I’m writing a SNES program using wla-dx
(wla-65816
specifically), and I’m including some binary data in the ROM:
data: .INCBIN "datafile.bin"
I can get the size of this data using _sizeof_data
, which can be used in e.g. macro arguments. However, I’m having trouble reserving a region of RAM with the same size as this. Perhaps this is because of the clunky way I’ve fond to reserve longer ram sections. For a known-in-advance size, I currently do something like:
; This struct is used as a workaround for me not finding a way
; to indicate how big a ram section should be
.STRUCT array
dummy: db
.ENDST
.RAMSECTION "Work" SLOT 1 ORG $100 SEMIFREE
work_data instanceof array size $1000
.ENDS
This works, but it appears a variable size is not accepted for the size argument here. Replacing $1000
with _sizeof_data
, I get DIRECTIVE_ERROR: Unexpected symbol "_sizeof_data" in .RAMSECTION.
What is the right way to do this? I could just hardcode a size, but I don’t think what I’m doing here should be unusual. There’s probably a better way to do this that I’m not seeing.