Compare commits

..

2 Commits

Author SHA1 Message Date
~d6 c39db007d2 Able to play .flac files. 2024-08-29 22:34:35 -04:00
Devine Lu Linvega c149d1b9e7 (m291) Only sort when files are present 2024-08-29 18:47:14 -07:00
1 changed files with 32 additions and 13 deletions

View File

@ -34,7 +34,7 @@
#0100 .Screen/width DEO2 #0100 .Screen/width DEO2
( | .. ) ( | .. )
message/<new> message/<new>
;dict/mpg-cmd .Console/addr DEO2 ;dict/flac-cmd .Console/addr DEO2
[ LIT2 03 -Console/mode ] DEO [ LIT2 03 -Console/mode ] DEO
[ LIT2 01 -Console/exec ] DEO [ LIT2 01 -Console/exec ] DEO
[ LIT2 00 -playing ] STZ [ LIT2 00 -playing ] STZ
@ -282,6 +282,7 @@
<draw-progress> <draw-progress>
<draw-timestamp> !message/<new> <draw-timestamp> !message/<new>
( TODO: flac123 id3 format is different and more limited, sadly )
@handle-id3 ( buf* char -- ) @handle-id3 ( buf* char -- )
POP [ LIT ". ] find-next INC2 LDA2k POP [ LIT ". ] find-next INC2 LDA2k
( | parse lines ) ( | parse lines )
@ -293,6 +294,7 @@
OVR2 [ LIT ": ] find-next INC2 ;id3/album <scpy> } OVR2 [ LIT ": ] find-next INC2 ;id3/album <scpy> }
POP2 POP2 !message/<new> POP2 POP2 !message/<new>
( TODO: flac123 doesn't use "@P 3" so we'd need to use "@P 0" )
@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 ?{ }
@ -354,7 +356,7 @@
@<parse-line> ( line* -- ) @<parse-line> ( line* -- )
#0005 ADD2 LDAk [ LIT ". ] EQU ?&hidden #0005 ADD2 LDAk [ LIT ". ] EQU ?&hidden
is-folder ?&folder is-folder ?&folder
is-mp3 ?&mp3 is-flac ?&flac
POP2 JMP2r POP2 JMP2r
&folder ( line* -- ) &folder ( line* -- )
@ -366,7 +368,7 @@
.lines/folders LDZ INC .lines/folders STZ .lines/folders LDZ INC .lines/folders STZ
JMP2r JMP2r
&mp3 ( line* -- ) &flac ( line* -- )
DUP2 llen DUP2 llen
( CELLSIZE ) #007f LTH2 ?{ POP2 JMP2r } ( CELLSIZE ) #007f LTH2 ?{ POP2 JMP2r }
;mem/tracks [ LIT2 00 -lines/tracks ] LDZ ;mem/tracks [ LIT2 00 -lines/tracks ] LDZ
@ -388,20 +390,28 @@
&done NIP2 LTH POP2r JMP2r &done NIP2 LTH POP2r JMP2r
@sort-folders ( -- ) @sort-folders ( -- )
;mem/folders DUP2 LIT2 [ 00 -lines/folders ] LDZ #01 SUB #70 SFT2 ADD2 !sort-tracks-0 .lines/folders LDZ ?{ JMP2r }
;mem/folders DUP2 LIT2 [ 00 -lines/folders ] LDZ #01 SUB #70 SFT2 ADD2 !sort-files
@sort-tracks ( -- ) @sort-tracks ( -- )
.lines/tracks LDZ ?{ JMP2r }
;mem/tracks DUP2 LIT2 [ 00 -lines/tracks ] LDZ #01 SUB #70 SFT2 ADD2 ;mem/tracks DUP2 LIT2 [ 00 -lines/tracks ] LDZ #01 SUB #70 SFT2 ADD2
( >> ) ( >> )
@sort-tracks-0 ( first* last* -- ) @sort-files ( first* last* -- )
SWP2 &loop GTH2k ?&ok SWP2
POP2 POP2 JMP2r &>loop ( -- )
&ok OVR2 OVR2 STH2k #0080 ADD2 &loop2 LTH2k ?&done GTH2k ?{ POP2 POP2 JMP2r }
OVR2 OVR2 STH2k #0080 ADD2
&>loop2 ( -- )
LTH2k ?&done
DUP2 STH2kr str-lth ?&replace DUP2 STH2kr str-lth ?&replace
!&inc !{
&replace POP2r STH2k &inc #0080 ADD2 !&loop2 &replace POP2r STH2k }
&done POP2 POP2 DUP2 STH2r swap-tracks #0080 ADD2 !&loop #0080 ADD2 !&>loop2
&done ( -- )
POP2 POP2 DUP2 STH2r swap-tracks #0080 ADD2 !&>loop
@swap-tracks ( src* dst* -- ) @swap-tracks ( src* dst* -- )
EQU2k ?&skip EQU2k ?&skip
@ -425,6 +435,9 @@
@is-mp3 ( line* -- line*f ) @is-mp3 ( line* -- line*f )
DUP2 lcap/ #0003 SUB2 ;dict/mp3-ext !scmp3 DUP2 lcap/ #0003 SUB2 ;dict/mp3-ext !scmp3
@is-flac ( line* -- line*f )
DUP2 lcap/ #0004 SUB2 ;dict/flac-ext !scmp4
@pos-to-seconds ( pos* -- seconds* ) @pos-to-seconds ( pos* -- seconds* )
.secfrom LDZ2 .secto LDZ2 ADD2 #00e7 DIV2k STH2k MUL2 SUB2 OVR2 STH2 .secfrom LDZ2 .secto LDZ2 ADD2 #00e7 DIV2k STH2k MUL2 SUB2 OVR2 STH2
MUL2r MUL2 #00e7 DIV2 STH2r ADD2 JMP2r MUL2r MUL2 #00e7 DIV2 STH2r ADD2 JMP2r
@ -838,6 +851,11 @@
LDAkr LDAk STHr NEQ ?{ INC2r INC2 } LDAkr LDAk STHr NEQ ?{ INC2r INC2 }
LDA2r LDA2 STH2r EQU2 JMP2r LDA2r LDA2 STH2r EQU2 JMP2r
@scmp4 ( a* b* -- f )
STH2
LDA2kr LDA2k STH2r NEQ2 ?{ INC2r INC2r INC2 INC2 }
LDA2r LDA2 STH2r EQU2 JMP2r
@<scpy> ( src* dst* -: ) @<scpy> ( src* dst* -: )
STH2 STH2
&>w ( src* `dst* -- ) &>w ( src* `dst* -- )
@ -932,8 +950,9 @@
@dict @dict
&home-path "./ $1 &home-path "./ $1
&mp3-ext "mp3 $1 &mp3-ext "mp3 $1
&flac-ext "flac $1
&empty "(empty) $1 &empty "(empty) $1
&mpg-cmd "mpg123 20 "-R $1 &flac-cmd "flac123 20 "-R $1
&load-cmd "load 20 $1 &load-cmd "load 20 $1
&jump-cmd "jump 20 $1 &jump-cmd "jump 20 $1
&pause-cmd "pause 0a $1 &pause-cmd "pause 0a $1