all repos — xyw @ e661f8f5a8df59e16980a9f5203f2614dca2b4c2

A minimal virtual machine and assembler for terminals.

examples/cmdexec.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
 27
 28
.include "lib/macros.xyw"

; Set command to execute
cmd file.path STW
; Capture output to buffer
output file.read STW
$0100 file.length STW
; Execute command
file.op.exec file.operation STB
; Print captured output
output-prefix puts JSRw
output puts JSRw
; Print: Result: <code>\n
result-prefix puts JSRw
file.result LDW putdw JSRw NL
HLT

.include "lib/putdw.xyw"
.include "lib/puts.xyw"

.label output
.reserve $0100
.label output-prefix
.string "Output: "
.label result-prefix
.string "Result: "
.label cmd
.string "uname -s"