0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-22 22:05:11 +00:00

Improved stack printing

This commit is contained in:
Devine Lu Linvega 2024-02-28 09:03:56 -08:00
parent 24299dcc58
commit c7ce358d0d

View file

@ -33,20 +33,12 @@ system_load(Uxn *u, char *filename)
} }
static void static void
system_print(Stack *s, char *name) system_print(Stack *s)
{ {
Uint8 i; Uint8 i;
fprintf(stderr, "%s ", name); for(i = s->ptr - 7; i != s->ptr + 1; i++)
for(i = 0; i < 9; i++) { fprintf(stderr, "%02x%c", s->dat[i], i == 0 ? '|' : ' ');
Uint8 pos = s->ptr - 4 + i; fprintf(stderr, "< \n");
if(!pos)
fprintf(stderr, "[%02x]", s->dat[pos]);
else if(i == 4)
fprintf(stderr, "<%02x>", s->dat[pos]);
else
fprintf(stderr, " %02x ", s->dat[pos]);
}
fprintf(stderr, "\n");
} }
static void static void
@ -63,8 +55,8 @@ system_zero(Uxn *u, int soft)
void void
system_inspect(Uxn *u) system_inspect(Uxn *u)
{ {
system_print(&u->wst, "wst"); fprintf(stderr, "WST "), system_print(&u->wst);
system_print(&u->rst, "rst"); fprintf(stderr, "RST "), system_print(&u->rst);
} }
int int