all repos — xyw @ 7080189bfbe1142ee142ec78c35df1b34184a68a

A minimal virtual machine and assembler for terminals.

Implemented trimend subroutine.
h3rald h3rald@h3rald.com
Sat, 15 Aug 2026 16:27:40 +0000
commit

7080189bfbe1142ee142ec78c35df1b34184a68a

parent

12959899d893742d178fa40c30533b31c8063a97

1 files changed, 22 insertions(+), 0 deletions(-)

jump to
A examples/lib/trimend.xyw

@@ -0,0 +1,22 @@

+; .include "lib/oneof.xyw" + +; Remeve space chats at end of string +; a16 -> +.label trimend + ; save string address + POPxw + .label trimend.toend + LDBxw $00 EQU trimend.loop JCNw + ; increment till end + INCxw trimend.toend JMPw + .label trimend.loop + DECxw PSHxw trimend.spaces oneof JSRw + ; if space, remove and decrement + trimend.remove JCNw + ; otherwise return + RTS + .label trimend.remove + $00 STBxw trimend.loop JMPw + +.label trimend.spaces + .byte $20 $09 $0A $0D $00