1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-09 01:28:58 +00:00
cc65/libsrc/c64/acc_detect_c64dtv.s
2018-04-14 10:40:13 -07:00

44 lines
895 B
ArmAsm
Executable File

;
; Marco van den Heuvel, 2018-04-14
;
; unsigned char detect_c64dtv (void);
;
;/* Check for the presence of the C64DTV.
; *
; * Possible return values:
; * 0x00 : C64DTV not present
; * 0x01 : C64DTV present
; */
.export _detect_c64dtv
.include "accelerator.inc"
_detect_c64dtv:
ldy C64DTV_Extended_Regs
lda #$00
tax
; Make sure the CPU is a 6510
.byte $1A ; NOP on 8502, INA on 65(S)C(E)02, 4510 and 65816
bne not_found
lda #$01
sta C64DTV_Extended_Regs
; Check if $D000 is mirrored at $D040
lda $D040
cmp $D000
bne found
inc $D040
cmp $D000
bne not_found
found:
lda #$01
.byte $2C
not_found:
lda #$00
sty C64DTV_Extended_Regs
rts