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 > How do I reliably detect 6581/8580 sid?
2006-08-22 14:18
tlr

Registered: Sep 2003
Posts: 1714
How do I reliably detect 6581/8580 sid?

There was an article in C=Hacking, but that does not work very well in VICE for example.
Maybe VICE's emulation is borked though.

I remember seeing a detailed analysis of the waveforms somewhere, but I can't seem to find it now.
 
... 47 posts hidden. Click here to view all posts....
 
2010-10-02 10:54
Frantic

Registered: Mar 2003
Posts: 1627
@MC: While it is nice to know how to check for various things, I get curious about what you will use this for? Will you make custom filter tables to make the tunes sound as similar as possible on different SID models and SID-emulation engines, or what?
2010-10-02 12:20
MC
Account closed

Registered: Jul 2009
Posts: 71
Exactly.
2010-10-02 12:27
iAN CooG

Registered: May 2002
Posts: 3132
ok, here's a new version =)
; Detect fastSID/reSID/reSID-fp/Hoxs/CCS/Frodo
; Just measure how much $d418 takes to decay from $1f to $00
; Experiment by iAN CooG, noticed first time in Excalibur intro exc-01
; Thanks to MC/Dutch USA-Team for checking CCS3 and real C64 timings
; Note: can't detect emulated sidmodel 6581/8580, values overlap.
; values   | Engine
; ---------+--------
; xx xx 01 | hoxs     (1cc00-)
; xx 07 00 | residfp  (7ca-7df)
; bx 03 00 | resid    (3bc-3cf)
; 8x 03 00 | ccs3     (38a-3a0)
; xx 01 00 | ccs2     (10f-11f)
; 7x 00 00 | real c64 (07d-08f)
; 0x 00 00 | fastsid  (003-005)
; 01 00 00 | vice nosound (001)
; ff ff ff | frodo    (never decays)

_id_hoxs     = 0
_id_residfp  = 1
_id_resid    = 2
_id_ccs3     = 3
_id_ccs2     = 4
_id_realc64  = 5
_id_fastsid  = 6
_id_nosound  = 7
_id_frodo    = 8

    *=$0801
    word eop
    word 7102
    byte $9e,"2059"
eop byte 0

    lda #0
    sta $0400
    sta $0401
    sta $0402

    sei
    lda #$1f
    sta $d418
loop
    inc $0400
    bne nohi
    inc $0401
    bne nohi
    inc $0402
    lda $0402
    cmp #$02
    beq check ; or directly: beq frodo
nohi
    lda $d418
    bne loop
check
    lda $0402
    beq vice
    cmp #$02
    beq frodo
    bne hoxs
vice
    lda $0401
    bne chkrs
    lda $0400
    cmp #$70
    bcs realc64
    cmp #$03
    bcs fastsid
    bcc nosound
chkrs
    cmp #$04
    bcs residfp
    cmp #$03
    bcc ccs2
rscc3
    lda $0400
    cmp #$b0
    bcs resid
ccs3
    ldx #_id_ccs3
    byte $2c
ccs2
    ldx #_id_ccs2
    byte $2c
resid
    ldx #_id_resid
    byte $2c
residfp
    ldx #_id_residfp
    byte $2c
fastsid
    ldx #_id_fastsid
    byte $2c
nosound
    ldx #_id_nosound
    byte $2c
hoxs
    ldx #_id_hoxs
    byte $2c
frodo
    ldx #_id_frodo
    byte $2c
realc64
    ldx #_id_realc64
    lda offtablel,x
    ldy #>stringtable
    ;cli ($ffd2 already clears int flag)
    jmp $ab1e

stringtable
shoxs     byte "HOXS64"  ,0
sresidfp  byte "RESID-FP",0
sresid    byte "RESID"   ,0
sccs3     byte "CCS 3"   ,0
sccs2     byte "CCS 2"   ,0
srealc64  byte "REAL C64",0
sfastsid  byte "FASTSID" ,0
snosound  byte "NO SOUND",0
sfrodo    byte "FRODO"   ,0

offtablel
          byte <shoxs
          byte <sresidfp
          byte <sresid
          byte <sccs3
          byte <sccs2
          byte <srealc64
          byte <sfastsid
          byte <snosound
          byte <sfrodo
2010-10-02 13:33
assiduous
Account closed

