Previous 199869 Revisions Next

r31245 Wednesday 9th July, 2014 at 19:20:11 UTC by Couriersud
AY8910_RESISTOR_OUTPUT now selects resistance calculation by simple saturation mosfet model in ay8910.c. Currently only two drivers use this: 1942 and popeye.
[src/emu/sound]ay8910.c ay8910.h
[src/mame/drivers]1942.c popeye.c

trunk/src/mame/drivers/1942.c
r31244r31245
8484
8585   SOLVER(Solver, 48000)
8686   ANALOG_INPUT(V5, 5)
87    PARAM(Solver.ACCURACY, 1e-10)
8788
8889   /* AY 8910 internal resistors */
8990
r31244r31245
138139
139140   NET_C(CC6.1, VR.2)
140141   NET_C(CC6.2, R1.1)
141   NET_C(R1.2, GND)
142    CAP(CC3, 220e-6)
143    NET_C(R1.2, CC3.1)
144    NET_C(CC3.2, GND)
142145
143146NETLIST_END()
144147
r31244r31245
549552
550553   MCFG_SOUND_ADD("ay1", AY8910, AUDIO_CLOCK)  /* 1.5 MHz */
551554   MCFG_AY8910_OUTPUT_TYPE(AY8910_RESISTOR_OUTPUT)
555    MCFG_AY8910_RES_LOADS(10000.0, 10000.0, 10000.0)
552556   
553557   MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 0)
554558   MCFG_SOUND_ROUTE_EX(1, "snd_nl", 1.0, 1)
555559   MCFG_SOUND_ROUTE_EX(2, "snd_nl", 1.0, 2)
560
556561   MCFG_SOUND_ADD("ay2", AY8910, AUDIO_CLOCK)  /* 1.5 MHz */
557562   MCFG_AY8910_OUTPUT_TYPE(AY8910_RESISTOR_OUTPUT)
563    MCFG_AY8910_RES_LOADS(10000.0, 10000.0, 10000.0)
558564   
559565   MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 3)
560566   MCFG_SOUND_ROUTE_EX(1, "snd_nl", 1.0, 4)
r31244r31245
565571   MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000)
566572   MCFG_NETLIST_SETUP(nl_1942)
567573   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 5.0)
568
569574   MCFG_NETLIST_STREAM_INPUT("snd_nl", 0, "R_AY1_1.R")
570575   MCFG_NETLIST_STREAM_INPUT("snd_nl", 1, "R_AY1_2.R")
571576   MCFG_NETLIST_STREAM_INPUT("snd_nl", 2, "R_AY1_3.R")
r31244r31245
574579   MCFG_NETLIST_STREAM_INPUT("snd_nl", 5, "R_AY2_3.R")
575580
576581   MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "R1.1")
582   //MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "VR.2")
577583   MCFG_NETLIST_ANALOG_MULT_OFFSET(100000.0, 0.0)
578584
579585MACHINE_CONFIG_END
trunk/src/mame/drivers/popeye.c
r31244r31245
5353
5454   SOLVER(Solver, 48000)
5555   PARAM(Solver.ACCURACY, 1e-5)
56    PARAM(Solver.LTE,     5e-2) // Default is not enough for paddle control
5657   ANALOG_INPUT(V5, 5)
5758
5859   /* AY 8910 internal resistors */
r31244r31245
481482   MCFG_SOUND_MODIFY("aysnd")
482483   MCFG_SOUND_ROUTES_RESET()
483484   MCFG_AY8910_OUTPUT_TYPE(AY8910_RESISTOR_OUTPUT) /* Does Sky Skipper have the same filtering? */
485    MCFG_AY8910_RES_LOADS(2000.0, 2000.0, 2000.0)
484486   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0"))
485487   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(popeye_state, popeye_portB_w))
486488   MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 0)
trunk/src/emu/sound/ay8910.c
r31244r31245
8888 *
8989 *  Whilst conducting, the FET operates in saturation mode:
9090 *
91 *  Id = Kn * (Vgs - Vtn)^2
91 *  Id = Kn * (Vgs - Vth)^2
9292 *
9393 *  Using Id = Vs / RD
9494 *
95 *  Vs = Kn * RD  * (Vg - Vs - Vtn)^2
95 *  Vs = Kn * RD  * (Vg - Vs - Vth)^2
9696 *
97 *  finally using Vg' = Vg - Vtn
97 *  finally using Vg' = Vg - Vth
9898 *
9999 *  Vs = Vg' + 1 / (2 * Kn * RD) - sqrt((Vg' + 1 / (2 * Kn * RD))^2 - Vg'^2)
100100 *
r31244r31245
386386 * RD was measured on a real chip to be 8m Ohm, RU was 0.8m Ohm.
387387 */
388388
389
389390static const ay8910_device::ay_ym_param ay8910_param =
390391{
391   800000, 8000000,
392   16,
393   { 15950, 15350, 15090, 14760, 14275, 13620, 12890, 11370,
394      10600,  8590,  7190,  5985,  4820,  3945,  3017,  2345 }
392    800000, 8000000,
393    16,
394    { 15950, 15350, 15090, 14760, 14275, 13620, 12890, 11370,
395        10600,  8590,  7190,  5985,  4820,  3945,  3017,  2345 }
395396};
396397
398static const ay8910_device::mosfet_param ay8910_mosfet_param =
399{
400    1.465385778,
401    4.9,
402    16,
403    {
404          0.00076,
405          0.80536,
406          1.13106,
407          1.65952,
408          2.42261,
409          3.60536,
410          5.34893,
411          8.96871,
412         10.97202,
413         19.32370,
414         29.01935,
415         38.82026,
416         55.50539,
417         78.44395,
418        109.49257,
419        153.72985,
420    }
421};
422
423
424
425
397426/*************************************
398427 *
399428 *  Inline
r31244r31245
492521
493522}
494523
495INLINE void build_resisor_table(const ay8910_device::ay_ym_param *par, INT32 *tab, int zero_is_off)
524INLINE void build_resistor_table(const ay8910_device::ay_ym_param *par, INT32 *tab, int zero_is_off)
496525{
497526   int j;
498527
r31244r31245
507536   }
508537}
509538
539INLINE void build_mosfet_resistor_table(const ay8910_device::mosfet_param &par, const double rd, INT32 *tab)
540{
541    int j;
510542
543    for (j=0; j < par.m_count; j++)
544    {
545        const double Vd = 5.0;
546        const double Vg = par.m_Vg - par.m_Vth;
547        const double kn = par.m_Kn[j] / 1.0e6;
548        const double p2 = 1.0 / (2.0 * kn * rd);
549        const double Vs = Vg + p2 - sqrt(p2 * p2 - Vg * Vg);
550
551        const double res = rd * ( Vd / Vs - 1.0);
552        tab[j] = res;
553    }
554}
555
556
511557UINT16 ay8910_device::mix_3D()
512558{
513559   int indx = 0, chan;
r31244r31245
782828
783829   if ((m_flags & AY8910_RESISTOR_OUTPUT) != 0)
784830   {
785      for (chan=0; chan < AY8910_NUM_CHANNELS; chan++)
831       if (m_type != PSG_TYPE_AY)
832           fatalerror("AY8910_RESISTOR_OUTPUT currently only supported for AY8910 devices.");
833
834       for (chan=0; chan < AY8910_NUM_CHANNELS; chan++)
786835      {
787         build_resisor_table(m_par, m_vol_table[chan], m_zero_is_off);
788         build_resisor_table(m_par_env, m_env_table[chan], 0);
836         build_mosfet_resistor_table(ay8910_mosfet_param, m_res_load[chan], m_vol_table[chan]);
837         build_mosfet_resistor_table(ay8910_mosfet_param, m_res_load[chan], m_vol_table[chan]);
789838      }
790839   }
791840   else
r31244r31245
10751124ay8910_device::ay8910_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
10761125   : device_t(mconfig, AY8910, "AY-3-8910A", tag, owner, clock, "ay8910", __FILE__),
10771126      device_sound_interface(mconfig, *this),
1127        m_type(PSG_TYPE_AY),
10781128      m_streams(3),
10791129      m_ioports(2),
10801130      m_ready(0),
r31244r31245
11161166                      psg_type_t psg_type, int streams, int ioports, const char *shortname, const char *source)
11171167   : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
11181168      device_sound_interface(mconfig, *this),
1169        m_type(psg_type),
11191170      m_streams(streams),
11201171      m_ioports(ioports),
11211172      m_ready(0),
trunk/src/emu/sound/ay8910.h
r31244r31245
133133      int    res_count;
134134      double res[32];
135135   };
136   
136
137    struct mosfet_param
138    {
139        double m_Vth;
140        double m_Vg;
141        int    m_count;
142        double m_Kn[32];
143    };
144
137145   void ay8910_write_ym(int addr, int data);
138146   int ay8910_read_ym();
139147   void ay8910_reset_ym();
r31244r31245
154162   void ay8910_statesave();
155163
156164   // internal state
165   psg_type_t m_type;
157166   int m_streams;
158167   int m_ioports;
159168   int m_ready;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team