more DMAgic work

This commit is contained in:
FeralChild64 committed 2020-08-30 23:01:57 +02:00
1 parent 9f98c476c8
commit d081ea4ffc
2 files changed
+85 -50

No files matched your search

+85 -48
View File
@@ -1,4 +1,4 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
// Helper routines for DMAgic usage
@@ -11,68 +11,55 @@
// XXX: finish the implementation, use in screen editor
m65_dmagic_oper_copy:
m65_dmagic_oper_fill:
// To configure parameters, use:
// To configure job parameters, use:
// - M65_DMAJOB_SIZE_*
// - M65_DMAJOB_SRC_*
// - M65_DMAJOB_DST_*
// - M65_DMAJOB_DST_*
// - .A - byte for filling
// Afterwards, consider M65_DMAJOB_*_2 and M65_DMAJOB_*_3 destroyed.
lda #$00
sta M65_DMAGIC_LIST+6 // operation: copy
// Set fill address
sta M65_DMAJOB_SRC_0
// We need to correct the addresses:
// - M65_DMAJOB_SRC_2, M65_DMAJOB_DST_2 - contain bits 16-23, should contain 16-19
// - M65_DMAJOB_SRC_3, M65_DMAJOB_DST_3 - contain bits 24-27, should contain 20-27
// Set operation type
// Correct SRC address
lda #$03 // operation: FILL
sta M65_DMAGIC_LIST+6
lda M65_DMAJOB_SRC_2
pha
asl
ror M65_DMAJOB_SRC_3
asl
ror M65_DMAJOB_SRC_3
asl
ror M65_DMAJOB_SRC_3
asl
ror M65_DMAJOB_SRC_3
pla
and %00001111
sta M65_DMAJOB_SRC_2
// Correct DST address
lda M65_DMAJOB_DST_2
pha
asl
ror M65_DMAJOB_DST_3
asl
ror M65_DMAJOB_DST_3
asl
ror M65_DMAJOB_DST_3
asl
ror M65_DMAJOB_DST_3
pla
and %00001111
sta M65_DMAJOB_DST_2
// Jump to common part
// Go to common part
jmp_8 m65_dmagic_common
m65_dmagic_oper_fill:
m65_dmagic_oper_copy:
// XXX provide implementation
// To configure job parameters, use:
// - M65_DMAJOB_SIZE_*
// - M65_DMAJOB_SRC_*
// - M65_DMAJOB_DST_*
// Afterwards, consider M65_DMAJOB_DST_2 and M65_DMAJOB_DST_3 destroyed.
// Set operation type
lda #$00 // operation: COPY
sta M65_DMAGIC_LIST+6
// Adapt the source addresses, go to common part
jsr m65_dmagic_adapt_src
// FALLTROUGH
m65_dmagic_common:
// Adapt destination addresses - this is always needed
// XXX consider inlining this here
jsr m65_dmagic_adapt_dst
// Set remaining job parameters
lda #$0A
sta M65_DMAGIC_LIST+0 // <- $0A = use F018A list format (it is shorter by 1 byte)
lda #$80
@@ -102,3 +89,53 @@ m65_dmagic_launch:
sta DMA_ETRIG // $D705
rts
m65_dmagic_adapt_src:
// We need to adapt the addresses:
// - M65_DMAJOB_SRC_2 - contain bits 16-23, should contain 16-19
// - M65_DMAJOB_SRC_3 - contain bits 24-27, should contain 20-27
lda M65_DMAJOB_SRC_2
pha
asl
ror M65_DMAJOB_SRC_3
asl
ror M65_DMAJOB_SRC_3
asl
ror M65_DMAJOB_SRC_3
asl
ror M65_DMAJOB_SRC_3
pla
and %00001111
sta M65_DMAJOB_SRC_2
rts
m65_dmagic_adapt_dst:
// We need to adapt the addresses:
// - M65_DMAJOB_DST_2 - contain bits 16-23, should contain 16-19
// - M65_DMAJOB_DST_3 - contain bits 24-27, should contain 20-27
lda M65_DMAJOB_DST_2
pha
asl
ror M65_DMAJOB_DST_3
asl
ror M65_DMAJOB_DST_3
asl
ror M65_DMAJOB_DST_3
asl
ror M65_DMAJOB_DST_3
pla
and %00001111
sta M65_DMAJOB_DST_2
rts
-2
View File
@@ -38,8 +38,6 @@
.label viciv_unhide = KERNAL_0.viciv_unhide
.label viciv_init = KERNAL_0.viciv_init
.label viciv_shutdown = KERNAL_0.viciv_shutdown
.label m65_dmagic_oper_copy = KERNAL_0.m65_dmagic_oper_copy
.label m65_dmagic_oper_fill = KERNAL_0.m65_dmagic_oper_fill
.label m65_scrtab_txtwidth = KERNAL_0.m65_scrtab_txtwidth
.label m65_scrtab_txtheight = KERNAL_0.m65_scrtab_txtheight