(m291) Housekeeping

This commit is contained in:
Devine Lu Linvega 2024-08-27 09:03:18 -07:00
parent e152dcb462
commit 5d7ae61420
1 changed files with 55 additions and 72 deletions

View File

@ -223,18 +223,13 @@
&folder ( id -- ) &folder ( id -- )
#00 SWP #00 SWP
( CELLSIZE ) #70 SFT2 ;mem/folders ADD2 !<enter> ( CELLSIZE ) #70 SFT2 ;mem/folders ADD2
( >> ) [ LIT2 00 -selection ] STZ
@<enter> ( folder* -- )
[ LIT2 00 -selection ] STZ
path/<push> !<refresh-dir> path/<push> !<refresh-dir>
@<leave> ( -- )
path/pop !<refresh-dir>
@<escape> ( -- ) @<escape> ( -- )
;path/null LDA ?<leave> ;path/null LDA ?{ JMP2r }
JMP2r path/pop !<refresh-dir>
( (
@|events ) @|events )
@ -253,7 +248,7 @@
@handle-frame ( buf* char -- ) @handle-frame ( buf* char -- )
POP POP
( skip key ) #0002 ADD2 ( skip key ) INC2 INC2
( curr-frame ) parse-dec .frames/a STZ2 ( curr-frame ) parse-dec .frames/a STZ2
INC2 INC2
( next-frame ) parse-dec .frames/b STZ2 ( next-frame ) parse-dec .frames/b STZ2
@ -284,8 +279,10 @@
@handle-pause ( buf* char -- ) @handle-pause ( buf* char -- )
POP INC2 INC2 LDA POP INC2 INC2 LDA
( stop ) DUP [ LIT "0 ] NEQ ?{ } ( stop ) DUP [ LIT "0 ] NEQ ?{ }
( paused ) DUP [ LIT "1 ] NEQ ?{ #01 .paused STZ } ( paused ) DUP [ LIT "1 ] NEQ ?{
( playing ) DUP [ LIT "2 ] NEQ ?{ #00 .paused STZ } [ LIT2 01 -paused ] STZ }
( playing ) DUP [ LIT "2 ] NEQ ?{
[ LIT2 00 -paused ] STZ }
( end ) DUP [ LIT "3 ] NEQ ?{ <skip-next> } ( end ) DUP [ LIT "3 ] NEQ ?{ <skip-next> }
POP <draw-play> !message/<new> POP <draw-play> !message/<new>
@ -375,6 +372,20 @@
INC2 #01 SFT2 INC2r LITr 01 SFT2r } INC2 #01 SFT2 INC2r LITr 01 SFT2r }
[ LIT2r 00e7 ] MUL2r STH2r SWP2 DIV2 JMP2r [ LIT2r 00e7 ] MUL2r STH2r SWP2 DIV2 JMP2r
@find-next ( buf* c -- index* )
,&t STR
&>loop ( -- )
LDAk [ LIT &t $1 ] EQU ?{ INC2 !&>loop }
JMP2r
@parse-dec ( buf* -- end* res* )
[ LIT2r 000a ] [ LIT2r 0000 ]
&>loop ( -- )
LDAk [ LIT "0 ] SUB DUP #09 GTH ?{
OVR2r MUL2r #00 SWP STH2
ADD2r INC2 !&>loop }
POP STH2r POP2r JMP2r
( (
@|path ) @|path )
@ -414,8 +425,32 @@
( | folders ) ( | folders )
;mem/folders .lines/folders LDZ .selection LDZ <draw-folders> ;mem/folders .lines/folders LDZ .selection LDZ <draw-folders>
[ LIT2 00 -lines/folders ] LDZ EQU ?{ ;dash-icn <draw-spacer> } [ LIT2 00 -lines/folders ] LDZ EQU ?{ ;dash-icn <draw-spacer> }
;mem/tracks .lines/tracks LDZ .selection LDZ .lines/folders LDZ SUB <draw-files> ;mem/tracks .lines/tracks LDZ .selection LDZ .lines/folders LDZ SUB
JMP2r ( >> )
@<draw-files> ( addr* length selection -- )
,&sel STR
DUP ?{ POP2 POP JMP2r }
#0008 .Screen/x DEO2
#00 SWP2 ,&t STR2
&>l ( -- )
[ LITr 05 ]
( | selected )
DUP [ LIT &sel $1 ] NEQ ?{
POPr [ LITr 06 ] ;fill-icn <draw-background> }
( | marker )
DUP .selection/track LDZ NEQ ?{
[ LIT2 15 -Screen/auto ] DEO
#0000 .Screen/x DEO2
;poke-icn .Screen/addr DEO2
DUPr [ LITr -Screen/sprite ] DEOr }
( | normal )
#0008 .Screen/x DEO2
#00 OVR
( CELLSIZE ) #70 SFT2 [ LIT2 &t $2 ] ADD2 STHr <draw-uf2>
.Screen/y DEI2k #0010 ADD2 ROT DEO2
INC GTHk ?&>l
POP2 JMP2r
@<draw-path> ( -- ) @<draw-path> ( -- )
( | clear ) ( | clear )
@ -478,8 +513,8 @@
[ LIT2 16 -Screen/auto ] DEO [ LIT2 16 -Screen/auto ] DEO
#0078 .Screen/x DEO2 #0078 .Screen/x DEO2
#005c .Screen/y DEO2 #005c .Screen/y DEO2
;pause-icn #00 .paused LDZ #50 SFT2 ADD2 .Screen/addr DEO2 ;pause-icn [ LIT2 00 -paused ] LDZ #50 SFT2 ADD2 .Screen/addr DEO2
[ LIT2 03 -Screen/sprite ] DEOk DEO [ LIT2 01 -Screen/sprite ] DEOk DEO
JMP2r JMP2r
@<draw-prev> ( -- ) @<draw-prev> ( -- )
@ -487,7 +522,7 @@
#0058 .Screen/x DEO2 #0058 .Screen/x DEO2
#005c .Screen/y DEO2 #005c .Screen/y DEO2
;prev-icn .Screen/addr DEO2 ;prev-icn .Screen/addr DEO2
[ LIT2 03 -Screen/sprite ] DEOk DEO [ LIT2 01 -Screen/sprite ] DEOk DEO
JMP2r JMP2r
@<draw-next> ( -- ) @<draw-next> ( -- )
@ -495,7 +530,7 @@
#0098 .Screen/x DEO2 #0098 .Screen/x DEO2
#005c .Screen/y DEO2 #005c .Screen/y DEO2
;next-icn .Screen/addr DEO2 ;next-icn .Screen/addr DEO2
[ LIT2 03 -Screen/sprite ] DEOk DEO [ LIT2 01 -Screen/sprite ] DEOk DEO
JMP2r JMP2r
@<draw-progress> ( -- ) @<draw-progress> ( -- )
@ -598,30 +633,6 @@
.Screen/y DEO2 .Screen/y DEO2
JMP2r JMP2r
@<draw-files> ( addr* length selection -- )
,&sel STR
DUP ?{ POP2 POP JMP2r }
#0008 .Screen/x DEO2
#00 SWP2 ,&t STR2
&>l ( -- )
[ LITr 05 ]
( | selected )
DUP [ LIT &sel $1 ] NEQ ?{
POPr [ LITr 06 ] ;fill-icn <draw-background> }
( | marker )
DUP .selection/track LDZ NEQ ?{
[ LIT2 15 -Screen/auto ] DEO
#0000 .Screen/x DEO2
;poke-icn .Screen/addr DEO2
STHkr .Screen/sprite DEO }
( | normal )
#0008 .Screen/x DEO2
#00 OVR
( CELLSIZE ) #70 SFT2 [ LIT2 &t $2 ] ADD2 STHr <draw-uf2>
.Screen/y DEI2k #0010 ADD2 ROT DEO2
INC GTHk ?&>l
POP2 JMP2r
@<draw-folders> ( addr* length selection -- ) @<draw-folders> ( addr* length selection -- )
,&sel STR ,&sel STR
DUP ?{ POP2 POP JMP2r } DUP ?{ POP2 POP JMP2r }
@ -699,30 +710,11 @@
.Screen/sprite DEOk DEO .Screen/sprite DEOk DEO
JMP2r JMP2r
(
@|helpers )
@find-next ( buf* c -- index* )
,&t STR
&>loop ( -- )
LDAk [ LIT &t $1 ] EQU ?{ INC2 !&>loop }
JMP2r
@parse-dec ( buf* -- end* res* )
[ LIT2r 000a ] [ LIT2r 0000 ]
&>loop ( -- )
LDAk [ LIT "0 ] SUB DUP #09 GTH ?{
OVR2r MUL2r #00 SWP STH2
ADD2r INC2 !&>loop }
POP STH2r POP2r JMP2r
( (
@|stdlib ) @|stdlib )
@scap ( str* -- end* ) @scap ( str* -- end* )
INC2 & LDAk ?scap
&w ( -- )
INC2 & LDAk ?&w
JMP2r JMP2r
@scmp3 ( a* b* -- f ) @scmp3 ( a* b* -- f )
@ -737,17 +729,8 @@
INC2r INC2 LDAk ?&>w INC2r INC2 LDAk ?&>w
POP2 POP2r JMP2r POP2 POP2r JMP2r
@<sclr> ( str* -- )
#00 ROT ROT
&>w ( -- )
STAk INC2 LDAk ?&>w
STA
JMP2r
@lcap ( str* -- next-line* ) @lcap ( str* -- next-line* )
LDAk #0a EQU ?{ INC2 & LDAk ?lcap }
&w ( -- )
LDAk #0a EQU ?{ INC2 & LDAk ?&w }
JMP2r JMP2r
@<lcpy> ( src* dst* -- ) @<lcpy> ( src* dst* -- )