diff --git a/ref/uxnmin.c b/ref/uxnmin.c index 4f4d47a..9efd1e7 100644 --- a/ref/uxnmin.c +++ b/ref/uxnmin.c @@ -48,7 +48,7 @@ emu_deo(Uint8 addr, Uint8 value) /* Microcode */ -#define JMI pc += uxn.ram[pc++] << 8 | uxn.ram[pc++]; +#define JMI a = uxn.ram[pc ] << 8 | uxn.ram[pc + 1], pc += a + 2; #define JMP(i) if(_2) pc = i; else pc += (Sint8)i; #define REM if(_r) uxn.rst.ptr -= 1 + _2; else uxn.wst.ptr -= 1 + _2; #define INC(s) uxn.s.dat[uxn.s.ptr++] @@ -60,7 +60,7 @@ emu_deo(Uint8 addr, Uint8 value) #define PU1(i) if(_r) INC(rst) = i; else INC(wst) = i; #define RP1(i) if(_r) INC(wst) = i; else INC(rst) = i; #define GET(o) if(_2) PO1(o[1]) PO1(o[0]) -#define PUT(i) PU1(i[0]) if(_2) PU1(i[1]) +#define PUT(i) PU1(i[0]) if(_2) { PU1(i[1]) } #define DEI(i,o) o[0] = emu_dei(i); if(_2) o[1] = emu_dei(i + 1); PUT(o) #define DEO(i,j) emu_deo(i, j[0]); if(_2) emu_deo(i + 1, j[1]); #define PEK(i,o,m) o[0] = uxn.ram[i]; if(_2) o[1] = uxn.ram[(i + 1) & m]; PUT(o) @@ -93,9 +93,9 @@ uxn_eval(Uint16 pc) /* GTH */ OPC(0x0a, POx(a) POx(b),PU1(b > a)) /* LTH */ OPC(0x0b, POx(a) POx(b),PU1(b < a)) /* JMP */ OPC(0x0c, POx(a),JMP(a)) - /* JCN */ OPC(0x0d, POx(a) PO1(b), if(b) JMP(a)) + /* JCN */ OPC(0x0d, POx(a) PO1(b), if(b) { JMP(a) }) /* JSR */ OPC(0x0e, POx(a),RP1(pc >> 8) RP1(pc) JMP(a)) - /* STH */ OPC(0x0f, GET(x),RP1(x[0]) if(_2) RP1(x[1])) + /* STH */ OPC(0x0f, GET(x),RP1(x[0]) if(_2) { RP1(x[1]) }) /* LDZ */ OPC(0x10, PO1(a),PEK(a, x, 0xff)) /* STZ */ OPC(0x11, PO1(a) GET(y),POK(a, y, 0xff)) /* LDR */ OPC(0x12, PO1(a),PEK(pc + (Sint8)a, x, 0xffff))