all repos — xyw @ 481fe7eafa064f39b9ea831d00de282712f3ef06

A minimal virtual machine and assembler for terminals.

examples/d6.xyw

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
.include "devices.xyw"

; Get random number and calculate modulo 6
clock.random LDBw $6 modulo JSRw

; Print result+1 and new line
$31 ADD console.output STBw
$0d console.output STBw

; Terminate
$0 system.state STBw

; Calculate the modulo
; a b -- a%b
.label modulo
    POPy POPx
    PSHx PSHy PSHx PSHy DIV MUL SUB
    RTS