|
Post by nojoopa on Nov 19, 2008 16:40:32 GMT -5
As it is commonly known, the C64DTV SID implementation (DTVSID) doesn't have filters, but has 2 new registers. However, these are not the only differences, as pointed out by some test cases [1]. I started to write various testprogs [2] to figure out some of these odd glitches. Here's some results. NOTE: Since I don't have a real C64 at the moment, I used VICE(plus) and reSID for comparison. Audio was captured with a soundcard due to the lack of an oscilloscope. 1. OSC3/RND ($D41B): ...seems to return "random" values regardless of waveform. I guess it's returning the noise waveform values, but this is tricky to verify. Use "sidtestm" to see this. 2. Envelope shape during decay ("adsr" [2]):  The data is acquired by reading $D41C with the DMA. On DTVSID, the envelope decrease is linear during decay. 3. Envelope values ($D41C) during sustain ("envcmp" [2]): Sustain | DTVSID | reSID [3] | 0 | 00 | 00 | 1 | 1f | 11 | 2 | 20 | 22 | 3 | 3f | 33 | 4 | 40 | 44 | 5 | 5f | 55 | 6 | 60 | 66 | 7 | 7f | 77 | 8 | 80 | 88 | 9 | 9f | 99 | a | a0 | aa | b | bf | bb | c | c0 | cc | d | df | dd | e | e0 | ee | f | ff | ff |
On the DTVSID, the envelope values for adjacent sustain levels differ either by $01 or by $1f. One could think that this means f.ex the sustain levels 8 and 7 have about the same volume, but... 4. Audio output during decay ("adsr" [2]):  Notice the odd "spaces" in the audio when volume == $8; here's a zoomed version from the one in the middle:  With "sidtestm" [2] it's easy to verify that the combinations volume = {1, 2, 4, 8} and sustain = {2, 4, 8} are actually silent. More about this later... 5. Waveforms ("waveform" [2]):  The picture shows all the different waveform combinations from $0x to $Fx. The last 7 (combinations where noise == 1) are emulated in reSID with a simple "return 0;", but on DTVSID they certainly are audible, even the used frequency is clear (insert FFT picture here...). The other combined waveform are also different, but I haven't had time to analyze them yet. Conclusions/speculation/etc: The extra tone in the test case "montez" [1] can be explained with the waveform differences, since it uses $Ex, which is silent on (re)SID. The "staccato" in "gyruss*" [1] is due to the weird silencing phenomenon; the test cases use volume 8 and sustain 8. Seems that the audio output is silent when the volume and envelope values are both in the form 2^n. Someone with a DTV, an oscilloscope and a clue on electronics: please check out the schematic [4] and measure the audio output signals ("SIDChannelX" and "SIDVolume") before the "mixing". There's still a lot of stuff to test, like ring modulation, sync, envelope during attack & release... I hope this encourages someone to play with the DTVSID and post the results. Let's figure this "chip" out!  -- [1] viceplus.svn.sourceforge.net/viewvc/viceplus/trunk/testprogs/sid/[2] www.students.tut.fi/~nuotio/DTVSID/sidtestprogs_v1.zip[3] vice-emu.svn.sourceforge.net/viewvc/vice-emu/tags/v2.0/v2.0/vice/src/resid/[4] picobay.com/dtv_wiki/images/b/b0/DTV-Ver2-Schematic.pdf
|
|
|
Post by tlr on Nov 20, 2008 3:24:20 GMT -5
Very interesting, good work! 
|
|
|
Post by spiff on Nov 21, 2008 14:00:25 GMT -5
Cool stuff. I had no idea there were test cases, and it appears one of them is from montezuma's revenge, which I dtv-fixed more or less by accident (or at least trial and error).
I have a scope (digital), and plenty of DTVs to play with. The question is whether I can use some of your SID test prgs, or if I need to poke the registers one by one.
|
|
|
Post by nojoopa on Nov 21, 2008 15:28:28 GMT -5
I have a scope (digital), and plenty of DTVs to play with. The question is whether I can use some of your SID test prgs, or if I need to poke the registers one by one. Most of my testprogs are suited for generating data for the pictures, but "sidtestm" is (just) an interface for register poking, which I hope is a bit more usable than BASIC  The most interesting measurements would be the "SIDVolume" signal on all the volume values, and "SIDVolume" in parallel with "SIDChannel3" (or 2 or 1) when volume == 8 and CH3 sustain == 8 (and CH3 outputting some recognizable waveform, such as max frequency pulse with 50% width). Of course, all measurements are welcome. Thanks in advance!
|
|
|
Post by spiff on Nov 21, 2008 19:17:29 GMT -5
OK, I hooked up my scope to a DTV and did some playing around with your sidtestm. First I had to do a little reverse engineering of the PCB to get a clear view of where to measure. The circuit is not too different from the schematics, but discrete resistors and caps have been used in stead of arrays. Basically, the outputs from the ASIC go to R42 for the volume output, and R43, R44 and R45 respectively for channels 1, 2 and 3. Looking at the volume channel only, there are some simple observations: - The volume channel is always on, regardless of the gate.
- It outputs a signal switching at full 32MHz, consisting of a 16-bit pattern, i.e. pattern repeats at 2MHz.
- For volume setting 0, the signal is constantly low. For setting 1, one bit is set, setting 2=2 bits set, etc.
The bit patterns have the bits evenly spaced: 01: 1000000000000000 02: 1000000010000000 03: 1000010000100000 08: 1010101010101010 09: 1101010110101010 0F: 1111111111111110 The SID channels are clearly modulated in somewhat the same way, but this is dependent on both the volume and sustain register. I have not done too much analyzing of this, but clearly it is not the hardware mixing that mutes the sound when Vol=8 and sustain=0, 1, 2, 4 or 8; the channel output simply disappears. I'm getting too tired to really think about this tonight, so I will stop here. But these were my observations so far. More to come when I find some more time to play 
|
|
|
Post by nojoopa on Nov 22, 2008 5:01:05 GMT -5
The bit patterns have the bits evenly spaced: 01: 1000000000000000 02: 1000000010000000 03: 1000010000100000 08: 1010101010101010 09: 1101010110101010 0F: 1111111111111110 Can you fill this table for later reference? The SID channels are clearly modulated in somewhat the same way, but this is dependent on both the volume and sustain register. I have not done too much analyzing of this, but clearly it is not the hardware mixing that mutes the sound when Vol=8 and sustain=0, 1, 2, 4 or 8; the channel output simply disappears. This I wasn't expecting. Well, that's one theory out of the window  Are you certain about sustain = 1? I'm fairly sure that it outputs something, but I cannot test it again for a while (~week) since I don't have a DTV at my current location. I'm getting too tired to really think about this tonight, so I will stop here. But these were my observations so far. More to come when I find some more time to play  Great job so far, keep it up!  There are also other envelope values that have strange output on the "magic" volume values; some are noticeable from the "Vol = $8" picture. I haven't determined those envelope values; I think a new testprog is needed. The program should allow control of the envelope value for checking the exact channel output bit patterns with user defined (8 bit) envelope values. This should be possible by setting a slow attack and spamming the new $D41F register ("Writes to voice 2s 8bit envelope generator") [1] with the envelope value using DMA. I'll try to implement this, but right now I have no DTV here to test it with. Also, measuring all the 256*16 combinations would be too much to ask for  -- [1] picobay.com/dtv_wiki/index.php?title=DTV_Programming#EXTENDED_SID_REGISTERS
|
|
|
Post by spiff on Nov 22, 2008 5:31:56 GMT -5
A few more observations:
I set the volume to 1 (giving the pattern described above on the volume channel), and then started playing with the sustain-value. Now things are starting to get interesting.
The pattern observed on the SID channel is the same as the one on the volume channel, but delayed one bit, i.e. 500ns. For vol=1 and sustain=f the following appears: VOL 1000000000000000 SID 0100000000000000
Now, let's call the pattern above A, and an all-zero SID pattern for pattern O. Then, based on the setting of the sustain value, the patterns repeat like this (each pattern is 500ns, so the 16 patterns repeat at 8us ~ 125kHz): STN 0 OOOOOOOOOOOOOOOO STN 1 AAOOOOOOOOOOOOOO STN 2 OOOOOOOOOOOOOOOO STN 3 AAAAOOOOOOOOOOOO ... STN E OOOOOOOOOOOOOOOO STN F AAAAAAAAAAAAAAAA So for some reason, all EVEN sustain values result in no sound.
Now, selecting volume 2, the pattern is 1000000010000000, but in this case, the last pulse is missing from the pattern, e.g. sustain value 1 yields 3 pulses (spaced at 250ns), sustain value 3 yields 7 pulses, etc.
|
|
|
Post by spiff on Nov 28, 2008 16:03:20 GMT -5
Can you fill this table for later reference? I have apparently thrown away my notes, but I just did the test again, and the full table is as follows. vol pattern $0 0000000000000000 $1 1000000000000000 $2 1000000010000000 $3 1000010000100000 $4 1000100010001000 $5 1001001001001000 $6 1010010010100100 $7 1010100101010010 $8 1010101010101010 $9 1010110101011010 $A 1011011010110110 $B 1101101110110110 $C 1110111011101110 $D 1111101111011110 $E 1111111011111110 $F 1111111111111110 But remember that the pattern repeats, so the table presented above does not define a clear start and end. Although it would be possible to lock on to some trigger signal, I think there are so many other things to explore before going back to that. Are you certain about sustain = 1? I'm fairly sure that it outputs something, but I cannot test it again for a while (~week) since I don't have a DTV at my current location. A shown i my post from nov 22, vol=1 and sustain=1 yields sound. But for vol=8 (as stated in my original post), and sustain=1, there is no signal. I have just done some further experiments, and it turns out that all volume values work for ODD sustain settings. For even sustain settings, there are many combinations that yield no sound. To get an idea about what is going on here, I have tried to map it in this matrix: volume 0 1 2 3 4 5 6 7 8 9 A B C D E F sust 2 - - - - - S - S - S S S S S S S sust 4 - - - S - S S S - S S S S S S S sust 6 - - - - - S - S S S S S S S S S sust 8 - - - S - S S S - S S S S S S S sust A - - - S S S S S S S S S S S S S sust C - - - S - S S S S S S S S S S S sust E - - - S S S S S S S S S S S S SThe S means there is some sound, but the audible level is certainly not linear along them (in some cases a higher volume settings yields a lower perceived sound level). There must be some interference going on between the combinations. I think a further analysis of the actual patterns generated for the different settings should be done to try and guess what is going on.
|
|
|
Post by nojoopa on Nov 29, 2008 7:35:19 GMT -5
The pattern observed on the SID channel is the same as the one on the volume channel, but delayed one bit, i.e. 500ns. Shouldn't that be 31.25ns? Now, selecting volume 2, the pattern is 1000000010000000, but in this case, the last pulse is missing from the pattern, e.g. sustain value 1 yields 3 pulses (spaced at 250ns), sustain value 3 yields 7 pulses, etc. Maybe this is related to the 'f' in the envelope values $1f, $3f etc. What were the other registers of the channel set to? I'm curious on how the (SID) waveform is "seen" on the pattern... A shown i my post from nov 22, vol=1 and sustain=1 yields sound. But for vol=8 (as stated in my original post), and sustain=1, there is no signal. OK, thanks for clearing this up. I have just done some further experiments, and it turns out that all volume values work for ODD sustain settings. The odd sustain settings have $xf as the envelope value, while the even have $x0. I'll try to get the new testprog done soon so other $x0 values can be tested. For even sustain settings, there are many combinations that yield no sound. To get an idea about what is going on here, I have tried to map it in this matrix: volume 0 1 2 3 4 5 6 7 8 9 A B C D E F sust 2 - - - - - S - S - S S S S S S S sust 4 - - - S - S S S - S S S S S S S sust 6 - - - - - S - S S S S S S S S S sust 8 - - - S - S S S - S S S S S S S sust A - - - S S S S S S S S S S S S S sust C - - - S - S S S S S S S S S S S sust E - - - S S S S S S S S S S S S SThe S means there is some sound, but the audible level is certainly not linear along them (in some cases a higher volume settings yields a lower perceived sound level). This is really interesting! There must be some interference going on between the combinations. I think a further analysis of the actual patterns generated for the different settings should be done to try and guess what is going on. I tested [1] one theory: combining (AND) the bit patterns with the 1 bit delay on sustain. Results are: volume 0 1 2 3 4 5 6 7 8 9 a b c d e f sust 2 - - - - - S - S - S - S S S S S sust 4 - - - S - S S S - S S S S S S S sust 6 - - - - - S - S S S S S S S S S sust 8 - - - S - S S S - S S S S S S S sust a - - - - S S - S S S S S S S S S sust c - - - S - S S S S S S S S S S S sust e - - - S S S S S S S S S S S S SClose, but the $a results differ. Keep up the good work!  -- [1] www.students.tut.fi/~nuotio/DTVSID/dtvsidtest.c
|
|
|
Post by spiff on Nov 29, 2008 11:37:09 GMT -5
Shouldn't that be 31.25ns? Yes, of course. I have been doing a lot of scope screen captures today, and will put them online to document further. My parents are coming over for dinner tonight, so I don't have the time this evening (perhaps tonight when they have gone home). Maybe this is related to the 'f' in the envelope values $1f, $3f etc. What were the other registers of the channel set to? I'm curious on how the (SID) waveform is "seen" on the pattern... Freq=$1000 PW = $0100 Ctrl=$41 Attach,decay,release all 0. I tested [1] one theory: combining (AND) the bit patterns with the 1 bit delay on sustain. Results are: ... Close, but the $a results differ. Hmm.. But a good suggestion. I think I need to analyze further on cases where vol!=1. Although the waveform is more complicated in these cases, I want to make sure that the observation about the channel having the same pattern (for sustain=f) is correct. I have already discovered that the theory of the sustain-value simply defining the number of repeated patterns, and the missing last pulse, is not entirely correct. For instance with volume=4 and sustain=1, I see 4 pulses, then 3 pulses (then repeating I think) on the channel output. And the pulses seem to be half the freq of the volume-channel (which contradicts the channel having the same pattern as the volume, except delayed one clock). I haven't studied my captured data in detail yet, but I will put it online, and we can have a look at it.
|
|
|
Post by spiff on Nov 29, 2008 19:15:06 GMT -5
OK, I put up a bunch of oscilloscope screen captures and my observations. Take a look, and tell me if you spot something that I have overlooked. symlink.dk/nostalgia/dtv/dtvsid/
|
|
|
Post by spiff on Nov 29, 2008 19:37:53 GMT -5
volume 0 1 2 3 4 5 6 7 8 9 a b c d e f sust 2 - - - - - S - S - S - S S S S S sust 4 - - - S - S S S - S S S S S S S sust 6 - - - - - S - S S S S S S S S S sust 8 - - - S - S S S - S S S S S S S sust a - - - - S S - S S S S S S S S S sust c - - - S - S S S S S S S S S S S sust e - - - S S S S S S S S S S S S SClose, but the $a results differ. I GOT IT! I played around with your program, and as I mentioned, there is really no way to tell the start and end of the captured data (i.e. the pattern repeats). With this in mind, shift the table entry for $A, so it becomes 0xdada, instead of 0xb6b6, and you get this: volume 0 1 2 3 4 5 6 7 8 9 a b c d e f sust 2 - - - - - S - S - S S S S S S S sust 4 - - - S - S S S - S S S S S S S sust 6 - - - - - S - S S S S S S S S S sust 8 - - - S - S S S - S S S S S S S sust a - - - S S S S S S S S S S S S S sust c - - - S - S S S S S S S S S S S sust e - - - S S S S S S S S S S S S S ;D I suppose, comparing with the voice channels I can get some reference point in terms of telling where a pattern starts and ends, but I definitely think we are onto something here.
|
|
|
Post by nojoopa on Nov 30, 2008 5:09:04 GMT -5
Nice writeup! It will take a while to study it and test some cases before having useful feedback. Meanwhile, I updated the C program [1] with the $A pattern change (and bin->hex fixes on the others) and bit count for the resulting waveform (which should indicate the output volume). Here's the new table: volume 0 1 2 3 4 5 6 7 8 9 a b c d e f sust 2 - - - - - 1 - 1 - 1 2 1 2 2 2 2 sust 4 - - - 1 - 1 2 1 - 2 2 2 4 3 4 4 sust 6 - - - - - 3 - 3 2 3 6 5 4 6 6 6 sust 8 - - - 1 - 2 2 3 - 4 4 5 4 6 6 7 sust a - - - 2 2 2 4 4 4 6 4 5 8 7 8 9 sust c - - - 2 - 3 4 5 4 6 6 8 8 9 a b sust e - - - 2 2 4 4 6 6 8 8 9 a b c d It should be possible to test this by changing the volume register while a tone is played at a constant sustain value and listening to the overall volume changes. Will do this once I get back to my DTV... -- [1] www.students.tut.fi/~nuotio/DTVSID/dtvsidtest.c
|
|
|
Post by nojoopa on Dec 8, 2008 10:56:43 GMT -5
...and the table seems almost correct, except for some cases with volumes $7 and $C, probably due to the unknown starting points of the patterns. I tried to make the envelope testprog [1], but it doesn't behave as expected. I guess a waveform testprog (for identifying how the waveform values affect the output) would work better, but that wouldn't help much in figuring out the envelope. -- [1] www.students.tut.fi/~nuotio/DTVSID/envelopm_v1.zip
|
|
|
Post by spiff on Dec 9, 2008 4:14:56 GMT -5
...and the table seems almost correct, except for some cases with volumes $7 and $C, probably due to the unknown starting points of the patterns. Perhaps if I set up a channel generating some signal that is easily recognizable, I can use this as a fix-point for finding out the starting position of the waveforms on the volume channel. Also, I would like to look at the bit count and see if this corresponds to what I see on the scope. If I recorded all the bit counts, it should be possible to make the program try different combinations of rotating the patterns in the table, and check against the bit counts.
|
|