From 13b3496f4e04a39e48c343f338e65a4dcd524a1f Mon Sep 17 00:00:00 2001 From: neauoire Date: Tue, 31 Oct 2023 11:13:27 -0700 Subject: [PATCH] New stack printing in cli --- etc/polycat.tal | 1 - src/devices/screen.c | 16 +++++++++------- src/devices/system.c | 12 +++++++----- src/uxncli.c | 2 +- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/etc/polycat.tal b/etc/polycat.tal index a661ce4..e4d8152 100644 --- a/etc/polycat.tal +++ b/etc/polycat.tal @@ -66,7 +66,6 @@ JMP2r .cat/timer LDZ INC [ DUP ] .cat/timer STZ #04 SFT draw-tail draw-cursor - .Mouse/state DEI #00 EQU ?{ #ff #00 .Mouse/state DEO } BRK diff --git a/src/devices/screen.c b/src/devices/screen.c index f0b58aa..27e56c1 100644 --- a/src/devices/screen.c +++ b/src/devices/screen.c @@ -96,18 +96,20 @@ screen_debugger(Uxn *u) int i; for(i = 0; i < 0x08; i++) { Uint8 pos = u->wst.ptr - 4 + i; - draw_byte(u->wst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x18, i > 4 ? 0x01 : !pos ? 0xc : - i == 4 ? 0x8 : - 0x2); + Uint8 color = i > 4 ? 0x01 : !pos ? 0xc : + i == 4 ? 0x8 : + 0x2; + draw_byte(u->wst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x18, color); } for(i = 0; i < 0x08; i++) { Uint8 pos = u->rst.ptr - 4 + i; - draw_byte(u->rst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x10, i > 4 ? 0x01 : !pos ? 0xc : - i == 4 ? 0x8 : - 0x2); + Uint8 color = i > 4 ? 0x01 : !pos ? 0xc : + i == 4 ? 0x8 : + 0x2; + draw_byte(u->rst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x10, color); } screen_blit(uxn_screen.fg, arrow, 0, 0x68, uxn_screen.height - 0x20, 3, 0, 0, 0); - for(i = 0; i < 0x40; i++) + for(i = 0; i < 0x20; i++) draw_byte(u->ram[i], (i & 0x7) * 0x18 + 0x8, ((i >> 3) << 3) + 0x8, 1 + !!u->ram[i]); } diff --git a/src/devices/system.c b/src/devices/system.c index 7491572..819dac5 100644 --- a/src/devices/system.c +++ b/src/devices/system.c @@ -36,11 +36,13 @@ static void system_print(Stack *s, char *name) { Uint8 i; - fprintf(stderr, "<%s>", name); - for(i = 0; i < s->ptr; i++) - fprintf(stderr, " %02x", s->dat[i]); - if(!i) - fprintf(stderr, " empty"); + fprintf(stderr, "%s ", name); + for(i = 0; i < 9; i++) { + Uint8 pos = s->ptr - 4 + i; + fprintf(stderr, !pos ? "[%02x]" : i == 4 ? "<%02x>" : + " %02x ", + s->dat[pos]); + } fprintf(stderr, "\n"); } diff --git a/src/uxncli.c b/src/uxncli.c index eee1a13..82d42f3 100644 --- a/src/uxncli.c +++ b/src/uxncli.c @@ -70,7 +70,7 @@ main(int argc, char **argv) return system_error("usage", "uxncli [-v] file.rom [args..]"); /* Read flags */ if(argv[i][0] == '-' && argv[i][1] == 'v') - return system_version("Uxncli - Console Varvara Emulator", "30 Oct 2023"); + return system_version("Uxncli - Console Varvara Emulator", "31 Oct 2023"); if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++])) return system_error("Init", "Failed to initialize uxn."); /* Game Loop */