1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-10 10:04:50 +00:00
cc65/libsrc/c64/acc_detect_c64dtv.s
Greg King c92a3c5bd5 Improved the accelerator code. Fixed an infinite loop.
Removed the execute permissions from some files.
2018-04-26 05:46:34 -04:00

45 lines
926 B
ArmAsm

;
; 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
ldx $D000
; 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
cpx $D040
bne found
inc $D000
cpx $D040
bne not_found
found:
lda #$01
.byte $2C
not_found:
lda #$00
stx $D000
ldx #$00
sty C64DTV_Extended_Regs
rts