Previous 199869 Revisions Next

r34486 Sunday 18th January, 2015 at 19:13:51 UTC by Logan B
Update phozons manufacturer (nw)

According to tilt.it (http://www.tilt.it/deb/sidam-en.html), this one was licensed. Claim holds up given that there's a Super Pac-Man licensed to Bally France that was manufactured by Sidam (http://www.gamoover.net/Forums/index.php?topic=29916.0)
[src/emu]distate.c distate.h luaengine.c luaengine.h save.c save.h
[src/emu/cpu/tms0980]tms0980.c
[src/emu/machine]netlist.c
[src/emu/netlist]nl_base.c nl_base.h nl_config.h nl_dice_compat.h nl_factory.c nl_factory.h nl_parser.c nl_parser.h nl_setup.c nl_setup.h pstate.c pstate.h pstring.c pstring.h
[src/emu/netlist/analog]nld_bjt.c nld_bjt.h nld_fourterm.c nld_fourterm.h nld_ms_direct.h nld_ms_direct1.h nld_ms_direct2.h nld_ms_gauss_seidel.h nld_solver.c nld_solver.h nld_twoterm.c nld_twoterm.h
[src/emu/netlist/devices]nld_4020.c nld_4066.c nld_74123.c nld_74ls629.c nld_cmos.h nld_ne555.c nld_ne555.h nld_r2r_dac.c nld_system.c
[src/mame/drivers]mappy.c nl_pongd.c
[src/mess/drivers]elecdet.c ngen.c splitsec.c
[src/mess/layout]splitsec.lay
[src/osd/sdl]sdlmain.c strconv.h
[src/osd/sdl/man]castool.1 chdman.1 floptool.1 imgtool.1 jedutil.1 ldresample.1 ldverify.1 mame.6 mess.6 romcmp.1 testkeys.1
[src/osd/windows]strconv.h
[src/tools]nltool.c

trunk/src/emu/cpu/tms0980/tms0980.c
r242997r242998
638638   tms1100_cpu_device::device_reset();
639639
640640   // small differences in 00-3f area
641   m_fixed_decode[0x09] = F_COMX;
641642   m_fixed_decode[0x0b] = F_TPC;
642643}
643644
trunk/src/emu/distate.c
r242997r242998
4949//  device_state_entry - constructor
5050//-------------------------------------------------
5151
52device_state_entry::device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size, device_state_interface *dev)
53   : m_device_state(dev),
54      m_next(NULL),
52device_state_entry::device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size)
53   : m_next(NULL),
5554      m_index(index),
5655      m_dataptr(dataptr),
5756      m_datamask(0),
r242997r242998
8786      m_symbol.cpy("CURFLAGS");
8887}
8988
90device_state_entry::device_state_entry(int index, device_state_interface *dev)
91   : m_device_state(dev),
92       m_next(NULL),
89device_state_entry::device_state_entry(int index)
90   : m_next(NULL),
9391      m_index(index),
9492      m_dataptr(NULL),
9593      m_datamask(0),
r242997r242998
525523   assert(symbol != NULL);
526524
527525   // allocate new entry
528   device_state_entry *entry = global_alloc(device_state_entry(index, symbol, data, size, this));
526   device_state_entry *entry = global_alloc(device_state_entry(index, symbol, data, size));
529527
530528   // append to the end of the list
531529   m_state_list.append(*entry);
r242997r242998
545543device_state_entry &device_state_interface::state_add_divider(int index)
546544{
547545   // allocate new entry
548   device_state_entry *entry = global_alloc(device_state_entry(index, this));
546   device_state_entry *entry = global_alloc(device_state_entry(index));
549547
550548   // append to the end of the list
551549   m_state_list.append(*entry);
trunk/src/emu/distate.h
r242997r242998
4545{
4646   friend class device_state_interface;
4747   friend class simple_list<device_state_entry>;
48   friend class lua_engine;
4849
4950private:
5051   // construction/destruction
51   device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size, device_state_interface *dev);
52   device_state_entry(int index, device_state_interface *dev);
52   device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size);
53   device_state_entry(int index);
5354
5455public:
5556   // post-construction modifiers
r242997r242998
6970   const char *symbol() const { return m_symbol; }
7071   bool visible() const { return ((m_flags & DSF_NOSHOW) == 0); }
7172   bool divider() const { return m_flags & DSF_DIVIDER; }
72   device_state_interface *parent_state() const {return m_device_state;}
7373
7474protected:
7575   // device state flags
r242997r242998
9898   static const UINT64 k_decimal_divisor[20];      // divisors for outputting decimal values
9999
100100   // public state description
101   device_state_interface *m_device_state;         // link to parent device state
102101   device_state_entry *    m_next;                 // link to next item
103102   UINT32                  m_index;                // index by which this item is referred
104103   generic_ptr             m_dataptr;              // pointer to where the data lives
trunk/src/emu/luaengine.c
r242997r242998
11// license:BSD-3-Clause
2// copyright-holders:Miodrag Milanovic,Luca Bruno
2// copyright-holders:Miodrag Milanovic
33/***************************************************************************
44
55    luaengine.c
r242997r242998
456456}
457457
458458//-------------------------------------------------
459//  state_get_value - return value of a device state entry
459//  state_get_value - return value of a devices state
460460//  -> manager:machine().devices[":maincpu"].state["PC"].value
461461//-------------------------------------------------
462462
463463UINT64 lua_engine::l_state_get_value(const device_state_entry *d)
464464{
465   device_state_interface *state = d->parent_state();
466   if(state) {
467      luaThis->machine().save().dispatch_presave();
468      return state->state_int(d->index());
469   } else {
470      return 0;
471   }
465   return d->value();
472466}
473467
474468//-------------------------------------------------
475//  state_set_value - set value of a device state entry
469//  state_set_value - set value of a devices state
476470//  -> manager:machine().devices[":maincpu"].state["D0"].value = 0x0c00
477471//-------------------------------------------------
478472
479473void lua_engine::l_state_set_value(device_state_entry *d, UINT64 val)
480474{
481   device_state_interface *state = d->parent_state();
482   if(state) {
483      state->set_state_int(d->index(), val);
484      luaThis->machine().save().dispatch_presave();
485   }
475   d->set_value(val);
486476}
487477
488478//-------------------------------------------------
r242997r242998
537527}
538528
539529//-------------------------------------------------
540//  mem_write - templated memory writer for <sign>,<size>
541//  -> manager:machine().devices[":maincpu"].spaces["program"]:write_u16(0xC000, 0xF00D)
542//-------------------------------------------------
543
544template <typename T>
545int lua_engine::lua_addr_space::l_mem_write(lua_State *L)
546{
547   address_space &sp = luabridge::Stack<address_space &>::get(L, 1);
548   luaL_argcheck(L, lua_isnumber(L, 2), 2, "address (integer) expected");
549   luaL_argcheck(L, lua_isnumber(L, 3), 3, "value (integer) expected");
550   offs_t address = lua_tounsigned(L, 2);
551   T val = lua_tounsigned(L, 3);
552
553   switch(sizeof(val) * 8) {
554      case 8:
555         sp.write_byte(address, val);
556         break;
557      case 16:
558         if ((address & 1) == 0) {
559            sp.write_word(address, val);
560         } else {
561            sp.read_word_unaligned(address, val);
562         }
563         break;
564      case 32:
565         if ((address & 3) == 0) {
566            sp.write_dword(address, val);
567         } else {
568            sp.write_dword_unaligned(address, val);
569         }
570         break;
571      case 64:
572         if ((address & 7) == 0) {
573            sp.write_qword(address, val);
574         } else {
575            sp.write_qword_unaligned(address, val);
576         }
577         break;
578      default:
579         break;
580   }
581
582   return 0;
583}
584
585//-------------------------------------------------
586//  screen_height - return screen visible height
587//  -> manager:machine().screens[":screen"]:height()
588//-------------------------------------------------
589
590int lua_engine::lua_screen::l_height(lua_State *L)
591{
592   screen_device *sc = luabridge::Stack<screen_device *>::get(L, 1);
593   if(!sc) {
594      return 0;
595   }
596
597   lua_pushunsigned(L, sc->visible_area().height());
598   return 1;
599}
600
601//-------------------------------------------------
602//  screen_width - return screen visible width
603//  -> manager:machine().screens[":screen"]:width()
604//-------------------------------------------------
605
606int lua_engine::lua_screen::l_width(lua_State *L)
607{
608   screen_device *sc = luabridge::Stack<screen_device *>::get(L, 1);
609   if(!sc) {
610      return 0;
611   }
612
613   lua_pushunsigned(L, sc->visible_area().width());
614   return 1;
615}
616
617//-------------------------------------------------
618530//  draw_box - draw a box on a screen container
619531//  -> manager:machine().screens[":screen"]:draw_box(x1, y1, x2, y2, bgcolor, linecolor)
620532//-------------------------------------------------
r242997r242998
636548
637549   // retrieve all parameters
638550   float x1, y1, x2, y2;
639   x1 = MIN(lua_tounsigned(L, 2) / static_cast<float>(sc->visible_area().width()) , 1.0f);
640   y1 = MIN(lua_tounsigned(L, 3) / static_cast<float>(sc->visible_area().height()), 1.0f);
641   x2 = MIN(lua_tounsigned(L, 4) / static_cast<float>(sc->visible_area().width()) , 1.0f);
642   y2 = MIN(lua_tounsigned(L, 5) / static_cast<float>(sc->visible_area().height()), 1.0f);
551   x1 = MIN(lua_tounsigned(L, 2) / static_cast<float>(sc->width()) , 1.0f);
552   y1 = MIN(lua_tounsigned(L, 3) / static_cast<float>(sc->height()), 1.0f);
553   x2 = MIN(lua_tounsigned(L, 4) / static_cast<float>(sc->width()) , 1.0f);
554   y2 = MIN(lua_tounsigned(L, 5) / static_cast<float>(sc->height()), 1.0f);
643555   UINT32 bgcolor = lua_tounsigned(L, 6);
644556   UINT32 fgcolor = lua_tounsigned(L, 7);
645557
r242997r242998
672584
673585   // retrieve all parameters
674586   float x1, y1, x2, y2;
675   x1 = MIN(lua_tounsigned(L, 2) / static_cast<float>(sc->visible_area().width()) , 1.0f);
676   y1 = MIN(lua_tounsigned(L, 3) / static_cast<float>(sc->visible_area().height()), 1.0f);
677   x2 = MIN(lua_tounsigned(L, 4) / static_cast<float>(sc->visible_area().width()) , 1.0f);
678   y2 = MIN(lua_tounsigned(L, 5) / static_cast<float>(sc->visible_area().height()), 1.0f);
587   x1 = MIN(lua_tounsigned(L, 2) / static_cast<float>(sc->width()) , 1.0f);
588   y1 = MIN(lua_tounsigned(L, 3) / static_cast<float>(sc->height()), 1.0f);
589   x2 = MIN(lua_tounsigned(L, 4) / static_cast<float>(sc->width()) , 1.0f);
590   y2 = MIN(lua_tounsigned(L, 5) / static_cast<float>(sc->height()), 1.0f);
679591   UINT32 color = lua_tounsigned(L, 6);
680592
681593   // draw the line
r242997r242998
701613   luaL_argcheck(L, lua_isstring(L, 4), 4, "message (string) expected");
702614
703615   // retrieve all parameters
704   float x = MIN(lua_tounsigned(L, 2) / static_cast<float>(sc->visible_area().width()) , 1.0f);
705   float y = MIN(lua_tounsigned(L, 3) / static_cast<float>(sc->visible_area().height()), 1.0f);
616   float x = MIN(lua_tounsigned(L, 2) / static_cast<float>(sc->width()) , 1.0f);
617   float y = MIN(lua_tounsigned(L, 3) / static_cast<float>(sc->height()), 1.0f);
706618   const char *msg = luaL_checkstring(L,4);
707619   // TODO: add optional parameters (colors, etc.)
708620
r242997r242998
970882            .addCFunction ("read_u32", &lua_addr_space::l_mem_read<UINT32>)
971883            .addCFunction ("read_i64", &lua_addr_space::l_mem_read<INT64>)
972884            .addCFunction ("read_u64", &lua_addr_space::l_mem_read<UINT64>)
973            .addCFunction ("write_i8", &lua_addr_space::l_mem_write<INT8>)
974            .addCFunction ("write_u8", &lua_addr_space::l_mem_write<UINT8>)
975            .addCFunction ("write_i16", &lua_addr_space::l_mem_write<INT16>)
976            .addCFunction ("write_u16", &lua_addr_space::l_mem_write<UINT16>)
977            .addCFunction ("write_i32", &lua_addr_space::l_mem_write<INT32>)
978            .addCFunction ("write_u32", &lua_addr_space::l_mem_write<UINT32>)
979            .addCFunction ("write_i64", &lua_addr_space::l_mem_write<INT64>)
980            .addCFunction ("write_u64", &lua_addr_space::l_mem_write<UINT64>)
981885         .endClass()
982886         .deriveClass <address_space, lua_addr_space> ("addr_space")
983887            .addFunction("name", &address_space::name)
r242997r242998
986890            .addCFunction ("draw_box",  &lua_screen::l_draw_box)
987891            .addCFunction ("draw_line", &lua_screen::l_draw_line)
988892            .addCFunction ("draw_text", &lua_screen::l_draw_text)
989            .addCFunction ("height", &lua_screen::l_height)
990            .addCFunction ("width", &lua_screen::l_width)
991893         .endClass()
992894         .deriveClass <screen_device, lua_screen> ("screen_dev")
993            .addFunction ("frame_number", &screen_device::frame_number)
994895            .addFunction ("name", &screen_device::name)
995896            .addFunction ("shortname", &screen_device::shortname)
996897            .addFunction ("tag", &screen_device::tag)
898            .addFunction ("height", &screen_device::height)
899            .addFunction ("width", &screen_device::width)
997900         .endClass()
998901         .beginClass <device_state_entry> ("dev_space")
999902            .addFunction ("name", &device_state_entry::symbol)
trunk/src/emu/luaengine.h
r242997r242998
112112   static luabridge::LuaRef l_dev_get_memspaces(const device_t *d);
113113   struct lua_addr_space {
114114      template<typename T> int l_mem_read(lua_State *L);
115      template<typename T> int l_mem_write(lua_State *L);
116115   };
117116   static luabridge::LuaRef l_machine_get_screens(const running_machine *r);
118117   struct lua_screen {
119      int l_height(lua_State *L);
120      int l_width(lua_State *L);
121118      int l_draw_box(lua_State *L);
122119      int l_draw_line(lua_State *L);
123120      int l_draw_text(lua_State *L);
trunk/src/emu/machine/netlist.c
r242997r242998
4848#include "netlist.h"
4949#include "netlist/nl_base.h"
5050#include "netlist/nl_setup.h"
51#include "netlist/nl_factory.h"
5251#include "netlist/devices/net_lib.h"
5352#include "debugger.h"
5453
r242997r242998
135134   pstring dname = "OUT_" + m_in;
136135   m_delegate.bind_relative_to(owner()->machine().root_device());
137136   NETLIB_NAME(analog_callback) *dev = downcast<NETLIB_NAME(analog_callback) *>(
138         setup.register_dev("nld_analog_callback", dname));
137         setup.factory().new_device_by_classname("nld_analog_callback", setup));
139138
139   setup.register_dev(dev, dname);
140140   dev->register_callback(m_delegate);
141141   setup.register_link(dname + ".IN", m_in);
142142}
r242997r242998
208208{
209209   NETLIB_NAME(sound_in) *snd_in = setup.netlist().get_first_device<NETLIB_NAME(sound_in)>();
210210   if (snd_in == NULL)
211      snd_in = dynamic_cast<NETLIB_NAME(sound_in) *>(setup.register_dev("nld_sound_in", "STREAM_INPUT"));
211   {
212      snd_in = dynamic_cast<NETLIB_NAME(sound_in) *>(setup.factory().new_device_by_classname("nld_sound_in", setup));
213      setup.register_dev(snd_in, "STREAM_INPUT");
214   }
212215
213216   pstring sparam = pstring::sprintf("STREAM_INPUT.CHAN%d", m_channel);
214217   setup.register_param(sparam, m_param_name);
r242997r242998
244247
245248void netlist_mame_stream_output_t::custom_netlist_additions(netlist_setup_t &setup)
246249{
247   //NETLIB_NAME(sound_out) *snd_out;
250   NETLIB_NAME(sound_out) *snd_out;
248251   pstring sname = pstring::sprintf("STREAM_OUT_%d", m_channel);
249252
250   //snd_out = dynamic_cast<NETLIB_NAME(sound_out) *>(setup.register_dev("nld_sound_out", sname));
251   setup.register_dev("nld_sound_out", sname);
253   snd_out = dynamic_cast<NETLIB_NAME(sound_out) *>(setup.factory().new_device_by_classname("nld_sound_out", setup));
254   setup.register_dev(snd_out, sname);
252255
253256   setup.register_param(sname + ".CHAN" , m_channel);
254257   setup.register_param(sname + ".MULT",  m_mult);
r242997r242998
440443               if (td != NULL) save_pointer(td, s->m_name, s->m_count);
441444            }
442445            break;
443            case DT_FLOAT:
444                {
445                    float *td = s->resolved<float>();
446                    if (td != NULL) save_pointer(td, s->m_name, s->m_count);
447                }
448                break;
449446         case DT_INT64:
450447            save_pointer((INT64 *) s->m_ptr, s->m_name, s->m_count);
451448            break;
trunk/src/emu/netlist/analog/nld_bjt.c
r242997r242998
1111{
1212public:
1313   diode() : m_Is(1e-15), m_VT(0.0258), m_VT_inv(1.0 / m_VT) {}
14   diode(const nl_double Is, const nl_double n)
14   diode(const double Is, const double n)
1515   {
1616      m_Is = Is;
1717      m_VT = 0.0258 * n;
1818      m_VT_inv = 1.0 / m_VT;
1919   }
20   void set(const nl_double Is, const nl_double n)
20   void set(const double Is, const double n)
2121   {
2222      m_Is = Is;
2323      m_VT = 0.0258 * n;
2424      m_VT_inv = 1.0 / m_VT;
2525   }
26   nl_double I(const nl_double V) const { return m_Is * exp(V * m_VT_inv) - m_Is; }
27   nl_double g(const nl_double V) const { return m_Is * m_VT_inv * exp(V * m_VT_inv); }
28   nl_double V(const nl_double I) const { return log(1.0 + I / m_Is) * m_VT; }
29   nl_double gI(const nl_double I) const { return m_VT_inv * (I + m_Is); }
26   double I(const double V) const { return m_Is * exp(V * m_VT_inv) - m_Is; }
27   double g(const double V) const { return m_Is * m_VT_inv * exp(V * m_VT_inv); }
28   double V(const double I) const { return log(1.0 + I / m_Is) * m_VT; }
29   double gI(const double I) const { return m_VT_inv * (I + m_Is); }
3030
3131private:
32   nl_double m_Is;
33   nl_double m_VT;
34   nl_double m_VT_inv;
32   double m_Is;
33   double m_VT;
34   double m_VT_inv;
3535};
3636
3737
r242997r242998
8585   m_state_on = 0;
8686
8787   {
88      nl_double IS = m_model.model_value("IS", 1e-15);
89      nl_double BF = m_model.model_value("BF", 100);
90      nl_double NF = m_model.model_value("NF", 1);
91      //nl_double VJE = m_model.dValue("VJE", 0.75);
88      double IS = m_model.model_value("IS", 1e-15);
89      double BF = m_model.model_value("BF", 100);
90      double NF = m_model.model_value("NF", 1);
91      //double VJE = m_model.dValue("VJE", 0.75);
9292
9393      set_qtype((m_model.model_type() == "NPN") ? BJT_NPN : BJT_PNP);
9494
95      nl_double alpha = BF / (1.0 + BF);
95      double alpha = BF / (1.0 + BF);
9696
9797      diode d(IS, NF);
9898
r242997r242998
155155   m_gD_BC.save("m_D_BC", *this);
156156
157157   {
158      nl_double IS = m_model.model_value("IS", 1e-15);
159      nl_double BF = m_model.model_value("BF", 100);
160      nl_double NF = m_model.model_value("NF", 1);
161      nl_double BR = m_model.model_value("BR", 1);
162      nl_double NR = m_model.model_value("NR", 1);
163      //nl_double VJE = m_model.dValue("VJE", 0.75);
158      double IS = m_model.model_value("IS", 1e-15);
159      double BF = m_model.model_value("BF", 100);
160      double NF = m_model.model_value("NF", 1);
161      double BR = m_model.model_value("BR", 1);
162      double NR = m_model.model_value("NR", 1);
163      //double VJE = m_model.dValue("VJE", 0.75);
164164
165165      set_qtype((m_model.model_type() == "NPN") ? BJT_NPN : BJT_PNP);
166166      //printf("type %s\n", m_model.model_type().cstr());
trunk/src/emu/netlist/analog/nld_bjt.h
r242997r242998
9898
9999   NETLIB_UPDATE_TERMINALS()
100100   {
101      const nl_double m = (is_qtype( BJT_NPN) ? 1 : -1);
101      const double m = (is_qtype( BJT_NPN) ? 1 : -1);
102102
103103      const int new_state = (m_RB.deltaV() * m > m_V ) ? 1 : 0;
104104      if (m_state_on ^ new_state)
105105      {
106106#if 0
107         nl_double gb = m_gB;
108         nl_double gc = m_gC;
109         nl_double v  = m_V * m;
107         double gb = m_gB;
108         double gc = m_gC;
109         double v  = m_V * m;
110110         if (!new_state )
111111         {
112112            // not conducting
r242997r242998
115115            gc = netlist().gmin();
116116         }
117117#else
118         const nl_double gb = new_state ? m_gB : netlist().gmin();
119         const nl_double gc = new_state ? m_gC : netlist().gmin();
120         const nl_double v  = new_state ? m_V * m : 0;
118         const double gb = new_state ? m_gB : netlist().gmin();
119         const double gc = new_state ? m_gC : netlist().gmin();
120         const double v  = new_state ? m_V * m : 0;
121121#endif
122122         m_RB.set(gb, v,   0.0);
123123         m_RC.set(gc, 0.0, 0.0);
r242997r242998
142142   ATTR_COLD virtual void start();
143143   ATTR_HOT void update_param();
144144
145   nl_double m_gB; // base conductance / switch on
146   nl_double m_gC; // collector conductance / switch on
147   nl_double m_V; // internal voltage source
145   double m_gB; // base conductance / switch on
146   double m_gC; // collector conductance / switch on
147   double m_V; // internal voltage source
148148   UINT8 m_state_on;
149149
150150private:
r242997r242998
169169
170170   NETLIB_UPDATE_TERMINALS()
171171   {
172      const nl_double polarity = (qtype() == BJT_NPN ? 1.0 : -1.0);
172      const double polarity = (qtype() == BJT_NPN ? 1.0 : -1.0);
173173
174174      m_gD_BE.update_diode(-m_D_EB.deltaV() * polarity);
175175      m_gD_BC.update_diode(-m_D_CB.deltaV() * polarity);
176176
177      const nl_double gee = m_gD_BE.G();
178      const nl_double gcc = m_gD_BC.G();
179      const nl_double gec =  m_alpha_r * gcc;
180      const nl_double gce =  m_alpha_f * gee;
181      const nl_double sIe = -m_gD_BE.I() + m_alpha_r * m_gD_BC.I();
182      const nl_double sIc = m_alpha_f * m_gD_BE.I() - m_gD_BC.I();
183      const nl_double Ie = (sIe + gee * m_gD_BE.Vd() - gec * m_gD_BC.Vd()) * polarity;
184      const nl_double Ic = (sIc - gce * m_gD_BE.Vd() + gcc * m_gD_BC.Vd()) * polarity;
177      const double gee = m_gD_BE.G();
178      const double gcc = m_gD_BC.G();
179      const double gec =  m_alpha_r * gcc;
180      const double gce =  m_alpha_f * gee;
181      const double sIe = -m_gD_BE.I() + m_alpha_r * m_gD_BC.I();
182      const double sIc = m_alpha_f * m_gD_BE.I() - m_gD_BC.I();
183      const double Ie = (sIe + gee * m_gD_BE.Vd() - gec * m_gD_BC.Vd()) * polarity;
184      const double Ic = (sIc - gce * m_gD_BE.Vd() + gcc * m_gD_BC.Vd()) * polarity;
185185
186186      m_D_EB.set_mat(gee, gec - gee, gce - gee, gee - gec, Ie, -Ie);
187187      m_D_CB.set_mat(gcc, gce - gcc, gec - gcc, gcc - gce, Ic, -Ic);
r242997r242998
202202   nld_twoterm m_D_EB;  // gee, gec - gee, gce - gee, gee - gec | Ie
203203   nld_twoterm m_D_EC;  // 0, -gec, -gcc, 0 | 0
204204
205   nl_double m_alpha_f;
206   nl_double m_alpha_r;
205   double m_alpha_f;
206   double m_alpha_r;
207207
208208private:
209209};
trunk/src/emu/netlist/analog/nld_fourterm.c
r242997r242998
1717   m_gfac = 1.0;
1818}
1919
20void NETLIB_NAME(VCCS)::start_internal(const nl_double def_RI)
20void NETLIB_NAME(VCCS)::start_internal(const double def_RI)
2121{
2222   register_param("G", m_G, 1.0);
2323   register_param("RI", m_RI, def_RI);
r242997r242998
4545
4646NETLIB_RESET(VCCS)
4747{
48   const nl_double m_mult = m_G.Value() * m_gfac; // 1.0 ==> 1V ==> 1A
49   const nl_double GI = 1.0 / m_RI.Value();
48   const double m_mult = m_G.Value() * m_gfac; // 1.0 ==> 1V ==> 1A
49   const double GI = 1.0 / m_RI.Value();
5050
5151   m_IP.set(GI);
5252   m_IN.set(GI);
trunk/src/emu/netlist/analog/nld_fourterm.h
r242997r242998
5959   ATTR_COLD virtual void update_param();
6060   ATTR_HOT ATTR_ALIGN void update();
6161
62   ATTR_COLD void start_internal(const nl_double def_RI);
62   ATTR_COLD void start_internal(const double def_RI);
6363
6464   netlist_terminal_t m_OP;
6565   netlist_terminal_t m_ON;
r242997r242998
7373   netlist_param_double_t m_G;
7474   netlist_param_double_t m_RI;
7575
76   nl_double m_gfac;
76   double m_gfac;
7777};
7878
7979// ----------------------------------------------------------------------------------------
r242997r242998
115115   ATTR_COLD virtual void update_param();
116116   ATTR_HOT ATTR_ALIGN void update();
117117
118   nl_double m_gfac;
118   double m_gfac;
119119};
120120
121121
trunk/src/emu/netlist/analog/nld_ms_direct.h
r242997r242998
2828protected:
2929   ATTR_COLD virtual void add_term(int net_idx, netlist_terminal_t *term);
3030
31   ATTR_HOT virtual nl_double vsolve();
31   ATTR_HOT virtual double vsolve();
3232
3333   ATTR_HOT int solve_non_dynamic();
3434   ATTR_HOT void build_LE();
35   ATTR_HOT void gauss_LE(nl_double (* RESTRICT x));
36   ATTR_HOT nl_double delta(const nl_double (* RESTRICT V));
37   ATTR_HOT void store(const nl_double (* RESTRICT V), const bool store_RHS);
35   ATTR_HOT void gauss_LE(double (* RESTRICT x));
36   ATTR_HOT double delta(const double (* RESTRICT V));
37   ATTR_HOT void store(const double (* RESTRICT V), const bool store_RHS);
3838
3939   /* bring the whole system to the current time
4040    * Don't schedule a new calculation time. The recalculation has to be
4141    * triggered by the caller after the netlist element was changed.
4242    */
43   ATTR_HOT nl_double compute_next_timestep();
43   ATTR_HOT double compute_next_timestep();
4444
45   nl_double m_A[_storage_N][((_storage_N + 7) / 8) * 8];
46   nl_double m_RHS[_storage_N];
47   nl_double m_last_RHS[_storage_N]; // right hand side - contains currents
48   nl_double m_Vdelta[_storage_N];
49   nl_double m_last_V[_storage_N];
45   double m_A[_storage_N][((_storage_N + 7) / 8) * 8];
46   double m_RHS[_storage_N];
47   double m_last_RHS[_storage_N]; // right hand side - contains currents
48   double m_Vdelta[_storage_N];
49   double m_last_V[_storage_N];
5050
5151   terms_t **m_terms;
5252   terms_t *m_rails_temp;
r242997r242998
5555   vector_ops_t *m_row_ops[_storage_N + 1];
5656
5757   int m_dim;
58   nl_double m_lp_fact;
58   double m_lp_fact;
5959};
6060
6161// ----------------------------------------------------------------------------------------
r242997r242998
8484}
8585
8686template <int m_N, int _storage_N>
87ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep()
87ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep()
8888{
89   nl_double new_solver_timestep = m_params.m_max_timestep;
89   double new_solver_timestep = m_params.m_max_timestep;
9090
9191   if (m_params.m_dynamic)
9292   {
r242997r242998
103103      {
104104         netlist_analog_net_t *n = m_nets[k];
105105#endif
106         const nl_double DD_n = (n->m_cur_Analog - m_last_V[k]);
107         const nl_double hn = current_timestep();
106         const double DD_n = (n->m_cur_Analog - m_last_V[k]);
107         const double hn = current_timestep();
108108
109         nl_double DD2 = (DD_n / hn - n->m_DD_n_m_1 / n->m_h_n_m_1) / (hn + n->m_h_n_m_1);
110         nl_double new_net_timestep;
109         double DD2 = (DD_n / hn - n->m_DD_n_m_1 / n->m_h_n_m_1) / (hn + n->m_h_n_m_1);
110         double new_net_timestep;
111111
112112         n->m_h_n_m_1 = hn;
113113         n->m_DD_n_m_1 = DD_n;
r242997r242998
236236      for (int i=0; i < N(); i++)
237237         m_A[k][i] = 0.0;
238238
239      nl_double rhsk = 0.0;
240      nl_double akk  = 0.0;
239      double rhsk = 0.0;
240      double akk  = 0.0;
241241      {
242242         const int terms_count = m_terms[k]->count();
243         const nl_double * RESTRICT gt = m_terms[k]->gt();
244         const nl_double * RESTRICT go = m_terms[k]->go();
245         const nl_double * RESTRICT Idr = m_terms[k]->Idr();
243         const double * RESTRICT gt = m_terms[k]->gt();
244         const double * RESTRICT go = m_terms[k]->go();
245         const double * RESTRICT Idr = m_terms[k]->Idr();
246246#if VECTALT
247247
248248         for (int i = 0; i < terms_count; i++)
r242997r242998
253253#else
254254         m_terms[k]->ops()->sum2(Idr, gt, rhsk, akk);
255255#endif
256         nl_double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog();
256         double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog();
257257         for (int i = m_terms[k]->m_railstart; i < terms_count; i++)
258258         {
259259            //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog();
r242997r242998
272272      m_A[k][k] += 1.0;
273273      {
274274         const int *net_other = m_terms[k]->net_other();
275         const nl_double *go = m_terms[k]->go();
275         const double *go = m_terms[k]->go();
276276         const int railstart =  m_terms[k]->m_railstart;
277277
278278         for (int i = 0; i < railstart; i++)
r242997r242998
285285      m_A[k][k] += akk;
286286      {
287287         const int * RESTRICT net_other = m_terms[k]->net_other();
288         const nl_double * RESTRICT go = m_terms[k]->go();
288         const double * RESTRICT go = m_terms[k]->go();
289289         const int railstart =  m_terms[k]->m_railstart;
290290
291291         for (int i = 0; i < railstart; i++)
r242997r242998
299299
300300template <int m_N, int _storage_N>
301301ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::gauss_LE(
302      nl_double (* RESTRICT x))
302      double (* RESTRICT x))
303303{
304304#if 0
305305   for (int i = 0; i < N(); i++)
r242997r242998
336336      }
337337
338338      /* FIXME: Singular matrix? */
339      const nl_double f = 1.0 / m_A[i][i];
339      const double f = 1.0 / m_A[i][i];
340340
341341      /* Eliminate column i from row j */
342342
343343      for (int j = i + 1; j < kN; j++)
344344      {
345         const nl_double f1 = - m_A[j][i] * f;
345         const double f1 = - m_A[j][i] * f;
346346         if (f1 != 0.0)
347347         {
348348#if 0 && VECTALT
r242997r242998
359359   /* back substitution */
360360   for (int j = kN - 1; j >= 0; j--)
361361   {
362      nl_double tmp = 0;
362      double tmp = 0;
363363
364364      for (int k = j + 1; k < kN; k++)
365365         tmp += m_A[j][k] * x[k];
r242997r242998
380380}
381381
382382template <int m_N, int _storage_N>
383ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta(
384      const nl_double (* RESTRICT V))
383ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta(
384      const double (* RESTRICT V))
385385{
386   nl_double cerr = 0;
387   nl_double cerr2 = 0;
386   double cerr = 0;
387   double cerr2 = 0;
388388   for (int i = 0; i < this->N(); i++)
389389   {
390      const nl_double e = (V[i] - this->m_nets[i]->m_cur_Analog);
391      const nl_double e2 = (m_RHS[i] - this->m_last_RHS[i]);
390      const double e = (V[i] - this->m_nets[i]->m_cur_Analog);
391      const double e2 = (m_RHS[i] - this->m_last_RHS[i]);
392392      cerr = (fabs(e) > cerr ? fabs(e) : cerr);
393393      cerr2 = (fabs(e2) > cerr2 ? fabs(e2) : cerr2);
394394   }
r242997r242998
398398
399399template <int m_N, int _storage_N>
400400ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::store(
401      const nl_double (* RESTRICT V), const bool store_RHS)
401      const double (* RESTRICT V), const bool store_RHS)
402402{
403403   for (int i = 0; i < this->N(); i++)
404404   {
r242997r242998
414414}
415415
416416template <int m_N, int _storage_N>
417ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve()
417ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve()
418418{
419419   solve_base<netlist_matrix_solver_direct_t>(this);
420420   return this->compute_next_timestep();
r242997r242998
424424template <int m_N, int _storage_N>
425425ATTR_HOT int netlist_matrix_solver_direct_t<m_N, _storage_N>::solve_non_dynamic()
426426{
427   nl_double new_v[_storage_N] = { 0.0 };
427   double new_v[_storage_N] = { 0.0 };
428428
429429   this->gauss_LE(new_v);
430430
431431   if (this->is_dynamic())
432432   {
433      nl_double err = delta(new_v);
433      double err = delta(new_v);
434434
435435      store(new_v, true);
436436
trunk/src/emu/netlist/analog/nld_ms_direct1.h
r242997r242998
1818      {}
1919   ATTR_HOT inline int vsolve_non_dynamic();
2020protected:
21   ATTR_HOT virtual nl_double vsolve();
21   ATTR_HOT virtual double vsolve();
2222private:
2323};
2424
r242997r242998
2626// netlist_matrix_solver - Direct1
2727// ----------------------------------------------------------------------------------------
2828
29ATTR_HOT nl_double netlist_matrix_solver_direct1_t::vsolve()
29ATTR_HOT double netlist_matrix_solver_direct1_t::vsolve()
3030{
3131   solve_base<netlist_matrix_solver_direct1_t>(this);
3232   return this->compute_next_timestep();
r242997r242998
3838   this->build_LE();
3939   //NL_VERBOSE_OUT(("%f %f\n", new_val, m_RHS[0] / m_A[0][0]);
4040
41   nl_double new_val =  m_RHS[0] / m_A[0][0];
41   double new_val =  m_RHS[0] / m_A[0][0];
4242
43   nl_double e = (new_val - net->m_cur_Analog);
44   nl_double cerr = fabs(e);
43   double e = (new_val - net->m_cur_Analog);
44   double cerr = fabs(e);
4545
4646   net->m_cur_Analog = new_val;
4747
trunk/src/emu/netlist/analog/nld_ms_direct2.h
r242997r242998
2020      {}
2121   ATTR_HOT inline int vsolve_non_dynamic();
2222protected:
23   ATTR_HOT virtual nl_double vsolve();
23   ATTR_HOT virtual double vsolve();
2424private:
2525};
2626
r242997r242998
2828// netlist_matrix_solver - Direct2
2929// ----------------------------------------------------------------------------------------
3030
31ATTR_HOT nl_double netlist_matrix_solver_direct2_t::vsolve()
31ATTR_HOT double netlist_matrix_solver_direct2_t::vsolve()
3232{
3333   solve_base<netlist_matrix_solver_direct2_t>(this);
3434   return this->compute_next_timestep();
r242997r242998
3838{
3939   build_LE();
4040
41   const nl_double a = m_A[0][0];
42   const nl_double b = m_A[0][1];
43   const nl_double c = m_A[1][0];
44   const nl_double d = m_A[1][1];
41   const double a = m_A[0][0];
42   const double b = m_A[0][1];
43   const double c = m_A[1][0];
44   const double d = m_A[1][1];
4545
46   nl_double new_val[2];
46   double new_val[2];
4747   new_val[1] = (a * m_RHS[1] - c * m_RHS[0]) / (a * d - b * c);
4848   new_val[0] = (m_RHS[0] - b * new_val[1]) / a;
4949
5050   if (is_dynamic())
5151   {
52      nl_double err = this->delta(new_val);
52      double err = this->delta(new_val);
5353      store(new_val, true);
5454      if (err > m_params.m_accuracy )
5555         return 2;
trunk/src/emu/netlist/analog/nld_ms_gauss_seidel.h
r242997r242998
2929
3030   ATTR_HOT inline int vsolve_non_dynamic();
3131protected:
32   ATTR_HOT virtual nl_double vsolve();
32   ATTR_HOT virtual double vsolve();
3333
3434private:
35   nl_double m_lp_fact;
35   double m_lp_fact;
3636   int m_gs_fail;
3737   int m_gs_total;
3838
r242997r242998
6464}
6565
6666template <int m_N, int _storage_N>
67ATTR_HOT nl_double netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::vsolve()
67ATTR_HOT double netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::vsolve()
6868{
6969   /*
7070    * enable linear prediction on first newton pass
r242997r242998
8686
8787   if (USE_LINEAR_PREDICTION)
8888   {
89      nl_double sq = 0;
90      nl_double sqo = 0;
91      const nl_double rez_cts = 1.0 / this->current_timestep();
89      double sq = 0;
90      double sqo = 0;
91      const double rez_cts = 1.0 / this->current_timestep();
9292      for (int k = 0; k < this->N(); k++)
9393      {
9494         const netlist_analog_net_t *n = this->m_nets[k];
95         const nl_double nv = (n->m_cur_Analog - this->m_last_V[k]) * rez_cts ;
95         const double nv = (n->m_cur_Analog - this->m_last_V[k]) * rez_cts ;
9696         sq += nv * nv;
9797         sqo += this->m_Vdelta[k] * this->m_Vdelta[k];
9898         this->m_Vdelta[k] = nv;
r242997r242998
116116    */
117117
118118#if 0 || USE_MATRIX_GS
119   static nl_double ws = 1.0;
120   ATTR_ALIGN nl_double new_v[_storage_N] = { 0.0 };
119   static double ws = 1.0;
120   ATTR_ALIGN double new_v[_storage_N] = { 0.0 };
121121   const int iN = this->N();
122122
123123   bool resched = false;
r242997r242998
127127   this->build_LE();
128128
129129   {
130      nl_double frob;
130      double frob;
131131      frob = 0;
132      nl_double rmin = 1e99, rmax = -1e99;
132      double rmin = 1e99, rmax = -1e99;
133133      for (int k = 0; k < iN; k++)
134134      {
135135         new_v[k] = this->m_nets[k]->m_cur_Analog;
136         nl_double s=0.0;
136         double s=0.0;
137137         for (int i = 0; i < iN; i++)
138138         {
139139            frob += this->m_A[k][i] * this->m_A[k][i];
r242997r242998
146146            rmax = s;
147147      }
148148#if 0
149      nl_double frobA = sqrt(frob /(iN));
149      double frobA = sqrt(frob /(iN));
150150      if (1 &&frobA < 1.0)
151151         //ws = 2.0 / (1.0 + sqrt(1.0-frobA));
152152         ws = 2.0 / (2.0 - frobA);
r242997r242998
161161      // overhead is bigger than the gain. Consequently the fast GS below
162162      // uses a fixed GS. One can however use this here to determine a
163163      // suitable parameter.
164      nl_double rm = (rmax + rmin) * 0.5;
164      double rm = (rmax + rmin) * 0.5;
165165      if (rm < 1.0)
166166         ws = 2.0 / (1.0 + sqrt(1.0-rm));
167167      else
r242997r242998
172172   }
173173
174174   // Frobenius norm for (D-L)^(-1)U
175   //nl_double frobU;
176   //nl_double frobL;
177   //nl_double norm;
175   //double frobU;
176   //double frobL;
177   //double norm;
178178   do {
179179      resched = false;
180      nl_double cerr = 0.0;
180      double cerr = 0.0;
181181      //frobU = 0;
182182      //frobL = 0;
183183      //norm = 0;
184184
185185      for (int k = 0; k < iN; k++)
186186      {
187         nl_double Idrive = 0;
188         //nl_double norm_t = 0;
187         double Idrive = 0;
188         //double norm_t = 0;
189189         // Reduction loops need -ffast-math
190190         for (int i = 0; i < iN; i++)
191191            Idrive += this->m_A[k][i] * new_v[i];
r242997r242998
198198         }
199199
200200         //if (norm_t > norm) norm = norm_t;
201         const nl_double new_val = (1.0-ws) * new_v[k] + ws * (this->m_RHS[k] - Idrive + this->m_A[k][k] * new_v[k]) / this->m_A[k][k];
201         const double new_val = (1.0-ws) * new_v[k] + ws * (this->m_RHS[k] - Idrive + this->m_A[k][k] * new_v[k]) / this->m_A[k][k];
202202
203         const nl_double e = fabs(new_val - new_v[k]);
203         const double e = fabs(new_val - new_v[k]);
204204         cerr = (e > cerr ? e : cerr);
205205         new_v[k] = new_val;
206206      }
r242997r242998
210210         resched = true;
211211      }
212212      resched_cnt++;
213      //ATTR_UNUSED nl_double frobUL = sqrt((frobU + frobL) / (double) (iN) / (double) (iN));
213      //ATTR_UNUSED double frobUL = sqrt((frobU + frobL) / (double) (iN) / (double) (iN));
214214   } while (resched && (resched_cnt < this->m_params.m_gs_loops));
215215   //printf("Frobenius %f %f %f %f %f\n", sqrt(frobU), sqrt(frobL), frobUL, frobA, norm);
216216   //printf("Omega Estimate1 %f %f\n", 2.0 / (1.0 + sqrt(1-frobUL)), 2.0 / (1.0 + sqrt(1-frobA)) ); //        printf("Frobenius %f\n", sqrt(frob / (double) (iN * iN) ));
r242997r242998
247247    * omega = 2.0 / (1.0 + sqrt(1-rho))
248248    */
249249
250   const nl_double ws = this->m_params.m_sor; //1.045; //2.0 / (1.0 + /*sin*/(3.14159 * 5.5 / (double) (m_nets.count()+1)));
251   //const nl_double ws = 2.0 / (1.0 + sin(3.14159 * 4 / (double) (this->N())));
250   const double ws = this->m_params.m_sor; //1.045; //2.0 / (1.0 + /*sin*/(3.14159 * 5.5 / (double) (m_nets.count()+1)));
251   //const double ws = 2.0 / (1.0 + sin(3.14159 * 4 / (double) (this->N())));
252252
253   ATTR_ALIGN nl_double w[_storage_N];
254   ATTR_ALIGN nl_double one_m_w[_storage_N];
255   ATTR_ALIGN nl_double RHS[_storage_N];
256   ATTR_ALIGN nl_double new_V[_storage_N];
253   ATTR_ALIGN double w[_storage_N];
254   ATTR_ALIGN double one_m_w[_storage_N];
255   ATTR_ALIGN double RHS[_storage_N];
256   ATTR_ALIGN double new_V[_storage_N];
257257
258258   for (int k = 0; k < iN; k++)
259259   {
260      nl_double gtot_t = 0.0;
261      nl_double gabs_t = 0.0;
262      nl_double RHS_t = 0.0;
260      double gtot_t = 0.0;
261      double gabs_t = 0.0;
262      double RHS_t = 0.0;
263263
264264      new_V[k] = this->m_nets[k]->m_cur_Analog;
265265
266266      {
267267         const int term_count = this->m_terms[k]->count();
268         const nl_double * const RESTRICT gt = this->m_terms[k]->gt();
269         const nl_double * const RESTRICT go = this->m_terms[k]->go();
270         const nl_double * const RESTRICT Idr = this->m_terms[k]->Idr();
271         const nl_double * const *other_cur_analog = this->m_terms[k]->other_curanalog();
268         const double * const RESTRICT gt = this->m_terms[k]->gt();
269         const double * const RESTRICT go = this->m_terms[k]->go();
270         const double * const RESTRICT Idr = this->m_terms[k]->Idr();
271         const double * const *other_cur_analog = this->m_terms[k]->other_curanalog();
272272#if VECTALT
273273         for (int i = 0; i < term_count; i++)
274274         {
r242997r242998
308308
309309   }
310310
311   const nl_double accuracy = this->m_params.m_accuracy;
311   const double accuracy = this->m_params.m_accuracy;
312312
313313   do {
314314      resched = false;
r242997r242998
317317      {
318318         const int * RESTRICT net_other = this->m_terms[k]->net_other();
319319         const int railstart = this->m_terms[k]->m_railstart;
320         const nl_double * RESTRICT go = this->m_terms[k]->go();
320         const double * RESTRICT go = this->m_terms[k]->go();
321321
322         nl_double Idrive = 0.0;
322         double Idrive = 0.0;
323323         for (int i = 0; i < railstart; i++)
324324            Idrive = Idrive + go[i] * new_V[net_other[i]];
325325
326         //nl_double new_val = (net->m_cur_Analog * gabs[k] + iIdr) / (gtot[k]);
327         const nl_double new_val = new_V[k] * one_m_w[k] + (Idrive + RHS[k]) * w[k];
326         //double new_val = (net->m_cur_Analog * gabs[k] + iIdr) / (gtot[k]);
327         const double new_val = new_V[k] * one_m_w[k] + (Idrive + RHS[k]) * w[k];
328328
329329         resched = resched || (std::abs(new_val - new_V[k]) > accuracy);
330330         new_V[k] = new_val;
trunk/src/emu/netlist/analog/nld_solver.c
r242997r242998
233233
234234ATTR_COLD void netlist_matrix_solver_t::update()
235235{
236   const nl_double new_timestep = solve();
236   const double new_timestep = solve();
237237
238238   if (m_params.m_dynamic && is_timestep() && new_timestep > 0)
239239      m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(new_timestep));
r242997r242998
241241
242242ATTR_COLD void netlist_matrix_solver_t::update_forced()
243243{
244   ATTR_UNUSED const nl_double new_timestep = solve();
244   ATTR_UNUSED const double new_timestep = solve();
245245
246246   if (m_params.m_dynamic && is_timestep())
247247      m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(m_params.m_min_timestep));
r242997r242998
249249
250250ATTR_HOT void netlist_matrix_solver_t::step(const netlist_time delta)
251251{
252   const nl_double dd = delta.as_double();
252   const double dd = delta.as_double();
253253   for (int k=0; k < m_step_devices.count(); k++)
254254      m_step_devices[k]->step_time(dd);
255255}
r242997r242998
284284   }
285285}
286286
287ATTR_HOT nl_double netlist_matrix_solver_t::solve()
287ATTR_HOT double netlist_matrix_solver_t::solve()
288288{
289289   netlist_time now = netlist().time();
290290   netlist_time delta = now - m_last_step;
r242997r242998
300300
301301   step(delta);
302302
303   const nl_double next_time_step = vsolve();
303   const double next_time_step = vsolve();
304304
305305   update_inputs();
306306   return next_time_step;
r242997r242998
348348   register_param("GMIN", m_gmin, NETLIST_GMIN_DEFAULT);
349349   register_param("DYNAMIC_TS", m_dynamic, 0);
350350   register_param("LTE", m_lte, 5e-5);                     // diff/timestep
351   register_param("MIN_TIMESTEP", m_min_timestep, 1e-6);   // nl_double timestep resolution
351   register_param("MIN_TIMESTEP", m_min_timestep, 1e-6);   // double timestep resolution
352352
353353   // internal staff
354354
r242997r242998
417417      if (m_mat_solvers[i]->is_timestep())
418418         {
419419            // Ignore return value
420            ATTR_UNUSED const nl_double ts = m_mat_solvers[i]->solve();
420            ATTR_UNUSED const double ts = m_mat_solvers[i]->solve();
421421         }
422422   }
423423#endif
trunk/src/emu/netlist/analog/nld_solver.h
r242997r242998
3737
3838struct netlist_solver_parameters_t
3939{
40   nl_double m_accuracy;
41   nl_double m_lte;
42   nl_double m_min_timestep;
43   nl_double m_max_timestep;
44   nl_double m_sor;
40   double m_accuracy;
41   double m_lte;
42   double m_min_timestep;
43   double m_max_timestep;
44   double m_sor;
4545   bool m_dynamic;
4646   int m_gs_loops;
4747   int m_nr_loops;
r242997r242998
5959
6060   virtual ~vector_ops_t() {}
6161
62   virtual const nl_double sum(const nl_double * v) = 0;
63   virtual void sum2(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, nl_double & RESTRICT  s1, nl_double & RESTRICT s2) = 0;
64   virtual void addmult(nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double &mult) = 0;
65   virtual void sum2a(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double * RESTRICT v3abs, nl_double & RESTRICT s1, nl_double & RESTRICT s2, nl_double & RESTRICT s3abs) = 0;
62   virtual const double sum(const double * v) = 0;
63   virtual void sum2(const double * RESTRICT v1, const double * RESTRICT v2, double & RESTRICT  s1, double & RESTRICT s2) = 0;
64   virtual void addmult(double * RESTRICT v1, const double * RESTRICT v2, const double &mult) = 0;
65   virtual void sum2a(const double * RESTRICT v1, const double * RESTRICT v2, const double * RESTRICT v3abs, double & RESTRICT s1, double & RESTRICT s2, double & RESTRICT s3abs) = 0;
6666
67   virtual const nl_double sumabs(const nl_double * v) = 0;
67   virtual const double sumabs(const double * v) = 0;
6868
6969   static vector_ops_t *create_ops(const int size);
7070
r242997r242998
9595
9696   ATTR_HOT inline const int N() const { if (m_N == 0) return m_dim; else return m_N; }
9797
98   const nl_double sum(const nl_double * v)
98   const double sum(const double * v)
9999   {
100      const nl_double *  RESTRICT vl = v;
101      nl_double tmp = 0.0;
100      const double *  RESTRICT vl = v;
101      double tmp = 0.0;
102102      for (int i=0; i < N(); i++)
103103         tmp += vl[i];
104104      return tmp;
105105   }
106106
107   void sum2(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, nl_double & RESTRICT s1, nl_double & RESTRICT s2)
107   void sum2(const double * RESTRICT v1, const double * RESTRICT v2, double & RESTRICT s1, double & RESTRICT s2)
108108   {
109      const nl_double * RESTRICT v1l = v1;
110      const nl_double * RESTRICT v2l = v2;
109      const double * RESTRICT v1l = v1;
110      const double * RESTRICT v2l = v2;
111111      for (int i=0; i < N(); i++)
112112      {
113113         s1 += v1l[i];
r242997r242998
115115      }
116116   }
117117
118   void addmult(nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double &mult)
118   void addmult(double * RESTRICT v1, const double * RESTRICT v2, const double &mult)
119119   {
120      nl_double * RESTRICT v1l = v1;
121      const nl_double * RESTRICT v2l = v2;
120      double * RESTRICT v1l = v1;
121      const double * RESTRICT v2l = v2;
122122      for (int i=0; i < N(); i++)
123123      {
124124         v1l[i] += v2l[i] * mult;
125125      }
126126   }
127127
128   void sum2a(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double * RESTRICT v3abs, nl_double & RESTRICT s1, nl_double & RESTRICT s2, nl_double & RESTRICT s3abs)
128   void sum2a(const double * RESTRICT v1, const double * RESTRICT v2, const double * RESTRICT v3abs, double & RESTRICT s1, double & RESTRICT s2, double & RESTRICT s3abs)
129129   {
130      const nl_double * RESTRICT v1l = v1;
131      const nl_double * RESTRICT v2l = v2;
132      const nl_double * RESTRICT v3l = v3abs;
130      const double * RESTRICT v1l = v1;
131      const double * RESTRICT v2l = v2;
132      const double * RESTRICT v3l = v3abs;
133133      for (int i=0; i < N(); i++)
134134      {
135135         s1 += v1l[i];
r242997r242998
138138      }
139139   }
140140
141   const nl_double sumabs(const nl_double * v)
141   const double sumabs(const double * v)
142142   {
143      const nl_double * RESTRICT vl = v;
144      nl_double tmp = 0.0;
143      const double * RESTRICT vl = v;
144      double tmp = 0.0;
145145      for (int i=0; i < N(); i++)
146146         tmp += fabs(vl[i]);
147147      return tmp;
r242997r242998
171171
172172   ATTR_HOT inline netlist_terminal_t **terms() { return m_term; }
173173   ATTR_HOT inline int *net_other() { return m_net_other; }
174   ATTR_HOT inline nl_double *gt() { return m_gt; }
175   ATTR_HOT inline nl_double *go() { return m_go; }
176   ATTR_HOT inline nl_double *Idr() { return m_Idr; }
177   ATTR_HOT inline nl_double **other_curanalog() { return m_other_curanalog; }
174   ATTR_HOT inline double *gt() { return m_gt; }
175   ATTR_HOT inline double *go() { return m_go; }
176   ATTR_HOT inline double *Idr() { return m_Idr; }
177   ATTR_HOT inline double **other_curanalog() { return m_other_curanalog; }
178178
179179   ATTR_COLD void set_pointers();
180180
r242997r242998
183183private:
184184   plinearlist_t<netlist_terminal_t *> m_term;
185185   plinearlist_t<int> m_net_other;
186   plinearlist_t<nl_double> m_go;
187   plinearlist_t<nl_double> m_gt;
188   plinearlist_t<nl_double> m_Idr;
189   plinearlist_t<nl_double *> m_other_curanalog;
186   plinearlist_t<double> m_go;
187   plinearlist_t<double> m_gt;
188   plinearlist_t<double> m_Idr;
189   plinearlist_t<double *> m_other_curanalog;
190190};
191191
192192class netlist_matrix_solver_t : public netlist_device_t
r242997r242998
209209   template<class C>
210210   void solve_base(C *p);
211211
212   ATTR_HOT nl_double solve();
212   ATTR_HOT double solve();
213213
214214   ATTR_HOT inline bool is_dynamic() { return m_dynamic_devices.count() > 0; }
215215   ATTR_HOT inline bool is_timestep() { return m_step_devices.count() > 0; }
r242997r242998
236236   ATTR_HOT void update_dynamic();
237237
238238   // should return next time step
239   ATTR_HOT virtual nl_double vsolve() = 0;
239   ATTR_HOT virtual double vsolve() = 0;
240240
241241   ATTR_COLD virtual void  add_term(int net_idx, netlist_terminal_t *term) = 0;
242242
r242997r242998
249249
250250   const netlist_solver_parameters_t &m_params;
251251
252   ATTR_HOT inline const nl_double current_timestep() { return m_cur_ts; }
252   ATTR_HOT inline const double current_timestep() { return m_cur_ts; }
253253private:
254254
255255   netlist_time m_last_step;
256   nl_double m_cur_ts;
256   double m_cur_ts;
257257   dev_list_t m_step_devices;
258258   dev_list_t m_dynamic_devices;
259259
r242997r242998
279279
280280   ATTR_COLD void post_start();
281281
282   ATTR_HOT inline nl_double gmin() { return m_gmin.Value(); }
282   ATTR_HOT inline double gmin() { return m_gmin.Value(); }
283283
284284protected:
285285   ATTR_HOT void update();
trunk/src/emu/netlist/analog/nld_twoterm.c
r242997r242998
1616   set_param(1e-15, 1, 1e-15);
1717}
1818
19ATTR_COLD void netlist_generic_diode::set_param(const nl_double Is, const nl_double n, nl_double gmin)
19ATTR_COLD void netlist_generic_diode::set_param(const double Is, const double n, double gmin)
2020{
2121   m_Is = Is;
2222   m_n = n;
r242997r242998
157157
158158NETLIB_UPDATE_PARAM(POT)
159159{
160   nl_double v = m_Dial.Value();
160   double v = m_Dial.Value();
161161   if (m_DialIsLog.Value())
162162      v = (exp(v) - 1.0) / (exp(1.0) - 1.0);
163163
r242997r242998
221221
222222NETLIB_UPDATE_PARAM(D)
223223{
224   nl_double Is = m_model.model_value("Is", 1e-15);
225   nl_double n = m_model.model_value("N", 1);
224   double Is = m_model.model_value("Is", 1e-15);
225   double n = m_model.model_value("N", 1);
226226
227227   m_D.set_param(Is, n, netlist().gmin());
228228}
trunk/src/emu/netlist/analog/nld_twoterm.h
r242997r242998
9797   {
9898   }
9999
100   ATTR_HOT inline void set(const nl_double G, const nl_double V, const nl_double I)
100   ATTR_HOT inline void set(const double G, const double V, const double I)
101101   {
102102      /*      GO, GT, I                */
103103      m_P.set( G,  G, (  V) * G - I);
104104      m_N.set( G,  G, ( -V) * G + I);
105105   }
106106
107   ATTR_HOT inline nl_double deltaV() const
107   ATTR_HOT inline double deltaV() const
108108   {
109109      return m_P.net().as_analog().Q_Analog() - m_N.net().as_analog().Q_Analog();
110110   }
111111
112   ATTR_HOT void set_mat(nl_double a11, nl_double a12, nl_double a21, nl_double a22, nl_double r1, nl_double r2)
112   ATTR_HOT void set_mat(double a11, double a12, double a21, double a22, double r1, double r2)
113113   {
114114      /*      GO, GT, I                */
115115      m_P.set(-a12, a11, -r1);
r242997r242998
133133public:
134134   ATTR_COLD NETLIB_NAME(R_base)() : NETLIB_NAME(twoterm)(RESISTOR) { }
135135
136   inline void set_R(const nl_double R)
136   inline void set_R(const double R)
137137   {
138138      set(1.0 / R, 0.0, 0.0);
139139   }
r242997r242998
171171public:
172172   ATTR_COLD NETLIB_NAME(C)() : NETLIB_NAME(twoterm)(CAPACITOR) { }
173173
174   ATTR_HOT void step_time(const nl_double st)
174   ATTR_HOT void step_time(const double st)
175175   {
176      const nl_double G = m_C.Value() / st;
177      const nl_double I = -G * deltaV();
176      const double G = m_C.Value() / st;
177      const double I = -G * deltaV();
178178      set(G, 0.0, I);
179179   }
180180
r242997r242998
198198public:
199199   ATTR_COLD netlist_generic_diode();
200200
201   ATTR_HOT inline void update_diode(const nl_double nVd)
201   ATTR_HOT inline void update_diode(const double nVd)
202202   {
203203      //FIXME: Optimize cutoff case
204204
r242997r242998
212212      {
213213         m_Vd = nVd;
214214
215         const nl_double eVDVt = exp(m_Vd * m_VtInv);
215         const double eVDVt = exp(m_Vd * m_VtInv);
216216         m_Id = m_Is * (eVDVt - 1.0);
217217         m_G = m_Is * m_VtInv * eVDVt + m_gmin;
218218      }
r242997r242998
221221#if defined(_MSC_VER) && _MSC_VER < 1800
222222         m_Vd = m_Vd + log((nVd - m_Vd) * m_VtInv + 1.0) * m_Vt;
223223#else
224         nl_double a = (nVd - m_Vd) * m_VtInv;
224         double a = (nVd - m_Vd) * m_VtInv;
225225         if (a<1e-12 - 1.0) a = 1e-12 - 1.0;
226226         m_Vd = m_Vd + log1p(a) * m_Vt;
227227#endif
228         const nl_double eVDVt = exp(m_Vd * m_VtInv);
228         const double eVDVt = exp(m_Vd * m_VtInv);
229229         m_Id = m_Is * (eVDVt - 1.0);
230230
231231         m_G = m_Is * m_VtInv * eVDVt + m_gmin;
r242997r242998
234234      //printf("nVd %f m_Vd %f Vcrit %f\n", nVd, m_Vd, m_Vcrit);
235235   }
236236
237   ATTR_COLD void set_param(const nl_double Is, const nl_double n, nl_double gmin);
237   ATTR_COLD void set_param(const double Is, const double n, double gmin);
238238
239   ATTR_HOT inline nl_double I() const { return m_Id; }
240   ATTR_HOT inline nl_double G() const { return m_G; }
241   ATTR_HOT inline nl_double Ieq() const { return (m_Id - m_Vd * m_G); }
242   ATTR_HOT inline nl_double Vd() const { return m_Vd; }
239   ATTR_HOT inline double I() const { return m_Id; }
240   ATTR_HOT inline double G() const { return m_G; }
241   ATTR_HOT inline double Ieq() const { return (m_Id - m_Vd * m_G); }
242   ATTR_HOT inline double Vd() const { return m_Vd; }
243243
244244   /* owning object must save those ... */
245245
246246   ATTR_COLD void save(pstring name, netlist_object_t &parent);
247247
248248private:
249   nl_double m_Vd;
250   nl_double m_Id;
251   nl_double m_G;
249   double m_Vd;
250   double m_Id;
251   double m_G;
252252
253   nl_double m_Vt;
254   nl_double m_Is;
255   nl_double m_n;
256   nl_double m_gmin;
253   double m_Vt;
254   double m_Is;
255   double m_n;
256   double m_gmin;
257257
258   nl_double m_VtInv;
259   nl_double m_Vcrit;
258   double m_VtInv;
259   double m_Vcrit;
260260};
261261
262262// ----------------------------------------------------------------------------------------
r242997r242998
268268// add c3 and it'll be better than 1%
269269
270270#if 0
271inline nl_double fastexp_h(const nl_double x)
271inline double fastexp_h(const double x)
272272{
273   static const nl_double ln2r = 1.442695040888963387;
274   static const nl_double ln2  = 0.693147180559945286;
275   //static const nl_double c3   = 0.166666666666666667;
273   static const double ln2r = 1.442695040888963387;
274   static const double ln2  = 0.693147180559945286;
275   //static const double c3   = 0.166666666666666667;
276276
277   const nl_double y = x * ln2r;
277   const double y = x * ln2r;
278278   const unsigned int t = y;
279   const nl_double z = (x - ln2 * (double) t);
280   const nl_double zz = z * z;
281   //const nl_double zzz = zz * z;
279   const double z = (x - ln2 * (double) t);
280   const double zz = z * z;
281   //const double zzz = zz * z;
282282
283283   return (double)(1 << t)*(1.0 + z + 0.5 * zz); // + c3*zzz;
284284}
285285
286inline nl_double fastexp(const nl_double x)
286inline double fastexp(const double x)
287287{
288288   if (x<0)
289289      return 1.0 / fastexp_h(-x);
trunk/src/emu/netlist/devices/nld_4020.c
r242997r242998
125125   register_subalias("7", sub.m_Q[3]);
126126   register_subalias("8", m_supply.m_vss);
127127
128   register_subalias("9", sub.m_Q[0]);
128   register_subalias("9", sub.m_Q[1]);
129129   register_subalias("10", sub.m_IP);
130130   register_subalias("11", m_RESET);
131131   register_subalias("12", sub.m_Q[8]);
trunk/src/emu/netlist/devices/nld_4066.c
r242997r242998
1919
2020NETLIB_UPDATE(4066)
2121{
22   nl_double sup = (m_supply.get()->vdd() - m_supply.get()->vss());
23   nl_double low = 0.45 * sup;
24   nl_double high = 0.55 * sup;
25   nl_double in = INPANALOG(m_control) - m_supply.get()->vss();
26   nl_double rON = 270.0 * 5.0 / sup;
22   double sup = (m_supply.get()->vdd() - m_supply.get()->vss());
23   double low = 0.45 * sup;
24   double high = 0.55 * sup;
25   double in = INPANALOG(m_control) - m_supply.get()->vss();
26   double rON = 270.0 * 5.0 / sup;
2727
2828   if (in < low)
2929   {
r242997r242998
5353   register_subalias("4", m_B.m_R.m_N);
5454   register_subalias("5", m_B.m_control);
5555   register_subalias("6", m_C.m_control);
56   register_subalias("7", m_supply.m_vss);
56   register_input("7", m_supply.m_vss);
5757
5858   register_subalias("8", m_C.m_R.m_P);
5959   register_subalias("9", m_C.m_R.m_N);
r242997r242998
6161   register_subalias("11", m_D.m_R.m_N);
6262   register_subalias("12", m_D.m_control);
6363   register_subalias("13", m_A.m_control);
64   register_subalias("14", m_supply.m_vdd);
64   register_input("14", m_supply.m_vdd);
6565
6666}
6767
trunk/src/emu/netlist/devices/nld_74123.c
r242997r242998
6969
7070   if (m_state == 1)
7171   {
72      const nl_double vLow = m_KP * TERMANALOG(m_RP.m_P);
72      const double vLow = m_KP * TERMANALOG(m_RP.m_P);
7373      if (INPANALOG(m_CV) < vLow)
7474      {
7575         m_RN.set_R(R_OFF);
r242997r242998
7878   }
7979   else if (m_state == 2)
8080   {
81      const nl_double vHigh = TERMANALOG(m_RP.m_P) * (1.0 - m_KP);
81      const double vHigh = TERMANALOG(m_RP.m_P) * (1.0 - m_KP);
8282      if (INPANALOG(m_CV) > vHigh)
8383      {
8484         m_RP.set_R(R_OFF);
trunk/src/emu/netlist/devices/nld_74ls629.c
r242997r242998
104104{
105105   {
106106      // recompute
107      nl_double  freq;
108      nl_double  v_freq_2, v_freq_3, v_freq_4;
109      nl_double  v_freq = INPANALOG(m_FC);
110      nl_double  v_rng = INPANALOG(m_RNG);
107      double  freq;
108      double  v_freq_2, v_freq_3, v_freq_4;
109      double  v_freq = INPANALOG(m_FC);
110      double  v_rng = INPANALOG(m_RNG);
111111
112112      /* coefficients */
113      const nl_double k1 = 1.9904769024796283E+03;
114      const nl_double k2 = 1.2070059213983407E+03;
115      const nl_double k3 = 1.3266985579561108E+03;
116      const nl_double k4 = -1.5500979825922698E+02;
117      const nl_double k5 = 2.8184536266938172E+00;
118      const nl_double k6 = -2.3503421582744556E+02;
119      const nl_double k7 = -3.3836786704527788E+02;
120      const nl_double k8 = -1.3569136703258670E+02;
121      const nl_double k9 = 2.9914575453819188E+00;
122      const nl_double k10 = 1.6855569086173170E+00;
113      const double k1 = 1.9904769024796283E+03;
114      const double k2 = 1.2070059213983407E+03;
115      const double k3 = 1.3266985579561108E+03;
116      const double k4 = -1.5500979825922698E+02;
117      const double k5 = 2.8184536266938172E+00;
118      const double k6 = -2.3503421582744556E+02;
119      const double k7 = -3.3836786704527788E+02;
120      const double k8 = -1.3569136703258670E+02;
121      const double k9 = 2.9914575453819188E+00;
122      const double k10 = 1.6855569086173170E+00;
123123
124124      /* scale due to input resistance */
125125
trunk/src/emu/netlist/devices/nld_cmos.h
r242997r242998
2929      ATTR_HOT void reset()  {};
3030
3131public:
32   ATTR_HOT inline nl_double vdd() { return INPANALOG(m_vdd); }
33   ATTR_HOT inline nl_double vss() { return INPANALOG(m_vss); }
32   ATTR_HOT inline double vdd() { return INPANALOG(m_vdd); }
33   ATTR_HOT inline double vss() { return INPANALOG(m_vss); }
3434};
3535
3636#endif /* NLD_CMOS_H_ */
trunk/src/emu/netlist/devices/nld_ne555.c
r242997r242998
1010#define R_OFF (1E20)
1111#define R_ON (25)   // Datasheet states a maximum discharge of 200mA, R = 5V / 0.2
1212
13inline nl_double NETLIB_NAME(NE555)::clamp(const nl_double v, const nl_double a, const nl_double b)
13inline double NETLIB_NAME(NE555)::clamp(const double v, const double a, const double b)
1414{
15   nl_double ret = v;
16   nl_double vcc = TERMANALOG(m_R1.m_P);
15   double ret = v;
16   double vcc = TERMANALOG(m_R1.m_P);
1717
1818   if (ret >  vcc - a)
1919      ret = vcc - a;
r242997r242998
6464{
6565   // FIXME: assumes GND is connected to 0V.
6666
67   nl_double vt = clamp(TERMANALOG(m_R2.m_P), 0.7, 1.4);
67   double vt = clamp(TERMANALOG(m_R2.m_P), 0.7, 1.4);
6868   bool bthresh = (INPANALOG(m_THRES) > vt);
6969   bool btrig = (INPANALOG(m_TRIG) > clamp(TERMANALOG(m_R2.m_N), 0.7, 1.4));
7070   bool out = m_last_out;
trunk/src/emu/netlist/devices/nld_ne555.h
r242997r242998
3939
4040   netlist_state_t<bool> m_last_out;
4141
42   inline nl_double clamp(const nl_double v, const nl_double a, const nl_double b);
42   inline double clamp(const double v, const double a, const double b);
4343
4444);
4545
trunk/src/emu/netlist/devices/nld_r2r_dac.c
r242997r242998
3232
3333   update_dev();
3434
35   nl_double V = m_VIN.Value() / (double) (1 << m_num.Value()) * (double) m_val.Value();
35   double V = m_VIN.Value() / (double) (1 << m_num.Value()) * (double) m_val.Value();
3636
3737   this->set(1.0 / m_R.Value(), V, 0.0);
3838}
trunk/src/emu/netlist/devices/nld_system.c
r242997r242998
118118   if (state != m_last_state)
119119   {
120120      m_last_state = state;
121      const nl_double R = state ? m_logic_family->m_R_high : m_logic_family->m_R_low;
122      const nl_double V = state ? m_logic_family->m_high_V : m_logic_family->m_low_V;
121      const double R = state ? m_logic_family->m_R_high : m_logic_family->m_R_low;
122      const double V = state ? m_logic_family->m_high_V : m_logic_family->m_low_V;
123123
124124      // We only need to update the net first if this is a time stepping net
125125      if (m_RV.m_P.net().as_analog().solver()->is_timestep())
trunk/src/emu/netlist/nl_base.c
r242997r242998
170170   netlist_object_t::save_register();
171171}
172172
173ATTR_HOT const nl_double netlist_base_t::gmin() const
173ATTR_HOT const double netlist_base_t::gmin() const
174174{
175175   return solver()->gmin();
176176}
r242997r242998
452452}
453453
454454template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_double_t &param, const double initialVal);
455template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_double_t &param, const float initialVal);
456455template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_int_t &param, const int initialVal);
457456template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_logic_t &param, const int initialVal);
458457template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_str_t &param, const char * const initialVal);
r242997r242998
875874   net().as_analog().m_cur_Analog = 0.98;
876875}
877876
878ATTR_COLD void netlist_analog_output_t::initial(const nl_double val)
877ATTR_COLD void netlist_analog_output_t::initial(const double val)
879878{
880879   net().as_analog().m_cur_Analog = val * 0.99;
881880}
r242997r242998
932931}
933932
934933
935ATTR_COLD nl_double netlist_param_model_t::model_value(const pstring &entity, const nl_double defval) const
934ATTR_COLD double netlist_param_model_t::model_value(const pstring &entity, const double defval) const
936935{
937936   pstring tmp = this->Value();
938937   // .model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)
r242997r242998
946945      if (pequal < 0)
947946         netlist().error("parameter %s misformat in model %s temp %s\n", entity.cstr(), Value().cstr(), tmp.cstr());
948947      tmp = tmp.substr(pequal+1);
949      nl_double factor = 1.0;
948      double factor = 1.0;
950949      switch (*(tmp.right(1).cstr()))
951950      {
952951         case 'm': factor = 1e-3; break;
r242997r242998
10021001   net.set_time(netlist().time() + m_inc);
10031002}
10041003
1004// ----------------------------------------------------------------------------------------
1005// net_device_t_base_factory
1006// ----------------------------------------------------------------------------------------
1007
1008ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::term_param_list()
1009{
1010   if (m_def_param.startsWith("+"))
1011      return nl_util::split(m_def_param.substr(1), ",");
1012   else
1013      return nl_util::pstring_list();
1014}
1015
1016ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::def_params()
1017{
1018   if (m_def_param.startsWith("+") || m_def_param.equals("-"))
1019      return nl_util::pstring_list();
1020   else
1021      return nl_util::split(m_def_param, ",");
1022}
trunk/src/emu/netlist/nl_base.h
r242997r242998
272272
273273struct netlist_logic_family_desc_t
274274{
275   nl_double m_low_thresh_V;
276   nl_double m_high_thresh_V;
277   nl_double m_low_V;
278   nl_double m_high_V;
279   nl_double m_R_low;
280   nl_double m_R_high;
275   double m_low_thresh_V;
276   double m_high_thresh_V;
277   double m_low_V;
278   double m_high_V;
279   double m_R_low;
280   double m_R_high;
281281};
282282
283283/* Terminals inherit the family description from the netlist_device
r242997r242998
474474
475475   ATTR_COLD netlist_terminal_t();
476476
477   nl_double *m_Idr1; // drive current
478   nl_double *m_go1;  // conductance for Voltage from other term
479   nl_double *m_gt1;  // conductance for total conductance
477   double *m_Idr1; // drive current
478   double *m_go1;  // conductance for Voltage from other term
479   double *m_gt1;  // conductance for total conductance
480480
481   ATTR_HOT inline void set(const nl_double G)
481   ATTR_HOT inline void set(const double G)
482482   {
483483      set_ptr(m_Idr1, 0);
484484      set_ptr(m_go1, G);
485485      set_ptr(m_gt1, G);
486486   }
487487
488   ATTR_HOT inline void set(const nl_double GO, const nl_double GT)
488   ATTR_HOT inline void set(const double GO, const double GT)
489489   {
490490      set_ptr(m_Idr1, 0);
491491      set_ptr(m_go1, GO);
492492      set_ptr(m_gt1, GT);
493493   }
494494
495   ATTR_HOT inline void set(const nl_double GO, const nl_double GT, const nl_double I)
495   ATTR_HOT inline void set(const double GO, const double GT, const double I)
496496   {
497497      set_ptr(m_Idr1, I);
498498      set_ptr(m_go1, GO);
r242997r242998
509509
510510   ATTR_COLD virtual void reset();
511511private:
512   inline void set_ptr(nl_double *ptr, const nl_double val)
512   inline void set_ptr(double *ptr, const double val)
513513   {
514514      if (ptr != NULL)
515515         *ptr = val;
r242997r242998
586586   ATTR_COLD netlist_analog_input_t()
587587      : netlist_input_t(INPUT, ANALOG) { }
588588
589   ATTR_HOT inline const nl_double Q_Analog() const;
589   ATTR_HOT inline const double Q_Analog() const;
590590};
591591
592592//#define INPVAL(_x) (_x).Q()
r242997r242998
661661   // We have to have those on one object. Dividing those does lead
662662   // to a significant performance hit
663663   // FIXME: Have to fix the public at some time
664   nl_double m_cur_Analog;
664   double m_cur_Analog;
665665
666666};
667667
r242997r242998
736736   ATTR_COLD netlist_analog_net_t();
737737   ATTR_COLD virtual ~netlist_analog_net_t() { };
738738
739   ATTR_HOT inline const nl_double Q_Analog() const
739   ATTR_HOT inline const double Q_Analog() const
740740   {
741741      //nl_assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG);
742742      nl_assert(family() == ANALOG);
743743      return m_cur_Analog;
744744   }
745745
746   ATTR_COLD inline nl_double &Q_Analog_state_ptr()
746   ATTR_COLD inline double &Q_Analog_state_ptr()
747747   {
748748      //nl_assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG);
749749      nl_assert(family() == ANALOG);
r242997r242998
764764private:
765765
766766public:
767   nl_double m_DD_n_m_1;
768   nl_double m_h_n_m_1;
767   double m_DD_n_m_1;
768   double m_h_n_m_1;
769769
770770   //FIXME: needed by current solver code
771771   netlist_matrix_solver_t *m_solver;
r242997r242998
831831
832832   ATTR_COLD netlist_analog_output_t();
833833
834   ATTR_COLD void initial(const nl_double val);
834   ATTR_COLD void initial(const double val);
835835
836   ATTR_HOT inline void set_Q(const nl_double newQ);
836   ATTR_HOT inline void set_Q(const double newQ);
837837
838838   netlist_analog_net_t *m_proxied_net; // only for proxy nets in analog input logic
839839
r242997r242998
876876public:
877877   ATTR_COLD netlist_param_double_t();
878878
879   ATTR_HOT inline void setTo(const nl_double param);
880   ATTR_COLD inline void initial(const nl_double val) { m_param = val; }
881   ATTR_HOT inline const nl_double Value() const        { return m_param;   }
879   ATTR_HOT inline void setTo(const double param);
880   ATTR_COLD inline void initial(const double val) { m_param = val; }
881   ATTR_HOT inline const double Value() const        { return m_param;   }
882882
883883protected:
884884   ATTR_COLD virtual void save_register()
r242997r242998
888888   }
889889
890890private:
891   nl_double m_param;
891   double m_param;
892892};
893893
894894class netlist_param_int_t : public netlist_param_t
r242997r242998
946946   ATTR_HOT inline const pstring &Value() const     { return m_param;     }
947947
948948   /* these should be cached! */
949   ATTR_COLD nl_double model_value(const pstring &entity, const nl_double defval = 0.0) const;
949   ATTR_COLD double model_value(const pstring &entity, const double defval = 0.0) const;
950950   ATTR_COLD const pstring model_type() const;
951951
952952private:
r242997r242998
997997      out.set_Q(val, delay);
998998   }
999999
1000   ATTR_HOT inline const nl_double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); }
1000   ATTR_HOT inline const double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); }
10011001
1002   ATTR_HOT inline const nl_double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); }
1002   ATTR_HOT inline const double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); }
10031003
1004   ATTR_HOT inline void OUTANALOG(netlist_analog_output_t &out, const nl_double val)
1004   ATTR_HOT inline void OUTANALOG(netlist_analog_output_t &out, const double val)
10051005   {
10061006      out.set_Q(val);
10071007   }
r242997r242998
10101010
10111011   ATTR_HOT virtual void dec_active() {  }
10121012
1013   ATTR_HOT virtual void step_time(const nl_double st) { }
1013   ATTR_HOT virtual void step_time(const double st) { }
10141014   ATTR_HOT virtual void update_terminals() { }
10151015
10161016
r242997r242998
11201120   ATTR_HOT inline const netlist_time time() const { return m_time; }
11211121   ATTR_HOT inline NETLIB_NAME(solver) *solver() const { return m_solver; }
11221122   ATTR_HOT inline NETLIB_NAME(gnd) *gnd() const { return m_gnd; }
1123   ATTR_HOT const nl_double gmin() const;
1123   ATTR_HOT const double gmin() const;
11241124
11251125   ATTR_HOT inline void push_to_queue(netlist_net_t *out, const netlist_time attime)
11261126   {
r242997r242998
12511251   }
12521252}
12531253
1254ATTR_HOT inline void netlist_param_double_t::setTo(const nl_double param)
1254ATTR_HOT inline void netlist_param_double_t::setTo(const double param)
12551255{
12561256   if (m_param != param)
12571257   {
r242997r242998
13561356   return net().as_logic().Q();
13571357}
13581358
1359ATTR_HOT inline const nl_double netlist_analog_input_t::Q_Analog() const
1359ATTR_HOT inline const double netlist_analog_input_t::Q_Analog() const
13601360{
13611361   return net().as_analog().Q_Analog();
13621362}
13631363
1364ATTR_HOT inline void netlist_analog_output_t::set_Q(const nl_double newQ)
1364ATTR_HOT inline void netlist_analog_output_t::set_Q(const double newQ)
13651365{
13661366   if (newQ != net().as_analog().m_cur_Analog)
13671367   {
trunk/src/emu/netlist/nl_config.h
r242997r242998
4949
5050#define NETLIST_GMIN_DEFAULT    (1e-9)
5151
52//typedef double   nl_double;
53
54#define nl_double double
55
5652//============================================================
5753//  DEBUGGING
5854//============================================================
r242997r242998
159155#else
160156#define nl_assert(x)               do { } while (0)
161157//#define assert_always(x, msg)   do { if (!(x)) throw emu_fatalerror("Fatal error: %s (%s:%d)", msg, __FILE__, __LINE__); } while (0)
162#define nl_assert_always(x, msg)    do { if (!(x)) throw nl_fatalerror("Fatal error: %s\nCaused by assert: %s:%d: %s", msg, __FILE__, __LINE__, #x); } while (0)
158#define nl_assert_always(x, msg)   do { } while (0)
163159#endif
164160
165161//============================================================
trunk/src/emu/netlist/nl_dice_compat.h
r242997r242998
88#ifndef NL_DICE_COMPAT_H_
99#define NL_DICE_COMPAT_H_
1010
11#include "netlist/devices/net_lib.h"
12
1311/* --------------------------------------------------------------------
1412 * Compatibility macros for DICE netlists ...
1513 * -------------------------------------------------------------------- */
1614
17/*
18 * define NETLIST_DEVELOPMENT in IDEs before including this header file
19 * to get compile time errors on unknown devices. This should only be
20 * a temporary support and not be used in commits.
21 */
22
23#ifdef NETLIST_DEVELOPMENT
15//#define CHIP(_n, _t) netlist.register_dev(NET_NEW(_t ## _dip), _n);
2416#define CHIP(_n, _t) setup.register_dev( nl_alloc(nld_ ## _t ## _dip), _n);
25#else
26#define CHIP(_n, _t) setup.register_dev(NETLIB_NAME_STR(_t ## _dip), _n);
27#endif
2817
2918#define CONNECTION( ... ) CONNECTIONY( CONNECTIONX( __VA_ARGS__ ) )
3019#define CONNECTIONY(_a) _a
r242997r242998
4130struct Mono555Desc
4231{
4332public:
44      nl_double r, c;
33      double r, c;
4534
46      Mono555Desc(nl_double res, nl_double cap) : r(res), c(cap) { }
35      Mono555Desc(double res, double cap) : r(res), c(cap) { }
4736};
4837
4938struct SeriesRCDesc
5039{
5140public:
52      nl_double r, c;
41      double r, c;
5342
54      SeriesRCDesc(nl_double res, nl_double cap) : r(res), c(cap) { }
43      SeriesRCDesc(double res, double cap) : r(res), c(cap) { }
5544};
5645
5746#define CHIP_555_Mono(_name,  _pdesc)   \
trunk/src/emu/netlist/nl_factory.c
r242997r242998
5050#include "nl_factory.h"
5151#include "nl_setup.h"
5252
53// ----------------------------------------------------------------------------------------
54// net_device_t_base_factory
55// ----------------------------------------------------------------------------------------
56
57ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::term_param_list()
58{
59    if (m_def_param.startsWith("+"))
60        return nl_util::split(m_def_param.substr(1), ",");
61    else
62        return nl_util::pstring_list();
63}
64
65ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::def_params()
66{
67    if (m_def_param.startsWith("+") || m_def_param.equals("-"))
68        return nl_util::pstring_list();
69    else
70        return nl_util::split(m_def_param, ",");
71}
72
73
7453netlist_factory_t::netlist_factory_t()
7554{
7655}
r242997r242998
8564   m_list.clear();
8665}
8766
88netlist_device_t *netlist_factory_t::new_device_by_classname(const pstring &classname) const
67netlist_device_t *netlist_factory_t::new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const
8968{
9069   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
9170   {
r242997r242998
9776      }
9877      p++;
9978   }
79   setup.netlist().error("Class %s not found!\n", classname.cstr());
10080   return NULL; // appease code analysis
10181}
10282
trunk/src/emu/netlist/nl_factory.h
r242997r242998
8080      m_list.add(nl_alloc(net_device_t_factory< _C >, name, classname, def_param));
8181   }
8282
83   ATTR_COLD netlist_device_t *new_device_by_classname(const pstring &classname) const;
83   ATTR_COLD netlist_device_t *new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const;
8484   ATTR_COLD netlist_device_t *new_device_by_name(const pstring &name, netlist_setup_t &setup) const;
8585   ATTR_COLD net_device_t_base_factory * factory_by_name(const pstring &name, netlist_setup_t &setup) const;
8686
trunk/src/emu/netlist/nl_parser.c
r242997r242998
66 */
77
88#include "nl_parser.h"
9#include "nl_factory.h"
109
1110//#undef NL_VERBOSE_OUT
1211//#define NL_VERBOSE_OUT(x) printf x
r242997r242998
400399void netlist_parser::netdev_param()
401400{
402401   pstring param;
403   nl_double val;
402   double val;
404403   param = get_identifier();
405404   require_token(m_tok_comma);
406405   val = eval_param(get_token());
r242997r242998
440439      }
441440      else
442441      {
443         nl_double val = eval_param(tok);
442         double val = eval_param(tok);
444443         m_setup.register_param(paramfq, val);
445444      }
446445      cnt++;
r242997r242998
468467// ----------------------------------------------------------------------------------------
469468
470469
471nl_double netlist_parser::eval_param(const token_t tok)
470double netlist_parser::eval_param(const token_t tok)
472471{
473472   static const char *macs[6] = {"", "RES_K", "RES_M", "CAP_U", "CAP_N", "CAP_P"};
474   static nl_double facs[6] = {1, 1e3, 1e6, 1e-6, 1e-9, 1e-12};
473   static double facs[6] = {1, 1e3, 1e6, 1e-6, 1e-9, 1e-12};
475474   int i;
476475   int f=0;
477476   bool e;
478   nl_double ret;
477   double ret;
479478   pstring val;
480479
481480   //printf("param %s\n", tok.m_token.cstr());
trunk/src/emu/netlist/nl_parser.h
r242997r242998
160160   virtual void verror(pstring msg, int line_num, pstring line);
161161private:
162162
163   nl_double eval_param(const token_t tok);
163   double eval_param(const token_t tok);
164164
165165   token_id_t m_tok_param_left;
166166   token_id_t m_tok_param_right;
trunk/src/emu/netlist/nl_setup.c
r242997r242998
99#include "nl_setup.h"
1010#include "nl_parser.h"
1111#include "nl_util.h"
12#include "nl_factory.h"
1312#include "devices/net_lib.h"
1413#include "devices/nld_system.h"
1514#include "analog/nld_solver.h"
r242997r242998
3837   , m_proxy_cnt(0)
3938{
4039   netlist.set_setup(this);
41   m_factory = nl_alloc(netlist_factory_t);
4240}
4341
4442void netlist_setup_t::init()
r242997r242998
5755   m_params_temp.clear();
5856
5957   netlist().set_setup(NULL);
60   nl_free(m_factory);
6158
6259   pstring::resetmem();
6360}
r242997r242998
9592   return dev;
9693}
9794
98netlist_device_t *netlist_setup_t::register_dev(const pstring &classname, const pstring &name)
99{
100    netlist_device_t *dev = factory().new_device_by_classname(classname);
101    if (dev == NULL)
102        netlist().error("Class %s not found!\n", classname.cstr());
103    return register_dev(dev, name);
104}
105
10695template <class T>
10796static void remove_start_with(T &hm, pstring &sw)
10897{
r242997r242998
706695      {
707696         NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
708697         NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
709         netlist_device_t *nc = factory().new_device_by_classname("nld_log");
698         netlist_device_t *nc = factory().new_device_by_classname("nld_log", *this);
710699         pstring name = "log_" + ll[i];
711700         register_dev(nc, name);
712701         register_link(name + ".I", ll[i]);
trunk/src/emu/netlist/nl_setup.h
r242997r242998
33/*
44 * nlsetup.h
55 *
6 *  Created on: 3 Nov 2013
7 *      Author: andre
68 */
79
810#ifndef NLSETUP_H_
911#define NLSETUP_H_
1012
1113#include "nl_base.h"
12//#include "nl_factory.h"
14#include "nl_factory.h"
1315
1416//============================================================
1517//  MACROS / inline netlist definitions
r242997r242998
2325#define ALIAS(_alias, _name)                                                        \
2426   setup.register_alias(# _alias, # _name);
2527
26//#define NET_NEW(_type)  setup.factory().new_device_by_classname(NETLIB_NAME_STR(_type), setup)
28#define NET_NEW(_type)  setup.factory().new_device_by_classname(NETLIB_NAME_STR(_type), setup)
2729
2830#define NET_REGISTER_DEV(_type, _name)                                              \
29      setup.register_dev(NETLIB_NAME_STR(_type), # _name);
31      setup.register_dev(NET_NEW(_type), # _name);
3032
3133#define NET_REMOVE_DEV(_name)                                                       \
3234      setup.remove_dev(# _name);
r242997r242998
6567      setup.namespace_pop();
6668
6769// ----------------------------------------------------------------------------------------
70// FIXME: Clean this up
71// ----------------------------------------------------------------------------------------
72
73//class NETLIB_NAME(analog_callback);
74
75// ----------------------------------------------------------------------------------------
6876// netlist_setup_t
6977// ----------------------------------------------------------------------------------------
7078
71// Forward definition so we keep nl_factory.h out of the public
72class netlist_factory_t;
73
7479class netlist_setup_t
7580{
7681   NETLIST_PREVENT_COPYING(netlist_setup_t)
r242997r242998
113118
114119   netlist_base_t &netlist() { return m_netlist; }
115120   const netlist_base_t &netlist() const { return m_netlist; }
121   netlist_factory_t &factory() { return m_factory; }
122   const netlist_factory_t &factory() const { return m_factory; }
116123
117124   pstring build_fqn(const pstring &obj_name) const;
118125
119126   netlist_device_t *register_dev(netlist_device_t *dev, const pstring &name);
120   netlist_device_t *register_dev(const pstring &classname, const pstring &name);
121127   void remove_dev(const pstring &name);
122128
123129   void register_model(const pstring &model);
r242997r242998
146152   void namespace_push(const pstring &aname);
147153   void namespace_pop();
148154
149    netlist_factory_t &factory() { return *m_factory; }
150    const netlist_factory_t &factory() const { return *m_factory; }
155   /* not ideal, but needed for save_state */
156   tagmap_terminal_t  m_terminals;
151157
152    /* not ideal, but needed for save_state */
153    tagmap_terminal_t  m_terminals;
158   void print_stats() const;
154159
155    void print_stats() const;
156
157160protected:
158161
159162private:
r242997r242998
165168   tagmap_link_t   m_links;
166169   tagmap_nstring_t m_params_temp;
167170
168   netlist_factory_t *m_factory;
171   netlist_factory_t m_factory;
169172
170173   plinearlist_t<pstring> m_models;
171174
trunk/src/emu/netlist/pstate.c
r242997r242998
2323         "DT_INT16",
2424         "DT_INT8",
2525         "DT_INT",
26         "DT_BOOLEAN",
27            "DT_FLOAT"
26         "DT_BOOLEAN"
2827   };
2928
3029   NL_VERBOSE_OUT(("SAVE: <%s> %s(%d) %p\n", fullname.cstr(), ts[dt].cstr(), size, ptr));
trunk/src/emu/netlist/pstate.h
r242997r242998
3232   DT_INT16,
3333   DT_INT8,
3434   DT_INT,
35   DT_BOOLEAN,
36   DT_FLOAT
35   DT_BOOLEAN
3736};
3837
3938template<typename _ItemType> struct nl_datatype
r242997r242998
5655
5756NETLIST_SAVE_TYPE(char, DT_INT8);
5857NETLIST_SAVE_TYPE(double, DT_DOUBLE);
59NETLIST_SAVE_TYPE(float, DT_FLOAT);
6058NETLIST_SAVE_TYPE(INT8, DT_INT8);
6159NETLIST_SAVE_TYPE(UINT8, DT_INT8);
6260NETLIST_SAVE_TYPE(INT64, DT_INT64);
trunk/src/emu/netlist/pstring.c
r242997r242998
108108   return 1;
109109}
110110
111nl_double pstring::as_double(bool *error) const
111double pstring::as_double(bool *error) const
112112{
113   nl_double ret;
113   double ret;
114114   char *e = NULL;
115115
116116   if (error != NULL)
r242997r242998
124124
125125long pstring::as_long(bool *error) const
126126{
127   nl_double ret;
127   double ret;
128128   char *e = NULL;
129129
130130   if (error != NULL)
trunk/src/emu/netlist/pstring.h
r242997r242998
159159
160160   // conversions
161161
162   nl_double as_double(bool *error = NULL) const;
162   double as_double(bool *error = NULL) const;
163163
164164   long as_long(bool *error = NULL) const;
165165
trunk/src/emu/save.c
r242997r242998
213213   return validate_header(header, gamename, sig, errormsg, "");
214214}
215215
216//-------------------------------------------------
217//  dispatch_postload - invoke all registered
218//  postload callbacks for updates
219//-------------------------------------------------
220216
221
222void save_manager::dispatch_postload()
223{
224   for (state_callback *func = m_postload_list.first(); func != NULL; func = func->next())
225      func->m_func();
226}
227
228217//-------------------------------------------------
229218//  read_file - read the data from a file
230219//-------------------------------------------------
r242997r242998
264253   }
265254
266255   // call the post-load functions
267   dispatch_postload();
256   for (state_callback *func = m_postload_list.first(); func != NULL; func = func->next())
257      func->m_func();
268258
269259   return STATERR_NONE;
270260}
271261
272//-------------------------------------------------
273//  dispatch_presave - invoke all registered
274//  presave callbacks for updates
275//-------------------------------------------------
276262
277
278void save_manager::dispatch_presave()
279{
280   for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next())
281      func->m_func();
282}
283
284263//-------------------------------------------------
285264//  write_file - writes the data to a file
286265//-------------------------------------------------
r242997r242998
308287   file.compress(FCOMPRESS_MEDIUM);
309288
310289   // call the pre-save functions
311   dispatch_presave();
290   for (state_callback *func = m_presave_list.first(); func != NULL; func = func->next())
291      func->m_func();
312292
313293   // then write all the data
314294   for (state_entry *entry = m_entry_list.first(); entry != NULL; entry = entry->next())
trunk/src/emu/save.h
r242997r242998
9999   void register_presave(save_prepost_delegate func);
100100   void register_postload(save_prepost_delegate func);
101101
102   // callback dispatching
103   void dispatch_presave();
104   void dispatch_postload();
105
106102   // generic memory registration
107103   void save_memory(const char *module, const char *tag, UINT32 index, const char *name, void *val, UINT32 valsize, UINT32 valcount = 1);
108104
trunk/src/mame/drivers/mappy.c
r242997r242998
24622462
24632463/* 3x6809, static tilemap, 2bpp sprites (Gaplus type) */
24642464GAME( 1983, phozon,   0,        phozon,   phozon, mappy_state,   phozon,        ROT90, "Namco", "Phozon (Japan)", GAME_SUPPORTS_SAVE )
2465GAME( 1983, phozons,  phozon,   phozon,   phozon, mappy_state,   phozon,        ROT90, "bootleg? (Sidam)", "Phozon (Sidam)", GAME_SUPPORTS_SAVE )
2465GAME( 1983, phozons,  phozon,   phozon,   phozon, mappy_state,   phozon,        ROT90, "Namco (Sidam license)", "Phozon (Sidam)", GAME_SUPPORTS_SAVE )
24662466
24672467/* 2x6809, scroling tilemap, 4bpp sprites (Super Pacman type) */
24682468GAME( 1983, mappy,    0,        mappy,    mappy, mappy_state,   mappy,        ROT90, "Namco", "Mappy (US)", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/nl_pongd.c
r242997r242998
6565 *
6666 */
6767
68// identify unknown devices in IDE
6968
70//#define NETLIST_DEVELOPMENT 1
71
7269#include "netlist/nl_dice_compat.h"
7370#include "netlist/devices/net_lib.h"
7471#include "netlist/analog/nld_twoterm.h"
trunk/src/mess/drivers/elecdet.c
r242997r242998
297297
298298ROM_START( elecdet )
299299   ROM_REGION( 0x1000, "maincpu", 0 )
300   ROM_LOAD( "tms0980nll_mp6100a", 0x0000, 0x1000, CRC(6f396bb8) SHA1(1f104d4ca9bee0d4572be4779b7551dfe20c4f04) )
300   ROM_LOAD( "tms0980nll_mp6100a", 0x0000, 0x1000, CRC(8160a081) SHA1(14cbfc0529ad83a58e0dc15fe8ba594947e49f08) )
301301
302302   ROM_REGION( 1246, "maincpu:ipla", 0 )
303303   ROM_LOAD( "tms0980_default_ipla.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) )
trunk/src/mess/drivers/ngen.c
r242997r242998
6767#include "machine/pit8253.h"
6868#include "machine/z80dart.h"
6969#include "machine/wd_fdc.h"
70#include "machine/wd2010.h"
7170#include "bus/rs232/rs232.h"
7271#include "machine/ngen_kb.h"
7372#include "machine/clock.h"
74#include "imagedev/harddriv.h"
7573
7674class ngen_state : public driver_device
7775{
r242997r242998
9189      m_fdc(*this,"fdc"),
9290      m_fd0(*this,"fdc:0"),
9391      m_fdc_timer(*this,"fdc_timer"),
94      m_hdc(*this,"hdc"),
95      m_hdc_timer(*this,"hdc_timer"),
96      m_hd_buffer(*this,"hd_buffer_ram")
92      m_hdc_timer(*this,"hdc_timer")
9793   {}
9894
9995   DECLARE_WRITE_LINE_MEMBER(pit_out0_w);
r242997r242998
133129   DECLARE_READ8_MEMBER(irq_cb);
134130   DECLARE_WRITE8_MEMBER(hdc_control_w);
135131   DECLARE_WRITE8_MEMBER(disk_addr_ext);
136   DECLARE_READ8_MEMBER(hd_buffer_r);
137   DECLARE_WRITE8_MEMBER(hd_buffer_w);
138132
139133protected:
140134   virtual void machine_reset();
141   virtual void machine_start();
142135
143136private:
144137   required_device<i80186_cpu_device> m_maincpu;
r242997r242998
154147   optional_device<wd2797_t> m_fdc;
155148   optional_device<floppy_connector> m_fd0;
156149   optional_device<pit8253_device> m_fdc_timer;
157   optional_device<wd2010_device> m_hdc;
158150   optional_device<pit8253_device> m_hdc_timer;
159   optional_shared_ptr<UINT8> m_hd_buffer;
160151
161152   void set_dma_channel(int channel, int state);
162153
r242997r242998
479470      case 0x0a:
480471      case 0x0b:
481472         if(mem_mask & 0x00ff)
482            m_fdc_timer->write(space,offset-0x08,data & 0xff);
473            m_fdc_timer->write(space,offset,data & 0xff);
483474         break;
484475      case 0x10:
485476      case 0x11:
r242997r242998
489480      case 0x15:
490481      case 0x16:
491482      case 0x17:
492         if(mem_mask & 0x00ff)
493            m_hdc->write(space,offset-0x10,data & 0xff);
494483         logerror("WD1010 register %i write %02x mask %04x\n",offset-0x10,data & 0xff,mem_mask);
495484         break;
496485      case 0x18:
r242997r242998
498487      case 0x1a:
499488      case 0x1b:
500489         if(mem_mask & 0x00ff)
501            m_hdc_timer->write(space,offset-0x18,data & 0xff);
490            m_hdc_timer->write(space,offset,data & 0xff);
502491         break;
503492   }
504493}
r242997r242998
521510      case 0x0a:
522511      case 0x0b:
523512         if(mem_mask & 0x00ff)
524            ret = m_fdc_timer->read(space,offset-0x08);
513            ret = m_fdc_timer->read(space,offset);
525514         break;
526515      case 0x10:
527516      case 0x11:
r242997r242998
531520      case 0x15:
532521      case 0x16:
533522      case 0x17:
534         if(mem_mask & 0x00ff)
535            ret = m_hdc->read(space,offset-0x10);
536523         logerror("WD1010 register %i read, mask %04x\n",offset-0x10,mem_mask);
537524         break;
538525      case 0x18:
r242997r242998
540527      case 0x1a:
541528      case 0x1b:
542529         if(mem_mask & 0x00ff)
543            ret = m_hdc_timer->read(space,offset-0x18);
530            ret = m_hdc_timer->read(space,offset);
544531         break;
545532   }
546533
r242997r242998
598585   m_disk_page = data & 0x7f;
599586}
600587
601READ8_MEMBER(ngen_state::hd_buffer_r)
602{
603   return m_hd_buffer[offset];
604}
605
606WRITE8_MEMBER(ngen_state::hd_buffer_w)
607{
608   m_hd_buffer[offset] = data;
609}
610
611588WRITE_LINE_MEMBER( ngen_state::dma_hrq_changed )
612589{
613590   m_maincpu->set_input_line(INPUT_LINE_HALT, state ? ASSERT_LINE : CLEAR_LINE);
r242997r242998
626603   {
627604      if(state)
628605      {
629         if(m_hdc_control & 0x04) // ROM transfer
606         if(m_hdc_control & 0x04) // ROM transfer?
630607            m_hdc_control &= ~0x04;  // switch it off when done
631608      }
632609   }
r242997r242998
712689   return m_pic->acknowledge();
713690}
714691
715void ngen_state::machine_start()
716{
717   m_hd_buffer.allocate(1024*8);  // 8kB buffer RAM for HD controller
718}
719
720692void ngen_state::machine_reset()
721693{
722694   m_port00 = 0;
r242997r242998
865837   MCFG_WD_FDC_DRQ_CALLBACK(DEVWRITELINE("maincpu",i80186_cpu_device,drq1_w))
866838   MCFG_WD_FDC_FORCE_READY
867839   MCFG_DEVICE_ADD("fdc_timer", PIT8253, 0)
868   MCFG_PIT8253_CLK0(XTAL_20MHz / 20) 
869   MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))  // clocked on FDC data register access
840   MCFG_PIT8253_CLK0(XTAL_20MHz / 20)
841   MCFG_PIT8253_OUT0_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))
870842   MCFG_PIT8253_CLK1(XTAL_20MHz / 20)
871   MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))  // 1MHz
872   MCFG_PIT8253_CLK2(XTAL_20MHz / 10)
873   MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w)) 
874   // TODO: WD1010 HDC (not implemented), use WD2010 for now
875   MCFG_DEVICE_ADD("hdc", WD2010, XTAL_20MHz / 4)
876   MCFG_WD2010_IN_BCS_CB(READ8(ngen_state,hd_buffer_r))
877   MCFG_WD2010_OUT_BCS_CB(WRITE8(ngen_state,hd_buffer_w))
878   MCFG_WD2010_IN_DRDY_CB(VCC)
879   MCFG_WD2010_IN_INDEX_CB(VCC)
880   MCFG_WD2010_IN_WF_CB(VCC)
881   MCFG_WD2010_IN_TK000_CB(VCC)
882   MCFG_WD2010_IN_SC_CB(VCC)
843   MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))
844   MCFG_PIT8253_CLK2(XTAL_20MHz / 20)
845   MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("pic",pic8259_device,ir7_w))
846   // TODO: WD1010 HDC (not implemented)
883847   MCFG_DEVICE_ADD("hdc_timer", PIT8253, 0)
884   MCFG_PIT8253_CLK2(XTAL_20MHz / 10)  // 2MHz
885848   MCFG_FLOPPY_DRIVE_ADD("fdc:0", ngen_floppies, "525qd", floppy_image_device::default_floppy_formats)
886   MCFG_HARDDISK_ADD("hard0")
887849
888850MACHINE_CONFIG_END
889851
trunk/src/mess/drivers/splitsec.c
r242997r242998
44
55  Parker Brothers Split Second
66  * TMS1400NLL MP7314-N2 (die labeled MP7314)
7 
8  This is an electronic handheld reflex gaming device, it's straightforward
9  to use. The included mini-games are:
10  1, 2, 3: Mad Maze*
11  4, 5: Space Attack*
12  6: Auto Cross
13  7: Stomp
14  8: Speedball
15 
16  *: higher number indicates harder difficulty
177
188
19  TODO:
20  - MCU clock is unknown
21
229***************************************************************************/
2310
2411#include "emu.h"
r242997r242998
2714
2815#include "splitsec.lh"
2916
30// The master clock is a single stage RC oscillator: R=24K, C=100pf,
31// according to the TMS 1000 series data manual this is around 375kHz.
32// However, this sounds too low-pitched and runs too slow when compared
33// to recordings, maybe the RC osc curve is different for TMS1400?
17// master clock is a single stage RC oscillator: R=24K, C=100pf,
18// according to the TMS 1000 series data manual this is around 375kHz
19#define MASTER_CLOCK (375000)
3420
35// so for now, the value below is an approximation
36#define MASTER_CLOCK (485000)
3721
38
3922class splitsec_state : public driver_device
4023{
4124public:
r242997r242998
177160
178161static INPUT_PORTS_START( splitsec )
179162   PORT_START("IN.0") // R9
180   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY
181   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_16WAY
182   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY
163   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
164   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
165   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
183166   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
184167
185168   PORT_START("IN.1") // R10
186   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_16WAY
169   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
187170   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Select")
188171   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Start")
189172   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
r242997r242998
247230
248231ROM_START( splitsec )
249232   ROM_REGION( 0x1000, "maincpu", 0 )
250   ROM_LOAD( "tms1400nll_mp7314", 0x0000, 0x1000, CRC(e94b2098) SHA1(f0fc1f56a829252185592a2508740354c50bedf8) )
233   ROM_LOAD( "tms1400nll_mp7314", 0x0000, 0x1000, CRC(0cccdf59) SHA1(06a533134a433aaf856b80f0ca239d0498b98d5f) )
251234
252235   ROM_REGION( 867, "maincpu:mpla", 0 )
253236   ROM_LOAD( "tms1100_default_mpla.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) )
r242997r242998
256239ROM_END
257240
258241
259CONS( 1980, splitsec, 0, 0, splitsec, splitsec, driver_device, 0, "Parker Brothers", "Split Second", GAME_SUPPORTS_SAVE )
242CONS( 1980, splitsec, 0, 0, splitsec, splitsec, driver_device, 0, "Parker Brothers", "Split Second", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
trunk/src/mess/layout/splitsec.lay
r242997r242998
2525
2626   <!-- maze of lamps -->
2727
28      <bezel name="lamp0" element="lamp_rect"><bounds x="2" y="1" width="4" height="1" /></bezel>
29      <bezel name="lamp2" element="lamp_rect"><bounds x="7" y="1" width="4" height="1" /></bezel>
30      <bezel name="lamp4" element="lamp_rect"><bounds x="12" y="1" width="4" height="1" /></bezel>
28      <bezel name="lamp6" element="lamp_rect"><bounds x="2" y="1" width="4" height="1" /></bezel>
29      <bezel name="lamp4" element="lamp_rect"><bounds x="7" y="1" width="4" height="1" /></bezel>
30      <bezel name="lamp2" element="lamp_rect"><bounds x="12" y="1" width="4" height="1" /></bezel>
3131
32      <bezel name="lamp10" element="lamp_rect"><bounds x="1" y="2" width="1" height="4" /></bezel>
33      <bezel name="lamp1" element="lamp_disk"><bounds x="3" y="3" width="2" height="2" /></bezel>
34      <bezel name="lamp12" element="lamp_rect"><bounds x="6" y="2" width="1" height="4" /></bezel>
32      <bezel name="lamp16" element="lamp_rect"><bounds x="1" y="2" width="1" height="4" /></bezel>
33      <bezel name="lamp5" element="lamp_disk"><bounds x="3" y="3" width="2" height="2" /></bezel>
34      <bezel name="lamp14" element="lamp_rect"><bounds x="6" y="2" width="1" height="4" /></bezel>
3535      <bezel name="lamp3" element="lamp_disk"><bounds x="8" y="3" width="2" height="2" /></bezel>
36      <bezel name="lamp14" element="lamp_rect"><bounds x="11" y="2" width="1" height="4" /></bezel>
37      <bezel name="lamp5" element="lamp_disk"><bounds x="13" y="3" width="2" height="2" /></bezel>
38      <bezel name="lamp16" element="lamp_rect"><bounds x="16" y="2" width="1" height="4" /></bezel>
36      <bezel name="lamp12" element="lamp_rect"><bounds x="11" y="2" width="1" height="4" /></bezel>
37      <bezel name="lamp1" element="lamp_disk"><bounds x="13" y="3" width="2" height="2" /></bezel>
38      <bezel name="lamp10" element="lamp_rect"><bounds x="16" y="2" width="1" height="4" /></bezel>
3939
40      <bezel name="lamp11" element="lamp_rect"><bounds x="2" y="6" width="4" height="1" /></bezel>
40      <bezel name="lamp15" element="lamp_rect"><bounds x="2" y="6" width="4" height="1" /></bezel>
4141      <bezel name="lamp13" element="lamp_rect"><bounds x="7" y="6" width="4" height="1" /></bezel>
42      <bezel name="lamp15" element="lamp_rect"><bounds x="12" y="6" width="4" height="1" /></bezel>
42      <bezel name="lamp11" element="lamp_rect"><bounds x="12" y="6" width="4" height="1" /></bezel>
4343
44      <bezel name="lamp20" element="lamp_rect"><bounds x="1" y="7" width="1" height="4" /></bezel>
45      <bezel name="lamp21" element="lamp_disk"><bounds x="3" y="8" width="2" height="2" /></bezel>
46      <bezel name="lamp22" element="lamp_rect"><bounds x="6" y="7" width="1" height="4" /></bezel>
44      <bezel name="lamp26" element="lamp_rect"><bounds x="1" y="7" width="1" height="4" /></bezel>
45      <bezel name="lamp25" element="lamp_disk"><bounds x="3" y="8" width="2" height="2" /></bezel>
46      <bezel name="lamp24" element="lamp_rect"><bounds x="6" y="7" width="1" height="4" /></bezel>
4747      <bezel name="lamp23" element="lamp_disk"><bounds x="8" y="8" width="2" height="2" /></bezel>
48      <bezel name="lamp24" element="lamp_rect"><bounds x="11" y="7" width="1" height="4" /></bezel>
49      <bezel name="lamp25" element="lamp_disk"><bounds x="13" y="8" width="2" height="2" /></bezel>
50      <bezel name="lamp26" element="lamp_rect"><bounds x="16" y="7" width="1" height="4" /></bezel>
48      <bezel name="lamp22" element="lamp_rect"><bounds x="11" y="7" width="1" height="4" /></bezel>
49      <bezel name="lamp21" element="lamp_disk"><bounds x="13" y="8" width="2" height="2" /></bezel>
50      <bezel name="lamp20" element="lamp_rect"><bounds x="16" y="7" width="1" height="4" /></bezel>
5151
52      <bezel name="lamp31" element="lamp_rect"><bounds x="2" y="11" width="4" height="1" /></bezel>
52      <bezel name="lamp35" element="lamp_rect"><bounds x="2" y="11" width="4" height="1" /></bezel>
5353      <bezel name="lamp33" element="lamp_rect"><bounds x="7" y="11" width="4" height="1" /></bezel>
54      <bezel name="lamp35" element="lamp_rect"><bounds x="12" y="11" width="4" height="1" /></bezel>
54      <bezel name="lamp31" element="lamp_rect"><bounds x="12" y="11" width="4" height="1" /></bezel>
5555
56      <bezel name="lamp30" element="lamp_rect"><bounds x="1" y="12" width="1" height="4" /></bezel>
57      <bezel name="lamp41" element="lamp_disk"><bounds x="3" y="13" width="2" height="2" /></bezel>
58      <bezel name="lamp32" element="lamp_rect"><bounds x="6" y="12" width="1" height="4" /></bezel>
56      <bezel name="lamp36" element="lamp_rect"><bounds x="1" y="12" width="1" height="4" /></bezel>
57      <bezel name="lamp45" element="lamp_disk"><bounds x="3" y="13" width="2" height="2" /></bezel>
58      <bezel name="lamp34" element="lamp_rect"><bounds x="6" y="12" width="1" height="4" /></bezel>
5959      <bezel name="lamp43" element="lamp_disk"><bounds x="8" y="13" width="2" height="2" /></bezel>
60      <bezel name="lamp34" element="lamp_rect"><bounds x="11" y="12" width="1" height="4" /></bezel>
61      <bezel name="lamp45" element="lamp_disk"><bounds x="13" y="13" width="2" height="2" /></bezel>
62      <bezel name="lamp36" element="lamp_rect"><bounds x="16" y="12" width="1" height="4" /></bezel>
60      <bezel name="lamp32" element="lamp_rect"><bounds x="11" y="12" width="1" height="4" /></bezel>
61      <bezel name="lamp41" element="lamp_disk"><bounds x="13" y="13" width="2" height="2" /></bezel>
62      <bezel name="lamp30" element="lamp_rect"><bounds x="16" y="12" width="1" height="4" /></bezel>
6363
64      <bezel name="lamp51" element="lamp_rect"><bounds x="2" y="16" width="4" height="1" /></bezel>
64      <bezel name="lamp55" element="lamp_rect"><bounds x="2" y="16" width="4" height="1" /></bezel>
6565      <bezel name="lamp53" element="lamp_rect"><bounds x="7" y="16" width="4" height="1" /></bezel>
66      <bezel name="lamp55" element="lamp_rect"><bounds x="12" y="16" width="4" height="1" /></bezel>
66      <bezel name="lamp51" element="lamp_rect"><bounds x="12" y="16" width="4" height="1" /></bezel>
6767
68      <bezel name="lamp40" element="lamp_rect"><bounds x="1" y="17" width="1" height="4" /></bezel>
69      <bezel name="lamp61" element="lamp_disk"><bounds x="3" y="18" width="2" height="2" /></bezel>
70      <bezel name="lamp42" element="lamp_rect"><bounds x="6" y="17" width="1" height="4" /></bezel>
68      <bezel name="lamp46" element="lamp_rect"><bounds x="1" y="17" width="1" height="4" /></bezel>
69      <bezel name="lamp65" element="lamp_disk"><bounds x="3" y="18" width="2" height="2" /></bezel>
70      <bezel name="lamp44" element="lamp_rect"><bounds x="6" y="17" width="1" height="4" /></bezel>
7171      <bezel name="lamp63" element="lamp_disk"><bounds x="8" y="18" width="2" height="2" /></bezel>
72      <bezel name="lamp44" element="lamp_rect"><bounds x="11" y="17" width="1" height="4" /></bezel>
73      <bezel name="lamp65" element="lamp_disk"><bounds x="13" y="18" width="2" height="2" /></bezel>
74      <bezel name="lamp46" element="lamp_rect"><bounds x="16" y="17" width="1" height="4" /></bezel>
72      <bezel name="lamp42" element="lamp_rect"><bounds x="11" y="17" width="1" height="4" /></bezel>
73      <bezel name="lamp61" element="lamp_disk"><bounds x="13" y="18" width="2" height="2" /></bezel>
74      <bezel name="lamp40" element="lamp_rect"><bounds x="16" y="17" width="1" height="4" /></bezel>
7575
76      <bezel name="lamp71" element="lamp_rect"><bounds x="2" y="21" width="4" height="1" /></bezel>
76      <bezel name="lamp75" element="lamp_rect"><bounds x="2" y="21" width="4" height="1" /></bezel>
7777      <bezel name="lamp73" element="lamp_rect"><bounds x="7" y="21" width="4" height="1" /></bezel>
78      <bezel name="lamp75" element="lamp_rect"><bounds x="12" y="21" width="4" height="1" /></bezel>
78      <bezel name="lamp71" element="lamp_rect"><bounds x="12" y="21" width="4" height="1" /></bezel>
7979
80      <bezel name="lamp50" element="lamp_rect"><bounds x="1" y="22" width="1" height="4" /></bezel>
81      <bezel name="lamp60" element="lamp_disk"><bounds x="3" y="23" width="2" height="2" /></bezel>
82      <bezel name="lamp52" element="lamp_rect"><bounds x="6" y="22" width="1" height="4" /></bezel>
83      <bezel name="lamp62" element="lamp_disk"><bounds x="8" y="23" width="2" height="2" /></bezel>
84      <bezel name="lamp54" element="lamp_rect"><bounds x="11" y="22" width="1" height="4" /></bezel>
85      <bezel name="lamp64" element="lamp_disk"><bounds x="13" y="23" width="2" height="2" /></bezel>
86      <bezel name="lamp56" element="lamp_rect"><bounds x="16" y="22" width="1" height="4" /></bezel>
80      <bezel name="lamp56" element="lamp_rect"><bounds x="1" y="22" width="1" height="4" /></bezel>
81      <bezel name="lamp66" element="lamp_disk"><bounds x="3" y="23" width="2" height="2" /></bezel>
82      <bezel name="lamp54" element="lamp_rect"><bounds x="6" y="22" width="1" height="4" /></bezel>
83      <bezel name="lamp64" element="lamp_disk"><bounds x="8" y="23" width="2" height="2" /></bezel>
84      <bezel name="lamp52" element="lamp_rect"><bounds x="11" y="22" width="1" height="4" /></bezel>
85      <bezel name="lamp62" element="lamp_disk"><bounds x="13" y="23" width="2" height="2" /></bezel>
86      <bezel name="lamp50" element="lamp_rect"><bounds x="16" y="22" width="1" height="4" /></bezel>
8787
88      <bezel name="lamp70" element="lamp_rect"><bounds x="2" y="26" width="4" height="1" /></bezel>
89      <bezel name="lamp72" element="lamp_rect"><bounds x="7" y="26" width="4" height="1" /></bezel>
90      <bezel name="lamp74" element="lamp_rect"><bounds x="12" y="26" width="4" height="1" /></bezel>
88      <bezel name="lamp76" element="lamp_rect"><bounds x="2" y="26" width="4" height="1" /></bezel>
89      <bezel name="lamp74" element="lamp_rect"><bounds x="7" y="26" width="4" height="1" /></bezel>
90      <bezel name="lamp72" element="lamp_rect"><bounds x="12" y="26" width="4" height="1" /></bezel>
9191
9292   </view>
9393</mamelayout>
trunk/src/osd/sdl/man/castool.1
r242997r242998
66.\" Cesare Falco <c.falco@ubuntu.com>, February 2011
77.\"
88.\"
9.TH CASTOOL 1 2015-01-18 0.158 "MESS Generic cassette manipulation tool"
9.TH CASTOOL 1 2014-12-15 0.157 "MESS Generic cassette manipulation tool"
1010.\"
1111.\"
1212.\" NAME chapter
trunk/src/osd/sdl/man/chdman.1
r242997r242998
66.\" Ashley T. Howes <debiandev@ashleyhowes.com>, February 2005
77.\" updated by Cesare Falco <c.falco@ubuntu.com>, February 2007
88.\"
9.TH CHDMAN 1 2015-01-18 0.158 "MAME Compressed Hunks of Data (CHD) manager"
9.TH CHDMAN 1 2014-12-15 0.157 "MAME Compressed Hunks of Data (CHD) manager"
1010.\"
1111.\" NAME chapter
1212.SH NAME
trunk/src/osd/sdl/man/floptool.1
r242997r242998
66.\" Cesare Falco <c.falco@ubuntu.com>, April 2014
77.\"
88.\"
9.TH FLOPTOOL 1 2015-01-18 0.158 "MESS Generic floppy manipulation tool"
9.TH FLOPTOOL 1 2014-12-15 0.157 "MESS Generic floppy manipulation tool"
1010.\"
1111.\"
1212.\" NAME chapter
trunk/src/osd/sdl/man/imgtool.1
r242997r242998
66.\" Cesare Falco <c.falco@ubuntu.com>, February 2011
77.\"
88.\"
9.TH IMGTOOL 1 2015-01-18 0.158 "MESS media image manipulation tool"
9.TH IMGTOOL 1 2014-12-15 0.157 "MESS media image manipulation tool"
1010.\"
1111.\"
1212.\" NAME chapter
trunk/src/osd/sdl/man/jedutil.1
r242997r242998
88.\" References
99.\" http://aarongiles.com/?p=159
1010.\"
11.TH JEDUTIL 1 2015-01-18 0.158 "MAME JEDEC file utilities"
11.TH JEDUTIL 1 2014-12-15 0.157 "MAME JEDEC file utilities"
1212.\"
1313.\" NAME chapter
1414.SH NAME
trunk/src/osd/sdl/man/ldresample.1
r242997r242998
33.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
44.\" other parameters are allowed: see man(7), man(1)
55.\"
6.TH LDRESAMPLE 1 2015-01-18 0.158 "MAME laserdisc audio manipulation tool"
6.TH LDRESAMPLE 1 2014-12-15 0.157 "MAME laserdisc audio manipulation tool"
77.\"
88.\" Please adjust this date whenever revising the manpage.
99.\"
trunk/src/osd/sdl/man/ldverify.1
r242997r242998
55.\" Man page created from source and usage information by
66.\" Cesare Falco <c.falco@ubuntu.com>, August 2008
77.\"
8.TH LDVERIFY 1 2015-01-18 0.158 "MAME laserdisc data checker"
8.TH LDVERIFY 1 2014-12-15 0.157 "MAME laserdisc data checker"
99.\"
1010.\" NAME chapter
1111.SH NAME
trunk/src/osd/sdl/man/mame.6
r242997r242998
1313.\" and updated by Andrew Burton <burtona@gol.com>, July 2003
1414.\"
1515.\"
16.TH MAME 6 2015-01-18 0.158 "MAME \- The Multiple Arcade Machine Emulator"
16.TH MAME 6 2014-12-15 0.157 "MAME \- The Multiple Arcade Machine Emulator"
1717.\"
1818.\"
1919.\" NAME chapter
trunk/src/osd/sdl/man/mess.6
r242997r242998
1616.\" http://www.mess.org/
1717.\"
1818.\"
19.TH MESS 6 2015-01-18 0.158 "The Multiple Emulator Super System (MESS)"
19.TH MESS 6 2014-12-15 0.157 "The Multiple Emulator Super System (MESS)"
2020.\"
2121.\"
2222.\" NAME chapter
trunk/src/osd/sdl/man/romcmp.1
r242997r242998
99.\" References
1010.\" http://www.mame.net/mamefaq.html
1111.\"
12.TH ROMCMP 1 2015-01-18 0.158 "MAME romset checking tool"
12.TH ROMCMP 1 2014-12-15 0.157 "MAME romset checking tool"
1313.\"
1414.\" NAME chapter
1515.SH NAME
trunk/src/osd/sdl/man/testkeys.1
r242997r242998
55.\" Man page created from source and usage information
66.\" Cesare Falco <c.falco@ubuntu.com>, February 2007
77.\"
8.TH TESTKEYS 1 2015-01-18 0.158 "MAME SDL keycode scanner"
8.TH TESTKEYS 1 2014-12-15 0.157 "MAME SDL keycode scanner"
99.\"
1010.\" NAME chapter
1111.SH NAME
trunk/src/osd/sdl/sdlmain.c
r242997r242998
3131#include <unistd.h>
3232#endif
3333
34// only for strconv.h
35#if defined(SDLMAME_WIN32)
36#define WIN32_LEAN_AND_MEAN
37#include <windows.h>
38#endif
39
40
4134#ifdef SDLMAME_OS2
4235#define INCL_DOS
4336#include <os2.h>
r242997r242998
5447#include "emu.h"
5548#include "clifront.h"
5649#include "emuopts.h"
57#include "strconv.h"
5850
5951// OSD headers
6052#include "video.h"
r242997r242998
12111203   return result;
12121204}
12131205
1214osd_font *sdl_osd_interface::font_open(const char *_name, int &height)
1206osd_font sdl_osd_interface::font_open(const char *_name, int &height)
12151207{
12161208   // accept qualifiers from the name
12171209   astring name(_name);
r242997r242998
12361228   logfont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
12371229
12381230   // copy in the face name
1239   TCHAR *face = tstring_from_utf8(name);
1240   _tcsncpy(logfont.lfFaceName, face, sizeof(logfont.lfFaceName) / sizeof(TCHAR));
1231   TCHAR *face = wstring_from_utf8(name);
1232   wcsncpy(logfont.lfFaceName, face, sizeof(logfont.lfFaceName) / sizeof(TCHAR));
12411233   logfont.lfFaceName[sizeof(logfont.lfFaceName) / sizeof(TCHAR)-1] = 0;
12421234   osd_free(face);
12431235
12441236   // create the font
12451237   height = logfont.lfHeight;
1246   osd_font *font = reinterpret_cast<osd_font *>(CreateFontIndirect(&logfont));
1238   osd_font font = reinterpret_cast<osd_font>(CreateFontIndirect(&logfont));
12471239   if (font == NULL)
12481240      return NULL;
12491241
r242997r242998
12561248   DeleteDC(dummyDC);
12571249
12581250   // if it doesn't match our request, fail
1259   char *utf = utf8_from_tstring(realname);
1251   char *utf = utf8_from_wstring(realname);
12601252   int result = core_stricmp(utf, name);
12611253   osd_free(utf);
12621254
r242997r242998
12751267//  a given OSD font
12761268//-------------------------------------------------
12771269
1278void sdl_osd_interface::font_close(osd_font *font)
1270void sdl_osd_interface::font_close(osd_font font)
12791271{
12801272   // delete the font ojbect
12811273   if (font != NULL)
r242997r242998
12911283//  pixel of a black & white font
12921284//-------------------------------------------------
12931285
1294bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
1286bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
12951287{
12961288   // create a dummy DC to work with
12971289   HDC dummyDC = CreateCompatibleDC(NULL);
r242997r242998
14331425//  font with the given name
14341426//-------------------------------------------------
14351427
1436osd_font *sdl_osd_interface::font_open(const char *_name, int &height)
1428osd_font sdl_osd_interface::font_open(const char *_name, int &height)
14371429{
1438   return (osd_font *)NULL;
1430   return (osd_font)NULL;
14391431}
14401432
14411433//-------------------------------------------------
r242997r242998
14431435//  a given OSD font
14441436//-------------------------------------------------
14451437
1446void sdl_osd_interface::font_close(osd_font *font)
1438void sdl_osd_interface::font_close(osd_font font)
14471439{
14481440}
14491441
r242997r242998
14551447//  pixel of a black & white font
14561448//-------------------------------------------------
14571449
1458bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
1450bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
14591451{
14601452   return false;
14611453}
trunk/src/osd/sdl/strconv.h
r242997r242998
1// license:BSD-3-Clause
2// copyright-holders:Aaron Giles
31//============================================================
42//
5//  strconv.h - String conversion
3//  strconv.h - SDL string conversion
64//
75//  Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
86//  Visit http://mamedev.org for licensing and usage restrictions.
97//
108//============================================================
119
12#ifndef __OSD_STRCONV__
13#define __OSD_STRCONV__
10#ifndef __SDLSTRCONV__
11#define __SDLSTRCONV__
1412
1513#include "osdcore.h"
1614
r242997r242998
2018//  FUNCTION PROTOTYPES
2119//============================================================
2220
23#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
21#ifdef SDLMAME_WIN32
2422
25#define WIN32_LEAN_AND_MEAN
26#include <windows.h>
2723// the result of these functions has to be released with osd_free()
2824
2925CHAR *astring_from_utf8(const char *s);
r242997r242998
4036#define utf8_from_tstring   utf8_from_astring
4137#endif // UNICODE
4238
43#if defined(SDLMAME_WIN32)
44#define _tcsncpy wcsncpy
45#endif
46
4739#endif //SDLMAME_WIN32
4840
49
50#endif // __OSD_STRCONV__
41#endif // __SDLSTRCONV__
trunk/src/osd/windows/strconv.h
r242997r242998
22// copyright-holders:Aaron Giles
33//============================================================
44//
5//  strconv.h - String conversion
5//  strconv.h - Win32 string conversion
66//
7//  Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team.
8//  Visit http://mamedev.org for licensing and usage restrictions.
9//
107//============================================================
118
12#ifndef __OSD_STRCONV__
13#define __OSD_STRCONV__
9#ifndef __WIN_STRCONV__
10#define __WIN_STRCONV__
1411
1512#include "osdcore.h"
1613
r242997r242998
2017//  FUNCTION PROTOTYPES
2118//============================================================
2219
23#if defined(SDLMAME_WIN32) || defined(OSD_WINDOWS)
24
2520// the result of these functions has to be released with osd_free()
2621
2722CHAR *astring_from_utf8(const char *s);
r242997r242998
3833#define utf8_from_tstring   utf8_from_astring
3934#endif // UNICODE
4035
41#endif //SDLMAME_WIN32
4236
4337
44#endif // __OSD_STRCONV__
38#endif // __WIN_STRCONV__
trunk/src/tools/nltool.c
r242997r242998
1818#include "netlist/nl_base.h"
1919#include "netlist/nl_setup.h"
2020#include "netlist/nl_parser.h"
21#include "netlist/nl_factory.h"
2221#include "netlist/nl_util.h"
23#include "netlist/devices/net_lib.h"
2422#include "options.h"
2523
2624/***************************************************************************
27 * MAME COMPATIBILITY ...
28 *
29 * These are needed if we link without libutil
30 ***************************************************************************/
25    MAME COMPATIBILITY ...
26***************************************************************************/
3127
3228#if 0
3329void ATTR_PRINTF(1,2) osd_printf_warning(const char *format, ...)
r242997r242998
3935   vprintf(format, argptr);
4036   va_end(argptr);
4137}
38#endif
4239
4340void *malloc_file_line(size_t size, const char *file, int line)
4441{
r242997r242998
7572         src_type.name(), dst_type.name());
7673   throw;
7774}
78#endif
7975
8076struct options_entry oplist[] =
8177{
r242997r242998
8783   { NULL }
8884};
8985
90NETLIST_START(dummy)
91    /* Standard stuff */
92
93    CLOCK(clk, 1000) // 1000 Hz
94    SOLVER(Solver, 48000)
95
96NETLIST_END()
97
9886/***************************************************************************
9987    CORE IMPLEMENTATION
10088***************************************************************************/
r242997r242998
172160      nl_util::pstring_list ll = nl_util::split(m_logs, ":");
173161      for (int i=0; i < ll.count(); i++)
174162      {
175            pstring name = "log_" + ll[i];
176         netlist_device_t *nc = m_setup->register_dev("nld_log", name);
163         netlist_device_t *nc = m_setup->factory().new_device_by_classname("nld_log", *m_setup);
164         pstring name = "log_" + ll[i];
165         m_setup->register_dev(nc, name);
177166         m_setup->register_link(name + ".I", ll[i]);
178167      }
179168   }
r242997r242998
241230   nt.init();
242231   const netlist_factory_t::list_t &list = nt.setup().factory().list();
243232
244    netlist_sources_t sources;
245
246    sources.add(netlist_source_t("dummy", &netlist_dummy));
247    sources.parse(nt.setup(),"dummy");
248
249233   nt.setup().start_devices();
250234   nt.setup().resolve_inputs();
251235


Previous 199869 Revisions Next


© 1997-2024 The MAME Team