| |
Shadow Account closed
Registered: Apr 2002 Posts: 355 |
Detecting presence of dual-SID?
As I understand it, most dual SID cards map either to $d420 or $de00.
Since no SID is at $de00 normally, my idea to detect here is to write *something* to *$de00+some SID register offset* and then later do a read back and if value = some specific value, then it can be assumed that a SID chip was attached.
For $d420 I guess it's a bit trickier, since normally SID-regs are mirrored here. I am thinking that doing the same as above, but additionally reading that same register from the normal $d400-based SID as well, and if only the $d420 based version was affected, it could be assumed that a second SID was present.
Anyone have any more concrete tips on how to proceed with this - ie. tips on what to write to which SID register and what to expect to read back, and also if the general idea is correct? |
|
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
TLR (i believe) once posted a program that does this... sf website is down atm apparently, you can find it in testprogs/SID/mapping/ |
| |
iAN CooG
Registered: May 2002 Posts: 3193 |
was already discussed here
https://csdb.dk/forums/?roomid=14&topicid=99181&showallposts=1
the idea is to set $d41b to generate random numbers, and check which of the other mirrored regs (add $20) is getting only 0 by peeking it a couple of times: that's the address of an additional sid. This is how I did it, only checking d420-d7e0.
zfb=$fb
*=$0801
word eop
word 7102
byte $9e,"2061",0
eop
word 0
jsr zerosid
ldx #$d4
stx zfb+1
lda #$81 ;init random
ldy #$12
sta (zfb),y
lda #$ff
ldy #$0f
sta (zfb),y
loopmirr
lda zfb
clc
adc #$20
sta zfb
bne noinczfc
inc zfb+1
lda zfb+1
cmp #$d8
beq finished
noinczfc
ldx #$0
tryagain
ldy #$1b
lda (zfb),y
bne loopmirr
inx
cpx #10 ; if random gets 0 for some times it means it's not a mirror of d41b
bne tryagain
mirrorfound
ldy #0
lda zfb+1
jsr cciph
lda zfb
jsr cciph
finished
ldy #>output
lda #<output
jsr $ab1e
; 0 again in output2 for a 2nd run
ldy #0
tya
jsr cciph
lda #0
jsr cciph
zerosid
lda #0
tay
sta zfb
ldx #$d4
lp0
stx zfb+1
lp1
sta (zfb),y
iny
bne lp1
inx
cpx #$d8
bne lp0
rts
cciph
pha
lsr
lsr
lsr
lsr
jsr ccipher2
pla
and #$0f
ccipher2
clc
adc #$30
cmp #$3a
bcc nolett
adc #$06
nolett
sta output2,y
iny
rts
output byte "2ND SID @ $"
output2 byte "0000"
byte $0d,$00
|
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
I guess it is obvious, but don't forget that there might be other hardware (cartrdiges etc) that use the $de00 area, so don't just write stuff blindly and hope for the best. :)
By the way, I seem to remember that I have seen a second sid at $d5xx in some cases too. ...and of course $dfxx is a possibility. For example, I had some sort of stereo sid cart that could be configured to use either $dexx or $dfxx, so if you had a cartridge port expander, you could use your normal cartridge at $dexx and have a second sid at $dfxx. |
| |
encore
Registered: Aug 2010 Posts: 67 |
One thought. With 1541 ultimate, where you can setup the sid emulation with snooping addresses, those will probably not be detectable by software because of the way it works, no? |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
i dont see why not... it all depends on whether it properly emulates OSC3/ENV3 or not. |
| |
soci
Registered: Sep 2003 Posts: 480 |
Snooping implies it's write only. The OSC3/ENV3 registers are only "visible" when configured to the IO1/IO2 area to avoid bus collision with the on-board SID. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
for the d4xx-d7xx range, ok. for regular IO1/IO2 it should work :) |