diff --git a/src/uxn.c b/src/uxn.c index 58419eb..9438243 100644 --- a/src/uxn.c +++ b/src/uxn.c @@ -11,19 +11,20 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. */ +#define T *ptr +#define N *(ptr - 1) +#define L *(ptr - 2) +#define T2 (N << 8 | T) +#define H2 (L << 8 | N) +#define N2 (*(ptr - 3) << 8 | L) +#define L2 (*(ptr - 5) << 8 | *(ptr - 4)) + /* Registers [ . ][ . ][ . ][ L ][ N ][ T ] < [ . ][ . ][ . ][ H2 ][ T ] < [ L2 ][ N2 ][ T2 ] < */ -#define T *ptr -#define N *(ptr - 1) -#define L *(ptr - 2) -#define T2 PEEK2((ptr - 1)) -#define H2 PEEK2((ptr - 2)) -#define N2 PEEK2((ptr - 3)) -#define L2 PEEK2((ptr - 5)) #define HALT(c) { return emu_halt(u, ins, c, pc - 1); } #define FLIP { s = ins & 0x40 ? &u->wst : &u->rst; } #define SET(x, y) { r = s->ptr; if(x > r) HALT(1) r += (x & k) + y; if(r > 254) HALT(2) ptr = s->dat + r - 1; s->ptr = r; }