(m291) Track sorting
This commit is contained in:
parent
2e17f1a0e5
commit
628ba9e17f
|
@ -420,5 +420,7 @@
|
||||||
|
|
||||||
@id3 &title $100 &artist $100 &album $100
|
@id3 &title $100 &artist $100 &album $100
|
||||||
|
|
||||||
|
@tmp $81
|
||||||
|
|
||||||
@mem &dir $2000 &folders $3000 &tracks
|
@mem &dir $2000 &folders $3000 &tracks
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,7 @@
|
||||||
#0005 ADD2 LDAk [ LIT ". ] EQU ?&hidden
|
#0005 ADD2 LDAk [ LIT ". ] EQU ?&hidden
|
||||||
is-folder ?&folder
|
is-folder ?&folder
|
||||||
is-mp3 ?&mp3
|
is-mp3 ?&mp3
|
||||||
POP2 JMP2r
|
POP2 !sort-tracks
|
||||||
|
|
||||||
&folder ( line* -- )
|
&folder ( line* -- )
|
||||||
DUP2 llen #003f LTH2 ?{ POP2 JMP2r }
|
DUP2 llen #003f LTH2 ?{ POP2 JMP2r }
|
||||||
|
@ -379,6 +379,37 @@
|
||||||
&hidden ( line* -- )
|
&hidden ( line* -- )
|
||||||
POP2 JMP2r
|
POP2 JMP2r
|
||||||
|
|
||||||
|
@str-lth ( a* b* -- a>b )
|
||||||
|
STH2
|
||||||
|
&>loop ( -- )
|
||||||
|
LDAk LDAkr STHr SUBk ?&done
|
||||||
|
DUP2 #0000 EQU2 ?&done
|
||||||
|
POP2 INC2 INC2r !&>loop
|
||||||
|
&done NIP2 LTH POP2r JMP2r
|
||||||
|
|
||||||
|
@sort-tracks ( -- )
|
||||||
|
;mem/tracks DUP2 LIT2 [ 00 -lines/tracks ] LDZ #01 SUB #70 SFT2 ADD2
|
||||||
|
( >> ) ( | selection sort; walk forward creating a sorted prefix )
|
||||||
|
|
||||||
|
|
||||||
|
@sort-tracks-0 ( first* last* -- )
|
||||||
|
SWP2 &loop GTH2k ?&ok
|
||||||
|
POP2 POP2 JMP2r
|
||||||
|
&ok OVR2 OVR2 STH2k #0080 ADD2 &loop2 LTH2k ?&done
|
||||||
|
DUP2 STH2kr str-lth ?&replace
|
||||||
|
!&inc
|
||||||
|
&replace POP2r STH2k &inc #0080 ADD2 !&loop2
|
||||||
|
&done POP2 POP2 DUP2 STH2r swap-tracks #0080 ADD2 !&loop
|
||||||
|
|
||||||
|
@swap-tracks ( src* dst* -- )
|
||||||
|
EQU2k ?&skip
|
||||||
|
DUP2 ;tmp <scpy>
|
||||||
|
OVR2 STH2
|
||||||
|
<scpy>
|
||||||
|
;tmp STH2r <scpy>
|
||||||
|
JMP2r
|
||||||
|
&skip POP2 POP2 JMP2r
|
||||||
|
|
||||||
@count-lines ( -- lines )
|
@count-lines ( -- lines )
|
||||||
.lines/folders LDZ .lines/tracks LDZ ADD JMP2r
|
.lines/folders LDZ .lines/tracks LDZ ADD JMP2r
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue