From c149d1b9e7a18b80a8b1e96bed1caa8c8369b87f Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 29 Aug 2024 18:47:14 -0700 Subject: [PATCH] (m291) Only sort when files are present --- gui/m291/src/m291.tal | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/gui/m291/src/m291.tal b/gui/m291/src/m291.tal index bdef5b0..4c09bbc 100644 --- a/gui/m291/src/m291.tal +++ b/gui/m291/src/m291.tal @@ -388,20 +388,28 @@ &done NIP2 LTH POP2r JMP2r @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 ( -- ) + .lines/tracks LDZ ?{ JMP2r } ;mem/tracks DUP2 LIT2 [ 00 -lines/tracks ] LDZ #01 SUB #70 SFT2 ADD2 ( >> ) -@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 +@sort-files ( first* last* -- ) + SWP2 + &>loop ( -- ) + GTH2k ?{ POP2 POP2 JMP2r } + OVR2 OVR2 STH2k #0080 ADD2 + &>loop2 ( -- ) + LTH2k ?&done + DUP2 STH2kr str-lth ?&replace + !{ + &replace POP2r STH2k } + #0080 ADD2 !&>loop2 + + &done ( -- ) + POP2 POP2 DUP2 STH2r swap-tracks #0080 ADD2 !&>loop @swap-tracks ( src* dst* -- ) EQU2k ?&skip