commit 07dc45c0e75605cb816c3631826aea5f3fa97633
parent d974111939089a65b1f4c078c5008f675fff5531
Author: neauoire <aliceffekt@gmail.com>
Date: Wed, 30 Aug 2023 09:40:45 -0700
(uxn.c) Faster stack registers
Diffstat:
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git 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; }