Browse code

Print return stack in uxncli

neauoire authored on 29/08/2021 18:53:27
Showing 1 changed files
... ...
@@ -27,16 +27,26 @@ error(char *msg, const char *err)
27 27
 }
28 28
 
29 29
 static void
30
-inspect(Stack *wst)
30
+inspect(Uxn *u)
31 31
 {
32 32
 	Uint8 x, y;
33
-	fprintf(stderr, "\n\n");
34
-	for(y = 0; y < 0x08; ++y) {
33
+	fprintf(stderr, "\nWorking Stack\n");
34
+	for(y = 0; y < 0x04; ++y) {
35 35
 		for(x = 0; x < 0x08; ++x) {
36 36
 			Uint8 p = y * 0x08 + x;
37 37
 			fprintf(stderr,
38
-				p == wst->ptr ? "[%02x]" : " %02x ",
39
-				wst->dat[p]);
38
+				p == u->wst.ptr ? "[%02x]" : " %02x ",
39
+				u->wst.dat[p]);
40
+		}
41
+		fprintf(stderr, "\n");
42
+	}
43
+	fprintf(stderr, "\nReturn Stack\n");
44
+	for(y = 0; y < 0x04; ++y) {
45
+		for(x = 0; x < 0x08; ++x) {
46
+			Uint8 p = y * 0x08 + x;
47
+			fprintf(stderr,
48
+				p == u->rst.ptr ? "[%02x]" : " %02x ",
49
+				u->rst.dat[p]);
40 50
 		}
41 51
 		fprintf(stderr, "\n");
42 52
 	}
... ...
@@ -56,7 +66,7 @@ system_talk(Device *d, Uint8 b0, Uint8 w)
56 66
 		switch(b0) {
57 67
 		case 0x2: d->u->wst.ptr = d->dat[0x2]; break;
58 68
 		case 0x3: d->u->rst.ptr = d->dat[0x3]; break;
59
-		case 0xe: inspect(&d->u->wst); break;
69
+		case 0xe: inspect(d->u); break;
60 70
 		case 0xf: d->u->ram.ptr = 0x0000; break;
61 71
 		}
62 72
 	}