commit 1884d00

Devine Lu Linvega  ·  2026-06-24 17:46:25 +0000 UTC
parent 32eb458
Pulled latest M/PC
1 files changed,  +159, -59
+159, -59
  1@@ -18,7 +18,8 @@
  2 |0100 @path/buflen
  3 |0200 @bios/buflen
  4 |0028 @bios/anchor-y
  5-|ffd6 @loader/entry
  6+|ff00 @loader/entry
  7+|ff80 @loader/buf
  8 
  9 |000
 10 
 11@@ -29,20 +30,21 @@
 12 @on-reset ( -> )
 13 	;meta #06 DEO2
 14 	theme/<load>
 15+	( | #0100 .Screen/width DEO2 #00c0 .Screen/height DEO2 )
 16 	;input/on-controller .Controller/vector DEO2
 17 	;input/on-console .Console/vector DEO2
 18 	;dict/home-path path/<set>
 19 	wallpaper/<draw>
 20 	spacer/<draw>
 21 	input/<redraw>
 22-	bios/<draw-welcome>
 23+	bios/<welcome>
 24 	BRK
 25 
 26 @meta 00
 27 	( name ) "M/PC 0a
 28 	( details ) "Monitor/Program 20 "Control 0a
 29 	( author ) "By 20 "Devine 20 "Lu 20 "Linvega 0a
 30-	( date ) "23 20 "Jun 20 "2026 00
 31+	( date ) "24 20 "Jun 20 "2026 00
 32 	( . ) 03
 33 	( - ) 56 =Varvara/version
 34 	( - ) 83 =appicon
 35@@ -52,7 +54,8 @@
 36 	_{ =dict/m_pc
 37 	( ) 40 00 =sel/<prev> =dict/sel-prev
 38 	( ) 80 00 =sel/<next> =dict/sel-next
 39-	( ) 01 00 =sel/<pick> =dict/sel-pick }
 40+	( ) 01 00 =sel/<use> =dict/sel-pick
 41+	( ) 02 00 =bios/<dir> =dict/directory }
 42 	_{ =dict/input
 43 	( ) 00 0d =input/<eval> =dict/eval
 44 	( ) 04 0d =input/<eval-partial> =dict/eval-partial
 45@@ -97,9 +100,18 @@
 46 	[ LIT2 -&buf _&ptr ] STR
 47 	JMP2r
 48 
 49+@input/<push-str-quoted> ( str* -- )
 50+	DUP2 str/is-word ?/<push-str>
 51+	LIT "" /<push>
 52+	/<push-str>
 53+	LIT "" !/<push>
 54+
 55 @input/<push-str> ( str* -- )
 56 	&>w
 57 		LDAk DUP ?{ POP POP2 !/<redraw> }
 58+		DUP #0a NEQ ?{
 59+			POP LIT "\ /<push>
 60+			LIT "n }
 61 		/<push>
 62 		INC2 !/>w
 63 
 64@@ -115,21 +127,21 @@
 65 	,&ptr STR
 66 	JMP2r
 67 
 68+@input/<eval-partial> ( -- )
 69+	;&buf LDAk ?{ POP2 !bios/<welcome> }
 70+	bios/<parse-partial>
 71+	/<reset> !/<redraw>
 72+
 73 @input/<eval> ( -- )
 74 	sel/is-active ?sel/<pick>
 75-	;&buf LDAk ?{ POP2 /<reset> !bios/<draw-welcome> }
 76+	;&buf LDAk ?{ POP2 !bios/<welcome> }
 77 	bios/<parse>
 78 	/<reset> !/<redraw>
 79 
 80-@input/<eval-partial> ( -- )
 81-	;&buf LDAk ?{ POP2 /<reset> !bios/<draw-welcome> }
 82-	bios/<parse-partial>
 83-	/<reset> !/<redraw>
 84-
 85 @input/<blank> ( -- )
 86 	sel/is-active ?sel/<reset-draw>
 87 	/<reset>
 88-	bios/<draw>
 89+	bios/<redraw>
 90 	( >> )
 91 
 92 @input/<redraw> ( -- )
 93@@ -159,17 +171,15 @@
 94 (
 95 @|Bios )
 96 
 97-@bios/<draw-welcome> ( -- )
 98-	#0008 .Screen/x DEO2
 99-	;&anchor-y .Screen/y DEO2
100-	[ LIT2 c0 -Screen/pixel ] DEO
101-	;&anchor-y .Screen/y DEO2
102-	;dict/info #45 font/<draw-str-color>
103-	( | logo )
104-	[ LIT2 66 -Screen/auto ] DEO
105-	;&logo .Screen/addr DEO2
106-	[ LIT2 45 -Screen/sprite ] DEOk DEO
107-	JMP2r
108+@bios/<welcome> ( -- )
109+	/<reset>
110+	;dict/ready1 /<push>
111+	;dict/ready2 /<push> !/<redraw>
112+
113+@bios/<dir> ( -- )
114+	sel/<reset>
115+	/<reset>
116+	dir/<eval> !/<redraw>
117 
118 @bios/get-symbol ( id -- sym* )
119 	#00 SWP DUP ADD ;&buf ADD2 LDA2 JMP2r
120@@ -194,7 +204,7 @@
121 	&>w
122 		dict/alloc /<push>
123 		str/walk-ws LDAk ?/>w
124-	POP2 !/<draw>
125+	POP2 !/<redraw>
126 
127 @bios/<reset> ( -- )
128 	;&buf ,&ptr STR2
129@@ -238,21 +248,29 @@
130 @bios/<push-err-binary> ( -- )
131 	;dict/err-binary !/<push>
132 
133-@bios/<draw> ( -- )
134-	#0008 .Screen/x DEO2
135+@bios/<redraw> ( -- )
136+	#0000 .Screen/x DEO2
137 	;&anchor-y .Screen/y DEO2
138 	[ LIT2 c0 -Screen/pixel ] DEO
139 	;&anchor-y .Screen/y DEO2
140 	,&ptr LDR2 ;&buf [ LITr 00 ]
141 	&>l
142-		NEQ2k ?{ POP2 POP2 POPr JMP2r }
143+		NEQ2k ?{
144+			POP2 POP2 POPr
145+			( | logo )
146+			#0008 .Screen/x DEO2
147+			.Screen/y DEI2 #0018 ADD2 .Screen/y DEO2
148+			[ LIT2 66 -Screen/auto ] DEO
149+			;&logo .Screen/addr DEO2
150+			[ LIT2 45 -Screen/sprite ] DEOk DEO
151+			JMP2r }
152 		LDA2k STHkr /<draw-symbol>
153 		INCr INC2 INC2 !/>l
154 
155 @bios/<draw-symbol> ( symbol* id -- )
156 	STHk #00 EQU ?{
157 		( | wrap )
158-		DUP2 font/get-width .Screen/x DEI2 ADD2 .Screen/width DEI2 LTH2 ?{
159+		DUP2 font/get-width .Screen/x DEI2 ADD2 .Screen/width DEI2 #0010 SUB2 LTH2 ?{
160 			( ) font/<draw-lb> } }
161 	.Screen/x DEI2k #0008 ADD2 ROT DEO2
162 	STHr sel/is-unselected #44 ADD !font/<draw-str-color>
163@@ -260,9 +278,6 @@
164 (
165 @|Path )
166 
167-@path/is-folder ( -- t )
168-	,&ptr LDR2 #0001 SUB2 LDA LIT "/ EQU JMP2r
169-
170 @path/<move> ( str* -- )
171 	DUP2 ;dict/out-path str/cmp ?/<pop>
172 	( | Check if file is a folder )
173@@ -276,14 +291,20 @@
174 	/is-folder ?{ LIT "/ /<push> }
175 	JMP2r
176 
177+@path/is-home ( -- t )
178+	;&buf str/len #0002 EQU2 JMP2r
179+
180+@path/is-folder ( -- t )
181+	,&ptr LDR2 #0001 SUB2 LDA LIT "/ EQU JMP2r
182+
183 @path/<pop> ( str* -- )
184 	POP2
185 	( | find last slash )
186 	;&buf ,&ptr LDR2 #0001 SUB2
187-	( clamp ) DUP2 ;&buf INC2 NEQ2 ?{ POP2 POP2 JMP2r }
188 	&>lp
189 		#0001 SUB2 LDAk LIT "/ EQU ?{ LTH2k ?/>lp }
190-	INC2 #0000 SWP2 STA2
191+	INC2 #0000 OVR2 STA2
192+	,&ptr STR2
193 	POP2 JMP2r
194 
195 @path/<set> ( str* -- )
196@@ -310,6 +331,38 @@
197 (
198 @|Selection )
199 
200+@sel/is-dir ( str* -- t )
201+	str/cap #0001 SUB2 LDA LIT "/ EQU JMP2r
202+
203+@sel/is-icn ( str* -- t )
204+	str/cap #0004 SUB2 ;dict/icn-ext !str/cmp
205+
206+@sel/is-rom ( str* -- t )
207+	str/cap #0004 SUB2 ;dict/rom-ext !str/cmp
208+
209+@sel/<use> ( -- )
210+	,&id LDR INCk ?{ POP JMP2r }
211+	bios/get-symbol
212+	( | handlers )
213+	DUP2 /is-dir ?/<use-move>
214+	DUP2 /is-icn ?/<use-draw>
215+	DUP2 /is-rom ?/<use-load>
216+	POP2 JMP2r
217+
218+@sel/<use-move> ( str* -- )
219+	/<reset>
220+	bios/<reset>
221+	path/<move>
222+	input/<redraw>
223+	dir/<eval> !bios/<redraw>
224+
225+@sel/<use-draw> ( str* -- )
226+	!icn/<select>
227+
228+@sel/<use-load> ( str* -- )
229+	bios/<reset>
230+	run/<select> !bios/<redraw>
231+
232 @sel/is-active ( -- bool )
233 	#ff
234 	( >> )
235@@ -328,14 +381,14 @@
236 	POP JMP2r
237 
238 @sel/<set> ( id -- )
239-	,&id STR !bios/<draw>
240+	,&id STR !bios/<redraw>
241 
242 @sel/<pick> ( -- )
243 	,&id LDR INCk ?{ POP JMP2r }
244-	#ff /<set>
245+	/<reset>
246 	bios/get-symbol
247 	( clamp ) DUP2 str/len #0040 LTH2 ?{ POP2 !input/<redraw> }
248-	input/<push-str>
249+	input/<push-str-quoted>
250 	#20 input/<push> !input/<redraw>
251 
252 @sel/<reset> ( -- )
253@@ -343,7 +396,7 @@
254 	JMP2r
255 
256 @sel/<reset-draw> ( -- )
257-	/<reset> !bios/<draw>
258+	/<reset> !bios/<redraw>
259 
260 (
261 @|Commands )
262@@ -378,11 +431,28 @@
263 	;path/buf .File/name DEO2
264 	;&buflen .File/length DEO2
265 	;&buf .File/read DEO2
266-	;&buf DUP2 .File/success DEI2 ADD2 SWP2
267-	&>l
268-		LDAk ?{ POP2 POP2 JMP2r }
269-		#0005 ADD2 dict/alloc-line bios/<push-raw>
270-		INC2 !/>l
271+	path/is-home ?{ ;dict/out-path bios/<push-raw> }
272+	.File/success DEI2
273+	( | Handlers )
274+	DUP2 /<push-folders> !/<push-files>
275+
276+@dir/<push-folders> ( length* -- )
277+	;&buf ADD2 ;&buf
278+	&>lfo
279+		LDAk LIT "- NEQ STH
280+		#0005 ADD2 STHr ?{
281+			LDAk LIT ". EQU ?{ dict/alloc-line bios/<push-raw> } }
282+		str/eol INC2 GTH2k ?/>lfo
283+	POP2 POP2 JMP2r
284+
285+@dir/<push-files> ( length* -- )
286+	;&buf ADD2 ;&buf
287+	&>lfi
288+		LDAk LIT "- EQU STH
289+		#0005 ADD2 STHr ?{
290+			LDAk LIT ". EQU ?{ dict/alloc-line bios/<push-raw> } }
291+		str/eol INC2 GTH2k ?/>lfi
292+	POP2 POP2 JMP2r
293 	&api =dict/dir =&<eval> "<dir> 20 "( 20 09 20 "[f] 20 ") 00
294 
295 @mov/<eval> ( -- )
296@@ -397,7 +467,11 @@
297 
298 @run/<eval> ( -- )
299 	bios/req-depth1 ?bios/<push-err-underflow>
300-	bios/pop path/make
301+	bios/pop
302+	( >> )
303+
304+@run/<select> ( name* -- )
305+	path/make
306 	( ? ) DUP2 file/is-oversized ?{
307 		( ? ) DUP2 file/exists ?loader/<run>
308 		POP2 !bios/<push-err-missing> }
309@@ -406,7 +480,11 @@
310 
311 @icn/<eval> ( -- )
312 	bios/req-depth1 ?bios/<push-err-underflow>
313-	bios/pop path/make
314+	bios/pop
315+	( >> )
316+
317+@icn/<select> ( path* -- )
318+	path/make
319 	( ? ) DUP2 file/exists ?{ POP2 !bios/<push-err-missing> }
320 	;dict/ok bios/<push>
321 	( >> )
322@@ -685,7 +763,7 @@
323 	JMP2r
324 
325 @font/<draw-lb> ( -- )
326-	#0008 .Screen/x DEO2
327+	#0000 .Screen/x DEO2
328 	.Screen/y DEI2 #0010 ADD2 .Screen/y DEO2
329 	JMP2r
330 
331@@ -733,21 +811,33 @@
332 @|Loader )
333 
334 @loader/<run> ( path* -- )
335-	,&path STR2
336-	;&on-frame .Screen/vector DEO2
337-	JMP2r
338+	;&buf ,&ptr STR2
339+	&>w
340+		LDAk DUP ?{
341+			POP POP2 ;&on-frame .Screen/vector DEO2
342+			JMP2r }
343+		#00 [ LIT2 &ptr =&buf ] INC2k ,&ptr STR2
344+		STA2
345+		INC2 !/>w
346 
347 @loader/on-frame ( -> )
348-	#0000 DUP2 .Screen/vector DEO2
349-	DUP2 .Screen/x DEO2
350+	#0000 DUP2 .Screen/x DEO2
351 	.Screen/y DEO2
352+	( | Clear screen )
353 	[ LIT2 80 -Screen/pixel ] DEO
354 	[ LIT2 c0 -Screen/pixel ] DEO
355-	[ LIT2 &path $2 ] .File/name DEO2
356+	( | Blank vectors )
357+	#0000 #00 &l DEO2k #10 ADD DUP [ ?&l POP POP2 ]
358+	( | Load )
359+	;&buf .File/name DEO2
360 	#fe00 .File/length DEO2
361 	;&mmu .System/expansion DEO2 !/entry
362 
363-	&mmu [ 01 0029 0000 =loader/rom 0000 =&entry ]
364+	&mmu [ 01 0020 0000 =&rom 0000 =&entry ]
365+
366+@loader/rom [
367+	c000 4ea0 0008 38a0 000b 3880 0237 a001
368+	0026 80ac 372c 00fe 0000 0000 0000 0000 ]
369 
370 (
371 @|Stdlib )
372@@ -817,6 +907,18 @@
373 	#18 DEO
374 	INC2 !/<print>
375 
376+@str/is-word ( str* -- t )
377+	&>wiw
378+		LDAk DUP ?{ POP POP2 #01 JMP2r }
379+		#20 GTH ?{ POP2 #00 JMP2r }
380+		INC2 !/>wiw
381+
382+@str/eol ( str* -- eol* )
383+	&>we
384+		LDAk DUP ?{ POP JMP2r }
385+		#0a NEQ ?{ JMP2r }
386+		INC2 !/>we
387+
388 @str/cap ( str* -- end* )
389 	LDAk ?{ JMP2r }
390 	INC2 !/cap
391@@ -943,17 +1045,20 @@
392 @|Assets )
393 
394 @dict/m_pc "M/PC 00
395-	&info "M/PC 20 "is 20 "ready. 0a
396-	( ) "Type 20 "<cmd> 20 "to 20 "see 20 "options. 0a0a 00
397+	&ready1 "M/PC 20 "is 20 "ready. 0a 00
398+	&ready2 "Type 20 "<cmd> 20 "to 20 "see 20 "options. 00
399 	&home-path "./ 00
400 	&sel-prev "Selection 20 "Previous 00
401 	&sel-next "Selection 20 "Next 00
402 	&sel-pick "Pick 20 "Selection 00
403 	&clear "Clear 20 "Input 00
404+	&directory "Directory 00
405 	&input "Input 00
406 	&eval "Run 00
407 	&eval-partial "Non-Destructive 20 "Run 00
408-	&out-path ".. 00
409+	&out-path "../ 00
410+	&icn-ext ".icn 00
411+	&rom-ext ".rom 00
412 	&dir "dir 00
413 	&mov "mov 00
414 	&run "run 00
415@@ -1158,11 +1263,6 @@
416 	8300 0000 0000 0000 0000 0000 0000 0000
417 	8000 0000 0000 0000 0000 0000 0000 0000 ]
418 
419-@loader/rom [
420-	8000 8000 0711 0106 20ff f702 a001 00af
421-	80ac 37a0 ffd5 80a2 36ef 38af 8000 6f15
422-	21aa 20ff f622 226f 2c00 ]
423-
424 @bios/logo [
425 	000f 3f7f 7fff ffff 00c0 f0f8 f8fc fcfc
426 	000e 0e1c 1c38 3870 00ff ffff e0e0 e0e0