Previous 199869 Revisions Next

r27453 Monday 3rd February, 2014 at 23:53:23 UTC by Couriersud
- Some bug fixes for sound device routing
- pong doubles (yet to be committed) starts up again.
[src/emu/machine]netlist.c netlist.h
[src/emu/netlist/devices]nld_7400.c nld_7402.c nld_7404.c nld_7410.c nld_74107.c nld_7420.c nld_7425.c nld_7427.c nld_7430.c nld_7450.c nld_7474.c nld_7474.h nld_7486.c nld_legacy.c nld_signal.h

trunk/src/emu/machine/netlist.c
r27452r27453
6666
6767netlist_mame_analog_input_t::netlist_mame_analog_input_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
6868      : device_t(mconfig, NETLIST_ANALOG_INPUT, "netlist analog input", tag, owner, clock, "netlist_analog_input", __FILE__),
69         netlist_mame_sub_interface(*this),
69         netlist_mame_sub_interface(*owner),
7070         m_param(0),
7171         m_offset(0.0),
7272         m_mult(1.0),
r27452r27453
9393void netlist_mame_analog_input_t::device_start()
9494{
9595   LOG_DEV_CALLS(("start %s\n", tag()));
96   netlist_param_t *p = downcast<netlist_mame_device_t *>(this->owner())->setup().find_param(m_param_name);
96   netlist_param_t *p = this->nl_owner().setup().find_param(m_param_name);
9797   m_param = dynamic_cast<netlist_param_double_t *>(p);
9898   if (m_param == NULL)
9999   {
r27452r27453
103103
104104netlist_mame_logic_input_t::netlist_mame_logic_input_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
105105      : device_t(mconfig, NETLIST_ANALOG_INPUT, "netlist analog input", tag, owner, clock, "netlist_analog_input", __FILE__),
106         netlist_mame_sub_interface(*this),
106         netlist_mame_sub_interface(*owner),
107107         m_param(0),
108108         m_mask(0xffffffff),
109109         m_shift(0),
trunk/src/emu/machine/netlist.h
r27452r27453
281281
282282    static void static_set_constructor(device_t &device, void (*setup_func)(netlist_setup_t &));
283283
284    inline sound_stream *get_stream() { return m_stream; }
285
286
284287    // device_sound_interface overrides
285288
286289    virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
r27452r27453
318321{
319322public:
320323   // construction/destruction
321   netlist_mame_sub_interface(netlist_mame_device_t &obj) : m_object(obj) {}
324   netlist_mame_sub_interface(device_t &aowner)
325    {
326       m_owner = dynamic_cast<netlist_mame_device_t *>(&aowner);
327       m_sound = dynamic_cast<netlist_mame_sound_device_t *>(&aowner);
328    }
322329   virtual ~netlist_mame_sub_interface() { }
323330
324331   virtual void custom_netlist_additions(netlist_base_t &netlist) { }
325332
326   inline netlist_mame_device_t &object() { return m_object; }
333   inline netlist_mame_device_t &nl_owner() const { return *m_owner; }
334
335   inline bool is_sound_device() const { return (m_sound != NULL); }
336
337   inline void update_to_current_time()
338   {
339       printf("%p\n", m_sound);
340       printf("%p\n", m_sound->get_stream());
341       m_sound->get_stream()->update();
342   }
343
327344private:
328   netlist_mame_device_t &m_object;
345   netlist_mame_device_t *m_owner;
346   netlist_mame_sound_device_t *m_sound;
329347};
330348
331349// ----------------------------------------------------------------------------------------
r27452r27453
344362   static void static_set_name(device_t &device, const char *param_name);
345363   static void static_set_mult_offset(device_t &device, const double mult, const double offset);
346364
347   inline void write(const double val) { m_param->setTo(val * m_mult + m_offset); }
365   inline void write(const double val)
366   {
367       if (is_sound_device())
368       {
369           update_to_current_time();
370           m_param->setTo(val * m_mult + m_offset);
371       }
372       else
373       {
374           // FIXME: use device timer ....
375           m_param->setTo(val * m_mult + m_offset);
376       }
377   }
348378
349379   inline DECLARE_INPUT_CHANGED_MEMBER(input_changed)
350380   {
r27452r27453
386416
387417   static void static_set_params(device_t &device, const char *param_name, const UINT32 mask, const UINT32 shift);
388418
389   inline void write(const UINT32 val) { m_param->setTo((val >> m_shift) & m_mask); }
419   inline void write(const UINT32 val)
420   {
421        if (is_sound_device())
422        {
423            update_to_current_time();
424            m_param->setTo((val >> m_shift) & m_mask);
425        }
426        else
427        {
428            // FIXME: use device timer ....
429            m_param->setTo((val >> m_shift) & m_mask);
430        }
431   }
390432
391433   inline DECLARE_INPUT_CHANGED_MEMBER(input_changed) { write(newval); }
392434   DECLARE_WRITE_LINE_MEMBER(write_line)       { write(state);  }
r27452r27453
510552    NETLIB_NAME(sound_in)()
511553        : netlist_device_t() { }
512554
513    static const int BUFSIZE = 2048;
555    static const int MAX_INPUT_CHANNELS = 10;
514556
515557    ATTR_COLD void start()
516558    {
r27452r27453
522564        m_inc = netlist_time::from_nsec(1);
523565
524566
525        for (int i=0; i<10; i++)
567        for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
526568            register_param(pstring::sprintf("CHAN%d", i), m_param_name[i], "");
527569        m_num_channel = 0;
528570    }
r27452r27453
530572    ATTR_COLD void reset()
531573    {
532574        m_pos = 0;
533        for (int i=0; i<10; i++)
575        for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
534576            m_buffer[i] = NULL;
535577    }
536578
537579    ATTR_COLD int resolve()
538580    {
539581        m_pos = 0;
540        for (int i=0; i<10; i++)
582        for (int i = 0; i < MAX_INPUT_CHANNELS; i++)
541583        {
542584            if (m_param_name[i].Value() != "")
543585            {
r27452r27453
568610        m_pos = 0;
569611    }
570612
571    netlist_param_str_t m_param_name[10];
572    netlist_param_double_t *m_param[10];
573    stream_sample_t *m_buffer[10];
613    netlist_param_str_t m_param_name[MAX_INPUT_CHANNELS];
614    netlist_param_double_t *m_param[MAX_INPUT_CHANNELS];
615    stream_sample_t *m_buffer[MAX_INPUT_CHANNELS];
574616    netlist_time m_inc;
575617
576618private:
trunk/src/emu/netlist/devices/nld_7474.h
r27452r27453
6161   netlist_ttl_output_t m_Q;
6262   netlist_ttl_output_t m_QQ;
6363
64   ATTR_HOT inline void newstate(const UINT8 state);
64   ATTR_HOT inline void newstate(const UINT8 stateQ, const UINT8 stateQQ);
6565);
6666
6767NETLIB_DEVICE(7474,
trunk/src/emu/netlist/devices/nld_signal.h
r27452r27453
4747
4848   ATTR_COLD void reset()
4949   {
50        m_Q.initial(1);
5051        m_active = 1;
5152   }
5253
r27452r27453
99100
100101    ATTR_COLD void reset()
101102    {
103        m_Q.initial(1);
102104        m_active = 1;
103105    }
104106
r27452r27453
171173
172174    ATTR_COLD void reset()
173175    {
176        m_Q.initial(1);
174177        m_active = 1;
175178    }
176179
r27452r27453
241244      {
242245         register_input(sIN[i], m_i[i], netlist_input_t::STATE_INP_ACTIVE);
243246      }
244      m_Q.initial(1);
247      //m_Q.initial(1);
245248   }
246249
247250   ATTR_HOT ATTR_ALIGN void update()
trunk/src/emu/netlist/devices/nld_7400.c
r27452r27453
3131
3232NETLIB_UPDATE(7400_dip)
3333{
34    /* only called during startup */
35    m_1.update_dev();
36    m_2.update_dev();
37    m_3.update_dev();
38    m_4.update_dev();
3439}
3540
3641NETLIB_RESET(7400_dip)
trunk/src/emu/netlist/devices/nld_7420.c
r27452r27453
2828
2929NETLIB_UPDATE(7420_dip)
3030{
31    /* only called during startup */
32    m_1.update_dev();
33    m_2.update_dev();
3134}
3235
3336NETLIB_RESET(7420_dip)
trunk/src/emu/netlist/devices/nld_7402.c
r27452r27453
3131
3232NETLIB_UPDATE(7402_dip)
3333{
34    /* only called during startup */
35    m_1.update_dev();
36    m_2.update_dev();
37    m_3.update_dev();
38    m_4.update_dev();
3439}
3540
3641NETLIB_RESET(7402_dip)
trunk/src/emu/netlist/devices/nld_7404.c
r27452r27453
5252
5353NETLIB_UPDATE(7404_dip)
5454{
55    /* only called during startup */
56
57    m_1.update_dev();
58    m_2.update_dev();
59    m_3.update_dev();
60    m_4.update_dev();
61    m_5.update_dev();
62    m_6.update_dev();
5563}
5664
5765NETLIB_RESET(7404_dip)
trunk/src/emu/netlist/devices/nld_7425.c
r27452r27453
3232
3333NETLIB_UPDATE(7425_dip)
3434{
35    /* only called during startup */
36    m_1.update_dev();
37    m_2.update_dev();
3538}
3639
3740NETLIB_RESET(7425_dip)
trunk/src/emu/netlist/devices/nld_7427.c
r27452r27453
2929
3030NETLIB_UPDATE(7427_dip)
3131{
32    /* only called during startup */
33    m_1.update_dev();
34    m_2.update_dev();
35    m_3.update_dev();
3236}
3337
3438NETLIB_RESET(7427_dip)
trunk/src/emu/netlist/devices/nld_legacy.c
r27452r27453
1616
1717NETLIB_RESET(nicRSFF)
1818{
19    m_Q.initial(0);
20    m_QQ.initial(1);
1921}
2022
2123NETLIB_UPDATE(nicRSFF)
trunk/src/emu/netlist/devices/nld_7486.c
r27452r27453
4949
5050NETLIB_UPDATE(7486_dip)
5151{
52    /* only called during startup */
53    m_1.update_dev();
54    m_2.update_dev();
55    m_3.update_dev();
56    m_4.update_dev();
5257}
5358
5459NETLIB_RESET(7486_dip)
trunk/src/emu/netlist/devices/nld_74107.c
r27452r27453
1919NETLIB_RESET(74107Asub)
2020{
2121    m_clk.set_state(netlist_input_t::STATE_INP_HL);
22    m_Q.initial(0);
23    m_QQ.initial(1);
2224
2325    m_Q1 = 0;
2426    m_Q2 = 0;
r27452r27453
133135
134136NETLIB_UPDATE(74107_dip)
135137{
138    /* only called during startup */
139    m_1.update_dev();
140    m_2.update_dev();
136141}
trunk/src/emu/netlist/devices/nld_7410.c
r27452r27453
2929
3030NETLIB_UPDATE(7410_dip)
3131{
32    /* only called during startup */
33    m_1.update_dev();
34    m_2.update_dev();
35    m_3.update_dev();
3236}
3337
3438NETLIB_RESET(7410_dip)
trunk/src/emu/netlist/devices/nld_7430.c
r27452r27453
2424
2525NETLIB_UPDATE(7430_dip)
2626{
27    /* only called during startup */
28    m_1.update_dev();
2729}
2830
2931NETLIB_RESET(7430_dip)
trunk/src/emu/netlist/devices/nld_7450.c
r27452r27453
7676
7777NETLIB_UPDATE(7450_dip)
7878{
79    /* only called during startup */
80    m_1.update_dev();
81    m_2.update_dev();
7982}
8083
8184NETLIB_RESET(7450_dip)
trunk/src/emu/netlist/devices/nld_7474.c
r27452r27453
55
66#include "nld_7474.h"
77
8ATTR_HOT inline void NETLIB_NAME(7474sub)::newstate(const UINT8 state)
8ATTR_HOT inline void NETLIB_NAME(7474sub)::newstate(const UINT8 stateQ, const UINT8 stateQQ)
99{
1010   static const netlist_time delay[2] = { NLTIME_FROM_NS(25), NLTIME_FROM_NS(40) };
11   OUTLOGIC(m_Q, state, delay[state]);
12   OUTLOGIC(m_QQ, !state, delay[!state]);
11   OUTLOGIC(m_Q, stateQ, delay[stateQ]);
12   OUTLOGIC(m_QQ, stateQQ, delay[stateQQ]);
1313}
1414
1515NETLIB_UPDATE(7474sub)
1616{
17   //if (!INP_LAST(m_clk) & INP(m_clk))
17   //if (INP_LH(m_CLK))
1818   {
19      newstate(m_nextD);
19      newstate(m_nextD, !m_nextD);
2020      m_CLK.inactivate();
2121   }
2222}
2323
2424NETLIB_UPDATE(7474)
2525{
26    if (!INPLOGIC(m_PREQ) && !INPLOGIC(m_CLRQ))
27    {
28        sub.newstate(1, 1);
29        sub.m_CLK.inactivate();
30    }
2631   if (!INPLOGIC(m_PREQ))
2732   {
28      sub.newstate(1);
33      sub.newstate(1, 0);
2934      sub.m_CLK.inactivate();
3035      m_D.inactivate();
3136   }
3237   else if (!INPLOGIC(m_CLRQ))
3338   {
34      sub.newstate(0);
39      sub.newstate(0, 1);
3540      sub.m_CLK.inactivate();
3641      m_D.inactivate();
3742   }
r27452r27453
7782    m_CLK.set_state(netlist_input_t::STATE_INP_LH);
7883
7984    m_nextD = 0;
85    /* FIXME: required by pong doubles - need a mechanism to set this from netlist */
86    m_Q.initial(1);
87    m_QQ.initial(0);
8088}
8189
8290NETLIB_START(7474_dip)
r27452r27453
109117
110118NETLIB_UPDATE(7474_dip)
111119{
120    m_1.update_dev();
121    m_2.update_dev();
112122}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team