]> git.sur5r.net Git - cc65/blob - libsrc/c64/acc_detect_turbomaster.s
AtariOS: Fix for FPIDX enum
[cc65] / libsrc / c64 / acc_detect_turbomaster.s
1 ;
2 ; Marco van den Heuvel, 2018-04-30
3 ;
4
5 ; unsigned char detect_turbomaster (void);
6 ;
7 ;/* Check for the presence of a Turbo Master cartridge.
8 ; *
9 ; * Possible return values:
10 ; * 0x00  : TurboMaster cartridge not present
11 ; * 0x01  : TurboMaster cartridge present
12 ; */
13
14         .export         _detect_turbomaster
15
16         .include        "accelerator.inc"
17
18 _detect_turbomaster:
19         lda     #$00
20         tax
21
22 ; Make sure the current CPU is not a 6510
23         .byte   $1A                    ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816
24         beq     not_found
25
26 ; Make sure the current CPU is not a 65816
27         clc
28         .byte   $E2,$01                ; NOP #$01 on 65(S)C02, LDA $(01,S),Y on 65CE02 and 4510, SEP #$01 on 65816
29         bcs     not_found              ; carry will be set on 65816
30
31 ; Make sure the current CPU is not a 65CE02/4510
32         .byte   $A3,$A3                ; NOP NOP on 65(S)C02 and LDZ #$00 on 65CE02 and 4510
33         .byte   $6B                    ; NOP on 65(S)C02 and TZA on 65CE02 and 4510
34         cmp     #$A3
35         beq     not_found
36
37 ; Check for turbo master basic replacement
38         ldy     TURBOMASTER_DETECT
39         cpy     #$A2
40         beq     found
41 not_found:
42         txa
43 found:
44         rts
45