uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit daa421c25902dd7d3b550303cf6576a3f229a8f1
parent fc8400dcac74befba85646547fa6aff65f18aa6a
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Tue, 11 Apr 2023 10:32:23 -0700

(uxn.c) Cache stack pointer

Diffstat:
Msrc/uxn.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/uxn.c b/src/uxn.c @@ -31,8 +31,8 @@ WITH REGARD TO THIS SOFTWARE. #define SET(mul, add) { if(mul > s->ptr) HALT(1) tmp = s->ptr + k * mul + add; if(tmp > 254) HALT(2) s->ptr = tmp; } #define PUT(o, v) { s->dat[(Uint8)(s->ptr - 1 - (o))] = (v); } #define PUT2(o, v) { tmp = (v); s->dat[(Uint8)(s->ptr - o - 2)] = tmp >> 8; s->dat[(Uint8)(s->ptr - o - 1)] = tmp; } -#define PUSH(stack, v) { if((stack)->ptr > 254) HALT(2) (stack)->dat[(stack)->ptr++] = (v); } -#define PUSH2(stack, v) { if((stack)->ptr > 253) HALT(2) tmp = (v); (stack)->dat[(stack)->ptr] = tmp >> 8; (stack)->dat[(stack)->ptr + 1] = tmp; (stack)->ptr += 2; } +#define PUSH(x, v) { z = (x); if(z->ptr > 254) HALT(2) z->dat[z->ptr++] = (v); } +#define PUSH2(x, v) { z = (x); if(z->ptr > 253) HALT(2) tmp = (v); z->dat[z->ptr] = tmp >> 8; z->dat[z->ptr + 1] = tmp; z->ptr += 2; } #define DEO(a, b) { u->dev[(a)] = (b); if((deo_mask[(a) >> 4] >> ((a) & 0xf)) & 0x1) uxn_deo(u, (a)); } #define DEI(a, b) { PUT((a), ((dei_mask[(b) >> 4] >> ((b) & 0xf)) & 0x1) ? uxn_dei(u, (b)) : u->dev[(b)]) } @@ -41,7 +41,7 @@ uxn_eval(Uxn *u, Uint16 pc) { Uint8 ins, opc, k; Uint16 t, n, l, tmp; - Stack *s; + Stack *s, *z; if(!pc || u->dev[0x0f]) return 0; for(;;) { ins = u->ram[pc++];