2 ; Marco van den Heuvel, 2018-04-27
5 ; unsigned char detect_c65 (void);
7 ;/* Check for the presence of a C65/C64DX in C64 mode.
9 ; * Possible return values:
10 ; * 0x00 : C65/C64DX in C64 mode not present
11 ; * 0x01 : C65/C64DX in C64 mode present
16 .include "accelerator.inc"
21 ; Make sure the CPU is not a 65816
23 .byte $E2,$01 ; NOP #$01 on 6510 and 65(S)C02, LDA $(01,S),Y on 65CE02 and 4510, SEP #$01 on 65816
26 bcs not_found ; carry will be set on 65816
28 ; Make sure the CPU is not a 6510
29 .byte $1A ; NOP on 6510, INA on 65(S)C(E)02
33 ; Make sure the CPU is a 65CE02/4510
34 .byte $A3,$A3 ; NOP NOP on 65(S)C02, LDZ #$A3 on 65CE02 and 4510
35 .byte $6B ; NOP on 65(S)C02, TZA on 65CE02 and 4510
39 ; Switch to VICIII mode and check if $D040 is a mirror of $D000
40 ldy #C65_VICIII_UNLOCK_1
42 ldy #C65_VICIII_UNLOCK_2