]> git.sur5r.net Git - cc65/blob - libsrc/c64/acc_detect_c64dtv.s
Added c64dtv accelerator code and documentation.
[cc65] / libsrc / c64 / acc_detect_c64dtv.s
1 ;
2 ; Marco van den Heuvel, 2018-04-14
3 ;
4
5 ; unsigned char detect_c64dtv (void);
6 ;
7 ;/* Check for the presence of the C64DTV.
8 ; *
9 ; * Possible return values:
10 ; * 0x00  : C64DTV not present
11 ; * 0x01  : C64DTV present
12 ; */
13
14         .export         _detect_c64dtv
15
16         .include        "accelerator.inc"
17
18 _detect_c64dtv:
19         ldy     C64DTV_Extended_Regs
20         lda     #$00
21         tax
22
23 ; Make sure the CPU is a 6510
24         .byte   $1A                   ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816
25         bne     not_found
26         lda     #$01
27         sta     C64DTV_Extended_Regs
28
29 ; Check if $D000 is mirrored at $D040
30         lda     $D040
31         cmp     $D000
32         bne     found
33         inc     $D040
34         cmp     $D000
35         bne     not_found
36 found:
37         lda     #$01
38         .byte   $2C
39 not_found:
40         lda     #$00
41         sty     C64DTV_Extended_Regs
42         rts
43