uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit c7ce358d0d43e444b5826aad1d920553d19a4646
parent 24299dcc589869f5918d09ce8db5c5394fc62346
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Wed, 28 Feb 2024 09:03:56 -0800

Improved stack printing

Diffstat:
Msrc/devices/system.c | 20++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)

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