all repos — xyw @ 646f057cb6472175f8030b4dcc8ecb45d8581cf1

A minimal virtual machine and assembler for terminals.

examples/helloworld.xyw

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
; main program
hello print JSRw
end JMPw

; a16 --
; printing subroutine
.label print
  ; store top of stack to register XW
  POPxw
  .label print.loop
    ; dereference address in XW and print 
    ; by setting the terminal output ($11) byte
    LDBxw $11 STB
    ; increment address, dereference 
    ; go back to loop unless zero
    INCxw LDBxw print.loop JCNw
    RTS

; store null-terminated string
.label hello
  .string "Hello, World!\n"
.label end