Code: Select all
move16 #100, entity_x_velocity ; automatically stores lo byte in entity_x_velocity_lo,x and hi byte in entity_x_velocity_hi,x
Code: Select all
move16 entity_x_velocity, entity_x_velocity, x, y ;moves velocity of entity indexed by x to entity indexed by y, automatically using the _lo and _hi arrays for each
Code: Select all
.macro ins_lo reg, ins, arg, suf
.local entity_lo
.if !.xmatch (.left (1, {arg}), #)
.if .xmatch (.left (1, .ident(.sprintf("%.7s", .string(arg)))), entity_)
.ifnblank suf
entity_lo = .ident(.concat(.string(arg), suf))
.else
entity_lo = arg
.endif
.ifnblank reg
ins entity_lo,reg
.else
ins entity_lo,x
.endif
.else
ins arg
.endif
.else
ins #<(.right (.tcount ({arg})-1, {arg}))
.endif
.endmacro
.macro ins_hi reg, ins, arg
.local entity_hi
.if !.xmatch (.left (1, {arg}), #)
.if .xmatch (.left (1, .ident(.sprintf("%.7s", .string(arg)))), entity_)
entity_hi = .ident(.concat(.string(arg), "_hi"))
.ifnblank reg
ins entity_hi,reg
.else
ins entity_hi,x
.endif
.else
ins arg+1
.endif
.else
ins #>(.right (.tcount ({arg})-1, {arg}))
.endif
.endmacro
.macro move16 source, dest, rega, regb
ins_lo rega, lda, source, "_lo"
ins_lo regb, sta, dest, "_lo"
ins_hi rega, lda, source
ins_hi regb, sta, dest
.endmacro
;...a whole series of other possible 16 bit and 8 bit macros using ins_lo and ins_hi follows in my codebase, you can easily imagine how they would look based on move16.