commit 2919c11cb9a24012afe3928fe2451c5264cc7108
parent 3da9352230159f1032c375bb1c88d35ccb2bc491
Author: neauoire <aliceffekt@gmail.com>
Date:   Sun, 29 Aug 2021 11:53:27 -0700
Print return stack in uxncli
Diffstat:
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/uxncli.c b/src/uxncli.c
@@ -27,16 +27,26 @@ error(char *msg, const char *err)
 }
 
 static void
-inspect(Stack *wst)
+inspect(Uxn *u)
 {
 	Uint8 x, y;
-	fprintf(stderr, "\n\n");
-	for(y = 0; y < 0x08; ++y) {
+	fprintf(stderr, "\nWorking Stack\n");
+	for(y = 0; y < 0x04; ++y) {
 		for(x = 0; x < 0x08; ++x) {
 			Uint8 p = y * 0x08 + x;
 			fprintf(stderr,
-				p == wst->ptr ? "[%02x]" : " %02x ",
-				wst->dat[p]);
+				p == u->wst.ptr ? "[%02x]" : " %02x ",
+				u->wst.dat[p]);
+		}
+		fprintf(stderr, "\n");
+	}
+	fprintf(stderr, "\nReturn Stack\n");
+	for(y = 0; y < 0x04; ++y) {
+		for(x = 0; x < 0x08; ++x) {
+			Uint8 p = y * 0x08 + x;
+			fprintf(stderr,
+				p == u->rst.ptr ? "[%02x]" : " %02x ",
+				u->rst.dat[p]);
 		}
 		fprintf(stderr, "\n");
 	}
@@ -56,7 +66,7 @@ system_talk(Device *d, Uint8 b0, Uint8 w)
 		switch(b0) {
 		case 0x2: d->u->wst.ptr = d->dat[0x2]; break;
 		case 0x3: d->u->rst.ptr = d->dat[0x3]; break;
-		case 0xe: inspect(&d->u->wst); break;
+		case 0xe: inspect(d->u); break;
 		case 0xf: d->u->ram.ptr = 0x0000; break;
 		}
 	}