uxn

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

commit 1d4ae74e414f52ca137ab6c40ebdf4935968f74a
parent 305b8469b015040ead14e4991caff768a1d62aeb
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Wed, 17 May 2023 20:39:03 -0700

Removed multiplication from SET macro in uxn core

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

diff --git a/src/uxn.c b/src/uxn.c @@ -28,7 +28,7 @@ WITH REGARD TO THIS SOFTWARE. */ #define HALT(c) { return uxn_halt(u, ins, (c), pc - 1); } -#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 SET(mul, add) { if(mul > s->ptr) HALT(1) tmp = (mul & k) + add + s->ptr; 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(x, v) { z = (x); if(z->ptr > 254) HALT(2) z->dat[z->ptr++] = (v); } @@ -45,7 +45,7 @@ uxn_eval(Uxn *u, Uint16 pc) if(!pc || u->dev[0x0f]) return 0; for(;;) { ins = ram[pc++] & 0xff; - k = !!(ins & 0x80); + k = ins & 0x80 ? 0xff : 0; s = ins & 0x40 ? &u->rst : &u->wst; opc = !(ins & 0x1f) ? (0 - (ins >> 5)) & 0xff : ins & 0x3f; switch(opc) {