diff --git a/STATUS.md b/STATUS.md index ff3fb37e..b3cff17c 100644 --- a/STATUS.md +++ b/STATUS.md @@ -70,7 +70,7 @@ The following ROM features are currently missing: | :----------------: | :------: | :------------------------------------------------: | | VIC-II | DONE | | | 80 columns, VDC | NOT DONE | | -| 80 columns, Mega65 | PARTIAL | work-in-progreess, not useable yet | +| 80 columns, Mega65 | PARTIAL | work-in-progress |
diff --git a/src/aliases/,aliases_ram_lowmem_m65.s b/src/aliases/,aliases_ram_lowmem_m65.s index 07316987..423bfd7f 100644 --- a/src/aliases/,aliases_ram_lowmem_m65.s +++ b/src/aliases/,aliases_ram_lowmem_m65.s @@ -52,6 +52,24 @@ .label M65_TXTWIN_X1 = $590 // text window - bottom-right X coordinate + 1 .label M65_TXTWIN_Y1 = $591 // text window - bottom-right Y coordinate + 1 .label M65_TXTROW_OFF = $592 // $592-$593 offset to the current text row - // $594-$5FF -- UNUSED -- + // $594-$5EB -- UNUSED -- + .label M65_DMAGIC_LIST = $5EF // $5EF-$5FF reserved for DMAgic list, 17 bytes .label M65_RS232_INBUF = $600 // $600-$6FF -- reserved for RS-232 input buffer -- .label M65_RS232_OUTBUF = $700 // $700-$7FF -- reserved for RS-232 output buffer -- + + // + // Addresses for configuring the DMA job + // + + .label M65_DMAJOB_SIZE_0 = M65_DMAGIC_LIST + 7 + .label M65_DMAJOB_SIZE_1 = M65_DMAGIC_LIST + 8 + + .label M65_DMAJOB_SRC_0 = M65_DMAGIC_LIST + 10 + .label M65_DMAJOB_SRC_1 = M65_DMAGIC_LIST + 11 + .label M65_DMAJOB_SRC_2 = M65_DMAGIC_LIST + 9 + .label M65_DMAJOB_SRC_3 = M65_DMAGIC_LIST + 2 + + .label M65_DMAJOB_DST_0 = M65_DMAGIC_LIST + 13 + .label M65_DMAJOB_DST_1 = M65_DMAGIC_LIST + 14 + .label M65_DMAJOB_DST_2 = M65_DMAGIC_LIST + 12 + .label M65_DMAJOB_DST_3 = M65_DMAGIC_LIST + 4 diff --git a/src/kernal/board_m65/mega65_dmagic.s b/src/kernal/board_m65/mega65_dmagic.s new file mode 100644 index 00000000..8dbd7dbf --- /dev/null +++ b/src/kernal/board_m65/mega65_dmagic.s @@ -0,0 +1,63 @@ +// #LAYOUT# M65 KERNAL_0 #TAKE +// #LAYOUT# * * #IGNORE + +// Helper routines for DMAgic usage + +// See: +// - https://c65gs.blogspot.com/2019/03/auto-detecting-required-revision-of.html +// - https://c65gs.blogspot.com/2018/01/improving-dmagic-controller-interface.html + + +// XXX: finish the implementation, use in screen editor + + +m65_dmagic_oper_copy: + + // To configure parameters, use: + // - M65_DMAJOB_SIZE_* + // - M65_DMAJOB_SRC_* + // - M65_DMAJOB_DST_* + + lda #$00 + sta M65_DMAGIC_LIST+6 // operation: copy + + jmp_8 m65_dmagic_common + +m65_dmagic_oper_fill: + + // XXX provide implementation + + // FALLTROUGH + +m65_dmagic_common: + + lda #$0A + sta M65_DMAGIC_LIST+0 // <- $0A = use F018A list format (it is shorter by 1 byte) + lda #$80 + sta M65_DMAGIC_LIST+1 // <- $80 = next byte is highest 8 bits of source address + inc_a + sta M65_DMAGIC_LIST+3 // <- $80 = next byte is highest 8 bits of destination address + + lda #$00 + sta M65_DMAGIC_LIST+5 // <- end of options + + sta M65_DMAGIC_LIST+15 // <- set modulo to 0 + sta M65_DMAGIC_LIST+16 + + // FALLTROUGH + +m65_dmagic_launch: + + // Launch the DMA list + + lda #$00 + sta DMA_ADDRBANK // $D702 + sta DMA_ADDRMB // $D704 + + lda #>M65_DMAGIC_LIST + sta DMA_ADDRMSB // $D701 + + lda #