Improved stack printing

This commit is contained in:
Devine Lu Linvega 2024-02-28 08:53:34 -08:00
parent c7d3a410ab
commit 6b207ed328
4 changed files with 12 additions and 16 deletions

View File

@ -12,11 +12,11 @@ all: dest bin/uxnasm bin/uxncli bin/uxn11
dest:
@ mkdir -p bin
run: all bin/uxnasm bin/uxncli bin/uxn11
@ ./bin/uxn11
@ bin/uxn11
test: bin/uxnasm bin/uxncli bin/uxn11
@ ./bin/uxnasm -v && ./bin/uxncli -v && ./bin/uxn11 -v
@ ./bin/uxnasm etc/opctest.tal bin/opctest.rom
@ ./bin/uxncli bin/opctest.rom
@ bin/uxnasm -v && ./bin/uxncli -v && ./bin/uxn11 -v
@ bin/uxnasm etc/opctest.tal bin/opctest.rom
@ bin/uxncli bin/opctest.rom
install: all bin/uxnasm bin/uxncli bin/uxn11
@ cp bin/uxn11 bin/uxnasm bin/uxncli ~/bin/
uninstall:

View File

@ -47,14 +47,10 @@ static void
system_print(Stack *s, char *name)
{
Uint8 i;
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");
fprintf(stderr, "%s ", name, s->ptr);
for(i = s->ptr - 7; i != s->ptr + 1; i++)
fprintf(stderr, "%02x%c", s->dat[i], i == 0 ? '|' : ' ');
fprintf(stderr, "< \n");
}
int
@ -68,8 +64,8 @@ system_error(char *msg, const char *err)
void
system_inspect(Uxn *u)
{
system_print(&u->wst, "wst");
system_print(&u->rst, "rst");
system_print(&u->wst, "WST");
system_print(&u->rst, "RST");
}
int

View File

@ -267,7 +267,7 @@ main(int argc, char **argv)
int i = 1;
char *rom;
if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
fprintf(stdout, "Uxn11 - Varvara Emulator, 22 Feb 2023.\n");
fprintf(stdout, "Uxn11 - Varvara Emulator, 28 Feb 2023.\n");
i++;
}
rom = i == argc ? "boot.rom" : argv[i++];

View File

@ -71,7 +71,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", "15 Feb 2024");
return system_version("Uxncli - Console Varvara Emulator", "28 Feb 2024");
if(!system_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
return system_error("Init", "Failed to initialize uxn.");
/* Game Loop */