Removed device specific addresses from vm
h3rald h3rald@h3rald.com
Sun, 26 Jul 2026 15:26:43 +0200
1 files changed,
4 insertions(+),
23 deletions(-)
jump to
M
xywrun.c
→
xywrun.c
@@ -28,15 +28,6 @@ #define SYSTEM_PAGE 0xff02
#define SYSTEM_RANDOM 0xff03 #define SYSTEM_ON_ERROR 0xff04 -/* Terminal device addresses */ -#define TERMINAL_INPUT 0xff10 -#define TERMINAL_ON_KEYPRESS 0xff12 -#define TERMINAL_ON_ARGUMENT 0xff14 - -/* Clock device addresses */ -#define CLOCK_TIMER 0xff28 -#define CLOCK_ON_TIMER_ELAPSED 0xff2a - typedef enum { XYW_ERROR_NONE = 0,@@ -609,20 +600,10 @@ restore_snapshot(&exec_stack[--exec_stack_depth]);
} } -//// Event dispatch (WAITING state) - -// Addresses of event handler slots — used by HLT to decide whether to enter WAITING. -static const xyw_word event_handler_addrs[] = { - TERMINAL_ON_ARGUMENT, - TERMINAL_ON_KEYPRESS, - CLOCK_ON_TIMER_ELAPSED, -}; -#define NUM_EVENT_HANDLERS (sizeof(event_handler_addrs) / sizeof(event_handler_addrs[0])) - -static int has_event_handlers(void) +static int has_poll_devices(void) { - for (size_t i = 0; i < NUM_EVENT_HANDLERS; i++) - if (XYW_PEEKW(&xyw_memory[event_handler_addrs[i]])) + for (int i = 0; i < XYW_TOTAL_DEVICES; i++) + if (xyw_devices[i].poll) return 1; return 0; }@@ -694,7 +675,7 @@ {
// clang-format off /* HLT */ case 0x00: xyw_memory[SYSTEM_STATE] &= ~SYSTEM_STATE_RUNNING; - if (has_event_handlers()) + if (has_poll_devices()) { xyw_memory[SYSTEM_STATE] |= SYSTEM_STATE_WAITING; }