(m291) Only sort when files are present

This commit is contained in:
Devine Lu Linvega 2024-08-29 18:47:14 -07:00
parent 7a7fb38dda
commit c149d1b9e7
1 changed files with 17 additions and 9 deletions

View File

@ -388,20 +388,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