New stack printing in cli

This commit is contained in:
neauoire 2023-10-31 11:13:27 -07:00
parent 4d3974faad
commit 13b3496f4e
4 changed files with 17 additions and 14 deletions

View File

@ -66,7 +66,6 @@ JMP2r
.cat/timer LDZ INC [ DUP ] .cat/timer STZ .cat/timer LDZ INC [ DUP ] .cat/timer STZ
#04 SFT draw-tail #04 SFT draw-tail
draw-cursor draw-cursor
.Mouse/state DEI #00 EQU ?{ #ff #00 .Mouse/state DEO }
BRK BRK

View File

@ -96,18 +96,20 @@ screen_debugger(Uxn *u)
int i; int i;
for(i = 0; i < 0x08; i++) { for(i = 0; i < 0x08; i++) {
Uint8 pos = u->wst.ptr - 4 + 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 : Uint8 color = i > 4 ? 0x01 : !pos ? 0xc :
i == 4 ? 0x8 : i == 4 ? 0x8 :
0x2); 0x2;
draw_byte(u->wst.dat[pos], i * 0x18 + 0x8, uxn_screen.height - 0x18, color);
} }
for(i = 0; i < 0x08; i++) { for(i = 0; i < 0x08; i++) {
Uint8 pos = u->rst.ptr - 4 + 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 : Uint8 color = i > 4 ? 0x01 : !pos ? 0xc :
i == 4 ? 0x8 : i == 4 ? 0x8 :
0x2); 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); 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]); draw_byte(u->ram[i], (i & 0x7) * 0x18 + 0x8, ((i >> 3) << 3) + 0x8, 1 + !!u->ram[i]);
} }

View File

@ -36,11 +36,13 @@ static void
system_print(Stack *s, char *name) system_print(Stack *s, char *name)
{ {
Uint8 i; Uint8 i;
fprintf(stderr, "<%s>", name); fprintf(stderr, "%s ", name);
for(i = 0; i < s->ptr; i++) for(i = 0; i < 9; i++) {
fprintf(stderr, " %02x", s->dat[i]); Uint8 pos = s->ptr - 4 + i;
if(!i) fprintf(stderr, !pos ? "[%02x]" : i == 4 ? "<%02x>" :
fprintf(stderr, " empty"); " %02x ",
s->dat[pos]);
}
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }

View File

@ -70,7 +70,7 @@ main(int argc, char **argv)
return system_error("usage", "uxncli [-v] file.rom [args..]"); return system_error("usage", "uxncli [-v] file.rom [args..]");
/* Read flags */ /* Read flags */
if(argv[i][0] == '-' && argv[i][1] == 'v') 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++])) if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
return system_error("Init", "Failed to initialize uxn."); return system_error("Init", "Failed to initialize uxn.");
/* Game Loop */ /* Game Loop */