diff --git a/src/computer.c b/src/computer.c index e58e354..788491f 100644 --- a/src/computer.c +++ b/src/computer.c @@ -141,7 +141,6 @@ void computer_init () { //Called only on start-up ordenador.vol_b = 0; ordenador.vol_c = 0; ordenador.tst_ay = 0; - ordenador.tst_ay2 = 0; ordenador.wr = 0; ordenador.r_fetch = 0; ordenador.io = 0; diff --git a/src/computer.h b/src/computer.h index e911c77..398ecde 100644 --- a/src/computer.h +++ b/src/computer.h @@ -132,7 +132,6 @@ struct computer { unsigned char audio_mode; //mono, ABC, ACB, BAC unsigned char vol_a,vol_b,vol_c; unsigned int tst_ay; - unsigned int tst_ay2; unsigned int ay_latch; signed char ay_envel_value; unsigned char ay_envel_way; diff --git a/src/spk_ay.c b/src/spk_ay.c index e40698c..f99ae85 100644 --- a/src/spk_ay.c +++ b/src/spk_ay.c @@ -49,7 +49,6 @@ inline void play_ay (unsigned int tstados) { return; ordenador.tst_ay += tstados; - ordenador.tst_ay2 += tstados; // A note about the period of tones, noise and envelope: careful studies of the chip // output prove that it counts up from 0 until the counter becomes @@ -61,16 +60,17 @@ inline void play_ay (unsigned int tstados) { //The frequency of AY-3-8912 is half the ZX Spectrum frequency - //Envelope - //Envelope frequency is 1/(256*envelop_period) of AY-3-8912 frequency - if (ordenador.tst_ay2 > 127) { - ordenador.tst_ay2 -= 128; + if (ordenador.tst_ay > 16) { + ordenador.tst_ay -= 16; - env_period=2*((unsigned int) ordenador.ay_registers[11]) + 256 * ((unsigned int) (ordenador.ay_registers[12])); - if (!env_period) env_period = 1; + //Envelope + //Envelope frequency is 1/(256*envelop_period) of AY-3-8912 frequency - if (ordenador.aych_envel 15) - { - ordenador.tst_ay -= 16; tone_period_a= ((unsigned int) ordenador.ay_registers[0]) + 256 * ((unsigned int) ((ordenador.ay_registers[1]) & 0x0F)); tone_period_b= ((unsigned int) ordenador.ay_registers[2]) + 256 * ((unsigned int) ((ordenador.ay_registers[3]) & 0x0F)); tone_period_c= ((unsigned int) ordenador.ay_registers[4]) + 256 * ((unsigned int) ((ordenador.ay_registers[5]) & 0x0F)); - if (tone_period_a<6) //max 20KHz ordenador.ayval_a =1; else