Implemented trimstart subroutine.
h3rald h3rald@h3rald.com
Sat, 15 Aug 2026 13:28:58 +0000
1 files changed,
22 insertions(+),
0 deletions(-)
jump to
A
examples/lib/trimstart.xyw
@@ -0,0 +1,22 @@
+; UNTESTED +; .include "lib/oneof.xyw" + +; Pushes the address of string trimmed at start +; a16 -> b16 +.label trimstart + ; Save string address + POPxw ; start address (to return) m + .label trimstart.loop + ; if space, trim + PSHxw trimstart.spaces oneof JSRw + trimstart.remove JCNw + ; otherwise return (at start of string) + trimstart.end JMPw + .label trimstart.remove + ; remove and increment start + $00 STBxw INCxw trimstart.loop JMPw + .label trimstart.end + PSHxw RTS + +.label trimstart.spaces + .byte $20 $09 $0A $0D $00