diff --git a/src/aliases/,aliases_ram_over64K_m65.s b/src/aliases/,aliases_ram_over64K_m65.s index f26d15a7..0c49297d 100644 --- a/src/aliases/,aliases_ram_over64K_m65.s +++ b/src/aliases/,aliases_ram_over64K_m65.s @@ -6,6 +6,9 @@ // $10000-$17FFF (32KB) - reserved for DOS // $18000-$18FFF (4KB) - chargen copied to RAM, to allow character redefinition + +.const MEMCONF_CHRBASE = $8000 + // $19000-$1B7FF (10KB) - reserved for virtual text screen, 80x128 .const MEMCONF_SCRBASE = $9000 diff --git a/src/kernal/board_m65/mega65_dmagic.s b/src/kernal/board_m65/mega65_dmagic.s index 29268033..22cb5ad8 100644 --- a/src/kernal/board_m65/mega65_dmagic.s +++ b/src/kernal/board_m65/mega65_dmagic.s @@ -25,10 +25,10 @@ m65_dmagic_oper_fill: lda #($03 + $08) // operation: FILL + allow interrupts sta M65_DMAGIC_LIST+6 - // Adapt the addresses, go to common part + // Adapt the addresses, launch the job jsr m65_dmagic_adapt_dst - jmp_8 m65_dmagic_common + jmp_8 m65_dmagic_launch m65_dmagic_oper_copy: @@ -43,7 +43,7 @@ m65_dmagic_oper_copy: lda #($00 + $08) // operation: COPY + allow interrupts sta M65_DMAGIC_LIST+6 - // Adapt the addresses, go to common part + // Adapt the addresses, launch the job jsr m65_dmagic_adapt_src jsr m65_dmagic_adapt_dst @@ -53,26 +53,6 @@ m65_dmagic_oper_copy: // FALLTROUGH -m65_dmagic_common: - - // Set remaining job parameters - // XXX this should be done during switching to MEGA65 native mode - - 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 // <- $81 = 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 @@ -137,3 +117,23 @@ m65_dmagic_adapt_dst: sta M65_DMAJOB_DST_2 rts + + +m65_dmagic_init: + + // Set common job parameters + + 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 // <- $81 = 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 + + rts diff --git a/src/kernal/board_m65/mega65_native_meminit.s b/src/kernal/board_m65/mega65_native_meminit.s new file mode 100644 index 00000000..b7ef61dc --- /dev/null +++ b/src/kernal/board_m65/mega65_native_meminit.s @@ -0,0 +1,42 @@ +// #LAYOUT# M65 KERNAL_1 #TAKE +// #LAYOUT# * * #IGNORE + + +m65_native_meminit: + + // Prepare generic DMAgic list + + jsr m65_dmagic_init + + // Copy MEGA65 charset to target location - set size + + lda #$00 + sta M65_DMAJOB_SIZE_0 + lda #$10 + sta M65_DMAJOB_SIZE_1 + + // Set destination + + lda #$00 + sta M65_DMAJOB_DST_3 + lda #$01 + sta M65_DMAJOB_DST_2 + lda #>MEMCONF_CHRBASE + sta M65_DMAJOB_DST_1 + lda #MEMCONF_CHRBASE + sta VIC_CHARPTR+1 + lda #$01 + sta VIC_CHARPTR+2 + // Set the following locations: // - M65_SCRGUARD, M65_COLGUARD - guards for virtual screen end // - M65_COLVIEWMAX - guard for viewport start