RosettaCodeData/Task/Extend-your-language/6502-Assembly/extend-your-language.6502
2023-07-01 13:44:08 -04:00

24 lines
706 B
Text

CMP_Double .macro ;NESASM3 syntax
; input:
; \1 = first condition. Valid addressing modes: immediate, zero page, or absolute.
; \2 = second condition. Valid addressing modes: immediate, zero page, or absolute.
; \3 = branch here if both are true
; \4 = branch here if only first condition is true
; \5 = branch here if only second condition is true
; \6 = branch here if both are false
CMP \1
BNE .check2\@ ;\1 is not true
CMP \2
BEQ .doubletrue\@
JMP \4 ;only condition 1 is true
.doubletrue\@:
JMP \3 ;both are true
.check2\@:
CMP \2
BNE .doublefalse\@
JMP \5 ;only condition 2 is true
.doublefalse:
JMP \6 ;both are false
.endm