examples/fileops.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 29 30 31 |
.include "lib/macros.xyw"
; Write test.txt
test.txt file.path STW
contents_write file.write STW
$0100 file.length STW
file.op.write file.operation STB
; Read test.txt
contents_read file.read STW
$0100 file.length STW
file.op.read file.operation STB
; Print read contents
contents_read puts JSRw
; Delete test.txt
file.op.delete file.operation STB
; Exit
HLT
.include "lib/puts.xyw"
.label test.txt
.string "test.txt"
.label contents_write
.string "This is a test file.\nIt has multiple lines.\n"
.label contents_read
|