So, I have plenty of places right now that are being indirectly addressed, but now that I'm sort of creating a jump table (indirect address pointing to indirect addresses), can't quite wrap my head around it. Hoping someone can help.
So, essentially I want something like this:
StartAddressLo:
.db <newAddLo0, <newAddLo1, <newAddLo2
StartAddressHi:
.db >newAddHi0, >newAddHi1, >newAddHi2
And then use that info to point to another table, which provides a data address...
NewAddLo0:
.db <PointHereLo0, <PointHereLo1, <PointHereLo2
NewAddHi0:
.db >PointHereHi0, >PointHereHi1, >PointHereHi2
So if I had three variables, StartVariable, temp, and PointHere variable...trying something like this:
LDX StartVariable ;;;(let's pretend it's #$00 right now)
LDA StartAddressLo,x
;; So now, that should read newAddLo0 ?
STA temp ;; which is now loaded into the point here variable
LDX PointHere ;; let's pretend #$01 was loaded into that variable
LDA temp,x
;; the loaded address should now be PointHereLo1?
I'm sure I'm probably circling around something here, but not quite there. Could someone point me in the right direction as to how to achieve this sort of address jump table?
Thanks!
So, essentially I want something like this:
Code:
StartAddressLo:
.db <newAddLo0, <newAddLo1, <newAddLo2
StartAddressHi:
.db >newAddHi0, >newAddHi1, >newAddHi2
And then use that info to point to another table, which provides a data address...
Code:
NewAddLo0:
.db <PointHereLo0, <PointHereLo1, <PointHereLo2
NewAddHi0:
.db >PointHereHi0, >PointHereHi1, >PointHereHi2
So if I had three variables, StartVariable, temp, and PointHere variable...trying something like this:
Code:
LDX StartVariable ;;;(let's pretend it's #$00 right now)
LDA StartAddressLo,x
;; So now, that should read newAddLo0 ?
STA temp ;; which is now loaded into the point here variable
LDX PointHere ;; let's pretend #$01 was loaded into that variable
LDA temp,x
;; the loaded address should now be PointHereLo1?
I'm sure I'm probably circling around something here, but not quite there. Could someone point me in the right direction as to how to achieve this sort of address jump table?
Thanks!