mirror of
https://github.com/holub/mame
synced 2025-07-05 18:08:04 +03:00
- Some bug fixes for sound device routing
- pong doubles (yet to be committed) starts up again.
This commit is contained in:
parent
1f68cb9336
commit
799c621d65
@ -66,7 +66,7 @@ const device_type NETLIST_LOGIC_INPUT = &device_creator<netlist_mame_logic_input
|
|||||||
|
|
||||||
netlist_mame_analog_input_t::netlist_mame_analog_input_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
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__),
|
: device_t(mconfig, NETLIST_ANALOG_INPUT, "netlist analog input", tag, owner, clock, "netlist_analog_input", __FILE__),
|
||||||
netlist_mame_sub_interface(*this),
|
netlist_mame_sub_interface(*owner),
|
||||||
m_param(0),
|
m_param(0),
|
||||||
m_offset(0.0),
|
m_offset(0.0),
|
||||||
m_mult(1.0),
|
m_mult(1.0),
|
||||||
@ -93,7 +93,7 @@ void netlist_mame_analog_input_t::static_set_mult_offset(device_t &device, const
|
|||||||
void netlist_mame_analog_input_t::device_start()
|
void netlist_mame_analog_input_t::device_start()
|
||||||
{
|
{
|
||||||
LOG_DEV_CALLS(("start %s\n", tag()));
|
LOG_DEV_CALLS(("start %s\n", tag()));
|
||||||
netlist_param_t *p = downcast<netlist_mame_device_t *>(this->owner())->setup().find_param(m_param_name);
|
netlist_param_t *p = this->nl_owner().setup().find_param(m_param_name);
|
||||||
m_param = dynamic_cast<netlist_param_double_t *>(p);
|
m_param = dynamic_cast<netlist_param_double_t *>(p);
|
||||||
if (m_param == NULL)
|
if (m_param == NULL)
|
||||||
{
|
{
|
||||||
@ -103,7 +103,7 @@ void netlist_mame_analog_input_t::device_start()
|
|||||||
|
|
||||||
netlist_mame_logic_input_t::netlist_mame_logic_input_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
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__),
|
: device_t(mconfig, NETLIST_ANALOG_INPUT, "netlist analog input", tag, owner, clock, "netlist_analog_input", __FILE__),
|
||||||
netlist_mame_sub_interface(*this),
|
netlist_mame_sub_interface(*owner),
|
||||||
m_param(0),
|
m_param(0),
|
||||||
m_mask(0xffffffff),
|
m_mask(0xffffffff),
|
||||||
m_shift(0),
|
m_shift(0),
|
||||||
|
@ -281,6 +281,9 @@ public:
|
|||||||
|
|
||||||
static void static_set_constructor(device_t &device, void (*setup_func)(netlist_setup_t &));
|
static void static_set_constructor(device_t &device, void (*setup_func)(netlist_setup_t &));
|
||||||
|
|
||||||
|
inline sound_stream *get_stream() { return m_stream; }
|
||||||
|
|
||||||
|
|
||||||
// device_sound_interface overrides
|
// device_sound_interface overrides
|
||||||
|
|
||||||
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||||
@ -318,14 +321,29 @@ class netlist_mame_sub_interface
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// construction/destruction
|
// construction/destruction
|
||||||
netlist_mame_sub_interface(netlist_mame_device_t &obj) : m_object(obj) {}
|
netlist_mame_sub_interface(device_t &aowner)
|
||||||
|
{
|
||||||
|
m_owner = dynamic_cast<netlist_mame_device_t *>(&aowner);
|
||||||
|
m_sound = dynamic_cast<netlist_mame_sound_device_t *>(&aowner);
|
||||||
|
}
|
||||||
virtual ~netlist_mame_sub_interface() { }
|
virtual ~netlist_mame_sub_interface() { }
|
||||||
|
|
||||||
virtual void custom_netlist_additions(netlist_base_t &netlist) { }
|
virtual void custom_netlist_additions(netlist_base_t &netlist) { }
|
||||||
|
|
||||||
inline netlist_mame_device_t &object() { return m_object; }
|
inline netlist_mame_device_t &nl_owner() const { return *m_owner; }
|
||||||
|
|
||||||
|
inline bool is_sound_device() const { return (m_sound != NULL); }
|
||||||
|
|
||||||
|
inline void update_to_current_time()
|
||||||
|
{
|
||||||
|
printf("%p\n", m_sound);
|
||||||
|
printf("%p\n", m_sound->get_stream());
|
||||||
|
m_sound->get_stream()->update();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
netlist_mame_device_t &m_object;
|
netlist_mame_device_t *m_owner;
|
||||||
|
netlist_mame_sound_device_t *m_sound;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------
|
||||||
@ -344,7 +362,19 @@ public:
|
|||||||
static void static_set_name(device_t &device, const char *param_name);
|
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);
|
static void static_set_mult_offset(device_t &device, const double mult, const double offset);
|
||||||
|
|
||||||
inline void write(const double val) { m_param->setTo(val * m_mult + m_offset); }
|
inline void write(const double val)
|
||||||
|
{
|
||||||
|
if (is_sound_device())
|
||||||
|
{
|
||||||
|
update_to_current_time();
|
||||||
|
m_param->setTo(val * m_mult + m_offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// FIXME: use device timer ....
|
||||||
|
m_param->setTo(val * m_mult + m_offset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inline DECLARE_INPUT_CHANGED_MEMBER(input_changed)
|
inline DECLARE_INPUT_CHANGED_MEMBER(input_changed)
|
||||||
{
|
{
|
||||||
@ -386,7 +416,19 @@ public:
|
|||||||
|
|
||||||
static void static_set_params(device_t &device, const char *param_name, const UINT32 mask, const UINT32 shift);
|
static void static_set_params(device_t &device, const char *param_name, const UINT32 mask, const UINT32 shift);
|
||||||
|
|
||||||
inline void write(const UINT32 val) { m_param->setTo((val >> m_shift) & m_mask); }
|
inline void write(const UINT32 val)
|
||||||
|
{
|
||||||
|
if (is_sound_device())
|
||||||
|
{
|
||||||
|
update_to_current_time();
|
||||||
|
m_param->setTo((val >> m_shift) & m_mask);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// FIXME: use device timer ....
|
||||||
|
m_param->setTo((val >> m_shift) & m_mask);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inline DECLARE_INPUT_CHANGED_MEMBER(input_changed) { write(newval); }
|
inline DECLARE_INPUT_CHANGED_MEMBER(input_changed) { write(newval); }
|
||||||
DECLARE_WRITE_LINE_MEMBER(write_line) { write(state); }
|
DECLARE_WRITE_LINE_MEMBER(write_line) { write(state); }
|
||||||
@ -510,7 +552,7 @@ public:
|
|||||||
NETLIB_NAME(sound_in)()
|
NETLIB_NAME(sound_in)()
|
||||||
: netlist_device_t() { }
|
: netlist_device_t() { }
|
||||||
|
|
||||||
static const int BUFSIZE = 2048;
|
static const int MAX_INPUT_CHANNELS = 10;
|
||||||
|
|
||||||
ATTR_COLD void start()
|
ATTR_COLD void start()
|
||||||
{
|
{
|
||||||
@ -522,7 +564,7 @@ public:
|
|||||||
m_inc = netlist_time::from_nsec(1);
|
m_inc = netlist_time::from_nsec(1);
|
||||||
|
|
||||||
|
|
||||||
for (int i=0; i<10; i++)
|
for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
|
||||||
register_param(pstring::sprintf("CHAN%d", i), m_param_name[i], "");
|
register_param(pstring::sprintf("CHAN%d", i), m_param_name[i], "");
|
||||||
m_num_channel = 0;
|
m_num_channel = 0;
|
||||||
}
|
}
|
||||||
@ -530,14 +572,14 @@ public:
|
|||||||
ATTR_COLD void reset()
|
ATTR_COLD void reset()
|
||||||
{
|
{
|
||||||
m_pos = 0;
|
m_pos = 0;
|
||||||
for (int i=0; i<10; i++)
|
for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
|
||||||
m_buffer[i] = NULL;
|
m_buffer[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ATTR_COLD int resolve()
|
ATTR_COLD int resolve()
|
||||||
{
|
{
|
||||||
m_pos = 0;
|
m_pos = 0;
|
||||||
for (int i=0; i<10; i++)
|
for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
|
||||||
{
|
{
|
||||||
if (m_param_name[i].Value() != "")
|
if (m_param_name[i].Value() != "")
|
||||||
{
|
{
|
||||||
@ -568,9 +610,9 @@ public:
|
|||||||
m_pos = 0;
|
m_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
netlist_param_str_t m_param_name[10];
|
netlist_param_str_t m_param_name[MAX_INPUT_CHANNELS];
|
||||||
netlist_param_double_t *m_param[10];
|
netlist_param_double_t *m_param[MAX_INPUT_CHANNELS];
|
||||||
stream_sample_t *m_buffer[10];
|
stream_sample_t *m_buffer[MAX_INPUT_CHANNELS];
|
||||||
netlist_time m_inc;
|
netlist_time m_inc;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -31,6 +31,11 @@ NETLIB_START(7400_dip)
|
|||||||
|
|
||||||
NETLIB_UPDATE(7400_dip)
|
NETLIB_UPDATE(7400_dip)
|
||||||
{
|
{
|
||||||
|
/* only called during startup */
|
||||||
|
m_1.update_dev();
|
||||||
|
m_2.update_dev();
|
||||||
|
m_3.update_dev();
|
||||||
|
m_4.update_dev();
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_RESET(7400_dip)
|
NETLIB_RESET(7400_dip)
|
||||||
|
@ -31,6 +31,11 @@ NETLIB_START(7402_dip)
|
|||||||
|
|
||||||
NETLIB_UPDATE(7402_dip)
|
NETLIB_UPDATE(7402_dip)
|
||||||
{
|
{
|
||||||
|
/* only called during startup */
|
||||||
|
m_1.update_dev();
|
||||||
|
m_2.update_dev();
|
||||||
|
m_3.update_dev();
|
||||||
|
m_4.update_dev();
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_RESET(7402_dip)
|
NETLIB_RESET(7402_dip)
|
||||||
|
@ -52,6 +52,14 @@ NETLIB_START(7404_dip)
|
|||||||
|
|
||||||
NETLIB_UPDATE(7404_dip)
|
NETLIB_UPDATE(7404_dip)
|
||||||
{
|
{
|
||||||
|
/* only called during startup */
|
||||||
|
|
||||||
|
m_1.update_dev();
|
||||||
|
m_2.update_dev();
|
||||||
|
m_3.update_dev();
|
||||||
|
m_4.update_dev();
|
||||||
|
m_5.update_dev();
|
||||||
|
m_6.update_dev();
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_RESET(7404_dip)
|
NETLIB_RESET(7404_dip)
|
||||||
|
@ -29,6 +29,10 @@ NETLIB_START(7410_dip)
|
|||||||
|
|
||||||
NETLIB_UPDATE(7410_dip)
|
NETLIB_UPDATE(7410_dip)
|
||||||
{
|
{
|
||||||
|
/* only called during startup */
|
||||||
|
m_1.update_dev();
|
||||||
|
m_2.update_dev();
|
||||||
|
m_3.update_dev();
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_RESET(7410_dip)
|
NETLIB_RESET(7410_dip)
|
||||||
|
@ -19,6 +19,8 @@ NETLIB_START(74107Asub)
|
|||||||
NETLIB_RESET(74107Asub)
|
NETLIB_RESET(74107Asub)
|
||||||
{
|
{
|
||||||
m_clk.set_state(netlist_input_t::STATE_INP_HL);
|
m_clk.set_state(netlist_input_t::STATE_INP_HL);
|
||||||
|
m_Q.initial(0);
|
||||||
|
m_QQ.initial(1);
|
||||||
|
|
||||||
m_Q1 = 0;
|
m_Q1 = 0;
|
||||||
m_Q2 = 0;
|
m_Q2 = 0;
|
||||||
@ -133,4 +135,7 @@ NETLIB_RESET(74107_dip)
|
|||||||
|
|
||||||
NETLIB_UPDATE(74107_dip)
|
NETLIB_UPDATE(74107_dip)
|
||||||
{
|
{
|
||||||
|
/* only called during startup */
|
||||||
|
m_1.update_dev();
|
||||||
|
m_2.update_dev();
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,9 @@ NETLIB_START(7420_dip)
|
|||||||
|
|
||||||
NETLIB_UPDATE(7420_dip)
|
NETLIB_UPDATE(7420_dip)
|
||||||
{
|
{
|
||||||
|
/* only called during startup */
|
||||||
|
m_1.update_dev();
|
||||||
|
m_2.update_dev();
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_RESET(7420_dip)
|
NETLIB_RESET(7420_dip)
|
||||||
|
@ -32,6 +32,9 @@ NETLIB_START(7425_dip)
|
|||||||
|
|
||||||
NETLIB_UPDATE(7425_dip)
|
NETLIB_UPDATE(7425_dip)
|
||||||
{
|
{
|
||||||
|
/* only called during startup */
|
||||||
|
m_1.update_dev();
|
||||||
|
m_2.update_dev();
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_RESET(7425_dip)
|
NETLIB_RESET(7425_dip)
|
||||||
|
@ -29,6 +29,10 @@ NETLIB_START(7427_dip)
|
|||||||
|
|
||||||
NETLIB_UPDATE(7427_dip)
|
NETLIB_UPDATE(7427_dip)
|
||||||
{
|
{
|
||||||
|
/* only called during startup */
|
||||||
|
m_1.update_dev();
|
||||||
|
m_2.update_dev();
|
||||||
|
m_3.update_dev();
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_RESET(7427_dip)
|
NETLIB_RESET(7427_dip)
|
||||||
|
@ -24,6 +24,8 @@ NETLIB_START(7430_dip)
|
|||||||
|
|
||||||
NETLIB_UPDATE(7430_dip)
|
NETLIB_UPDATE(7430_dip)
|
||||||
{
|
{
|
||||||
|
/* only called during startup */
|
||||||
|
m_1.update_dev();
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_RESET(7430_dip)
|
NETLIB_RESET(7430_dip)
|
||||||
|
@ -76,6 +76,9 @@ NETLIB_START(7450_dip)
|
|||||||
|
|
||||||
NETLIB_UPDATE(7450_dip)
|
NETLIB_UPDATE(7450_dip)
|
||||||
{
|
{
|
||||||
|
/* only called during startup */
|
||||||
|
m_1.update_dev();
|
||||||
|
m_2.update_dev();
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_RESET(7450_dip)
|
NETLIB_RESET(7450_dip)
|
||||||
|
@ -5,33 +5,38 @@
|
|||||||
|
|
||||||
#include "nld_7474.h"
|
#include "nld_7474.h"
|
||||||
|
|
||||||
ATTR_HOT inline void NETLIB_NAME(7474sub)::newstate(const UINT8 state)
|
ATTR_HOT inline void NETLIB_NAME(7474sub)::newstate(const UINT8 stateQ, const UINT8 stateQQ)
|
||||||
{
|
{
|
||||||
static const netlist_time delay[2] = { NLTIME_FROM_NS(25), NLTIME_FROM_NS(40) };
|
static const netlist_time delay[2] = { NLTIME_FROM_NS(25), NLTIME_FROM_NS(40) };
|
||||||
OUTLOGIC(m_Q, state, delay[state]);
|
OUTLOGIC(m_Q, stateQ, delay[stateQ]);
|
||||||
OUTLOGIC(m_QQ, !state, delay[!state]);
|
OUTLOGIC(m_QQ, stateQQ, delay[stateQQ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_UPDATE(7474sub)
|
NETLIB_UPDATE(7474sub)
|
||||||
{
|
{
|
||||||
//if (!INP_LAST(m_clk) & INP(m_clk))
|
//if (INP_LH(m_CLK))
|
||||||
{
|
{
|
||||||
newstate(m_nextD);
|
newstate(m_nextD, !m_nextD);
|
||||||
m_CLK.inactivate();
|
m_CLK.inactivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_UPDATE(7474)
|
NETLIB_UPDATE(7474)
|
||||||
{
|
{
|
||||||
|
if (!INPLOGIC(m_PREQ) && !INPLOGIC(m_CLRQ))
|
||||||
|
{
|
||||||
|
sub.newstate(1, 1);
|
||||||
|
sub.m_CLK.inactivate();
|
||||||
|
}
|
||||||
if (!INPLOGIC(m_PREQ))
|
if (!INPLOGIC(m_PREQ))
|
||||||
{
|
{
|
||||||
sub.newstate(1);
|
sub.newstate(1, 0);
|
||||||
sub.m_CLK.inactivate();
|
sub.m_CLK.inactivate();
|
||||||
m_D.inactivate();
|
m_D.inactivate();
|
||||||
}
|
}
|
||||||
else if (!INPLOGIC(m_CLRQ))
|
else if (!INPLOGIC(m_CLRQ))
|
||||||
{
|
{
|
||||||
sub.newstate(0);
|
sub.newstate(0, 1);
|
||||||
sub.m_CLK.inactivate();
|
sub.m_CLK.inactivate();
|
||||||
m_D.inactivate();
|
m_D.inactivate();
|
||||||
}
|
}
|
||||||
@ -77,6 +82,9 @@ NETLIB_RESET(7474sub)
|
|||||||
m_CLK.set_state(netlist_input_t::STATE_INP_LH);
|
m_CLK.set_state(netlist_input_t::STATE_INP_LH);
|
||||||
|
|
||||||
m_nextD = 0;
|
m_nextD = 0;
|
||||||
|
/* FIXME: required by pong doubles - need a mechanism to set this from netlist */
|
||||||
|
m_Q.initial(1);
|
||||||
|
m_QQ.initial(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_START(7474_dip)
|
NETLIB_START(7474_dip)
|
||||||
@ -109,4 +117,6 @@ NETLIB_RESET(7474_dip)
|
|||||||
|
|
||||||
NETLIB_UPDATE(7474_dip)
|
NETLIB_UPDATE(7474_dip)
|
||||||
{
|
{
|
||||||
|
m_1.update_dev();
|
||||||
|
m_2.update_dev();
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ NETLIB_SUBDEVICE(7474sub,
|
|||||||
netlist_ttl_output_t m_Q;
|
netlist_ttl_output_t m_Q;
|
||||||
netlist_ttl_output_t m_QQ;
|
netlist_ttl_output_t m_QQ;
|
||||||
|
|
||||||
ATTR_HOT inline void newstate(const UINT8 state);
|
ATTR_HOT inline void newstate(const UINT8 stateQ, const UINT8 stateQQ);
|
||||||
);
|
);
|
||||||
|
|
||||||
NETLIB_DEVICE(7474,
|
NETLIB_DEVICE(7474,
|
||||||
|
@ -49,6 +49,11 @@ NETLIB_START(7486_dip)
|
|||||||
|
|
||||||
NETLIB_UPDATE(7486_dip)
|
NETLIB_UPDATE(7486_dip)
|
||||||
{
|
{
|
||||||
|
/* only called during startup */
|
||||||
|
m_1.update_dev();
|
||||||
|
m_2.update_dev();
|
||||||
|
m_3.update_dev();
|
||||||
|
m_4.update_dev();
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_RESET(7486_dip)
|
NETLIB_RESET(7486_dip)
|
||||||
|
@ -16,6 +16,8 @@ NETLIB_START(nicRSFF)
|
|||||||
|
|
||||||
NETLIB_RESET(nicRSFF)
|
NETLIB_RESET(nicRSFF)
|
||||||
{
|
{
|
||||||
|
m_Q.initial(0);
|
||||||
|
m_QQ.initial(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
NETLIB_UPDATE(nicRSFF)
|
NETLIB_UPDATE(nicRSFF)
|
||||||
|
@ -47,6 +47,7 @@ public:
|
|||||||
|
|
||||||
ATTR_COLD void reset()
|
ATTR_COLD void reset()
|
||||||
{
|
{
|
||||||
|
m_Q.initial(1);
|
||||||
m_active = 1;
|
m_active = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,6 +100,7 @@ public:
|
|||||||
|
|
||||||
ATTR_COLD void reset()
|
ATTR_COLD void reset()
|
||||||
{
|
{
|
||||||
|
m_Q.initial(1);
|
||||||
m_active = 1;
|
m_active = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,6 +173,7 @@ public:
|
|||||||
|
|
||||||
ATTR_COLD void reset()
|
ATTR_COLD void reset()
|
||||||
{
|
{
|
||||||
|
m_Q.initial(1);
|
||||||
m_active = 1;
|
m_active = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +244,7 @@ public:
|
|||||||
{
|
{
|
||||||
register_input(sIN[i], m_i[i], netlist_input_t::STATE_INP_ACTIVE);
|
register_input(sIN[i], m_i[i], netlist_input_t::STATE_INP_ACTIVE);
|
||||||
}
|
}
|
||||||
m_Q.initial(1);
|
//m_Q.initial(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ATTR_HOT ATTR_ALIGN void update()
|
ATTR_HOT ATTR_ALIGN void update()
|
||||||
|
Loading…
Reference in New Issue
Block a user