I'm trying to translate to ASM6 a sound driver including a macro that takes different number of parameters. In ca65, I'd use .ifblank to test whether an argument is present.
Which expands as follows:
How would this be done in ASM6?
Related issue on GitHub
Code:
.macro sfxpairdef name, sfx1, sfx2
name = <(* - sfxpairs_base) / 2
.byte sfx1
.ifblank sfx2
.byte $80
.else
.byte sfx2
.endif
.endmacro
sfxpairs_base:
sfxpairdef D_JUMP, 2
sfxpairdef D_FIRE, 3
sfxpairdef D_EXPLOSION, 4, 5
name = <(* - sfxpairs_base) / 2
.byte sfx1
.ifblank sfx2
.byte $80
.else
.byte sfx2
.endif
.endmacro
sfxpairs_base:
sfxpairdef D_JUMP, 2
sfxpairdef D_FIRE, 3
sfxpairdef D_EXPLOSION, 4, 5
Which expands as follows:
Code:
sfxpairs_base:
D_JUMP = <(* - sfxpairs_base) / 2
.byte 2
.byte $80
D_FIRE = <(* - sfxpairs_base) / 2
.byte 3
.byte $80
D_EXPLOSION = <(* - sfxpairs_base) / 2
.byte 4
.byte 5
D_JUMP = <(* - sfxpairs_base) / 2
.byte 2
.byte $80
D_FIRE = <(* - sfxpairs_base) / 2
.byte 3
.byte $80
D_EXPLOSION = <(* - sfxpairs_base) / 2
.byte 4
.byte 5
How would this be done in ASM6?
Related issue on GitHub