more refactoring towards RAM disk support

This commit is contained in:
FeralChild64 committed 2021-07-07 20:33:49 +02:00
1 parent 924d87d271
commit 7624e14104
19 files changed
+51 -51

No files matched your search

+1 -1
View File
@@ -68,9 +68,9 @@ SRCDIR_DOS_M65 = $(SRCDIR_COMMON) \
src/dos_m65/filesystem_vfs \
src/dos_m65/lowlevel \
src/dos_m65/pseudoiec \
src/dos_m65/unit_card \
src/dos_m65/unit_disk \
src/dos_m65/unit_ramdisk \
src/dos_m65/unit_sdcard \
src/dos_m65/utils
SRCDIR_MON_M65 = $(SRCDIR_COMMON) \
+3 -3
View File
@@ -84,9 +84,9 @@ dos_INIT:
; Initialize device handlers
jsr unit_sd_init
jsr unit_fd_init
jsr unit_rd_init
jsr card_sd_init
jsr disk_fd_init
jsr disk_rd_init
; Safer version of 'dos_EXIT' - does not affect speed related registers
+1 -1
View File
@@ -13,5 +13,5 @@ dos_PRELOAD:
rts
@ok:
jsr dos_ENTER
jsr unit_rd_preload
jsr disk_rd_preload
jmp dos_EXIT_CLC
+8 -6
View File
@@ -6,13 +6,15 @@
dos_cmd_OPEN_vectab:
!word unit_sd_cmd_OPEN
!word unit_disk_cmd_OPEN
!word unit_disk_cmd_OPEN
!word card_sd_cmd_OPEN
!word disk_xx_cmd_OPEN
!word disk_xx_cmd_OPEN
!word disk_xx_cmd_OPEN
dos_cmd_CLOSE_vectab:
!word unit_sd_cmd_CLOSE
!word unit_fd_cmd_CLOSE
!word unit_rd_cmd_CLOSE
!word card_sd_cmd_CLOSE
!word disk_fd_cmd_CLOSE
!word disk_fd_cmd_CLOSE
!word disk_rd_cmd_CLOSE
+3 -3
View File
@@ -60,7 +60,7 @@ msg_ACPTR_read_SD:
ora SD_ACPTR_LEN+1
bne @3
jsr unit_sd_cmd_READ
jsr card_sd_cmd_READ
bcc @3
jsr kernalstatus_EOI
@3:
@@ -90,7 +90,7 @@ msg_ACPTR_read_F0:
ora F0_ACPTR_LEN+1
bne @3
jsr unit_f0_cmd_READ
jsr disk_f0_cmd_READ
bcc @3
jsr kernalstatus_EOI
@3:
@@ -120,7 +120,7 @@ msg_ACPTR_read_F1:
ora F1_ACPTR_LEN+1
bne @3
jsr unit_f1_cmd_READ
jsr disk_f1_cmd_READ
bcc @3
jsr kernalstatus_EOI
@3:
+2 -2
View File
@@ -58,7 +58,7 @@ msg_CIOUT_cmdfn_SD: ; get next byte of status - SD card
lda #$A0
sta SD_CMDFN_BUF,x
plp
+bcs unit_sd_cmd_OPEN_EOI ; if EOI - execute command
+bcs card_sd_cmd_OPEN_EOI ; if EOI - execute command
jmp dos_EXIT_CLC
msg_CIOUT_cmdfn_F0: ; get next byte of status - floppy
@@ -104,7 +104,7 @@ msg_CIOUT_cmdfn_RD: ; get next byte of status - ram disk
msg_CIOUT_cmdfn_FX: ; common pard for floppy and RAM disk
plp
+bcs unit_disk_cmd_OPEN_EOI ; if EOI - execute command
+bcs disk_fd_cmd_OPEN_EOI ; if EOI - execute command
jmp dos_EXIT_CLC
msg_CIOUT_cmdfn_vectab:
@@ -4,7 +4,7 @@
;
unit_sd_cmd_CLOSE:
card_sd_cmd_CLOSE:
; XXX provide implementation
@@ -4,14 +4,14 @@
;
unit_sd_cmd_OPEN:
card_sd_cmd_OPEN:
lda #$01 ; mode: receive command or file name
sta SD_MODE
jmp dos_EXIT_CLC
unit_sd_cmd_OPEN_EOI:
card_sd_cmd_OPEN_EOI:
; XXX this dispatcher is temporary
@@ -26,11 +26,11 @@ unit_sd_cmd_OPEN_EOI:
lda SD_CMDFN_BUF
cmp #'$'
beq unit_sd_cmd_OPEN_dir
beq card_sd_cmd_OPEN_dir
; FALLTROUGH
unit_sd_cmd_OPEN_file:
card_sd_cmd_OPEN_file:
; Copy the filter from command XXX this should be moved to common part and deduplicated with directory opening
@@ -49,7 +49,7 @@ unit_sd_cmd_OPEN_file:
jmp fs_vfs_read_file_open
unit_sd_cmd_OPEN_dir:
card_sd_cmd_OPEN_dir:
lda #$02 ; mode: read directory
sta SD_MODE
@@ -4,7 +4,7 @@
;
unit_sd_cmd_READ:
card_sd_cmd_READ:
lda SD_MODE
cmp #$03
@@ -4,7 +4,7 @@
;
unit_sd_init:
card_sd_init:
; Copy initial status string
@@ -4,7 +4,7 @@
;
unit_fd_cmd_CLOSE:
disk_fd_cmd_CLOSE:
; XXX provide implementation
@@ -6,7 +6,7 @@
; XXX add support for both floppies
unit_disk_cmd_OPEN:
disk_xx_cmd_OPEN:
lda #$01 ; mode: receive command or file name
ldx PAR_FSINSTANCE
@@ -14,7 +14,7 @@ unit_disk_cmd_OPEN:
jmp dos_EXIT_CLC
unit_disk_cmd_OPEN_EOI:
disk_fd_cmd_OPEN_EOI:
; XXX this dispatcher is temporary
@@ -41,11 +41,11 @@ unit_disk_cmd_OPEN_EOI:
lda RD_CMDFN_BUF
cmp #'$'
beq unit_fd_cmd_OPEN_dir ; XXX add support for second floppy and RAM disk
beq disk_fd_cmd_OPEN_dir ; XXX add support for second floppy and RAM disk
; FALLTROUGH
unit_fd_cmd_OPEN_file:
disk_fd_cmd_OPEN_file:
; XXX add support for second floppy and RAM disk
@@ -66,7 +66,7 @@ unit_fd_cmd_OPEN_file:
jmp fs_cbm_read_file_open
unit_fd_cmd_OPEN_dir:
disk_fd_cmd_OPEN_dir:
lda #$02 ; mode: read directory
sta F0_MODE
@@ -4,15 +4,15 @@
;
unit_f0_cmd_READ:
disk_f0_cmd_READ:
; XXX provide implementation
unit_f1_cmd_READ:
disk_f1_cmd_READ:
; XXX provide implementation
unit_fd_cmd_READ:
disk_f__cmd_READ:
lda F0_MODE
cmp #$03
@@ -4,7 +4,7 @@
;
unit_fd_init:
disk_fd_init:
; Copy status string
@@ -3,10 +3,8 @@
; Close currently opened file
;
; XXX to be unified with floppy code
unit_rd_cmd_CLOSE:
disk_rd_cmd_CLOSE:
; XXX provide implementation
@@ -4,7 +4,7 @@
;
unit_rd_init:
disk_rd_init:
; Copy status string
@@ -26,7 +26,7 @@ unit_rd_init:
; FALLTROUGH
unit_rd_init_test_ram: ; non-destructive ATTIC/CELLAR RAM test
disk_rd_init_test_ram: ; non-destructive ATTIC/CELLAR RAM test
; Preserve temporary address area on stack
@@ -7,12 +7,12 @@
!addr __stoptrack = RD_DIR_PHASE ; helper value for detecting too large image
unit_rd_preload:
disk_rd_preload:
; Check if RAM disk is enabled (should be disabled if no Hyper RAM is present)
lda UNIT_RAMDISK
+beq unit_rd_preload_err_common_noclose
+beq disk_rd_preload_err_common_noclose
; Select SD card buffer
@@ -51,13 +51,13 @@ unit_rd_preload:
lda RAM_ATTIC
beq @added_attic
jsr unit_rd_preload_addram
jsr disk_rd_preload_addram
@added_attic:
lda RAM_CELLAR
beq @added_cellar
jsr unit_rd_preload_addram
jsr disk_rd_preload_addram
@added_cellar:
@@ -168,22 +168,22 @@ unit_rd_preload:
@error_wrong_size:
lda #$01
jmp unit_rd_preload_err_common
jmp disk_rd_preload_err_common
@error_too_large:
lda #$02
jmp unit_rd_preload_err_common
jmp disk_rd_preload_err_common
@error_not_found:
lda #$03
sta RD_MSG
jmp unit_rd_preload_err_common_noclose
jmp disk_rd_preload_err_common_noclose
unit_rd_preload_err_common:
disk_rd_preload_err_common:
sta RD_MSG ; set code for startup screen
@@ -191,7 +191,7 @@ unit_rd_preload_err_common:
; FALLTROUGH
unit_rd_preload_err_common_noclose:
disk_rd_preload_err_common_noclose:
lda #$00 ; temporary storage needs to be restored to 0
sta __stoptrack
@@ -201,7 +201,7 @@ unit_rd_preload_err_common_noclose:
unit_rd_preload_addram:
disk_rd_preload_addram:
; Add allowed number of tracks due to attic/cellar block presence
@@ -6,7 +6,7 @@
; XXX to be unified with floppy code
unit_rd_cmd_OPEN_EOI:
disk_rd_cmd_OPEN_EOI:
; XXX provide implementation
@@ -6,7 +6,7 @@
; XXX to be unified with floppy code
unit_rd_cmd_READ:
disk_rd_cmd_READ:
; XXX provide implementation