]> git.sur5r.net Git - cc65/blob - libsrc/c64/acc_detect_c128.s
Updated c128 accelerator code and documentation.
[cc65] / libsrc / c64 / acc_detect_c128.s
1 ;
2 ; Marco van den Heuvel, 2018-04-20
3 ;
4
5 ; unsigned char detect_c128 (void);
6 ;
7 ;/* Check for the presence of a C128 in C64 mode.
8 ; *
9 ; * Possible return values:
10 ; * 0x00  : C128 in C64 mode not present
11 ; * 0x01  : C128 in C64 mode present
12 ; */
13
14         .export         _detect_c128
15
16         .include        "accelerator.inc"
17
18 _detect_c128:
19         lda     #$00
20         tax
21
22 ; Make sure the CPU is a 8502
23         .byte   $1A                   ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816
24         beq     found
25         .byte   $3A                   ; decrement A again, so a #$00 can be returned
26         rts
27
28 found:
29
30 ; Make sure a C128 VICIIe is present
31         ldy     C128_VICIIE_CLK
32         cpy     #$FF
33         beq     not_found
34         lda     #$01
35 not_found:
36         rts