more work on Mega65 native mode
This commit is contained in:
1 parent
b235db4cd0
commit
0b9cc2a9ec
16 files changed
+163
-142
No files matched your search
@@ -52,10 +52,12 @@
|
|||||||
|
|
||||||
.label filename_any = KERNAL().filename_any
|
.label filename_any = KERNAL().filename_any
|
||||||
|
|
||||||
|
.label SELDEV = KERNAL().SELDEV
|
||||||
|
|
||||||
#if ROM_LAYOUT_M65
|
#if ROM_LAYOUT_M65
|
||||||
.label M65_JMODE64 = KERNAL().M65_JMODE64
|
.label M65_MODE64 = KERNAL().M65_MODE64
|
||||||
.label M65_JMODE65 = KERNAL().M65_JMODE65
|
.label M65_MODE65 = KERNAL().M65_MODE65
|
||||||
.label M65_JISMODE65 = KERNAL().M65_JISMODE65
|
.label M65_ISMODE65 = KERNAL().M65_ISMODE65
|
||||||
.label M65_JSLOW = KERNAL().M65_JSLOW
|
.label M65_SLOW = KERNAL().M65_SLOW
|
||||||
.label M65_JFAST = KERNAL().M65_JFAST
|
.label M65_FAST = KERNAL().M65_FAST
|
||||||
#endif
|
#endif
|
||||||
@@ -31,24 +31,26 @@ cmd_go_syntax_error:
|
|||||||
|
|
||||||
// If in native mode - switch to C64 compatibilty
|
// If in native mode - switch to C64 compatibilty
|
||||||
|
|
||||||
jsr M65_JISMODE65
|
jsr M65_ISMODE65
|
||||||
bne cmd_go_rts
|
bne cmd_go_rts
|
||||||
|
|
||||||
jsr helper_ask_if_sure
|
jsr helper_ask_if_sure
|
||||||
bcs cmd_go_rts
|
bcs cmd_go_rts
|
||||||
jmp M65_JMODE64
|
jsr M65_MODE64
|
||||||
|
jmp do_clr
|
||||||
!:
|
!:
|
||||||
cmp #65
|
cmp #65
|
||||||
bne !+
|
bne !+
|
||||||
|
|
||||||
// If in C64 compatibility mode - switch to native mode
|
// If in C64 compatibility mode - switch to native mode
|
||||||
|
|
||||||
jsr M65_JISMODE65
|
jsr M65_ISMODE65
|
||||||
beq cmd_go_rts
|
beq cmd_go_rts
|
||||||
|
|
||||||
jsr helper_ask_if_sure
|
jsr helper_ask_if_sure
|
||||||
bcs cmd_go_rts
|
bcs cmd_go_rts
|
||||||
jmp M65_JMODE65
|
jsr M65_MODE65
|
||||||
|
jmp do_clr
|
||||||
!:
|
!:
|
||||||
jmp do_ILLEGAL_QUANTITY_error
|
jmp do_ILLEGAL_QUANTITY_error
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,6 @@ helper_load_init_params_no_VERCKB:
|
|||||||
|
|
||||||
// Set default device, set secondary address to 0
|
// Set default device, set secondary address to 0
|
||||||
|
|
||||||
jsr select_device
|
jsr SELDEV
|
||||||
ldy #$00 // secondary address
|
ldy #$00 // secondary address
|
||||||
jmp JSETFLS
|
jmp JSETFLS
|
||||||
@@ -10,15 +10,11 @@
|
|||||||
.const command_01_list = List().add(
|
.const command_01_list = List().add(
|
||||||
|
|
||||||
#if CONFIG_MB_MEGA_65
|
#if CONFIG_MB_MEGA_65
|
||||||
|
M65_SLOW,
|
||||||
M65_JSLOW,
|
M65_FAST,
|
||||||
M65_JFAST,
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
cmd_slow,
|
cmd_slow,
|
||||||
cmd_fast,
|
cmd_fast,
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cmd_old,
|
cmd_old,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
.label JCHKIN = KERNAL_0.JCHKIN
|
.label JCHKIN = KERNAL_0.JCHKIN
|
||||||
.label JCHRIN = KERNAL_0.JCHRIN
|
.label JCHRIN = KERNAL_0.JCHRIN
|
||||||
.label JREADST = KERNAL_0.JREADST
|
.label JREADST = KERNAL_0.JREADST
|
||||||
|
.label SELDEV = KERNAL_0.SELDEV
|
||||||
.label plot_set = KERNAL_0.plot_set
|
.label plot_set = KERNAL_0.plot_set
|
||||||
.label init_oldtxt = BASIC_0.init_oldtxt
|
.label init_oldtxt = BASIC_0.init_oldtxt
|
||||||
.label tmpstr_free_all_reset = BASIC_0.tmpstr_free_all_reset
|
.label tmpstr_free_all_reset = BASIC_0.tmpstr_free_all_reset
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ wedge_dos:
|
|||||||
jsr JCLALL
|
jsr JCLALL
|
||||||
|
|
||||||
// Set file parameters, channel 15 is a typical one for commands
|
// Set file parameters, channel 15 is a typical one for commands
|
||||||
jsr select_device // sets .X register
|
jsr SELDEV // sets .X register
|
||||||
lda #$0F
|
lda #$0F
|
||||||
ldy #$0F
|
ldy #$0F
|
||||||
jsr JSETFLS
|
jsr JSETFLS
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
M65_ISMODE65: // checks if mode is native M65 one, BEQ = jump if native mode
|
||||||
|
|
||||||
|
pha
|
||||||
|
|
||||||
|
lda M65_MAGICSTR+0
|
||||||
|
cmp #$4D // 'M'
|
||||||
|
bne !+
|
||||||
|
lda M65_MAGICSTR+1
|
||||||
|
cmp #$36 // '6'
|
||||||
|
bne !+
|
||||||
|
lda M65_MAGICSTR+2
|
||||||
|
cmp #$35 // '5'
|
||||||
|
!:
|
||||||
|
pla
|
||||||
|
rts
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
M65_MODE64:
|
||||||
|
|
||||||
|
// Disable interrupts, they might interfere
|
||||||
|
|
||||||
|
sei
|
||||||
|
|
||||||
|
// XXX provide full implementation
|
||||||
|
|
||||||
|
// Set the magic string to mark legacy mode
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
sta M65_MAGICSTR+0
|
||||||
|
sta M65_MAGICSTR+1
|
||||||
|
sta M65_MAGICSTR+2
|
||||||
|
|
||||||
|
// Reenable interrupts
|
||||||
|
|
||||||
|
cli
|
||||||
|
|
||||||
|
// Switch CPU speed back to slow and quit
|
||||||
|
|
||||||
|
jmp M65_SLOW
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// #LAYOUT# M65 KERNAL_0 #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
|
||||||
|
|
||||||
|
// XXX provide full implementation
|
||||||
|
|
||||||
|
// Switch VIC to VIC-IV mode
|
||||||
|
|
||||||
|
jsr viciv_unhide
|
||||||
|
|
||||||
|
// XXX provide proper implementation below
|
||||||
|
|
||||||
|
// Set screen mode to 80 columns
|
||||||
|
|
||||||
|
lda $D031
|
||||||
|
ora #$80
|
||||||
|
sta $D031
|
||||||
|
|
||||||
|
// Set screen RAM base to $15000
|
||||||
|
|
||||||
|
lda #$00
|
||||||
|
sta $D060
|
||||||
|
sta LDTB1+0
|
||||||
|
sta $D063
|
||||||
|
sta LDTB1+3
|
||||||
|
lda #$50
|
||||||
|
sta $D061
|
||||||
|
sta LDTB1+1
|
||||||
|
lda #$01
|
||||||
|
sta $D062
|
||||||
|
sta LDTB1+2
|
||||||
|
|
||||||
|
// Set something in screen memory
|
||||||
|
|
||||||
|
lda #$01
|
||||||
|
|
||||||
|
// STA [],Z
|
||||||
|
nop
|
||||||
|
.byte $92
|
||||||
|
.byte LDTB1
|
||||||
|
|
||||||
|
!:
|
||||||
|
nop
|
||||||
|
jmp !-
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
|
||||||
|
M65_SLOW: // set CPU speed to 1 MHz
|
||||||
|
|
||||||
|
lda #$40
|
||||||
|
skip_2_bytes_trash_nvz
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
M65_FAST: // set CPU speed to 40 MHz
|
||||||
|
|
||||||
|
lda #$41
|
||||||
|
sta CPU_D6510
|
||||||
|
rts
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
|
||||||
|
|
||||||
.label mega65_unhide = KERNAL_0.mega65_unhide
|
.label viciv_unhide = KERNAL_0.viciv_unhide
|
||||||
.label tape_motor_on = KERNAL_0.tape_motor_on
|
.label tape_motor_on = KERNAL_0.tape_motor_on
|
||||||
.label tape_motor_off = KERNAL_0.tape_motor_off
|
.label tape_motor_off = KERNAL_0.tape_motor_off
|
||||||
|
|
||||||
|
|||||||
@@ -4,126 +4,24 @@
|
|||||||
//
|
//
|
||||||
// Not this is not an official Kernal API extension (yet)! It is subject to change!
|
// Not this is not an official Kernal API extension (yet)! It is subject to change!
|
||||||
//
|
//
|
||||||
|
// XXX consider turning this into vector table, the only jumptable extension
|
||||||
|
// would copy the vector table to given memory location
|
||||||
|
|
||||||
|
|
||||||
M65_JMODE64:
|
M65_JMODE64:
|
||||||
|
jsr M65_MODE64
|
||||||
// Disable interrupts, they might interfere
|
|
||||||
|
|
||||||
sei
|
|
||||||
|
|
||||||
// XXX provide full implementation
|
|
||||||
|
|
||||||
// Set the magic string to mark legacy mode
|
|
||||||
|
|
||||||
lda #$00
|
|
||||||
sta M65_MAGICSTR+0
|
|
||||||
sta M65_MAGICSTR+1
|
|
||||||
sta M65_MAGICSTR+2
|
|
||||||
|
|
||||||
// Reenable interrupts
|
|
||||||
|
|
||||||
cli
|
|
||||||
|
|
||||||
// Switch CPU speed back to slow and quit
|
|
||||||
|
|
||||||
jmp M65_JSLOW
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
M65_JMODE65:
|
M65_JMODE65:
|
||||||
|
jsr M65_MODE65
|
||||||
|
|
||||||
// Disable interrupts, they might interfere
|
M65_JISMODE65:
|
||||||
|
jsr M65_ISMODE65
|
||||||
|
|
||||||
sei
|
M65_JSLOW:
|
||||||
|
jsr M65_SLOW
|
||||||
|
|
||||||
// Swithc CPU speed to fast
|
M65_JFAST:
|
||||||
|
jsr M65_FAST
|
||||||
|
|
||||||
jsr M65_JFAST
|
M65_JSELDEV:
|
||||||
|
jsr SELDEV
|
||||||
// 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
|
|
||||||
|
|
||||||
// XXX provide full implementation
|
|
||||||
|
|
||||||
// Switch VIC to VIC-IV mode
|
|
||||||
|
|
||||||
lda #$47
|
|
||||||
sta VIC_KEY
|
|
||||||
lda #$53
|
|
||||||
sta VIC_KEY
|
|
||||||
|
|
||||||
// XXX provide proper implementation
|
|
||||||
|
|
||||||
// Set screen mode to 80 columns
|
|
||||||
|
|
||||||
lda $D031
|
|
||||||
ora #$80
|
|
||||||
sta $D031
|
|
||||||
|
|
||||||
// Set screen RAM base to $15000
|
|
||||||
|
|
||||||
lda #$00
|
|
||||||
sta $D060
|
|
||||||
sta LDTB1+0
|
|
||||||
sta $D063
|
|
||||||
sta LDTB1+3
|
|
||||||
lda #$50
|
|
||||||
sta $D061
|
|
||||||
sta LDTB1+1
|
|
||||||
lda #$01
|
|
||||||
sta $D062
|
|
||||||
sta LDTB1+2
|
|
||||||
|
|
||||||
// Set something in screen memory
|
|
||||||
|
|
||||||
lda #$01
|
|
||||||
|
|
||||||
// STA [],Z
|
|
||||||
nop
|
|
||||||
.byte $92
|
|
||||||
.byte LDTB1
|
|
||||||
|
|
||||||
!:
|
|
||||||
nop
|
|
||||||
jmp !-
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
M65_JISMODE65: // checks if mode is native M65 one, BEQ = jump if native mode
|
|
||||||
|
|
||||||
pha
|
|
||||||
|
|
||||||
lda M65_MAGICSTR+0
|
|
||||||
cmp #$4D // 'M'
|
|
||||||
bne !+
|
|
||||||
lda M65_MAGICSTR+1
|
|
||||||
cmp #$36 // '6'
|
|
||||||
bne !+
|
|
||||||
lda M65_MAGICSTR+2
|
|
||||||
cmp #$35 // '5'
|
|
||||||
!:
|
|
||||||
pla
|
|
||||||
rts
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
M65_JSLOW: // set CPU speed to 1 MHz
|
|
||||||
|
|
||||||
lda #$40
|
|
||||||
skip_2_bytes_trash_nvz
|
|
||||||
|
|
||||||
// FALLTROUGH
|
|
||||||
|
|
||||||
M65_JFAST: // set CPU speed to 40 MHz
|
|
||||||
|
|
||||||
lda #$41
|
|
||||||
sta CPU_D6510
|
|
||||||
rts
|
|
||||||
@@ -8,10 +8,10 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#if CONFIG_KEYBOARD_C65 || (CONFIG_MB_MEGA_65 && (CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO))
|
#if ROM_LAYOUT_M65 || CONFIG_KEYBOARD_C65 || (CONFIG_MB_MEGA_65 && (CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO))
|
||||||
|
|
||||||
|
|
||||||
mega65_unhide:
|
viciv_unhide:
|
||||||
|
|
||||||
lda #$A5
|
lda #$A5
|
||||||
sta VIC_KEY
|
sta VIC_KEY
|
||||||
@@ -1,11 +1,9 @@
|
|||||||
// #LAYOUT# STD * #TAKE
|
// #LAYOUT# STD * #TAKE
|
||||||
// #LAYOUT# M65 BASIC_1 #TAKE
|
// #LAYOUT# * KERNAL_0 #TAKE
|
||||||
// #LAYOUT# * BASIC_0 #TAKE
|
// #LAYOUT# * * #IGNORE
|
||||||
// #LAYOUT# * * #IGNORE
|
|
||||||
|
|
||||||
// XXX for Mega65, it should be available in BASIC_1 segment only
|
|
||||||
|
|
||||||
select_device:
|
SELDEV:
|
||||||
|
|
||||||
// Take last device number, make sure it is a drive - 8 or above. Above 30,
|
// Take last device number, make sure it is a drive - 8 or above. Above 30,
|
||||||
// although illegal for IEC we also consider a drive, as they exists
|
// although illegal for IEC we also consider a drive, as they exists
|
||||||
@@ -48,7 +48,7 @@ SCNKEY:
|
|||||||
// mode when done. This is not ideal, but as MEGA65s start C65 mode with VIC-IV IO mode
|
// 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.
|
// selected anyway, it should not be a big problem in practice.
|
||||||
|
|
||||||
jsr mega65_unhide
|
jsr viciv_unhide
|
||||||
jsr scnkey_viciv_mode
|
jsr scnkey_viciv_mode
|
||||||
|
|
||||||
sta VIC_KEY // hide Mega65 registers
|
sta VIC_KEY // hide Mega65 registers
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ tape_screen_off_motor_on:
|
|||||||
// On Mega65 we do not have to turn the screen off;
|
// On Mega65 we do not have to turn the screen off;
|
||||||
// it is enough to disable badline emulation
|
// it is enough to disable badline emulation
|
||||||
|
|
||||||
jsr mega65_unhide
|
jsr viciv_unhide
|
||||||
lda #$00
|
lda #$00
|
||||||
sta M65_BADL_SLI
|
sta M65_BADL_SLI
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user