diff options
| author | 2015-05-26 13:52:54 -0500 | |
|---|---|---|
| committer | 2015-05-26 13:52:54 -0500 | |
| commit | ad9440ce2e2f8ca5c17973263cbae43e78bee67b (patch) | |
| tree | 364904aef1ea7d8b284344111a8bd96c7718e7ca | |
| parent | 4b46cd25240b2627b30e2de37238402ff434c5e9 (diff) | |
| parent | 2d81c07ecb6f03dfa84890f19bba00ba6fb19f5d (diff) | |
Merge branch 'master' of https://github.com/mamedev/mame
| -rw-r--r-- | hash/pet_flop.xml | 12 | ||||
| -rw-r--r-- | src/emu/cpu/tms0980/tms0980.c | 3 | ||||
| -rw-r--r-- | src/emu/cpu/tms0980/tms0980.h | 41 | ||||
| -rw-r--r-- | src/emu/netlist/analog/nld_solver.c | 37 | ||||
| -rw-r--r-- | src/emu/netlist/analog/nld_solver.h | 3 | ||||
| -rw-r--r-- | src/emu/netlist/devices/nld_truthtable.c | 36 | ||||
| -rw-r--r-- | src/emu/netlist/devices/nld_truthtable.h | 14 | ||||
| -rw-r--r-- | src/emu/netlist/nl_base.c | 30 | ||||
| -rw-r--r-- | src/emu/netlist/nl_dice_compat.h | 4 | ||||
| -rw-r--r-- | src/emu/netlist/nl_factory.c | 6 | ||||
| -rw-r--r-- | src/emu/netlist/nl_parser.c | 4 | ||||
| -rw-r--r-- | src/emu/netlist/nl_parser.h | 2 | ||||
| -rw-r--r-- | src/emu/netlist/nl_setup.c | 26 | ||||
| -rw-r--r-- | src/emu/netlist/nl_time.h | 1 | ||||
| -rw-r--r-- | src/emu/netlist/nl_util.h | 2 | ||||
| -rw-r--r-- | src/emu/netlist/plists.h | 8 | ||||
| -rw-r--r-- | src/emu/netlist/poptions.h | 6 | ||||
| -rw-r--r-- | src/emu/netlist/pparser.c | 58 | ||||
| -rw-r--r-- | src/emu/netlist/pparser.h | 2 | ||||
| -rw-r--r-- | src/emu/netlist/pstate.c | 8 | ||||
| -rw-r--r-- | src/emu/netlist/pstring.c | 2 |
21 files changed, 200 insertions, 105 deletions
diff --git a/hash/pet_flop.xml b/hash/pet_flop.xml index cfe9d64d590..b39cfd569ea 100644 --- a/hash/pet_flop.xml +++ b/hash/pet_flop.xml @@ -14,6 +14,18 @@ </part> </software> + <software name="1001demo"> + <description>Commodore SFD-1001 Floppy Disk Drive Test/Demo Disk</description> + <year>198?</year> + <publisher>Commodore</publisher> + + <part name="flop1" interface="floppy_5_25"> + <dataarea name="flop" size="1066496"> + <rom name="sfd1001-td-disk.d82" size="1066496" crc="83b12b13" sha1="316fa89b4553ff1d411dc14ffcdd477c1fb284da" offset="0" /> + </dataarea> + </part> + </software> + <software name="2040demov1" cloneof="2040demo"> <description>Commodore 2040 Floppy Disk Drive Test/Demo Disk (DOS v1)</description> <year>197?</year> diff --git a/src/emu/cpu/tms0980/tms0980.c b/src/emu/cpu/tms0980/tms0980.c index d7b13db1d62..50f61788086 100644 --- a/src/emu/cpu/tms0980/tms0980.c +++ b/src/emu/cpu/tms0980/tms0980.c @@ -7,7 +7,6 @@ TODO: - emulate TMS1600 L-pins - fix debugger disasm view - - add pinout diagrams for reference The TMS0980 and TMS1000-family MCU cores are very similar. The TMS0980 has a @@ -175,7 +174,7 @@ const device_type TMS0980 = &device_creator<tms0980_cpu_device>; // 28-pin DIP, // - main instructions PLA at the top half, to the right of the midline // - 32-term microinstructions PLA between the RAM and ROM, supporting 15 microinstructions // - 16-term output PLA and segment PLA above the RAM (rotate opla 90 degrees) -const device_type TMS0970 = &device_creator<tms0970_cpu_device>; // 28-pin DIP, 11 R pins +const device_type TMS0970 = &device_creator<tms0970_cpu_device>; // 28-pin DIP, 11 R pins (note: pinout may slightly differ from chip to chip) const device_type TMS1990 = &device_creator<tms1990_cpu_device>; // 28-pin DIP, ? R pins.. // TMS0950 is same? diff --git a/src/emu/cpu/tms0980/tms0980.h b/src/emu/cpu/tms0980/tms0980.h index b3d8b2163e0..fb9c3690fdd 100644 --- a/src/emu/cpu/tms0980/tms0980.h +++ b/src/emu/cpu/tms0980/tms0980.h @@ -46,6 +46,47 @@ tms0270_cpu_device::set_write_pdc_callback(*device, DEVCB_##_devcb); +// pinout reference + +/* + + ____ ____ ____ ____ + R8 1 |* \_/ | 28 R7 R0 1 |* \_/ | 28 Vss + R9 2 | | 27 R6 R1 2 | | 27 OSC2 + R10 3 | | 26 R5 R2 3 | | 26 OSC1 + Vdd 4 | | 25 R4 R3 4 | | 25 O0 + K1 5 | | 24 R3 R4 5 | | 24 O1 + K2 6 | TMS1000 | 23 R2 R5 6 | | 23 O2 + K4 7 | TMS1070 | 22 R1 R6 7 | TMS1400 | 22 O3 + K8 8 | TMS1100 | 21 R0 R7 8 | | 21 O4 + INIT 9 | TMS1170 | 20 Vss R8 9 | | 20 O5 + O7 10 | | 19 OSC2 R9 10 | | 19 O6 + O6 11 | | 18 OSC1 R10 11 | | 18 O7 + O5 12 | | 17 O0 Vdd 12 | | 17 K8 + O4 13 | | 16 O1 INIT 13 | | 16 K4 + O3 14 |___________| 15 O2 K1 14 |___________| 15 K2 + + + ____ ____ + R2 1 |* \_/ | 28 R3 + R1 2 | | 27 R4 + R0 3 | | 26 R5 + ? 4 | | 25 R6 + Vdd 5 | | 24 R7 + K3 6 | | 23 R8 + K8 7 | TMS0980 | 22 ? + K4 8 | | 21 ? + K2 9 | | 20 Vss + K1 10 | | 19 ? + O7 11 | | 18 O0 + O6 12 | | 17 O1 + O5 13 | | 16 O2 + O4 14 |___________| 15 O3 + + note: TMS0980 official pin names for R0-R8 is D9-D1, O0-O7 is S(A-G,DP) + +*/ + class tms1xxx_cpu_device : public cpu_device { diff --git a/src/emu/netlist/analog/nld_solver.c b/src/emu/netlist/analog/nld_solver.c index 00373e29814..703f6f35770 100644 --- a/src/emu/netlist/analog/nld_solver.c +++ b/src/emu/netlist/analog/nld_solver.c @@ -25,9 +25,6 @@ #pragma GCC optimize "-fivopts" #endif -#define SOLVER_VERBOSE_OUT(x) do {} while (0) -//#define SOLVER_VERBOSE_OUT(x) printf x - #include <algorithm> #include "nld_solver.h" #include "nld_ms_direct.h" @@ -88,12 +85,12 @@ ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets m_nets.clear(); - for (int k = 0; k < nets.size(); k++) + for (std::size_t k = 0; k < nets.size(); k++) { m_nets.add(nets[k]); } - for (int k = 0; k < nets.size(); k++) + for (std::size_t k = 0; k < nets.size(); k++) { NL_VERBOSE_OUT(("setting up net\n")); @@ -101,7 +98,7 @@ ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets net->m_solver = this; - for (int i = 0; i < net->m_core_terms.size(); i++) + for (std::size_t i = 0; i < net->m_core_terms.size(); i++) { netlist_core_terminal_t *p = net->m_core_terms[i]; NL_VERBOSE_OUT(("%s %s %d\n", p->name().cstr(), net->name().cstr(), (int) net->isRailNet())); @@ -134,7 +131,7 @@ ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets case netlist_terminal_t::INPUT: { netlist_analog_output_t *net_proxy_output = NULL; - for (int i = 0; i < m_inps.size(); i++) + for (std::size_t i = 0; i < m_inps.size(); i++) if (m_inps[i]->m_proxied_net == &p->net().as_analog()) { net_proxy_output = m_inps[i]; @@ -167,7 +164,7 @@ ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets ATTR_HOT void netlist_matrix_solver_t::update_inputs() { // avoid recursive calls. Inputs are updated outside this call - for (int i=0; i<m_inps.size(); i++) + for (std::size_t i=0; i<m_inps.size(); i++) m_inps[i]->set_Q(m_inps[i]->m_proxied_net->m_cur_Analog); } @@ -175,7 +172,7 @@ ATTR_HOT void netlist_matrix_solver_t::update_inputs() ATTR_HOT void netlist_matrix_solver_t::update_dynamic() { /* update all non-linear devices */ - for (int i=0; i < m_dynamic_devices.size(); i++) + for (std::size_t i=0; i < m_dynamic_devices.size(); i++) switch (m_dynamic_devices[i]->family()) { case netlist_device_t::DIODE: @@ -218,7 +215,7 @@ ATTR_COLD void netlist_matrix_solver_t::update_forced() ATTR_HOT void netlist_matrix_solver_t::step(const netlist_time delta) { const nl_double dd = delta.as_double(); - for (int k=0; k < m_step_devices.size(); k++) + for (std::size_t k=0; k < m_step_devices.size(); k++) m_step_devices[k]->step_time(dd); } @@ -281,7 +278,7 @@ ATTR_HOT nl_double netlist_matrix_solver_t::solve() ATTR_COLD int netlist_matrix_solver_t::get_net_idx(netlist_net_t *net) { - for (int k = 0; k < m_nets.size(); k++) + for (std::size_t k = 0; k < m_nets.size(); k++) if (m_nets[k] == net) return k; return -1; @@ -329,7 +326,7 @@ NETLIB_START(solver) NETLIB_RESET(solver) { - for (int i = 0; i < m_mat_solvers.size(); i++) + for (std::size_t i = 0; i < m_mat_solvers.size(); i++) m_mat_solvers[i]->reset(); } @@ -341,7 +338,7 @@ NETLIB_UPDATE_PARAM(solver) NETLIB_STOP(solver) { - for (int i = 0; i < m_mat_solvers.size(); i++) + for (std::size_t i = 0; i < m_mat_solvers.size(); i++) m_mat_solvers[i]->log_stats(); } @@ -355,7 +352,7 @@ NETLIB_UPDATE(solver) if (m_params.m_dynamic) return; - const int t_cnt = m_mat_solvers.size(); + const std::size_t t_cnt = m_mat_solvers.size(); #if HAS_OPENMP && USE_OPENMP if (m_parallel.Value()) @@ -381,7 +378,7 @@ NETLIB_UPDATE(solver) ATTR_UNUSED const nl_double ts = m_mat_solvers[i]->solve(); } #else - for (int i = 0; i < t_cnt; i++) + for (std::size_t i = 0; i < t_cnt; i++) { if (m_mat_solvers[i]->is_timestep()) { @@ -464,7 +461,7 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start() netlist().log("Scanning net groups ..."); // determine net groups - for (int i=0; i<netlist().m_nets.size(); i++) + for (std::size_t i=0; i<netlist().m_nets.size(); i++) { SOLVER_VERBOSE_OUT(("processing %s\n", netlist().m_nets[i]->name().cstr())); if (!netlist().m_nets[i]->isRailNet()) @@ -484,7 +481,7 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start() for (int i = 0; i <= cur_group; i++) { netlist_matrix_solver_t *ms; - int net_count = groups[i].size(); + std::size_t net_count = groups[i].size(); switch (net_count) { @@ -547,11 +544,11 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start() netlist().log(" # %d ==> %" SIZETFMT " nets", i, groups[i].size()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr()); netlist().log(" has %s elements", ms->is_dynamic() ? "dynamic" : "no dynamic"); netlist().log(" has %s elements", ms->is_timestep() ? "timestep" : "no timestep"); - for (int j=0; j<groups[i].size(); j++) + for (std::size_t j=0; j<groups[i].size(); j++) { - netlist().log("Net %d: %s", j, groups[i][j]->name().cstr()); + netlist().log("Net %" SIZETFMT ": %s", j, groups[i][j]->name().cstr()); netlist_net_t *n = groups[i][j]; - for (int k = 0; k < n->m_core_terms.size(); k++) + for (std::size_t k = 0; k < n->m_core_terms.size(); k++) { const netlist_core_terminal_t *p = n->m_core_terms[k]; netlist().log(" %s", p->name().cstr()); diff --git a/src/emu/netlist/analog/nld_solver.h b/src/emu/netlist/analog/nld_solver.h index 95b92dd94c4..874c8dc7e1d 100644 --- a/src/emu/netlist/analog/nld_solver.h +++ b/src/emu/netlist/analog/nld_solver.h @@ -14,6 +14,9 @@ //#define ATTR_ALIGNED(N) __attribute__((aligned(N))) #define ATTR_ALIGNED(N) ATTR_ALIGN +#define SOLVER_VERBOSE_OUT(x) do {} while (0) +//#define SOLVER_VERBOSE_OUT(x) printf x + // ---------------------------------------------------------------------------------------- // Macros // ---------------------------------------------------------------------------------------- diff --git a/src/emu/netlist/devices/nld_truthtable.c b/src/emu/netlist/devices/nld_truthtable.c index 01784edef06..85fc56ac34b 100644 --- a/src/emu/netlist/devices/nld_truthtable.c +++ b/src/emu/netlist/devices/nld_truthtable.c @@ -8,9 +8,9 @@ #include "nld_truthtable.h" #include "../plists.h" -int truthtable_desc_t::count_bits(UINT32 v) +unsigned truthtable_desc_t::count_bits(UINT32 v) { - int ret = 0; + unsigned ret = 0; for (; v != 0; v = v >> 1) { if (v & 1) @@ -52,7 +52,7 @@ UINT32 truthtable_desc_t::get_ignored_extended(UINT32 i) { // Determine all inputs which may be ignored ... UINT32 nign = 0; - for (int j=0; j<m_NI; j++) + for (unsigned j=0; j<m_NI; j++) { if (m_outs[i] == m_outs[i ^ (1 << j)]) nign |= (1<<j); @@ -61,14 +61,14 @@ UINT32 truthtable_desc_t::get_ignored_extended(UINT32 i) * We have to remove those where the ignored inputs * may change the output */ - int bits = (1<<count_bits(nign)); + UINT32 bits = (1<<count_bits(nign)); parray_t<int> t(bits); for (UINT32 j=1; j<bits; j++) { UINT32 tign = set_bits(nign, j); t[j] = 0; - int bitsk=(1<<count_bits(tign)); + UINT32 bitsk=(1<<count_bits(tign)); for (UINT32 k=0; k<bitsk; k++) { UINT32 b=set_bits(tign, k); @@ -83,7 +83,7 @@ UINT32 truthtable_desc_t::get_ignored_extended(UINT32 i) UINT32 jm=0; for (UINT32 j=1; j<bits; j++) { - int nb = count_bits(j); + unsigned nb = count_bits(j); if ((t[j] == 0)&& (nb>jb)) { jb = nb; @@ -97,7 +97,7 @@ UINT32 truthtable_desc_t::get_ignored_extended(UINT32 i) // desc // ---------------------------------------------------------------------------------------- -ATTR_COLD void truthtable_desc_t::help(int cur, nl_util::pstring_list list, +ATTR_COLD void truthtable_desc_t::help(unsigned cur, nl_util::pstring_list list, UINT64 state,UINT16 val, UINT8 *timing_index) { pstring elem = list[cur].trim(); @@ -132,11 +132,11 @@ ATTR_COLD void truthtable_desc_t::help(int cur, nl_util::pstring_list list, else { // cutoff previous inputs and outputs for ignore - if (m_outs[nstate] != -1 && m_outs[nstate] != val) + if (m_outs[nstate] != ~0U && m_outs[nstate] != val) nl_fatalerror("Error in truthtable: State %04x already set, %d != %d\n", (UINT32) nstate, m_outs[nstate], val); m_outs[nstate] = val; - for (int j=0; j<m_NO; j++) + for (unsigned j=0; j<m_NO; j++) m_timing[nstate * m_NO + j] = timing_index[j]; } } @@ -152,8 +152,8 @@ ATTR_COLD void truthtable_desc_t::setup(const char **truthtable, UINT32 disabled ttline = pstring(truthtable[0]); truthtable++; - for (int j=0; j < m_size; j++) - m_outs[j] = -1; + for (unsigned j=0; j < m_size; j++) + m_outs[j] = ~0L; for (int j=0; j < 16; j++) m_timing_nt[j] = netlist_time::zero; @@ -173,7 +173,7 @@ ATTR_COLD void truthtable_desc_t::setup(const char **truthtable, UINT32 disabled UINT16 val = 0; parray_t<UINT8> tindex(m_NO); - for (int j=0; j<m_NO; j++) + for (unsigned j=0; j<m_NO; j++) { pstring outs = out[j].trim(); if (outs.equals("1")) @@ -196,12 +196,12 @@ ATTR_COLD void truthtable_desc_t::setup(const char **truthtable, UINT32 disabled // determine ignore parray_t<UINT32> ign(m_size); - for (int j=0; j < m_size; j++) - ign[j] = -1; + for (UINT32 j=0; j < m_size; j++) + ign[j] = ~0U; for (UINT32 i=0; i<m_size; i++) { - if (ign[i] == -1) + if (ign[i] == ~0U) { int tign; if (0) @@ -215,7 +215,7 @@ ATTR_COLD void truthtable_desc_t::setup(const char **truthtable, UINT32 disabled ign[i] = tign; /* don't need to recalculate similar ones */ - int bitsk=(1<<count_bits(tign)); + UINT32 bitsk=(1<<count_bits(tign)); for (UINT32 k=0; k<bitsk; k++) { UINT32 b=set_bits(tign, k); @@ -224,9 +224,9 @@ ATTR_COLD void truthtable_desc_t::setup(const char **truthtable, UINT32 disabled } } } - for (int i=0; i<m_size; i++) + for (UINT32 i=0; i<m_size; i++) { - if (m_outs[i] == -1) + if (m_outs[i] == ~0U) nl_fatalerror("truthtable: found element not set %04x\n", i); m_outs[i] |= ((ign[i] & ~disabled_ignore) << m_NO); } diff --git a/src/emu/netlist/devices/nld_truthtable.h b/src/emu/netlist/devices/nld_truthtable.h index 634e485931f..d12dd3c578b 100644 --- a/src/emu/netlist/devices/nld_truthtable.h +++ b/src/emu/netlist/devices/nld_truthtable.h @@ -47,15 +47,15 @@ struct truthtable_desc_t ATTR_COLD void setup(const char **truthtable, UINT32 disabled_ignore); private: - ATTR_COLD void help(int cur, nl_util::pstring_list list, + ATTR_COLD void help(unsigned cur, nl_util::pstring_list list, UINT64 state,UINT16 val, UINT8 *timing_index); - static int count_bits(UINT32 v); + static unsigned count_bits(UINT32 v); static UINT32 set_bits(UINT32 v, UINT32 b); UINT32 get_ignored_simple(UINT32 i); UINT32 get_ignored_extended(UINT32 i); - int m_NO; - int m_NI; + unsigned m_NO; + unsigned m_NI; //int m_has_state; bool *m_initialized; UINT32 *m_outs; @@ -69,7 +69,7 @@ private: }; -template<int m_NI, int m_NO, int has_state> +template<unsigned m_NI, unsigned m_NO, int has_state> class nld_truthtable_t : public netlist_device_t { public: @@ -166,12 +166,12 @@ public: netlist_time mt = netlist_time::zero; UINT32 state = 0; - for (int i = 0; i < m_NI; i++) + for (unsigned i = 0; i < m_NI; i++) { if (!doOUT || (m_ign & (1<<i)) != 0) m_i[i].activate(); } - for (int i = 0; i < m_NI; i++) + for (unsigned i = 0; i < m_NI; i++) { state |= (INPLOGIC(m_i[i]) << i); if (!doOUT) diff --git a/src/emu/netlist/nl_base.c b/src/emu/netlist/nl_base.c index e32cca9bf4b..0a8da9fda8b 100644 --- a/src/emu/netlist/nl_base.c +++ b/src/emu/netlist/nl_base.c @@ -197,7 +197,7 @@ netlist_base_t::netlist_base_t() netlist_base_t::~netlist_base_t() { - for (int i=0; i < m_nets.size(); i++) + for (std::size_t i=0; i < m_nets.size(); i++) { if (!m_nets[i]->isRailNet()) { @@ -248,7 +248,7 @@ ATTR_COLD void netlist_base_t::start() m_use_deactivate = (m_params->m_use_deactivate.Value() ? true : false); NL_VERBOSE_OUT(("Initializing devices ...\n")); - for (int i = 0; i < m_devices.size(); i++) + for (std::size_t i = 0; i < m_devices.size(); i++) { netlist_device_t *dev = m_devices[i]; if (dev != m_solver && dev != m_params) @@ -264,7 +264,7 @@ ATTR_COLD void netlist_base_t::stop() NL_VERBOSE_OUT(("Stopping all devices ...\n")); // Step all devices once ! - for (int i = 0; i < m_devices.size(); i++) + for (std::size_t i = 0; i < m_devices.size(); i++) { m_devices[i]->stop_dev(); } @@ -272,7 +272,7 @@ ATTR_COLD void netlist_base_t::stop() ATTR_COLD netlist_net_t *netlist_base_t::find_net(const pstring &name) { - for (int i = 0; i < m_nets.size(); i++) + for (std::size_t i = 0; i < m_nets.size(); i++) { if (m_nets[i]->name() == name) return m_nets[i]; @@ -282,7 +282,7 @@ ATTR_COLD netlist_net_t *netlist_base_t::find_net(const pstring &name) ATTR_COLD void netlist_base_t::rebuild_lists() { - for (int i = 0; i < m_nets.size(); i++) + for (std::size_t i = 0; i < m_nets.size(); i++) m_nets[i]->rebuild_list(); } @@ -297,24 +297,24 @@ ATTR_COLD void netlist_base_t::reset() m_solver->do_reset(); // Reset all nets once ! - for (int i = 0; i < m_nets.size(); i++) + for (std::size_t i = 0; i < m_nets.size(); i++) m_nets[i]->do_reset(); // Reset all devices once ! - for (int i = 0; i < m_devices.size(); i++) + for (std::size_t i = 0; i < m_devices.size(); i++) { m_devices[i]->do_reset(); } // Step all devices once ! - for (int i = 0; i < m_devices.size(); i++) + for (std::size_t i = 0; i < m_devices.size(); i++) { m_devices[i]->update_dev(); } // FIXME: some const devices rely on this /* make sure params are set now .. */ - for (int i = 0; i < m_devices.size(); i++) + for (std::size_t i = 0; i < m_devices.size(); i++) { m_devices[i]->update_param(); } @@ -650,7 +650,7 @@ ATTR_COLD void netlist_net_t::rebuild_list() /* rebuild m_list */ m_list_active.clear(); - for (int i=0; i < m_core_terms.size(); i++) + for (std::size_t i=0; i < m_core_terms.size(); i++) if (m_core_terms[i]->state() != netlist_logic_t::STATE_INP_PASSIVE) m_list_active.add(*m_core_terms[i]); } @@ -708,13 +708,13 @@ ATTR_COLD void netlist_net_t::reset() /* rebuild m_list */ m_list_active.clear(); - for (int i=0; i < m_core_terms.size(); i++) + for (std::size_t i=0; i < m_core_terms.size(); i++) m_list_active.add(*m_core_terms[i]); - for (int i=0; i < m_core_terms.size(); i++) + for (std::size_t i=0; i < m_core_terms.size(); i++) m_core_terms[i]->do_reset(); - for (int i=0; i < m_core_terms.size(); i++) + for (std::size_t i=0; i < m_core_terms.size(); i++) if (m_core_terms[i]->state() != netlist_logic_t::STATE_INP_PASSIVE) m_active++; } @@ -731,7 +731,7 @@ ATTR_COLD void netlist_net_t::register_con(netlist_core_terminal_t &terminal) ATTR_COLD void netlist_net_t::move_connections(netlist_net_t *dest_net) { - for (int i = 0; i < m_core_terms.size(); i++) + for (std::size_t i = 0; i < m_core_terms.size(); i++) { netlist_core_terminal_t *p = m_core_terms[i]; dest_net->register_con(*p); @@ -829,7 +829,7 @@ ATTR_COLD void netlist_analog_net_t::process_net(list_t *groups, int &cur_group) /* add the net */ //SOLVER_VERBOSE_OUT(("add %d - %s\n", cur_group, name().cstr())); groups[cur_group].add(this); - for (int i = 0; i < m_core_terms.size(); i++) + for (std::size_t i = 0; i < m_core_terms.size(); i++) { netlist_core_terminal_t *p = m_core_terms[i]; //SOLVER_VERBOSE_OUT(("terminal %s\n", p->name().cstr())); diff --git a/src/emu/netlist/nl_dice_compat.h b/src/emu/netlist/nl_dice_compat.h index f67a7895658..5b24868b13a 100644 --- a/src/emu/netlist/nl_dice_compat.h +++ b/src/emu/netlist/nl_dice_compat.h @@ -25,8 +25,8 @@ sed -e 's/#define \(.*\)"\(.*\)"[ \t]*,[ \t]*\(.*\)/NET_ALIAS(\1,\2.\3)/' src/ma #define NL_DICE_COMPAT_H_ #ifndef NL_CONVERT_CPP -#include "netlist/devices/net_lib.h" -#include "netlist/analog/nld_twoterm.h" +#include "devices/net_lib.h" +#include "analog/nld_twoterm.h" #endif /* -------------------------------------------------------------------- diff --git a/src/emu/netlist/nl_factory.c b/src/emu/netlist/nl_factory.c index abaf5166c31..4c611af4c18 100644 --- a/src/emu/netlist/nl_factory.c +++ b/src/emu/netlist/nl_factory.c @@ -38,7 +38,7 @@ netlist_factory_t::netlist_factory_t() netlist_factory_t::~netlist_factory_t() { - for (int i=0; i < m_list.size(); i++) + for (std::size_t i=0; i < m_list.size(); i++) { net_device_t_base_factory *p = m_list[i]; pfree(p); @@ -48,7 +48,7 @@ netlist_factory_t::~netlist_factory_t() netlist_device_t *netlist_factory_t::new_device_by_classname(const pstring &classname) const { - for (int i=0; i < m_list.size(); i++) + for (std::size_t i=0; i < m_list.size(); i++) { net_device_t_base_factory *p = m_list[i]; if (p->classname() == classname) @@ -69,7 +69,7 @@ netlist_device_t *netlist_factory_t::new_device_by_name(const pstring &name, net net_device_t_base_factory * netlist_factory_t::factory_by_name(const pstring &name, netlist_setup_t &setup) const { - for (int i=0; i < m_list.size(); i++) + for (std::size_t i=0; i < m_list.size(); i++) { net_device_t_base_factory *p = m_list[i]; if (p->name() == name) diff --git a/src/emu/netlist/nl_parser.c b/src/emu/netlist/nl_parser.c index de1dba4722c..7d7b29733be 100644 --- a/src/emu/netlist/nl_parser.c +++ b/src/emu/netlist/nl_parser.c @@ -228,7 +228,7 @@ void netlist_parser::device(const pstring &dev_type) nl_util::pstring_list termlist = f->term_param_list(); nl_util::pstring_list def_params = f->def_params(); - int cnt; + std::size_t cnt; devname = get_identifier(); @@ -269,7 +269,7 @@ void netlist_parser::device(const pstring &dev_type) tok = get_token(); } if (cnt != termlist.size()) - m_setup.netlist().error("netlist: input count mismatch for %s - expected %" SIZETFMT " found %d\n", devname.cstr(), termlist.size(), cnt); + m_setup.netlist().error("netlist: input count mismatch for %s - expected %" SIZETFMT " found %" SIZETFMT "\n", devname.cstr(), termlist.size(), cnt); require_token(tok, m_tok_param_right); } diff --git a/src/emu/netlist/nl_parser.h b/src/emu/netlist/nl_parser.h index 79e349fc61d..582aad49de7 100644 --- a/src/emu/netlist/nl_parser.h +++ b/src/emu/netlist/nl_parser.h @@ -144,7 +144,7 @@ public: void parse(netlist_setup_t &setup, const pstring name) { - for (int i=0; i < m_list.size(); i++) + for (std::size_t i=0; i < m_list.size(); i++) { if (m_list[i].parse(setup, name)) return; diff --git a/src/emu/netlist/nl_setup.c b/src/emu/netlist/nl_setup.c index 2ad8c208abc..6b98f14d452 100644 --- a/src/emu/netlist/nl_setup.c +++ b/src/emu/netlist/nl_setup.c @@ -107,7 +107,7 @@ netlist_device_t *netlist_setup_t::register_dev(const pstring &classname, const template <class T> static void remove_start_with(T &hm, pstring &sw) { - for (int i = hm.size() - 1; i >= 0; i--) + for (std::size_t i = hm.size() - 1; i >= 0; i--) { pstring x = hm[i]->name(); if (sw.equals(x.substr(0, sw.len()))) @@ -248,7 +248,7 @@ void netlist_setup_t::register_object(netlist_device_t &dev, const pstring &name { pstring search = (".model " + val + " ").ucase(); bool found = false; - for (int i=0; i < m_models.size(); i++) + for (std::size_t i=0; i < m_models.size(); i++) { if (m_models[i].ucase().startsWith(search)) { @@ -289,7 +289,7 @@ void netlist_setup_t::register_link_arr(const pstring &terms) nl_util::pstring_list list = nl_util::split(terms,", "); if (list.size() < 2) netlist().error("You must pass at least 2 terminals to NET_C"); - for (int i = 1; i < list.size(); i++) + for (std::size_t i = 1; i < list.size(); i++) { register_link(list[0], list[i]); } @@ -418,7 +418,7 @@ nld_base_proxy *netlist_setup_t::get_d_a_proxy(netlist_core_terminal_t &out) #if 1 /* connect all existing terminals to new net */ - for (int i = 0; i < out.net().m_core_terms.size(); i++) + for (std::size_t i = 0; i < out.net().m_core_terms.size(); i++) { netlist_core_terminal_t *p = out.net().m_core_terms[i]; p->clear_net(); // de-link from all nets ... @@ -577,7 +577,7 @@ bool netlist_setup_t::connect_input_input(netlist_core_terminal_t &t1, netlist_c ret = connect(t2, t1.net().railterminal()); if (!ret) { - for (int i=0; i<t1.net().m_core_terms.size(); i++) + for (std::size_t i=0; i<t1.net().m_core_terms.size(); i++) { if (t1.net().m_core_terms[i]->isType(netlist_core_terminal_t::TERMINAL) /*|| t1.net().m_core_terms[i]->isType(netlist_core_terminal_t::OUTPUT)*/) @@ -595,7 +595,7 @@ bool netlist_setup_t::connect_input_input(netlist_core_terminal_t &t1, netlist_c ret = connect(t1, t2.net().railterminal()); if (!ret) { - for (int i=0; i<t2.net().m_core_terms.size(); i++) + for (std::size_t i=0; i<t2.net().m_core_terms.size(); i++) { if (t2.net().m_core_terms[i]->isType(netlist_core_terminal_t::TERMINAL) /*|| t2.net().m_core_terms[i]->isType(netlist_core_terminal_t::OUTPUT)*/) @@ -674,7 +674,7 @@ void netlist_setup_t::resolve_inputs() int tries = 100; while (m_links.size() > 0 && tries > 0) // FIXME: convert into constant { - int li = 0; + unsigned li = 0; while (li < m_links.size()) { const pstring t1s = m_links[li].e1; @@ -695,7 +695,7 @@ void netlist_setup_t::resolve_inputs() } if (tries == 0) { - for (int i = 0; i < m_links.size(); i++ ) + for (std::size_t i = 0; i < m_links.size(); i++ ) netlist().warning("Error connecting %s to %s\n", m_links[i].e1.cstr(), m_links[i].e2.cstr()); netlist().error("Error connecting -- bailing out\n"); @@ -707,7 +707,7 @@ void netlist_setup_t::resolve_inputs() netlist_net_t::list_t todelete; - for (int i = 0; i<netlist().m_nets.size(); i++) + for (std::size_t i = 0; i<netlist().m_nets.size(); i++) { if (netlist().m_nets[i]->num_cons() == 0) { @@ -719,7 +719,7 @@ void netlist_setup_t::resolve_inputs() } } - for (int i=0; i < todelete.size(); i++) + for (std::size_t i=0; i < todelete.size(); i++) { netlist().log("Deleting net %s ...", todelete[i]->name().cstr()); netlist().m_nets.remove(todelete[i]); @@ -730,7 +730,7 @@ void netlist_setup_t::resolve_inputs() pstring errstr(""); netlist().log("looking for terminals not connected ..."); - for (int i = 0; i < m_terminals.size(); i++) + for (std::size_t i = 0; i < m_terminals.size(); i++) { if (!m_terminals[i]->has_net()) errstr += pstring::sprintf("Found terminal %s without a net\n", @@ -745,7 +745,7 @@ void netlist_setup_t::resolve_inputs() netlist().log("looking for two terms connected to rail nets ...\n"); // FIXME: doesn't find internal devices. This needs to be more clever - for (int i=0; i < netlist().m_devices.size(); i++) + for (std::size_t i=0; i < netlist().m_devices.size(); i++) { NETLIB_NAME(twoterm) *t = dynamic_cast<NETLIB_NAME(twoterm) *>(netlist().m_devices[i]); if (t != NULL) @@ -777,7 +777,7 @@ void netlist_setup_t::start_devices() { NL_VERBOSE_OUT(("Creating dynamic logs ...\n")); nl_util::pstring_list ll = nl_util::split(env, ":"); - for (int i=0; i < ll.size(); i++) + for (std::size_t i=0; i < ll.size(); i++) { NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr())); NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr())); diff --git a/src/emu/netlist/nl_time.h b/src/emu/netlist/nl_time.h index 8e759f2cf1b..457f7622307 100644 --- a/src/emu/netlist/nl_time.h +++ b/src/emu/netlist/nl_time.h @@ -7,6 +7,7 @@ #ifndef NLTIME_H_ #define NLTIME_H_ +#include "nl_config.h" #include "pstate.h" //============================================================ diff --git a/src/emu/netlist/nl_util.h b/src/emu/netlist/nl_util.h index 28b8b859125..cf5ee6a3a7b 100644 --- a/src/emu/netlist/nl_util.h +++ b/src/emu/netlist/nl_util.h @@ -56,7 +56,7 @@ public: while (i<str.len()) { int p = -1; - for (int j=0; j < onstrl.size(); j++) + for (std::size_t j=0; j < onstrl.size(); j++) { if (std::strncmp(onstrl[j].cstr(), &(str.cstr()[i]), onstrl[j].len())==0) { diff --git a/src/emu/netlist/plists.h b/src/emu/netlist/plists.h index 83b94ab3796..25ded23fe83 100644 --- a/src/emu/netlist/plists.h +++ b/src/emu/netlist/plists.h @@ -194,7 +194,7 @@ public: ~plist_t() { if (m_list != NULL) - this->dealloc(m_list, m_capacity); + this->dealloc(m_list); m_list = NULL; } @@ -299,14 +299,14 @@ private: for (_ListClass *ps = m_list; ps < m_list + cnt; ps++, pd++) *pd = *ps; if (m_list != NULL) - this->dealloc(m_list, m_capacity); + this->dealloc(m_list); m_list = m_new; m_count = cnt; } else { if (m_list != NULL) - this->dealloc(m_list, m_capacity); + this->dealloc(m_list); m_list = NULL; m_count = 0; } @@ -318,7 +318,7 @@ private: return palloc_array(_ListClass, n); } - void dealloc(_ListClass *p, std::size_t n) + void dealloc(_ListClass *p) { pfree_array(p); } diff --git a/src/emu/netlist/poptions.h b/src/emu/netlist/poptions.h index ed5750d4560..7803a315d94 100644 --- a/src/emu/netlist/poptions.h +++ b/src/emu/netlist/poptions.h @@ -156,7 +156,7 @@ public: { pstring ret; - for (int i=0; i<m_opts.size(); i++ ) + for (std::size_t i=0; i<m_opts.size(); i++ ) { poption *opt = m_opts[i]; pstring line = ""; @@ -181,7 +181,7 @@ private: poption *getopt_short(pstring arg) { - for (int i=0; i < m_opts.size(); i++) + for (std::size_t i=0; i < m_opts.size(); i++) { if (m_opts[i]->m_short == arg) return m_opts[i]; @@ -190,7 +190,7 @@ private: } poption *getopt_long(pstring arg) { - for (int i=0; i < m_opts.size(); i++) + for (std::size_t i=0; i < m_opts.size(); i++) { if (m_opts[i]->m_long == arg) return m_opts[i]; diff --git a/src/emu/netlist/pparser.c b/src/emu/netlist/pparser.c index e1e6b9b9342..8e58f0dcae7 100644 --- a/src/emu/netlist/pparser.c +++ b/src/emu/netlist/pparser.c @@ -227,7 +227,7 @@ void ppreprocessor::error(const pstring &err) -double ppreprocessor::expr(const nl_util::pstring_list &sexpr, int &start, int prio) +double ppreprocessor::expr(const nl_util::pstring_list &sexpr, std::size_t &start, int prio) { double val; pstring tok=sexpr[start]; @@ -255,14 +255,14 @@ double ppreprocessor::expr(const nl_util::pstring_list &sexpr, int &start, int p } else if (tok == "+") { - if (prio >= 20) + if (prio > 10) return val; start++; val = val + expr(sexpr, start, 10); } else if (tok == "-") { - if (prio >= 20) + if (prio > 10) return val; start++; val = val - expr(sexpr, start, 10); @@ -272,13 +272,25 @@ double ppreprocessor::expr(const nl_util::pstring_list &sexpr, int &start, int p start++; val = val * expr(sexpr, start, 20); } + else if (tok == "/") + { + start++; + val = val / expr(sexpr, start, 20); + } + else if (tok == "==") + { + if (prio > 5) + return val; + start++; + val = (val == expr(sexpr, start, 5)) ? 1.0 : 0.0; + } } return val; } ppreprocessor::define_t *ppreprocessor::get_define(const pstring &name) { - for (int i = 0; i<m_defines.size(); i++) + for (std::size_t i = 0; i<m_defines.size(); i++) { if (m_defines[i].m_name == name) return &m_defines[i]; @@ -290,7 +302,7 @@ pstring ppreprocessor::replace_macros(const pstring &line) { nl_util::pstring_list elems = nl_util::splitexpr(line, m_expr_sep); pstringbuffer ret = ""; - for (int i=0; i<elems.size(); i++) + for (std::size_t i=0; i<elems.size(); i++) { define_t *def = get_define(elems[i]); if (def != NULL) @@ -301,6 +313,16 @@ pstring ppreprocessor::replace_macros(const pstring &line) return pstring(ret.cstr()); } +static pstring catremainder(const nl_util::pstring_list &elems, std::size_t start, pstring sep) +{ + pstringbuffer ret = ""; + for (std::size_t i=start; i<elems.size(); i++) + { + ret.cat(elems[i]); + ret.cat(sep); + } + return pstring(ret.cstr()); +} pstring ppreprocessor::process(const pstring &contents) { @@ -309,7 +331,7 @@ pstring ppreprocessor::process(const pstring &contents) UINT32 ifflag = 0; // 31 if levels int level = 0; - int i=0; + std::size_t i=0; while (i<lines.size()) { pstring line = lines[i]; @@ -321,12 +343,24 @@ pstring ppreprocessor::process(const pstring &contents) if (lti[0].equals("#if")) { level++; - int start = 0; + std::size_t start = 0; nl_util::pstring_list t = nl_util::splitexpr(lt.substr(3).replace(" ",""), m_expr_sep); int val = expr(t, start, 0); if (val == 0) ifflag |= (1 << level); } + else if (lti[0].equals("#ifdef")) + { + level++; + if (get_define(lti[1]) == NULL) + ifflag |= (1 << level); + } + else if (lti[0].equals("#ifndef")) + { + level++; + if (get_define(lti[1]) != NULL) + ifflag |= (1 << level); + } else if (lti[0].equals("#else")) { ifflag ^= (1 << level); @@ -340,6 +374,14 @@ pstring ppreprocessor::process(const pstring &contents) { // ignore } + else if (lti[0].equals("#pragma")) + { + if (lti.size() > 3 && lti[1].equals("NETLIST")) + { + if (lti[2].equals("warning")) + error("NETLIST: " + catremainder(lti, 3, " ")); + } + } else if (lti[0].equals("#define")) { if (lti.size() != 3) @@ -347,7 +389,7 @@ pstring ppreprocessor::process(const pstring &contents) m_defines.add(define_t(lti[1], lti[2])); } else - error(pstring::sprintf("unknown directive on line %d: %s\n", i, line.cstr())); + error(pstring::sprintf("unknown directive on line %" SIZETFMT ": %s\n", i, line.cstr())); } else { diff --git a/src/emu/netlist/pparser.h b/src/emu/netlist/pparser.h index df646b37475..b44e83f649c 100644 --- a/src/emu/netlist/pparser.h +++ b/src/emu/netlist/pparser.h @@ -161,7 +161,7 @@ public: protected: - double expr(const nl_util::pstring_list &sexpr, int &start, int prio); + double expr(const nl_util::pstring_list &sexpr, std::size_t &start, int prio); define_t *get_define(const pstring &name); diff --git a/src/emu/netlist/pstate.c b/src/emu/netlist/pstate.c index 6ee02d99fa1..07532032405 100644 --- a/src/emu/netlist/pstate.c +++ b/src/emu/netlist/pstate.c @@ -41,12 +41,12 @@ ATTR_COLD void pstate_manager_t::remove_save_items(const void *owner) { pstate_entry_t::list_t todelete; - for (int i=0; i < m_save.size(); i++) + for (std::size_t i=0; i < m_save.size(); i++) { if (m_save[i]->m_owner == owner) todelete.add(m_save[i]); } - for (int i=0; i < todelete.size(); i++) + for (std::size_t i=0; i < todelete.size(); i++) { m_save.remove(todelete[i]); } @@ -55,14 +55,14 @@ ATTR_COLD void pstate_manager_t::remove_save_items(const void *owner) ATTR_COLD void pstate_manager_t::pre_save() { - for (int i=0; i < m_save.size(); i++) + for (std::size_t i=0; i < m_save.size(); i++) if (m_save[i]->m_dt == DT_CUSTOM) m_save[i]->m_callback->on_pre_save(); } ATTR_COLD void pstate_manager_t::post_load() { - for (int i=0; i < m_save.size(); i++) + for (std::size_t i=0; i < m_save.size(); i++) if (m_save[i]->m_dt == DT_CUSTOM) m_save[i]->m_callback->on_post_load(); } diff --git a/src/emu/netlist/pstring.c b/src/emu/netlist/pstring.c index 810e7c803ae..ec930808e7b 100644 --- a/src/emu/netlist/pstring.c +++ b/src/emu/netlist/pstring.c @@ -76,7 +76,7 @@ void pstring::pcopy(const char *from, int size) pstring pstring::substr(unsigned int start, int count) const { pstring ret; - int alen = len(); + unsigned alen = len(); if (start >= alen) return ret; if (count <0 || start + count > alen) |
