Removed a PEEK2 macro

This commit is contained in:
Devine Lu Linvega 2024-01-10 17:16:01 -08:00
parent 8cecc59f52
commit 1a6df2e48f
2 changed files with 2 additions and 3 deletions

View File

@ -5,7 +5,7 @@ all: bin/uxn
run: all run: all
@ wc -c bin/uxn @ wc -c bin/uxn
@ bin/uxn test.bin "Text from arg" @ bin/uxn test.bin "Text from arg"
test: test: all
@ bin/uxn opc-test.bin @ bin/uxn opc-test.bin
format: format:
@ clang-format -i uxn.c @ clang-format -i uxn.c

View File

@ -1,7 +1,6 @@
#include <stdio.h> #include <stdio.h>
#define PEEK2(d) (*(d) << 8 | (d)[1]) #define PEEK2(d) (*(d) << 8 | (d)[1])
#define POKE2(d, v) { *(d) = (v) >> 8; (d)[1] = (v); }
typedef unsigned char Uint8; typedef unsigned char Uint8;
typedef signed char Sint8; typedef signed char Sint8;
@ -71,7 +70,7 @@ uxn_eval(Uxn *u, Uint16 pc)
switch(ins) { switch(ins) {
case 0x00: /* BRK */ return 1; case 0x00: /* BRK */ return 1;
case 0x20: /* JCI */ POP1(b) if(!b) { pc += 2; break; } 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 0x60: /* JSI */ PUSH2(pc + 2) pc += PEEK2(ram + pc) + 2; break;
case 0x80: case 0xc0: /* LIT */ PUSH1(ram[pc++]) break; case 0x80: case 0xc0: /* LIT */ PUSH1(ram[pc++]) break;
case 0xa0: case 0xe0: /* LIT2 */ PUSH1(ram[pc++]) PUSH1(ram[pc++]) break; case 0xa0: case 0xe0: /* LIT2 */ PUSH1(ram[pc++]) PUSH1(ram[pc++]) break;