Code: Select all
.define sprite(sprnum, sprattr) ($700+(sprnum*4)+sprattr)
Code: Select all
sta sprite(0, tile)
The best workaround I've found is to add a "0+", as such.
Code: Select all
sta 0+sprite(0, tile)
Moderator: Moderators
Code: Select all
.define sprite(sprnum, sprattr) ($700+(sprnum*4)+sprattr)
Code: Select all
sta sprite(0, tile)
Code: Select all
sta 0+sprite(0, tile)
Code: Select all
sta ($700+(0*4)+tile)
Code: Select all
.define sprite(sprnum, sprattr) 0+($700+(sprnum*4)+sprattr)
Code: Select all
; With a macro like this
.define sprite(sprnum, sprattr) 0+($700+(sprnum*4)+sprattr)
; Something like this
.word 0x8000 | sprite(0, tile)
; would expand to this
.word 0x8000 | 0+($700+(0*4)+tile)
; But because bitwise OR operator | binds more tightly than the
; addition operator +, it automatically parenthesizes thus
.word (0x8000 | 0)+($700+(0*4)+tile)
Code: Select all
; With a macro like this
.define sprite(sprnum, sprattr) +($700+(sprnum*4)+sprattr)
; Something like this will unexpectedly assemble correctly
.word 0x8000 sprite(0, tile)
; because it expands to this
.word 0x8000 +($700+(0*4)+tile)
Code: Select all
; With a macro like this
.define sprite(sprnum, sprattr) ~~($700+(sprnum*4)+sprattr)
; Your instruction
sta sprite(0, tile)
; expands to this
sta ~~($700+(0*4)+tile)
Code: Select all
.feature bracket_as_indirect
jmp [$FFFC]