browser

fileops.xyw

fileops.xyw
calendarsave
.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