Print stack in debugger

This commit is contained in:
neauoire 2021-03-22 19:24:05 -07:00
parent 82674a1484
commit 2c8ce4970e
2 changed files with 16 additions and 1 deletions

View File

@ -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' ];

View File

@ -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;
}