ad"Sorted Directory 0.1 15-May-1981"ai, @,:TOPPC bn AZbsLIMDIR,'bx CODE(2)7b ARRAY(2)Jb DIR$(LIMDIR)Xb BUF(@)|bDIRFORM$"\ \.\ \## ### "b @bX:GOSUB 3000b Pb "Drive";DRIVEb MASK$(DRIVE)"????????""???"b Xb DISPLAYc c : "Sorting..."#c ();.c( 9c2()ccx  : display sorted directoryc: GOSUB 4200 ' dump directory to disccc --- display sorted directory in columnsc K(MAXDIR) : Lc I K d JI MAXDIR K#d D$DIR$(J) : -d J5d >d IEd Kdpd --- display directory entry d$d DIRFORM$;(D$,,),(D$, ,),((D$, ,)), ((D$,,));ddX --- create directory maskdbI el J ((MASK$))$ev V1((MASK$,I,))Ye I(MASK$) V2 : V2((MASK$,I,))me VV!V2V1e VV! ARRAY(J)VV! : ARRAY(J)VV!e IIe Jee --- read in entire directory!f FUNC:PARAM:CPM:BASE:V:I:J:K:D$"":RESULTXf FUNC : BUFADR : TOP+20 ' Set DMA addressf CPM(CODE()) : CPM(FUNC,BUFADR,RESULT)f FUNC : Search directory for firstf CPM(CODE( )) : CPM(FUNC,ARRAY(),RESULT)f I g RESULT RESULT p9g  BASEBUFADR RESULTEg D$""Vg  J rg* D$D$((BASEJ))|g4 Jg> DISPLAY "."; : h : I   gH DIR$(I)D$gR FUNC : Search directory for next'h\ CPM(CODE( )) : CPM(FUNC,ARRAY(),RESULT)0hf I@hp MAXDIRIFhzmh --- sort directory by shell sorth COMP(X,Y)(DIR$(X),, )(DIR$(Y),, )h GAPMAXDIRh GAPGAP : GAP  h JGAP MAXDIRi IJGAP  GAP%i COMP(I,IGAP) Ai DIR$(I),DIR$(IGAP)Ni IWi Jbi hii@ --- install CPM call routineiJ ADR:I:V:CPMADR:CPMVALiT VP(CODE())i^ ih I 'ir V: V )j| V V ADR,V : ADRADR : Hj V ADR(CODE())hj V ADR(CODE( ))qj Ixj j 1001,197,6,0,78,235,22,0,94,205,5,0,225,119,35,54,0,201j 1002,197,6,0,78,205,5,0,225,119,35,54,0,201j -1 k VP(CODE()) k,k --- read back memory