mirror of
https://github.com/cc65/cc65.git
synced 2025-08-09 13:25:06 +00:00
Fixed the behavior of the JMP (ind) instruction in sim65 when it runs with the "6502X" CPU type.
The JMP (ind) bug is present in the 6502 which is emulated by both the "6502" and "6502X" emulation targets of sim65; specifically, the OPC_6502_6C handler. In the old code, the bug-exhibiting code was not executed when the target was set to 6502X, which is incorrect. the patch removes the (CPU == CPU_6502) check, which made no sense. The JMP (ind) bug was actually fixed in the 65c02. Indeed, the OPC_65C02_6C opcode handler has code that implements the 'right' behavior.
This commit is contained in:
@@ -1964,9 +1964,7 @@ static void OPC_6502_6C (void)
|
||||
PC = Regs.PC;
|
||||
Lo = MemReadWord (PC+1);
|
||||
|
||||
if (CPU == CPU_6502)
|
||||
{
|
||||
/* Emulate the 6502 bug */
|
||||
/* Emulate the buggy 6502 behavior */
|
||||
Cycles = 5;
|
||||
Regs.PC = MemReadByte (Lo);
|
||||
Hi = (Lo & 0xFF00) | ((Lo + 1) & 0xFF);
|
||||
@@ -1978,12 +1976,6 @@ static void OPC_6502_6C (void)
|
||||
Warning ("6502 indirect jump bug triggered at $%04X, ind addr = $%04X",
|
||||
PC, Lo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Cycles = 6;
|
||||
Regs.PC = MemReadWord(Lo);
|
||||
}
|
||||
|
||||
ParaVirtHooks (&Regs);
|
||||
}
|
||||
|
Reference in New Issue
Block a user