changed CPU speed handling for MEGA65
This commit is contained in:
1 parent
121f49b763
commit
47b9676ca9
12 files changed
+142
-22
No files matched your search
@@ -0,0 +1,45 @@
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
;
|
||||
; Checks if system is in MEGA65 native mode; if so, switches CPU speed to fast/slow - for IEC routines;
|
||||
; Alters only status bits, all remaining registers preserved
|
||||
;
|
||||
|
||||
!ifdef CONFIG_IEC {
|
||||
|
||||
|
||||
m65_iec_slow:
|
||||
|
||||
jsr M65_MODEGET
|
||||
bcs m65_iec_fast_slow_done
|
||||
|
||||
; Switch CPU speed
|
||||
|
||||
pha
|
||||
lda VIC_CTRLB
|
||||
and #%10111111
|
||||
bra m65_iec_fast_slow_common
|
||||
|
||||
m65_iec_fast:
|
||||
|
||||
jsr M65_MODEGET
|
||||
bcs m65_iec_fast_slow_done
|
||||
|
||||
pha
|
||||
lda VIC_CTRLB
|
||||
ora #%01000000
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65_iec_fast_slow_common:
|
||||
|
||||
sta VIC_CTRLB
|
||||
pla
|
||||
|
||||
; FALLTROUGH
|
||||
|
||||
m65_iec_fast_slow_done:
|
||||
|
||||
rts
|
||||
}
|
||||
@@ -17,10 +17,10 @@ viciv_init:
|
||||
lda #$00
|
||||
sta MISC_EMU
|
||||
|
||||
; Set misc VIC-IV flags
|
||||
; Set VIC-IV CTRL registers
|
||||
|
||||
lda #%01000000 ; enable C65 character set
|
||||
sta VIC_CTRLA
|
||||
lda #%01000000 ; enable C65 character set
|
||||
jsr mega65_viciv_setctrl_AC ; also initialize remaining CTRLA / CTRLC bits; CTRLB will be set by screen editor
|
||||
|
||||
; Disable hot registers
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
;
|
||||
; Helper routine for setting VIC-IV control registers A and C
|
||||
;
|
||||
|
||||
|
||||
mega65_viciv_setctrl_AC:
|
||||
|
||||
sta VIC_CTRLA
|
||||
|
||||
lda VIC_CTRLC
|
||||
and #%01101000
|
||||
ora #%01000000 ; make C65/C128 fast modes switch to max MEGA65 CPU speed
|
||||
sta VIC_CTRLC
|
||||
|
||||
rts
|
||||
@@ -20,12 +20,8 @@ viciv_shutdown:
|
||||
; Set misc VIC-IV flags
|
||||
|
||||
lda #%00000000
|
||||
sta VIC_CTRLA ; enable C64 character set
|
||||
sta VIC_CTRLB ; disable extended resolution and attributes
|
||||
|
||||
lda VIC_CTRLC
|
||||
and #%00101000 ; disable fast mode and various VIC-IV extensions
|
||||
sta VIC_CTRLC
|
||||
sta VIC_CTRLB ; disable extended resolution and attributes, disable 3.5 MHz mode
|
||||
jsr mega65_viciv_setctrl_AC ; enable C64 character set, initialize remaining CTRLA / CTRLC bits
|
||||
|
||||
; Reenable hot registers
|
||||
|
||||
|
||||
Reference in new issue
Block a user