common DMA list in CBDOS

This commit is contained in:
FeralChild64 committed 2021-03-03 19:04:31 +01:00
1 parent 93bf5afcee
commit 3aa33f76ff
5 files changed
+72 -22

No files matched your search

+8 -1
View File
@@ -109,7 +109,14 @@
!addr FD_STATUS_IDX = $806E ; - floppy
!addr RD_STATUS_IDX = $806F ; - ram disk
!addr SD_DESC = $8070 ; current file descriptor
!addr DMAJOB_LIST = $8070 ; 15 bytes, a general purpose DMA list
!addr DMAJOB_SRC_MB = DMAJOB_LIST+2
!addr DMAJOB_DST_MB = DMAJOB_LIST+4
!addr DMAJOB_SIZE = DMAJOB_LIST+7 ; keep $0200 here
!addr DMAJOB_SRC_ADDR = DMAJOB_LIST+9
!addr DMAJOB_DST_ADDR = DMAJOB_LIST+12
!addr SD_DESC = $807F ; current file descriptor
+11
View File
@@ -0,0 +1,11 @@
dos_dmalist_template:
!byte $0A ; use F018A list format (it is shorter by 1 byte)
!byte $80, $00 ; src. address is $00xxxxx
!byte $81, $00 ; dst. address is $00xxxxx
!byte $00 ; end of options
!byte $00 ; operation: COPY
!word $0200 ; data size if 512 bytes
; 3 bytes of src address + 3 bytes of dst address - not included in template
+11 -21
View File
@@ -109,32 +109,22 @@ fs_hvsr_read_file:
lda #%10000000 ; select SD card buffer
tsb SD_BUFCTL
lda #$02
sta DMA_ADDRBANK ; $D702
lda #$00
sta DMA_ADDRMB ; $D704
; Copy data using DMA job
lda #>(@dmalist-$4000)
sta DMA_ADDRMSB ; $D701
lda #<(@dmalist-$4000)
sta DMA_ETRIG ; $D705
lda #$00
sta DMAJOB_DST_MB
lda #<(SHARED_BUF_0 - $8000)
sta DMAJOB_DST_ADDR+0
lda #>(SHARED_BUF_0 - $8000)
sta DMAJOB_DST_ADDR+1
lda #$01
sta DMAJOB_DST_ADDR+2
jsr util_dma_launch_from_hwbuf ; execute DMA job
clc
rts
@dmalist:
!byte $0A ; use F018A list format (it is shorter by 1 byte)
!byte $80, $FF ; src. address is $FFxxxxx
!byte $81, $00 ; dst. address is $00xxxxx
!byte $00 ; end of options
!byte $00 ; operation: COPY
!word $0200 ; data size if 512 bytes
!byte $00, $6E, $0D ; src. addr is $xxD6E00
!byte <(SHARED_BUF_0 - $8000)
!byte >(SHARED_BUF_0 - $8000)
!byte $01 ; dst. addr is $xx1xxxx (internal buffer)
fs_hvsr_file_not_found:
jsr fs_hvsr_direntmem_restore ; restore $1000 memory content
+9
View File
@@ -45,6 +45,15 @@ dos_INIT:
jsr dev_fd_init
jsr dev_rd_init
; Initialize DMA list
ldy #$08
@2:
lda dos_dmalist_template, y
sta DMAJOB_LIST, y
dey
bpl @2:
; Initialize helper code in RAM
lda #$AD ; LDA opcode, absolute
+33
View File
@@ -0,0 +1,33 @@
; Launch the DMA list
util_dma_launch_from_hwbuf:
; Operation from source $FFD6E00 (hardware SD card / floppy buffer)
; Destination has to be set by the caller
lda #$FF
sta DMAJOB_SRC_MB
lda #$00
sta DMAJOB_SRC_ADDR+0
lda #$6E
sta DMAJOB_SRC_ADDR+1
lda #$0D
sta DMAJOB_SRC_ADDR+2
; FALLTROUGH
util_dma_launch:
lda #$01
sta DMA_ADDRBANK ; $D702
dec
sta DMA_ADDRMB ; $D704
lda #>(DMAJOB_LIST-$8000)
sta DMA_ADDRMSB ; $D701
lda #<(DMAJOB_LIST-$8000)
sta DMA_ETRIG ; $D705
rts