work towards directory filtering in CBDOS

This commit is contained in:
FeralChild64 committed 2021-02-23 22:32:27 +01:00
1 parent 282fba5288
commit 2b7f0d41eb
3 files changed
+61 -1

No files matched your search

+27 -1
View File
@@ -19,11 +19,37 @@ dev_sd_cmd_OPEN_EOI:
lda SD_CMDFN_BUF
cmp #'$'
+beq fs_hvsr_read_dir_open
beq dev_sd_cmd_OPEN_dir
; XXX implement for file names
jmp dos_EXIT_SEC
dev_sd_cmd_OPEN_dir:
; XXX this should be moved to common part
; Erase filter pattern for the directory
ldy #$0F
lda #$A0
@lp1:
sta PAR_FPATTERN, y
dey
bpl @lp1
; Copy the filter from command
ldy #$00
@lp2:
lda SD_MODE, y
beq @lp2_end
sta PAR_FPATTERN, y
iny
cpy #$10
bne @lp2_end
@lp2_end:
jmp fs_hvsr_read_dir_open
@@ -60,6 +60,12 @@ fs_hvsr_read_dir:
+bcs fs_hvsr_read_dir_blocksfree
; Check if file name matches the filter
; XXX debug this
; jsr util_dir_filter
; bne fs_hvsr_read_dir ; if does not match, try the next entry
; Otherwise, convert the file length from bytes to blocks to display
jsr util_dir_filesize_bytes
+28
View File
@@ -0,0 +1,28 @@
; Check if file name matches the filter (if so - Zero flag set)
util_dir_filter:
lda PAR_FPATTERN
cmp #$A0
beq @done ; branch if no filter
ldy #$00
@lp1:
lda PAR_FPATTERN, y
cmp #'*'
beq @done ; branch on wildcard
cmp PAR_FNAME, y
bne @done ; branch if does not match
iny
cpy #$10
bne @lp1 ; next iteration if maximum length not reached
@done:
rts