diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 752a452e..ebf44ae2 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -112,9 +112,9 @@ #if ROM_LAYOUT_M65 && !CONFIG_CPU_M65_45GS02 .error "Mega65 ROM layout requires CONFIG_CPU_M65_45GS02" #endif -//#if ROM_LAYOUT_M65 && !CONFIG_MB_MEGA_65 -// .error "Mega65 ROM layout requires CONFIG_MB_MEGA_65" -//#endif +#if ROM_LAYOUT_M65 && !CONFIG_MB_MEGA_65 + .error "Mega65 ROM layout requires CONFIG_MB_MEGA_65" +#endif .var selected = 0; diff --git a/c64/aliases/,aliases_hardware.s b/c64/aliases/,aliases_hardware.s index f03458c9..bdd0f5e5 100644 --- a/c64/aliases/,aliases_hardware.s +++ b/c64/aliases/,aliases_hardware.s @@ -186,6 +186,8 @@ .const C65_EXTKEYS_PR = $D607 .const C65_EXTKEYS_DDR = $D608 + .const M65_BADL_SLI = $D710 + #endif diff --git a/c64/kernal/assets/kernal_messages.s b/c64/kernal/assets/kernal_messages.s index 6825712f..3c876dc9 100644 --- a/c64/kernal/assets/kernal_messages.s +++ b/c64/kernal/assets/kernal_messages.s @@ -84,8 +84,10 @@ __msg_kernalfound: #if CONFIG_MB_MEGA_65 __msg_kernaloksearching: - .text "OK, SEARCHING" - .byte $80 + $0D // end of string mark + return + .text "OK" + .byte $0D, $0D + .text "SEARCHIN" + .byte $80 + $47 // end of string mark + 'G' #endif diff --git a/c64/kernal/board_m65/mega65_imports.s b/c64/kernal/board_m65/mega65_imports.s index cd63f523..e09cabb0 100644 --- a/c64/kernal/board_m65/mega65_imports.s +++ b/c64/kernal/board_m65/mega65_imports.s @@ -25,8 +25,7 @@ #if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO -.label screen_on = KERNAL_0.screen_on -.label screen_off = KERNAL_0.screen_off +.label mega65_unhide = KERNAL_0.mega65_unhide .label tape_motor_on = KERNAL_0.tape_motor_on .label tape_motor_off = KERNAL_0.tape_motor_off diff --git a/c64/kernal/board_m65/mega65_unhide.s b/c64/kernal/board_m65/mega65_unhide.s new file mode 100644 index 00000000..3fa9b1c9 --- /dev/null +++ b/c64/kernal/board_m65/mega65_unhide.s @@ -0,0 +1,24 @@ +// #LAYOUT# STD * #TAKE +// #LAYOUT# X16 * #IGNORE +// #LAYOUT# * KERNAL_0 #TAKE +// #LAYOUT# * * #IGNORE + +// +// Routine to unhide Mega65 extra registers +// + + +#if CONFIG_KEYBOARD_C65 || (CONFIG_MB_MEGA_65 && (CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO)) + + +mega65_unhide: + + lda #$A5 + sta VIC_KEY + lda #$96 + sta VIC_KEY + + rts + + +#endif diff --git a/c64/kernal/init/fda3.ioinit.s b/c64/kernal/init/fda3.ioinit.s index b5cfc31d..9e67a661 100644 --- a/c64/kernal/init/fda3.ioinit.s +++ b/c64/kernal/init/fda3.ioinit.s @@ -61,7 +61,7 @@ IOINIT: lda #$00 -#if !CONFIG_MB_MEGA65 +#if !CONFIG_MB_MEGA_65 // First the standard chip (skip if it is covered by whole $D4XX range) @@ -111,7 +111,7 @@ IOINIT: sta SID_SIGVOL + __SID_L1_OFFSET sta SID_SIGVOL + __SID_L2_OFFSET -#endif // CONFIG_MB_MEGA65 +#endif // CONFIG_MB_MEGA_65 // // Now continue the CIAs initialization diff --git a/c64/kernal/keyboard/scnkey.s b/c64/kernal/keyboard/scnkey.s index 12161598..ae1421ff 100644 --- a/c64/kernal/keyboard/scnkey.s +++ b/c64/kernal/keyboard/scnkey.s @@ -48,14 +48,10 @@ SCNKEY: // mode when done. This is not ideal, but as MEGA65s start C65 mode with VIC-IV IO mode // selected anyway, it should not be a big problem in practice. - lda #$A5 - sta VIC_KEY - lda #$96 - sta VIC_KEY - + jsr mega65_unhide jsr scnkey_viciv_mode - sta VIC_KEY + sta VIC_KEY // hide Mega65 registers rts scnkey_viciv_mode: diff --git a/c64/kernal/screen/screen_off.s b/c64/kernal/screen/screen_off.s index f7ef6d62..133127a3 100644 --- a/c64/kernal/screen/screen_off.s +++ b/c64/kernal/screen/screen_off.s @@ -8,7 +8,7 @@ // -#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO || (CONFIG_IEC_JIFFYDOS && !CONFIG_MEMORY_MODEL_60K) +#if ((CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO) && !CONFIG_MB_MEGA_65) || (CONFIG_IEC_JIFFYDOS && !CONFIG_MEMORY_MODEL_60K) screen_off: diff --git a/c64/kernal/screen/screen_on.s b/c64/kernal/screen/screen_on.s index 6d49d4a4..22853c22 100644 --- a/c64/kernal/screen/screen_on.s +++ b/c64/kernal/screen/screen_on.s @@ -8,7 +8,7 @@ // -#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO +#if (CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO) && !CONFIG_MB_MEGA_65 screen_on: @@ -19,4 +19,5 @@ screen_on: rts + #endif diff --git a/c64/kernal/tape/tape_common_autodetect.s b/c64/kernal/tape/tape_common_autodetect.s index 07f60842..bad0c45e 100644 --- a/c64/kernal/tape/tape_common_autodetect.s +++ b/c64/kernal/tape/tape_common_autodetect.s @@ -17,7 +17,7 @@ tape_common_autodetect: lda #$0B sta VIC_EXTCOL lda #$00 -#if CONFIG_MB_MEGA65 +#if CONFIG_MB_MEGA_65 sta SID_SIGVOL + __SID_R1_OFFSET sta SID_SIGVOL + __SID_L1_OFFSET #else diff --git a/c64/kernal/tape/tape_common_clean_sid.s b/c64/kernal/tape/tape_common_clean_sid.s index f91b8c6e..41083007 100644 --- a/c64/kernal/tape/tape_common_clean_sid.s +++ b/c64/kernal/tape/tape_common_clean_sid.s @@ -16,7 +16,7 @@ tape_clean_sid: ldy #$1C !: -#if CONFIG_MB_MEGA65 +#if CONFIG_MB_MEGA_65 // It should be safer than cleaning whole $D400-D47C range diff --git a/c64/kernal/tape/tape_common_screen.s b/c64/kernal/tape/tape_common_screen.s index 2d0ef177..19264dee 100644 --- a/c64/kernal/tape/tape_common_screen.s +++ b/c64/kernal/tape/tape_common_screen.s @@ -21,8 +21,23 @@ tape_screen_on_motor_off: lda COLSTORE sta VIC_EXTCOL +#if !CONFIG_MB_MEGA_65 + jmp screen_on +#else + + // On Mega65 just reenable badline emulation + + lda #$FF + sta M65_BADL_SLI + sta VIC_KEY + + rts + +#endif + + tape_screen_off_motor_on: // We do not want interrupts and CHROUT reenables them @@ -36,7 +51,22 @@ tape_screen_off_motor_on: lda VIC_EXTCOL sta COLSTORE +#if !CONFIG_MB_MEGA_65 + jsr screen_off + +#else + + // On Mega65 we do not have to turn the screen off; + // it is enough to disable badline emulation + + jsr mega65_unhide + lda #$00 + sta M65_BADL_SLI + +#endif + + jmp tape_motor_on #endif diff --git a/c64/kernal/tape/tape_turbo_get_bit.s b/c64/kernal/tape/tape_turbo_get_bit.s index f2718cff..d2cf4f6a 100644 --- a/c64/kernal/tape/tape_turbo_get_bit.s +++ b/c64/kernal/tape/tape_turbo_get_bit.s @@ -23,7 +23,7 @@ tape_turbo_get_bit: sta __turbo_half_S // store half of the last measurement result for short pulse lda #$01 -#if CONFIG_MB_MEGA65 +#if CONFIG_MB_MEGA_65 sta SID_SIGVOL + __SID_R1_OFFSET sta SID_SIGVOL + __SID_L1_OFFSET #else @@ -39,7 +39,7 @@ tape_turbo_get_bit: sta __turbo_half_L // store half of the last measurement result for long pulse lda #$00 -#if CONFIG_MB_MEGA65 +#if CONFIG_MB_MEGA_65 sta SID_SIGVOL + __SID_R1_OFFSET sta SID_SIGVOL + __SID_L1_OFFSET #else