From e5d3af5c01151479b515ae27f16cd19530cc5133 Mon Sep 17 00:00:00 2001 From: couriersud Date: Tue, 26 May 2015 19:29:43 +0200 Subject: Add #ifndef, #ifdef to netlist preprocessor and implemented == operator Fix more -Wextra warnings, mostly int==>std::size_t and signed comparisons. (nw) --- src/emu/netlist/analog/nld_solver.c | 37 ++++++++++---------- src/emu/netlist/analog/nld_solver.h | 3 ++ src/emu/netlist/devices/nld_truthtable.c | 36 ++++++++++---------- src/emu/netlist/devices/nld_truthtable.h | 14 ++++---- src/emu/netlist/nl_base.c | 30 ++++++++--------- src/emu/netlist/nl_dice_compat.h | 4 +-- src/emu/netlist/nl_factory.c | 6 ++-- src/emu/netlist/nl_parser.c | 4 +-- src/emu/netlist/nl_parser.h | 2 +- src/emu/netlist/nl_setup.c | 26 +++++++------- src/emu/netlist/nl_time.h | 1 + src/emu/netlist/nl_util.h | 2 +- src/emu/netlist/plists.h | 8 ++--- src/emu/netlist/poptions.h | 6 ++-- src/emu/netlist/pparser.c | 58 +++++++++++++++++++++++++++----- src/emu/netlist/pparser.h | 2 +- src/emu/netlist/pstate.c | 8 ++--- src/emu/netlist/pstring.c | 2 +- 18 files changed, 146 insertions(+), 103 deletions(-) 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 #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; iset_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; iname().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; jname().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 t(bits); for (UINT32 j=1; jjb)) { 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 tindex(m_NO); - for (int j=0; j 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 +template 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<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 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; iisType(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; iisType(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; inum_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(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 (idealloc(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; im_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 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) -- cgit v1.2.3 From d3c13bbff35b7eb6e198a0f4dce978eb339938f3 Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 26 May 2015 20:24:52 +0200 Subject: added pinout for common tms1x chips --- src/emu/cpu/tms0980/tms0980.c | 3 +-- src/emu/cpu/tms0980/tms0980.h | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) 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; // 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; // 28-pin DIP, 11 R pins +const device_type TMS0970 = &device_creator; // 28-pin DIP, 11 R pins (note: pinout may slightly differ from chip to chip) const device_type TMS1990 = &device_creator; // 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 { -- cgit v1.2.3 From 2d81c07ecb6f03dfa84890f19bba00ba6fb19f5d Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Tue, 26 May 2015 21:24:47 +0300 Subject: (MESS) pet_flop.xml: Added SFD-1001 Test/Demo disk. [SPACETAXI] --- hash/pet_flop.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 @@ + + Commodore SFD-1001 Floppy Disk Drive Test/Demo Disk + 198? + Commodore + + + + + + + + Commodore 2040 Floppy Disk Drive Test/Demo Disk (DOS v1) 197? -- cgit v1.2.3