uxn

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

commit 1704e23b4d31072cffd826e6d3ed10f3848585d7
parent 19322f1d234a0b0600db7309a8be7ec6edb342d6
Author: neauoire <aliceffekt@gmail.com>
Date:   Mon, 16 Aug 2021 07:22:53 -0700

Fixed issue with uxncli debugger

Diffstat:
MREADME.md | 7++++++-
Msrc/uxncli.c | 12+++++-------
2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md @@ -59,7 +59,12 @@ To start the rom, point the emulator to the newly created rom: bin/uxnemu bin/life.rom ``` -You can also use the emulator without graphics by using `uxncli`. You can find additional roms [here](https://sr.ht/~rabbits/uxn/sources). +You can also use the emulator without graphics by using `uxncli`. You can find additional roms [here](https://sr.ht/~rabbits/uxn/sources). If you only wish to build `uxncli` + +``` +cc src/uxn.c -DNDEBUG -Os -g0 -s src/uxncli.c -o bin/uxncli + +``` ### I/O diff --git a/src/uxncli.c b/src/uxncli.c @@ -27,7 +27,7 @@ error(char *msg, const char *err) } static void -inspect(Uint8 *stack, Uint8 wptr, Uint8 rptr, Uint8 *memory) +inspect(Stack *wst) { Uint8 x, y; fprintf(stderr, "\n\n"); @@ -35,8 +35,8 @@ inspect(Uint8 *stack, Uint8 wptr, Uint8 rptr, Uint8 *memory) for(x = 0; x < 0x08; ++x) { Uint8 p = y * 0x08 + x; fprintf(stderr, - p == wptr ? "[%02x]" : " %02x ", - stack[p]); + p == wst->ptr ? "[%02x]" : " %02x ", + wst->dat[p]); } fprintf(stderr, "\n"); } @@ -56,6 +56,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 0xf: d->u->ram.ptr = 0x0000; break; } } @@ -132,11 +133,8 @@ static void run(Uxn *u) { uxn_eval(u, PAGE_PROGRAM); - while(read(0, &devconsole->dat[0x2], 1) > 0) { - if(devsystem->dat[0xe]) - inspect(u->wst.dat, u->wst.ptr, u->rst.ptr, u->ram.dat); + while(read(0, &devconsole->dat[0x2], 1) > 0) uxn_eval(u, mempeek16(devconsole->dat, 0)); - } } static int