diff --git a/README.md b/README.md index 5137aeb..b82aae7 100644 --- 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 index 54b7e9e..ecddb72 100644 --- 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