Browse code

Added procedurally generated wallpaper example

Andrew Alderwick authored on 13/04/2021 21:47:46
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,65 @@
1
+;scroll { x 2 y 2 wait 1 }
2
+
3
+( devices )
4
+
5
+|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
6
+|0110 ;Console { vector 2 pad 6 char 1 byte 1 short 2 string 2 }
7
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
8
+|0130 ;Audio { wave 2 envelope 2 pad 4 volume 1 pitch 1 play 1 value 2 delay 2 finish 1 }
9
+|0140 ;Controller { vector 2 button 1 key 1 }
10
+|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
11
+|0170 ;File { vector 2 pad 6 name 2 length 2 load 2 save 2 }
12
+|01a0 ;DateTime { year 2 month 1 day 1 hour 1 minute 1 second 1 dotw 1 doty 2 isdst 1 refresh 1 }
13
+
14
+|0200 @RESET
15
+    #90ff =System.r #9000 =System.g #900f =System.b
16
+    #08e0 ~Screen.width #0001 SFT2 SUB2 =scroll.x
17
+    #09b0 =scroll.y
18
+    ,frame =Screen.vector
19
+    #30 =scroll.wait
20
+    BRK
21
+
22
+@frame
23
+    #ffff
24
+    $loop
25
+    DUP2 ^row JSR
26
+    #0001 ADD2
27
+    DUP2 ~Screen.height LTH2 ^$loop JNZ
28
+    POP2
29
+    ~scroll.wait ^$noscroll JNZ
30
+    ~scroll.y #0001 ADD2 =scroll.y
31
+    BRK
32
+
33
+    $noscroll
34
+    ~scroll.wait #01 SUB =scroll.wait
35
+    BRK
36
+
37
+@row ( y* -- )
38
+    DUP2 =Screen.y
39
+    ~scroll.y ADD2
40
+
41
+    ~Screen.width
42
+    $loop
43
+    #0001 SUB2
44
+    OVR2 OVR2 ~scroll.x ADD2 EOR2 DUP2 #0013 DIV2 #0013 MUL2 SUB2
45
+    DUP #00 EQU ^$draw JNZ
46
+    DUP #05 EQU ^$draw JNZ
47
+    POP2
48
+    $rest
49
+    DUP2 ORA ^$loop JNZ
50
+    POP2 POP2
51
+    JMP2r
52
+
53
+    #15 =Screen.color
54
+    JMP2r
55
+
56
+    $draw
57
+    OVR2 =Screen.x
58
+    #05 ADD =Screen.color
59
+    ~Screen.y
60
+    DUP2 #0001 ADD2 =Screen.y
61
+    #00 =Screen.color
62
+    =Screen.y
63
+    POP
64
+    ^$rest JMP
65
+