more work on SD card directory display

This commit is contained in:
FeralChild64 committed 2021-02-15 20:07:31 +01:00
1 parent d79c1041e6
commit ca54482c08
2 files changed
+88 -17

No files matched your search

+12 -11
View File
@@ -39,14 +39,15 @@ dir_ext_02: !pet "prg" ; PRG
dir_ext_03: !pet "usr" ; USR
dir_ext_04: !pet "rel" ; REL
dir_ext_05: !pet "dir" ; directory
dir_ext_06: !pet "d67" ; CBM 2040 (DOS 1) - disk image
dir_ext_07: !pet "d64" ; CBM 1541 / 2031 / 3040 / 4040 - disk image
dir_ext_08: !pet "d71" ; CBM 1571 - disk image
dir_ext_09: !pet "d81" ; CBM 1581 - disk image
dir_ext_0A: !pet "d80" ; CBM 8050 - disk image
dir_ext_0B: !pet "d81" ; CBM 8250 / 1001 - disk image
dir_ext_0C: !pet "d90" ; CBM D9060 / D9090 - hard disk image
dir_ext_0D: !pet "d1m" ; CMD FD 2000 / 4000 - disk image (DD)
dir_ext_0E: !pet "d2m" ; CMD FD 2000 / 4000 - disk image (HD)
dir_ext_0F: !pet "d4m" ; CMD FD 4000 - disk image (ED)
dir_ext_10: !pet "dhd" ; CMD HD - hard disk image
; dir_ext_06: !pet "tap" ; tape image
; dir_ext_07: !pet "d67" ; CBM 2040 (DOS 1) - disk image
; dir_ext_08: !pet "d64" ; CBM 1541 / 2031 / 3040 / 4040 - disk image
; dir_ext_09: !pet "d71" ; CBM 1571 - disk image
; dir_ext_0A: !pet "d81" ; CBM 1581 - disk image
; dir_ext_0B: !pet "d80" ; CBM 8050 - disk image
; dir_ext_0C: !pet "d81" ; CBM 8250 / 1001 - disk image
; dir_ext_0D: !pet "d90" ; CBM D9060 / D9090 - hard disk image
; dir_ext_0E: !pet "d1m" ; CMD FD 2000 / 4000 - disk image (DD)
; dir_ext_0F: !pet "d2m" ; CMD FD 2000 / 4000 - disk image (HD)
; dir_ext_10: !pet "d4m" ; CMD FD 4000 - disk image (ED)
; dir_ext_11: !pet "dhd" ; CMD HD - hard disk image
+76 -6
View File
@@ -63,11 +63,12 @@ fs_hvsr_read_dir:
; If nothing to read, output 'blocks free'
bcc fs_hvsr_read_dir_blocksfree
+bcc fs_hvsr_read_dir_blocksfree
; Dirent structure - important fields:
; - $00-$3F - file name
; - $40 - file name length
; - $51-$54 - file length
; - $55 - file type and attributes
; Validate/fix characters in file name
@@ -98,6 +99,8 @@ fs_hvsr_read_dir:
dex
bpl @lp1
inc $D020
; Validate file name length
; XXX check for directory!
@@ -111,17 +114,85 @@ fs_hvsr_read_dir:
cmp #$11
bcs fs_hvsr_read_dir ; if stripped name is 17 characters or longer, try the next entry
sta SD_DIRENT+$40 ; store corrected file name length
tax
; Detect file type (+64 for read-only, +128 = damaged)
; XXX detect image
lda SD_DIRENT, x
cmp #$2E
bne fs_hvsr_read_dir ; 3-character extension is required!
; Try to prepare output row
; XXX temporary; detect file type by extension instead
; Try to prepare output row, starting from SD_DIRENT+$80
; XXX provide proper implementation here
lda #$01 ; link to the next line - dummy, will be regenerated by BASIC
sta SD_DIRENT+$80
sta SD_DIRENT+$81
lda #$00 ; XXX calculate length in blocks instead
sta SD_DIRENT+$82
sta SD_DIRENT+$83
jmp fs_hvsr_read_dir_blocksfree ; XXX temporary
ldx #$04 ; XXX put correct amount of spaces instead
lda #' '
sta SD_DIRENT+$80, x
inx
sta SD_DIRENT+$80, x
lda #$22 ; opening quote
sta SD_DIRENT+$80, x
ldy #$FF ; put file name
@lp2:
inx
iny
lda SD_DIRENT, y
sta SD_DIRENT+$80,x
bne @lp2
inx
lda #$22 ; closing quote
sta SD_DIRENT+$80, x
inx
lda #' ' ; XXX put correct amount of spaces instead
sta SD_DIRENT+$80, x
inx
sta SD_DIRENT+$80, x
inx
; XXX put read-only mark if needed
ldy #$03 ; XXX select proper file type instead
lda dir_ext_01+0, y
sta SD_DIRENT+$80, x
inx
lda dir_ext_01+1, y
sta SD_DIRENT+$80, x
inx
lda dir_ext_01+2, y
sta SD_DIRENT+$80, x
inx
; No 'damaged' mark is needed here; put ending 0 and provide pointer
lda #$00
sta SD_DIRENT+$80, x
inx
stx SD_ACPTR_LEN+0
sta SD_ACPTR_LEN+1
lda #<(SD_DIRENT+$80)
sta SD_ACPTR_PTR+0
lda #>(SD_DIRENT+$80)
sta SD_ACPTR_PTR+1
clc
rts
fs_hvsr_read_dir_blocksfree:
@@ -152,7 +223,6 @@ fs_hvsr_read_dir_blocksfree:
clc
rts
;
; Helper routines
;