From c8f47d8a0833afa96dd8501311f775bee5aadb25 Mon Sep 17 00:00:00 2001 From: Andrew Alderwick Date: Sun, 19 Sep 2021 22:53:45 +0100 Subject: [PATCH] Always return current PPU size when Screen/width,height is read --- src/uxnemu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uxnemu.c b/src/uxnemu.c index 3cd5f2e..534fe7e 100644 --- a/src/uxnemu.c +++ b/src/uxnemu.c @@ -343,8 +343,12 @@ console_talk(Device *d, Uint8 b0, Uint8 w) static int screen_talk(Device *d, Uint8 b0, Uint8 w) { - if(!w) - return 1; + if(!w) switch(b0) { + case 0x2: d->dat[0x2] = ppu.width >> 8; break; + case 0x3: d->dat[0x3] = ppu.width; break; + case 0x4: d->dat[0x4] = ppu.height >> 8; break; + case 0x5: d->dat[0x5] = ppu.height; break; + } else switch(b0) { case 0x3: @@ -583,10 +587,6 @@ main(int argc, char **argv) /* unused */ uxn_port(&u, 0xe, nil_talk); /* unused */ uxn_port(&u, 0xf, nil_talk); - /* Write screen size */ - poke16(devscreen->dat, 2, ppu.width); - poke16(devscreen->dat, 4, ppu.height); - run(&u); quit(); return 0;