various cleanups

This commit is contained in:
FeralChild64 committed 2020-08-31 19:39:12 +02:00
1 parent 7582913021
commit 1d4c953cee
26 files changed
+125 -123

No files matched your search

+1 -1
View File
@@ -70,7 +70,7 @@ The following ROM features are currently missing:
| :----------------: | :------: | :------------------------------------------------: | | :----------------: | :------: | :------------------------------------------------: |
| VIC-II | DONE | | | VIC-II | DONE | |
| 80 columns, VDC | NOT DONE | | | 80 columns, VDC | NOT DONE | |
| 80 columns, Mega65 | PARTIAL | work-in-progress | | 80 columns, Mega65 | PARTIAL | no windowing mode and C65/M65 extra keys support |
<br /> <br />
+2 -3
View File
@@ -55,9 +55,8 @@
.label SELDEV = KERNAL().SELDEV .label SELDEV = KERNAL().SELDEV
#if ROM_LAYOUT_M65 #if ROM_LAYOUT_M65
.label M65_MODE64 = KERNAL().M65_MODE64 .label M65_MODEGET = KERNAL().M65_MODEGET
.label M65_MODE65 = KERNAL().M65_MODE65 .label M65_MODESET = KERNAL().M65_MODESET
.label M65_ISMODE65 = KERNAL().M65_ISMODE65
.label M65_SLOW = KERNAL().M65_SLOW .label M65_SLOW = KERNAL().M65_SLOW
.label M65_FAST = KERNAL().M65_FAST .label M65_FAST = KERNAL().M65_FAST
.label M65_SETWIN_Y = KERNAL().M65_SETWIN_Y .label M65_SETWIN_Y = KERNAL().M65_SETWIN_Y
+5 -4
View File
@@ -31,12 +31,13 @@ cmd_go_syntax_error:
// If in native mode - switch to C64 compatibilty // If in native mode - switch to C64 compatibilty
jsr M65_ISMODE65 jsr M65_MODEGET
bcs cmd_go_rts bcs cmd_go_rts
jsr helper_ask_if_sure jsr helper_ask_if_sure
bcs cmd_go_rts bcs cmd_go_rts
jsr M65_MODE64 sec
jsr M65_MODESET // Carry set = switch to C64 mode
jmp_8 cmd_go_switchmode_clr_banner jmp_8 cmd_go_switchmode_clr_banner
!: !:
cmp #65 cmp #65
@@ -44,12 +45,12 @@ cmd_go_syntax_error:
// If in C64 compatibility mode - switch to native mode // If in C64 compatibility mode - switch to native mode
jsr M65_ISMODE65 jsr M65_MODEGET
bcc cmd_go_rts bcc cmd_go_rts
jsr helper_ask_if_sure jsr helper_ask_if_sure
bcs cmd_go_rts bcs cmd_go_rts
jsr M65_MODE65 jsr M65_MODESET // Carry clear = switch to M65 mode
// FALLTROUGH // FALLTROUGH
+3 -2
View File
@@ -26,9 +26,10 @@ cmd_sys:
// Make sure we are in C64 compatibility mode // Make sure we are in C64 compatibility mode
jsr M65_ISMODE65 jsr M65_MODEGET
bcs cmd_sys_nsys_common bcs cmd_sys_nsys_common
jsr M65_MODE64 sec
jsr M65_MODESET // set legacy C64 compatibility mode
// FALLTROUGH // FALLTROUGH
+2 -2
View File
@@ -21,7 +21,7 @@ cmd_sysinfo:
ldx #IDX__STR_SI_HEADER ldx #IDX__STR_SI_HEADER
jsr print_packed_misc_str jsr print_packed_misc_str
jsr M65_ISMODE65 jsr M65_MODEGET
bcc !+ bcc !+
ldx #IDX__STR_SI_MODE64 ldx #IDX__STR_SI_MODE64
@@ -39,7 +39,7 @@ cmd_sysinfo:
jsr print_return jsr print_return
jsr M65_ISMODE65 jsr M65_MODEGET
bcs print_sysinfo_video bcs print_sysinfo_video
jsr print_return jsr print_return
+1 -1
View File
@@ -26,7 +26,7 @@
.label JREADST = KERNAL_0.JREADST .label JREADST = KERNAL_0.JREADST
.label JSCREEN = KERNAL_0.JSCREEN .label JSCREEN = KERNAL_0.JSCREEN
.label SELDEV = KERNAL_0.SELDEV .label SELDEV = KERNAL_0.SELDEV
.label M65_ISMODE65 = KERNAL_0.M65_ISMODE65 .label M65_MODEGET = KERNAL_0.M65_MODEGET
.label M65_SETWIN_XY = KERNAL_0.M65_SETWIN_XY .label M65_SETWIN_XY = KERNAL_0.M65_SETWIN_XY
.label M65_SETWIN_WH = KERNAL_0.M65_SETWIN_WH .label M65_SETWIN_WH = KERNAL_0.M65_SETWIN_WH
.label M65_SETWIN_Y = BASIC_0.proxy_B1_M65_SETWIN_Y .label M65_SETWIN_Y = BASIC_0.proxy_B1_M65_SETWIN_Y
+2 -2
View File
@@ -22,10 +22,10 @@ INITMSG:
// Display additional information, depending on the mode // Display additional information, depending on the mode
jsr M65_ISMODE65 jsr M65_MODEGET
bcc !+ bcc !+
// Legacy mode // Legacy C64 compatibility mode
ldx #$02 ldx #$02
ldy #$21 ldy #$21
@@ -13,20 +13,19 @@
.label VK1__IOINIT = $4000 + 2 * 0 .label VK1__IOINIT = $4000 + 2 * 0
.label VK1__RAMTAS = $4000 + 2 * 1 .label VK1__RAMTAS = $4000 + 2 * 1
.label VK1__setup_vicii = $4000 + 2 * 2 .label VK1__vicii_init = $4000 + 2 * 2
.label VK1__load_tape_normal = $4000 + 2 * 3 .label VK1__load_tape_normal = $4000 + 2 * 3
.label VK1__load_tape_turbo = $4000 + 2 * 4 .label VK1__load_tape_turbo = $4000 + 2 * 4
.label VK1__load_tape_auto = $4000 + 2 * 5 .label VK1__load_tape_auto = $4000 + 2 * 5
.label VK1__tape_head_align = $4000 + 2 * 6 .label VK1__tape_head_align = $4000 + 2 * 6
.label VK1__m65_chrout_screen = $4000 + 2 * 7 .label VK1__m65_chrout_screen = $4000 + 2 * 7
.label VK1__m65_chrin_keyboard = $4000 + 2 * 8 .label VK1__m65_chrin_keyboard = $4000 + 2 * 8
.label VK1__M65_MODE64 = $4000 + 2 * 9 .label VK1__M65_MODESET = $4000 + 2 * 9
.label VK1__M65_MODE65 = $4000 + 2 * 10 .label VK1__M65_SCRMODEGET = $4000 + 2 * 10
.label VK1__M65_SCRMODEGET = $4000 + 2 * 11 .label VK1__M65_SCRMODESET = $4000 + 2 * 11
.label VK1__M65_SCRMODESET = $4000 + 2 * 12 .label VK1__M65_CLRSCR = $4000 + 2 * 12
.label VK1__M65_CLRSCR = $4000 + 2 * 13 .label VK1__M65_CLRWIN = $4000 + 2 * 13
.label VK1__M65_CLRWIN = $4000 + 2 * 14 .label VK1__m65_screen_upd_txtrow_off = $4000 + 2 * 14
.label VK1__m65_screen_upd_txtrow_off = $4000 + 2 * 15
#else #else
@@ -34,7 +33,7 @@
.word IOINIT .word IOINIT
.word RAMTAS .word RAMTAS
.word setup_vicii .word vicii_init
#if CONFIG_TAPE_NORMAL && !CONFIG_TAPE_AUTODETECT #if CONFIG_TAPE_NORMAL && !CONFIG_TAPE_AUTODETECT
.word load_tape_normal .word load_tape_normal
@@ -63,8 +62,7 @@
.word m65_chrout_screen .word m65_chrout_screen
.word m65_chrin_keyboard .word m65_chrin_keyboard
.word M65_MODE64 .word M65_MODESET
.word M65_MODE65
.word M65_SCRMODEGET .word M65_SCRMODEGET
.word M65_SCRMODESET .word M65_SCRMODESET
.word M65_CLRSCR .word M65_CLRSCR
+1 -1
View File
@@ -12,7 +12,7 @@
.label STOP = KERNAL_0.STOP .label STOP = KERNAL_0.STOP
.label M65_SLOW = KERNAL_0.M65_SLOW .label M65_SLOW = KERNAL_0.M65_SLOW
.label M65_FAST = KERNAL_0.M65_FAST .label M65_FAST = KERNAL_0.M65_FAST
.label M65_ISMODE65 = KERNAL_0.M65_ISMODE65 .label M65_MODEGET = KERNAL_0.M65_MODEGET
.label M65_SETWIN_XY = KERNAL_0.M65_SETWIN_XY .label M65_SETWIN_XY = KERNAL_0.M65_SETWIN_XY
.label M65_SETWIN_WH = KERNAL_0.M65_SETWIN_WH .label M65_SETWIN_WH = KERNAL_0.M65_SETWIN_WH
.label M65_SETWIN_N = KERNAL_0.M65_SETWIN_N .label M65_SETWIN_N = KERNAL_0.M65_SETWIN_N
+2 -8
View File
@@ -5,16 +5,10 @@
// ROM routine call redirect for Mega65 API routines // ROM routine call redirect for Mega65 API routines
// //
M65_MODE64: M65_MODESET:
jsr map_KERNAL_1 jsr map_KERNAL_1
jsr_ind VK1__M65_MODE64 jsr_ind VK1__M65_MODESET
bra m65_api_end
M65_MODE65:
jsr map_KERNAL_1
jsr_ind VK1__M65_MODE65
bra m65_api_end bra m65_api_end
M65_SCRMODEGET: M65_SCRMODEGET:
+1 -1
View File
@@ -10,7 +10,7 @@ scnkey_set_keytab:
clear_screen: clear_screen:
STUB_IMPLEMENTATION() STUB_IMPLEMENTATION()
setup_vicii: vicii_init:
STUB_IMPLEMENTATION() STUB_IMPLEMENTATION()
cursor_blink: cursor_blink:
+5 -8
View File
@@ -8,19 +8,16 @@
// would copy the vector table to given memory location // would copy the vector table to given memory location
M65_JMODE64: M65_JMODEGET:
jsr M65_MODE64 jsr M65_MODEGET
M65_JMODE65: // XXX consider combining with M65_JMODE64 M65_JISMODESET:
jsr M65_MODE65 jsr M65_MODESET
M65_JISMODE65:
jsr M65_ISMODE65
M65_JSLOW: M65_JSLOW:
jsr M65_SLOW jsr M65_SLOW
M65_JFAST: // XXX consider combining with M65_JSLOW M65_JFAST:
jsr M65_FAST jsr M65_FAST
M65_JSELDEV: M65_JSELDEV:
-29
View File
@@ -1,29 +0,0 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
M65_MODE64:
// Disable interrupts, they might interfere
sei
// Set the magic string to mark legacy mode
lda #$00
sta M65_MAGICSTR+0
sta M65_MAGICSTR+1
sta M65_MAGICSTR+2
// Restore VIC-II configuration
jsr viciv_shutdown
jsr setup_vicii
// Reenable interrupts
cli
// Switch CPU speed back to slow and quit
jmp M65_SLOW
-36
View File
@@ -1,36 +0,0 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
M65_MODE65:
// Disable interrupts, they might interfere
sei
// Switch CPU speed to fast
jsr M65_FAST
// Set the magic string to mark native mode
lda #$4D // 'M'
sta M65_MAGICSTR+0
lda #$36 // '6'
sta M65_MAGICSTR+1
lda #$35 // '5'
sta M65_MAGICSTR+2
// Initialize VIC-IV
jsr setup_vicii
jsr viciv_init
// Set screen mode to 80x50
lda #$02
jsr m65_scrmodeset_internal
// Clear the screen
jmp M65_CLRSCR
@@ -2,7 +2,9 @@
// #LAYOUT# * * #IGNORE // #LAYOUT# * * #IGNORE
M65_ISMODE65: // checks if mode is native M65 one, BCC = jump if native mode M65_MODEGET:
// Checks if mode is native M65 one; Carry clear = native mode, Carry set = legacy mode
pha pha
+71
View File
@@ -0,0 +1,71 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
M65_MODESET:
// Carry clear = set native mode; Carry set = set legacy mode
bcc m65_mode65
// FALLTROUGH
m65_mode64:
// Disable interrupts, they might interfere
sei
// Set the magic string to mark legacy mode
lda #$00
sta M65_MAGICSTR+0
sta M65_MAGICSTR+1
sta M65_MAGICSTR+2
// Restore VIC-II configuration
jsr viciv_shutdown
jsr vicii_init
// Reenable interrupts
cli
// Switch CPU speed back to slow and quit
jmp M65_SLOW
m65_mode65:
// Disable interrupts, they might interfere
sei
// Switch CPU speed to fast
jsr M65_FAST
// Set the magic string to mark native mode
lda #$4D // 'M'
sta M65_MAGICSTR+0
lda #$36 // '6'
sta M65_MAGICSTR+1
lda #$35 // '5'
sta M65_MAGICSTR+2
// Initialize VIC-IV
jsr vicii_init
jsr viciv_init
// Set screen mode to 80x50
lda #$02
jsr m65_scrmodeset_internal
// Clear the screen
jmp M65_CLRSCR
+1 -1
View File
@@ -16,7 +16,7 @@ cint_legacy: // $E518
// Setup video and I/O // Setup video and I/O
// See here: https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=22 // See here: https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=22
jsr setup_vicii jsr vicii_init
// Code below must be placed under $E51B, or some code will break - see here: // Code below must be placed under $E51B, or some code will break - see here:
// - https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=2 // - https://csdb.dk/forums/index.php?roomid=11&topicid=17048&firstpost=2
@@ -11,12 +11,12 @@
// //
setup_vicii: vicii_init:
#if (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0) #if (ROM_LAYOUT_M65 && SEGMENT_KERNAL_0)
jsr map_KERNAL_1 jsr map_KERNAL_1
jsr_ind VK1__setup_vicii jsr_ind VK1__vicii_init
jmp map_NORMAL jmp map_NORMAL
#else #else
@@ -17,7 +17,7 @@ default_irq_handler:
#if ROM_LAYOUT_M65 #if ROM_LAYOUT_M65
jsr M65_ISMODE65 jsr M65_MODEGET
bcs !+ bcs !+
jsr m65_cursor_blink jsr m65_cursor_blink
+1 -1
View File
@@ -22,7 +22,7 @@ CLRCHN:
// FALLTROUGH // FALLTROUGH
clrchn_reset: // entry needed by setup_vicii clrchn_reset: // entry needed by vicii_init
// Set input device number to keyboard // Set input device number to keyboard
lda #$00 lda #$00
+3 -2
View File
@@ -25,12 +25,13 @@ panic:
// Make sure we are in legacy mode with normal memory mapping // Make sure we are in legacy mode with normal memory mapping
jsr map_NORMAL jsr map_NORMAL
jsr M65_MODE64 sec
jsr M65_MODESET // switch to legacy C64 compatibility mode
sei sei
#else #else
jsr setup_vicii jsr vicii_init
#endif #endif
+1 -1
View File
@@ -12,7 +12,7 @@ chrin_keyboard:
#if ROM_LAYOUT_M65 #if ROM_LAYOUT_M65
jsr M65_ISMODE65 jsr M65_MODEGET
bcc_16 m65_chrin_keyboard bcc_16 m65_chrin_keyboard
#endif #endif
+1 -1
View File
@@ -12,7 +12,7 @@ chrout_screen:
#if ROM_LAYOUT_M65 #if ROM_LAYOUT_M65
jsr M65_ISMODE65 jsr M65_MODEGET
bcc_16 m65_chrout_screen bcc_16 m65_chrout_screen
#endif #endif
@@ -17,7 +17,7 @@ screen_calculate_pointers:
#if ROM_LAYOUT_M65 #if ROM_LAYOUT_M65
jsr M65_ISMODE65 jsr M65_MODEGET
bcc_16 m65_screen_upd_txtrow_off bcc_16 m65_screen_upd_txtrow_off
#endif #endif
+3 -1
View File
@@ -28,7 +28,7 @@ SCREEN:
#else #else
php php
jsr M65_ISMODE65 jsr M65_MODEGET
bcc !+ bcc !+
plp plp
@@ -38,6 +38,8 @@ SCREEN:
rts rts
!: !:
// Screen dimensions depends on text mode
plp plp
pha pha
ldy M65_SCRMODE ldy M65_SCRMODE
+3 -2
View File
@@ -25,7 +25,7 @@ tape_screen_on_motor_off:
#else #else
jsr M65_ISMODE65 jsr M65_MODEGET
bcs_16 screen_on // MEGA65 native mode does not have badlines, no need to enable/disable screen bcs_16 screen_on // MEGA65 native mode does not have badlines, no need to enable/disable screen
rts rts
@@ -51,7 +51,8 @@ tape_screen_off_motor_on:
#else #else
jsr M65_ISMODE65 jsr M65_MODEGET
// XXX optimize this
bcs !+ // MEGA65 native mode does not have badlines, no need to enable/disable screen bcs !+ // MEGA65 native mode does not have badlines, no need to enable/disable screen
jsr screen_off jsr screen_off
!: !: