commit bf1ee0298d51461731a4cc247f43d7eb107d76dc
parent db6f7d9fbf4a490740804cf296309f7c20ee1dd0
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Sun, 23 Jul 2023 09:57:32 -0700
(uxn.c) Fixed issue where JSRr was pushing to wrong stack
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/uxn.c b/src/uxn.c
@@ -85,8 +85,8 @@ uxn_eval(Uxn *u, Uint16 pc)
case 0x2c: t=T2; SET(2,-2) pc = t; break;
case 0x0d: /* JCN */ t=T;n=N; SET(2,-2) if(n) pc += (Sint8)t; break;
case 0x2d: t=T2;n=L; SET(3,-3) if(n) pc = t; break;
- case 0x0e: /* JSR */ t=T; SET(1,-1) s = &u->rst; PUSH2(pc) pc += (Sint8)t; break;
- case 0x2e: t=T2; SET(2,-2) s = &u->rst; PUSH2(pc) pc = t; break;
+ case 0x0e: /* JSR */ t=T; SET(1,-1) s = ins & 0x40 ? &u->wst : &u->rst; PUSH2(pc) pc += (Sint8)t; break;
+ case 0x2e: t=T2; SET(2,-2) s = ins & 0x40 ? &u->wst : &u->rst; PUSH2(pc) pc = t; break;
case 0x0f: /* STH */ t=T; SET(1,-1) s = ins & 0x40 ? &u->wst : &u->rst; PUSH(t) break;
case 0x2f: t=T2; SET(2,-2) s = ins & 0x40 ? &u->wst : &u->rst; PUSH2(t) break;
case 0x10: /* LDZ */ t=T; SET(1, 0) PUT(0, ram[t]) break;