CBDOS wildcard improvements
This commit is contained in:
1 parent
29db7340dd
commit
d91e8365b6
1 file changed
+65
-2
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
; Check if file name matches the filter (if so - Zero flag set)
|
; Check if file name/type matches the filter (if so - Zero flag set)
|
||||||
|
|
||||||
|
|
||||||
util_dir_filter:
|
util_dir_filter:
|
||||||
@@ -14,15 +14,78 @@ util_dir_filter:
|
|||||||
|
|
||||||
lda PAR_FPATTERN, y
|
lda PAR_FPATTERN, y
|
||||||
cmp #'*'
|
cmp #'*'
|
||||||
beq @done ; branch on wildcard
|
beq @asterisk ; branch on wildcard
|
||||||
|
|
||||||
|
cmp #'?'
|
||||||
|
beq @lp1_next ; question mark substitutes any character
|
||||||
|
|
||||||
cmp PAR_FNAME, y
|
cmp PAR_FNAME, y
|
||||||
bne @done ; branch if does not match
|
bne @done ; branch if does not match
|
||||||
|
|
||||||
|
@lp1_next:
|
||||||
|
|
||||||
iny
|
iny
|
||||||
cpy #$10
|
cpy #$10
|
||||||
bne @lp1 ; next iteration if maximum length not reached
|
bne @lp1 ; next iteration if maximum length not reached
|
||||||
|
|
||||||
|
@done_match:
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
|
||||||
@done:
|
@done:
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
@asterisk:
|
||||||
|
|
||||||
|
iny ; check if the next character after asterisk is '='
|
||||||
|
cpy #$10
|
||||||
|
beq @done
|
||||||
|
lda PAR_FPATTERN, y
|
||||||
|
cmp #'='
|
||||||
|
bne @done_match
|
||||||
|
|
||||||
|
iny
|
||||||
|
cpy #$10
|
||||||
|
beq @done
|
||||||
|
lda PAR_FPATTERN, y
|
||||||
|
|
||||||
|
; XXXthe comparisons below do not work; investigate, why
|
||||||
|
|
||||||
|
cmp #$44 ; if 'D' - require a directory XXX document this
|
||||||
|
beq @require_dir
|
||||||
|
cmp #$50 ; if 'P' - require PRG file
|
||||||
|
beq @require_prg
|
||||||
|
cmp #$52 ; if 'R' - require REL file
|
||||||
|
beq @require_rel
|
||||||
|
cmp #$53 ; if 'S' - require SEQ file
|
||||||
|
beq @require_seq
|
||||||
|
cmp #$55 ; if 'U' - require USR file
|
||||||
|
bne @done
|
||||||
|
|
||||||
|
@require_usr:
|
||||||
|
|
||||||
|
lda #$03
|
||||||
|
+skip_2_bytes_trash_nvz
|
||||||
|
|
||||||
|
@require_seq:
|
||||||
|
|
||||||
|
lda #$01
|
||||||
|
+skip_2_bytes_trash_nvz
|
||||||
|
|
||||||
|
@require_rel:
|
||||||
|
|
||||||
|
lda #$04
|
||||||
|
+skip_2_bytes_trash_nvz
|
||||||
|
|
||||||
|
@require_prg:
|
||||||
|
|
||||||
|
lda #$02
|
||||||
|
+skip_2_bytes_trash_nvz
|
||||||
|
|
||||||
|
@require_dir:
|
||||||
|
|
||||||
|
lda #$05
|
||||||
|
|
||||||
|
cmp PAR_FTYPE
|
||||||
|
rts
|
||||||
Reference in new issue
Block a user