From 4904ca661b5e1c9063de0ae7fd41c764b1336599 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 10 Jan 2024 17:20:37 -0800 Subject: [PATCH] Removed PEEK2 macro --- ref/uxn.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ref/uxn.c b/ref/uxn.c index be6410d..f6dee7a 100644 --- a/ref/uxn.c +++ b/ref/uxn.c @@ -1,7 +1,5 @@ #include -#define PEEK2(d) (*(d) << 8 | (d)[1]) - typedef unsigned char Uint8; typedef signed char Sint8; typedef unsigned short Uint16; @@ -20,9 +18,9 @@ int uxn_eval(Uxn *u, Uint16 pc); int console_input(Uxn *u, char c, int type) { - Uint8 *d = &u->dev[0x10]; - d[0x2] = c, d[0x7] = type; - return uxn_eval(u, PEEK2(d)); + Uint16 vector = u->dev[0x10] << 8 | u->dev[0x11]; + u->dev[0x12] = c, u->dev[0x17] = type; + return uxn_eval(u, vector); } Uint8 @@ -71,7 +69,7 @@ uxn_eval(Uxn *u, Uint16 pc) case 0x00: /* BRK */ return 1; case 0x20: /* JCI */ POP1(b) if(!b) { 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 0x60: /* JSI */ PUSH2(pc + 2) a = ram[pc++] << 8 | ram[pc++]; pc += a; break; case 0x80: case 0xc0: /* LIT */ PUSH1(ram[pc++]) break; case 0xa0: case 0xe0: /* LIT2 */ PUSH1(ram[pc++]) PUSH1(ram[pc++]) break; } break;