summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Couriersud <couriersud@users.noreply.github.com>2014-04-06 15:45:52 +0000
committer Couriersud <couriersud@users.noreply.github.com>2014-04-06 15:45:52 +0000
commit4a2be6f1637dfaeb98aea894c742457e9515cfca (patch)
treee147d7d7d5737c0b03dc177e4c3747459667a867 /src
parentd481d244b89e7c7563487a08112c93c1d2768d21 (diff)
Netlist: fixed reset (F3) and save state. Both crashed after last changes. Fixed issues introduced lately around DICE compatibility. [Couriersud]
Diffstat (limited to 'src')
-rw-r--r--src/emu/machine/netlist.c1
-rw-r--r--src/emu/netlist/devices/net_lib.c2
-rw-r--r--src/emu/netlist/devices/nld_74107.c2
-rw-r--r--src/emu/netlist/devices/nld_system.h2
-rw-r--r--src/emu/netlist/nl_base.c24
-rw-r--r--src/emu/netlist/nl_base.h5
-rw-r--r--src/emu/netlist/nl_dice_compat.h6
-rw-r--r--src/emu/netlist/nl_lists.h6
-rw-r--r--src/emu/netlist/nl_setup.c11
-rw-r--r--src/emu/netlist/pstate.c4
-rw-r--r--src/mame/drivers/pong.c23
11 files changed, 62 insertions, 24 deletions
diff --git a/src/emu/machine/netlist.c b/src/emu/machine/netlist.c
index 1cd94d9a089..3526753df08 100644
--- a/src/emu/machine/netlist.c
+++ b/src/emu/machine/netlist.c
@@ -403,6 +403,7 @@ ATTR_COLD void netlist_mame_device_t::device_post_load()
LOG_DEV_CALLS(("device_post_load\n"));
netlist().post_load();
+ netlist().rebuild_lists();
}
ATTR_COLD void netlist_mame_device_t::device_pre_save()
diff --git a/src/emu/netlist/devices/net_lib.c b/src/emu/netlist/devices/net_lib.c
index 0eed88a8240..ecc27fc13ab 100644
--- a/src/emu/netlist/devices/net_lib.c
+++ b/src/emu/netlist/devices/net_lib.c
@@ -78,7 +78,7 @@ netlist_factory_t::~netlist_factory_t()
net_device_t_base_factory *p = *e;
delete p;
}
- m_list.reset();
+ m_list.clear();
}
void netlist_factory_t::initialize()
diff --git a/src/emu/netlist/devices/nld_74107.c b/src/emu/netlist/devices/nld_74107.c
index 7c145b29815..7480b9fcd74 100644
--- a/src/emu/netlist/devices/nld_74107.c
+++ b/src/emu/netlist/devices/nld_74107.c
@@ -57,7 +57,7 @@ NETLIB_UPDATE(74107Asub)
{
const netlist_sig_t t = m_Q.net().Q();
newstate((!t & m_Q1) | (t & m_Q2) | m_F);
- if (!m_Q1)
+ if (UNEXPECTED(m_Q1 ^ 1))
m_clk.inactivate();
}
diff --git a/src/emu/netlist/devices/nld_system.h b/src/emu/netlist/devices/nld_system.h
index 5bb2b4154f2..ca5f9b70316 100644
--- a/src/emu/netlist/devices/nld_system.h
+++ b/src/emu/netlist/devices/nld_system.h
@@ -33,7 +33,7 @@
NET_REGISTER_DEV(clock, _name) \
PARAM(_name.FREQ, _freq)
-#define GND() \
+#define GNDA() \
NET_REGISTER_DEV(gnd, GND)
// ----------------------------------------------------------------------------------------
diff --git a/src/emu/netlist/nl_base.c b/src/emu/netlist/nl_base.c
index b725e17a9d0..55ef0f80073 100644
--- a/src/emu/netlist/nl_base.c
+++ b/src/emu/netlist/nl_base.c
@@ -148,7 +148,7 @@ netlist_base_t::~netlist_base_t()
}
}
- m_nets.reset();
+ m_nets.clear();
tagmap_free_entries<tagmap_devices_t>(m_devices);
@@ -200,6 +200,13 @@ ATTR_COLD netlist_net_t *netlist_base_t::find_net(const pstring &name)
return NULL;
}
+ATTR_COLD void netlist_base_t::rebuild_lists()
+{
+ for (int i = 0; i < m_nets.count(); i++)
+ m_nets[i]->rebuild_list();
+}
+
+
ATTR_COLD void netlist_base_t::reset()
{
m_time = netlist_time::zero;
@@ -537,6 +544,15 @@ ATTR_HOT void netlist_net_t::dec_active(netlist_core_terminal_t &term)
}
}
+ATTR_COLD void netlist_net_t::rebuild_list()
+{
+ /* rebuild m_list */
+
+ m_list.clear();
+ for (int i=0; i < m_registered.count(); i++)
+ if (m_registered[i]->state() != netlist_input_t::STATE_INP_PASSIVE)
+ m_list.add(*m_registered[i]);
+}
ATTR_COLD void netlist_net_t::reset()
{
@@ -550,6 +566,12 @@ ATTR_COLD void netlist_net_t::reset()
m_active = 0;
m_in_queue = 2;
+ /* rebuild m_list */
+
+ m_list.clear();
+ for (int i=0; i < m_registered.count(); i++)
+ m_list.add(*m_registered[i]);
+
for (netlist_core_terminal_t *t = m_list.first(); t != NULL; t = m_list.next(t))
{
t->do_reset();
diff --git a/src/emu/netlist/nl_base.h b/src/emu/netlist/nl_base.h
index 6f0717b20d2..97c229e0dd2 100644
--- a/src/emu/netlist/nl_base.h
+++ b/src/emu/netlist/nl_base.h
@@ -625,8 +625,11 @@ public:
ATTR_HOT void solve();
+ netlist_list_t<netlist_core_terminal_t *> m_registered; // save post-start m_list ...
plinked_list<netlist_core_terminal_t> m_list;
+ ATTR_COLD void rebuild_list(); /* rebuild m_list after a load */
+
protected: //FIXME: needed by current solver code
UINT16 m_num_cons;
@@ -1029,6 +1032,8 @@ public:
ATTR_HOT void process_queue(const netlist_time delta);
ATTR_HOT inline void abort_current_queue_slice() { m_stop = netlist_time::zero; }
+ ATTR_COLD void rebuild_lists(); /* must be called after post_load ! */
+
ATTR_COLD void set_setup(netlist_setup_t *asetup) { m_setup = asetup; }
ATTR_COLD netlist_setup_t &setup() { return *m_setup; }
diff --git a/src/emu/netlist/nl_dice_compat.h b/src/emu/netlist/nl_dice_compat.h
index d40dcc5a20c..c6ea2ef5860 100644
--- a/src/emu/netlist/nl_dice_compat.h
+++ b/src/emu/netlist/nl_dice_compat.h
@@ -13,11 +13,11 @@
* -------------------------------------------------------------------- */
//#define CHIP(_n, _t) netlist.register_dev(NET_NEW(_t ## _dip), _n);
-#define CHIP(_n, _t) netlist.register_dev( new nld_ ## _t ## _dip(), _n);
+#define CHIP(_n, _t) setup.register_dev( new nld_ ## _t ## _dip(), _n);
#define CONNECTION( a... ) CONNECTIONX( a )
-#define CONNECTIONX(_a, _b, _c, _d) netlist.register_link(_a "." # _b, _c "." # _d);
-#define NET_CSTR(_a, _b) netlist.register_link( _a, _b);
+#define CONNECTIONX(_a, _b, _c, _d) setup.register_link(_a "." # _b, _c "." # _d);
+#define NET_CSTR(_a, _b) setup.register_link( _a, _b);
#define CIRCUIT_LAYOUT(x) NETLIST_START(x)
#define CIRCUIT_LAYOUT_END NETLIST_END()
diff --git a/src/emu/netlist/nl_lists.h b/src/emu/netlist/nl_lists.h
index 346d60ec5ea..685081d941a 100644
--- a/src/emu/netlist/nl_lists.h
+++ b/src/emu/netlist/nl_lists.h
@@ -130,16 +130,16 @@ public:
ATTR_HOT inline const _ListClass *last() const { return &m_list[m_count -1]; }
ATTR_HOT inline int count() const { return m_count; }
ATTR_HOT inline bool empty() const { return (m_count == 0); }
- ATTR_HOT inline void reset() { m_count = 0; }
+ ATTR_HOT inline void clear() { m_count = 0; }
ATTR_HOT inline int capacity() const { return m_num_elements; }
- ATTR_COLD void reset_and_free()
+ ATTR_COLD void clear_and_free()
{
for (_ListClass *i = m_list; i < m_list + m_count; i++)
{
delete *i;
}
- reset();
+ clear();
}
ATTR_HOT inline _ListClass& operator[](const int & index) { return m_list[index]; }
diff --git a/src/emu/netlist/nl_setup.c b/src/emu/netlist/nl_setup.c
index 6ad32abd3c7..b8d93b2f865 100644
--- a/src/emu/netlist/nl_setup.c
+++ b/src/emu/netlist/nl_setup.c
@@ -17,7 +17,7 @@
static NETLIST_START(base)
TTL_INPUT(ttlhigh, 1)
TTL_INPUT(ttllow, 0)
- GND()
+ NET_REGISTER_DEV(gnd, GND)
INCLUDE(diode_models);
INCLUDE(bjt_models);
@@ -45,7 +45,7 @@ void netlist_setup_t::init()
netlist_setup_t::~netlist_setup_t()
{
- m_links.reset();
+ m_links.clear();
m_alias.reset();
m_params.reset();
m_terminals.reset();
@@ -614,7 +614,7 @@ void netlist_setup_t::resolve_inputs()
netlist().log("deleting empty nets ...");
- // delete empty nets ...
+ // delete empty nets ... and save m_list ...
netlist_net_t::list_t todelete;
@@ -624,6 +624,11 @@ void netlist_setup_t::resolve_inputs()
{
todelete.add(*pn);
}
+ else
+ {
+ for (netlist_core_terminal_t *p = (*pn)->m_list.first(); p != NULL; p = (*pn)->m_list.next(p))
+ (*pn)->m_registered.add(p);
+ }
}
for (int i=0; i < todelete.count(); i++)
diff --git a/src/emu/netlist/pstate.c b/src/emu/netlist/pstate.c
index 3297f5acc3d..1bc08410a7f 100644
--- a/src/emu/netlist/pstate.c
+++ b/src/emu/netlist/pstate.c
@@ -7,7 +7,7 @@
ATTR_COLD pstate_manager_t::~pstate_manager_t()
{
- m_save.reset_and_free();
+ m_save.clear_and_free();
}
@@ -44,7 +44,7 @@ ATTR_COLD void pstate_manager_t::remove_save_items(const void *owner)
{
m_save.remove(todelete[i]);
}
- todelete.reset_and_free();
+ todelete.clear_and_free();
}
ATTR_COLD void pstate_manager_t::pre_save()
diff --git a/src/mame/drivers/pong.c b/src/mame/drivers/pong.c
index 780d8359518..3998b3c8cfe 100644
--- a/src/mame/drivers/pong.c
+++ b/src/mame/drivers/pong.c
@@ -58,14 +58,22 @@ TODO:
#define HRES_MULT (1)
-fixedfreq_interface fixedfreq_mode_pong = {
+fixedfreq_interface fixedfreq_mode_pongd = {
MASTER_CLOCK,
- H_TOTAL-67,H_TOTAL-40,H_TOTAL-8,H_TOTAL,
+ H_TOTAL-67,H_TOTAL-52,H_TOTAL-8,H_TOTAL,
V_TOTAL-22,V_TOTAL-19,V_TOTAL-12,V_TOTAL,
1, /* non-interlaced */
0.31
};
+fixedfreq_interface fixedfreq_mode_pong = {
+ MASTER_CLOCK,
+ H_TOTAL-67,H_TOTAL-40,H_TOTAL-8,H_TOTAL,
+ V_TOTAL-22,V_TOTAL-19,V_TOTAL-12,V_TOTAL,
+ 1, /* non-interlaced */
+ 0.31
+};
+
fixedfreq_interface fixedfreq_mode_pongX2 = {
MASTER_CLOCK * 2,
(H_TOTAL-67) * 2, (H_TOTAL-40) * 2, (H_TOTAL-8) * 2, (H_TOTAL) * 2,
@@ -105,16 +113,13 @@ static NETLIST_START(pong_schematics)
#if 1
#if 0
/* this is the clock circuit in schematics. */
- MAINCLOCK(xclk)
- //CLOCK(clk)
- PARAM(xclk.FREQ, 7159000.0*2)
+ MAINCLOCK(xclk, 7159000.0*2)
TTL_74107(ic_f6a, xclk, high, high, high)
ALIAS(clk, ic_f6a.Q)
#else
- /* abstracting this, performance increases by 40%
+ /* abstracting this, performance increases by 60%
* No surprise, the clock is extremely expensive */
MAINCLOCK(clk, 7159000.0)
- //CLOCK(clk, 7159000.0)
#endif
#else
// benchmarking ...
@@ -728,7 +733,7 @@ NETLIST_END()
static NETLIST_START(pongd)
- NETLIST_INCLUDE(pongdoubles)
+ INCLUDE(pongdoubles)
//NETDEV_ANALOG_CALLBACK(sound_cb, AUDIO, pong_state, sound_cb, "")
//NETDEV_ANALOG_CALLBACK(video_cb, videomix, fixedfreq_device, update_vid, "fixfreq")
@@ -946,7 +951,7 @@ static MACHINE_CONFIG_START( pongd, pong_state )
//MCFG_FIXFREQ_ADD("fixfreq", "screen", fixedfreq_mode_ntsc720)
//MCFG_FIXFREQ_ADD("fixfreq", "screen", fixedfreq_mode_pongX2)
- MCFG_FIXFREQ_ADD("fixfreq", "screen", fixedfreq_mode_pong)
+ MCFG_FIXFREQ_ADD("fixfreq", "screen", fixedfreq_mode_pongd)
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")