[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LDA OpCode Question



LDA OpCode Question

    I tried to tell 65816 that 65816 can read data from bank $01 by using
local address instead of long address.  For example below:

00/2000: JSR $FC58
00/2002: JSL $012000
00/2007: RTS

01/2000: LDX #00
01/2002: LDA 2100,X
01/2005: STA 002100,X
01/2009: INX
01/200A: CPX #10
01/200C: BEQ 2010
01/200E: BRA 2002
01/2010: RTL
01/2100:"Bryan Parkoff..."
    It does not work because LDA 2100,X is the local address in bank $01.
It forces me to use LDA 012100,X instead of LDA 2100,X that is the long
address in bank $01.  Look like below.

01/2000: LDX #00
01/2002: LDA 012100,X
01/2006: STA 002100,X
01/200A: INX
01/200B: CPX #10
01/200D: BEQ 2011
01/200F: BRA 2002
01/2011: RTL

    Do you notice that BEQ and BRA are local addresses in bank $01?  I know
that the rule for branch which it can execute between -128 and +127
and -32768 and +32767 for BRL.

    Does 65816's rule always state that all long address LDA/STA must be
used in bank $01 to $FF except local address LDA/STA must be in bank $00.
If this rule is true that bank $00 is always default for LDA $12, LDA $1234,
etc.  I understand what it means.  Please advise.

Bryan Parkoff
BParkoff@satx.rr.com