From 9d0803e99f6549a9db621170edc2cbc2813b9ba1 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sat, 29 Jun 2024 15:37:43 -0800 Subject: [PATCH] Removed indirection in screen device --- src/devices/screen.c | 18 +++++++++--------- src/devices/screen.h | 2 +- src/uxn11.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/devices/screen.c b/src/devices/screen.c index de99a19..2fb7200 100644 --- a/src/devices/screen.c +++ b/src/devices/screen.c @@ -256,20 +256,20 @@ screen_dei(Uint8 addr) } void -screen_deo(Uint8 *d, Uint8 port) +screen_deo(Uint8 port) { switch(port) { - case 0x3: screen_resize(PEEK2(d + 2), uxn_screen.height, uxn_screen.scale); return; - case 0x5: screen_resize(uxn_screen.width, PEEK2(d + 4), uxn_screen.scale); return; - case 0x6: rMX = d[0x6] & 0x1, rMY = d[0x6] & 0x2, rMA = d[0x6] & 0x4, rML = d[0x6] >> 4, rDX = rMX << 3, rDY = rMY << 2; return; + case 0x3: screen_resize(PEEK2(&uxn.dev[0x22]), uxn_screen.height, uxn_screen.scale); return; + case 0x5: screen_resize(uxn_screen.width, PEEK2(&uxn.dev[0x24]), uxn_screen.scale); return; + case 0x6: rMX = uxn.dev[0x26] & 0x1, rMY = uxn.dev[0x26] & 0x2, rMA = uxn.dev[0x26] & 0x4, rML = uxn.dev[0x26] >> 4, rDX = rMX << 3, rDY = rMY << 2; return; case 0x8: - case 0x9: rX = (d[0x8] << 8) | d[0x9], rX = twos(rX); return; + case 0x9: rX = (uxn.dev[0x28] << 8) | uxn.dev[0x29], rX = twos(rX); return; case 0xa: - case 0xb: rY = (d[0xa] << 8) | d[0xb], rY = twos(rY); return; + case 0xb: rY = (uxn.dev[0x2a] << 8) | uxn.dev[0x2b], rY = twos(rY); return; case 0xc: - case 0xd: rA = (d[0xc] << 8) | d[0xd]; return; + case 0xd: rA = (uxn.dev[0x2c] << 8) | uxn.dev[0x2d]; return; case 0xe: { - Uint8 ctrl = d[0xe]; + Uint8 ctrl = uxn.dev[0x2e]; Uint8 color = ctrl & 0x3; Uint8 *layer = ctrl & 0x40 ? uxn_screen.fg : uxn_screen.bg; /* fill mode */ @@ -299,7 +299,7 @@ screen_deo(Uint8 *d, Uint8 port) } case 0xf: { Uint8 i; - Uint8 ctrl = d[0xf]; + Uint8 ctrl = uxn.dev[0x2f]; Uint8 twobpp = !!(ctrl & 0x80); Uint8 color = ctrl & 0xf; Uint8 *layer = ctrl & 0x40 ? uxn_screen.fg : uxn_screen.bg; diff --git a/src/devices/screen.h b/src/devices/screen.h index f02039b..d6c5cd6 100644 --- a/src/devices/screen.h +++ b/src/devices/screen.h @@ -26,6 +26,6 @@ void screen_resize(Uint16 width, Uint16 height, int scale); void screen_redraw(); Uint8 screen_dei(Uint8 addr); -void screen_deo(Uint8 *d, Uint8 port); +void screen_deo(Uint8 port); #define twos(v) (v & 0x8000 ? (int)v - 0x10000 : (int)v) diff --git a/src/uxn11.c b/src/uxn11.c index 3f18107..d4417b3 100644 --- a/src/uxn11.c +++ b/src/uxn11.c @@ -68,7 +68,7 @@ emu_deo(Uint8 addr, Uint8 value) screen_palette(&uxn.dev[0x8]); break; case 0x10: console_deo(&uxn.dev[d], p); break; - case 0x20: screen_deo(&uxn.dev[d], p); break; + case 0x20: screen_deo(p); break; case 0xa0: file_deo(0, &uxn.dev[d], p); break; case 0xb0: file_deo(1, &uxn.dev[d], p); break; }