CBDOS refactoring

This commit is contained in:
FeralChild64 committed 2021-03-06 20:57:56 +01:00
1 parent 659330c9f1
commit 4234591508
31 files changed
+164 -135

No files matched your search

+7 -3
View File
@@ -63,9 +63,13 @@ SRCDIR_KERNAL = $(SRCDIR_COMMON) \
SRCDIR_DOS_M65 = $(SRCDIR_COMMON) \ SRCDIR_DOS_M65 = $(SRCDIR_COMMON) \
src/dos_m65 \ src/dos_m65 \
src/dos_m65/assets \ src/dos_m65/assets \
src/dos_m65/dev_floppy \ src/dos_m65/filesystem_cbm \
src/dos_m65/dev_ramdisk \ src/dos_m65/filesystem_vfs \
src/dos_m65/dev_sdcard \ src/dos_m65/lowlevel \
src/dos_m65/pseudoiec \
src/dos_m65/unit_floppy \
src/dos_m65/unit_ramdisk \
src/dos_m65/unit_sdcard \
src/dos_m65/utils src/dos_m65/utils
SRCDIR_MON_M65 = $(SRCDIR_COMMON) \ SRCDIR_MON_M65 = $(SRCDIR_COMMON) \
@@ -1,17 +0,0 @@
;
; Hypervisor virtual filesystem - reading the file
;
fs_1581_read_file_open:
; XXX provide implementation
jmp dos_EXIT_SEC
fs_1581_read_file:
; XXX provide implementation
jmp dos_EXIT_SEC
+3 -3
View File
@@ -41,9 +41,9 @@ dos_INIT:
; Initialize device handlers ; Initialize device handlers
jsr dev_sd_init jsr unit_sd_init
jsr dev_fd_init jsr unit_fd_init
jsr dev_rd_init jsr unit_rd_init
; Initialize DMA list ; Initialize DMA list
-18
View File
@@ -1,18 +0,0 @@
;
; Vector tables to device-specific routines
;
dos_cmd_OPEN_vectab:
!word dev_sd_cmd_OPEN
!word dev_fd_cmd_OPEN
!word dev_rd_cmd_OPEN
dos_cmd_CLOSE_vectab:
!word dev_sd_cmd_CLOSE
!word dev_fd_cmd_CLOSE
!word dev_rd_cmd_CLOSE
+18
View File
@@ -0,0 +1,18 @@
;
; Vector tables to device-specific routines
;
dos_cmd_OPEN_vectab:
!word unit_sd_cmd_OPEN
!word unit_fd_cmd_OPEN
!word unit_rd_cmd_OPEN
dos_cmd_CLOSE_vectab:
!word unit_sd_cmd_CLOSE
!word unit_fd_cmd_CLOSE
!word unit_rd_cmd_CLOSE
@@ -0,0 +1,13 @@
;
; CBM/CMD filesystem - helper routine to get the next directory entry
;
; Fills-in: PAR_FNAME, PAR_FTYPE, PAR_FSIZE_BYTES
; XXX work-in-progress, this should be used within directory reading code
fs_cbm_nextdirentry:
@@ -1,10 +1,10 @@
; ;
; Hypervisor virtual filesystem - reading directory ; CBM/CMD virtual filesystem - reading directory
; ;
fs_1581_read_dir_open: fs_cbm_read_dir_open:
; Try to read track 40, sector 0 (disk header) ; Try to read track 40, sector 0 (disk header)
@@ -13,7 +13,7 @@ fs_1581_read_dir_open:
lda #$00 lda #$00
sta PAR_SECTOR sta PAR_SECTOR
jsr dev_fd_util_readsector ; XXX handle read errors jsr lowlevel_readsector ; XXX handle read errors
; Create the first directory listing entry (title, id) ; Create the first directory listing entry (title, id)
@@ -78,7 +78,7 @@ fs_1581_read_dir_open:
lda #$02 lda #$02
sta PAR_SECTOR sta PAR_SECTOR
jsr dev_fd_util_readsector ; XXX handle read errors jsr lowlevel_readsector ; XXX handle read errors
; Copy 2nd BAM sector to the cache ; Copy 2nd BAM sector to the cache
@@ -106,7 +106,7 @@ fs_1581_read_dir_open:
jmp dos_EXIT_CLC jmp dos_EXIT_CLC
fs_1581_read_dir: fs_cbm_read_dir:
lda FD_DIRENT lda FD_DIRENT
@@ -147,12 +147,12 @@ fs_1581_read_dir:
ldy #$02 ; start from determining file type ldy #$02 ; start from determining file type
jsr code_LDA_nnnn_Y jsr code_LDA_nnnn_Y
beq fs_1581_read_dir ; ignore deleted files (but allow DEL files in some cases) beq fs_cbm_read_dir ; ignore deleted files (but allow DEL files in some cases)
tax tax
and #%00111111 ; for checking, filter out special bits and #%00111111 ; for checking, filter out special bits
cmp #$06 cmp #$06
bcs fs_1581_read_dir ; ignore unknown file types bcs fs_cbm_read_dir ; ignore unknown file types
stx PAR_FTYPE stx PAR_FTYPE
@@ -198,10 +198,10 @@ fs_1581_read_dir:
; Check if this was the last sector ; Check if this was the last sector
lda SHARED_BUF_1+0 lda SHARED_BUF_1+0
beq fs_1581_read_dir_blocksfree beq fs_cbm_read_dir_blocksfree
lda SHARED_BUF_1+1 lda SHARED_BUF_1+1
cmp #$FF cmp #$FF
beq fs_1581_read_dir_blocksfree beq fs_cbm_read_dir_blocksfree
; Transition from 1st half of the buffer, to (possibly) the second one ; Transition from 1st half of the buffer, to (possibly) the second one
@@ -232,10 +232,10 @@ fs_1581_read_dir:
; Check if this was the last sector ; Check if this was the last sector
lda SHARED_BUF_1+$100+0 lda SHARED_BUF_1+$100+0
beq fs_1581_read_dir_blocksfree beq fs_cbm_read_dir_blocksfree
lda SHARED_BUF_1+$100+1 lda SHARED_BUF_1+$100+1
cmp #$FF cmp #$FF
beq fs_1581_read_dir_blocksfree beq fs_cbm_read_dir_blocksfree
; Load new sector ; Load new sector
@@ -246,7 +246,7 @@ fs_1581_read_dir:
@get_sector_common: @get_sector_common:
jsr dev_fd_util_readsector ; XXX handle read errors jsr lowlevel_readsector ; XXX handle read errors
; Set new FD_DIRENT ; Set new FD_DIRENT
@@ -258,7 +258,7 @@ fs_1581_read_dir:
sta FD_DIRENT sta FD_DIRENT
jmp @cont jmp @cont
fs_1581_read_dir_blocksfree: fs_cbm_read_dir_blocksfree:
; Copy the 'BLOCKS FREE' line ; Copy the 'BLOCKS FREE' line
@@ -0,0 +1,31 @@
;
; CBM/CMD virtual filesystem - reading the file
;
fs_cbm_read_file_open:
; Get the first sector of the directory
lda #40
sta PAR_TRACK
lda #$03
sta PAR_SECTOR
jsr lowlevel_readsector ; XXX handle read errors
; XXX provide implementation
jmp dos_EXIT_SEC
fs_cbm_read_file:
; XXX provide implementation
jmp dos_EXIT_SEC
@@ -9,9 +9,7 @@
; NOTE: overrides page pointed by FS_HVSR_DIRENT! ; NOTE: overrides page pointed by FS_HVSR_DIRENT!
; XXX work-in-progress, this should be used within directory reading code fs_vfs_nextdirentry:
fs_hvsr_util_nextdirentry:
; Clear the page which will be used ; Clear the page which will be used
@@ -47,26 +45,26 @@ fs_hvsr_util_nextdirentry:
; ;
ldx FS_HVSR_DIRENT+$40 ; file name length ldx FS_HVSR_DIRENT+$40 ; file name length
beq fs_hvsr_util_nextdirentry ; do not even try for empty file name beq fs_vfs_nextdirentry ; do not even try for empty file name
cpx #20 cpx #20
bcs fs_hvsr_util_nextdirentry ; if longer than 16 characters + dot + extension - also skip this one bcs fs_vfs_nextdirentry ; if longer than 16 characters + dot + extension - also skip this one
dex dex
@lpname: @lpname:
lda FS_HVSR_DIRENT,x lda FS_HVSR_DIRENT,x
cmp #$22 cmp #$22
beq fs_hvsr_util_nextdirentry ; quotation mark is illegal beq fs_vfs_nextdirentry ; quotation mark is illegal
cmp #$2A cmp #$2A
beq fs_hvsr_util_nextdirentry ; asterisk is illegal, it is used for filtering beq fs_vfs_nextdirentry ; asterisk is illegal, it is used for filtering
cmp #$3F cmp #$3F
beq fs_hvsr_util_nextdirentry ; the question mark - in the MS-DOS world it is illegal beq fs_vfs_nextdirentry ; the question mark - in the MS-DOS world it is illegal
cmp #$20 cmp #$20
bcc fs_hvsr_util_nextdirentry ; control characters are not allowed bcc fs_vfs_nextdirentry ; control characters are not allowed
cmp #$5B cmp #$5B
bcc @lpname_next ; up to PETSCII 'Z' is OK bcc @lpname_next ; up to PETSCII 'Z' is OK
cmp #$61 cmp #$61
bcc fs_hvsr_util_nextdirentry ; some characters are not allowed bcc fs_vfs_nextdirentry ; some characters are not allowed
cmp #$7E cmp #$7E
bne @lpname_1 bne @lpname_1
lda #$A6 ; replace tilde / pi with something more sane lda #$A6 ; replace tilde / pi with something more sane
@@ -75,7 +73,7 @@ fs_hvsr_util_nextdirentry:
@lpname_1: @lpname_1:
cmp #$7B cmp #$7B
bcs fs_hvsr_util_nextdirentry ; PETSCII-art and control characters are illegal bcs fs_vfs_nextdirentry ; PETSCII-art and control characters are illegal
clc clc
sbc #$20 ; make everything the same case sbc #$20 ; make everything the same case
@@ -102,7 +100,7 @@ fs_hvsr_util_nextdirentry:
txa txa
and #$10 and #$10
beq fs_hvsr_util_nextdirentry ; this type is unknown beq fs_vfs_nextdirentry ; this type is unknown
@entity_dir: @entity_dir:
@@ -110,7 +108,7 @@ fs_hvsr_util_nextdirentry:
lda FS_HVSR_DIRENT+$40 lda FS_HVSR_DIRENT+$40
cmp #$11 cmp #$11
bcs fs_hvsr_util_nextdirentry ; skip entry if file name longer than 16 characters bcs fs_vfs_nextdirentry ; skip entry if file name longer than 16 characters
; Set the type to directory ; Set the type to directory
@@ -124,8 +122,8 @@ fs_hvsr_util_nextdirentry:
lda FS_HVSR_DIRENT+$40 lda FS_HVSR_DIRENT+$40
sec sec
sbc #$04 ; strip 4 bytes - for dot and extension sbc #$04 ; strip 4 bytes - for dot and extension
bmi fs_hvsr_util_nextdirentry ; if name too short, try next entry bmi fs_vfs_nextdirentry ; if name too short, try next entry
beq fs_hvsr_util_nextdirentry ; if name too short, try next entry beq fs_vfs_nextdirentry ; if name too short, try next entry
sta FS_HVSR_DIRENT+$40 ; store corrected file name length sta FS_HVSR_DIRENT+$40 ; store corrected file name length
tax tax
@@ -133,7 +131,7 @@ fs_hvsr_util_nextdirentry:
lda FS_HVSR_DIRENT, x lda FS_HVSR_DIRENT, x
cmp #$2E cmp #$2E
+bne fs_hvsr_util_nextdirentry +bne fs_vfs_nextdirentry
; ;
; Detect file type by extension ; Detect file type by extension
@@ -165,12 +163,12 @@ fs_hvsr_util_nextdirentry:
cpy #(dir_types__end - dir_types) cpy #(dir_types__end - dir_types)
bcc @lpext bcc @lpext
jmp fs_hvsr_util_nextdirentry ; file extension not detected jmp fs_vfs_nextdirentry ; file extension not detected
@lpext_found: @lpext_found:
cpy #$18 cpy #$18
+beq fs_hvsr_util_nextdirentry ; file extension 'DIR' does not mean this is a directory +beq fs_vfs_nextdirentry ; file extension 'DIR' does not mean this is a directory
tya tya
clc clc
@@ -4,7 +4,7 @@
; ;
fs_hvsr_read_dir_open: fs_vfs_read_dir_open:
; Open the directory ; Open the directory
@@ -44,23 +44,23 @@ fs_hvsr_read_dir_open:
jmp dos_EXIT_CLC jmp dos_EXIT_CLC
fs_hvsr_read_dir: fs_vfs_read_dir:
; Read dirent structure into $1000, process it, restore the memory content. ; Read dirent structure into $1000, process it, restore the memory content.
; Starting at $1000 VIC sees chargen, so this should be a safe place ; Starting at $1000 VIC sees chargen, so this should be a safe place
jsr fs_hvsr_direntmem_prepare jsr fs_vfs_direntmem_prepare
jsr fs_hvsr_util_nextdirentry jsr fs_vfs_nextdirentry
jsr fs_hvsr_direntmem_restore ; processor status is preserved jsr fs_vfs_direntmem_restore ; processor status is preserved
; If nothing to read, output 'blocks free' ; If nothing to read, output 'blocks free'
+bcs fs_hvsr_read_dir_blocksfree +bcs fs_vfs_read_dir_blocksfree
; Check if file name matches the filter ; Check if file name matches the filter
jsr util_dir_filter jsr util_dir_filter
bne fs_hvsr_read_dir ; if does not match, try the next entry bne fs_vfs_read_dir ; if does not match, try the next entry
; Otherwise, convert the file length from bytes to blocks to display ; Otherwise, convert the file length from bytes to blocks to display
@@ -84,7 +84,7 @@ fs_hvsr_read_dir:
clc clc
rts rts
fs_hvsr_read_dir_blocksfree: fs_vfs_read_dir_blocksfree:
; Set pointer to 'BLOCKS FREE.' line ; Set pointer to 'BLOCKS FREE.' line
@@ -117,7 +117,7 @@ fs_hvsr_read_dir_blocksfree:
; Helper routines ; Helper routines
; ;
fs_hvsr_direntmem_prepare: fs_vfs_direntmem_prepare:
ldx #$00 ldx #$00
@1: @1:
@@ -128,7 +128,7 @@ fs_hvsr_direntmem_prepare:
rts rts
fs_hvsr_direntmem_restore: fs_vfs_direntmem_restore:
php php
@@ -4,7 +4,7 @@
; ;
fs_hvsr_read_file_open: fs_vfs_read_file_open:
; Open the directory ; Open the directory
@@ -28,12 +28,12 @@ fs_hvsr_read_file_open:
; Read dirent structures into $1000, find the first matching file ; Read dirent structures into $1000, find the first matching file
; Starting at $1000 VIC sees chargen, so this should be a safe place ; Starting at $1000 VIC sees chargen, so this should be a safe place
jsr fs_hvsr_direntmem_prepare jsr fs_vfs_direntmem_prepare
@lp_find: @lp_find:
jsr fs_hvsr_util_nextdirentry ; fetch the next file name jsr fs_vfs_nextdirentry ; fetch the next file name
+bcs fs_hvsr_file_not_found +bcs fs_vfs_file_not_found
; Only accept files of type 'PRG', properly closed ; Only accept files of type 'PRG', properly closed
@@ -49,9 +49,9 @@ fs_hvsr_read_file_open:
; Found the file - load it ; Found the file - load it
jsr fs_hvsr_direntmem_restore ; restore $1000 memory content jsr fs_vfs_direntmem_restore ; restore $1000 memory content
lda #$18 ; dos_openfile lda #$18 ; dos_openfile
sta HTRAP00 sta HTRAP00
+nop +nop
@@ -62,15 +62,15 @@ fs_hvsr_read_file_open:
lda #$03 ; mode: read file lda #$03 ; mode: read file
sta SD_MODE sta SD_MODE
jsr fs_hvsr_read_file jsr fs_vfs_read_file
jmp dos_EXIT jmp dos_EXIT
fs_hvsr_read_file: fs_vfs_read_file:
; Read chunk of data to SD card buffer ; Read chunk of data to SD card buffer
ldx SD_DESC ldx SD_DESC
lda #$1A ; dos_readfile lda #$1A ; dos_readfile
sta HTRAP00 sta HTRAP00
+nop +nop
@@ -87,7 +87,7 @@ fs_hvsr_read_file:
ora SD_ACPTR_LEN+0 ora SD_ACPTR_LEN+0
bne @copy bne @copy
lda #$20 ; dos_closefile lda #$20 ; dos_closefile
sta HTRAP00 sta HTRAP00
+nop +nop
@@ -106,7 +106,7 @@ fs_hvsr_read_file:
; Copy data to SHARED_BUF_0 ; Copy data to SHARED_BUF_0
lda #%10000000 ; select SD card buffer lda #%10000000 ; select SD card buffer
tsb SD_BUFCTL tsb SD_BUFCTL
; Copy data using DMA job ; Copy data using DMA job
@@ -120,21 +120,21 @@ fs_hvsr_read_file:
lda #$01 lda #$01
sta DMAJOB_DST_ADDR+2 sta DMAJOB_DST_ADDR+2
jsr util_dma_launch_from_hwbuf ; execute DMA job jsr util_dma_launch_from_hwbuf ; execute DMA job
clc clc
rts rts
fs_hvsr_file_not_found: fs_vfs_file_not_found:
jsr fs_hvsr_direntmem_restore ; restore $1000 memory content jsr fs_vfs_direntmem_restore ; restore $1000 memory content
ldx SD_DESC ldx SD_DESC
lda #$16 ; dos_closedir lda #$16 ; dos_closedir
sta HTRAP00 sta HTRAP00
+nop +nop
lda #39 ; file not found error lda #39 ; file not found error
jsr util_status_SD jsr util_status_SD
lda #K_ERR_FILE_NOT_FOUND lda #K_ERR_FILE_NOT_FOUND
@@ -1,8 +1,8 @@
; Read a single sector from a floppy drive ; Read a single sector from a block device
dev_fd_util_readsector: lowlevel_readsector:
; Select FDD sector as buffer ; Select FDD sector as buffer
@@ -56,7 +56,7 @@ msg_ACPTR_read_SD:
ora SD_ACPTR_LEN+1 ora SD_ACPTR_LEN+1
bne @3 bne @3
jsr dev_sd_cmd_READ jsr unit_sd_cmd_READ
bcc @3 bcc @3
jsr kernalstatus_EOI jsr kernalstatus_EOI
@3: @3:
@@ -86,7 +86,7 @@ msg_ACPTR_read_FD:
ora FD_ACPTR_LEN+1 ora FD_ACPTR_LEN+1
bne @3 bne @3
jsr dev_fd_cmd_READ jsr unit_fd_cmd_READ
bcc @3 bcc @3
jsr kernalstatus_EOI jsr kernalstatus_EOI
@3: @3:
@@ -52,7 +52,7 @@ msg_CIOUT_cmdfn_SD: ; get next byte of status - SD card
lda #$A0 lda #$A0
sta SD_CMDFN_BUF,x sta SD_CMDFN_BUF,x
plp plp
+bcs dev_sd_cmd_OPEN_EOI ; if EOI - execute command +bcs unit_sd_cmd_OPEN_EOI ; if EOI - execute command
jmp dos_EXIT_CLC jmp dos_EXIT_CLC
msg_CIOUT_cmdfn_FD: ; get next byte of status - floppy msg_CIOUT_cmdfn_FD: ; get next byte of status - floppy
@@ -67,7 +67,7 @@ msg_CIOUT_cmdfn_FD: ; get next byte of status - floppy
lda #$A0 lda #$A0
sta FD_CMDFN_BUF,x sta FD_CMDFN_BUF,x
plp plp
+bcs dev_fd_cmd_OPEN_EOI ; if EOI - execute command +bcs unit_fd_cmd_OPEN_EOI ; if EOI - execute command
jmp dos_EXIT_CLC jmp dos_EXIT_CLC
msg_CIOUT_cmdfn_RD: ; get next byte of status - ram disk msg_CIOUT_cmdfn_RD: ; get next byte of status - ram disk
@@ -82,7 +82,7 @@ msg_CIOUT_cmdfn_RD: ; get next byte of status - ram disk
lda #$A0 lda #$A0
sta RD_CMDFN_BUF,x sta RD_CMDFN_BUF,x
plp plp
+bcs dev_rd_cmd_OPEN_EOI ; if EOI - execute command +bcs unit_rd_cmd_OPEN_EOI ; if EOI - execute command
jmp dos_EXIT_CLC jmp dos_EXIT_CLC
msg_CIOUT_cmdfn_vectab: msg_CIOUT_cmdfn_vectab:
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -4,7 +4,7 @@
; ;
dev_fd_cmd_CLOSE: unit_fd_cmd_CLOSE:
; XXX provide implementation ; XXX provide implementation
@@ -4,14 +4,14 @@
; ;
dev_fd_cmd_OPEN: unit_fd_cmd_OPEN:
lda #$01 ; mode: receive command or file name lda #$01 ; mode: receive command or file name
sta FD_MODE sta FD_MODE
jmp dos_EXIT_CLC jmp dos_EXIT_CLC
dev_fd_cmd_OPEN_EOI: unit_fd_cmd_OPEN_EOI:
; XXX this dispatcher is temporary ; XXX this dispatcher is temporary
@@ -28,17 +28,17 @@ dev_fd_cmd_OPEN_EOI:
lda FD_CMDFN_BUF lda FD_CMDFN_BUF
cmp #'$' cmp #'$'
beq dev_fd_cmd_OPEN_dir beq unit_fd_cmd_OPEN_dir
; FALLTROUGH ; FALLTROUGH
dev_fd_cmd_OPEN_file: unit_fd_cmd_OPEN_file:
; XXX provide implementation ; XXX provide implementation
jmp dos_EXIT_CLC jmp dos_EXIT_CLC
dev_fd_cmd_OPEN_dir: unit_fd_cmd_OPEN_dir:
lda #$02 ; mode: read directory lda #$02 ; mode: read directory
sta FD_MODE sta FD_MODE
@@ -57,4 +57,4 @@ dev_fd_cmd_OPEN_dir:
@lp1_end: @lp1_end:
jmp fs_1581_read_dir_open jmp fs_cbm_read_dir_open
@@ -4,17 +4,17 @@
; ;
dev_fd_cmd_READ: unit_fd_cmd_READ:
lda FD_MODE lda FD_MODE
cmp #$03 cmp #$03
+beq fs_1581_read_file +beq fs_cbm_read_file
lda FD_DIR_PHASE lda FD_DIR_PHASE
cmp #$01 cmp #$01
+beq fs_1581_read_dir +beq fs_cbm_read_dir
cmp #$02 cmp #$02
+beq fs_1581_read_dir_blocksfree +beq fs_cbm_read_dir_blocksfree
sec ; mark EOI sec ; mark EOI
rts rts
@@ -4,7 +4,7 @@
; ;
dev_fd_init: unit_fd_init:
; Copy status string ; Copy status string
@@ -4,7 +4,7 @@
; ;
dev_rd_cmd_CLOSE: unit_rd_cmd_CLOSE:
; XXX provide implementation ; XXX provide implementation
@@ -4,13 +4,13 @@
; ;
dev_rd_cmd_OPEN: unit_rd_cmd_OPEN:
; XXX provide implementation ; XXX provide implementation
jmp dos_EXIT_SEC jmp dos_EXIT_SEC
dev_rd_cmd_OPEN_EOI: unit_rd_cmd_OPEN_EOI:
; XXX provide implementation ; XXX provide implementation
@@ -4,7 +4,7 @@
; ;
dev_rd_cmd_READ: unit_rd_cmd_READ:
; XXX provide implementation ; XXX provide implementation
@@ -4,7 +4,7 @@
; ;
dev_rd_init: unit_rd_init:
; Copy status string ; Copy status string
@@ -4,7 +4,7 @@
; ;
dev_sd_cmd_CLOSE: unit_sd_cmd_CLOSE:
; XXX provide implementation ; XXX provide implementation
@@ -4,14 +4,14 @@
; ;
dev_sd_cmd_OPEN: unit_sd_cmd_OPEN:
lda #$01 ; mode: receive command or file name lda #$01 ; mode: receive command or file name
sta SD_MODE sta SD_MODE
jmp dos_EXIT_CLC jmp dos_EXIT_CLC
dev_sd_cmd_OPEN_EOI: unit_sd_cmd_OPEN_EOI:
; XXX this dispatcher is temporary ; XXX this dispatcher is temporary
@@ -28,11 +28,11 @@ dev_sd_cmd_OPEN_EOI:
lda SD_CMDFN_BUF lda SD_CMDFN_BUF
cmp #'$' cmp #'$'
beq dev_sd_cmd_OPEN_dir beq unit_sd_cmd_OPEN_dir
; FALLTROUGH ; FALLTROUGH
dev_sd_cmd_OPEN_file: unit_sd_cmd_OPEN_file:
; Copy the filter from command XXX this should be moved to common part and deduplicated with directory opening ; Copy the filter from command XXX this should be moved to common part and deduplicated with directory opening
@@ -48,10 +48,10 @@ dev_sd_cmd_OPEN_file:
@lp1_end: @lp1_end:
jmp fs_hvsr_read_file_open jmp fs_vfs_read_file_open
dev_sd_cmd_OPEN_dir: unit_sd_cmd_OPEN_dir:
lda #$02 ; mode: read directory lda #$02 ; mode: read directory
sta SD_MODE sta SD_MODE
@@ -70,4 +70,4 @@ dev_sd_cmd_OPEN_dir:
@lp1_end: @lp1_end:
jmp fs_hvsr_read_dir_open jmp fs_vfs_read_dir_open
@@ -4,17 +4,17 @@
; ;
dev_sd_cmd_READ: unit_sd_cmd_READ:
lda SD_MODE lda SD_MODE
cmp #$03 cmp #$03
+beq fs_hvsr_read_file +beq fs_vfs_read_file
lda SD_DIR_PHASE lda SD_DIR_PHASE
cmp #$01 cmp #$01
+beq fs_hvsr_read_dir +beq fs_vfs_read_dir
cmp #$02 cmp #$02
+beq fs_hvsr_read_dir_blocksfree +beq fs_vfs_read_dir_blocksfree
sec ; mark EOI sec ; mark EOI
rts rts
@@ -4,7 +4,7 @@
; ;
dev_sd_init: unit_sd_init:
; Copy initial status string ; Copy initial status string