1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00

Merge pull request #2547 from sidneycadot/fix-jmp-ind

Fixed the behavior of JMP (ind) in sim65 when it runs with the 6502X CPU type.
This commit is contained in:
Bob Andrews 2024-12-02 00:21:31 +01:00 committed by GitHub
commit 79e26c1bc5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1964,25 +1964,17 @@ static void OPC_6502_6C (void)
PC = Regs.PC;
Lo = MemReadWord (PC+1);
if (CPU == CPU_6502)
{
/* Emulate the 6502 bug */
Cycles = 5;
Regs.PC = MemReadByte (Lo);
Hi = (Lo & 0xFF00) | ((Lo + 1) & 0xFF);
Regs.PC |= (MemReadByte (Hi) << 8);
/* Emulate the buggy 6502 behavior */
Cycles = 5;
Regs.PC = MemReadByte (Lo);
Hi = (Lo & 0xFF00) | ((Lo + 1) & 0xFF);
Regs.PC |= (MemReadByte (Hi) << 8);
/* Output a warning if the bug is triggered */
if (Hi != Lo + 1)
{
Warning ("6502 indirect jump bug triggered at $%04X, ind addr = $%04X",
PC, Lo);
}
}
else
/* Output a warning if the bug is triggered */
if (Hi != Lo + 1)
{
Cycles = 6;
Regs.PC = MemReadWord(Lo);
Warning ("6502 indirect jump bug triggered at $%04X, ind addr = $%04X",
PC, Lo);
}
ParaVirtHooks (&Regs);