uxn

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

commit 2c8ce4970e7ed90ac067dd4963358bcba5acc89f
parent 82674a14844dc805ae8c75464a4f5d69ebf3e022
Author: neauoire <aliceffekt@gmail.com>
Date:   Mon, 22 Mar 2021 19:24:05 -0700

Print stack in debugger

Diffstat:
Mbuild.sh | 2+-
Msrc/debugger.c | 15+++++++++++++++
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; }