commit 4622a8a061265fa767351ab65462cc6bda9c4f68
parent 742c52265f91dd9600bd8a6f33e6de454a40e033
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Wed, 14 Jul 2021 20:19:29 +0100
Created working stack space in case of previous evaluxn overflow
Diffstat:
4 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/etc/mkuxn-fast.lua b/etc/mkuxn-fast.lua
@@ -324,6 +324,7 @@ evaluxn(Uxn *u, Uint16 vec)
{
Uint8 instr;
u->ram.ptr = vec;
+ if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
while(u->ram.ptr) {
instr = u->ram.dat[u->ram.ptr++];
switch(instr) {
diff --git a/etc/mkuxn-fast.moon b/etc/mkuxn-fast.moon
@@ -232,6 +232,7 @@ evaluxn(Uxn *u, Uint16 vec)
{
Uint8 instr;
u->ram.ptr = vec;
+ if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
while(u->ram.ptr) {
instr = u->ram.dat[u->ram.ptr++];
switch(instr) {
diff --git a/src/uxn-fast.c b/src/uxn-fast.c
@@ -56,6 +56,7 @@ evaluxn(Uxn *u, Uint16 vec)
{
Uint8 instr;
u->ram.ptr = vec;
+ if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
while(u->ram.ptr) {
instr = u->ram.dat[u->ram.ptr++];
switch(instr) {
diff --git a/src/uxn.c b/src/uxn.c
@@ -159,6 +159,7 @@ evaluxn(Uxn *u, Uint16 vec)
u->ram.ptr = vec;
u->wst.error = 0;
u->rst.error = 0;
+ if(u->wst.ptr > 0xf8) u->wst.ptr = 0xf8;
while(u->ram.ptr)
if(!stepuxn(u, u->ram.dat[u->ram.ptr++]))
return 0;