Konami SCC
This page was last modified 12:36, 31 July 2016 by Rderooy. Based on work by NYYRIKKI.

Links:

Routine to detect SCC-slot: (See SlotID)

;------------------------------------------
; SCCDETECT (Made by : NYYRIKKI)
; Input: (None)
; Output:
;   Success:
;     CF = NC
;     SCC SLOT #8000-#BFFF
;     A = SlotID
;
;   Fail:
;     CF = C
;     (Random slot on #8000-#BFFF)
; Changes: All registers
;------------------------------------------
 
SCCDETECT:
         LD D,#FF
         LD HL,#FCC1
 
.MAINL:
         INC D
         LD A,4
         CP D
         SCF
         RET Z
 
         LD A,(HL)
         INC HL
         AND #80
         JR Z,.MAINTST
         CALL .SUBTST
         JR C,.MAINL
         RET
 
.MAINTST:
         LD A,D
         CALL .TESTSLOT
         JR C,.MAINL
         LD A,D
         RET
 
;-----------------------
.SUBTST
         LD E,#FC
.SUBLOOP:
         LD A,4
         ADD A,E
         CP 16
         SCF
         RET Z
         LD E,A
         OR D
         OR #80
         LD C,A
         CALL .TESTSLOT
         JR C,.SUBLOOP
         LD A,C
         RET
 
 
.TESTSLOT:
         PUSH BC
         PUSH DE
         PUSH HL
 
         LD H,#80
         CALL #24
 
 
         LD A,(#9000)
         LD D,A
         LD A,#3F
         LD (#9000),A
         LD HL,#9800
         LD E,(HL)
         XOR A
         LD (HL),A
         LD A,(HL)
         OR A
         JR NZ,.NOSCC
         DEC A
         LD (HL),A
         LD A,(HL)
         INC A
         JR NZ,.NOSCC
         LD A,(#9000)
         CP #3F
         JR Z,.NOSCC
         XOR A
         JR .EXIT
.NOSCC
         LD (HL),E
         LD A,D
         LD (#9000),A
         SCF
.EXIT
         POP HL
         POP DE
         POP BC
         RET