... | ... |
@@ -1,4 +1,4 @@ |
1 |
-( gui/terminal ) |
|
1 |
+( UXN-DOS ) |
|
2 | 2 |
|
3 | 3 |
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV } |
4 | 4 |
%< { LTH } %> { GTH } %= { EQU } %! { NEQ } |
... | ... |
@@ -37,7 +37,7 @@ |
37 | 37 |
|
38 | 38 |
%RTN { JMP2r } |
39 | 39 |
|
40 |
-%WIDTH { #40 } |
|
40 |
+%WIDTH { #38 } |
|
41 | 41 |
%HEIGHT { #20 } |
42 | 42 |
%PAD { #0018 } |
43 | 43 |
|
... | ... |
@@ -53,7 +53,8 @@ |
53 | 53 |
|
54 | 54 |
|0000 |
55 | 55 |
|
56 |
-@buffer $80 |
|
56 |
+@buffer $3 |
|
57 |
+ &input $80 |
|
57 | 58 |
@path $40 |
58 | 59 |
@frame $1 |
59 | 60 |
|
... | ... |
@@ -62,9 +63,9 @@ |
62 | 63 |
|0100 ( -> ) |
63 | 64 |
|
64 | 65 |
( theme ) |
65 |
- #05f5 .System/r DEO2 |
|
66 |
- #0cf5 .System/g DEO2 |
|
67 |
- #0af5 .System/b DEO2 |
|
66 |
+ #50f8 .System/r DEO2 |
|
67 |
+ #c0f8 .System/g DEO2 |
|
68 |
+ #a0f8 .System/b DEO2 |
|
68 | 69 |
|
69 | 70 |
( vectors ) |
70 | 71 |
;on-button .Controller/vector DEO2 |
... | ... |
@@ -119,7 +120,7 @@ BRK |
119 | 120 |
&ver |
120 | 121 |
WIDTH #00 |
121 | 122 |
&hor |
122 |
- #03 .Screen/sprite DEO |
|
123 |
+ #02 .Screen/sprite DEO |
|
123 | 124 |
INC GTHk ,&hor JCN |
124 | 125 |
POP2 |
125 | 126 |
PAD .Screen/x DEO2 |
... | ... |
@@ -131,6 +132,8 @@ BRK |
131 | 132 |
RTN |
132 | 133 |
&blank-icn 8000 0000 0000 0000 |
133 | 134 |
|
135 |
+( DOS ) |
|
136 |
+ |
|
134 | 137 |
@validate ( -- ) |
135 | 138 |
|
136 | 139 |
;clear JSR2 |
... | ... |
@@ -151,15 +154,13 @@ JMP2r |
151 | 154 |
NIP2 ;commands -- RTN |
152 | 155 |
&continue |
153 | 156 |
INC2 INC2 GTH2k ,&loop JCN |
154 |
- &end |
|
155 | 157 |
POP2 ;commands -- |
156 | 158 |
|
157 | 159 |
RTN |
158 | 160 |
|
159 |
-@cmd-ls "ls $1 |
|
160 |
- &docs "list_folder_content $1 |
|
161 |
- &func |
|
161 |
+@cmd-ls "ls $1 &docs "list 20 "folder 20 "content $1 &func |
|
162 | 162 |
|
163 |
+ ( load ) |
|
163 | 164 |
;path .File/name DEO2 |
164 | 165 |
#8000 .File/length DEO2 |
165 | 166 |
;view .File/read DEO2 |
... | ... |
@@ -168,53 +169,97 @@ RTN |
168 | 169 |
|
169 | 170 |
RTN |
170 | 171 |
|
171 |
-@cmd-cp "cp $1 &docs "copy_file_to_name $1 |
|
172 |
- &func |
|
172 |
+@cmd-mk "mk $1 &docs "make 20 "file $1 &func |
|
173 |
+ |
|
174 |
+ ;buffer/input ;file-exists JSR2 #01 ! ,&no-exists JCN |
|
175 |
+ ;error-exists-txt ;buffer/input ;draw-message JSR2 RTN |
|
176 |
+ &no-exists |
|
177 |
+ ( save ) |
|
178 |
+ ;buffer/input .File/name DEO2 |
|
179 |
+ #0001 .File/length DEO2 |
|
180 |
+ ;&buf .File/write DEO2 |
|
181 |
+ ( message ) |
|
182 |
+ ;make-success-txt ;buffer/input ;draw-message JSR2 |
|
173 | 183 |
|
174 | 184 |
RTN |
185 |
+ &buf 0a |
|
175 | 186 |
|
176 |
-@cmd-mv "mv $1 &docs "move_file_to_name $1 |
|
187 |
+@cmd-cp "cp $1 &docs "copy 20 "file 20 "to 20 "name $1 &func |
|
188 |
+ |
|
189 |
+ ( b ) ;buffer/input #20 ;next-char JSR2 STH2k INC2 |
|
190 |
+ #00 STH2r STA |
|
191 |
+ ( a ) ;buffer/input |
|
192 |
+ ( a exists ) |
|
193 |
+ ;buffer/input ;file-exists JSR2 ,&valid JCN |
|
194 |
+ ;error-unexists-txt ;buffer/input ;draw-message JSR2 POP2 POP2 RTN |
|
195 |
+ &valid |
|
196 |
+ ( b unexists ) |
|
197 |
+ OVR2 ;file-exists JSR2 #00 = ,&available JCN |
|
198 |
+ OVR2 ;error-exists-txt SWP2 ;draw-message JSR2 POP2 POP2 RTN |
|
199 |
+ &available |
|
200 |
+ ( load ) |
|
201 |
+ .File/name DEO2 |
|
202 |
+ #8000 .File/length DEO2 |
|
203 |
+ ;view .File/read DEO2 |
|
204 |
+ ( save ) |
|
205 |
+ DUP2 .File/name DEO2 |
|
206 |
+ #8000 .File/length DEO2 |
|
207 |
+ ;view .File/write DEO2 |
|
208 |
+ ( message ) |
|
209 |
+ ;copy-success-txt SWP2 ;draw-message JSR2 |
|
210 |
+ |
|
211 |
+RTN |
|
212 |
+ |
|
213 |
+@cmd-mv "mv $1 &docs "move 20 "file 20 "to 20 "name $1 |
|
177 | 214 |
&func |
178 | 215 |
|
216 |
+ ( todo ) |
|
217 |
+ |
|
179 | 218 |
RTN |
180 | 219 |
|
181 |
-@cmd-rm "rm $1 &docs "remove_file $1 |
|
220 |
+@cmd-rm "rm $1 &docs "remove 20 "file $1 |
|
182 | 221 |
&func |
183 | 222 |
|
184 |
- ;buffer #0003 ++ .File/name DEO2 |
|
223 |
+ ( exists ) |
|
224 |
+ ;buffer/input ;file-exists JSR2 ,&valid JCN |
|
225 |
+ ;error-unexists-txt ;buffer/input ;draw-message JSR2 RTN |
|
226 |
+ &valid |
|
227 |
+ ( delete ) |
|
228 |
+ ;buffer/input .File/name DEO2 |
|
185 | 229 |
#01 .File/delete DEO |
186 |
- |
|
187 |
- ;&remove-txt #01 ;draw-str JSR2 |
|
188 |
- ;buffer #0003 ++ #01 ;draw-str JSR2 |
|
230 |
+ ( message ) |
|
231 |
+ ;remove-success-txt ;buffer/input ;draw-message JSR2 |
|
189 | 232 |
|
190 | 233 |
RTN |
191 |
- &remove-txt "removed_file: $1 |
|
192 | 234 |
|
193 |
-@cmd-tx "tx $1 &docs "display_file_as_text $1 |
|
235 |
+@cmd-tx "tx $1 &docs "display 20 "file 20 "as 20 "text $1 |
|
194 | 236 |
&func |
195 | 237 |
|
196 |
- ;buffer #0003 ++ .File/name DEO2 |
|
238 |
+ ( exists ) |
|
239 |
+ ;buffer/input ;file-exists JSR2 ,&valid JCN |
|
240 |
+ ;error-unexists-txt ;buffer/input ;draw-message JSR2 RTN |
|
241 |
+ &valid |
|
242 |
+ ( load ) |
|
243 |
+ ;buffer/input .File/name DEO2 |
|
197 | 244 |
#8000 .File/length DEO2 |
198 | 245 |
;view .File/read DEO2 |
199 |
- |
|
200 |
- .File/success DEI2 #0000 >> ,&valid JCN |
|
201 |
- ;&error-txt #02 ;draw-str JSR2 RTN &valid |
|
202 |
- |
|
246 |
+ ( message ) |
|
203 | 247 |
;view #01 ;draw-tx JSR2 |
204 | 248 |
|
205 | 249 |
RTN |
206 |
- &error-txt "unknown_file $1 |
|
207 | 250 |
|
208 |
-@cmd-hx "hx $1 &docs "display_file_as_hex $1 |
|
251 |
+@cmd-hx "hx $1 &docs "display 20 "file 20 "as 20 "hex $1 |
|
209 | 252 |
&func |
210 | 253 |
|
211 |
- ;buffer #0003 ++ .File/name DEO2 |
|
254 |
+ ( exists ) |
|
255 |
+ ;buffer/input ;file-exists JSR2 ,&valid JCN |
|
256 |
+ ;error-unexists-txt ;buffer/input ;draw-message JSR2 RTN |
|
257 |
+ &valid |
|
258 |
+ ( load ) |
|
259 |
+ ;buffer/input .File/name DEO2 |
|
212 | 260 |
#8000 .File/length DEO2 |
213 | 261 |
;view .File/read DEO2 |
214 |
- |
|
215 |
- .File/success DEI2 #0000 >> ,&valid JCN |
|
216 |
- ;&error-txt #02 ;draw-str JSR2 RTN &valid |
|
217 |
- |
|
262 |
+ ( message ) |
|
218 | 263 |
AUTO-YADDR |
219 | 264 |
.File/success DEI2 #0000 |
220 | 265 |
&loop |
... | ... |
@@ -234,15 +279,14 @@ RTN |
234 | 279 |
POP2 POP2 |
235 | 280 |
|
236 | 281 |
RTN |
237 |
- &error-txt "unknown_file $1 |
|
238 | 282 |
|
239 |
-@cmd-do "do $1 &docs "run_file_as_rom $1 |
|
283 |
+@cmd-do "do $1 &docs "run 20 "file 20 "as 20 "rom $1 |
|
240 | 284 |
&func |
241 | 285 |
|
242 | 286 |
( release inputs ) |
243 | 287 |
#0000 .Controller/button DEO2 |
244 | 288 |
|
245 |
- ;buffer #0003 ++ |
|
289 |
+ ;buffer/input |
|
246 | 290 |
DUP2 ;check-rom JSR2 ,&valid JCN |
247 | 291 |
PAD .Screen/x DEO2 |
248 | 292 |
PAD .Screen/y DEO2 |
... | ... |
@@ -253,9 +297,9 @@ RTN |
253 | 297 |
;load-rom JSR2 |
254 | 298 |
|
255 | 299 |
RTN |
256 |
- &invalid-txt "invalid_rom: $1 |
|
300 |
+ &invalid-txt "invalid 20 "rom: $1 |
|
257 | 301 |
|
258 |
-@cmd-tm "tm $1 &docs "display_time $1 |
|
302 |
+@cmd-tm "tm $1 &docs "display 20 "time $1 |
|
259 | 303 |
&func |
260 | 304 |
|
261 | 305 |
#00 .DateTime/month DEI 4* ;month-txt ++ #01 ;draw-str JSR2 |
... | ... |
@@ -272,7 +316,28 @@ RTN |
272 | 316 |
|
273 | 317 |
RTN |
274 | 318 |
|
275 |
-@cmd-?? "-- $1 &docs "display_commands $1 |
|
319 |
+@cmd-1b "1b $1 &docs "display 20 "1bit 20 "file $1 |
|
320 |
+ &func |
|
321 |
+ |
|
322 |
+ ( todo ) |
|
323 |
+ |
|
324 |
+RTN |
|
325 |
+ |
|
326 |
+@cmd-2b "2b $1 &docs "display 20 "2bit 20 "file $1 |
|
327 |
+ &func |
|
328 |
+ |
|
329 |
+ ( todo ) |
|
330 |
+ |
|
331 |
+RTN |
|
332 |
+ |
|
333 |
+@cmd-sn "sn $1 &docs "play 20 "sound 20 "file $1 |
|
334 |
+ &func |
|
335 |
+ |
|
336 |
+ ( todo ) |
|
337 |
+ |
|
338 |
+RTN |
|
339 |
+ |
|
340 |
+@cmd-?? "-- $1 &docs "display 20 "commands $1 |
|
276 | 341 |
&func |
277 | 342 |
|
278 | 343 |
;&help-txt #01 ;draw-tx JSR2 |
... | ... |
@@ -281,30 +346,42 @@ RTN |
281 | 346 |
;commands/end ;commands |
282 | 347 |
&loop |
283 | 348 |
PAD .Screen/x DEO2 |
284 |
- ( name ) LDA2k #08 ;draw-str JSR2 |
|
349 |
+ ( name ) LDA2k #04 ;draw-str JSR2 |
|
285 | 350 |
PAD #0020 ++ .Screen/x DEO2 |
286 | 351 |
( docs ) DUP2 ;commands -- ;commands-docs ++ LDA2 #01 ;draw-str JSR2 |
287 | 352 |
.Screen/y DEI2k #0010 ++ ROT DEO2 |
288 | 353 |
INC2 INC2 GTH2k ,&loop JCN |
289 |
- &end |
|
290 | 354 |
POP2 POP2 |
291 | 355 |
|
292 | 356 |
RTN |
293 | 357 |
&help-txt "Commands: $1 |
294 | 358 |
|
295 | 359 |
@commands |
296 |
- :cmd-ls :cmd-cp :cmd-mv :cmd-rm |
|
360 |
+ :cmd-ls :cmd-mk :cmd-cp :cmd-mv :cmd-rm |
|
297 | 361 |
:cmd-hx :cmd-tx :cmd-do :cmd-tm |
362 |
+ :cmd-1b :cmd-2b :cmd-sn |
|
298 | 363 |
&end :cmd-?? |
299 | 364 |
@commands-docs |
300 |
- :cmd-ls/docs :cmd-cp/docs :cmd-mv/docs :cmd-rm/docs |
|
365 |
+ :cmd-ls/docs :cmd-mk/docs :cmd-cp/docs :cmd-mv/docs :cmd-rm/docs |
|
301 | 366 |
:cmd-hx/docs :cmd-tx/docs :cmd-do/docs :cmd-tm/docs |
367 |
+ :cmd-1b/docs :cmd-2b/docs :cmd-sn/docs |
|
302 | 368 |
&end :cmd-??/docs |
303 | 369 |
@commands-func |
304 |
- :cmd-ls/func :cmd-cp/func :cmd-mv/func :cmd-rm/func |
|
370 |
+ :cmd-ls/func :cmd-mk/func :cmd-cp/func :cmd-mv/func :cmd-rm/func |
|
305 | 371 |
:cmd-hx/func :cmd-tx/func :cmd-do/func :cmd-tm/func |
372 |
+ :cmd-1b/func :cmd-2b/func :cmd-sn/func |
|
306 | 373 |
&end :cmd-??/func |
307 | 374 |
|
375 |
+@file-exists ( name* -- bool ) |
|
376 |
+ |
|
377 |
+ .File/name DEO2 |
|
378 |
+ #0040 .File/length DEO2 |
|
379 |
+ ;&buf .File/stat DEO2 |
|
380 |
+ .File/success DEI2 #0000 >> |
|
381 |
+ |
|
382 |
+RTN |
|
383 |
+ &buf $40 |
|
384 |
+ |
|
308 | 385 |
( gui ) |
309 | 386 |
|
310 | 387 |
@draw-input ( color -- ) |
... | ... |
@@ -331,6 +408,13 @@ RTN |
331 | 408 |
|
332 | 409 |
JMP2r |
333 | 410 |
|
411 |
+@draw-message ( a* b* -- ) |
|
412 |
+ |
|
413 |
+ SWP2 #02 ;draw-str JSR2 |
|
414 |
+ #01 ;draw-str JSR2 |
|
415 |
+ |
|
416 |
+RTN |
|
417 |
+ |
|
334 | 418 |
@draw-tx ( str* color -- ) |
335 | 419 |
|
336 | 420 |
AUTO-YADDR |
... | ... |
@@ -402,6 +486,18 @@ RTN |
402 | 486 |
|
403 | 487 |
( utils ) |
404 | 488 |
|
489 |
+@next-char ( addr* char -- addr* ) |
|
490 |
+ |
|
491 |
+ STH |
|
492 |
+ &while |
|
493 |
+ LDAk STHkr = ,&end JCN |
|
494 |
+ LDAk #00 = ,&end JCN |
|
495 |
+ INC2 LDAk ,&while JCN |
|
496 |
+ &end |
|
497 |
+ POPr |
|
498 |
+ |
|
499 |
+RTN |
|
500 |
+ |
|
405 | 501 |
@slen ( str* -- len* ) |
406 | 502 |
|
407 | 503 |
DUP2 ,scap JSR SWP2 -- |
... | ... |
@@ -428,22 +524,6 @@ RTN |
428 | 524 |
|
429 | 525 |
RTN |
430 | 526 |
|
431 |
-@scmp ( a* b* -- flag ) |
|
432 |
- |
|
433 |
- STH2 |
|
434 |
- &loop |
|
435 |
- LDAk LDAkr STHr = ,¬-diff JCN |
|
436 |
- POP2 POP2r #00 RTN |
|
437 |
- ¬-diff |
|
438 |
- LDAk LDAkr STHr #0000 !! ,¬-end JCN |
|
439 |
- POP2 POP2r #01 RTN |
|
440 |
- ¬-end |
|
441 |
- INC2 INC2r |
|
442 |
- ,&loop JMP |
|
443 |
- POP2 POP2r #00 |
|
444 |
- |
|
445 |
-RTN |
|
446 |
- |
|
447 | 527 |
@scmp-seg ( a* b* -- flag ) |
448 | 528 |
|
449 | 529 |
STH2 |
... | ... |
@@ -491,8 +571,12 @@ JMP2r |
491 | 571 |
|
492 | 572 |
JMP2r |
493 | 573 |
|
494 |
-~projects/library/check-rom.tal |
|
495 |
-~projects/library/load-rom.tal |
|
574 |
+@error-exists-txt "file_exists: 20 $1 |
|
575 |
+@error-unexists-txt "file_does_not_exists: 20 $1 |
|
576 |
+ |
|
577 |
+@make-success-txt "made: 20 $1 |
|
578 |
+@copy-success-txt "copied: 20 $1 |
|
579 |
+@remove-success-txt "removed: 20 $1 |
|
496 | 580 |
|
497 | 581 |
@week-txt |
498 | 582 |
"Sun $1 "Mon $1 "Tue $1 "Wed $1 "Thu $1 "Fri $1 |
... | ... |
@@ -616,4 +700,7 @@ JMP2r |
616 | 700 |
0000 1818 1818 0018 1818 1818 0000 0000 |
617 | 701 |
0000 7018 1818 0e18 1818 1870 0000 0000 |
618 | 702 |
|
703 |
+~projects/library/check-rom.tal |
|
704 |
+~projects/library/load-rom.tal |
|
705 |
+ |
|
619 | 706 |
@view |