commit d5a570e
Devine Lu Linvega
·
2026-06-25 19:13:41 +0000 UTC
parent c3f1148
Pulled latest M/PC
1 files changed,
+176,
-50
+176,
-50
1@@ -13,12 +13,13 @@
2 @|Enums )
3
4 |0050 @Varvara/version
5-|0200 @dir/buflen
6-|c000 @dict/buflen
7-|0100 @path/buflen
8+|0080 @path/buflen
9 |0200 @bios/buflen
10+|0200 @dir/buflen
11+|ff00 @dict/cap
12+|0008 @bios/anchor-x
13 |0028 @bios/anchor-y
14-|ff00 @loader/entry
15+|ffe0 @loader/entry
16 |ff80 @loader/buf
17
18 |000
19@@ -30,12 +31,10 @@
20 @on-reset ( -> )
21 ;meta #06 DEO2
22 theme/<load>
23- ;input/on-controller .Controller/vector DEO2
24- ;input/on-console .Console/vector DEO2
25 ;dict/home-path path/<set>
26 wallpaper/<draw>
27 spacer/<draw>
28- input/<redraw>
29+ input/<bind>
30 bios/<welcome>
31 BRK
32
33@@ -43,7 +42,7 @@
34 ( name ) "M/PC 0a
35 ( details ) "Monitor/Program 20 "Control 0a
36 ( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
37- ( date ) "24 20 "Jun 20 "2026 00
38+ ( date ) "25 20 "Jun 20 "2026 00
39 ( . ) 03
40 ( - ) 56 =Varvara/version
41 ( - ) 83 =appicon
42@@ -77,6 +76,10 @@
43 [ LIT2 03 -Console/type ] DEI NEQ ?{ POP #20 }
44 /handle-input BRK
45
46+@input/<bind> ( -- )
47+ ;&on-controller .Controller/vector DEO2
48+ ;&on-console .Console/vector DEO2 !/<redraw>
49+
50 @input/handle-input ( c -- )
51 DUP ?{ POP JMP2r }
52 DUP #08 EQU ?/on-bs
53@@ -109,8 +112,7 @@
54 @input/<push-str> ( str* -- )
55 &>w
56 LDAk DUP ?{ POP POP2 !/<redraw> }
57- DUP #0a NEQ ?{ POP #20 }
58- /<push>
59+ str/escape /<push>
60 INC2 !/>w
61
62 @input/<push> ( c -- )
63@@ -143,7 +145,7 @@
64 ( >> )
65
66 @input/<redraw> ( -- )
67- #0008 .Screen/x DEO2
68+ ;bios/anchor-x .Screen/x DEO2
69 #0018 .Screen/y DEO2
70 [ LIT2 e0 -Screen/pixel ] DEO
71 #0008 .Screen/y DEO2
72@@ -231,7 +233,9 @@
73
74 @bios/<push-raw> ( str* -- )
75 ( | put on stack )
76- [ LIT2 &ptr =&buf ] INC2k INC2 ,&ptr STR2
77+ [ LIT2 &ptr =&buf ]
78+ ( clamp ) DUP2 ;&cap NEQ2 ?{ POP2 POP2 JMP2r }
79+ INC2k INC2 ,&ptr STR2
80 STA2
81 JMP2r
82
83@@ -258,26 +262,40 @@
84 ;&anchor-y .Screen/y DEO2
85 ,&ptr LDR2 ;&buf [ LITr 00 ]
86 &>l
87- NEQ2k ?{
88- POP2 POP2 POPr
89- ( | logo )
90- #0008 .Screen/x DEO2
91- .Screen/y DEI2 #0018 ADD2 .Screen/y DEO2
92- [ LIT2 66 -Screen/auto ] DEO
93- ;&logo .Screen/addr DEO2
94- [ LIT2 45 -Screen/sprite ] DEOk DEO
95- JMP2r }
96- LDA2k STHkr /<draw-symbol>
97+ NEQ2k ?{ POP2 POP2 POPr !/<draw-logo> }
98+ LDA2k symbol/make DUP2 /<draw-spacer>
99+ STHkr sel/is-unselected #44 ADD font/<draw-str-color>
100 INCr INC2 INC2 !/>l
101
102-@bios/<draw-symbol> ( symbol* id -- )
103- STH
104- DUP2 STHkr /<draw-spacer>
105- STHr sel/is-unselected #44 ADD !font/<draw-str-color>
106+@bios/<draw-spacer> ( symbol* -- )
107+ font/get-width .Screen/x DEI2 ADD2 [ LIT2 &margin $2 ] LTH2 ?{ !font/<draw-lb> }
108+ .Screen/x DEI2k #0008 ADD2 ROT DEO2
109+ JMP2r
110+
111+@bios/<draw-logo> ( -- )
112+ ;&anchor-x .Screen/x DEO2
113+ .Screen/y DEI2 #0018 ADD2 .Screen/y DEO2
114+ [ LIT2 66 -Screen/auto ] DEO
115+ ;&logo .Screen/addr DEO2
116+ [ LIT2 45 -Screen/sprite ] DEOk DEO
117+ JMP2r
118+
119+@symbol/make ( str* -- sym* )
120+ ;&buf DUP2 ,&ptr STR2
121+ SWP2 [ LIT2r 1c00 ]
122+ &>w
123+ NEQkr STHr ?{
124+ [ LIT2 ".. ] /<push>
125+ /<push> !/end }
126+ LDAk DUP ?{
127+ POP &end POP2r POP2 #00 !/<push> }
128+ DUP #0a NEQ ?{ POP #20 }
129+ /<push>
130+ INCr INC2 !/>w
131
132-@bios/<draw-spacer> ( symbol* id -- )
133- ?{ POP2 !/space }
134- font/get-width .Screen/x DEI2 ADD2 [ LIT2 &margin $2 ] LTH2 ?{ !font/<draw-lb> } &space .Screen/x DEI2k #0008 ADD2 ROT DEO2
135+@symbol/<push> ( c -- )
136+ #00 [ LIT2 &ptr =&buf ] INC2k ,&ptr STR2
137+ STA2
138 JMP2r
139
140 (
141@@ -323,7 +341,9 @@
142 INC2 !/>w
143
144 @path/<push> ( str* -- )
145- #00 [ LIT2 &ptr =&buf ] INC2k ,&ptr STR2
146+ #00 [ LIT2 &ptr =&buf ]
147+ ( clamp ) DUP2 ;&cap NEQ2 ?{ POP2 POP POP2 JMP2r }
148+ INC2k ,&ptr STR2
149 STA2
150 JMP2r
151
152@@ -352,6 +372,7 @@
153 DUP2 /is-dir ?/<use-move>
154 DUP2 /is-icn ?/<use-draw>
155 DUP2 /is-rom ?/<use-load>
156+ DUP2 file/is-text ?read/<bind>
157 POP2 JMP2r
158
159 @sel/<use-move> ( str* -- )
160@@ -404,6 +425,63 @@
161 ,&id LDR NEQ ?bios/<redraw>
162 JMP2r
163
164+(
165+@|Read )
166+
167+@read/on-controller ( -> )
168+ .Controller/button DEI
169+ ( | handlers )
170+ DUP #01 NEQ ?{ /<leave> }
171+ DUP #10 NEQ ?{ /<select-prev> }
172+ DUP #20 NEQ ?{ /<select-next> }
173+ POP BRK
174+
175+@read/<leave> ( -- )
176+ input/<bind> !bios/<redraw>
177+
178+@read/<bind> ( str* -- )
179+ .File/name DEO2
180+ ;&on-controller .Controller/vector DEO2
181+ ( col ) .Screen/width DEI2 #03 SFT2 #0002 SUB2 ,&col STR
182+ POP
183+ ( row ) .Screen/height DEI2 #04 SFT2 #0004 SUB2 ,&row STR
184+ POP #0000 !/<select-line>
185+
186+@read/<select-prev> ( -- )
187+ ,&line LDR2 ORAk ?{ POP2 JMP2r }
188+ #0001 SUB2 !/<select-line>
189+
190+@read/<select-next> ( -- )
191+ [ LIT2 &line $2 ] INC2
192+ ( >> )
193+
194+@read/<select-line> ( line* -- )
195+ DUP2 ,&line STR2
196+ file/<seek-line>
197+ ;bios/anchor-x .Screen/x DEO2
198+ ;bios/anchor-y .Screen/y DEO2
199+ [ LIT2 c0 -Screen/pixel ] DEO
200+ [ LIT2 15 -Screen/auto ] DEO
201+ #0001 .File/length DEO2
202+ ( | Render )
203+ #41 ;font/color STA
204+ ( | Stream )
205+ [ LIT2 &row $1 00 ] [ LIT2r &col $1 00 ]
206+ &>s
207+ ;&b .File/read DEO2
208+ .File/success-lb DEI ?{
209+ POP2 POP2r ;dict/eof #44 !font/<draw-str-color> }
210+ ( | hard-wrap )
211+ GTHkr STHr ?{
212+ ;bios/anchor-x .Screen/x DEO2
213+ .Screen/y DEI2k #0010 ADD2 ROT DEO2
214+ INC POPr LITr 00 }
215+ [ LIT &b $1 ] DUP #0a NEQ ?{
216+ SWP INC SWP POPr LITr 00 }
217+ font/<draw-glyph>
218+ INCr GTHk ?/>s
219+ POP2 POP2r JMP2r
220+
221 (
222 @|Commands )
223
224@@ -518,7 +596,7 @@
225 [ LIT2 00 -File/success-lb ] DEI EQU ?{ DEOkr
226 INC DUP ?/>h }
227 POP
228- ( lb ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
229+ ( lb ) .Screen/y DEI2k #0008 ADD2 ROT DEO2
230 INC DUP ?/>v
231 POP POP2r JMP2r
232
233@@ -585,7 +663,7 @@
234 #0004 .File/length DEO2
235 ;&buf .File/stat DEO2
236 ;&buf dict/alloc NIP2 !bios/<push>
237- &buf $5 &api =dict/len =&<eval> "<len> 20 "( 20 "f 20 09 20 "hex 20 ") 00
238+ &api =dict/len =&<eval> "<len> 20 "( 20 "f 20 09 20 "hex 20 ") 00
239
240 @dup/<eval> ( -- )
241 bios/req-depth1 ?bios/<push-err-underflow>
242@@ -696,9 +774,9 @@
243 &>wc2
244 LDAk DUP ?{
245 POP POP2 STH2r #00 !/<push> }
246- /<push>
247+ str/escape /<push>
248 INC2 !/>wc2 }
249- /<push>
250+ str/escape /<push>
251 INC2 !/>wc1
252
253 @dict/alloc ( str* -- str* addr* )
254@@ -706,7 +784,7 @@
255 [ LITr _&ptr ] LDR2r
256 &>w
257 LDAk DUP #20 GTH ?{ POP STH2r #00 !/<push> }
258- /<push>
259+ str/escape /<push>
260 INC2 !/>w
261
262 @dict/alloc-string ( str* -- str* addr* )
263@@ -714,18 +792,20 @@
264 &>was
265 LDAk DUP ?{ &end POP INC2 STH2r #00 !/<push> }
266 DUP LIT "" EQU ?/end
267- /<push>
268+ str/escape /<push>
269 INC2 !/>was
270
271 @dict/alloc-line ( str* -- str* addr* )
272 [ LITr _&ptr ] LDR2r
273 &>wal
274 LDAk DUP #1f GTH ?{ POP STH2r #00 !/<push> }
275- /<push>
276+ str/escape /<push>
277 INC2 !/>wal
278
279 @dict/<push> ( c -- )
280- [ LIT2 &ptr =&buf ] INC2k ,&ptr STR2
281+ [ LIT2 &ptr =&buf ]
282+ ( clamp ) DUP2 ;&cap NEQ2 ?{ POP2 POP JMP2r }
283+ INC2k ,&ptr STR2
284 STA
285 JMP2r
286
287@@ -757,6 +837,11 @@
288 /<draw-glyph>
289 INC2 !/>w
290
291+@font/get-addr ( c -- addr* )
292+ DUP #09 NEQ ?{ POP ;&tab JMP2r }
293+ DUP #0a NEQ ?{ POP ;&lb JMP2r }
294+ #00 SWP #20 SUB #40 SFT2 ;&glyphs ADD2 JMP2r
295+
296 @font/<draw-glyph> ( c -- )
297 DUP #0a NEQ ?{ POP !/<draw-lb> }
298 DUP #09 NEQ ?{ POP !/<draw-tab> }
299@@ -769,8 +854,8 @@
300 JMP2r
301
302 @font/<draw-lb> ( -- )
303- #0008 .Screen/x DEO2
304- .Screen/y DEI2 #0010 ADD2 .Screen/y DEO2
305+ ;bios/anchor-x .Screen/x DEO2
306+ .Screen/y DEI2k #0010 ADD2 ROT DEO2
307 JMP2r
308
309 @font/<draw-tab> ( -- )
310@@ -833,10 +918,12 @@
311 [ LIT2 80 -Screen/pixel ] DEO
312 [ LIT2 c0 -Screen/pixel ] DEO
313 ( | Blank vectors )
314- #0000 #00 &l DEO2k #10 ADD DUP [ ?&l POP POP2 ]
315+ #0000 #00 &l DEO2k #10 ADD DUP [ ?/l POP POP2 ]
316+ ( | Blank arguments )
317+ [ LIT2 00 -Console/type ] DEO
318 ( | Load )
319 ;&buf .File/name DEO2
320- #fe00 .File/length DEO2
321+ #fee0 .File/length DEO2
322 ;&mmu .System/expansion DEO2 !/entry
323
324 &mmu [ 01 0020 0000 =&rom 0000 =&entry ]
325@@ -861,6 +948,18 @@
326 POP2 INC2 LDAk ?/>cat
327 POP2 #ffff JMP2r
328
329+@file/<seek-line> ( line* -- )
330+ .File/name DEI2k ROT DEO2
331+ ORAk ?{ POP2 JMP2r }
332+ #0000 INC2k .File/length DEO2
333+ [ LIT2r =&bs ] [ LITr -File/read ]
334+ &>l
335+ DEO2kr
336+ [ LIT2 -File/success-lb ] DEI EQU ?{
337+ [ LIT2 &bs $1 0a ] NEQ ?{ INC2 }
338+ GTH2k ?/>l }
339+ POP2 POP2 POPr POP2r JMP2r
340+
341 @file/is-folder ( path* -- t )
342 .File/name DEO2
343 #0001 .File/length DEO2
344@@ -907,6 +1006,18 @@
345 ( hex ) #27 SUB DUP #0a SUB #05 GTH [ JMP JMP2r ]
346 ( nil ) POP #ff JMP2r
347
348+@chr/n-0 ( c -- c )
349+ POP #00 JMP2r
350+
351+@chr/t-tab ( c -- c )
352+ POP #09 JMP2r
353+
354+@chr/n-lb ( c -- c )
355+ POP #0a JMP2r
356+
357+@chr/t-ws ( c -- c )
358+ POP #20 JMP2r
359+
360 @chr/is-ascii ( c -- t )
361 DUP #08 GTH SWP #7f LTH AND JMP2r
362
363@@ -915,6 +1026,16 @@
364 #18 DEO
365 INC2 !/<print>
366
367+@str/escape ( addr* c -- addr* c )
368+ DUP [ LIT "\ ] NEQ ?{
369+ POP INC2 LDAk
370+ ( | handlers )
371+ DUP [ LIT "0 ] EQU ?chr/n-0
372+ DUP [ LIT "t ] EQU ?chr/t-tab
373+ DUP [ LIT "n ] EQU ?chr/n-lb
374+ DUP [ LIT "s ] EQU ?chr/t-ws }
375+ JMP2r
376+
377 @str/is-word ( str* -- t )
378 &>wiw
379 LDAk DUP ?{ POP POP2 #01 JMP2r }
380@@ -1053,7 +1174,6 @@
381 @|Assets )
382
383 @dict/m_pc "M/PC 00
384- &ready1 "Ready. 00
385 &ready2 "Type 20 "<cmd> 20 "to 20 "see 20 "options. 00
386 &home-path "./ 00
387 &sel-prev "Selection 20 "Previous 00
388@@ -1063,6 +1183,7 @@
389 &directory "Directory 00
390 &input "Input 00
391 &eval "Run 00
392+ &eof "eof 00
393 &eval-partial "Non-Destructive 20 "Run 00
394 &out-path "../ 00
395 &icn-ext ".icn 00
396@@ -1207,7 +1328,8 @@
397 0000 1010 1020 2020 2040 4040 0000 0000
398 0030 0808 0810 100c 1020 2020 c000 0000
399 0000 0032 4c00 0000 0000 0000 0000 0000 ]
400- &tab [ 0000 0000 0010 18fc 1810 0000 0000 0000 ]
401+ &tab [ 0000 0000 0008 0c7e 0c08 0000 0000 0000 ]
402+ &lb [ 0000 0002 0212 327c 3010 0000 0000 0000 ]
403
404 @kbd/glyphs [
405 0000 0000 0000 0000 0808 1010 1000 2000
406@@ -1285,17 +1407,21 @@
407 (
408 @|Buffer )
409
410+@len/buf $5
411+
412 @icn/buf $8
413
414-@date/buf $20
415+@date/buf $12
416+
417+@time/buf $a
418
419-@time/buf $20
420+@symbol/buf $20
421
422-@path/buf $&buflen
423+@path/buf $&buflen &cap 0000
424
425-@bios/buf $&buflen
426+@dir/buf $&buflen 0000
427
428-@dir/buf $&buflen
429+@bios/buf $&buflen &cap 0000
430
431-@dict/buf $&buflen
432+@dict/buf
433