length_w.xyw

length-w.xyw
calendarsave
; Pushes the length of s
; s -> w
.label length_w
   POPxw ; store start address
   $0000 POPyw ; counter
   .label length_w.loop
     ; if at end of string, go to end
     LDBxw $00 EQU length_w.end JCNw
     ; otherwise increment address and counter
     INCxyw
     length_w.loop JMPw
     .label length_w.end
       PSHyw RTS