file loading from floppy image should be complete, but not yet tested
This commit is contained in:
1 parent
0011b3eacf
commit
9eb00c675d
2 files changed
+107
-11
No files matched your search
@@ -49,7 +49,14 @@ fs_cbm_nextdirentry:
|
||||
; XXX most likely copying is not necessary (compare all CBM and CMD filesystems) -
|
||||
; XXX just make the hypervisor file system emulate these structures
|
||||
|
||||
ldy #$02 ; start from determining file type
|
||||
ldy #$00 ; start from getting track and sector of file beginning
|
||||
jsr code_LDA_nnnn_Y
|
||||
sta FD_LOADTRACK
|
||||
iny
|
||||
jsr code_LDA_nnnn_Y
|
||||
sta FD_LOADSECTOR
|
||||
|
||||
iny ; determining file type
|
||||
jsr code_LDA_nnnn_Y
|
||||
beq fs_cbm_nextdirentry ; ignore deleted files (but allow DEL files in some cases)
|
||||
|
||||
|
||||
@@ -48,19 +48,108 @@ fs_cbm_read_file_open:
|
||||
jsr util_dir_filter
|
||||
bne @lp_find ; if does not match, try the next entry
|
||||
|
||||
; Found the file - load it, start from fetching initial track/sector
|
||||
; Found the file, load it
|
||||
|
||||
inc $D020
|
||||
lda FD_LOADTRACK
|
||||
sta PAR_TRACK
|
||||
lda FD_LOADSECTOR
|
||||
sta PAR_SECTOR
|
||||
|
||||
|
||||
|
||||
|
||||
; XXX provide implementation, use FD_LOADTRACK and FD_LOADSECTOR
|
||||
|
||||
jmp dos_EXIT_SEC
|
||||
bra fs_cbm_read_file_got_ts
|
||||
|
||||
fs_cbm_read_file:
|
||||
|
||||
; XXX provide implementation
|
||||
; Fetch the next track/sector
|
||||
|
||||
jmp dos_EXIT_SEC
|
||||
lda FD_LOADSECTOR
|
||||
and #$01
|
||||
bne @part_2
|
||||
|
||||
@part_1:
|
||||
|
||||
; We were reading from the 1st half of the buffer
|
||||
|
||||
lda SHARED_BUF_1+1
|
||||
sta PAR_SECTOR
|
||||
lda SHARED_BUF_1+0
|
||||
bra @common_chk
|
||||
|
||||
@part_2:
|
||||
|
||||
; We were reading from the 2nd half of the buffer
|
||||
|
||||
lda SHARED_BUF_1+$100+1
|
||||
sta PAR_SECTOR
|
||||
lda SHARED_BUF_1+$100+0
|
||||
|
||||
@common_chk:
|
||||
|
||||
bne @common_load
|
||||
|
||||
lda #$00 ; end of file
|
||||
sec
|
||||
rts
|
||||
|
||||
@common_load:
|
||||
|
||||
sta PAR_TRACK
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
fs_cbm_read_file_got_ts:
|
||||
|
||||
; Load next track/sector
|
||||
|
||||
jsr lowlevel_readsector ; XXX handle read errors
|
||||
|
||||
; Store pointer and amount of data ready to fetch
|
||||
|
||||
lda #$FE
|
||||
sta FD_ACPTR_LEN+0
|
||||
lda #$00
|
||||
sta FD_ACPTR_LEN+1
|
||||
|
||||
lda #$02
|
||||
sta FD_ACPTR_PTR+0
|
||||
lda #>SHARED_BUF_1
|
||||
sta FD_ACPTR_PTR+1
|
||||
|
||||
lda PAR_SECTOR
|
||||
and #$01
|
||||
bne @part_2
|
||||
|
||||
@part_1:
|
||||
|
||||
; Sector with data is located in the 1st half of the buffer
|
||||
|
||||
lda SHARED_BUF_1+0
|
||||
beq @exit
|
||||
|
||||
; Less than a full sector is used
|
||||
|
||||
lda SHARED_BUF_1+1
|
||||
bra @not_full_buf
|
||||
|
||||
@part_2:
|
||||
|
||||
; Sector with data is located in the 2nd half of the buffer
|
||||
|
||||
inc FD_ACPTR_PTR+1
|
||||
|
||||
lda SHARED_BUF_1+$100+0
|
||||
beq @exit
|
||||
|
||||
; Less than a full sector is used
|
||||
|
||||
lda SHARED_BUF_1+$100+0
|
||||
|
||||
@not_full_buf:
|
||||
|
||||
sta FD_ACPTR_LEN+0
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
@exit:
|
||||
|
||||
clc
|
||||
rts
|
||||
Reference in new issue
Block a user