mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-26 07:45:14 +00:00
(uxn.c) Removed used of stack pointer for circular arithmetic
This commit is contained in:
parent
bb99a02bf7
commit
f1f1babd47
2 changed files with 8 additions and 11 deletions
17
src/uxn.c
17
src/uxn.c
|
@ -17,12 +17,12 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
[ L2 ][ N2 ][ T2 ] <
|
||||
*/
|
||||
|
||||
#define T *(ptr)
|
||||
#define N *(ptr - 1)
|
||||
#define L *(ptr - 2)
|
||||
#define X *(ptr - 3)
|
||||
#define Y *(ptr - 4)
|
||||
#define Z *(ptr - 5)
|
||||
#define T *(s->dat + s->ptr - 1)
|
||||
#define N *(s->dat + s->ptr - 2)
|
||||
#define L *(s->dat + s->ptr - 3)
|
||||
#define X *(s->dat + s->ptr - 4)
|
||||
#define Y *(s->dat + s->ptr - 5)
|
||||
#define Z *(s->dat + s->ptr - 6)
|
||||
#define T2 (N << 8 | T)
|
||||
#define H2 (L << 8 | N)
|
||||
#define N2 (X << 8 | L)
|
||||
|
@ -30,12 +30,10 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
#define T2_(v) { r = (v); T = r; N = r >> 8; }
|
||||
#define N2_(v) { r = (v); L = r; X = r >> 8; }
|
||||
#define L2_(v) { r = (v); Y = r; Z = r >> 8; }
|
||||
|
||||
#define DEI(p) (dei_masks[p] ? emu_dei(u, (p)) : u->dev[(p)])
|
||||
#define DEO(p, v) { u->dev[p] = v; if(deo_masks[p]) emu_deo(u, p); }
|
||||
|
||||
#define FLIP { s = ins & 0x40 ? &u->wst : &u->rst; }
|
||||
#define SHIFT(y) { s->ptr += (y); ptr = s->dat + s->ptr - 1; }
|
||||
#define SHIFT(y) { s->ptr += (y); }
|
||||
#define SET(x, y) { SHIFT((ins & 0x80) ? x + y : y) }
|
||||
|
||||
int
|
||||
|
@ -47,7 +45,6 @@ uxn_eval(Uxn *u, Uint16 pc)
|
|||
for(;;) {
|
||||
int ins = ram[pc++];
|
||||
Stack *s = ins & 0x40 ? &u->rst : &u->wst;
|
||||
Uint8 *ptr = s->dat + s->ptr - 1;
|
||||
switch(ins & 0x1f ? ins & 0x3f : ins << 4) {
|
||||
/* IMM */
|
||||
case 0x000: /* BRK */ return 1;
|
||||
|
|
|
@ -561,7 +561,7 @@ main(int argc, char **argv)
|
|||
/* Read flag. Right now, there can be only one. */
|
||||
if(argv[i][0] == '-') {
|
||||
if(argv[i][1] == 'v')
|
||||
return system_version("Uxnemu - Graphical Varvara Emulator", "25 Oct 2023");
|
||||
return system_version("Uxnemu - Graphical Varvara Emulator", "30 Oct 2023");
|
||||
if(argv[i][1] == '-')
|
||||
i++;
|
||||
if(strcmp(argv[i], "-2x") == 0 || strcmp(argv[i], "-3x") == 0)
|
||||
|
|
Loading…
Reference in a new issue