(uxn.c) Simple branching value
This commit is contained in:
parent
21dfea7890
commit
91257363c2
16
src/uxn.c
16
src/uxn.c
|
@ -38,16 +38,14 @@ uxn_eval(Uxn *u, Uint16 pc)
|
||||||
else
|
else
|
||||||
sp = &s->ptr;
|
sp = &s->ptr;
|
||||||
/* Opcodes */
|
/* Opcodes */
|
||||||
switch(opc - (!opc * (ins >> 5))) {
|
switch(opc ? opc : ins) {
|
||||||
/* Immediate */
|
/* Immediate */
|
||||||
case -0x0: /* BRK */ return 1;
|
case 0x00: /* BRK */ return 1;
|
||||||
case -0x1: /* JCI */ POP1(b) if(!b) { pc += 2; break; } /* else fallthrough */
|
case 0x20: /* JCI */ POP1(b) if(!b) { pc += 2; break; } /* else fallthrough */
|
||||||
case -0x2: /* JMI */ pc += PEEK2(ram + pc) + 2; break;
|
case 0x40: /* JMI */ pc += PEEK2(ram + pc) + 2; break;
|
||||||
case -0x3: /* JSI */ PUSH2(pc + 2) pc += PEEK2(ram + pc) + 2; break;
|
case 0x60: /* JSI */ PUSH2(pc + 2) pc += PEEK2(ram + pc) + 2; break;
|
||||||
case -0x4: /* LIT */
|
case 0x80: case 0xc0: /* LIT */ PUSH1(ram[pc++]) break;
|
||||||
case -0x6: /* LITr */ PUSH1(ram[pc++]) break;
|
case 0xa0: case 0xe0: /* LIT2 */ PUSH1(ram[pc++]) PUSH1(ram[pc++]) break;
|
||||||
case -0x5: /* LIT2 */
|
|
||||||
case -0x7: /* LIT2r */ PUSH1(ram[pc++]) PUSH1(ram[pc++]) break;
|
|
||||||
/* ALU */
|
/* ALU */
|
||||||
case 0x01: /* INC */ POPx(a) PUSHx(a + 1) break;
|
case 0x01: /* INC */ POPx(a) PUSHx(a + 1) break;
|
||||||
case 0x02: /* POP */ POPx(a) break;
|
case 0x02: /* POP */ POPx(a) break;
|
||||||
|
|
Loading…
Reference in New Issue