mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-29 09:13:01 +00:00
(uxn.c) Faster stack registers
This commit is contained in:
parent
d974111939
commit
07dc45c0e7
1 changed files with 8 additions and 7 deletions
15
src/uxn.c
15
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; }
|
||||
|
|
Loading…
Reference in a new issue