]> git.sur5r.net Git - cc65/blob - libsrc/c64/acc_detect_c128.s
Merge pull request #740 from laubzega/master
[cc65] / libsrc / c64 / acc_detect_c128.s
1 ;
2 ; 2018-04-20, Marco van den Heuvel
3 ; 2018-04-26, Greg King
4 ;
5
6 ; unsigned char detect_c128 (void);
7 ;
8 ;/* Check for the presence of a C128 in C64 mode.
9 ; *
10 ; * Possible return values:
11 ; * 0x00  : C128 in C64 mode not present
12 ; * 0x01  : C128 in C64 mode present
13 ; */
14
15         .export         _detect_c128
16
17         .include        "accelerator.inc"
18
19 _detect_c128:
20         ldx     #>$0001
21         lda     #<$0001
22
23 ; Make sure the CPU is an 8502.
24         .byte   $3A     ; NOP on 8502, DEA on 65(S)C(E)02, 4510, and 65816
25         beq     detect_end
26
27 ; Make sure a C128 VIC-IIe is present.
28         ldy     C128_VICIIE_CLK
29         cpy     #$FF
30         bne     detect_end
31         txa             ; return zero when not VIC-IIe
32 detect_end:
33         rts