Add power control port

This commit is contained in:
Ry 2022-10-27 22:32:16 -07:00
parent 3d1dff8495
commit 565685776a
2 changed files with 11 additions and 2 deletions

View File

@ -16,9 +16,11 @@
#include "keyboard.h" #include "keyboard.h"
#include "mouse.h" #include "mouse.h"
bool bus_requests_exit = false;
extern struct timeval rtc_current_time; extern struct timeval rtc_current_time;
extern uint32_t rtc_uptime; extern uint32_t rtc_uptime;
;
extern fox32_vm_t vm; extern fox32_vm_t vm;
extern disk_controller_t disk_controller; extern disk_controller_t disk_controller;
extern mouse_t mouse; extern mouse_t mouse;
@ -220,6 +222,12 @@ int bus_io_write(void *user, uint32_t value, uint32_t port) {
break; break;
}; };
case 0x80010000: { // power control port
if (value == 0) {
bus_requests_exit = true;
}
};
} }
return 0; return 0;

View File

@ -24,6 +24,7 @@
fox32_vm_t vm; fox32_vm_t vm;
extern bool bus_requests_exit;
extern disk_controller_t disk_controller; extern disk_controller_t disk_controller;
uint32_t tick_start; uint32_t tick_start;
@ -95,7 +96,7 @@ int main(int argc, char *argv[]) {
tick_start = SDL_GetTicks(); tick_start = SDL_GetTicks();
tick_end = SDL_GetTicks(); tick_end = SDL_GetTicks();
while (!done) { while (!done && !bus_requests_exit) {
main_loop(); main_loop();
tick_end = SDL_GetTicks(); tick_end = SDL_GetTicks();