maxfile = $03 ;Keeps track of # of files in memory rzp = $06 ;word countfile = $f0 ;byte countdir = $f1 ;byte dzp = $fc ;word dirpos = $d000 ;Filenames flengde = $daa1 ;Table of filename/dirname lengths for each entry in dirpos ;$01-$10 filename length ;$81-$90 dirname length iec_dir_sort lda #0 sta countfile sort_next jsr scanforfile ;scan for first file entry bne bn91 rts bn91 sta filevalue+1 tya jsr getpos sta dzp+1 stx dzp lda countfile ;set first dir entry to scan sta countdir ;for at same position as first file entry jsr scanfordir bne bn92 rts bn92 sta dirvalue+1 tya jsr getpos sta rzp+1 stx rzp ldy countfile ;filepos dirvalue lda #0 ;insert dir value sta flengde,y ldy countdir ;dirpos filevalue lda #0 ;insert file value sta flengde,y ldy #$0f ;swap names swap2 lda (dzp),y ;filename pha lda (rzp),y ;dirname sta (dzp),y ;store dirname in new position pla sta (rzp),y ;store filename in new position dey bpl swap2 bmi sort_next ;jmp getpos pha asl asl asl asl tax pla lsr lsr lsr lsr ora #>dirpos ;Filenames at $d000, $d010, $d020 ... rts scanfordir ldy countdir ;Search dir entries bn93 lda flengde,y bmi dirfound iny cpy maxfile bne bn93 lda #0 ;nothing, so we exit dirfound sty countdir rts scanforfile ldy countfile ;Search file entries bn94 lda flengde,y bpl filefound iny cpy maxfile bne bn94 lda #0 ;nothing available, so we exit filefound sty countfile rts
/home/spider/C64/sidtest/subdir 0 OPEN 2,6,0,SUBDIR 0 CHKIN 6,0 .CLOSE 6,0 /home/spider/C64/sidtest/, * 0 OPEN 1,6,0,$ 0 CHKIN 6,0 ........CLOSE 6,0
DOS"CD:<dirname>"
CMD: cd:subdir HuntPath: , subdir, subdir path: subdir/ 0 OPEN 0,6,15,cd:subdir OPEN repeat 0,6,15,CD:SUBDIR CLOSE 6,15 /home/spider/C64/sidtest/subdir/, * 0 OPEN 0,6,0,$ ......CLOSE 6,0