64TASS will let you do a lot of things, you can use default params to set the extra args to known things for example.
I have one that gives me an auto size length for STZ, so if I define a word and STZ the word it will clear both bytes. If I declare an int it will clear all 4 etc
Code:
STZ .macro
lda #0
.proff
;.if type(\1) == bits
.if IsParamDirectAddress(\1)
.pron
sta \1
.proff
.else
.pron
sta (\1)+range(size(\1))
.proff
.endif
.pron
.endm
so
Code:
myVar .byte ?
myWordVar .word ?
myWordVarHL .dunion HLWord
#STZ myVar = lda #0 sta myVar
#STZ myWordVar = lda #0 sta myWordVar sta myWordVar+1
#STZ myWordVarHL = lda #0 sta myWordVarHL sta myWordVarHL +1
#STZ myWordVarHL.lo = lda #0 sta myWordVarHL.lo
where HLWord is defined as
HLWord .union
.word ?
.struct
lo .byte ?
hi .byte ?
.ends
.endu
You can also make whole functions like so
Code:
dfont .function f
.proff
i := f
.for n = 0, n < len(f)/8, n = n + 1
r := bits(0)
.for m = 0, m < 8, m = m + 1
r ..= (i[0] == '#') ? %1 : %0
i := i[1:]
.if i == ''
.break
.endif
.next
.pron
.byte r
.proff
.next
.pron
.endf
dfontM .function f
.proff
i := f
.for n = 0, n < len(f)/4, n = n + 1
r := bits(0)
.for m = 0, m < 4, m = m + 1
.if (i[0] == '#')
r ..= %10
.elsif (i[0] == '@')
r ..= %01
.elsif (i[0] == '*')
r ..= %11
.else
r ..= %00
.endif
i := i[1:]
.if i == ''
.break
.endif
.next
.pron
.byte r
.proff
.next
.pron
.endf
these allow me to do things like
.dfont "##_##___"
.dfont "##_##___"
.dfont "#####___"
.dfont "##_##___"
.dfont "##_##___"
and it will convert it to
%11011000
%11011000
%11111000
%11011000
%11011000
The 2nd one lets me specify multicolour graphics
Code:
ILIW .macro
.proff
.if \2 == x
.pron
ldy \1.lo,\2
sty \3.lo
ldy \1.hi,\2
sty \3.hi
.proff
.elsif \2 == y
.pron
ldx \1.lo,\2
stx \3.lo
ldx \1.hi,\2
stx \3.hi
.else
.pron
.cerror "invalid index input"
.endif
.endm
lets me specify ,x or ,y on the params list.
You can also get it to do array of structs to struct of arrays conversions for you
Code:
sorted = sort([(60, irq1), (50, irq2)])
lines .byte sorted[:, 0] ; 50, 60
irqs .addr sorted[:, 1] ; irq2, irq1
However if one really wants scripting power KICKASS is the insane one
It has a optimiser that you can enable which will point out most of the things you can skip, so if you want to break the macros out into full code to save a clc or sec or A is already 0 etc it will give you a nice list.