trunk/src/mame/drivers/1942.c
| r31244 | r31245 | |
| 84 | 84 | |
| 85 | 85 | SOLVER(Solver, 48000) |
| 86 | 86 | ANALOG_INPUT(V5, 5) |
| 87 | PARAM(Solver.ACCURACY, 1e-10) |
| 87 | 88 | |
| 88 | 89 | /* AY 8910 internal resistors */ |
| 89 | 90 | |
| r31244 | r31245 | |
| 138 | 139 | |
| 139 | 140 | NET_C(CC6.1, VR.2) |
| 140 | 141 | 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) |
| 142 | 145 | |
| 143 | 146 | NETLIST_END() |
| 144 | 147 | |
| r31244 | r31245 | |
| 549 | 552 | |
| 550 | 553 | MCFG_SOUND_ADD("ay1", AY8910, AUDIO_CLOCK) /* 1.5 MHz */ |
| 551 | 554 | MCFG_AY8910_OUTPUT_TYPE(AY8910_RESISTOR_OUTPUT) |
| 555 | MCFG_AY8910_RES_LOADS(10000.0, 10000.0, 10000.0) |
| 552 | 556 | |
| 553 | 557 | MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 0) |
| 554 | 558 | MCFG_SOUND_ROUTE_EX(1, "snd_nl", 1.0, 1) |
| 555 | 559 | MCFG_SOUND_ROUTE_EX(2, "snd_nl", 1.0, 2) |
| 560 | |
| 556 | 561 | MCFG_SOUND_ADD("ay2", AY8910, AUDIO_CLOCK) /* 1.5 MHz */ |
| 557 | 562 | MCFG_AY8910_OUTPUT_TYPE(AY8910_RESISTOR_OUTPUT) |
| 563 | MCFG_AY8910_RES_LOADS(10000.0, 10000.0, 10000.0) |
| 558 | 564 | |
| 559 | 565 | MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 3) |
| 560 | 566 | MCFG_SOUND_ROUTE_EX(1, "snd_nl", 1.0, 4) |
| r31244 | r31245 | |
| 565 | 571 | MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000) |
| 566 | 572 | MCFG_NETLIST_SETUP(nl_1942) |
| 567 | 573 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 5.0) |
| 568 | | |
| 569 | 574 | MCFG_NETLIST_STREAM_INPUT("snd_nl", 0, "R_AY1_1.R") |
| 570 | 575 | MCFG_NETLIST_STREAM_INPUT("snd_nl", 1, "R_AY1_2.R") |
| 571 | 576 | MCFG_NETLIST_STREAM_INPUT("snd_nl", 2, "R_AY1_3.R") |
| r31244 | r31245 | |
| 574 | 579 | MCFG_NETLIST_STREAM_INPUT("snd_nl", 5, "R_AY2_3.R") |
| 575 | 580 | |
| 576 | 581 | MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "R1.1") |
| 582 | //MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "VR.2") |
| 577 | 583 | MCFG_NETLIST_ANALOG_MULT_OFFSET(100000.0, 0.0) |
| 578 | 584 | |
| 579 | 585 | MACHINE_CONFIG_END |
trunk/src/emu/sound/ay8910.c
| r31244 | r31245 | |
| 88 | 88 | * |
| 89 | 89 | * Whilst conducting, the FET operates in saturation mode: |
| 90 | 90 | * |
| 91 | | * Id = Kn * (Vgs - Vtn)^2 |
| 91 | * Id = Kn * (Vgs - Vth)^2 |
| 92 | 92 | * |
| 93 | 93 | * Using Id = Vs / RD |
| 94 | 94 | * |
| 95 | | * Vs = Kn * RD * (Vg - Vs - Vtn)^2 |
| 95 | * Vs = Kn * RD * (Vg - Vs - Vth)^2 |
| 96 | 96 | * |
| 97 | | * finally using Vg' = Vg - Vtn |
| 97 | * finally using Vg' = Vg - Vth |
| 98 | 98 | * |
| 99 | 99 | * Vs = Vg' + 1 / (2 * Kn * RD) - sqrt((Vg' + 1 / (2 * Kn * RD))^2 - Vg'^2) |
| 100 | 100 | * |
| r31244 | r31245 | |
| 386 | 386 | * RD was measured on a real chip to be 8m Ohm, RU was 0.8m Ohm. |
| 387 | 387 | */ |
| 388 | 388 | |
| 389 | |
| 389 | 390 | static const ay8910_device::ay_ym_param ay8910_param = |
| 390 | 391 | { |
| 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 } |
| 395 | 396 | }; |
| 396 | 397 | |
| 398 | static 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 | |
| 397 | 426 | /************************************* |
| 398 | 427 | * |
| 399 | 428 | * Inline |
| r31244 | r31245 | |
| 492 | 521 | |
| 493 | 522 | } |
| 494 | 523 | |
| 495 | | INLINE void build_resisor_table(const ay8910_device::ay_ym_param *par, INT32 *tab, int zero_is_off) |
| 524 | INLINE void build_resistor_table(const ay8910_device::ay_ym_param *par, INT32 *tab, int zero_is_off) |
| 496 | 525 | { |
| 497 | 526 | int j; |
| 498 | 527 | |
| r31244 | r31245 | |
| 507 | 536 | } |
| 508 | 537 | } |
| 509 | 538 | |
| 539 | INLINE void build_mosfet_resistor_table(const ay8910_device::mosfet_param &par, const double rd, INT32 *tab) |
| 540 | { |
| 541 | int j; |
| 510 | 542 | |
| 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 | |
| 511 | 557 | UINT16 ay8910_device::mix_3D() |
| 512 | 558 | { |
| 513 | 559 | int indx = 0, chan; |
| r31244 | r31245 | |
| 782 | 828 | |
| 783 | 829 | if ((m_flags & AY8910_RESISTOR_OUTPUT) != 0) |
| 784 | 830 | { |
| 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++) |
| 786 | 835 | { |
| 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]); |
| 789 | 838 | } |
| 790 | 839 | } |
| 791 | 840 | else |
| r31244 | r31245 | |
| 1075 | 1124 | ay8910_device::ay8910_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1076 | 1125 | : device_t(mconfig, AY8910, "AY-3-8910A", tag, owner, clock, "ay8910", __FILE__), |
| 1077 | 1126 | device_sound_interface(mconfig, *this), |
| 1127 | m_type(PSG_TYPE_AY), |
| 1078 | 1128 | m_streams(3), |
| 1079 | 1129 | m_ioports(2), |
| 1080 | 1130 | m_ready(0), |
| r31244 | r31245 | |
| 1116 | 1166 | psg_type_t psg_type, int streams, int ioports, const char *shortname, const char *source) |
| 1117 | 1167 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 1118 | 1168 | device_sound_interface(mconfig, *this), |
| 1169 | m_type(psg_type), |
| 1119 | 1170 | m_streams(streams), |
| 1120 | 1171 | m_ioports(ioports), |
| 1121 | 1172 | m_ready(0), |