6502 icon indicating copy to clipboard operation
6502 copied to clipboard

Indirect addressing mode needs to return entire page when lo(0xFF)

Open lucascebertin opened this issue 3 years ago • 1 comments

Following the 6502 spec, there is a bug in architecture when indirect addressing mode is used. Not sure if this thing affects all the indirect addressing like indirect, x and indirect, y but probably yes. We need to check if the lo(ADDRESS) is 0xFF and, then, consider a full page return, so:

LDX #$02
STX $3000

LDX #$04
STX $3100

LDX #$03
STX $30FF

JMP ($30FF)

the jump will consider the hi(0x3000) + lo(0x30FF) = 0x0203

NB: WE CAN'T USE EASY6502 TO VALIDATE THIS BECAUSE THEY ARE NOT RESPECTING THIS BEHAVIOUR AS WE CAN SEE IN THE PICTURE: image

lucascebertin avatar Mar 24 '21 11:03 lucascebertin