From 5d7ae614201675d41eb5ec35e3a1f5b6932e9a94 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 27 Aug 2024 09:03:18 -0700 Subject: [PATCH] (m291) Housekeeping --- gui/m291/src/m291.tal | 127 ++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 72 deletions(-) diff --git a/gui/m291/src/m291.tal b/gui/m291/src/m291.tal index 5b8be2a..4357c0c 100644 --- a/gui/m291/src/m291.tal +++ b/gui/m291/src/m291.tal @@ -223,18 +223,13 @@ &folder ( id -- ) #00 SWP - ( CELLSIZE ) #70 SFT2 ;mem/folders ADD2 ! - -@ ( folder* -- ) - [ LIT2 00 -selection ] STZ + ( CELLSIZE ) #70 SFT2 ;mem/folders ADD2 + ( >> ) [ LIT2 00 -selection ] STZ path/ ! -@ ( -- ) - path/pop ! - @ ( -- ) - ;path/null LDA ? - JMP2r + ;path/null LDA ?{ JMP2r } + path/pop ! ( @|events ) @@ -253,7 +248,7 @@ @handle-frame ( buf* char -- ) POP - ( skip key ) #0002 ADD2 + ( skip key ) INC2 INC2 ( curr-frame ) parse-dec .frames/a STZ2 INC2 ( next-frame ) parse-dec .frames/b STZ2 @@ -284,8 +279,10 @@ @handle-pause ( buf* char -- ) POP INC2 INC2 LDA ( stop ) DUP [ LIT "0 ] NEQ ?{ } - ( paused ) DUP [ LIT "1 ] NEQ ?{ #01 .paused STZ } - ( playing ) DUP [ LIT "2 ] NEQ ?{ #00 .paused STZ } + ( paused ) DUP [ LIT "1 ] NEQ ?{ + [ LIT2 01 -paused ] STZ } + ( playing ) DUP [ LIT "2 ] NEQ ?{ + [ LIT2 00 -paused ] STZ } ( end ) DUP [ LIT "3 ] NEQ ?{ } POP !message/ @@ -375,6 +372,20 @@ INC2 #01 SFT2 INC2r LITr 01 SFT2r } [ 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 ) @@ -414,8 +425,32 @@ ( | folders ) ;mem/folders .lines/folders LDZ .selection LDZ [ LIT2 00 -lines/folders ] LDZ EQU ?{ ;dash-icn } - ;mem/tracks .lines/tracks LDZ .selection LDZ .lines/folders LDZ SUB - JMP2r + ;mem/tracks .lines/tracks LDZ .selection LDZ .lines/folders LDZ SUB + ( >> ) + +@ ( 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 } + ( | 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 + .Screen/y DEI2k #0010 ADD2 ROT DEO2 + INC GTHk ?&>l + POP2 JMP2r @ ( -- ) ( | clear ) @@ -478,8 +513,8 @@ [ LIT2 16 -Screen/auto ] DEO #0078 .Screen/x DEO2 #005c .Screen/y DEO2 - ;pause-icn #00 .paused LDZ #50 SFT2 ADD2 .Screen/addr DEO2 - [ LIT2 03 -Screen/sprite ] DEOk DEO + ;pause-icn [ LIT2 00 -paused ] LDZ #50 SFT2 ADD2 .Screen/addr DEO2 + [ LIT2 01 -Screen/sprite ] DEOk DEO JMP2r @ ( -- ) @@ -487,7 +522,7 @@ #0058 .Screen/x DEO2 #005c .Screen/y DEO2 ;prev-icn .Screen/addr DEO2 - [ LIT2 03 -Screen/sprite ] DEOk DEO + [ LIT2 01 -Screen/sprite ] DEOk DEO JMP2r @ ( -- ) @@ -495,7 +530,7 @@ #0098 .Screen/x DEO2 #005c .Screen/y DEO2 ;next-icn .Screen/addr DEO2 - [ LIT2 03 -Screen/sprite ] DEOk DEO + [ LIT2 01 -Screen/sprite ] DEOk DEO JMP2r @ ( -- ) @@ -598,30 +633,6 @@ .Screen/y DEO2 JMP2r -@ ( 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 } - ( | 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 - .Screen/y DEI2k #0010 ADD2 ROT DEO2 - INC GTHk ?&>l - POP2 JMP2r - @ ( addr* length selection -- ) ,&sel STR DUP ?{ POP2 POP JMP2r } @@ -699,30 +710,11 @@ .Screen/sprite DEOk DEO 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 ) @scap ( str* -- end* ) - - &w ( -- ) - INC2 & LDAk ?&w + INC2 & LDAk ?scap JMP2r @scmp3 ( a* b* -- f ) @@ -737,17 +729,8 @@ INC2r INC2 LDAk ?&>w POP2 POP2r JMP2r -@ ( str* -- ) - #00 ROT ROT - &>w ( -- ) - STAk INC2 LDAk ?&>w - STA - JMP2r - @lcap ( str* -- next-line* ) - - &w ( -- ) - LDAk #0a EQU ?{ INC2 & LDAk ?&w } + LDAk #0a EQU ?{ INC2 & LDAk ?lcap } JMP2r @ ( src* dst* -- )