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 | |
| 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 />
+2 -3
View File
@@ -55,9 +55,8 @@
.label SELDEV = KERNAL().SELDEV
#if ROM_LAYOUT_M65
.label M65_MODE64 = KERNAL().M65_MODE64
.label M65_MODE65 = KERNAL().M65_MODE65
.label M65_ISMODE65 = KERNAL().M65_ISMODE65
.label M65_MODEGET = KERNAL().M65_MODEGET
.label M65_MODESET = KERNAL().M65_MODESET
.label M65_SLOW = KERNAL().M65_SLOW
.label M65_FAST = KERNAL().M65_FAST
.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
jsr M65_ISMODE65
jsr M65_MODEGET
bcs cmd_go_rts
jsr helper_ask_if_sure
bcs cmd_go_rts
jsr M65_MODE64
sec
jsr M65_MODESET // Carry set = switch to C64 mode
jmp_8 cmd_go_switchmode_clr_banner
!:
cmp #65
@@ -44,12 +45,12 @@ cmd_go_syntax_error:
// If in C64 compatibility mode - switch to native mode
jsr M65_ISMODE65
jsr M65_MODEGET
bcc cmd_go_rts
jsr helper_ask_if_sure
bcs cmd_go_rts
jsr M65_MODE65
jsr M65_MODESET // Carry clear = switch to M65 mode
// FALLTROUGH
+3 -2
View File
@@ -26,9 +26,10 @@ cmd_sys:
// Make sure we are in C64 compatibility mode
jsr M65_ISMODE65
jsr M65_MODEGET
bcs cmd_sys_nsys_common
jsr M65_MODE64
sec
jsr M65_MODESET // set legacy C64 compatibility mode
// FALLTROUGH
+2 -2
View File
@@ -21,7 +21,7 @@ cmd_sysinfo:
ldx #IDX__STR_SI_HEADER
jsr print_packed_misc_str
jsr M65_ISMODE65
jsr M65_MODEGET
bcc !+
ldx #IDX__STR_SI_MODE64
@@ -39,7 +39,7 @@ cmd_sysinfo:
jsr print_return
jsr M65_ISMODE65
jsr M65_MODEGET
bcs print_sysinfo_video
jsr print_return
+1 -1
View File
@@ -26,7 +26,7 @@
.label JREADST = KERNAL_0.JREADST
.label JSCREEN = KERNAL_0.JSCREEN
.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_WH = KERNAL_0.M65_SETWIN_WH
.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
jsr M65_ISMODE65
jsr M65_MODEGET
bcc !+
// Legacy mode
// Legacy C64 compatibility mode
ldx #$02
ldy #$21
@@ -13,20 +13,19 @@
.label VK1__IOINIT = $4000 + 2 * 0
.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_turbo = $4000 + 2 * 4
.label VK1__load_tape_auto = $4000 + 2 * 5
.label VK1__tape_head_align = $4000 + 2 * 6
.label VK1__m65_chrout_screen = $4000 + 2 * 7
.label VK1__m65_chrin_keyboard = $4000 + 2 * 8
.label VK1__M65_MODE64 = $4000 + 2 * 9
.label VK1__M65_MODE65 = $4000 + 2 * 10
.label VK1__M65_SCRMODEGET = $4000 + 2 * 11
.label VK1__M65_SCRMODESET = $4000 + 2 * 12
.label VK1__M65_CLRSCR = $4000 + 2 * 13
.label VK1__M65_CLRWIN = $4000 + 2 * 14
.label VK1__m65_screen_upd_txtrow_off = $4000 + 2 * 15
.label VK1__M65_MODESET = $4000 + 2 * 9
.label VK1__M65_SCRMODEGET = $4000 + 2 * 10
.label VK1__M65_SCRMODESET = $4000 + 2 * 11
.label VK1__M65_CLRSCR = $4000 + 2 * 12
.label VK1__M65_CLRWIN = $4000 + 2 * 13
.label VK1__m65_screen_upd_txtrow_off = $4000 + 2 * 14
#else
@@ -34,7 +33,7 @@
.word IOINIT
.word RAMTAS
.word setup_vicii
.word vicii_init
#if CONFIG_TAPE_NORMAL && !CONFIG_TAPE_AUTODETECT
.word load_tape_normal
@@ -63,8 +62,7 @@
.word m65_chrout_screen
.word m65_chrin_keyboard
.word M65_MODE64
.word M65_MODE65
.word M65_MODESET
.word M65_SCRMODEGET
.word M65_SCRMODESET
.word M65_CLRSCR
+1 -1
View File
@@ -12,7 +12,7 @@
.label STOP = KERNAL_0.STOP
.label M65_SLOW = KERNAL_0.M65_SLOW
.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_WH = KERNAL_0.M65_SETWIN_WH
.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
//
M65_MODE64:
M65_MODESET:
jsr map_KERNAL_1
jsr_ind VK1__M65_MODE64
bra m65_api_end
M65_MODE65:
jsr map_KERNAL_1
jsr_ind VK1__M65_MODE65
jsr_ind VK1__M65_MODESET
bra m65_api_end
M65_SCRMODEGET:
+1 -1
View File
@@ -10,7 +10,7 @@ scnkey_set_keytab:
clear_screen:
STUB_IMPLEMENTATION()
setup_vicii:
vicii_init:
STUB_IMPLEMENTATION()
cursor_blink:
+5 -8
View File
@@ -8,19 +8,16 @@
// would copy the vector table to given memory location
M65_JMODE64:
jsr M65_MODE64
M65_JMODEGET:
jsr M65_MODEGET
M65_JMODE65: // XXX consider combining with M65_JMODE64
jsr M65_MODE65
M65_JISMODE65:
jsr M65_ISMODE65
M65_JISMODESET:
jsr M65_MODESET
M65_JSLOW:
jsr M65_SLOW
M65_JFAST: // XXX consider combining with M65_JSLOW
M65_JFAST:
jsr M65_FAST
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
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
+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
// 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:
// - 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)
jsr map_KERNAL_1
jsr_ind VK1__setup_vicii
jsr_ind VK1__vicii_init
jmp map_NORMAL
#else
@@ -17,7 +17,7 @@ default_irq_handler:
#if ROM_LAYOUT_M65
jsr M65_ISMODE65
jsr M65_MODEGET
bcs !+
jsr m65_cursor_blink
+1 -1
View File
@@ -22,7 +22,7 @@ CLRCHN:
// FALLTROUGH
clrchn_reset: // entry needed by setup_vicii
clrchn_reset: // entry needed by vicii_init
// Set input device number to keyboard
lda #$00
+3 -2
View File
@@ -25,12 +25,13 @@ panic:
// Make sure we are in legacy mode with normal memory mapping
jsr map_NORMAL
jsr M65_MODE64
sec
jsr M65_MODESET // switch to legacy C64 compatibility mode
sei
#else
jsr setup_vicii
jsr vicii_init
#endif
+1 -1
View File
@@ -12,7 +12,7 @@ chrin_keyboard:
#if ROM_LAYOUT_M65
jsr M65_ISMODE65
jsr M65_MODEGET
bcc_16 m65_chrin_keyboard
#endif
+1 -1
View File
@@ -12,7 +12,7 @@ chrout_screen:
#if ROM_LAYOUT_M65
jsr M65_ISMODE65
jsr M65_MODEGET
bcc_16 m65_chrout_screen
#endif
@@ -17,7 +17,7 @@ screen_calculate_pointers:
#if ROM_LAYOUT_M65
jsr M65_ISMODE65
jsr M65_MODEGET
bcc_16 m65_screen_upd_txtrow_off
#endif
+3 -1
View File
@@ -28,7 +28,7 @@ SCREEN:
#else
php
jsr M65_ISMODE65
jsr M65_MODEGET
bcc !+
plp
@@ -38,6 +38,8 @@ SCREEN:
rts
!:
// Screen dimensions depends on text mode
plp
pha
ldy M65_SCRMODE
+3 -2
View File
@@ -25,7 +25,7 @@ tape_screen_on_motor_off:
#else
jsr M65_ISMODE65
jsr M65_MODEGET
bcs_16 screen_on // MEGA65 native mode does not have badlines, no need to enable/disable screen
rts
@@ -51,7 +51,8 @@ tape_screen_off_motor_on:
#else
jsr M65_ISMODE65
jsr M65_MODEGET
// XXX optimize this
bcs !+ // MEGA65 native mode does not have badlines, no need to enable/disable screen
jsr screen_off
!: