From b14f883e7339a0edbd734939cf910b2a5838f8b2 Mon Sep 17 00:00:00 2001 From: Sidney Cadot Date: Thu, 19 Dec 2024 22:58:42 +0100 Subject: [PATCH] sim65: changes constant of the unstable "ANE" instruction to comply with 65x02 test suite. ANE (0x8b) is an unstable illegal opcode that depends on a "constant" value that isn't really constant. It varies between machines, with temperature, and so on. Original sim65 behavior was to use the constant value 0xEF. To get the behavior in line with the 65x02 testsuite, we now use the value 0xEE instead, which is also a reasonable choice that can be observed in practice. --- src/sim65/6502.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sim65/6502.c b/src/sim65/6502.c index cb3270185..166d54e2e 100644 --- a/src/sim65/6502.c +++ b/src/sim65/6502.c @@ -969,8 +969,14 @@ static unsigned HaveIRQRequest; } while (0); /* ANE */ +/* An "unstable" illegal opcode that depends on a "constant" value that isn't + * really constant. It varies between machines, with temperature, and so on. + * Original sim65 behavior was to use the constant 0xEF here. To get behavior + * in line with the 65x02 testsuite, we now use the value 0xEE instead, + * which is also a reasonable choice that can be observed in practice. + */ #define ANE(Val) \ - Val = (Regs.AC | 0xEF) & Regs.XR & Val; \ + Val = (Regs.AC | 0xEE) & Regs.XR & Val; \ Regs.AC = Val; \ TEST_SF (Val); \ TEST_ZF (Val)