Removed indirection in uxn_eval

This commit is contained in:
Devine Lu Linvega 2024-06-29 11:38:41 -08:00
parent cfc8349d54
commit 7cff7b19d1
2 changed files with 7 additions and 8 deletions

View File

@ -13,11 +13,11 @@ dest:
@ mkdir -p bin
run: all bin/uxnasm bin/uxncli bin/uxn11
@ bin/uxn11
test: bin/uxnasm bin/uxncli bin/uxn11
test: all
@ bin/uxnasm -v && ./bin/uxncli -v && ./bin/uxn11 -v
@ bin/uxnasm etc/opctest.tal bin/opctest.rom
@ bin/uxncli bin/opctest.rom
install: all bin/uxnasm bin/uxncli bin/uxn11
install: all
@ cp bin/uxn11 bin/uxnasm bin/uxncli ~/bin/
uninstall:
@ rm -f ~/bin/uxn11 ~/bin/uxnasm ~/bin/uxncli
@ -31,6 +31,6 @@ clean:
bin/uxnasm: src/uxnasm.c
@ cc ${RELEASE_flags} ${CFLAGS} src/uxnasm.c -o bin/uxnasm
bin/uxncli: ${CLI_src} src/uxncli.c
@ cc ${DEBUG_flags} ${CFLAGS} ${CLI_src} src/uxncli.c -lutil -o bin/uxncli
@ cc ${RELEASE_flags} ${CFLAGS} ${CLI_src} src/uxncli.c -lutil -o bin/uxncli
bin/uxn11: ${EMU_src} src/uxn11.c
@ cc ${DEBUG_flags} ${CFLAGS} ${EMU_src} src/uxn11.c -lX11 -lutil -o bin/uxn11
@ cc ${RELEASE_flags} ${CFLAGS} ${EMU_src} src/uxn11.c -lX11 -lutil -o bin/uxn11

View File

@ -30,20 +30,19 @@ WITH REGARD TO THIS SOFTWARE.
#define T2_(v) { r = (v); T = r; N = r >> 8; }
#define N2_(v) { r = (v); L = r; X = r >> 8; }
#define L2_(v) { r = (v); Y = r; Z = r >> 8; }
#define FLIP { s = ins & 0x40 ? &u->wst : &u->rst; }
#define FLIP { s = ins & 0x40 ? &uxn.wst : &uxn.rst; }
#define SHIFT(y) { s->ptr += (y); }
#define SET(x, y) { SHIFT((ins & 0x80) ? x + y : y) }
int
uxn_eval(Uint16 pc)
{
Uxn *u = &uxn;
Uint16 t, n, l, r;
Uint8 *rr;
if(!pc || u->dev[0x0f]) return 0;
if(!pc || uxn.dev[0x0f]) return 0;
for(;;) {
Uint8 ins = uxn.ram[pc++];
Stack *s = ins & 0x40 ? &u->rst : &u->wst;
Stack *s = ins & 0x40 ? &uxn.rst : &uxn.wst;
switch(ins & 0x3f) {
/* IMM */
case 0x00: case 0x20: