all repos — xyw @ 481fe7eafa064f39b9ea831d00de282712f3ef06

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 "devices.xyw" 

; main program
hello print JSRw
; terminate
$0 system.state STB

; a16 --
; printing subroutine
.label print
  ; store top of stack to register XW
  POPxw
  .label print.loop
    ; dereference address in XW and print 
    LDBxw console.output 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"