GaBuZoMeu wrote:
For the 65C816 in native mode, there are exceptions. The offset is still treated unsigned, but page and block limits can (sometimes) be crossed.
The offsets computed by relative branch instructions cannot cross bank (not "block") boundaries.
BRL has a range of -32,768 to 32,767. All other relative branches have the same range as with the eight bit MPUs. When assembled, the operand to the
PER instruction is converted to a signed displacement, also with the range of -32,768 to 32,767. When the '816 executes
PER the displacement will be added to the next instruction's address, using signed arithmetic, and the resulting address will be pushed to the stack. Loading from or storing to that address results in the access occurring in the bank currently loaded in
DB.
65C816 indexed addressing can cross page and bank boundaries and indeed that is the secret to being able to touch the full 16 MB address space without using the
$bbhhll and
$bbhhll,X addressing modes. Also, direct page indexed addressing, e.g.,
LDA <dp>,X, will index beyond the end of direct page, unlike the eight bit MPUs. Hence the sequence
LDX #$FFFF -- LDA $FF,X will load the accumulator from
$0100FE (and
$0100FF if in 16 bit mode). In other words, both the page and bank boundaries are crossed.