| |
ThunderBlade
Registered: Jan 2002 Posts: 78 |
resetting the SID
Hi, not sure if this is an awkward question, but... what's the proper way to reset the SID?
When starting various musics, I sometimes, very rarely, notice they sound different like all the other times. It seems to depend which music I played previously!
Inbetween playing musics, currently I just fill $D400 - $D418 with a counting down loop (starting with $D418) with zeroes. Is there a recommended better way?
|
|
... 44 posts hidden. Click here to view all posts.... |
| |
j0x
Registered: Mar 2004 Posts: 215 |
Quote:
Probably enabling the filter for some voice(s) but not selecting any filter type results in silence then.. I guess.
Sounds like Frantic is probably on the right track. If this is true, is it only true for SID emulation?
Sorry for side-tracking the thread slightly, btw... :( |
| |
Frantic
Registered: Mar 2003 Posts: 1661 |
Sidwave: Sorry if I am rude now, but I have to say that that was quite a crappy answer to his question. To begin with, $d41d is not a valid SID register at all, and there is no need to write anything to the registers $d419-$d41c which are purely output registers. ...and the whole thread began on the assumption that something more than just writing zeroes to the SID would be relevant.
j0x: I think it may very well be true on the real hardware too, but I don't have it right here where I am at the moment, so I can't tell for sure. |
| |
SIDWAVE Account closed
Registered: Apr 2002 Posts: 2238 |
ok Frantic,
i didnt make a sidplayer yet, but what i think will work is:
clear d418, and do a hard restart with no sound, then set filter type.
now the sid will have a filter type when the first note is played, and the ADSR will be reset.
i have a sound like that in SDI:
waveform:
09 00
.01 00
ff .
it resets the sid (as of what i know),
and my filters begin at the correct spot.
this any help ? |
| |
SIDWAVE Account closed
Registered: Apr 2002 Posts: 2238 |
this positively works 100% (on 6581 R4 AR anyway), its from a tune i made, i used it many times:
ADSR: 0002
HARD RESTART
FILTER type: 1F (lowpass, max resonance)
WAVEFORM:
01 .
FF .
just a 1.
work every time. |
| |
Soren Account closed
Registered: Dec 2001 Posts: 547 |
SIDwave: what if you don't want to start the tune with hard restart? ;-) |
| |
SIDWAVE Account closed
Registered: Apr 2002 Posts: 2238 |
/MUSICIANS/H/Harries_Jan/Equations.sid
Jeff, its just a sid reset that works, that what he asked. |
| |
Devia
Registered: Oct 2004 Posts: 403 |
Quoting FranticFilter regs, frequency regs, and pulse width regs should simply be set to 00.
I would first set ADSR regs to 00, then set the control registers to $08 to set gate off and turn oscillators off (what Jeff suggested, sort of). Then you should preferably wait for a while (2-3 frames should be completely safe) to make sure that the internal ADSR counters are reset properly.
...and finally, if everything is silent when you try to play your tune, just set global sid volume to $0f before initializing the tune. (The tune init routine really should take care of this itself though, so I guess you won't ever need that.)
Quoting iAN CooGor even $1f as probably is best for most tunes, happened also that some tunes lacked a proper init (yes there are) and setting $0f would make the tune play with one voice muted =)
sooo.. to recap, the issues may be ADSR related and related to "incomplete" music init routines, right?
And based on at least 10489 tunes having hardcoded low-pass filter somewhere in the code, the assumption is that an incomplete music init routine is best supported by a preconfigured low-pass filter, right?
Since KERNAL sets $d418 to $00, I'm curious as to what has initialized $d418 to something other than that in the original code? ..or maybe they are just bad (incomplete) rips?
That aside,
Quoting FranticProbably enabling the filter for some voice(s) but not selecting any filter type results in silence then.. I guess.
You guessed right.
So to sum up: A SID reset routine would have to look something like this:
SIDRST:
ldx #$18
lda #$00
: sta $d400,x
dex
bpl :-
lda #$08
sta $d404
sta $d40b
sta $d412
ldx #$03
lda #$ff
: cmp $d012
bne :-
dex
bpl :-
lda #$00
sta $d404
sta $d40b
sta $d412
lda #WhateverValueUThinkIsMosLikelyToMakeSenseIfWhateverYouJumpToNextDoesntSetI tItself
sta $d418
rts
|
| |
j0x
Registered: Mar 2004 Posts: 215 |
Devia:
Quote:
You guessed right
Did you check on real hardware?
And, fwiw, your delay loop probably doesn't do what it's intended to. It may make a number of "dex"'s while $d012 equals $ff.
|
| |
ThunderBlade
Registered: Jan 2002 Posts: 78 |
This is a great discussion. Very helpful indeed, thank you all! |
| |
JackAsser
Registered: Jun 2002 Posts: 2038 |
Quote: Devia:
Quote:
You guessed right
Did you check on real hardware?
And, fwiw, your delay loop probably doesn't do what it's intended to. It may make a number of "dex"'s while $d012 equals $ff.
Indeed that wait will fail. Patch to:
ldx #$03
: bit $d011
bpl *-3
bit $d011
bmi *-3
dex
bpl :-
|
Previous - 1 | 2 | 3 | 4 | 5 | 6 - Next |