uxn

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

commit 617e3d1f41cf11637a3a17f9576c3851ef14c092
parent b09d5708b8778879ee182cf40a832cffe4b6ee04
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Thu,  2 Mar 2023 19:47:24 -0800

(uxn-fast) Added overflow error

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

diff --git a/src/uxn-fast.c b/src/uxn-fast.c @@ -30,8 +30,8 @@ WITH REGARD TO THIS SOFTWARE. #define L2 PEEK16(s->dat+s->ptr-6) #define HALT(c) { return uxn_halt(u, instr, (c), pc - 1); } -#define INC(mul, add) { if(mul > s->ptr) HALT(1) s->ptr += k * mul + add; } -#define DEC(mul, sub) { if(mul > s->ptr) HALT(1) s->ptr -= !k * mul - sub; } +#define INC(mul, add) { if(mul > s->ptr) HALT(1) s->ptr += k * mul + add; if(s->ptr > 255) HALT(2) } +#define DEC(mul, sub) { if(mul > s->ptr) HALT(1) s->ptr -= !k * mul - sub; if(s->ptr > 255) HALT(2) } #define PUT(o, v) { s->dat[s->ptr - o - 1] = (v); } #define PUT2(o, v) { tmp = (v); s->dat[s->ptr - o - 2] = tmp >> 8; s->dat[s->ptr - o - 1] = tmp; } #define PUSH(stack, v) { stack->dat[stack->ptr++] = (v); }