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

Both sides previous revision Previous revision
base:detecting_sid_type_-_safe_method [2015-06-12 20:59]
groepaz
base:detecting_sid_type_-_safe_method [2015-06-13 08:07] (current)
moloch
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
 + ; - Won't work in VICE (always detects 6581) unless resid-fp emulation is enabled
 +
 + 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 doesn't matter) in $d012 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>
 +
  
base/detecting_sid_type_-_safe_method.txt ยท Last modified: 2015-06-13 08:07 by moloch