39 | 39 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,202 @@ |
1 |
+( Dev/File ) |
|
2 |
+ |
|
3 |
+%RTN { JMP2r } |
|
4 |
+%STEP8 { #0033 SFT2 } |
|
5 |
+%++ { #01 ADD } |
|
6 |
+ |
|
7 |
+%->MS/STAT { .Mouse/state IOW } |
|
8 |
+%<-MS/STAT { .Mouse/state IOR } |
|
9 |
+%->SC/COLR { .Screen/color IOW } |
|
10 |
+%=>SC/ADDR { .Screen/addr IOW2 } |
|
11 |
+%=>SC/X { .Screen/x IOW2 } |
|
12 |
+%=>SC/Y { .Screen/y IOW2 } |
|
13 |
+%<=SC/X { .Screen/x IOR2 } |
|
14 |
+%<=MS/X { .Mouse/x IOR2 } |
|
15 |
+%<=MS/Y { .Mouse/y IOR2 } |
|
16 |
+ |
|
17 |
+%MEMORY { #1000 } |
|
18 |
+ |
|
19 |
+@loadbtn [ &x $2 &y $2 ] |
|
20 |
+@output [ &x $2 &y $2 ] |
|
21 |
+@pointer [ &x $2 &y $2 ] |
|
22 |
+@label [ &x $2 &y $2 &color $1 &addr $2 ] |
|
23 |
+ |
|
24 |
+( program ) |
|
25 |
+ |
|
26 |
+|0100 |
|
27 |
+ |
|
28 |
+ ( theme ) |
|
29 |
+ #804b .System/r IOW2 |
|
30 |
+ #804b .System/g IOW2 |
|
31 |
+ #e0bb .System/b IOW2 |
|
32 |
+ |
|
33 |
+ ( vectors ) |
|
34 |
+ ;on-mouse .Mouse/vector IOW2 |
|
35 |
+ |
|
36 |
+ #0020 .loadbtn/x STR |
|
37 |
+ #0020 .loadbtn/y STR |
|
38 |
+ #0020 .output/x STR |
|
39 |
+ #0030 .output/y STR |
|
40 |
+ |
|
41 |
+ .loadbtn/x LDR .loadbtn/y LDR #26 ;load_txt ;draw-label JSR2 |
|
42 |
+ |
|
43 |
+ ;draw-file JSR2 |
|
44 |
+ |
|
45 |
+BRK |
|
46 |
+ |
|
47 |
+@on-mouse ( -> ) |
|
48 |
+ |
|
49 |
+ .loadbtn/x LDR .loadbtn/y LDR #26 ;load_txt ;draw-label JSR2 |
|
50 |
+ .loadbtn/x LDR #0028 ADD2 .loadbtn/y LDR #23 ;srcpath ;draw-label JSR2 |
|
51 |
+ |
|
52 |
+ <-MS/STAT #00 EQU ,&touch-end JNZ |
|
53 |
+ |
|
54 |
+ <=MS/Y STEP8 .loadbtn/y LDR NEQ2 ,&no-touch-load JNZ |
|
55 |
+ .loadbtn/x LDR .loadbtn/y LDR #27 ;load_txt ;draw-label JSR2 |
|
56 |
+ ;srcpath #0100 ;load-file JSR2 |
|
57 |
+ ( release ) #00 ->MS/STAT |
|
58 |
+ &no-touch-load |
|
59 |
+ |
|
60 |
+ &touch-end |
|
61 |
+ |
|
62 |
+ ;draw-cursor JSR2 |
|
63 |
+ |
|
64 |
+BRK |
|
65 |
+ |
|
66 |
+@draw-file ( -- ) |
|
67 |
+ |
|
68 |
+ #00 #10 |
|
69 |
+ &ver |
|
70 |
+ ( pos-y ) OVR #00 SWP #0008 MUL2 .output/y LDR ADD2 =>SC/Y |
|
71 |
+ #00 #10 |
|
72 |
+ &hor |
|
73 |
+ ( pos-x ) OVR #00 SWP #0008 MUL2 .output/x LDR ADD2 =>SC/X |
|
74 |
+ ( get x,y ) SWP2 OVR STH SWP2 OVR STHr |
|
75 |
+ ( get id ) #10 MUL ADD |
|
76 |
+ ( get data ) #00 SWP MEMORY ADD2 PEK2 |
|
77 |
+ ( get sprite ) #20 SUB #00 SWP #0008 MUL2 ;font ADD2 =>SC/ADDR |
|
78 |
+ ( draw ) #2d ->SC/COLR |
|
79 |
+ ( incr ) SWP ++ SWP |
|
80 |
+ DUP2 NEQ ,&hor JNZ |
|
81 |
+ POP2 |
|
82 |
+ ( incr ) SWP ++ SWP |
|
83 |
+ DUP2 NEQ ,&ver JNZ |
|
84 |
+ POP2 |
|
85 |
+ |
|
86 |
+RTN |
|
87 |
+ |
|
88 |
+@load-file ( path length -- ) |
|
89 |
+ |
|
90 |
+ .File/length IOW2 .File/name IOW2 MEMORY .File/load IOW2 |
|
91 |
+ .File/success IOR2 #0000 EQU2 ,&no-success JNZ |
|
92 |
+ |
|
93 |
+ ;draw-file JSR2 |
|
94 |
+ .output/x LDR .output/y LDR #0088 ADD2 #23 ;done_txt ;draw-label JSR2 |
|
95 |
+ ( release ) #00 ->MS/STAT |
|
96 |
+ |
|
97 |
+ &no-success |
|
98 |
+ |
|
99 |
+RTN |
|
100 |
+ |
|
101 |
+@draw-cursor ( -- ) |
|
102 |
+ |
|
103 |
+ ( clear last cursor ) |
|
104 |
+ ;clear_icn =>SC/ADDR |
|
105 |
+ .pointer/x LDR =>SC/X |
|
106 |
+ .pointer/y LDR =>SC/Y |
|
107 |
+ #30 ->SC/COLR |
|
108 |
+ |
|
109 |
+ ( record pointer positions ) |
|
110 |
+ <=MS/X .pointer/x STR <=MS/Y .pointer/y STR |
|
111 |
+ |
|
112 |
+ ( draw new cursor ) |
|
113 |
+ ;cursor_icn =>SC/ADDR |
|
114 |
+ .pointer/x LDR =>SC/X |
|
115 |
+ .pointer/y LDR =>SC/Y |
|
116 |
+ #32 <-MS/STAT #00 NEQ ADD ->SC/COLR |
|
117 |
+ |
|
118 |
+RTN |
|
119 |
+ |
|
120 |
+@draw-label ( x y color addr -- ) |
|
121 |
+ |
|
122 |
+ ( load ) .label/addr STR .label/color POK =>SC/Y =>SC/X |
|
123 |
+ .label/addr LDR |
|
124 |
+ &loop |
|
125 |
+ ( draw ) DUP2 PEK2 #20 SUB #00 SWP #0008 MUL2 ;font ADD2 =>SC/ADDR .label/color PEK ->SC/COLR |
|
126 |
+ ( incr ) #0001 ADD2 |
|
127 |
+ ( incr ) <=SC/X #0008 ADD2 =>SC/X |
|
128 |
+ DUP2 PEK2 #00 NEQ ,&loop JNZ |
|
129 |
+ POP2 |
|
130 |
+ |
|
131 |
+RTN |
|
132 |
+ |
|
133 |
+@clear_icn [ 0000 0000 0000 0000 ] |
|
134 |
+@cursor_icn [ 80c0 e0f0 f8e0 1000 ] |
|
135 |
+ |
|
136 |
+@done_txt [ 4c4f 4144 2053 5543 4345 5353 2100 ] ( LOAD SUCCESS! ) |
|
137 |
+@load_txt [ 4c4f 4144 00 ] ( LOAD ) |
|
138 |
+@save_txt [ 5341 5645 00 ] ( SAVE ) |
|
139 |
+ |
|
140 |
+@srcpath [ 5245 4144 4d45 2e6d 6400 ] ( README.md ) |
|
141 |
+@dstpath [ 6269 6e2f 6578 706f 7274 2e6d 6400 ] ( bin/export.md ) |
|
142 |
+ |
|
143 |
+@font ( specter8-frag font ) |
|
144 |
+[ |
|
145 |
+ 0000 0000 0000 0000 0008 0808 0800 0800 |
|
146 |
+ 0014 1400 0000 0000 0024 7e24 247e 2400 |
|
147 |
+ 0008 1e28 1c0a 3c08 0000 2204 0810 2200 |
|
148 |
+ 0030 4832 4c44 3a00 0008 1000 0000 0000 |
|
149 |
+ 0004 0808 0808 0400 0020 1010 1010 2000 |
|
150 |
+ 0000 2214 0814 2200 0000 0808 3e08 0800 |
|
151 |
+ 0000 0000 0000 0810 0000 0000 3e00 0000 |
|
152 |
+ 0000 0000 0000 0800 0000 0204 0810 2000 |
|
153 |
+ 003c 464a 5262 3c00 0018 0808 0808 1c00 |
|
154 |
+ 003c 4202 3c40 7e00 003c 421c 0242 3c00 |
|
155 |
+ 000c 1424 447e 0400 007e 407c 0242 3c00 |
|
156 |
+ 003c 407c 4242 3c00 007e 0204 0810 1000 |
|
157 |
+ 003c 423c 4242 3c00 003c 4242 3e02 3c00 |
|
158 |
+ 0000 0010 0000 1000 0000 1000 0010 1020 |
|
159 |
+ 0000 0810 2010 0800 0000 003e 003e 0000 |
|
160 |
+ 0000 1008 0408 1000 003c 420c 1000 1000 |
|
161 |
+ 003c 4232 4a42 3c00 003c 4242 7e42 4200 |
|
162 |
+ 007c 427c 4242 7c00 003c 4240 4042 3c00 |
|
163 |
+ 007c 4242 4242 7c00 007e 4078 4040 7e00 |
|
164 |
+ 007e 4078 4040 4000 003c 4240 4642 3c00 |
|
165 |
+ 0042 427e 4242 4200 001c 0808 0808 1c00 |
|
166 |
+ 007e 0202 0242 3c00 0042 4478 4442 4200 |
|
167 |
+ 0040 4040 4040 7e00 0042 665a 4242 4200 |
|
168 |
+ 0042 6252 4a46 4200 003c 4242 4242 3c00 |
|
169 |
+ 007c 4242 7c40 4000 003c 4242 4244 3a00 |
|
170 |
+ 007c 4242 7c44 4200 003e 403c 0242 3c00 |
|
171 |
+ 007e 0808 0808 1000 0042 4242 4244 3a00 |
|
172 |
+ 0042 4242 4224 1800 0042 4242 5a66 4200 |
|
173 |
+ 0042 423c 4242 4200 0042 423e 0242 3c00 |
|
174 |
+ 007e 020c 3040 7e00 000c 0808 0808 0c00 |
|
175 |
+ 0040 2010 0804 0200 0030 1010 1010 3000 |
|
176 |
+ 0008 1400 0000 0000 0000 0000 0000 7e00 |
|
177 |
+ 0008 0400 0000 0000 0000 3c02 3e42 3a00 |
|
178 |
+ 0040 407c 4242 7c00 0000 3c42 4042 3c00 |
|
179 |
+ 0002 023e 4242 3e00 0000 3c42 7e40 3e00 |
|
180 |
+ 0000 3e40 7840 4000 0000 3c42 3e02 3c00 |
|
181 |
+ 0040 405c 6242 4200 0008 0018 0808 0400 |
|
182 |
+ 0008 0018 0808 4830 0040 4244 7844 4200 |
|
183 |
+ 0010 1010 1010 0c00 0000 6c52 5252 5200 |
|
184 |
+ 0000 5c62 4242 4200 0000 3c42 4242 3c00 |
|
185 |
+ 0000 7c42 427c 4040 0000 3e42 423e 0202 |
|
186 |
+ 0000 5c62 4040 4000 0000 3e40 3c02 7c00 |
|
187 |
+ 0008 7e08 0808 1000 0000 4242 4244 3a00 |
|
188 |
+ 0000 4242 4224 1800 0000 5252 5252 2e00 |
|
189 |
+ 0000 4224 1824 4200 0000 4242 3e02 7c00 |
|
190 |
+ 0000 7e02 3c40 7e00 000c 0810 1008 0c00 |
|
191 |
+ 0008 0808 0808 0800 0030 1008 0810 3000 |
|
192 |
+ 0000 0032 4c00 0000 3c42 99a1 a199 423c |
|
193 |
+] |
|
194 |
+ |
|
195 |
+( devices ) |
|
196 |
+ |
|
197 |
+|ff00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ] |
|
198 |
+|ff10 @Console [ &pad $8 &char $1 &byte $1 &short $2 &string $2 ] |
|
199 |
+|ff20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ] |
|
200 |
+|ff40 @Controller [ &vector $2 &button $1 &key $1 ] |
|
201 |
+|ff60 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &chord $1 ] |
|
202 |
+|ff70 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ] |