commit 2c8ce4970e7ed90ac067dd4963358bcba5acc89f
parent 82674a14844dc805ae8c75464a4f5d69ebf3e022
Author: neauoire <aliceffekt@gmail.com>
Date: Mon, 22 Mar 2021 19:24:05 -0700
Print stack in debugger
Diffstat:
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/build.sh b/build.sh
@@ -28,7 +28,7 @@ else
fi
echo "Assembling.."
-./bin/assembler projects/examples/dev.console.usm bin/boot.rom
+./bin/assembler projects/software/left.usm bin/boot.rom
echo "Running.."
if [ "${2}" = '--cli' ];
diff --git a/src/debugger.c b/src/debugger.c
@@ -22,6 +22,19 @@ error(char *msg, const char *err)
return 0;
}
+void
+printstack(Stack *s)
+{
+ Uint8 x, y;
+ for(y = 0; y < 0x08; ++y) {
+ for(x = 0; x < 0x08; ++x) {
+ Uint8 p = y * 0x08 + x;
+ printf(p == s->ptr ? "[%02x]" : " %02x ", s->dat[p]);
+ }
+ printf("\n");
+ }
+}
+
#pragma mark - Devices
Uint8
@@ -81,9 +94,11 @@ start(Uxn *u)
printf("RESET --------\n");
if(!evaluxn(u, u->vreset))
return error("Reset", "Failed");
+ printstack(&u->wst);
printf("FRAME --------\n");
if(!evaluxn(u, u->vframe))
return error("Frame", "Failed");
+ printstack(&u->wst);
return 1;
}