diff --git a/src/emu/machine/netlist.c b/src/emu/machine/netlist.c index 4d18be597d1..28e49f2deed 100644 --- a/src/emu/machine/netlist.c +++ b/src/emu/machine/netlist.c @@ -57,19 +57,32 @@ const device_type NETLIST_CORE = &device_creator; const device_type NETLIST_CPU = &device_creator; const device_type NETLIST_SOUND = &device_creator; + +/* subdevices */ + const device_type NETLIST_ANALOG_INPUT = &device_creator; const device_type NETLIST_LOGIC_INPUT = &device_creator; +const device_type NETLIST_STREAM_INPUT = &device_creator; + +const device_type NETLIST_ANALOG_OUTPUT = &device_creator; +const device_type NETLIST_STREAM_OUTPUT = &device_creator; // ---------------------------------------------------------------------------------------- // netlist_mame_analog_input_t // ---------------------------------------------------------------------------------------- +void netlist_mame_sub_interface::static_set_mult_offset(device_t &device, const double mult, const double offset) +{ + netlist_mame_sub_interface &netlist = dynamic_cast(device); + netlist.m_mult = mult; + netlist.m_offset = offset; +} + + netlist_mame_analog_input_t::netlist_mame_analog_input_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, NETLIST_ANALOG_INPUT, "netlist analog input", tag, owner, clock, "netlist_analog_input", __FILE__), netlist_mame_sub_interface(*owner), m_param(0), - m_offset(0.0), - m_mult(1.0), m_auto_port(true), m_param_name("") { @@ -81,15 +94,6 @@ void netlist_mame_analog_input_t::static_set_name(device_t &device, const char * netlist.m_param_name = param_name; } -void netlist_mame_analog_input_t::static_set_mult_offset(device_t &device, const double mult, const double offset) -{ - netlist_mame_analog_input_t &netlist = downcast(device); - netlist.m_mult = mult; - netlist.m_offset = offset; - // disable automatic scaling for ioports - netlist.m_auto_port = false; -} - void netlist_mame_analog_input_t::device_start() { LOG_DEV_CALLS(("start %s\n", tag())); @@ -99,8 +103,54 @@ void netlist_mame_analog_input_t::device_start() { fatalerror("device %s wrong parameter type for %s\n", basetag(), m_param_name.cstr()); } + if (m_mult != 1.0 || m_offset != 0.0) + { + // disable automatic scaling for ioports + m_auto_port = false; + } + } +// ---------------------------------------------------------------------------------------- +// netlist_mame_analog_output_t +// ---------------------------------------------------------------------------------------- + +netlist_mame_analog_output_t::netlist_mame_analog_output_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NETLIST_ANALOG_INPUT, "netlist analog output", tag, owner, clock, "netlist_analog_output", __FILE__), + netlist_mame_sub_interface(*owner), + m_in("") +{ +} + +void netlist_mame_analog_output_t::static_set_params(device_t &device, const char *in_name, netlist_analog_output_delegate adelegate) +{ + netlist_mame_analog_output_t &netlist = downcast(device); + netlist.m_in = in_name; + netlist.m_delegate = adelegate; +} + +void netlist_mame_analog_output_t::custom_netlist_additions(netlist_setup_t &setup) +{ + pstring dname = "OUT_" + m_in; + m_delegate.bind_relative_to(owner()->machine().root_device()); + NETLIB_NAME(analog_callback) *dev = downcast( + setup.factory().new_device_by_classname("nld_analog_callback", setup)); + + setup.register_dev(dev, dname); + dev->register_callback(m_delegate); + setup.register_link(dname + ".IN", m_in); +} + +void netlist_mame_analog_output_t::device_start() +{ + LOG_DEV_CALLS(("start %s\n", tag())); +} + + +// ---------------------------------------------------------------------------------------- +// netlist_mame_logic_input_t +// ---------------------------------------------------------------------------------------- + netlist_mame_logic_input_t::netlist_mame_logic_input_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, NETLIST_ANALOG_INPUT, "netlist analog input", tag, owner, clock, "netlist_analog_input", __FILE__), netlist_mame_sub_interface(*owner), @@ -130,6 +180,83 @@ void netlist_mame_logic_input_t::device_start() } } +// ---------------------------------------------------------------------------------------- +// netlist_mame_stream_input_t +// ---------------------------------------------------------------------------------------- + +netlist_mame_stream_input_t::netlist_mame_stream_input_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NETLIST_ANALOG_INPUT, "netlist analog input", tag, owner, clock, "netlist_analog_input", __FILE__), + netlist_mame_sub_interface(*owner), + m_channel(0), + m_param_name("") +{ +} + +void netlist_mame_stream_input_t::static_set_params(device_t &device, int channel, const char *param_name) +{ + netlist_mame_stream_input_t &netlist = downcast(device); + netlist.m_param_name = param_name; + netlist.m_channel = channel; +} + +void netlist_mame_stream_input_t::device_start() +{ + LOG_DEV_CALLS(("start %s\n", tag())); +} + +void netlist_mame_stream_input_t::custom_netlist_additions(netlist_setup_t &setup) +{ + NETLIB_NAME(sound_in) *snd_in = setup.netlist().get_first_device(); + if (snd_in == NULL) + { + snd_in = dynamic_cast(setup.factory().new_device_by_classname("nld_sound_in", setup)); + setup.register_dev(snd_in, "STREAM_INPUT"); + } + + pstring sparam = pstring::sprintf("STREAM_INPUT.CHAN%d", m_channel); + setup.register_param(sparam, m_param_name); + pstring mparam = pstring::sprintf("STREAM_INPUT.MULT%d", m_channel); + setup.register_param(mparam, m_mult); +} + +// ---------------------------------------------------------------------------------------- +// netlist_mame_stream_output_t +// ---------------------------------------------------------------------------------------- + +netlist_mame_stream_output_t::netlist_mame_stream_output_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, NETLIST_ANALOG_INPUT, "netlist analog input", tag, owner, clock, "netlist_analog_input", __FILE__), + netlist_mame_sub_interface(*owner), + m_channel(0), + m_out_name("") +{ +} + +void netlist_mame_stream_output_t::static_set_params(device_t &device, int channel, const char *out_name) +{ + netlist_mame_stream_output_t &netlist = downcast(device); + netlist.m_out_name = out_name; + netlist.m_channel = channel; +} + +void netlist_mame_stream_output_t::device_start() +{ + LOG_DEV_CALLS(("start %s\n", tag())); +} + +void netlist_mame_stream_output_t::custom_netlist_additions(netlist_setup_t &setup) +{ + NETLIB_NAME(sound_out) *snd_out; + pstring sname = pstring::sprintf("STREAM_OUT_%d", m_channel); + + snd_out = dynamic_cast(setup.factory().new_device_by_classname("nld_sound_out", setup)); + setup.register_dev(snd_out, sname); + + setup.register_param(sname + ".CHAN" , m_channel); + setup.register_param(sname + ".MULT", m_mult); + setup.register_link(sname + ".IN", m_out_name); +} + + // ---------------------------------------------------------------------------------------- // netlist_mame_t // ---------------------------------------------------------------------------------------- @@ -221,7 +348,7 @@ void netlist_mame_device_t::device_start() if( sdev != NULL ) { LOG_DEV_CALLS(("Found subdevice %s/%s\n", d->name(), d->shortname())); - sdev->custom_netlist_additions(*m_netlist); + sdev->custom_netlist_additions(*m_setup); } } diff --git a/src/emu/machine/netlist.h b/src/emu/machine/netlist.h index 5a555666312..5a77e7c54b0 100644 --- a/src/emu/machine/netlist.h +++ b/src/emu/machine/netlist.h @@ -64,19 +64,35 @@ MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_ANALOG_INPUT, 0) \ netlist_mame_analog_input_t::static_set_name(*device, _name); -#define MCFG_NETLIST_ANALOG_INPUT_MULT_OFFSET(_mult, _offset) \ +#define MCFG_NETLIST_ANALOG_MULT_OFFSET(_mult, _offset) \ netlist_mame_analog_input_t::static_set_mult_offset(*device, _mult, _offset); -#define NETLIST_ANALOG_PORT_CHANGED(_base, _tag) \ - PORT_CHANGED_MEMBER(_base ":" _tag, netlist_mame_analog_input_t, input_changed, 0) +#define MCFG_NETLIST_ANALOG_OUTPUT(_basetag, _tag, _IN, _class, _member, _class_tag) \ + MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_ANALOG_OUTPUT, 0) \ + netlist_mame_analog_output_t::static_set_params(*device, _IN, \ + netlist_analog_output_delegate(& _class :: _member, \ + # _class "::" # _member, _class_tag, (_class *) 0) ); #define MCFG_NETLIST_LOGIC_INPUT(_basetag, _tag, _name, _shift, _mask) \ MCFG_DEVICE_ADD(_basetag ":" _tag, NETLIST_LOGIC_INPUT, 0) \ netlist_mame_logic_input_t::static_set_params(*device, _name, _mask, _shift); +#define MCFG_NETLIST_STREAM_INPUT(_basetag, _chan, _name) \ + MCFG_DEVICE_ADD(_basetag ":cin" # _chan, NETLIST_STREAM_INPUT, 0) \ + netlist_mame_stream_input_t::static_set_params(*device, _chan, _name); + +#define MCFG_NETLIST_STREAM_OUTPUT(_basetag, _chan, _name) \ + MCFG_DEVICE_ADD(_basetag ":cout" # _chan, NETLIST_STREAM_OUTPUT, 0) \ + netlist_mame_stream_output_t::static_set_params(*device, _chan, _name); + + #define NETLIST_LOGIC_PORT_CHANGED(_base, _tag) \ PORT_CHANGED_MEMBER(_base ":" _tag, netlist_mame_logic_input_t, input_changed, 0) +#define NETLIST_ANALOG_PORT_CHANGED(_base, _tag) \ + PORT_CHANGED_MEMBER(_base ":" _tag, netlist_mame_analog_input_t, input_changed, 0) + + // ---------------------------------------------------------------------------------------- // Extensions to interface netlist with MAME code .... // ---------------------------------------------------------------------------------------- @@ -84,6 +100,11 @@ #define NETLIST_MEMREGION(_name) \ netlist.parse((char *)downcast(netlist.netlist()).machine().root_device().memregion(_name)->base()); +#define NETDEV_ANALOG_CALLBACK_MEMBER(_name) \ + void _name(const double data, const attotime &time) + + +#if 0 #define NETDEV_ANALOG_CALLBACK(_name, _IN, _class, _member, _tag) \ { \ NETLIB_NAME(analog_callback) *dev = downcast(netlist.register_dev(NET_NEW(analog_callback), # _name)); \ @@ -91,10 +112,9 @@ dev->register_callback(d); \ } \ NET_CONNECT(_name, IN, _IN) +#endif -#define NETDEV_ANALOG_CALLBACK_MEMBER(_name) \ - void _name(const double data, const attotime &time) - +#if 0 #define NETDEV_SOUND_OUT(_name, _v, _m) \ NET_REGISTER_DEV(sound_out, _name) \ PARAM(_name.CHAN, _v) \ @@ -102,6 +122,7 @@ #define NETDEV_SOUND_IN(_name) \ NET_REGISTER_DEV(sound_in, _name) +#endif class netlist_mame_device_t; @@ -323,13 +344,14 @@ class netlist_mame_sub_interface public: // construction/destruction netlist_mame_sub_interface(device_t &aowner) + : m_offset(0.0), m_mult(1.0) { m_owner = dynamic_cast(&aowner); m_sound = dynamic_cast(&aowner); } virtual ~netlist_mame_sub_interface() { } - virtual void custom_netlist_additions(netlist_base_t &netlist) { } + virtual void custom_netlist_additions(netlist_setup_t &setup) { } inline netlist_mame_device_t &nl_owner() const { return *m_owner; } @@ -337,11 +359,15 @@ public: inline void update_to_current_time() { - printf("%p\n", m_sound); - printf("%p\n", m_sound->get_stream()); m_sound->get_stream()->update(); } + static void static_set_mult_offset(device_t &device, const double mult, const double offset); + +protected: + double m_offset; + double m_mult; + private: netlist_mame_device_t *m_owner; netlist_mame_sound_device_t *m_sound; @@ -361,7 +387,6 @@ public: virtual ~netlist_mame_analog_input_t() { } static void static_set_name(device_t &device, const char *param_name); - static void static_set_mult_offset(device_t &device, const double mult, const double offset); inline void write(const double val) { @@ -396,12 +421,38 @@ protected: private: netlist_param_double_t *m_param; - double m_offset; - double m_mult; bool m_auto_port; pstring m_param_name; }; +// ---------------------------------------------------------------------------------------- +// netlist_mame_analog_output_t +// ---------------------------------------------------------------------------------------- + +typedef device_delegate netlist_analog_output_delegate; + +class netlist_mame_analog_output_t : public device_t, + public netlist_mame_sub_interface +{ +public: + + // construction/destruction + netlist_mame_analog_output_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~netlist_mame_analog_output_t() { } + + static void static_set_params(device_t &device, const char *in_name, netlist_analog_output_delegate adelegate); + +protected: + // device-level overrides + virtual void device_start(); + virtual void custom_netlist_additions(netlist_setup_t &setup); + +private: + pstring m_in; + netlist_analog_output_delegate m_delegate; +}; + + // ---------------------------------------------------------------------------------------- // netlist_mame_logic_input_t // ---------------------------------------------------------------------------------------- @@ -450,10 +501,55 @@ private: }; // ---------------------------------------------------------------------------------------- -// netdev_callback +// netlist_mame_stream_input_t // ---------------------------------------------------------------------------------------- -typedef device_delegate netlist_analog_output_delegate; +class netlist_mame_stream_input_t : public device_t, + public netlist_mame_sub_interface +{ +public: + + // construction/destruction + netlist_mame_stream_input_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~netlist_mame_stream_input_t() { } + + static void static_set_params(device_t &device, int channel, const char *param_name); + +protected: + // device-level overrides + virtual void device_start(); + virtual void custom_netlist_additions(netlist_setup_t &setup); +private: + UINT32 m_channel; + pstring m_param_name; +}; + +// ---------------------------------------------------------------------------------------- +// netlist_mame_stream_output_t +// ---------------------------------------------------------------------------------------- + +class netlist_mame_stream_output_t : public device_t, + public netlist_mame_sub_interface +{ +public: + + // construction/destruction + netlist_mame_stream_output_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + virtual ~netlist_mame_stream_output_t() { } + + static void static_set_params(device_t &device, int channel, const char *out_name); + +protected: + // device-level overrides + virtual void device_start(); + virtual void custom_netlist_additions(netlist_setup_t &setup); +private: + UINT32 m_channel; + pstring m_out_name; +}; +// ---------------------------------------------------------------------------------------- +// netdev_callback +// ---------------------------------------------------------------------------------------- class NETLIB_NAME(analog_callback) : public netlist_device_t { @@ -464,7 +560,6 @@ public: ATTR_COLD void start() { register_input("IN", m_in); - m_callback.bind_relative_to(downcast(netlist()).machine().root_device()); m_cpu_device = downcast(&downcast(netlist()).parent()); } @@ -490,6 +585,10 @@ private: netlist_mame_cpu_device_t *m_cpu_device; }; +// ---------------------------------------------------------------------------------------- +// sound_out +// ---------------------------------------------------------------------------------------- + class NETLIB_NAME(sound_out) : public netlist_device_t { public: @@ -504,6 +603,7 @@ public: register_param("CHAN", m_channel, 0); register_param("MULT", m_mult, 1000.0); m_sample = netlist_time::from_hz(1); //sufficiently big enough + save(NAME(m_last_buffer)); } ATTR_COLD void reset() @@ -528,7 +628,7 @@ public: { double val = INPANALOG(m_in); sound_update(netlist().time()); - m_cur = val * m_mult.Value(); + m_cur = (stream_sample_t) (val * m_mult.Value()); } ATTR_HOT void buffer_reset(netlist_time upto) @@ -549,6 +649,10 @@ private: netlist_time m_last_buffer; }; +// ---------------------------------------------------------------------------------------- +// sound_in +// ---------------------------------------------------------------------------------------- + class NETLIB_NAME(sound_in) : public netlist_device_t { public: @@ -568,7 +672,10 @@ public: for (int i = 0; i < MAX_INPUT_CHANNELS; i++) + { register_param(pstring::sprintf("CHAN%d", i), m_param_name[i], ""); + register_param(pstring::sprintf("MULT%d", i), m_param_mult[i], 1.0); + } m_num_channel = 0; } @@ -602,7 +709,7 @@ public: if (m_buffer[i] == NULL) break; // stop, called outside of stream_update double v = m_buffer[i][m_pos]; - m_param[i]->setTo(v); + m_param[i]->setTo(v * m_param_mult[i].Value()); } m_pos++; OUTLOGIC(m_Q, !m_Q.net().new_Q(), m_inc ); @@ -616,6 +723,7 @@ public: netlist_param_str_t m_param_name[MAX_INPUT_CHANNELS]; netlist_param_double_t *m_param[MAX_INPUT_CHANNELS]; stream_sample_t *m_buffer[MAX_INPUT_CHANNELS]; + netlist_param_double_t m_param_mult[MAX_INPUT_CHANNELS]; netlist_time m_inc; private: @@ -633,4 +741,8 @@ extern const device_type NETLIST_SOUND; extern const device_type NETLIST_ANALOG_INPUT; extern const device_type NETLIST_LOGIC_INPUT; +extern const device_type NETLIST_ANALOG_OUTPUT; +extern const device_type NETLIST_STREAM_INPUT; +extern const device_type NETLIST_STREAM_OUTPUT; + #endif diff --git a/src/emu/netlist/analog/nld_solver.c b/src/emu/netlist/analog/nld_solver.c index c8a80a1c297..34a53e58f9f 100644 --- a/src/emu/netlist/analog/nld_solver.c +++ b/src/emu/netlist/analog/nld_solver.c @@ -120,9 +120,9 @@ void netlist_matrix_solver_t::schedule() } else { - //NL_VERBOSE_OUT(("resched\n"); + m_owner->netlist().warning("Matrix solver reschedule .. Consider increasing RESCHED_LOOPS"); if (m_owner != NULL) - this->m_owner->schedule1(); + this->m_owner->schedule(); } //solve(); // update_inputs(); @@ -637,10 +637,10 @@ NETLIB_START(solver) register_param("FREQ", m_freq, 48000.0); m_inc = netlist_time::from_hz(m_freq.Value()); - //register_param("ACCURACY", m_accuracy, 1e-3); register_param("ACCURACY", m_accuracy, 1e-7); register_param("CONVERG", m_convergence, 0.3); register_param("RESCHED_LOOPS", m_resched_loops, 35); + register_param("PARALLEL", m_parallel, 0); // internal staff @@ -686,6 +686,7 @@ NETLIB_UPDATE(solver) bool do_full = false; bool global_resched = false; bool this_resched[100]; + int t_cnt = m_mat_solvers.count(); if (delta < m_inc) do_full = true; // we have been called between updates @@ -693,39 +694,47 @@ NETLIB_UPDATE(solver) m_last_step = now; #if HAS_OPENMP && USE_OPENMP - int t_cnt = m_mat_solvers.count(); - omp_set_num_threads(3); - omp_set_dynamic(0); - #pragma omp parallel + if (m_parallel.Value()) { - int i; - #pragma omp for nowait - for (i = 0; i < t_cnt; i++) + omp_set_num_threads(4); + omp_set_dynamic(0); + #pragma omp parallel { - this_resched[i] = m_mat_solvers[i]->solve(); + #pragma omp for nowait + for (int i = 0; i < t_cnt; i++) + { + this_resched[i] = m_mat_solvers[i]->solve(); + } } } + else + for (int i = 0; i < t_cnt; i++) + { + if (do_full || (m_mat_solvers[i]->is_timestep())) + this_resched[i] = m_mat_solvers[i]->solve(); + } #else - for (int i = 0; i < m_mat_solvers.count(); i++) + for (int i = 0; i < t_cnt; i++) { if (do_full || (m_mat_solvers[i]->is_timestep())) this_resched[i] = m_mat_solvers[i]->solve(); } #endif - for (int i = 0; i < m_mat_solvers.count(); i++) + for (int i = 0; i < t_cnt; i++) { if (do_full || m_mat_solvers[i]->is_timestep()) { - global_resched = global_resched || this_resched[i]; - if (!this_resched[i]) - m_mat_solvers[i]->update_inputs(); + global_resched = global_resched || this_resched[i]; + if (!this_resched[i]) + m_mat_solvers[i]->update_inputs(); } } if (global_resched) { - schedule1(); + netlist().warning("Gobal reschedule .. Consider increasing RESCHED_LOOPS"); + schedule(); } else { diff --git a/src/emu/netlist/analog/nld_solver.h b/src/emu/netlist/analog/nld_solver.h index ae7ab4e8dc9..f43b514bde9 100644 --- a/src/emu/netlist/analog/nld_solver.h +++ b/src/emu/netlist/analog/nld_solver.h @@ -164,6 +164,7 @@ NETLIB_DEVICE_WITH_PARAMS(solver, netlist_param_double_t m_accuracy; netlist_param_double_t m_convergence; netlist_param_int_t m_resched_loops; + netlist_param_int_t m_parallel; netlist_time m_inc; netlist_time m_last_step; @@ -174,12 +175,12 @@ public: ATTR_COLD ~NETLIB_NAME(solver)(); - ATTR_HOT inline void schedule1(); + ATTR_HOT inline void schedule(); ATTR_COLD void post_start(); ); -ATTR_HOT inline void NETLIB_NAME(solver)::schedule1() +ATTR_HOT inline void NETLIB_NAME(solver)::schedule() { if (!m_Q_sync.net().is_queued()) m_Q_sync.net().push_to_queue(m_nt_sync_delay); diff --git a/src/emu/netlist/nl_base.c b/src/emu/netlist/nl_base.c index 1d9e08907bf..d12fb61e414 100644 --- a/src/emu/netlist/nl_base.c +++ b/src/emu/netlist/nl_base.c @@ -551,13 +551,7 @@ ATTR_HOT inline void netlist_net_t::update_devs() m_in_queue = 2; /* mark as taken ... */ netlist_core_terminal_t *p = m_head; -#if 0 - do - { - update_dev(p, mask); - p = p->m_update_list_next; - } while (p != NULL); -#else + switch (m_num_cons) { case 2: @@ -574,7 +568,7 @@ ATTR_HOT inline void netlist_net_t::update_devs() } while (p != NULL); break; } -#endif + m_last = m_cur; } diff --git a/src/emu/netlist/nl_base.h b/src/emu/netlist/nl_base.h index 75073ab5935..f22df427182 100644 --- a/src/emu/netlist/nl_base.h +++ b/src/emu/netlist/nl_base.h @@ -1086,6 +1086,18 @@ public: return tmp; } + template + _C get_first_device() + { + for (tagmap_devices_t::entry_t *entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry)) + { + _C dev = dynamic_cast<_C>(entry->object()); + if (dev != NULL) + return dev; + } + return NULL; + } + tagmap_devices_t m_devices; netlist_net_t::list_t m_nets; diff --git a/src/emu/netlist/nl_config.h b/src/emu/netlist/nl_config.h index 5136d5ae6b1..e45ef742afb 100644 --- a/src/emu/netlist/nl_config.h +++ b/src/emu/netlist/nl_config.h @@ -34,8 +34,6 @@ #define NETLIST_INTERNAL_RES (U64(1000000000)) //#define NETLIST_INTERNAL_RES (U64(1000000000000)) -//#define USE_ALTERNATE_SCHEDULING (1) - #define NETLIST_CLOCK (NETLIST_INTERNAL_RES) #define NETLIST_GMIN (1e-9) diff --git a/src/mame/drivers/1942.c b/src/mame/drivers/1942.c index cee3e936616..a890bf03707 100644 --- a/src/mame/drivers/1942.c +++ b/src/mame/drivers/1942.c @@ -63,21 +63,13 @@ correctly. #define SOUND_CPU_CLOCK (XTAL_12MHz/4) /* 12MHz is the only OSC on the PCB */ #define AUDIO_CLOCK (XTAL_12MHz/8) /* 12MHz is the only OSC on the PCB */ -#define USE_NETLIST (0) - #include "emu.h" #include "cpu/z80/z80.h" #include "sound/ay8910.h" -#include "includes/1942.h" - -#if USE_NETLIST #include "machine/netlist.h" #include "netlist/devices/net_lib.h" -#endif - - -#if USE_NETLIST +#include "includes/1942.h" #define NLFILT(RA, R1, C1, R2) \ NET_C(RA.1, V5) \ @@ -94,14 +86,6 @@ static NETLIST_START(nl_1942) PARAM(Solver.FREQ, 48000) ANALOG_INPUT(V5, 5) - NETDEV_SOUND_IN(SND_IN) - PARAM(SND_IN.CHAN0, "R_AY1_1.R") - PARAM(SND_IN.CHAN1, "R_AY1_2.R") - PARAM(SND_IN.CHAN2, "R_AY1_3.R") - PARAM(SND_IN.CHAN3, "R_AY2_1.R") - PARAM(SND_IN.CHAN4, "R_AY2_2.R") - PARAM(SND_IN.CHAN5, "R_AY2_3.R") - /* AY 8910 internal resistors */ RES(R_AY1_1, 1000); @@ -157,11 +141,7 @@ static NETLIST_START(nl_1942) NET_C(CC6.2, R1.1) NET_C(R1.2, GND) - NETDEV_SOUND_OUT(CH0, 0, 100000) - NET_C(CH0.IN, R1.1) - NETLIST_END() -#endif WRITE8_MEMBER(_1942_state::c1942_bankswitch_w) { @@ -538,7 +518,6 @@ void _1942_state::machine_reset() m_scroll[1] = 0; } -#if USE_NETLIST static const ay8910_interface ay8910_config = { AY8910_RESISTOR_OUTPUT, @@ -548,7 +527,6 @@ static const ay8910_interface ay8910_config = DEVCB_NULL, DEVCB_NULL }; -#endif static MACHINE_CONFIG_START( 1942, _1942_state ) @@ -576,7 +554,7 @@ static MACHINE_CONFIG_START( 1942, _1942_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") -#if USE_NETLIST + MCFG_SOUND_ADD("ay1", AY8910, AUDIO_CLOCK) /* 1.5 MHz */ MCFG_SOUND_CONFIG(ay8910_config) MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 0) @@ -588,16 +566,22 @@ static MACHINE_CONFIG_START( 1942, _1942_state ) MCFG_SOUND_ROUTE_EX(1, "snd_nl", 1.0, 4) MCFG_SOUND_ROUTE_EX(2, "snd_nl", 1.0, 5) + /* NETLIST configuration using internal AY8910 resistor values */ + MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000) MCFG_NETLIST_SETUP(nl_1942) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 5.0) -#else - MCFG_SOUND_ADD("ay1", AY8910, AUDIO_CLOCK) /* 1.5 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_SOUND_ADD("ay2", AY8910, AUDIO_CLOCK) /* 1.5 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -#endif + MCFG_NETLIST_STREAM_INPUT("snd_nl", 0, "R_AY1_1.R") + MCFG_NETLIST_STREAM_INPUT("snd_nl", 1, "R_AY1_2.R") + MCFG_NETLIST_STREAM_INPUT("snd_nl", 2, "R_AY1_3.R") + MCFG_NETLIST_STREAM_INPUT("snd_nl", 3, "R_AY2_1.R") + MCFG_NETLIST_STREAM_INPUT("snd_nl", 4, "R_AY2_2.R") + MCFG_NETLIST_STREAM_INPUT("snd_nl", 5, "R_AY2_3.R") + + MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "R1.1") + MCFG_NETLIST_ANALOG_MULT_OFFSET(100000.0, 0.0) + MACHINE_CONFIG_END diff --git a/src/mame/drivers/pong.c b/src/mame/drivers/pong.c index 43123743319..e81cdc40dfc 100644 --- a/src/mame/drivers/pong.c +++ b/src/mame/drivers/pong.c @@ -728,16 +728,16 @@ static NETLIST_START(pong) //NETLIST_INCLUDE(pong_schematics) NETLIST_MEMREGION("maincpu") - NETDEV_ANALOG_CALLBACK(sound_cb, sound, pong_state, sound_cb, "") - NETDEV_ANALOG_CALLBACK(video_cb, videomix, fixedfreq_device, update_vid, "fixfreq") + //NETDEV_ANALOG_CALLBACK(sound_cb, sound, pong_state, sound_cb, "") + //NETDEV_ANALOG_CALLBACK(video_cb, videomix, fixedfreq_device, update_vid, "fixfreq") NETLIST_END() static NETLIST_START(pong_fast) NETLIST_INCLUDE(pong_schematics) - NETDEV_ANALOG_CALLBACK(sound_cb, sound, pong_state, sound_cb, "") - NETDEV_ANALOG_CALLBACK(video_cb, videomix, fixedfreq_device, update_vid, "fixfreq") + //NETDEV_ANALOG_CALLBACK(sound_cb, sound, pong_state, sound_cb, "") + //NETDEV_ANALOG_CALLBACK(video_cb, videomix, fixedfreq_device, update_vid, "fixfreq") NETLIST_END() @@ -747,8 +747,8 @@ static NETLIST_START(pongd) NETLIST_INCLUDE(pongdoubles) - NETDEV_ANALOG_CALLBACK(sound_cb, AUDIO, pong_state, sound_cb, "") - NETDEV_ANALOG_CALLBACK(video_cb, videomix, fixedfreq_device, update_vid, "fixfreq") + //NETDEV_ANALOG_CALLBACK(sound_cb, AUDIO, pong_state, sound_cb, "") + //NETDEV_ANALOG_CALLBACK(video_cb, videomix, fixedfreq_device, update_vid, "fixfreq") NETLIST_END() #endif @@ -766,8 +766,8 @@ static NETLIST_START(test) SOLVER(Solver) PARAM(Solver.FREQ, 48000) - NETDEV_SOUND_IN(SND_IN) - PARAM(SND_IN.CHAN0, "tin.IN") + //NETDEV_SOUND_IN(SND_IN) + //PARAM(SND_IN.CHAN0, "tin.IN") ANALOG_INPUT(tin, 0) @@ -779,12 +779,15 @@ static NETLIST_START(test) NET_C(n1.Q, R1.2) NET_C(n2.Q, C1.1) NET_C(C1.2, R1.1) + LOG(log1, n2.Q) +#if 0 NETDEV_SOUND_OUT(CH0, 0) NET_C(CH0.IN, n2.Q) NETDEV_SOUND_OUT(CH1, 1) NET_C(CH1.IN, tin.Q) +#endif NETLIST_END() #endif @@ -876,9 +879,9 @@ static MACHINE_CONFIG_START( pong, pong_state ) MCFG_NETLIST_SETUP(pong) MCFG_NETLIST_ANALOG_INPUT("maincpu", "vr0", "ic_b9_R.R") - MCFG_NETLIST_ANALOG_INPUT_MULT_OFFSET(1.0 / 100.0 * RES_K(50), RES_K(56) ) + MCFG_NETLIST_ANALOG_MULT_OFFSET(1.0 / 100.0 * RES_K(50), RES_K(56) ) MCFG_NETLIST_ANALOG_INPUT("maincpu", "vr1", "ic_a9_R.R") - MCFG_NETLIST_ANALOG_INPUT_MULT_OFFSET(1.0 / 100.0 * RES_K(50), RES_K(56) ) + MCFG_NETLIST_ANALOG_MULT_OFFSET(1.0 / 100.0 * RES_K(50), RES_K(56) ) MCFG_NETLIST_ANALOG_INPUT("maincpu", "pot0", "ic_b9_POT.DIAL") MCFG_NETLIST_ANALOG_INPUT("maincpu", "pot1", "ic_a9_POT.DIAL") MCFG_NETLIST_LOGIC_INPUT("maincpu", "sw1a", "sw1a.POS", 0, 0x01) @@ -886,6 +889,9 @@ static MACHINE_CONFIG_START( pong, pong_state ) MCFG_NETLIST_LOGIC_INPUT("maincpu", "coinsw", "coinsw.POS", 0, 0x01) MCFG_NETLIST_LOGIC_INPUT("maincpu", "antenna", "antenna.IN", 0, 0x01) + MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "snd0", "sound", pong_state, sound_cb, "") + MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "vid0", "videomix", fixedfreq_device, update_vid, "fixfreq") + /* video hardware */ //MCFG_FIXFREQ_ADD("fixfreq", "screen", fixedfreq_mode_ntsc720) @@ -905,6 +911,16 @@ static MACHINE_CONFIG_START( pong, pong_state ) MCFG_SOUND_ADD("snd_test", NETLIST_SOUND, 48000) MCFG_NETLIST_SETUP(test) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_NETLIST_STREAM_INPUT("snd_test", 0, "tin.IN") + MCFG_NETLIST_ANALOG_MULT_OFFSET(0.001, 0.0) + + //MCFG_NETLIST_STREAM_OUTPUT("snd_test", 0, "tin.Q", 100) + MCFG_NETLIST_STREAM_OUTPUT("snd_test", 0, "n2.Q") + MCFG_NETLIST_ANALOG_MULT_OFFSET(1000.0, 0.0) + MCFG_NETLIST_STREAM_OUTPUT("snd_test", 1, "tin.Q") + MCFG_NETLIST_ANALOG_MULT_OFFSET(1000.0, 0.0) + #endif MACHINE_CONFIG_END @@ -940,6 +956,9 @@ static MACHINE_CONFIG_START( pongd, pong_state ) MCFG_NETLIST_LOGIC_INPUT("maincpu", "antenna", "antenna.IN", 0, 0x01) #endif + MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "snd0", "AUDIO", pong_state, sound_cb, "") + MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "vid0", "videomix", fixedfreq_device, update_vid, "fixfreq") + /* video hardware */ //MCFG_FIXFREQ_ADD("fixfreq", "screen", fixedfreq_mode_ntsc720)