Improved stack printing

This commit is contained in:
Devine Lu Linvega 2024-02-28 09:04:21 -08:00
parent 6b207ed328
commit 6e7360ee71
1 changed files with 3 additions and 4 deletions

View File

@ -44,10 +44,9 @@ 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, s->ptr);
for(i = s->ptr - 7; i != s->ptr + 1; i++) for(i = s->ptr - 7; i != s->ptr + 1; i++)
fprintf(stderr, "%02x%c", s->dat[i], i == 0 ? '|' : ' '); fprintf(stderr, "%02x%c", s->dat[i], i == 0 ? '|' : ' ');
fprintf(stderr, "< \n"); fprintf(stderr, "< \n");
@ -64,8 +63,8 @@ system_error(char *msg, const char *err)
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