all repos — xyw @ c632e3a4cdd4d21b1f431030eb3723bbed10ae9d

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
 23
 24
; include device macros 
.include "lib/macros.xyw" 

; 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 
    LDBxw PUTC
    ; 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