mirror of
https://github.com/thiagoauler/apple1.git
synced 2024-11-24 13:32:23 +00:00
implementation of indirect JMP's bug
This commit is contained in:
parent
6bb5014964
commit
7cd85b7cdd
@ -389,9 +389,19 @@ void iny()
|
|||||||
void jmp()
|
void jmp()
|
||||||
{
|
{
|
||||||
// jump to new location (indirect)
|
// jump to new location (indirect)
|
||||||
address = read_word(pc);
|
// this jump instruction has a known bug where the MSB does not cross pages
|
||||||
address = read_word(address);
|
// i.e. if the LSB is in address 0xC0FF, then the MSB will be in 0xC000
|
||||||
pc = address;
|
db lsb, msb;
|
||||||
|
dw lsb_addr, msb_addr;
|
||||||
|
|
||||||
|
lsb_addr = read_word(pc);
|
||||||
|
lsb = read_byte(lsb_addr);
|
||||||
|
|
||||||
|
msb_addr = (lsb_addr + 1) & 0x00FF;
|
||||||
|
msb_addr = (lsb_addr & 0xFF00) | msb_addr;
|
||||||
|
msb = read_word(msb_addr);
|
||||||
|
|
||||||
|
pc = (msb << 8) | lsb;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jpa()
|
void jpa()
|
||||||
|
Loading…
Reference in New Issue
Block a user