uxn/projects/examples/dev.file.usm

68 lines
1008 B
Plaintext
Raw Normal View History

2021-04-02 00:53:41 -04:00
( Dev/File )
2021-03-23 16:10:35 -04:00
%RTN { JMP2r }
( devices )
|0100 ;Console { pad 8 char 1 byte 1 short 2 }
|0160 ;File { offset 2 append 1 pad 5 name 2 length 2 load 2 save 2 }
|01F0 .RESET .FRAME .ERROR ( vectors )
|01F8 [ 13fd 1ef3 1bf2 ] ( palette )
( program )
|0200 @RESET
#11
$loop
,text1 ,print-label JSR2
,scramble JSR2
2021-03-26 13:35:00 -04:00
#01 SUB DUP ,$loop ROT JNZ2
2021-03-23 16:10:35 -04:00
BRK
@print-label ( text )
$loop NOP
2021-03-24 12:39:19 -04:00
( send ) DUP2 PEK2 =Console.char
2021-03-23 16:10:35 -04:00
( incr ) #0001 ADD2
2021-03-24 12:39:19 -04:00
( loop ) DUP2 PEK2 #00 NEQ ^$loop MUL JMP
2021-03-23 16:10:35 -04:00
POP2
RTN
@scramble
,filename =File.name
#00 =File.append
#0000 =File.offset
#0003 =File.length
,text1 #000d ADD2 =File.save
#01 =File.append
#0003 =File.offset
#000d =File.length
,text1 =File.save
#0000 =File.offset
#0004 =File.length
,text1 =File.load
#0004 =File.offset
#0008 =File.length
,text1 #0008 ADD2 =File.load
#000c =File.offset
#0004 =File.length
,text1 #0004 ADD2 =File.load
RTN
@text1 [ Welcome 20 to 20 UxnVM 0a00 ]
@filename [ textio.bit ]
@FRAME BRK
@ERROR BRK