The SID has various registers that are described as 16 linear steps: The Filter Volume, The Filter Resonance, and the Sustain of the voice envelopes.
The SUSTAIN levels range from zero to peak amplitude in 16 linear steps, with a SUSTAIN value of 0 selecting zero amplitude and a SUSTAIN value of 15 (#F) selecting the peak amplitude.
A SUSTAIN value of 8 would cause Voice 1 to SUSTAIN at an amplitude one-half the peak amplitude reached by the ATTACK cycle.
Now, maybe I'm bad a math, but I can't make those numbers work if I try to translate them to a 0-100% scale: If I divide 100 by 16, I get 6.25. That's a nice number because the value 8 would be exactly 50% (8 * 6.25).
But the maximum value of the register is 15 (0xF), and 15 * 6.25 only comes out to 93.75%, not to 100%.
If I divide 100 by 15, I get steps of 6.66666..., and a value of 8 gives me 53.33333...% - but the value of 15 gives me 100% as expected.
Is the 6.66...% per step correct, and the "8 equals half the maximum value" is just an approximation in the datasheet? Or did they do something special to make a value of 8 be exactly 50% and just fudge the steps around a bit? Or am I missing something obvious?
100/16 | 100/15 | |
---|---|---|
0 | 0 % | 0 % |
1 | 6.25 % | 6.67 % |
2 | 12.5 % | 13.33 % |
3 | 18.75 % | 20 % |
4 | 25 % | 26.67 % |
5 | 31.25 % | 33.33 % |
6 | 37.5 % | 40 % |
7 | 43.75 % | 46.67 % |
8 | 50 % | 53.33 % |
9 | 56.25 % | 60 % |
10 | 62.5 % | 66.67 % |
11 | 68.75 % | 73.33 % |
12 | 75 % | 80 % |
13 | 81.25 % | 86.67 % |
14 | 87.5 % | 93.33 % |
15 | 93.75 % | 100 % |