ay8910.c:

* Fixes mantis bugs 01767, 01769
* Corrected some comments
This commit is contained in:
Couriersud 2008-05-02 10:58:11 +00:00
parent 128bfcc4e0
commit b7880b33fa

View File

@ -39,8 +39,8 @@
This is backed by oscilloscope pictures from the datasheet. If a fixed volume This is backed by oscilloscope pictures from the datasheet. If a fixed volume
is set, i.e. enveloppe is disabled, the output voltage is set to 0V. Recordings is set, i.e. enveloppe is disabled, the output voltage is set to 0V. Recordings
I found on the web for gyruss indicate, that the AY-3-8910 offset should I found on the web for gyruss indicate, that the AY-3-8910 offset should
be around 1.5V. This will also make sound levels more compatible with be around 0.2V. This will also make sound levels more compatible with
user descriptions. user observations for scramble.
The Model: The Model:
5V 5V 5V 5V
@ -66,8 +66,9 @@ where used to calibrate channel mixing for the YM2149. This was done using
a least square approach using a fixed RL of 1K Ohm. a least square approach using a fixed RL of 1K Ohm.
For the AY measurements cited in e.g. openmsx as "Hacker Kay" for a single For the AY measurements cited in e.g. openmsx as "Hacker Kay" for a single
channel were taken. These were normalized to 0 ... 65535 and adapted to on channel were taken. These were normalized to 0 ... 65535 and consequently
offset of 1.5V and a VPP of 1.3V. adapted to an offset of 0.2V and a VPP of 1.3V. These measurements are in
line e.g. with the formula used by pcmenc for the volume: vol(i) = exp(i/2-7.5).
The following is documentation from the code moved here and amended to reflect The following is documentation from the code moved here and amended to reflect
the changes done: the changes done:
@ -82,17 +83,17 @@ in the YM2203 data sheets. However, this does NOT apply to the Envelope
period. In that case, period = 0 is half as period = 1. period. In that case, period = 0 is half as period = 1.
Envelope shapes: Envelope shapes:
C AtAlH C AtAlH
0 0 x x \___ 0 0 x x \___
0 1 x x /___ 0 1 x x /___
1 0 0 0 \\\\ 1 0 0 0 \\\\
1 0 0 1 \___ 1 0 0 1 \___
1 0 1 0 \/\/ 1 0 1 0 \/\/
1 0 1 1 \``` 1 0 1 1 \```
1 1 0 0 //// 1 1 0 0 ////
1 1 0 1 /``` 1 1 0 1 /```
1 1 1 0 /\/\ 1 1 1 0 /\/\
1 1 1 1 /___ 1 1 1 1 /___
The envelope counter on the AY-3-8910 has 16 steps. On the YM2149 it The envelope counter on the AY-3-8910 has 16 steps. On the YM2149 it
has twice the steps, happening twice as fast. has twice the steps, happening twice as fast.
@ -310,7 +311,7 @@ INLINE void build_3D_table(double rl, const ay_ym_param *par, const ay_ym_param
if (normalize) if (normalize)
{ {
for (j=0; j < 32*32*32*8; j++) for (j=0; j < 32*32*32*8; j++)
tab[j] = MAX_OUTPUT * (((temp[j] - min)/(max-min)) - 0.25) * factor; tab[j] = MAX_OUTPUT * (((temp[j] - min)/(max-min))) * factor;
} }
else else
{ {
@ -619,9 +620,9 @@ static void build_mixer_table(ay8910_context *psg)
build_single_table(psg->intf->res_load[chan], psg->par_env, normalize, psg->env_table[chan], 0); build_single_table(psg->intf->res_load[chan], psg->par_env, normalize, psg->env_table[chan], 0);
} }
/* /*
* The previous implementation added all three channels up instead of averaging them. * The previous implementation added all three channels up instead of averaging them.
* The factor of 3 will force the same levels if normalizing is used. * The factor of 3 will force the same levels if normalizing is used.
*/ */
build_3D_table(psg->intf->res_load[0], psg->par, psg->par_env, normalize, 3, psg->zero_is_off, psg->vol3d_table); build_3D_table(psg->intf->res_load[0], psg->par, psg->par_env, normalize, 3, psg->zero_is_off, psg->vol3d_table);
} }