Login
Forum Help



Post Your Message
Username: (Login)

Topic:
Message:
 


Previous Messages
Posted By

KiCHY
on 2016-05-19
05:04:13
 Re: How to detect SID card?

Thanx for the solutions, I'll use these methods then, depending on requirements and avaliable space.

Posted By

siz
on 2016-05-18
04:27:18
 Re: How to detect SID card?

Thanks, it's a typo. (Originally there were symbols there and when I changed I've accidentally deleted the <> signs) I've fixed the source too. (BTW it's 64Tass)

Posted By

gerliczer
on 2016-05-18
02:43:04
 Re: How to detect SID card?

siz,

What kind of assembler do you use that is capable of compiling this:
ldx #$fd40
ldy #$fd40
jsr io_detsidaddr
into a form that meets this specification:
;=======================================
; In: XR: SID address low
; YR: SID address high
; Out: AC: 0: not found $ff: found
;=======================================
Or what am I missing?

Posted By

siz
on 2016-05-18
04:26:53
 Re: How to detect SID card?

My solution (yeah, a bit overcomplicated but detects NST SID card and 6581/8580 too):

; Output:
; io_soundtype:
; bit 7: 1: NAE (NST Audio Extension - BSz SID Card), 0: legacy SID Card
; bit 6-0: 0: TED only, 1: 6581 2: 8580
; io_sidbase: SID address
;================================================
sidptr = 2

lda #0
sta io_soundtype

ldx #<$fd40
ldy #>$fd40
jsr io_detsidaddr
cmp #$ff
beq hassid
ldx #<$fe80
ldy #>$fe80
jsr io_detsidaddr
cmp #$ff
bne nosid
hassid
inc io_soundtype
jsr detsidtp
jsr detnae
; Do whatever you need with SID
rts
nosid
; Do whatever you need without SID
rts

;=======================================
; In: XR: SID address low
; YR: SID address high
; Out: AC: 0: not found $ff: found
;=======================================

io_detsidaddr
lda #0
sta io_sidbase
sta io_sidbase+1

stx sidptr
sty sidptr+1

ldy #24
- sta (sidptr),y
dey
bpl -

ldy #25
lda (sidptr),y
iny
and (sidptr),y
rts

; Detect SID chip type
; original version from Reflex Math demo
;=======================================

detsidtp
lda #1
sta io_soundtype

;Set a low frequency for Oscillator
; (Voice 3) #$0200 which is somewhere
; between B-0 and C-1, according to demo

ldy #15
lda #$02
sta (sidptr),y

;Set Sawtooth and Triangle waveforms for
;voice 3 and start release of ADSR

ldy #18
lda #%00110000
sta (sidptr),y

;Check if output of voice 3 ever goes
;higher than $80. It's only possible on
;new SID chip (8580) and never on the
;old one (6581)

ldy #0
ldx #0
sty ystore
loop2 ldy #27
lda (sidptr),y
bmi newsid
dex
bne loop2
ldy ystore
dey
sty ystore
bne loop2
beq oldsid
newsid
inc io_soundtype
oldsid
rts

;=======================================
; Detect NST SIDCard
;=======================================

detnae
lda #%11100000
sta nae_control+13
ldx #0
- lda nae_control+15
cmp nae_control+15
bne +
dex
bne -
and #%11100000
cmp #%11100000
beq + ; Legacy SID-Card
lda nae_control+15
beq + ; VICE happy
lda io_soundtype
ora #%10000000
- sta io_soundtype
+ rts

io_soundtype .byte 0
io_sidbase .word 0


Posted By

Chronos
on 2016-05-17
14:21:17
 Re: How to detect SID card?

;---
LDA #$00 ; start with frq set
STA $fe98
LDA #tlcfrq >> 8
STA convertercall+2
;---
LDA #$00 ; sid card detection
STA $07f8 ; sid card detection
LDA #$ff ; sid card detection
STA $fe99 ; sid card detection
LDA $fe99 ; sid card detection
CMP #$ff ; sid card detection
BNE siddet ; sid card detection
LDA #$01 ; sid card detection
STA $07f8 ; sid card detection
siddet LDA $07f8 ; sid card detection
CMP #$00 ; sid card detection
BEQ foprogi2 ; start with frq player
;---
LDA #sidplay >> 8
STA convertercall+2
LDA #$00
STA $ff11 ; start with sid set
LDA #$1f
STA $fe98
STA $d404
;---
foprogi2

Posted By

gerliczer
on 2016-05-17
14:00:11
 Re: How to detect SID card?

Proky wrote about it in Yellow Pages #1. The documentation of BSZ's SID card also has some information about this, IIRC.

Posted By

Csabo
on 2016-05-17
13:36:27
 Re: How to detect SID card?

Sorry, I don't remember the source, but I have this code. You can detect it at any of the 2 usual base addresses ($FD40, $FE80).

1) Write $41 to base address + $12.
2) Write $55 to base address + $1B and wait a few cycles.

Write a loop for 256 times that checks:
3) Check base address + $1B AND #$FE.
4) If it's $00, keep looping. When the loop ends, there IS a SID card.
5) If it's NOT $FE, there's no SID card, you can exit the loop.

Hopefully it makes sense happy There might be simpler ways, but AFAIK this works reliably and it's pretty short/fast.

Posted By

KiCHY
on 2016-05-17
12:45:41
 How to detect SID card?

Hi,

What's the way to detect if any SID card present (all possible types)? Is there a built-in way into the cards itself?
PS: I don't have any cards, it would be cool to autodetect it and forget those "do you have a sid card..." questions.

Bests,
KiCHY


Copyright © Plus/4 World Team, 2001-2024