Browse code

Add example for enhanced file device.

Andrew Alderwick authored on 23/03/2021 20:10:35
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,67 @@
1
+( hello world )
2
+
3
+%RTN { JMP2r }
4
+
5
+( devices )
6
+
7
+|0100 ;Console { pad 8 char 1 byte 1 short 2 }
8
+|0160 ;File { offset 2 append 1 pad 5 name 2 length 2 load 2 save 2 }
9
+|01F0 .RESET .FRAME .ERROR ( vectors )
10
+|01F8 [ 13fd 1ef3 1bf2 ] ( palette )
11
+
12
+( program )
13
+
14
+|0200 @RESET
15
+	
16
+	#11
17
+	$loop
18
+		,text1 ,print-label JSR2
19
+		,scramble JSR2
20
+		#01 SUB DUP ,$loop ROT JMP2?
21
+
22
+BRK
23
+
24
+@print-label ( text )
25
+	
26
+	$loop NOP
27
+		( send ) DUP2 LDR =Console.char
28
+		( incr ) #0001 ADD2
29
+		( loop ) DUP2 LDR #00 NEQ ^$loop MUL JMP 
30
+	POP2
31
+
32
+RTN
33
+
34
+@scramble
35
+	
36
+	,filename =File.name
37
+	
38
+	#00 =File.append
39
+	#0000 =File.offset
40
+	#0003 =File.length
41
+	,text1 #000d ADD2 =File.save
42
+	
43
+	#01 =File.append
44
+	#0003 =File.offset
45
+	#000d =File.length
46
+	,text1 =File.save
47
+	
48
+	#0000 =File.offset
49
+	#0004 =File.length
50
+	,text1 =File.load
51
+	
52
+	#0004 =File.offset
53
+	#0008 =File.length
54
+	,text1 #0008 ADD2 =File.load
55
+	
56
+	#000c =File.offset
57
+	#0004 =File.length
58
+	,text1 #0004 ADD2 =File.load
59
+
60
+RTN
61
+
62
+
63
+@text1 [ Welcome 20 to 20 UxnVM 0a00 ]
64
+@filename [ textio.bit ]
65
+
66
+@FRAME BRK
67
+@ERROR BRK