Implemented equals subroutine.
h3rald h3rald@h3rald.com
Thu, 13 Aug 2026 14:45:42 +0000
1 files changed,
22 insertions(+),
0 deletions(-)
jump to
A
examples/lib/equals.xyw
@@ -0,0 +1,22 @@
+; .include "lib/macros.xyw" + +; 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 +