commit 8eae101
Devine Lu Linvega
·
2024-08-05 21:02:02 +0000 UTC
parent 4f03030
Tiny change to macro arg order
3 files changed,
+9,
-7
+7,
-5
1@@ -22,6 +22,8 @@ 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+/* Microcode */
6+
7 #define FLP { s = _r ? &uxn.wst : &uxn.rst; }
8 #define JMI { pc += uxn.ram[pc++] << 8 | uxn.ram[pc++]; }
9 #define JMP(x) { if(_2) pc = (x); else pc += (Sint8)(x); }
10@@ -30,12 +32,12 @@ WITH REGARD TO THIS SOFTWARE.
11 #define PO2(o) { o = s->dat[--*sp] | (s->dat[--*sp] << 8); }
12 #define PUx(y) { if(_2) { PU2(y) } else PU1(y) }
13 #define PU1(y) { s->dat[s->ptr++] = (y); }
14-#define PU2(y) { tt = (y); s->dat[s->ptr++] = tt >> 0x8; s->dat[s->ptr++] = tt; }
15+#define PU2(y) { tt = (y); PU1(tt >> 8) PU1(tt) }
16 #define IMM(x, y) { uxn.x.dat[uxn.x.ptr++] = (y); }
17-#define DEI(o, p) { if(_2) { o = (emu_dei(p) << 8) | emu_dei(p + 1); } else o = emu_dei(p); }
18-#define DEO(p, y) { if(_2) { emu_deo(p, y >> 8); emu_deo(p + 1, y); } else emu_deo(p, y); }
19+#define DEI(p, o) { if(_2) { o = (emu_dei(p) << 8) | emu_dei(p + 1); } else o = emu_dei(p); }
20+#define DEO(p, y) { if(_2) { emu_deo(p, y >> 8), emu_deo(p + 1, y); } else emu_deo(p, y); }
21 #define PEK(o, x, r) { if(_2) { r = (x); o = uxn.ram[r++] << 8 | uxn.ram[r]; } else o = uxn.ram[(x)]; }
22-#define POK(x, y, r) { if(_2) { r = (x); uxn.ram[r++] = y >> 8; uxn.ram[r] = y; } else uxn.ram[(x)] = (y); }
23+#define POK(x, y, r) { if(_2) { r = (x); uxn.ram[r++] = y >> 8, uxn.ram[r] = y; } else uxn.ram[(x)] = (y); }
24
25 int
26 uxn_eval(Uint16 pc)
27@@ -74,7 +76,7 @@ uxn_eval(Uint16 pc)
28 /* STR */ OPC(0x13, PO1(a) POx(b) POK(pc + (Sint8)a, b, tt))
29 /* LDA */ OPC(0x14, PO2(a) PEK(b, a, tt) PUx(b))
30 /* STA */ OPC(0x15, PO2(a) POx(b) POK(a, b, tt))
31- /* DEI */ OPC(0x16, PO1(a) DEI(b, a) PUx(b))
32+ /* DEI */ OPC(0x16, PO1(a) DEI(a, b) PUx(b))
33 /* DEO */ OPC(0x17, PO1(a) POx(b) DEO(a, b))
34 /* ADD */ OPC(0x18, POx(a) POx(b) PUx(b + a))
35 /* SUB */ OPC(0x19, POx(a) POx(b) PUx(b - a))
+1,
-1
1@@ -267,7 +267,7 @@ main(int argc, char **argv)
2 int i = 1;
3 char *rom;
4 if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
5- fprintf(stdout, "Uxn11 - Varvara Emulator, 15 Jul 2024.\n");
6+ fprintf(stdout, "Uxn11 - Varvara Emulator, 5 Aug 2024.\n");
7 i++;
8 }
9 rom = i == argc ? "boot.rom" : argv[i++];
+1,
-1
1@@ -68,7 +68,7 @@ main(int argc, char **argv)
2 int i = 1;
3 char *rom;
4 if(i != argc && argv[i][0] == '-' && argv[i][1] == 'v') {
5- fprintf(stdout, "Uxncli - Console Varvara Emulator, 15 Jul 2024.\n");
6+ fprintf(stdout, "Uxncli - Console Varvara Emulator, 5 Aug 2024.\n");
7 i++;
8 }
9 rom = i == argc ? "boot.rom" : argv[i++];