From e26c17fd502068645c743abc5e6efdbcd5baad54 Mon Sep 17 00:00:00 2001 From: Sidney Cadot Date: Sun, 1 Dec 2024 09:59:10 +0100 Subject: [PATCH] Fixed wrong clearing of D-flag on interrupts for sim65 with 6502X CPU type. The 65C02 clears the D flag on interrupts while the 6502 does not. The old code cleared the D flag also for the 6502X CPU type, which was incorrect. --- src/sim65/6502.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sim65/6502.c b/src/sim65/6502.c index 448e81669..09dc0ddea 100644 --- a/src/sim65/6502.c +++ b/src/sim65/6502.c @@ -4104,7 +4104,7 @@ unsigned ExecuteInsn (void) PUSH (PCL); PUSH (Regs.SR & ~BF); SET_IF (1); - if (CPU != CPU_6502) + if (CPU == CPU_65C02) { SET_DF (0); } @@ -4118,7 +4118,7 @@ unsigned ExecuteInsn (void) PUSH (PCL); PUSH (Regs.SR & ~BF); SET_IF (1); - if (CPU != CPU_6502) + if (CPU == CPU_65C02) { SET_DF (0); }