all repos — xyw @ 3007

A minimal virtual machine and assembler for terminals.

examples/print-args.xyw

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
.include "lib/macros.xyw" 

; Set on_argument event handler
print-args terminal.on_argument STW
; End program
HLT

; on_argument event handler
; -[x]-
.label print-args
    terminal.input POPx
    ; If end of argument, print new line and end
    LDBx arg.end EQU print-args.end JCNw
    LDBx arg.sep EQU print-args.next JCNw
    ; Print typed character
    LDBx PUTC
    RTS
    ; Print argument separator (, )
    .label print-args.next
        $2C PUTC
        SP
        RTS
    ; Print new line
    .label print-args.end
        NL
        RTS