Registered: Jun 2007
Posts: 343
using d418 fade out time to detect the sid model is abit risky. this thing has a very analogue nature so it depends on temperature and varies in a wide range. you will likely get different results on different chips and even on 1 chip when you test it cold and warmed up. some sids take so much time to drop bits from the write only registers that they fail the emufuxxor test.

i`ve run the program on an 8580,the first test shortly after the bootup printed C but 20 minutes later it changed its mind for good: screen shot

Sounddemon`s method can be trusted the most.
2010-10-02 14:50
MC
Account closed

Registered: Jul 2009
Posts: 71
Things come down to ranges of values of the low byte. In the current emulators I'm getting proper results, in CCS2 its hard to distinguish 8580 from 6581 emulation (but that's old crap anyway).

I'll up a testproggie and edit this post shortly.

Edit: http://tanx0r.org/mc/iantestprog.prg

Plz run that and tell me if the results are correct. TIA.

2010-10-02 15:39
MC
Account closed

Registered: Jul 2009
Posts: 71
Now that I come to think about it, I already have conclusive results when combining the results from D418 and D41B tests.

I know which SID emulation is running and I detected the SID model being emulated in all situations but vice/fastsid.

Knowing the situation in which a song was created will allow people to compensate. Also, an editor can have seperate settings for different SID models and even emulations. Knowledge == power.
2010-10-02 20:19
Frantic

Registered: Mar 2003
Posts: 1627
But... :)

Even within the category of "6581" sids there is a considerable variance in the filter characteristics, and I guess the same also the case when using resid-fp for example, depending on which 6581 variant (or 8580 variant) you choose and so forth? :)

Personally I eventually gave up on the filter issue around one or two years ago, hehe.. :) (Well, I do some minor adjustment depending on whether it is 8580 or 6581, but more than that... nah..)

Anyway, it is interesting to see what you come up with, so I am not trying to discourage anyone or so. Just providing my own take on the matter.

//FTC
2010-10-02 21:16
MC
Account closed

Registered: Jul 2009
Posts: 71
Well if we're gonna detect a SID let's just do the best possible job while at it... Afterall the question isn't a simple "why" but rather "why not"...
2010-10-03 20:11
MC
Account closed

Registered: Jul 2009
Posts: 71
Okay. More testing has been done and I added JAC64 to the list of recognized emulators. iAN is correct in stating you can't judge whether you're dealing with 6581 or 8580 emulation from the D418 timing test.

I have created wider margins on the recognized ranges as well so it should really always correctly detect SID + emulation now through combined D418 timing and D41B testing for high bit.

Note: EMU64 doesn't give any reliable results and is recognized as VICE/NOSOUND.

Here's the table:
;			     min max med  hi sidcode
recogtab:		dc.b $00,$00,$CC,$01,0		; HOXS, 8580
			dc.b $A0,$F0,$07,$00,1		; VICE, RESIDFP
			dc.b $B0,$E0,$03,$00,2		; VICE, RESID
			dc.b $70,$B0,$03,$00,3		; CCS3.X
			dc.b $01,$28,$01,$00,4		; CCS2.X
			dc.b $20,$FF,$00,$00,5		; Real C64
			dc.b $02,$0F,$00,$00,6		; VICE, FASTSID
			dc.b $00,$01,$00,$00,7		; VICE, NOSOUND
			dc.b $00,$00,$00,$02,8		; FRODO
			dc.b $C8,$E8,$01,$00,9		; JAC64


Testproggie: http://tanx0r.org/mc/iantestprog2.prg

2012-05-27 17:15
Jak T Rip

Registered: Feb 2002
Posts: 39
Hi guys,

I tested the latest test program with my real C64 and
- the SID and VIC type are reliably detected (8580 PAL 50Hz)
- emu type is detected as
1) Unknown when I have no additional HW on (or with SCPU in 1Mhz mode)
2) Frodo in case I have a SuperCPU running in 20Mhz

The displayed values for normal unenhanced C64II are
xx:98:00

The first value is completely unreliable. I get values between 1x and fx.
The second value is very stable. I get values around 98, sometimes 99 or 9a, but never far off.
Previous - 1 | 2 | 3 | 4 | 5 | 6 - Next
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
alwyz/udi
A3/AFL
Medicus
Stakker/Kohina
kbs/Pht/Lxt
Walt/Bonzai
WVL/Xenon
Guests online: 130
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.8)
4 Acidchild  (9.7)
5 Starlight  (9.6)

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