lemmurg wrote: ↑Sat May 08, 2021 7:40 am
Quietust wrote: ↑Sat May 08, 2021 7:32 am
But the page
was crossed - the instruction ended at $
F2FE and the branch landed at $
F300.
But F300 - F2FE = 2, and
lidnariq wrote: ↑Fri May 07, 2021 10:29 pm
The page boundary is relative to the end of the branch instruction. Hence why the range is +129 to -126 bytes from the beginning of the instruction.
I'm a little bit confused now.
What lidnariq meant was that the page crossing is measured based on the "starting" address and the "ending" address, and the "starting" address is the byte immediately
after the branch instruction.
In the first example with "CFFE: BEQ $D005", the starting address was $
D000 and the ending address was $
D005, and since those were in the same page, no page crossing happened.
In the second example with "F2FC: BEQ $F300", the starting address was $
F2FE and the ending address was $
F300, and since those were in
different pages, a page crossing happened.
If you're still confused, a "page" is defined as an aligned 256-byte region of memory (i.e. beginning at $xx00 and ending at $xxFF), and the 6502 has 256 of them. The first page is $0000-$00FF (and is called the "zero page"), the second page is $0100-$01FF (and contains the Stack), and they continue as such to $FF00-$FFFF.