commit 93d8fad
Devine Lu Linvega
·
2026-06-27 19:10:51 +0000 UTC
parent c0e6b5a
Pulled latest M/PC
1 files changed,
+221,
-61
+221,
-61
1@@ -16,6 +16,7 @@
2 |0080 @path/buflen
3 |0200 @bios/buflen
4 |0800 @dir/buflen
5+|0120 @meta/buflen
6 |ff00 @dict/cap
7 |0008 @bios/anchor-x
8 |0028 @bios/anchor-y
9@@ -32,8 +33,8 @@
10 ;meta #06 DEO2
11 theme/<load>
12 ;dict/home-path path/<set>
13- window/<init>
14- spacer/<draw>
15+ window/<update>
16+ window/<draw-spacer>
17 input/<bind>
18 bios/<welcome>
19 .Console/type DEI ?{ BRK }
20@@ -44,7 +45,7 @@
21 ( name ) "M/PC 0a
22 ( details ) "Monitor/Program 20 "Control 0a
23 ( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
24- ( date ) "26 20 "Jun 20 "2026 00
25+ ( date ) "27 20 "Jun 20 "2026 00
26 ( . ) 03
27 ( - ) 56 =Varvara/version
28 ( - ) 83 =appicon
29@@ -91,25 +92,37 @@
30 @input/handle-input ( c -- )
31 DUP ?{ POP JMP2r }
32 DUP #08 EQU ?/on-bs
33+ DUP #09 EQU ?/on-tab
34 DUP #0a EQU ?/on-enter
35 DUP #7f EQU ?/on-del
36 DUP #20 GTH ?{ POP #20 }
37 sel/<reset-draw>
38- /<push> !/<redraw>
39+ /<push>
40+ autocomplete/<update> !/<redraw>
41
42 &on-bs ( c -- )
43- POP /<pop> !/<redraw>
44+ POP /<pop>
45+ autocomplete/<reset> !/<redraw>
46+
47+ &on-tab ( c -- )
48+ POP autocomplete/get INC2k ORA ?{ POP2 JMP2r }
49+ /<push-str> !/<redraw>
50
51 &on-enter ( c -- )
52- POP !/<eval>
53+ POP autocomplete/<reset> !/<eval>
54
55 &on-del ( c -- )
56 POP !/<blank>
57
58+@input/is-active ( -- t )
59+ [ LIT2 -&buf _&+ptr ] LDR NEQ JMP2r
60+
61+@input/get-length ( -- length* )
62+ [ LIT2 00 _&+ptr ] LDR .&buf SUB JMP2r
63+
64 @input/<reset> ( -- )
65 #0000 .&buf STZ2
66- [ LIT2 -&buf _&+ptr ] STR
67- JMP2r
68+ [ LIT2 -&buf _&+ptr ] STR !autocomplete/<reset>
69
70 @input/<push-str-quoted> ( str* -- )
71 DUP2 str/is-word ?/<push-str>
72@@ -137,46 +150,55 @@
73
74 @input/<eval-partial> ( -- )
75 ;&buf LDAk ?{ POP2 !bios/<welcome> }
76- bios/<parse-partial>
77- /<reset> !/<redraw>
78+ bios/<parse-partial> !/<reset-draw>
79
80 @input/<eval> ( -- )
81 sel/is-active ?sel/<pick>
82+ ( >> )
83+
84+@input/<eval-force> ( -- )
85 ;&buf LDAk ?{ POP2 !bios/<welcome> }
86- bios/<parse>
87- /<reset> !/<redraw>
88+ bios/<parse> !/<reset-draw>
89
90 @input/<blank> ( -- )
91 sel/is-active ?sel/<reset-draw>
92- /<reset>
93 bios/<redraw>
94 ( >> )
95
96+@input/<reset-draw> ( -- )
97+ /<reset>
98+ ( >> )
99+
100 @input/<redraw> ( -- )
101 ;bios/anchor-x #0018 Screen/<set-pos>
102 [ LIT2 e0 -Screen/pixel ] DEO
103 #0008 .Screen/y DEO2
104 path/<draw>
105 /get-origin #45 font/<draw-str-color>
106+ autocomplete/<draw>
107 ;&caret !font/<draw-sprite>
108
109-@input/get-length ( -- length* )
110- #00 ;&+ptr LDA ;&buf SUB2 JMP2r
111-
112 @input/get-origin ( -- buf* )
113 /get-length window/get-margin #03 SFT2 #0002 SUB2 LTH2k ?{
114 ( follow cursor ) SUB2 ;&buf ADD2 JMP2r }
115 POP2 POP2 ;&buf JMP2r
116
117-@spacer/<draw> ( -- )
118- #0000 #0018 Screen/<set-pos>
119- ;&wave .Screen/addr DEO2
120- [ LIT2 01 -Screen/auto ] DEO
121- window/get-cols SUB [ LIT2r 41 -Screen/sprite ]
122- &>l
123- DEOkr
124- INC DUP ?/>l
125- POP POP2r JMP2r
126+@autocomplete/get ( -- str* )
127+ ,&addr LDR2 INC2k ORA ?{ JMP2r }
128+ ;input/buf str/len ADD2 JMP2r
129+
130+@autocomplete/<reset> ( -- )
131+ #ffff ,&addr STR2
132+ JMP2r
133+
134+@autocomplete/<update> ( -- )
135+ ;input/buf bios/find-seg INC2k ORA ?{ POP2 !/<reset> }
136+ LDA2 ,&addr STR2
137+ JMP2r
138+
139+@autocomplete/<draw> ( -- )
140+ [ LIT2 &addr $2 ] INC2k ORA ?{ POP2 JMP2r }
141+ input/get-length ADD2 #43 !font/<draw-str-color>
142
143 (
144 @|Bios )
145@@ -188,10 +210,20 @@
146 ;dict/ready2 /<push> !/<redraw>
147
148 @bios/<dir> ( -- )
149- sel/<reset>
150+ sel/is-active ?sel/<reset-draw>
151+ input/is-active ?input/<reset-draw>
152 /<reset>
153 dir/<eval> !/<redraw>
154
155+@bios/find-seg ( str* -- <res>* )
156+ ,&t STR2
157+ ;&+ptr LDA2 ;&buf
158+ &>lfs
159+ NEQ2k ?{
160+ POP2 #ffff &end NIP2 JMP2r }
161+ LDA2k [ LIT2 &t $2 ] str/seg ?/end
162+ INC2 INC2 !/>lfs
163+
164 @bios/get-symbol ( id -- sym* )
165 #00 SWP DUP ADD ;&buf ADD2 LDA2 JMP2r
166
167@@ -218,7 +250,8 @@
168 &>w
169 dict/alloc /<push>
170 str/walk-ws LDAk ?/>w
171- POP2 !/<redraw>
172+ POP2 reader/is-bound ?{ !/<redraw> }
173+ JMP2r
174
175 @bios/<reset> ( -- )
176 ;&buf ,&+ptr STR2 !scroll/<reset>
177@@ -284,24 +317,31 @@
178 @bios/<use> ( id -- )
179 /get-symbol
180 ( | handlers )
181- DUP2 str/is-dir ?/<use-move>
182- DUP2 str/is-icn ?/<use-draw>
183- DUP2 str/is-rom ?/<use-load>
184- path/make DUP2 file/is-text ?reader/<bind>
185+ DUP2 str/is-dir ?/<use-mov>
186+ DUP2 str/is-icn ?/<use-icn>
187+ DUP2 str/is-rom ?/<use-run>
188+ DUP2 path/make file/is-text ?/<use-txt>
189 POP2 JMP2r
190
191-@bios/<use-move> ( str* -- )
192- sel/<reset>
193- input/<redraw>
194- /<reset>
195- path/<move>
196- dir/<eval> !/<redraw>
197+@bios/<use-mov> ( str* -- )
198+ input/<push-str>
199+ ;&cmd-mov !input/<push-str>
200+ &cmd-mov 20 "mov 00
201+
202+@bios/<use-icn> ( str* -- )
203+ input/<push-str>
204+ ;&cmd-icn !input/<push-str>
205+ &cmd-icn 20 "icn 00
206
207-@bios/<use-draw> ( str* -- )
208- icn/<select> !/<redraw>
209+@bios/<use-run> ( str* -- )
210+ input/<push-str>
211+ ;&cmd-run !input/<push-str>
212+ &cmd-run 20 "run 00
213
214-@bios/<use-load> ( str* -- )
215- run/<select> !/<redraw>
216+@bios/<use-txt> ( name* -- )
217+ input/<push-str>
218+ ;&cmd-txt !input/<push-str>
219+ &cmd-txt 20 "0 20 "txt 00
220
221 @symbol/<draw> ( str* unsel -- )
222 ?{
223@@ -393,6 +433,7 @@
224 @|Selection )
225
226 @sel/<use> ( -- )
227+ input/is-active ?input/<eval-force>
228 ,&id LDR INCk ?bios/<use>
229 POP JMP2r
230
231@@ -406,6 +447,13 @@
232 ( clamp ) DUP bios/get-depth NIP LTH ?/<set>
233 POP JMP2r
234
235+@sel/has-meta ( -- t )
236+ ,&id LDR INCk ?{ POP #00 JMP2r }
237+ bios/get-symbol DUP2 str/is-rom ?{ POP2 #00 JMP2r }
238+ path/make file/get-meta ORAk ?{ POP2 #00 JMP2r }
239+ meta/<load>
240+ #01 JMP2r
241+
242 @sel/is-active ( -- bool )
243 #ff
244 ( >> )
245@@ -489,12 +537,15 @@
246 DUP #10 NEQ ?{ /<select-prev> }
247 DUP #20 NEQ ?{ /<select-next> }
248 POP .Controller/key DEI DUP ?{ POP BRK }
249- input/<bind>
250+ /<leave>
251 input/handle-input BRK
252
253 @reader/<leave> ( -- )
254 input/<bind> !bios/<redraw>
255
256+@reader/is-bound ( -- t )
257+ .Controller/vector DEI2 ;&on-controller EQU2 JMP2r
258+
259 @reader/<bind> ( str* -- )
260 .File/name DEO2
261 ;&on-controller .Controller/vector DEO2
262@@ -557,12 +608,12 @@
263 @cmds/lut [ =cmd/api ]
264 &lut-clip [
265 =dir/api =mov/api =now/api =run/api
266- =icn/api =len/api =put/api =get/api
267- =cpy/api =era/api =ren/api =pop/api
268- =dup/api =ovr/api =swp/api =rot/api
269- =dec/api =hex/api =cat/api =cmp/api
270- =and/api =ora/api =out/api =bye/api
271- &lutend ]
272+ =icn/api =txt/api =len/api =put/api
273+ =get/api =cpy/api =era/api =ren/api
274+ =pop/api =dup/api =ovr/api =swp/api
275+ =rot/api =dec/api =hex/api =cat/api
276+ =cmp/api =and/api =ora/api =rsz/api
277+ =out/api =bye/api &lutend ]
278
279 @cmd/<eval> ( -- )
280 ;cmds/lutend ;cmds/lut-clip
281@@ -612,24 +663,27 @@
282
283 @run/<eval> ( -- )
284 bios/is-empty ?bios/<push-err-underflow>
285- bios/pop
286- ( >> )
287-
288-@run/<select> ( name* -- )
289- path/make
290+ bios/pop path/make
291 ( ? ) DUP2 file/is-oversized ?{
292 ( ? ) DUP2 file/exists ?loader/<bind>
293 POP2 !bios/<push-err-missing> }
294 POP2 !bios/<push-err-oversized>
295 &api =dict/run =&<eval> "<run> 20 "( 20 "f.rom 20 09 20 "ok 20 ") 00
296
297+@txt/<eval> ( -- )
298+ bios/is-thtwo ?bios/<push-err-underflow>
299+ ( line* ) bios/pop
300+ ( path* ) bios/pop path/make
301+ ( ? ) DUP2 file/exists ?{ POP2 POP2 !bios/<push-err-missing> }
302+ ( ? ) DUP2 file/is-text ?{ POP2 POP2 !bios/<push-err-binary> }
303+ reader/<bind>
304+ str/dec reader/<select-line>
305+ ;dict/ok !bios/<push>
306+ &api =dict/txt =&<eval> "<txt> 20 "( 20 "f.txt 20 "line 20 09 20 "ok 20 ") 00
307+
308 @icn/<eval> ( -- )
309 bios/is-empty ?bios/<push-err-underflow>
310- bios/pop
311- ( >> )
312-
313-@icn/<select> ( path* -- )
314- path/make
315+ bios/pop path/make
316 ( ? ) DUP2 file/exists ?{ POP2 !bios/<push-err-missing> }
317 /<draw>
318 ;dict/ok !bios/<push>
319@@ -816,6 +870,13 @@
320 @hex/chr ( hex -- char )
321 #0f AND DUP #09 GTH #27 MUL ADD LIT "0 ADD JMP2r
322
323+@rsz/<eval> ( -- )
324+ bios/is-thtwo ?bios/<push-err-underflow>
325+ ( h* ) bios/pop str/dec
326+ ( w* ) bios/pop str/dec SWP2k window/<set-size>
327+ .Screen/width DEI2 EQU2 ROT ROT .Screen/height DEI2 EQU2 AND !bios/<push-bool>
328+ &api =dict/rsz =&<eval> "<rsz> 20 "( 20 "w 20 "h 20 09 20 "bool 20 ") 00
329+
330 @out/<eval> ( -- )
331 bios/is-empty ?bios/<push-err-underflow>
332 bios/pop !str/<print>
333@@ -915,7 +976,7 @@
334 JMP2r
335
336 @font/<draw-lb> ( -- )
337- ;bios/anchor-x .Screen/y DEI2 #0010 ADD2 Screen/<set-pos>
338+ [ LIT2 &anchor =bios/anchor-x ] .Screen/y DEI2 #0010 ADD2 Screen/<set-pos>
339 JMP2r
340
341 @font/<draw-tab> ( -- )
342@@ -1002,7 +1063,24 @@
343 ( addr* ) #00 ROT #0f AND #30 SFT2 ;curtain/out-short ADD2 window/<fill>
344 BRK
345
346-@window/<init> ( -- )
347+@window/<set-size> ( w* h* -- )
348+ .Screen/height DEO2
349+ .Screen/width DEO2
350+ input/<redraw>
351+ /<update>
352+ ( >> )
353+
354+@window/<draw-spacer> ( -- )
355+ #0000 #0018 Screen/<set-pos>
356+ ;&wave .Screen/addr DEO2
357+ [ LIT2 01 -Screen/auto ] DEO
358+ /get-cols SUB [ LIT2r 41 -Screen/sprite ]
359+ &>l
360+ DEOkr
361+ INC DUP ?/>l
362+ POP POP2r JMP2r
363+
364+@window/<update> ( -- )
365 .Screen/width DEI2 DUP2 #01 SFT2 ,¢er STR2
366 DUP2 #0010 SUB2 ,&margin STR2
367 #03 SFT2 ,&cols STR2
368@@ -1062,6 +1140,33 @@
369 POP2 INC2 LDAk ?/>cat
370 POP2 #ffff JMP2r
371
372+@file/get-meta ( path* -- addr* )
373+ #0000 ,&port-deo2 STR2
374+ ( | lit2 addr* )
375+ .File/name DEO2
376+ #0001 .File/length DEO2
377+ ;&lit2 .File/read DEO2
378+ #0002 .File/length DEO2
379+ ;&addr .File/read DEO2
380+ .File/success-lb DEI ?{ #0000 JMP2r }
381+ ( | lit port-deo2* )
382+ #0001 .File/length DEO2
383+ ;&lit .File/read DEO2
384+ #0002 .File/length DEO2
385+ ;&port-deo2 .File/read DEO2
386+ .File/success-lb DEI ?{ #0000 JMP2r }
387+ ( a ) [ LIT2 &lit2 $1 &lit $1 ] #a080 EQU2
388+ ( b ) [ LIT2 &port-deo2 $2 ] #0637 EQU2 AND ?{ #0000 JMP2r }
389+ [ LIT2 &addr $2 ] JMP2r
390+
391+@file/<seek> ( addr* -- )
392+ #0100 SUB2 .File/name DEI2k ROT DEO2
393+ #0000 INC2k .File/length DEO2
394+ &>lf
395+ ;&b .File/read DEO2
396+ INC2 GTH2k ?/>lf
397+ POP2 POP2 JMP2r
398+
399 @file/seek-line ( line* -- not-eof )
400 .File/name DEI2k ROT DEO2
401 ORAk ?{ POP2 #01 JMP2r }
402@@ -1218,6 +1323,17 @@
403 LDAk LIT "0 NEQ ?{ INC2 LDAk ?/>wz }
404 JMP2r
405
406+@str/seg ( str* seg* -- bool )
407+ DUP2 /len SWP2 !mem/cmp
408+
409+@mem/cmp ( a* length* b* -- t )
410+ STH2
411+ OVR2 ADD2 SWP2
412+ &>l
413+ EQU2k ?{
414+ LDAk LDAkr STHr NEQ ?{ INC2 INC2r !/>l } }
415+ POP2r EQU2 JMP2r
416+
417 @date/make ( -- str* )
418 ;&buf DUP2 ,&+ptr STR2
419 ( | Make string )
420@@ -1284,6 +1400,7 @@
421 ;bios/anchor-x DUP2 ,&x STR2
422 .Screen/y DEI2 #0018 ADD2 DUP2 ,&y STR2
423 Screen/<set-pos>
424+ sel/has-meta ?meta/<draw>
425 [ LIT2 66 -Screen/auto ] DEO
426 ;&asset .Screen/addr DEO2
427 [ LIT2 45 -Screen/sprite ] DEOk DEO
428@@ -1315,6 +1432,43 @@
429 ;&asset .File/read DEO2
430 JMP2r
431
432+@meta/<load> ( addr* -- )
433+ file/<seek>
434+ ;&buflen .File/length DEO2
435+ ;&buf .File/read DEO2
436+ ;&body str/cap INC2
437+ ( | parse fields )
438+ [ LIT2 00 _&has-icon ] STR
439+ LDAk #00 SWP #0003 MUL2 OVR2 INC2 ADD2 SWP2 INC2
440+ &>l
441+ LDAk #83 NEQ ?{
442+ ( | Load icon )
443+ INC2k LDA2 file/<seek>
444+ #0090 .File/length DEO2
445+ ;&icon .File/read DEO2
446+ [ LIT2 90 -File/success-lb ] DEI EQU ,&has-icon STR }
447+ #0003 ADD2 GTH2k ?/>l
448+ POP2 POP2 JMP2r
449+
450+@meta/<draw> ( -- )
451+ /<draw-icon>
452+ .Screen/x DEI2 #0020 ADD2 .Screen/y DEI2 #0018 SUB2 Screen/<set-pos>
453+ #0028 ;font/anchor STA2
454+ ;&body #41 font/<draw-str-color>
455+ ;bios/anchor-x ;font/anchor STA2
456+ JMP2r
457+
458+@meta/<draw-icon> ( -- )
459+ [ LIT &has-icon $1 ] ?{
460+ ;&no-icon .Screen/addr DEO2
461+ [ LIT2 22 -Screen/auto ] DEO
462+ [ LIT2 c5 -Screen/sprite ] DEOk DEOk DEO
463+ JMP2r }
464+ ;&icon .Screen/addr DEO2
465+ [ LIT2 26 -Screen/auto ] DEO
466+ [ LIT2 c5 -Screen/sprite ] DEOk DEOk DEO
467+ JMP2r
468+
469 @theme/<reset> ( -- )
470 #f0a8 #f0ec #f0b9
471 ( >> )
472@@ -1360,6 +1514,7 @@
473 &dir "dir 00
474 &mov "mov 00
475 &run "run 00
476+ &txt "txt 00
477 &put "put 00
478 &era "era 00
479 &ren "ren 00
480@@ -1382,6 +1537,7 @@
481 &out "out 00
482 &cpy "cpy 00
483 &bye "bye 00
484+ &rsz "rsz 00
485 &zero "0 00
486 &t "<true> 00
487 &f "<false> 00
488@@ -1398,7 +1554,7 @@
489 "Sun $1 "Mon $1 "Tue $1 "Wed $1
490 "Thu $1 "Fri $1 "Sat $1 ]
491
492-@spacer/wave [ 0000 0000 0070 8807 ]
493+@window/wave [ 0000 0000 0070 8807 ]
494
495 @input/caret [ 0020 2020 2020 2020 2020 2020 2020 0000 ]
496
497@@ -1446,6 +1602,8 @@
498 ffff ffe0 e0e0 e000 fcfc f000 0000 0000
499 e0e0 e0f0 7f7f 1f00 000e 0e1e fcfc f000 ]
500
501+@meta/no-icon [ cccc 3333 cccc 3333 ]
502+
503 @font/glyphs [
504 0000 0000 0000 0000 0000 0000 0000 0000
505 0000 1010 1020 2020 2000 4040 0000 0000
506@@ -1614,6 +1772,8 @@
507
508 @symbol/buf $20
509
510+@meta/buf $1 &body $&buflen &cap 0000 &icon $90
511+
512 @path/buf $&buflen &cap 0000
513
514 @dir/buf $&buflen 0000