0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-25 23:35:12 +00:00

(uxn.c) Faster stack registers

This commit is contained in:
neauoire 2023-08-30 09:40:45 -07:00
parent d974111939
commit 07dc45c0e7

View file

@ -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; }