I have been trying to figure out an implicit, reliable, and smart way to check for page crossing when executing certain addressing modes. I came up with the following for Indirect,Y..
It's reliable, but explicit and could cause unnecessary slow-downs having to check each instruction that uses Indirect,Y (Albeit, not many do).
I started researching this more, and came up with an assumption that I would like verified or proven wrong. My assumption based on research is that only instructions that read and ONLY read an effective address add cycles for page crossing. Read-modify-write instructions don't seem to check for page boundaries, and neither do instructions that only write to the effective address. For example:
ADC
AND
CMP
EOR
LDA
LDX
LDY
ORA
SBC
Those instructions never modify any data in RAM, they only modify internal registers. They also check page boundaries.. Is my assumption correct, or is there a better explanation?
Code:
if (code != 0x91 && (code & 0x1F) == 0x11) {
// Check for page boundary on Indirect,Y addressing mode
}
// Check for page boundary on Indirect,Y addressing mode
}
It's reliable, but explicit and could cause unnecessary slow-downs having to check each instruction that uses Indirect,Y (Albeit, not many do).
I started researching this more, and came up with an assumption that I would like verified or proven wrong. My assumption based on research is that only instructions that read and ONLY read an effective address add cycles for page crossing. Read-modify-write instructions don't seem to check for page boundaries, and neither do instructions that only write to the effective address. For example:
ADC
AND
CMP
EOR
LDA
LDX
LDY
ORA
SBC
Those instructions never modify any data in RAM, they only modify internal registers. They also check page boundaries.. Is my assumption correct, or is there a better explanation?