initial (very primitive) general sector caching

This commit is contained in:
FeralChild64 committed 2021-03-08 21:47:51 +01:00
1 parent df89e62761
commit 062c73a809
3 files changed
+48 -27

No files matched your search

+20 -6
View File
@@ -39,20 +39,28 @@ dos_INIT:
sta IDX1_TALKER sta IDX1_TALKER
sta IDX2_TALKER sta IDX2_TALKER
; Initialize device handlers ; Initialize buffer metadata
jsr unit_sd_init lda #$0
jsr unit_fd_init ldx #17
jsr unit_rd_init @2:
sta BUFTAB_TRACK, x
dec
sta BUFTAB_UNIT, x
sta BUFTAB_DEV, x
sta BUFTAB_SECTOR, x
inc
dex
bpl @2
; Initialize DMA list ; Initialize DMA list
ldy #$08 ldy #$08
@2: @3:
lda dos_dmalist_template, y lda dos_dmalist_template, y
sta DMAJOB_LIST, y sta DMAJOB_LIST, y
dey dey
bpl @2: bpl @3:
; Initialize helper code in RAM ; Initialize helper code in RAM
@@ -70,6 +78,12 @@ dos_INIT:
sta code_RTS_03 sta code_RTS_03
sta code_RTS_04 sta code_RTS_04
; Initialize device handlers
jsr unit_sd_init
jsr unit_fd_init
jsr unit_rd_init
; Safer version of 'dos_EXIT' - does not affect speed related registers ; Safer version of 'dos_EXIT' - does not affect speed related registers
clc clc
@@ -78,7 +78,7 @@ fs_cbm_nextdirentry:
clc clc
rts rts
@get_sector_lo: @get_sector_lo: ; processing the 1st half of the buffer finished
; Check if this was the last sector ; Check if this was the last sector
@@ -88,31 +88,16 @@ fs_cbm_nextdirentry:
cmp #$FF cmp #$FF
beq @end_of_dir beq @end_of_dir
; Transition from 1st half of the buffer, to (possibly) the second one ; Load the next sector
lda SHARED_BUF_1+0
cmp BUFTAB_TRACK+1
bne @get_sector_lo_next
lda SHARED_BUF_1+1
dec
cmp BUFTAB_SECTOR+1
bne @get_sector_lo_next
; It's OK, we can transition to the upper half of the buffer
lda FD_DIRENT
jmp @cont
@get_sector_lo_next:
lda SHARED_BUF_1+0 lda SHARED_BUF_1+0
sta PAR_TRACK sta PAR_TRACK
lda SHARED_BUF_1+1 lda SHARED_BUF_1+1
sta PAR_SECTOR sta PAR_SECTOR
bra @get_sector_common bra @get_sector_common
@get_sector_hi: @get_sector_hi: ; processing the 2nd half of the buffer finished
; Check if this was the last sector ; Check if this was the last sector
@@ -122,7 +107,7 @@ fs_cbm_nextdirentry:
cmp #$FF cmp #$FF
beq @end_of_dir beq @end_of_dir
; Load new sector ; Load the next sector
lda SHARED_BUF_1+$100+0 lda SHARED_BUF_1+$100+0
sta PAR_TRACK sta PAR_TRACK
+23 -1
View File
@@ -1,9 +1,31 @@
; Read a single sector from a block device ; Read a sector pair from a block device
lowlevel_readsector: lowlevel_readsector:
; XXX compare device and unit too
; Check if buffer contains data from given track
lda PAR_TRACK
cmp BUFTAB_TRACK+1
bne lowlevel_readsector_force
; Check if sectors match
lda PAR_SECTOR
and #%11111110
cmp BUFTAB_SECTOR+1
bne lowlevel_readsector_force
; Data already loaded into buffer - do nothing
clc
rts
lowlevel_readsector_force:
; Select FDD sector as buffer ; Select FDD sector as buffer
lda #%10000000 ; select floppy buffer lda #%10000000 ; select floppy buffer