examples/lib/equals.xyw
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
; Check if two strings are equal
; a16 b16 -> a8
.label equals
; save addresses to registers
POPyw POPxw
; if same address, then it's the same string
EQUxyw equals.ok JCNw
.label equals.loop
; if chars are different, fail
LDBxyw NEQ equals.fail JCNw
; chars at the same
; if one is end of string, ok
LDBxw $00 EQU equals.ok JCNw
; otherwise continue
INCxyw equals.loop JMPw
.label equals.fail
$00 RTS
.label equals.ok
$01 RTS
|