commit a53d6f7

Devine Lu Linvega  ·  2026-01-07 18:12:14 +0000 UTC
parent 307d3c1
Moved screen ports to handlers
1 files changed,  +38, -32
+38, -32
  1@@ -1025,37 +1025,27 @@ void system_deo_wst(void) { ptr[0] = dev[4]; }
  2 void system_deo_rst(void) { ptr[0] = dev[4]; }
  3 void system_deo_colorize(void) { screen_colorize(); }
  4 void system_deo_print(void) { system_print("WST", 0), system_print("RST", 1); }
  5-
  6 void console_deo_vector(void) { console_vector = PEEK2(&dev[0x10]); }
  7 void console_deo_stdout(void) { fputc(dev[0x18], stdout), fflush(stdout); }
  8 void console_deo_stderr(void) { fputc(dev[0x19], stderr), fflush(stderr); }
  9 void console_deo_hb(void) { fprintf(stderr, "%02x", dev[0x1a]); }
 10 void console_deo_lb(void) { fprintf(stderr, "%02x", dev[0x1b]); }
 11 void console_deo_fork(void) { console_start_fork(); }
 12+void screen_deo_vector(void) { screen_vector = PEEK2(&dev[0x20]); }
 13+void screen_deo_width(void) { screen_resize(PEEK2(&dev[0x22]) & 0xfff, screen_height & 0xfff); }
 14+void screen_deo_height(void) { screen_resize(screen_width & 0xfff, PEEK2(&dev[0x24]) & 0xfff); }
 15+void screen_deo_auto(void) { rMX = dev[0x26] & 0x1, rMY = dev[0x26] & 0x2, rMA = dev[0x26] & 0x4, rML = dev[0x26] >> 4, rDX = rMX << 3, rDY = rMY << 2; }
 16+void screen_deo_x(void) { rX = (dev[0x28] << 8) | dev[0x29], rX = TWOS(rX); }
 17+void screen_deo_y(void) { rY = (dev[0x2a] << 8) | dev[0x2b], rY = TWOS(rY); }
 18+void screen_deo_addr(void) { rA = (dev[0x2c] << 8) | dev[0x2d]; }
 19+void screen_deo_pixel(void) { screen_draw_pixel(); }
 20+void screen_deo_sprite(void) { screen_draw_sprite(); }
 21 
 22 /* clang-format on */
 23 
 24 void
 25 init_devices(void)
 26 {
 27-	/* DEO */
 28-	deo_handlers[0x03] = system_deo_expansion;
 29-	deo_handlers[0x04] = system_deo_wst;
 30-	deo_handlers[0x05] = system_deo_rst;
 31-	deo_handlers[0x08] = system_deo_colorize;
 32-	deo_handlers[0x09] = system_deo_colorize;
 33-	deo_handlers[0x0a] = system_deo_colorize;
 34-	deo_handlers[0x0b] = system_deo_colorize;
 35-	deo_handlers[0x0c] = system_deo_colorize;
 36-	deo_handlers[0x0d] = system_deo_colorize;
 37-	deo_handlers[0x0e] = system_deo_print;
 38-	deo_handlers[0x11] = console_deo_vector;
 39-	deo_handlers[0x18] = console_deo_stdout;
 40-	deo_handlers[0x19] = console_deo_stderr;
 41-	deo_handlers[0x1a] = console_deo_hb;
 42-	deo_handlers[0x1b] = console_deo_lb;
 43-	deo_handlers[0x1f] = console_deo_fork;
 44-
 45 	/* DEI */
 46 	dei_handlers[0x04] = system_dei_wst;
 47 	dei_handlers[0x05] = system_dei_rst;
 48@@ -1078,6 +1068,35 @@ init_devices(void)
 49 	dei_handlers[0xc8] = datetime_dei_ydayhb;
 50 	dei_handlers[0xc9] = datetime_dei_ydaylb;
 51 	dei_handlers[0xca] = datetime_dei_dst;
 52+	/* DEO */
 53+	deo_handlers[0x03] = system_deo_expansion;
 54+	deo_handlers[0x04] = system_deo_wst;
 55+	deo_handlers[0x05] = system_deo_rst;
 56+	deo_handlers[0x08] = system_deo_colorize;
 57+	deo_handlers[0x09] = system_deo_colorize;
 58+	deo_handlers[0x0a] = system_deo_colorize;
 59+	deo_handlers[0x0b] = system_deo_colorize;
 60+	deo_handlers[0x0c] = system_deo_colorize;
 61+	deo_handlers[0x0d] = system_deo_colorize;
 62+	deo_handlers[0x0e] = system_deo_print;
 63+	deo_handlers[0x11] = console_deo_vector;
 64+	deo_handlers[0x18] = console_deo_stdout;
 65+	deo_handlers[0x19] = console_deo_stderr;
 66+	deo_handlers[0x1a] = console_deo_hb;
 67+	deo_handlers[0x1b] = console_deo_lb;
 68+	deo_handlers[0x1f] = console_deo_fork;
 69+	deo_handlers[0x21] = screen_deo_vector;
 70+	deo_handlers[0x23] = screen_deo_width;
 71+	deo_handlers[0x25] = screen_deo_height;
 72+	deo_handlers[0x26] = screen_deo_auto;
 73+	deo_handlers[0x28] = screen_deo_x;
 74+	deo_handlers[0x29] = screen_deo_x;
 75+	deo_handlers[0x2a] = screen_deo_y;
 76+	deo_handlers[0x2b] = screen_deo_y;
 77+	deo_handlers[0x2c] = screen_deo_addr;
 78+	deo_handlers[0x2d] = screen_deo_addr;
 79+	deo_handlers[0x2e] = screen_deo_pixel;
 80+	deo_handlers[0x2f] = screen_deo_sprite;
 81 }
 82 
 83 Uint8
 84@@ -1098,19 +1117,6 @@ emu_deo(const Uint8 port, const Uint8 value)
 85 	}
 86 
 87 	switch(port) {
 88-	/* Screen */
 89-	case 0x21: screen_vector = PEEK2(&dev[0x20]); return;
 90-	case 0x23: screen_resize(PEEK2(&dev[0x22]) & 0xfff, screen_height & 0xfff); return;
 91-	case 0x25: screen_resize(screen_width & 0xfff, PEEK2(&dev[0x24]) & 0xfff); return;
 92-	case 0x26: rMX = dev[0x26] & 0x1, rMY = dev[0x26] & 0x2, rMA = dev[0x26] & 0x4, rML = dev[0x26] >> 4, rDX = rMX << 3, rDY = rMY << 2; return;
 93-	case 0x28:
 94-	case 0x29: rX = (dev[0x28] << 8) | dev[0x29], rX = TWOS(rX); return;
 95-	case 0x2a:
 96-	case 0x2b: rY = (dev[0x2a] << 8) | dev[0x2b], rY = TWOS(rY); return;
 97-	case 0x2c:
 98-	case 0x2d: rA = (dev[0x2c] << 8) | dev[0x2d]; return;
 99-	case 0x2e: screen_draw_pixel(); return;
100-	case 0x2f: screen_draw_sprite(); return;
101 	/* Controller */
102 	case 0x81: controller_vector = PEEK2(&dev[0x80]); return;
103 	/* Mouse */