more work on SD card directory display
This commit is contained in:
1 parent
d79c1041e6
commit
ca54482c08
2 files changed
+88
-17
No files matched your search
@@ -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
|
||||
;
|
||||
|
||||
Reference in new issue
Block a user