diff --git a/ref/makefile b/ref/makefile index dc8e654..39f4cdb 100644 --- a/ref/makefile +++ b/ref/makefile @@ -5,7 +5,7 @@ all: bin/uxn run: all @ wc -c bin/uxn @ bin/uxn test.bin "Text from arg" -test: +test: all @ bin/uxn opc-test.bin format: @ clang-format -i uxn.c diff --git a/ref/uxn.c b/ref/uxn.c index 12b06dc..be6410d 100644 --- a/ref/uxn.c +++ b/ref/uxn.c @@ -1,7 +1,6 @@ #include #define PEEK2(d) (*(d) << 8 | (d)[1]) -#define POKE2(d, v) { *(d) = (v) >> 8; (d)[1] = (v); } typedef unsigned char Uint8; typedef signed char Sint8; @@ -71,7 +70,7 @@ uxn_eval(Uxn *u, Uint16 pc) switch(ins) { case 0x00: /* BRK */ return 1; case 0x20: /* JCI */ POP1(b) if(!b) { pc += 2; break; } - case 0x40: /* JMI */ pc += PEEK2(ram + pc) + 2; break; + case 0x40: /* JMI */ a = ram[pc++] << 8 | ram[pc++]; pc += a; break; case 0x60: /* JSI */ PUSH2(pc + 2) pc += PEEK2(ram + pc) + 2; break; case 0x80: case 0xc0: /* LIT */ PUSH1(ram[pc++]) break; case 0xa0: case 0xe0: /* LIT2 */ PUSH1(ram[pc++]) PUSH1(ram[pc++]) break;