commit 9af4cf2
Devine Lu Linvega
·
2024-07-02 19:47:56 +0000 UTC
parent 44c5e17
(uxn.c) Let LITs fall through
1 files changed,
+8,
-9
+8,
-9
1@@ -22,21 +22,20 @@ WITH REGARD TO THIS SOFTWARE.
2 case 0xe0|opc: {int _2=1,_r=1,a,b,c; Stack *s = &uxn.rst; Uint8 kp = uxn.rst.ptr, *sp = &kp; body break;}\
3 }
4
5+#define FLP { s = _r ? &uxn.wst : &uxn.rst; }
6+#define JMI { pc += uxn.ram[pc++] << 8 | uxn.ram[pc++]; }
7 #define JMP(x) { if(_2) pc = (x); else pc += (Sint8)(x); }
8 #define POx(o) { if(_2) { PO2(o) } else PO1(o) }
9 #define PUx(y) { if(_2) { PU2(y) } else PU1(y) }
10-#define DEI(o, p) { if(_2) { o = (emu_dei(p) << 8) | emu_dei(p + 1); } else o = emu_dei(p); }
11-#define DEO(p, y) { if(_2) { emu_deo(p, y >> 8); emu_deo(p + 1, y); } else emu_deo(p, y); }
12-#define PEK(o, x, r) { if(_2) { r = (x); o = uxn.ram[r++] << 8 | uxn.ram[r]; } else o = uxn.ram[(x)]; }
13-#define POK(x, y, r) { if(_2) { r = (x); uxn.ram[r++] = y >> 8; uxn.ram[r] = y; } else uxn.ram[(x)] = (y); }
14 #define PO1(o) { o = s->dat[--*sp]; }
15 #define PO2(o) { o = s->dat[--*sp] | (s->dat[--*sp] << 8); }
16 #define PU1(y) { s->dat[s->ptr++] = (y); }
17 #define PU2(y) { tt = (y); s->dat[s->ptr++] = tt >> 0x8; s->dat[s->ptr++] = tt; }
18-#define FLP { s = _r ? &uxn.wst : &uxn.rst; }
19-
20 #define IMM(x, y) { uxn.x.dat[uxn.x.ptr++] = (y); }
21-#define JMI { pc += uxn.ram[pc++] << 8 | uxn.ram[pc++]; }
22+#define DEI(o, p) { if(_2) { o = (emu_dei(p) << 8) | emu_dei(p + 1); } else o = emu_dei(p); }
23+#define DEO(p, y) { if(_2) { emu_deo(p, y >> 8); emu_deo(p + 1, y); } else emu_deo(p, y); }
24+#define PEK(o, x, r) { if(_2) { r = (x); o = uxn.ram[r++] << 8 | uxn.ram[r]; } else o = uxn.ram[(x)]; }
25+#define POK(x, y, r) { if(_2) { r = (x); uxn.ram[r++] = y >> 8; uxn.ram[r] = y; } else uxn.ram[(x)] = (y); }
26
27 int
28 uxn_eval(Uint16 pc)
29@@ -50,10 +49,10 @@ uxn_eval(Uint16 pc)
30 /* JCI */ case 0x20: if(uxn.wst.dat[--uxn.wst.ptr]) { JMI break; } pc += 2; break;
31 /* JMI */ case 0x40: JMI break;
32 /* JSI */ case 0x60: tt = pc + 2; IMM(rst, tt >> 8) IMM(rst, tt) JMI break;
33+ /* LI2 */ case 0xa0: IMM(wst, uxn.ram[pc++])
34 /* LIT */ case 0x80: IMM(wst, uxn.ram[pc++]) break;
35- /* LI2 */ case 0xa0: IMM(wst, uxn.ram[pc++]) IMM(wst, uxn.ram[pc++]); break;
36+ /* L2r */ case 0xe0: IMM(rst, uxn.ram[pc++])
37 /* LIr */ case 0xc0: IMM(rst, uxn.ram[pc++]) break;
38- /* L2r */ case 0xe0: IMM(rst, uxn.ram[pc++]) IMM(rst, uxn.ram[pc++]) break;
39 /* INC */ OPC(0x01, POx(a) PUx(a + 1))
40 /* POP */ OPC(0x02, POx(a))
41 /* NIP */ OPC(0x03, POx(a) POx(b) PUx(a))