Removed PEEK2 macro
This commit is contained in:
parent
1a6df2e48f
commit
4904ca661b
10
ref/uxn.c
10
ref/uxn.c
|
@ -1,7 +1,5 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define PEEK2(d) (*(d) << 8 | (d)[1])
|
|
||||||
|
|
||||||
typedef unsigned char Uint8;
|
typedef unsigned char Uint8;
|
||||||
typedef signed char Sint8;
|
typedef signed char Sint8;
|
||||||
typedef unsigned short Uint16;
|
typedef unsigned short Uint16;
|
||||||
|
@ -20,9 +18,9 @@ int uxn_eval(Uxn *u, Uint16 pc);
|
||||||
int
|
int
|
||||||
console_input(Uxn *u, char c, int type)
|
console_input(Uxn *u, char c, int type)
|
||||||
{
|
{
|
||||||
Uint8 *d = &u->dev[0x10];
|
Uint16 vector = u->dev[0x10] << 8 | u->dev[0x11];
|
||||||
d[0x2] = c, d[0x7] = type;
|
u->dev[0x12] = c, u->dev[0x17] = type;
|
||||||
return uxn_eval(u, PEEK2(d));
|
return uxn_eval(u, vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint8
|
Uint8
|
||||||
|
@ -71,7 +69,7 @@ uxn_eval(Uxn *u, Uint16 pc)
|
||||||
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 */ a = ram[pc++] << 8 | ram[pc++]; pc += a; 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 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;
|
||||||
} break;
|
} break;
|
||||||
|
|
Loading…
Reference in New Issue