I scoured this (and many other) pages for the past two hours so I apologize if this is already answered somewhere, but I'm at my wit's end. I'm trying to load more than 256 bytes to a memory blob (for collision detection). I load the high and low bytes of the collision data blob (728 bytes) and want to store accumulator values in that data using indirect addressing. The problem, however, is that I can't stick my data into it. I've tried several things (some below), but feel like I'm missing a fundamental syntax here...
Code:
collision_map .rs 768 ; gets assigned $0005
collision_low .rs 1
collision_high .rs 1
...
LoadData:
LDA #low(collision_map)
STA collision_low ; confirmed puts $05 in collision_low
LDA #high(collision_map)
STA collision_high ; confirmed puts $00 in collision_high
LDX $00
LDY $00
LDA #$24 ; for simplicity sake, lets say i just want to load the value '24'
LoadDataLoop:
; These are things I've tried
STA (collision_low), Y ; this will store A at the address of collision_low and not collision_map
STA [collision_low], Y ; Doesn't build: Incorrect zero page address!
STA collision_low, Y ; this will store A at the address of collision_low and not collision_map
STA $0005, Y ; works, but whole point is to avoid hard coding the address and trying to use vars bc this won't work for over 256 bytes
; End things i've tried (I also tried a combination of putting '#', '$', '<', '>' in front of collision_low in a desperate attempt to get lucky
INY
CPY #$00
BNE LoadDataLoop
LDA collision_high
CLC
ADC #$01
STA collision_high
LDA #$24 ; reset back to value I want
INX
CPX #$03
BNE LoadDataLoop
collision_low .rs 1
collision_high .rs 1
...
LoadData:
LDA #low(collision_map)
STA collision_low ; confirmed puts $05 in collision_low
LDA #high(collision_map)
STA collision_high ; confirmed puts $00 in collision_high
LDX $00
LDY $00
LDA #$24 ; for simplicity sake, lets say i just want to load the value '24'
LoadDataLoop:
; These are things I've tried
STA (collision_low), Y ; this will store A at the address of collision_low and not collision_map
STA [collision_low], Y ; Doesn't build: Incorrect zero page address!
STA collision_low, Y ; this will store A at the address of collision_low and not collision_map
STA $0005, Y ; works, but whole point is to avoid hard coding the address and trying to use vars bc this won't work for over 256 bytes
; End things i've tried (I also tried a combination of putting '#', '$', '<', '>' in front of collision_low in a desperate attempt to get lucky
INY
CPY #$00
BNE LoadDataLoop
LDA collision_high
CLC
ADC #$01
STA collision_high
LDA #$24 ; reset back to value I want
INX
CPX #$03
BNE LoadDataLoop