User Tools

Site Tools


base:detecting_sid_type_-_safe_method

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
base:detecting_sid_type_-_safe_method [2015-04-17 04:31] – external edit 127.0.0.1base:detecting_sid_type_-_safe_method [2022-05-19 10:58] (current) ftc
Line 1: Line 1:
 +====== Detecting Sid Type - safe method ======
 +
 +This SID detection routine is based on the fact that there is a one cycle delay in the oscillator on 8580 compared to 6581 when turned on.
 +
 +<code>
 + ;SID DETECTION ROUTINE
 +
 + ;By SounDemon - Based on a tip from Dag Lem.
 + ;Put together by FTC after SounDemons instructions
 + ;...and tested by Rambones and Jeff.
 +
 + ; - Don't run this routine on a badline
 +
 + sei ;No disturbing interrupts
 + lda #$ff
 + cmp $d012 ;Don't run it on a badline.
 + bne *-3
 +
 + ;Detection itself starts here
 + lda #$ff ;Set frequency in voice 3 to $ffff 
 + sta $d412 ;...and set testbit (other bits don't matter) in VCREG3 ($d412) to disable oscillator
 + sta $d40e
 + sta $d40f
 + lda #$20 ;Sawtooth wave and gatebit OFF to start oscillator again.
 + sta $d412
 + lda $d41b ;Accu now has different value depending on sid model (6581=3/8580=2)
 + lsr ;...that is: Carry flag is set for 6581, and clear for 8580.
 + bcc model_8580
 +model_6581:
 + [...]
 +
 +model_8580:
 + [...]
 +</code>
 +