Removed PEEK2 macro

This commit is contained in:
Devine Lu Linvega 2024-01-10 17:20:37 -08:00
parent 1a6df2e48f
commit 4904ca661b
1 changed files with 4 additions and 6 deletions

View File

@ -1,7 +1,5 @@
#include <stdio.h>
#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;