Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user Jedfox ! (Registered 2024-05-28) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Writing twice to same $D4xx register?
2013-10-15 05:17
Mace

Registered: May 2002
Posts: 1799
Writing twice to same $D4xx register?

Is there a useful purpose for writing twice to the same SID register with different values within one call of a player routine?
In other words: if I'd capture the output of a SID player routine to RAM and write that to the SID later, would that work?
Obviously, 'doubles' would be missed, then.
2013-10-15 06:22
j0x

Registered: Mar 2004
Posts: 215
RanSID does this, and it works for many music players. However, as you say, doubles would be missed, e.g., setting and subsequently clearing the gate bit within the same player call. Also, the order of register writes would be missed (important for ADSR restart and general player "flavour").
2013-10-15 08:56
Mixer

Registered: Apr 2008
Posts: 422
In the past some players may have cleared gate in the beginning and set it on same call. Well, at least I made some without knowing any better.

Nowadays, I believe testbit restart sounds are the main reason for two or more writes to control register during one call.

There has been demo routines that have I/O off and later on collect sid values from RAM under I/O for later writing.

Anyway, if there is a replay of stored values, ADSR should be written before ctrl register, often these go hand in hand. Especially in hardrestarted or ADSR manipulated sounds.

Then there are the various sample play routines, which are altogether a different story. These require cycle exact sampling and replay of register values.

Is this about using Resid to play tunes? as a test, I've successfully played jsidplay-sid-dumps of single and multispeed tunes with resid, with no significant errors to original. Imho, important thing is to use same register write order(ctrl register vs. adsr) as in original.
2013-10-15 09:11
JackAsser

Registered: Jun 2002
Posts: 1994
Quote: Is there a useful purpose for writing twice to the same SID register with different values within one call of a player routine?
In other words: if I'd capture the output of a SID player routine to RAM and write that to the SID later, would that work?
Obviously, 'doubles' would be missed, then.


Why not make a proper debugger, i.e. insert a BRK infront of the current instruction and have a ISR parse the instruction and determine the OP-code. It's quite easy to see if it would result in a write to $d4xx.
2013-10-15 16:08
ChristopherJam

Registered: Aug 2004
Posts: 1381
Yes, there is frequently a useful purpose in writing twice. As others have said, blipping test bit is significant.

There's no hard and fast rule about the 'correct' ordering of ADSR vs gate, either - if a routine writes ctrl before ADSR but you play the writes back the other way round, you can easily jam the envelope for 30ms.
2013-10-16 13:30
Mace

Registered: May 2002
Posts: 1799
The reason why I ask this is that I'd like to read the values written to $D4xx to make some sort of visual response to what is happening inside the SID.

In restrospect, I was aware of that ADSR thing.
2013-12-05 02:15
theWizard
Account closed

Registered: Jul 2007
Posts: 109
use a memory buffer delay write it to the sid also usefull if your sids actually under the d400 range or de00 to dfff, io1 and 2.
2013-12-05 02:18
theWizard
Account closed

Registered: Jul 2007
Posts: 109
Quote: The reason why I ask this is that I'd like to read the values written to $D4xx to make some sort of visual response to what is happening inside the SID.

In restrospect, I was aware of that ADSR thing.


ok like i said write to somewhere else in memory , read what you need to then direct it back to the sid.

example instead of

tya
sta $d4xx

..

tya
sta $40xx

read...

lda $40xx
sta $d4xx

etc or disable the sid , read it , enable the sid and write it which would be easier.

just do it from 0 to 1f in a loop but check for changed values only or it will sound a bit knackerd.

btw matey il tell you a trick , most players you can find locations where they activate each voice etc in the player its self , good for graphical effects in time to the voices and sounds its much easier the second way.
2013-12-05 15:05
Rough
Account closed

Registered: Feb 2002
Posts: 1829
Quote:
btw matey il tell you a trick , most players you can find locations where they activate each voice etc in the player its self , good for graphical effects in time to the voices and sounds its much easier the second way.


Wow. Great trick. lol
2013-12-05 15:14
theWizard
Account closed

Registered: Jul 2007
Posts: 109
call me paul daniels blondie.lol
2013-12-05 15:21
Rough
Account closed

Registered: Feb 2002
Posts: 1829
Someone delete this lamer. He's starting to send illiterate mails to me.

"[picture of my csdb entry]

sup blondie =)

TROLOLOL!"

Don't need no moron stalking me.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
CA$H/TRiAD
Medicus
johny
rambo/Therapy/ Resou..
Andy/AEG
Guests online: 105
Top Demos
1 Next Level  (9.8)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Aliens in Wonderland  (9.6)
6 Edge of Disgrace  (9.6)
7 No Bounds  (9.6)
8 Comaland 100%  (9.6)
9 Uncensored  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Happy Birthday Dr.J  (9.7)
2 Layers  (9.6)
3 It's More Fun to Com..  (9.6)
4 Cubic Dream  (9.6)
5 Party Elk 2  (9.6)
6 Copper Booze  (9.6)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Rainbow Connection  (9.5)
9 Dawnfall V1.1  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.4)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 SHAPE  (9.3)
Top Swappers
1 Derbyshire Ram  (10)
2 Jerry  (9.8)
3 Violator  (9.8)
4 Acidchild  (9.7)
5 Starlight  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.037 sec.