I've been trying to wrap my head around how to use the low/high macros.
Let's say I've got something like:
And sometime during the code, currentSpriteDefinition will point to the memory at sprite_mario_definition.
But what I'm confused on is how the Low and High macros work with both currentSpriteDefinition and sprite_mario_definition. It's all been blind trial and error so far to make it work. I don't know what value to expect when doing:
Can someone clear this up for me?
Thanks!
Shawn
Let's say I've got something like:
Code:
.rsset $0000
currentSpriteDefinition .rs 2
; sprite definition data store somewhere.
sprite_mario_definition:
; sprite 1
.db 0 ; y offset
.db $32; sprite index
.db %00000000
.db 0 ; x offset
; sprite 2
.db 0 ; y offset
.db 33; sprite index
.db %00000000
.db 8 ; x offset
; sprite 3
.db 8 ; y offset
.db 34; sprite index
.db %00000000
.db 0 ; x offset
; sprite 4
.db 8 ; y offset
.db 35; sprite index
.db %00000000
.db 8 ; x offset
currentSpriteDefinition .rs 2
; sprite definition data store somewhere.
sprite_mario_definition:
; sprite 1
.db 0 ; y offset
.db $32; sprite index
.db %00000000
.db 0 ; x offset
; sprite 2
.db 0 ; y offset
.db 33; sprite index
.db %00000000
.db 8 ; x offset
; sprite 3
.db 8 ; y offset
.db 34; sprite index
.db %00000000
.db 0 ; x offset
; sprite 4
.db 8 ; y offset
.db 35; sprite index
.db %00000000
.db 8 ; x offset
And sometime during the code, currentSpriteDefinition will point to the memory at sprite_mario_definition.
But what I'm confused on is how the Low and High macros work with both currentSpriteDefinition and sprite_mario_definition. It's all been blind trial and error so far to make it work. I don't know what value to expect when doing:
Code:
LDA LOW(currentSpriteDefinition)
LDA #LOW(currentSpriteDefinition)
LDA LOW(sprite_mario_defintion)
LDA #LOW(sprite_mario_definition)
STA LOW(currentSpriteDefinition)
LDA #LOW(currentSpriteDefinition)
LDA LOW(sprite_mario_defintion)
LDA #LOW(sprite_mario_definition)
STA LOW(currentSpriteDefinition)
Can someone clear this up for me?
Thanks!
Shawn