]> git.sur5r.net Git - cc65/blob - libsrc/c64/acc_detect_scpu.s
lseek: Implement additional feedback from PR #723.
[cc65] / libsrc / c64 / acc_detect_scpu.s
1 ;
2 ; Marco van den Heuvel, 2018-04-08
3 ;
4
5 ; unsigned char detect_scpu (void);
6 ;
7 ;/* Check for the presence of the SuperCPU cartridge.
8 ; *
9 ; * Possible return values:
10 ; * 0x00  : SuperCPU cartridge not present
11 ; * 0x01  : SuperCPU cartridge present
12 ; */
13
14         .export         _detect_scpu
15
16         .include        "accelerator.inc"
17 _detect_scpu:
18         ldx     #$00
19         txa
20
21 ; Make sure the current CPU is a 65816
22         clc
23         .byte   $E2,$01                ; NOP #$01 on 6510 and 65(S)C02, LDA $(01,S),Y on 65CE02 and 4510, SEP #$01 on 65816
24         bcc     not_found              ; carry will be set on 65816
25
26 ; 65816 has been detected, make sure it's the SuperCPU cartridge
27
28         lda     SuperCPU_Detect
29         asl
30         bcs     not_found
31 found:
32         lda     #$01
33 not_found:
34         rts