initial (very primitive) general sector caching
This commit is contained in:
1 parent
df89e62761
commit
062c73a809
3 files changed
+49
-28
No files matched your search
+20
-6
@@ -39,20 +39,28 @@ dos_INIT:
|
||||
sta IDX1_TALKER
|
||||
sta IDX2_TALKER
|
||||
|
||||
; Initialize device handlers
|
||||
; Initialize buffer metadata
|
||||
|
||||
jsr unit_sd_init
|
||||
jsr unit_fd_init
|
||||
jsr unit_rd_init
|
||||
lda #$0
|
||||
ldx #17
|
||||
@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
|
||||
|
||||
ldy #$08
|
||||
@2:
|
||||
@3:
|
||||
lda dos_dmalist_template, y
|
||||
sta DMAJOB_LIST, y
|
||||
dey
|
||||
bpl @2:
|
||||
bpl @3:
|
||||
|
||||
; Initialize helper code in RAM
|
||||
|
||||
@@ -70,6 +78,12 @@ dos_INIT:
|
||||
sta code_RTS_03
|
||||
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
|
||||
|
||||
clc
|
||||
|
||||
@@ -78,7 +78,7 @@ fs_cbm_nextdirentry:
|
||||
clc
|
||||
rts
|
||||
|
||||
@get_sector_lo:
|
||||
@get_sector_lo: ; processing the 1st half of the buffer finished
|
||||
|
||||
; Check if this was the last sector
|
||||
|
||||
@@ -88,31 +88,16 @@ fs_cbm_nextdirentry:
|
||||
cmp #$FF
|
||||
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
|
||||
sta PAR_TRACK
|
||||
sta PAR_TRACK
|
||||
lda SHARED_BUF_1+1
|
||||
sta PAR_SECTOR
|
||||
|
||||
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
|
||||
|
||||
@@ -122,7 +107,7 @@ fs_cbm_nextdirentry:
|
||||
cmp #$FF
|
||||
beq @end_of_dir
|
||||
|
||||
; Load new sector
|
||||
; Load the next sector
|
||||
|
||||
lda SHARED_BUF_1+$100+0
|
||||
sta PAR_TRACK
|
||||
|
||||
@@ -1,9 +1,31 @@
|
||||
|
||||
; Read a single sector from a block device
|
||||
; Read a sector pair from a block device
|
||||
|
||||
|
||||
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
|
||||
|
||||
lda #%10000000 ; select floppy buffer
|
||||
|
||||
Reference in new issue
Block a user