Browse code

Simplify stack determination logic.

Andrew Alderwick authored on 05/01/2022 14:02:06
Showing 1 changed files
... ...
@@ -100,8 +100,8 @@ uxn_eval(Uxn *u, Uint16 pc)
100 100
 
101 101
 err:
102 102
 	/* set 1 in errcode if it involved the return stack instead of the working stack */
103
-	/*        (stack overflow & (       instruction opcode was STH or JSR        )) ^ Return Mode */
104
-	errcode |= ((errcode >> 1 & instr >> 1 & instr >> 2 & instr >> 3 & ~instr >> 4) ^ instr >> 6) & 1;
103
+	/*        (stack overflow & (opcode was STH / JSR)) ^ Return Mode */
104
+	errcode |= ((errcode >> 1 & (instr & 0x1e) == 0x0e) ^ instr >> 6) & 1;
105 105
 	return uxn_halt(u, errcode, pc - 1);
106 106
 }
107 107