| |
tlr
Registered: Sep 2003 Posts: 1787 |
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.
|
|
| |
Jetboy
Registered: Jul 2006 Posts: 299 |
AFAIK you cannot test it _reliably_.
That's why many demos ask about it before they start. |
| |
Zyron
Registered: Jan 2002 Posts: 2381 |
Mathematica has a SID tester that works in VICE too. |
| |
tlr
Registered: Sep 2003 Posts: 1787 |
The principle that seems most workable is sampling the waveform of voice 3 (using $d41b) and interpreting it in some way. The test in C=Hacking checks the differences of the combined triangle + sawtooth waveforms. (http://www.ffd2.com/fridge/chacking/c=hacking20.txt)
It uses a very simplistic max-value approach which does not work in VICE.
Assuming there are differences in waveform, it should be possible to detect reliably because this is done in an all digital domain. The timing of triggering the voices/reading $d41b might be very tricky though.
|
| |
Frantic
Registered: Mar 2003 Posts: 1647 |
It's possible.
The solution in mathematica is the standard one I think (waveform 5 on onscillator 3.. and check osc3 output for values above $80. However.. I've done some testing and noticed that values over $80 can show up on 6581 machines too, but they do so very seldom, so if you just read some more values than ppl normally do and use a threshold value instead of expecting zero occurances you are totally safe. (You are 99.9% safe anyway, since I actually think you need to initialize SID with random values before setting this wav$05-stuff to get any values above $80 at all on a 6581 machine.)
One interesting side issue that I have discovered (by some help of Twoflower who did the actual slavework of running a testprogram on some of his machines ;) is that waveform $05 is not exactly identical on all 8580 machines when read from oscillator 3, which is a bit weird. It seems to depend on factors external to the SID itself, or something like that. In our tests it was actually 1:1 correlated to the serial numbers of the motherboards, eh... ...but that's probably a coincidence... or not..
Anyway.. I did this testing stuff without using a REU for reading osc3, which is of course how it should be done, so proper testing remains to be done to clarify the behaviour of waveform 5 on the different chips.. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11357 |
you just play one of the combined waveforms that the 6581 can not produce and sample the output from osc3....that should be pretty reliable.
the timing test can be used for something else - detection of emulator :) |
| |
tlr
Registered: Sep 2003 Posts: 1787 |
C=Hacking 20:
start sei
lda #11
sta $d011
lda #$20
sta $d40e
sta $d40f
lda #%00110001
sta $d412
ldx #0
stx high
loop lda $d41b
cmp high
bcc ahead
sta high
ahead dex
bne loop
lda #%00110000
sta $d412
cli
lda #27
sta $d011
lda high
bmi SID8580
bpl SID6581
Mathematica (interrupts disabled, but no blanked screen):
B11F A2 18 LDX #$18
B121 A9 00 LDA #$00
B123 9D 18 D4 STA $D418,X
B126 CA DEX
B127 10 FA BPL $B123
B129 A9 02 LDA #$02
B12B 8D 0F D4 STA $D40F
B12E A9 30 LDA #$30
B130 8D 12 D4 STA $D412
B133 A0 00 LDY #$00
B135 A2 00 LDX #$00
B137 AD 1B D4 LDA $D41B
B13A 30 08 BMI $B144
B13C CA DEX
B13D D0 F8 BNE $B137
B13F 88 DEY
B140 D0 F5 BNE $B137
B142 F0 02 BEQ $B146
B144 A2 01 LDX #$01
B146 86 0B STX $0B
B148 A9 00 LDA #$00
B14A 8D 0F D4 STA $D40F
B14D 8D 12 D4 STA $D412
The same basic principle.
The mathematica code never sets the Gate. The gate is unnecessary as $d41b reads the oscillator directly.
It also uses a lower frequency and a longer detection time.
Thanks for the suggestions! I'll try it out. |
| |
Twoflower
Registered: Jan 2002 Posts: 434 |
Concerning my slave-testing of 8580's - it's clear that the waveform $05 differs from 8580 to 8580. It's also pretty clear that different SID's made at different production-runs at different factories produce slightly different results. The interesting part is that you probably can spot the factory and the time of making just by checking the combined waveform. One or two similar values, ok, that might be a coincidence. But here we have pretty much an 1:1 correlation? |
| |
tlr
Registered: Sep 2003 Posts: 1787 |
Quote: Concerning my slave-testing of 8580's - it's clear that the waveform $05 differs from 8580 to 8580. It's also pretty clear that different SID's made at different production-runs at different factories produce slightly different results. The interesting part is that you probably can spot the factory and the time of making just by checking the combined waveform. One or two similar values, ok, that might be a coincidence. But here we have pretty much an 1:1 correlation?
@Twoflower: Do you mean $05 as in sync+ringmod+gate?
|
| |
McMeatLoaf
Registered: Jan 2005 Posts: 108 |
$05 as in ringmod+gate, I think. |
| |
tlr
Registered: Sep 2003 Posts: 1787 |
Quote: $05 as in ringmod+gate, I think.
Doh! I knew that...
But what happens when you just set ringmod + gate with no selected waveform?
If you are unlucky you'll feed the ringmod xor-gate with High-Z which could result in process/temperature dependent behaviour (which is what seems to happen).
Also ringmod on voice 3 will surely depend on what voice 2 is setup to.
@Twoflower: could you please give some more details on your tests? |
... 47 posts hidden. Click here to view all posts.... |
Previous - 1 | 2 | 3 | 4 | 5 | 6 - Next |