Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Detecting presence of dual-SID?
2016-01-25 12:48
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?
2016-01-25 13:08
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/
2016-01-25 13:10
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
2016-01-25 13:23
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.
2016-01-25 15:42
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?
2016-01-25 15:43
chatGPZ

Registered: Dec 2001
Posts: 11386
i dont see why not... it all depends on whether it properly emulates OSC3/ENV3 or not.
2016-01-25 20:55
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.
2016-01-25 21:00
chatGPZ

Registered: Dec 2001
Posts: 11386
for the d4xx-d7xx range, ok. for regular IO1/IO2 it should work :)
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Bitbreaker/Performers
Sychamis
Isildur/Samar
csabanw
Holy Moses/Role
Steffan/BOOM!
AArt1256/MoonShine
rambo/Therapy/ Resou..
E$G/HF ⭐ 7
Didi/Laxity
Linus/MSL
Guests online: 129
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Mutetus  (9.7)
3 Jeroen Tel  (9.7)
4 Linus  (9.6)
5 Stinsen  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.066 sec.