Added C64/C128 SuperCPU accelerator functions and started on a generic framework for accelerators.
This commit is contained in:
34
libsrc/c128/acc_detect_scpu.s
Executable file
34
libsrc/c128/acc_detect_scpu.s
Executable file
@@ -0,0 +1,34 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-08
|
||||
;
|
||||
|
||||
; unsigned char detect_scpu (void);
|
||||
;
|
||||
;/* Check for the presence of the SuperCPU cartridge.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * 0x00 : SuperCPU cartridge not present
|
||||
; * 0x01 : SuperCPU cartridge present
|
||||
; */
|
||||
|
||||
.export _detect_scpu
|
||||
|
||||
.include "accelerator.inc"
|
||||
_detect_scpu:
|
||||
ldx #$00
|
||||
txa
|
||||
|
||||
; Make sure the current CPU is a 65816
|
||||
clc
|
||||
.byte $E2,$01 ; NOP #$01 on 6510 and 65(S)C02, LDA $(01,S),Y on 65CE02 and 4510, SEP #$01 on 65816
|
||||
bcc not_found ; carry will be set on 65816
|
||||
|
||||
; 65816 has been detected, make sure it's the SuperCPU cartridge
|
||||
|
||||
lda SuperCPU_Detect
|
||||
asl
|
||||
bcs not_found
|
||||
found:
|
||||
lda #$01
|
||||
not_found:
|
||||
rts
|
||||
59
libsrc/c128/acc_scpu_speed.s
Executable file
59
libsrc/c128/acc_scpu_speed.s
Executable file
@@ -0,0 +1,59 @@
|
||||
;
|
||||
; Marco van den Heuvel, 2018-04-09
|
||||
;
|
||||
|
||||
; extern unsigned char __fastcall__ set_scpu_speed (unsigned char speed);
|
||||
;
|
||||
;/* Set the speed of the SuperCPU cartridge, using SPEED_SLOW will switch to
|
||||
; * 1 Mhz mode, SPEED_20X or SPEED_FAST will switch to 20 Mhz mode.
|
||||
; *
|
||||
; * Note that any value lower than SPEED_20X will switch to 1 Mhz mode, and
|
||||
; * any value higher or equal to SPEED_20X will switch to 20 Mhz mode.
|
||||
; *
|
||||
; * This function will return the actual speed the CPU is at after trying
|
||||
; * to set the requested speed, if this is not the speed that was requested
|
||||
; * then possibly the hardware speed switch prevented any software speed
|
||||
; * switching.
|
||||
; *
|
||||
; * This function does not check for the presence of the SuperCPU cartridge,
|
||||
; * make sure you use 'detect_scpu();' before using.
|
||||
; */
|
||||
|
||||
; extern unsigned char get_scpu_speed (void);
|
||||
;
|
||||
;/* Get the speed of the SuperCPU cartridge.
|
||||
; *
|
||||
; * Possible return values:
|
||||
; * SPEED_1X : 1 Mhz mode
|
||||
; * SPEED_20X : 20 Mhz mode
|
||||
; *
|
||||
; * This function does not check for the presence of the SuperCPU cartridge,
|
||||
; * make sure you use 'detect_scpu();' before using.
|
||||
; */
|
||||
|
||||
.export _set_scpu_speed
|
||||
.export _get_scpu_speed
|
||||
|
||||
.include "accelerator.inc"
|
||||
|
||||
_set_scpu_speed:
|
||||
cmp #SPEED_20X
|
||||
bcs high_speed
|
||||
low_speed:
|
||||
sta SuperCPU_Slow
|
||||
jmp _get_scpu_speed
|
||||
|
||||
high_speed:
|
||||
sta SuperCPU_Fast
|
||||
|
||||
_get_scpu_speed:
|
||||
ldx #$00
|
||||
lda SuperCPU_Speed_Mode
|
||||
asl
|
||||
asl
|
||||
bcc is_fast_speed
|
||||
lda #SPEED_1X
|
||||
rts
|
||||
is_fast_speed:
|
||||
lda #SPEED_20X
|
||||
rts
|
||||
Reference in New Issue
Block a user