30 lines
778 B
Text
30 lines
778 B
Text
macro if2_EQ_DOT_L 1,2,3,4
|
|
;input: 1 = first param (can be any addressing mode compatible with CMP)
|
|
; 2 = second param (used for condition 1)
|
|
; 3 = third param (used for condition 2)
|
|
; 4 = output for comparison results (must be a data register, and can't be 1, 2, or 3. The macro will not enforce this!)
|
|
|
|
; <backslash>@ represents a macro-local label that is scoped for each instance of that macro in your program
|
|
; and doesn't cause "label already defined" conflicts if the macro is used multiple times
|
|
|
|
MOVEQ #0,\4
|
|
CMP.L \2,\1
|
|
BEQ \@eqCond1
|
|
;condition 1 failed.
|
|
CMP.L \3,\1
|
|
BEQ \@TwoButNotOne
|
|
;both failed
|
|
clr.b d0
|
|
bra \@done
|
|
\@eqCond1:
|
|
CMP.L \3,\1
|
|
BEQ \@Both
|
|
move.b #2,d0
|
|
bra \@done
|
|
\@Both:
|
|
move.b #3,d0
|
|
bra \@done
|
|
\@TwoButNotOne:
|
|
move.b #1,d0
|
|
\@done:
|
|
endm
|