]> git.sur5r.net Git - cc65/blob - libsrc/c64/acc_detect_chameleon.s
ld65: implement '--allow-multiple-definition' command line parameter
[cc65] / libsrc / c64 / acc_detect_chameleon.s
1 ;
2 ; Marco van den Heuvel, 2018-04-25
3 ;
4
5 ; unsigned char detect_chameleon (void);
6 ;
7 ;/* Check for the presence of the Chameleon cartridge.
8 ; *
9 ; * Possible return values:
10 ; * 0x00  : Chameleon cartridge not present
11 ; * 0x01  : Chameleon cartridge present
12 ; */
13
14         .export         _detect_chameleon
15
16         .include        "accelerator.inc"
17
18 _detect_chameleon:
19         lda     #$00
20         tax
21
22 ; Make sure the CPU is a 6510
23         .byte   $1A                   ; NOP on 6510, INA on 65(S)C(E)02, 4510 and 65816
24         bne     not_found
25
26         ldy     CHAMELEON_CFGENA
27         lda     #CHAMELEON_ENABLE_REGS
28         sta     CHAMELEON_CFGENA
29         lda     CHAMELEON_CFGENA
30         sty     CHAMELEON_CFGENA
31         cmp     #$FF
32         beq     not_found
33 found:
34         lda     #$01
35         .byte   $24
36 not_found:
37         txa
38         rts
39