Previous 199869 Revisions Next

r34479 Sunday 18th January, 2015 at 18:26:45 UTC by Cesare Falco
*nix: Bump version and date in man pages.
[src/emu]clifront.c clifront.h distate.c distate.h emu.mak emuopts.h image.c image.h ioport.c luaengine.c luaengine.h machine.c machine.h mame.c mame.h render.h rendfont.c rendfont.h rendutil.h save.c save.h video.c webengine.c
[src/emu/cpu/tms0980]tms0980.c tms0980.h
[src/emu/machine]netlist.c
[src/emu/netlist]netlist.mak nl_base.c nl_base.h nl_config.h nl_dice_compat.h nl_factory.c nl_factory.h nl_lists.h nl_parser.c nl_parser.h nl_setup.c nl_setup.h plists.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]net_lib.c net_lib.h nld_4020.c nld_4066.c nld_74107.c nld_74123.c nld_74153.c nld_7448.c nld_7474.c nld_7483.c nld_7490.c nld_7493.c nld_74ls629.c nld_9316.c nld_cmos.h nld_ne555.c nld_ne555.h nld_r2r_dac.c nld_signal.h nld_system.c nld_system.h nld_truthtable.h
[src/emu/sound]rf5c400.c rf5c400.h
[src/emu/ui]filemngr.c filemngr.h imgcntrl.c imgcntrl.h imginfo.c* imginfo.h* info.c info.h mainmenu.c miscmenu.c miscmenu.h selgame.c slotopt.c ui.c
[src/lib]lib.mak
[src/lib/util]corefile.h options.h
[src/mame]mame.lst
[src/mame/audio]mario.c
[src/mame/drivers]20pacgal.c aleck64.c chihiro.c itech32.c naomi.c nl_pongd.c peplus.c snowbros.c twinkle.c
[src/mame/includes]mario.h snowbros.h
[src/mame/machine]315-5881_crypt.c naomicrypt.c
[src/mess]mess.lst mess.mak
[src/mess/drivers]comp4.c splitsec.c
[src/mess/includes]msx.h
[src/mess/layout]splitsec.lay
[src/osd]osdcore.c osdepend.h
[src/osd/modules/lib]osdobj_common.c osdobj_common.h
[src/osd/osdmini]minimain.c osdmini.h osdmini.mak
[src/osd/sdl]draw13.c osdsdl.h sdlmain.c
[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]winmain.c winmain.h
[src/tools]nltool.c

trunk/src/emu/clifront.c
r242990r242991
2424
2525#include "drivenum.h"
2626
27#include "osdepend.h"
28
2927#include <new>
3028#include <ctype.h>
3129
trunk/src/emu/clifront.h
r242990r242991
1515
1616#include "emu.h"
1717#include "cliopts.h"
18#include "osdepend.h"
1819
19// don't include osd_interface in header files
20class osd_interface;
2120
2221//**************************************************************************
2322//  TYPE DEFINITIONS
trunk/src/emu/cpu/tms0980/tms0980.c
r242990r242991
429429   m_sr = 0;
430430   m_pa = 0;
431431   m_pb = 0;
432   m_ps = 0;
433432   m_a = 0;
434433   m_x = 0;
435434   m_y = 0;
r242990r242991
467466   save_item(NAME(m_sr));
468467   save_item(NAME(m_pa));
469468   save_item(NAME(m_pb));
470   save_item(NAME(m_ps));
471469   save_item(NAME(m_a));
472470   save_item(NAME(m_x));
473471   save_item(NAME(m_y));
r242990r242991
638636   tms1100_cpu_device::device_reset();
639637
640638   // small differences in 00-3f area
641   m_fixed_decode[0x09] = F_COMX;
639   m_fixed_decode[0x09] = F_COMX; // !
642640   m_fixed_decode[0x0b] = F_TPC;
643641}
644642
r242990r242991
960958//-------------------------------------------------
961959
962960// handle branches:
963
964// TMS1000/common
965961// note: add(latch) and bl(branch latch) are specific to 0980 series,
966962// c(chapter) bits are specific to 1100(and 1400) series
967963
964// TMS1000/common:
965
968966void tms1xxx_cpu_device::op_br()
969967{
970968   // BR/BL: conditional branch
971   if (m_status)
972   {
973      if (m_clatch == 0)
974         m_pa = m_pb;
975      m_ca = m_cb;
976      m_pc = m_opcode & m_pc_mask;
977   }
969   if (!m_status)
970      return;
971
972   if (!m_clatch)
973      m_pa = m_pb;
974   m_ca = m_cb;
975   m_pc = m_opcode & m_pc_mask;
978976}
979977
980978void tms1xxx_cpu_device::op_call()
981979{
982980   // CALL/CALLL: conditional call
983   if (m_status)
984   {
985      UINT8 prev_pa = m_pa;
981   if (!m_status)
982      return;
986983
987      if (m_clatch == 0)
988      {
989         m_clatch = 1;
990         m_sr = m_pc;
991         m_pa = m_pb;
992         m_cs = m_ca;
993      }
994      m_ca = m_cb;
995      m_pb = prev_pa;
996      m_pc = m_opcode & m_pc_mask;
984   UINT8 prev_pa = m_pa;
985   if (!m_clatch)
986   {
987      m_sr = m_pc;
988      m_clatch = 1;
989      m_pa = m_pb;
990      m_cs = m_ca;
997991   }
992   m_ca = m_cb;
993   m_pb = prev_pa;
994   m_pc = m_opcode & m_pc_mask;
998995}
999996
1000997void tms1xxx_cpu_device::op_retn()
1001998{
1002999   // RETN: return from subroutine
1003   if (m_clatch == 1)
1000   if (m_clatch)
10041001   {
1005      m_clatch = 0;
10061002      m_pc = m_sr;
1003      m_clatch = 0;
10071004      m_ca = m_cs;
10081005   }
10091006   m_add = 0;
r242990r242991
10171014void tms1400_cpu_device::op_br()
10181015{
10191016   // BR/BL: conditional branch
1020   if (m_status)
1021   {
1022      m_pa = m_pb; // don't care about clatch
1023      m_ca = m_cb;
1024      m_pc = m_opcode & m_pc_mask;
1025   }
1017   if (!m_status)
1018      return;
1019   
1020   //..
10261021}
10271022
10281023void tms1400_cpu_device::op_call()
10291024{
10301025   // CALL/CALLL: conditional call
1031   if (m_status)
1032   {
1033      // 3-level stack, mask clatch 3 bits (no need to mask others)
1034      m_clatch = (m_clatch << 1 | 1) & 7;
1026   if (!m_status)
1027      return;
10351028
1036      m_sr = m_sr << m_pc_bits | m_pc;
1037      m_pc = m_opcode & m_pc_mask;
1038
1039      m_ps = m_ps << 4 | m_pa;
1040      m_pa = m_pb;
1041     
1042      m_cs = m_cs << 2 | m_ca;
1043      m_ca = m_cb;
1044   }
1045   else
1046   {
1047      m_pb = m_pa;
1048      m_cb = m_ca;
1049   }
1029   //..
10501030}
10511031
10521032void tms1400_cpu_device::op_retn()
10531033{
10541034   // RETN: return from subroutine
1055   if (m_clatch & 1)
1056   {
1057      m_clatch >>= 1;
1058
1059      m_pc = m_sr & m_pc_mask;
1060      m_sr >>= m_pc_bits;
1061     
1062      m_pa = m_pb = m_ps & 0xf;
1063      m_ps >>= 4;
1064     
1065      m_ca = m_cb = m_cs & 3;
1066      m_cs >>= 2;
1067   }
1035   //..
10681036}
10691037
10701038
10711039// handle other:
10721040
1073// TMS1000/common
1041// TMS1000/common:
10741042
10751043void tms1xxx_cpu_device::op_sbit()
10761044{
r242990r242991
11901158
11911159
11921160// TMS0980-specific (and possibly child classes)
1193
11941161void tms0980_cpu_device::op_comx()
11951162{
11961163   // COMX: complement X register, but not the MSB
r242990r242991
12361203
12371204
12381205// TMS0270-specific
1239
12401206void tms0270_cpu_device::op_setr()
12411207{
12421208   // same as default, but handle write to output in dynamic_output
trunk/src/emu/cpu/tms0980/tms0980.h
r242990r242991
139139   optional_device<pla_device> m_spla;
140140
141141   UINT8   m_pc;        // 6 or 7-bit program counter
142   UINT32  m_sr;        // 6 or 7-bit subroutine return register(s)
142   UINT8  m_sr;        // 6 or 7-bit subroutine return register
143143   UINT8   m_pa;        // 4-bit page address register
144144   UINT8   m_pb;        // 4-bit page buffer register
145   UINT16  m_ps;        // 4-bit page subroutine register(s)
146145   UINT8   m_a;         // 4-bit accumulator
147146   UINT8   m_x;         // 2,3,or 4-bit RAM X register
148147   UINT8   m_y;         // 4-bit RAM Y register
149   UINT8   m_ca;        // chapter address register
150   UINT8   m_cb;        // chapter buffer register
151   UINT16  m_cs;        // chapter subroutine register(s)
148   UINT8   m_ca;        // chapter address bit
149   UINT8   m_cb;        // chapter buffer bit
150   UINT8   m_cs;        // chapter subroutine bit
152151   UINT16  m_r;
153152   UINT16  m_o;
154153   UINT8   m_cki_bus;
r242990r242991
161160   UINT8   m_status;
162161   UINT8   m_status_latch;
163162   UINT8   m_eac;       // end around carry bit
164   UINT8   m_clatch;    // call latch bit(s)
163   UINT8   m_clatch;    // call latch bit
165164   UINT8   m_add;       // add latch bit
166165   UINT8   m_bl;        // branch latch bit
167166
trunk/src/emu/distate.c
r242990r242991
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),
r242990r242991
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),
r242990r242991
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);
r242990r242991
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
r242990r242991
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
r242990r242991
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
r242990r242991
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/emu.mak
r242990r242991
124124   $(EMUOBJ)/ui/filemngr.o \
125125   $(EMUOBJ)/ui/filesel.o \
126126   $(EMUOBJ)/ui/imgcntrl.o \
127   $(EMUOBJ)/ui/info.o \
127   $(EMUOBJ)/ui/imginfo.o \
128128   $(EMUOBJ)/ui/inputmap.o \
129129   $(EMUOBJ)/ui/selgame.o \
130130   $(EMUOBJ)/ui/slotopt.o \
r242990r242991
148148   $(EMUOBJ)/debug/textbuf.o \
149149   $(EMUOBJ)/profiler.o \
150150   $(EMUOBJ)/webengine.o \
151   $(OSDOBJ)/osdcore.o \
151152   $(OSDOBJ)/osdnet.o \
152153   $(OSDOBJ)/modules/sound/none.o \
153154   $(OSDOBJ)/modules/debugger/none.o \
trunk/src/emu/emuopts.h
r242990r242991
354354
355355   const char *main_value(astring &buffer, const char *option) const;
356356   const char *sub_value(astring &buffer, const char *name, const char *subname) const;
357   bool add_slot_options(bool isfirst);
358
359357private:
360358   // device-specific option handling
361359   void add_device_options(bool isfirst);
360   bool add_slot_options(bool isfirst);
362361   void update_slot_options();
363362
364363   // INI parsing helper
trunk/src/emu/image.c
r242990r242991
237237         }
238238      }
239239   }
240}
241240
242/*-------------------------------------------------
243 image_mandatory_scan - search for devices which
244 need an image to be loaded
245 -------------------------------------------------*/
246
247astring &image_mandatory_scan(running_machine &machine, astring &mandatory)
248{
249   mandatory.reset();
250   // make sure that any required image has a mounted file
251   image_interface_iterator iter(machine.root_device());
252241   for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
253242   {
254      if (image->filename() == NULL && image->must_be_loaded())
255         mandatory.cat("\"").cat(image->instance_name()).cat("\", ");
243      /* is an image specified for this image */
244      image_name = image->filename();
245
246      if (!((image_name != NULL) && (image_name[0] != '\0')))
247      {
248         /* no image... must this device be loaded? */
249         if (image->must_be_loaded())
250         {
251            fatalerror_exitcode(machine, MAMERR_DEVICE, "Driver requires that device \"%s\" must have an image to load", image->instance_name());
252         }
253      }
256254   }
257   return mandatory;
258255}
259256
260257/*-------------------------------------------------
trunk/src/emu/image.h
r242990r242991
2020
2121void image_init(running_machine &machine);
2222void image_postdevice_init(running_machine &machine);
23astring &image_mandatory_scan(running_machine &machine, astring &mandatory);
2423
2524extern struct io_procs image_ioprocs;
2625
trunk/src/emu/ioport.c
r242990r242991
9999#include "uiinput.h"
100100#include "debug/debugcon.h"
101101
102#include "osdepend.h"
103
104102#include <ctype.h>
105103#include <time.h>
106104
trunk/src/emu/luaengine.c
r242990r242991
11// license:BSD-3-Clause
2// copyright-holders:Miodrag Milanovic,Luca Bruno
2// copyright-holders:Miodrag Milanovic
33/***************************************************************************
44
55    luaengine.c
r242990r242991
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//-------------------------------------------------
r242990r242991
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//-------------------------------------------------
r242990r242991
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
r242990r242991
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
r242990r242991
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
r242990r242991
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)
r242990r242991
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
r242990r242991
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.c
r242990r242991
106106//  RUNNING MACHINE
107107//**************************************************************************
108108
109osd_interface &running_machine::osd() const
110{
111    return m_manager.osd();
112}
113
114109//-------------------------------------------------
115110//  running_machine - constructor
116111//-------------------------------------------------
trunk/src/emu/machine.h
r242990r242991
1919
2020#include <time.h>
2121
22// forward declaration instead of osdepend.h
23class osd_interface;
2422
23
2524//**************************************************************************
2625//  CONSTANTS
2726//**************************************************************************
r242990r242991
158157   const machine_config &config() const { return m_config; }
159158   device_t &root_device() const { return m_config.root_device(); }
160159   const game_driver &system() const { return m_system; }
161   osd_interface &osd() const;
160   osd_interface &osd() const { return m_manager.osd(); }
162161   machine_manager &manager() const { return m_manager; }
163162   resource_pool &respool() { return m_respool; }
164163   device_scheduler &scheduler() { return m_scheduler; }
trunk/src/emu/machine/netlist.c
r242990r242991
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
r242990r242991
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}
r242990r242991
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);
r242990r242991
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);
r242990r242991
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/mame.c
r242990r242991
9292
9393machine_manager* machine_manager::m_manager = NULL;
9494
95osd_interface &machine_manager::osd() const
96{
97    return m_osd;
98}
99
100
10195machine_manager* machine_manager::instance(emu_options &options,osd_interface &osd)
10296{
10397   if(!m_manager)
trunk/src/emu/mame.h
r242990r242991
2222
2323#include "webengine.h"
2424
25class osd_interface;
2625
2726//**************************************************************************
2827//    CONSTANTS
r242990r242991
8988   static machine_manager *instance();
9089   ~machine_manager();
9190
92   osd_interface &osd() const;
91   osd_interface &osd() const { return m_osd; }
9392   emu_options &options() const { return m_options; }
9493   web_engine *web() { return &m_web; }
9594   lua_engine *lua() { return &m_lua; }
trunk/src/emu/netlist/analog/nld_bjt.c
r242990r242991
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
r242990r242991
7575   connect(m_RB.m_P, m_BC_dummy.m_P);
7676   connect(m_RC.m_P, m_BC_dummy.m_N);
7777
78   save(NLNAME(m_state_on));
78   save(NAME(m_state_on));
7979
8080   m_RB.set(netlist().gmin(), 0.0, 0.0);
8181   m_RC.set(netlist().gmin(), 0.0, 0.0);
r242990r242991
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
r242990r242991
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
r242990r242991
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
r242990r242991
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);
r242990r242991
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:
r242990r242991
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);
r242990r242991
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
r242990r242991
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);
r242990r242991
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
r242990r242991
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;
r242990r242991
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// ----------------------------------------------------------------------------------------
r242990r242991
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
r242990r242991
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;
r242990r242991
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// ----------------------------------------------------------------------------------------
r242990r242991
6969   {
7070      //delete[] m_A[k];
7171   }
72    for (int k = 0; k < N(); k++)
73    {
74        nl_free(m_terms[k]);
75        nl_free(m_row_ops[k]);
76    }
77    nl_free(m_row_ops[N()]);
78    //delete[] m_last_RHS;
72   //delete[] m_last_RHS;
7973   //delete[] m_RHS;
80   nl_free_array(m_terms);
81   nl_free_array(m_rails_temp);
74   delete[] m_terms;
75   delete[] m_rails_temp;
8276   //delete[] m_row_ops;
8377
8478}
8579
8680template <int m_N, int _storage_N>
87ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep()
81ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep()
8882{
89   nl_double new_solver_timestep = m_params.m_max_timestep;
83   double new_solver_timestep = m_params.m_max_timestep;
9084
9185   if (m_params.m_dynamic)
9286   {
r242990r242991
10397      {
10498         netlist_analog_net_t *n = m_nets[k];
10599#endif
106         const nl_double DD_n = (n->m_cur_Analog - m_last_V[k]);
107         const nl_double hn = current_timestep();
100         const double DD_n = (n->m_cur_Analog - m_last_V[k]);
101         const double hn = current_timestep();
108102
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;
103         double DD2 = (DD_n / hn - n->m_DD_n_m_1 / n->m_h_n_m_1) / (hn + n->m_h_n_m_1);
104         double new_net_timestep;
111105
112106         n->m_h_n_m_1 = hn;
113107         n->m_DD_n_m_1 = DD_n;
r242990r242991
236230      for (int i=0; i < N(); i++)
237231         m_A[k][i] = 0.0;
238232
239      nl_double rhsk = 0.0;
240      nl_double akk  = 0.0;
233      double rhsk = 0.0;
234      double akk  = 0.0;
241235      {
242236         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();
237         const double * RESTRICT gt = m_terms[k]->gt();
238         const double * RESTRICT go = m_terms[k]->go();
239         const double * RESTRICT Idr = m_terms[k]->Idr();
246240#if VECTALT
247241
248242         for (int i = 0; i < terms_count; i++)
r242990r242991
253247#else
254248         m_terms[k]->ops()->sum2(Idr, gt, rhsk, akk);
255249#endif
256         nl_double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog();
250         double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog();
257251         for (int i = m_terms[k]->m_railstart; i < terms_count; i++)
258252         {
259253            //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog();
r242990r242991
272266      m_A[k][k] += 1.0;
273267      {
274268         const int *net_other = m_terms[k]->net_other();
275         const nl_double *go = m_terms[k]->go();
269         const double *go = m_terms[k]->go();
276270         const int railstart =  m_terms[k]->m_railstart;
277271
278272         for (int i = 0; i < railstart; i++)
r242990r242991
285279      m_A[k][k] += akk;
286280      {
287281         const int * RESTRICT net_other = m_terms[k]->net_other();
288         const nl_double * RESTRICT go = m_terms[k]->go();
282         const double * RESTRICT go = m_terms[k]->go();
289283         const int railstart =  m_terms[k]->m_railstart;
290284
291285         for (int i = 0; i < railstart; i++)
r242990r242991
299293
300294template <int m_N, int _storage_N>
301295ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::gauss_LE(
302      nl_double (* RESTRICT x))
296      double (* RESTRICT x))
303297{
304298#if 0
305299   for (int i = 0; i < N(); i++)
r242990r242991
336330      }
337331
338332      /* FIXME: Singular matrix? */
339      const nl_double f = 1.0 / m_A[i][i];
333      const double f = 1.0 / m_A[i][i];
340334
341335      /* Eliminate column i from row j */
342336
343337      for (int j = i + 1; j < kN; j++)
344338      {
345         const nl_double f1 = - m_A[j][i] * f;
339         const double f1 = - m_A[j][i] * f;
346340         if (f1 != 0.0)
347341         {
348342#if 0 && VECTALT
r242990r242991
359353   /* back substitution */
360354   for (int j = kN - 1; j >= 0; j--)
361355   {
362      nl_double tmp = 0;
356      double tmp = 0;
363357
364358      for (int k = j + 1; k < kN; k++)
365359         tmp += m_A[j][k] * x[k];
r242990r242991
380374}
381375
382376template <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))
377ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta(
378      const double (* RESTRICT V))
385379{
386   nl_double cerr = 0;
387   nl_double cerr2 = 0;
380   double cerr = 0;
381   double cerr2 = 0;
388382   for (int i = 0; i < this->N(); i++)
389383   {
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]);
384      const double e = (V[i] - this->m_nets[i]->m_cur_Analog);
385      const double e2 = (m_RHS[i] - this->m_last_RHS[i]);
392386      cerr = (fabs(e) > cerr ? fabs(e) : cerr);
393387      cerr2 = (fabs(e2) > cerr2 ? fabs(e2) : cerr2);
394388   }
r242990r242991
398392
399393template <int m_N, int _storage_N>
400394ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::store(
401      const nl_double (* RESTRICT V), const bool store_RHS)
395      const double (* RESTRICT V), const bool store_RHS)
402396{
403397   for (int i = 0; i < this->N(); i++)
404398   {
r242990r242991
414408}
415409
416410template <int m_N, int _storage_N>
417ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve()
411ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve()
418412{
419413   solve_base<netlist_matrix_solver_direct_t>(this);
420414   return this->compute_next_timestep();
r242990r242991
424418template <int m_N, int _storage_N>
425419ATTR_HOT int netlist_matrix_solver_direct_t<m_N, _storage_N>::solve_non_dynamic()
426420{
427   nl_double new_v[_storage_N] = { 0.0 };
421   double new_v[_storage_N] = { 0.0 };
428422
429423   this->gauss_LE(new_v);
430424
431425   if (this->is_dynamic())
432426   {
433      nl_double err = delta(new_v);
427      double err = delta(new_v);
434428
435429      store(new_v, true);
436430
r242990r242991
458452, m_dim(size)
459453, m_lp_fact(0)
460454{
461   m_terms = nl_alloc_array(terms_t *, N());
462   m_rails_temp = nl_alloc_array(terms_t, N());
455   m_terms = new terms_t *[N()];
456   m_rails_temp = new terms_t[N()];
463457
464458   for (int k = 0; k < N(); k++)
465459   {
466      m_terms[k] = nl_alloc(terms_t);
460      m_terms[k] = new terms_t;
467461      m_row_ops[k] = vector_ops_t::create_ops(k);
468462   }
469463   m_row_ops[N()] = vector_ops_t::create_ops(N());
r242990r242991
475469, m_dim(size)
476470, m_lp_fact(0)
477471{
478    m_terms = nl_alloc_array(terms_t *, N());
479    m_rails_temp = nl_alloc_array(terms_t, N());
472    m_terms = new terms_t *[N()];
473    m_rails_temp = new terms_t[N()];
480474
481475    for (int k = 0; k < N(); k++)
482476    {
483        m_terms[k] = nl_alloc(terms_t);
477        m_terms[k] = new terms_t;
484478        m_row_ops[k] = vector_ops_t::create_ops(k);
485479    }
486480    m_row_ops[N()] = vector_ops_t::create_ops(N());
trunk/src/emu/netlist/analog/nld_ms_direct1.h
r242990r242991
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
r242990r242991
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();
r242990r242991
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
r242990r242991
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
r242990r242991
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();
r242990r242991
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
r242990r242991
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
r242990r242991
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
r242990r242991
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;
r242990r242991
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;
r242990r242991
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];
r242990r242991
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);
r242990r242991
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
r242990r242991
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];
r242990r242991
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      }
r242990r242991
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) ));
r242990r242991
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         {
r242990r242991
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;
r242990r242991
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
r242990r242991
4444   switch (size)
4545   {
4646      case 1:
47         return nl_alloc(vector_ops_impl_t<1>);
47         return new vector_ops_impl_t<1>();
4848      case 2:
49         return nl_alloc(vector_ops_impl_t<2>);
49         return new vector_ops_impl_t<2>();
5050      case 3:
51         return nl_alloc(vector_ops_impl_t<3>);
51         return new vector_ops_impl_t<3>();
5252      case 4:
53         return nl_alloc(vector_ops_impl_t<4>);
53         return new vector_ops_impl_t<4>();
5454      case 5:
55         return nl_alloc(vector_ops_impl_t<5>);
55         return new vector_ops_impl_t<5>();
5656      case 6:
57         return nl_alloc(vector_ops_impl_t<6>);
57         return new vector_ops_impl_t<6>();
5858      case 7:
59         return nl_alloc(vector_ops_impl_t<7>);
59         return new vector_ops_impl_t<7>();
6060      case 8:
61         return nl_alloc(vector_ops_impl_t<8>);
61         return new vector_ops_impl_t<8>();
6262      case 9:
63         return nl_alloc(vector_ops_impl_t<9>);
63         return new vector_ops_impl_t<9>();
6464      case 10:
65         return nl_alloc(vector_ops_impl_t<10>);
65         return new vector_ops_impl_t<10>();
6666      case 11:
67         return nl_alloc(vector_ops_impl_t<11>);
67         return new vector_ops_impl_t<11>();
6868      case 12:
69         return nl_alloc(vector_ops_impl_t<12>);
69         return new vector_ops_impl_t<12>();
7070      default:
71         return nl_alloc(vector_ops_impl_t<0>, size);
71         return new vector_ops_impl_t<0>(size);
7272   }
7373}
7474
r242990r242991
9191      m_term[i]->m_Idr1 = &m_Idr[i];
9292      m_other_curanalog[i] = &m_term[i]->m_otherterm->net().as_analog().m_cur_Analog;
9393   }
94
95   m_ops = vector_ops_t::create_ops(m_gt.count());
9496}
9597
9698// ----------------------------------------------------------------------------------------
r242990r242991
110112ATTR_COLD netlist_matrix_solver_t::~netlist_matrix_solver_t()
111113{
112114   for (int i = 0; i < m_inps.count(); i++)
113      global_free(m_inps[i]);
115      delete m_inps[i];
114116}
115117
116118ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets)
r242990r242991
174176
175177                  if (net_proxy_output == NULL)
176178                  {
177                     net_proxy_output = nl_alloc(netlist_analog_output_t);
179                     net_proxy_output = new netlist_analog_output_t();
178180                     net_proxy_output->init_object(*this, this->name() + "." + pstring::sprintf("m%d", m_inps.count()));
179181                     m_inps.add(net_proxy_output);
180182                     net_proxy_output->m_proxied_net = &p->net().as_analog();
r242990r242991
233235
234236ATTR_COLD void netlist_matrix_solver_t::update()
235237{
236   const nl_double new_timestep = solve();
238   const double new_timestep = solve();
237239
238240   if (m_params.m_dynamic && is_timestep() && new_timestep > 0)
239241      m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(new_timestep));
r242990r242991
241243
242244ATTR_COLD void netlist_matrix_solver_t::update_forced()
243245{
244   ATTR_UNUSED const nl_double new_timestep = solve();
246   ATTR_UNUSED const double new_timestep = solve();
245247
246248   if (m_params.m_dynamic && is_timestep())
247249      m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(m_params.m_min_timestep));
r242990r242991
249251
250252ATTR_HOT void netlist_matrix_solver_t::step(const netlist_time delta)
251253{
252   const nl_double dd = delta.as_double();
254   const double dd = delta.as_double();
253255   for (int k=0; k < m_step_devices.count(); k++)
254256      m_step_devices[k]->step_time(dd);
255257}
r242990r242991
284286   }
285287}
286288
287ATTR_HOT nl_double netlist_matrix_solver_t::solve()
289ATTR_HOT double netlist_matrix_solver_t::solve()
288290{
289291   netlist_time now = netlist().time();
290292   netlist_time delta = now - m_last_step;
r242990r242991
300302
301303   step(delta);
302304
303   const nl_double next_time_step = vsolve();
305   const double next_time_step = vsolve();
304306
305307   update_inputs();
306308   return next_time_step;
r242990r242991
348350   register_param("GMIN", m_gmin, NETLIST_GMIN_DEFAULT);
349351   register_param("DYNAMIC_TS", m_dynamic, 0);
350352   register_param("LTE", m_lte, 5e-5);                     // diff/timestep
351   register_param("MIN_TIMESTEP", m_min_timestep, 1e-6);   // nl_double timestep resolution
353   register_param("MIN_TIMESTEP", m_min_timestep, 1e-6);   // double timestep resolution
352354
353355   // internal staff
354356
r242990r242991
378380   while (e != NULL)
379381   {
380382      netlist_matrix_solver_t * const *en = m_mat_solvers.next(e);
381      global_free(*e);
383      delete *e;
382384      e = en;
383385   }
384386
r242990r242991
417419      if (m_mat_solvers[i]->is_timestep())
418420         {
419421            // Ignore return value
420            ATTR_UNUSED const nl_double ts = m_mat_solvers[i]->solve();
422            ATTR_UNUSED const double ts = m_mat_solvers[i]->solve();
421423         }
422424   }
423425#endif
r242990r242991
433435netlist_matrix_solver_t * NETLIB_NAME(solver)::create_solver(int size, const int gs_threshold, const bool use_specific)
434436{
435437   if (use_specific && m_N == 1)
436      return nl_alloc(netlist_matrix_solver_direct1_t, m_params);
438      return new netlist_matrix_solver_direct1_t(m_params);
437439   else if (use_specific && m_N == 2)
438      return nl_alloc(netlist_matrix_solver_direct2_t, m_params);
440      return new netlist_matrix_solver_direct2_t(m_params);
439441   else
440442   {
441       typedef netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N> solver_N;
442443      if (size >= gs_threshold)
443         return nl_alloc(solver_N, m_params, size);
444         return new netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N>(m_params, size);
444445      else
445         return nl_alloc(solver_N, m_params, size);
446         return new netlist_matrix_solver_direct_t<m_N, _storage_N>(m_params, size);
446447   }
447448}
448449
trunk/src/emu/netlist/analog/nld_solver.h
r242990r242991
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;
r242990r242991
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
r242990r242991
8888   vector_ops_impl_t(int size)
8989   : vector_ops_t(size)
9090   {
91      nl_assert(m_N == 0);
91      assert(m_N == 0);
9292   }
9393
9494   virtual ~vector_ops_impl_t() {}
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];
r242990r242991
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];
r242990r242991
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;
r242990r242991
155155   NETLIST_PREVENT_COPYING(terms_t)
156156
157157   public:
158   ATTR_COLD terms_t() : m_railstart(0)
158   ATTR_COLD terms_t() : m_railstart(0), m_ops(NULL)
159159   {}
160160
161161   ATTR_COLD void clear()
r242990r242991
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; }
178   ATTR_HOT vector_ops_t *ops() { return m_ops; }
178179
179180   ATTR_COLD void set_pointers();
180181
r242990r242991
183184private:
184185   plinearlist_t<netlist_terminal_t *> m_term;
185186   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;
187   plinearlist_t<double> m_go;
188   plinearlist_t<double> m_gt;
189   plinearlist_t<double> m_Idr;
190   plinearlist_t<double *> m_other_curanalog;
191   vector_ops_t * m_ops;
190192};
191193
192194class netlist_matrix_solver_t : public netlist_device_t
r242990r242991
209211   template<class C>
210212   void solve_base(C *p);
211213
212   ATTR_HOT nl_double solve();
214   ATTR_HOT double solve();
213215
214216   ATTR_HOT inline bool is_dynamic() { return m_dynamic_devices.count() > 0; }
215217   ATTR_HOT inline bool is_timestep() { return m_step_devices.count() > 0; }
r242990r242991
236238   ATTR_HOT void update_dynamic();
237239
238240   // should return next time step
239   ATTR_HOT virtual nl_double vsolve() = 0;
241   ATTR_HOT virtual double vsolve() = 0;
240242
241243   ATTR_COLD virtual void  add_term(int net_idx, netlist_terminal_t *term) = 0;
242244
r242990r242991
249251
250252   const netlist_solver_parameters_t &m_params;
251253
252   ATTR_HOT inline const nl_double current_timestep() { return m_cur_ts; }
254   ATTR_HOT inline const double current_timestep() { return m_cur_ts; }
253255private:
254256
255257   netlist_time m_last_step;
256   nl_double m_cur_ts;
258   double m_cur_ts;
257259   dev_list_t m_step_devices;
258260   dev_list_t m_dynamic_devices;
259261
r242990r242991
279281
280282   ATTR_COLD void post_start();
281283
282   ATTR_HOT inline nl_double gmin() { return m_gmin.Value(); }
284   ATTR_HOT inline double gmin() { return m_gmin.Value(); }
283285
284286protected:
285287   ATTR_HOT void update();
trunk/src/emu/netlist/analog/nld_twoterm.c
r242990r242991
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;
r242990r242991
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
r242990r242991
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
r242990r242991
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);
r242990r242991
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   }
r242990r242991
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
r242990r242991
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
r242990r242991
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      }
r242990r242991
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;
r242990r242991
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// ----------------------------------------------------------------------------------------
r242990r242991
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/net_lib.c
r242990r242991
4949
5050#include "net_lib.h"
5151#include "nld_system.h"
52#include "../nl_factory.h"
5352
5453NETLIST_START(diode_models)
5554   NET_MODEL(".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)")
r242990r242991
6564
6665
6766#define xstr(s) # s
68#define ENTRY1(_nic, _name, _defparam) factory.register_device<_nic>( # _name, xstr(_nic), _defparam );
67#define ENTRY1(_nic, _name, _defparam) register_device<_nic>( # _name, xstr(_nic), _defparam );
6968#define ENTRY(_nic, _name, _defparam) ENTRY1(NETLIB_NAME(_nic), _name, _defparam)
7069
71void nl_initialize_factory(netlist_factory_t &factory)
70netlist_factory_t::netlist_factory_t()
7271{
72}
73
74netlist_factory_t::~netlist_factory_t()
75{
76   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
77   {
78      net_device_t_base_factory *p = *e;
79      delete p;
80   }
81   m_list.clear();
82}
83
84void netlist_factory_t::initialize()
85{
7386   ENTRY(R,                    RES,                    "R")
7487   ENTRY(POT,                  POT,                    "R")
7588   ENTRY(C,                    CAP,                    "C")
r242990r242991
149162   ENTRY(NE555_dip,            NE555_DIP,              "-")
150163}
151164
165netlist_device_t *netlist_factory_t::new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const
166{
167   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
168   {
169      net_device_t_base_factory *p = *e;
170      if (strcmp(p->classname(), classname) == 0)
171      {
172         netlist_device_t *ret = p->Create();
173         return ret;
174      }
175      p++;
176   }
177   setup.netlist().error("Class %s not found!\n", classname.cstr());
178   return NULL; // appease code analysis
179}
180
181netlist_device_t *netlist_factory_t::new_device_by_name(const pstring &name, netlist_setup_t &setup) const
182{
183   net_device_t_base_factory *f = factory_by_name(name, setup);
184   return f->Create();
185}
186
187net_device_t_base_factory * netlist_factory_t::factory_by_name(const pstring &name, netlist_setup_t &setup) const
188{
189   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
190   {
191      net_device_t_base_factory *p = *e;
192      if (strcmp(p->name(), name) == 0)
193      {
194         return p;
195      }
196      p++;
197   }
198   setup.netlist().error("Class %s not found!\n", name.cstr());
199   return NULL; // appease code analysis
200}
trunk/src/emu/netlist/devices/net_lib.h
r242990r242991
9999NETLIST_EXTERNAL(diode_models);
100100NETLIST_EXTERNAL(bjt_models);
101101
102void nl_initialize_factory(netlist_factory_t &factory);
103
104102#endif
trunk/src/emu/netlist/devices/nld_4020.c
r242990r242991
5151   register_output("Q13", m_Q[12]);
5252   register_output("Q14", m_Q[13]);
5353
54   save(NLNAME(m_cnt));
54   save(NAME(m_cnt));
5555}
5656
5757NETLIB_RESET(4020_sub)
r242990r242991
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
r242990r242991
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   {
r242990r242991
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);
r242990r242991
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_74107.c
r242990r242991
1111   register_output("Q", m_Q);
1212   register_output("QQ", m_QQ);
1313
14   save(NLNAME(m_Q1));
15   save(NLNAME(m_Q2));
16   save(NLNAME(m_F));
14   save(NAME(m_Q1));
15   save(NAME(m_Q2));
16   save(NAME(m_F));
1717}
1818
1919NETLIB_RESET(74107Asub)
trunk/src/emu/netlist/devices/nld_74123.c
r242990r242991
3232   connect(m_RN.m_P, m_RP.m_N);
3333   connect(m_CV, m_RN.m_P);
3434
35   save(NLNAME(m_last_trig));
36   save(NLNAME(m_state));
37   save(NLNAME(m_KP));
35   save(NAME(m_last_trig));
36   save(NAME(m_state));
37   save(NAME(m_KP));
3838
3939   m_KP = 1.0 / (1.0 + exp(m_K.Value()));
4040}
r242990r242991
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);
r242990r242991
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_74153.c
r242990r242991
2222
2323   m_chan = 0;
2424
25   save(NLNAME(m_chan));
25   save(NAME(m_chan));
2626}
2727
2828NETLIB_RESET(74153sub)
trunk/src/emu/netlist/devices/nld_7448.c
r242990r242991
7878   register_output("f", m_f);
7979   register_output("g", m_g);
8080
81   save(NLNAME(m_state));
81   save(NAME(m_state));
8282}
8383
8484NETLIB_RESET(7448_sub)
r242990r242991
9898
9999NETLIB_FUNC_VOID(7448_sub, update_outputs, (UINT8 v))
100100{
101   nl_assert(v<16);
101   assert(v<16);
102102   if (v != m_state)
103103   {
104104      // max transfer time is 100 NS */
trunk/src/emu/netlist/devices/nld_7474.c
r242990r242991
7676   register_output("Q",   m_Q);
7777   register_output("QQ",  m_QQ);
7878
79   save(NLNAME(m_nextD));
79   save(NAME(m_nextD));
8080}
8181
8282NETLIB_RESET(7474sub)
trunk/src/emu/netlist/devices/nld_7483.c
r242990r242991
2323   register_output("S4", m_S4);
2424   register_output("C4", m_C4);
2525
26   save(NLNAME(m_lastr));
26   save(NAME(m_lastr));
2727}
2828
2929NETLIB_RESET(7483)
trunk/src/emu/netlist/devices/nld_7490.c
r242990r242991
1919   register_output("QC", m_Q[2]);
2020   register_output("QD", m_Q[3]);
2121
22   save(NLNAME(m_cnt));
23   save(NLNAME(m_last_A));
24   save(NLNAME(m_last_B));
22   save(NAME(m_cnt));
23   save(NAME(m_last_A));
24   save(NAME(m_last_B));
2525
2626}
2727
trunk/src/emu/netlist/devices/nld_7493.c
r242990r242991
4040   register_input("CLK", m_I);
4141   register_output("Q", m_Q);
4242
43   save(NLNAME(m_reset));
43   save(NAME(m_reset));
4444}
4545
4646NETLIB_RESET(7493ff)
trunk/src/emu/netlist/devices/nld_74ls629.c
r242990r242991
4949
5050   reset();
5151
52   save(NLNAME(m_enableq));
53   save(NLNAME(m_inc));
54   save(NLNAME(m_out));
52   save(NAME(m_enableq));
53   save(NAME(m_inc));
54   save(NAME(m_out));
5555}
5656
5757NETLIB_RESET(SN74LS629clk)
r242990r242991
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_9316.c
r242990r242991
7373   register_output("QD", m_QD);
7474   register_output("RC", m_RC);
7575
76   save(NLNAME(m_cnt.ref()));
77   save(NLNAME(m_loadq.ref()));
78   save(NLNAME(m_ent.ref()));
76   save(NAME(m_cnt.ref()));
77   save(NAME(m_loadq.ref()));
78   save(NAME(m_ent.ref()));
7979}
8080
8181NETLIB_RESET(9316_sub)
trunk/src/emu/netlist/devices/nld_cmos.h
r242990r242991
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
r242990r242991
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;
r242990r242991
4242   connect(m_R2.m_N, m_R3.m_P);
4343   connect(m_RDIS.m_N, m_R3.m_N);
4444
45   save(NLNAME(m_last_out));
45   save(NAME(m_last_out));
4646}
4747
4848NETLIB_RESET(NE555)
r242990r242991
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
r242990r242991
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
r242990r242991
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_signal.h
r242990r242991
4444      {
4545         register_input(sIN[i], m_i[i]);
4646      }
47      save(NLNAME(m_active));
47      save(NAME(m_active));
4848   }
4949
5050   ATTR_COLD void reset()
r242990r242991
118118      register_input("A", m_i[0]);
119119      register_input("B", m_i[1]);
120120
121      save(NLNAME(m_active));
121      save(NAME(m_active));
122122   }
123123
124124   ATTR_COLD void reset()
trunk/src/emu/netlist/devices/nld_system.c
r242990r242991
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/devices/nld_system.h
r242990r242991
198198   ATTR_COLD nld_a_to_d_proxy(netlist_input_t &in_proxied)
199199         : netlist_device_t()
200200   {
201      nl_assert(in_proxied.family() == LOGIC);
201      assert(in_proxied.family() == LOGIC);
202202      m_I.m_logic_family = in_proxied.m_logic_family;
203203   }
204204
r242990r242991
240240   ATTR_COLD nld_base_d_to_a_proxy(netlist_output_t &out_proxied)
241241         : netlist_device_t()
242242   {
243      nl_assert(out_proxied.family() == LOGIC);
243      assert(out_proxied.family() == LOGIC);
244244      m_logic_family = out_proxied.m_logic_family;
245245   }
246246
trunk/src/emu/netlist/devices/nld_truthtable.h
r242990r242991
5050      {
5151         nl_util::pstring_list io = nl_util::split(ttline,"|");
5252         // checks
53         nl_assert(io.count() == 2);
53         assert(io.count() == 2);
5454         nl_util::pstring_list inout = nl_util::split(io[0], ",");
55         nl_assert(inout.count() == m_num_bits);
55         assert(inout.count() == m_num_bits);
5656         nl_util::pstring_list out = nl_util::split(io[1], ",");
57         nl_assert(out.count() == m_NO);
57         assert(out.count() == m_NO);
5858
5959         for (int i=0; i < m_NI; i++)
6060         {
r242990r242991
133133      {
134134         nl_util::pstring_list io = nl_util::split(ttline,"|");
135135         // checks
136         nl_assert(io.count() == 3);
136         assert(io.count() == 3);
137137         nl_util::pstring_list inout = nl_util::split(io[0], ",");
138         nl_assert(inout.count() == m_num_bits);
138         assert(inout.count() == m_num_bits);
139139         nl_util::pstring_list out = nl_util::split(io[1], ",");
140         nl_assert(out.count() == m_NO);
140         assert(out.count() == m_NO);
141141         nl_util::pstring_list times = nl_util::split(io[2], ",");
142         nl_assert(times.count() == m_NO);
142         assert(times.count() == m_NO);
143143
144144         UINT16 val = 0;
145145         UINT8 tindex[m_NO];
trunk/src/emu/netlist/netlist.mak
r242990r242991
2626   $(NETLISTOBJ)/nl_base.o \
2727   $(NETLISTOBJ)/nl_parser.o \
2828   $(NETLISTOBJ)/nl_setup.o \
29   $(NETLISTOBJ)/nl_factory.o \
3029   $(NETLISTOBJ)/pstring.o \
3130   $(NETLISTOBJ)/pstate.o \
3231   $(NETLISTOBJ)/analog/nld_bjt.o \
trunk/src/emu/netlist/nl_base.c
r242990r242991
99#include "pstring.h"
1010#include "nl_util.h"
1111
12#include <stdlib.h> // FIXME: only included for atof
13
1412const netlist_time netlist_time::zero = netlist_time::from_raw(0);
1513
1614netlist_logic_family_desc_t netlist_family_TTL =
r242990r242991
152150   {
153151      if (!m_nets[i]->isRailNet())
154152      {
155         global_free(m_nets[i]);
153         delete m_nets[i];
156154      }
157155   }
158156
r242990r242991
166164ATTR_COLD void netlist_base_t::save_register()
167165{
168166   save(static_cast<pstate_callback_t &>(m_queue), "m_queue");
169   save(NLNAME(m_time));
167   save(NAME(m_time));
170168   netlist_object_t::save_register();
171169}
172170
173ATTR_HOT const nl_double netlist_base_t::gmin() const
171ATTR_HOT const double netlist_base_t::gmin() const
174172{
175173   return solver()->gmin();
176174}
r242990r242991
452450}
453451
454452template 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);
456453template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_int_t &param, const int initialVal);
457454template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_logic_t &param, const int initialVal);
458455template ATTR_COLD void netlist_device_t::register_param(const pstring &sname, netlist_param_str_t &param, const char * const initialVal);
r242990r242991
532529
533530ATTR_COLD void netlist_net_t::register_railterminal(netlist_output_t &mr)
534531{
535   nl_assert(m_railterminal == NULL);
532   assert(m_railterminal == NULL);
536533   m_railterminal = &mr;
537534}
538535
r242990r242991
548545
549546ATTR_COLD void netlist_net_t::save_register()
550547{
551   save(NLNAME(m_time));
552   save(NLNAME(m_active));
553   save(NLNAME(m_in_queue));
554   save(NLNAME(m_cur_Analog));
555   save(NLNAME(m_cur_Q));
556   save(NLNAME(m_new_Q));
548   save(NAME(m_time));
549   save(NAME(m_active));
550   save(NAME(m_in_queue));
551   save(NAME(m_cur_Analog));
552   save(NAME(m_cur_Q));
553   save(NAME(m_new_Q));
557554   netlist_object_t::save_register();
558555}
559556
r242990r242991
572569ATTR_HOT ATTR_ALIGN inline void netlist_net_t::update_devs()
573570{
574571   //assert(m_num_cons != 0);
575   nl_assert(this->isRailNet());
572   assert(this->isRailNet());
576573
577574   const UINT32 masks[4] = { 1, 5, 3, 1 };
578575   const UINT32 mask = masks[ (m_cur_Q  << 1) | m_new_Q ];
r242990r242991
710707
711708ATTR_COLD void netlist_analog_net_t::save_register()
712709{
713   save(NLNAME(m_DD_n_m_1));
714   save(NLNAME(m_h_n_m_1));
710   save(NAME(m_DD_n_m_1));
711   save(NAME(m_h_n_m_1));
715712   netlist_net_t::save_register();
716713}
717714
r242990r242991
806803
807804ATTR_COLD void netlist_terminal_t::save_register()
808805{
809   save(NLNAME(m_Idr1));
810   save(NLNAME(m_go1));
811   save(NLNAME(m_gt1));
806   save(NAME(m_Idr1));
807   save(NAME(m_go1));
808   save(NAME(m_gt1));
812809   netlist_core_terminal_t::save_register();
813810}
814811
r242990r242991
875872   net().as_analog().m_cur_Analog = 0.98;
876873}
877874
878ATTR_COLD void netlist_analog_output_t::initial(const nl_double val)
875ATTR_COLD void netlist_analog_output_t::initial(const double val)
879876{
880877   net().as_analog().m_cur_Analog = val * 0.99;
881878}
r242990r242991
932929}
933930
934931
935ATTR_COLD nl_double netlist_param_model_t::model_value(const pstring &entity, const nl_double defval) const
932ATTR_COLD double netlist_param_model_t::model_value(const pstring &entity, const double defval) const
936933{
937934   pstring tmp = this->Value();
938935   // .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)
r242990r242991
946943      if (pequal < 0)
947944         netlist().error("parameter %s misformat in model %s temp %s\n", entity.cstr(), Value().cstr(), tmp.cstr());
948945      tmp = tmp.substr(pequal+1);
949      nl_double factor = 1.0;
946      double factor = 1.0;
950947      switch (*(tmp.right(1).cstr()))
951948      {
952949         case 'm': factor = 1e-3; break;
r242990r242991
1002999   net.set_time(netlist().time() + m_inc);
10031000}
10041001
1002// ----------------------------------------------------------------------------------------
1003// net_device_t_base_factory
1004// ----------------------------------------------------------------------------------------
1005
1006ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::term_param_list()
1007{
1008   if (m_def_param.startsWith("+"))
1009      return nl_util::split(m_def_param.substr(1), ",");
1010   else
1011      return nl_util::pstring_list();
1012}
1013
1014ATTR_COLD const nl_util::pstring_list net_device_t_base_factory::def_params()
1015{
1016   if (m_def_param.startsWith("+") || m_def_param.equals("-"))
1017      return nl_util::pstring_list();
1018   else
1019      return nl_util::split(m_def_param, ",");
1020}
trunk/src/emu/netlist/nl_base.h
r242990r242991
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
r242990r242991
444444   ATTR_HOT inline const state_e state() const { return m_state; }
445445   ATTR_HOT inline void set_state(const state_e astate)
446446   {
447      nl_assert(astate != STATE_NONEX);
447      assert(astate != STATE_NONEX);
448448      m_state = astate;
449449   }
450450
r242990r242991
453453protected:
454454   ATTR_COLD virtual void save_register()
455455   {
456      save(NLNAME(m_state));
456      save(NAME(m_state));
457457      netlist_owned_object_t::save_register();
458458   }
459459
r242990r242991
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);
r242990r242991
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;
r242990r242991
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()
r242990r242991
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
r242990r242991
710710    */
711711   ATTR_COLD inline netlist_sig_t &Q_state_ptr()
712712   {
713      nl_assert(family() == LOGIC);
713      assert(family() == LOGIC);
714714      return m_cur_Q;
715715   }
716716
r242990r242991
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   {
741      //nl_assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG);
742      nl_assert(family() == ANALOG);
741      //assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG);
742      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   {
748      //nl_assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG);
749      nl_assert(family() == ANALOG);
748      //assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG);
749      assert(family() == ANALOG);
750750      return m_cur_Analog;
751751   }
752752
r242990r242991
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;
r242990r242991
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
r242990r242991
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()
885885   {
886      save(NLNAME(m_param));
886      save(NAME(m_param));
887887      netlist_param_t::save_register();
888888   }
889889
890890private:
891   nl_double m_param;
891   double m_param;
892892};
893893
894894class netlist_param_int_t : public netlist_param_t
r242990r242991
905905protected:
906906   ATTR_COLD virtual void save_register()
907907   {
908      save(NLNAME(m_param));
908      save(NAME(m_param));
909909      netlist_param_t::save_register();
910910   }
911911
r242990r242991
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:
r242990r242991
988988
989989   ATTR_HOT inline const netlist_sig_t INPLOGIC(const netlist_logic_input_t &inp) const
990990   {
991      nl_assert(inp.state() != netlist_input_t::STATE_INP_PASSIVE);
991      assert(inp.state() != netlist_input_t::STATE_INP_PASSIVE);
992992      return inp.Q();
993993   }
994994
r242990r242991
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   }
r242990r242991
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
r242990r242991
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   {
r242990r242991
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   {
r242990r242991
12621262
12631263ATTR_HOT inline netlist_logic_net_t & RESTRICT netlist_net_t::as_logic()
12641264{
1265   nl_assert(family() == LOGIC);
1265   assert(family() == LOGIC);
12661266   return static_cast<netlist_logic_net_t &>(*this);
12671267}
12681268
12691269ATTR_HOT inline const netlist_logic_net_t & RESTRICT netlist_net_t::as_logic() const
12701270{
1271    nl_assert(family() == LOGIC);
1271   assert(family() == LOGIC);
12721272   return static_cast<const netlist_logic_net_t &>(*this);
12731273}
12741274
12751275ATTR_HOT inline netlist_analog_net_t & RESTRICT netlist_net_t::as_analog()
12761276{
1277    nl_assert(family() == ANALOG);
1277   assert(family() == ANALOG);
12781278   return static_cast<netlist_analog_net_t &>(*this);
12791279}
12801280
12811281ATTR_HOT inline const netlist_analog_net_t & RESTRICT netlist_net_t::as_analog() const
12821282{
1283   nl_assert(family() == ANALOG);
1283   assert(family() == ANALOG);
12841284   return static_cast<const netlist_analog_net_t &>(*this);
12851285}
12861286
r242990r242991
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   {
r242990r242991
13701370   }
13711371}
13721372
1373
1374// -----------------------------------------------------------------------------
1375// net_dev class factory
1376// -----------------------------------------------------------------------------
1377
1378class net_device_t_base_factory
1379{
1380   NETLIST_PREVENT_COPYING(net_device_t_base_factory)
1381public:
1382   ATTR_COLD net_device_t_base_factory(const pstring &name, const pstring &classname,
1383         const pstring &def_param)
1384   : m_name(name), m_classname(classname), m_def_param(def_param)
1385   {}
1386
1387   ATTR_COLD virtual ~net_device_t_base_factory() {}
1388
1389   ATTR_COLD virtual netlist_device_t *Create() const = 0;
1390
1391   ATTR_COLD const pstring &name() const { return m_name; }
1392   ATTR_COLD const pstring &classname() const { return m_classname; }
1393   ATTR_COLD const pstring &param_desc() const { return m_def_param; }
1394   ATTR_COLD const nl_util::pstring_list term_param_list();
1395   ATTR_COLD const nl_util::pstring_list def_params();
1396
1397protected:
1398   pstring m_name;                             /* device name */
1399   pstring m_classname;                        /* device class name */
1400   pstring m_def_param;                        /* default parameter */
1401};
1402
1403template <class C>
1404class net_device_t_factory : public net_device_t_base_factory
1405{
1406   NETLIST_PREVENT_COPYING(net_device_t_factory)
1407public:
1408   ATTR_COLD net_device_t_factory(const pstring &name, const pstring &classname,
1409         const pstring &def_param)
1410   : net_device_t_base_factory(name, classname, def_param) { }
1411
1412   ATTR_COLD netlist_device_t *Create() const
1413   {
1414      netlist_device_t *r = new C();
1415      //r->init(setup, name);
1416      return r;
1417   }
1418};
1419
1420class netlist_factory_t
1421{
1422public:
1423   typedef plinearlist_t<net_device_t_base_factory *> list_t;
1424
1425   ATTR_COLD netlist_factory_t();
1426   ATTR_COLD ~netlist_factory_t();
1427
1428   ATTR_COLD void initialize();
1429
1430   template<class _C>
1431   ATTR_COLD void register_device(const pstring &name, const pstring &classname,
1432         const pstring &def_param)
1433   {
1434      m_list.add(new net_device_t_factory< _C >(name, classname, def_param) );
1435   }
1436
1437   ATTR_COLD netlist_device_t *new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const;
1438   ATTR_COLD netlist_device_t *new_device_by_name(const pstring &name, netlist_setup_t &setup) const;
1439   ATTR_COLD net_device_t_base_factory * factory_by_name(const pstring &name, netlist_setup_t &setup) const;
1440
1441   const list_t &list() { return m_list; }
1442
1443private:
1444   list_t m_list;
1445
1446};
1447
1448
13731449#endif /* NLBASE_H_ */
trunk/src/emu/netlist/nl_config.h
r242990r242991
1010
1111/* FIXME: at some time, make it compile on it's own */
1212
13#include "osdcore.h"
14#include "corealloc.h"
15#include <math.h>
16#include <exception>
17#include <typeinfo>
13#include "emu.h"
1814
1915//============================================================
2016//  SETUP
r242990r242991
4945
5046#define NETLIST_GMIN_DEFAULT    (1e-9)
5147
52//typedef double   nl_double;
53
54#define nl_double double
55
5648//============================================================
5749//  DEBUGGING
5850//============================================================
r242990r242991
110102#define end_timing(v)           do { } while (0)
111103#endif
112104
113// this macro passes an item followed by a string version of itself as two consecutive parameters
114#define NLNAME(x) x, #x
115105
116106//============================================================
117//  Exceptions
118//============================================================
119
120// emu_fatalerror is a generic fatal exception that provides an error string
121class nl_fatalerror : public std::exception
122{
123public:
124    nl_fatalerror(const char *format, ...) ATTR_PRINTF(2,3)
125    {
126        char text[1024];
127        va_list ap;
128        va_start(ap, format);
129        vsprintf(text, format, ap);
130        va_end(ap);
131        osd_printf_error("%s\n", text);
132    }
133    nl_fatalerror(const char *format, va_list ap)
134    {
135        char text[1024];
136        vsprintf(text, format, ap);
137        osd_printf_error("%s\n", text);
138    }
139};
140
141//============================================================
142//  Memory allocation
143//============================================================
144
145#define nl_alloc(T, ...)        global_alloc(T(__VA_ARGS__))
146#define nl_alloc_array(T, N)    global_alloc_array(T, N)
147
148#define nl_free(_ptr)           global_free(_ptr)
149#define nl_free_array(_ptr)     global_free_array(_ptr)
150
151
152//============================================================
153//  Asserts
154//============================================================
155
156#ifdef MAME_DEBUG
157#define nl_assert(x)               do { if (!(x)) throw nl_fatalerror("assert: %s:%d: %s", __FILE__, __LINE__, #x); } while (0)
158#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)
159#else
160#define nl_assert(x)               do { } while (0)
161//#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)
163#endif
164
165//============================================================
166107//  Compiling standalone
167108//============================================================
168109
169110// Compiling without mame ?
170111
171112#ifndef ATTR_HOT
172#warning ATTR_HOT not defined
113//#warning ATTR_HOT not defined
173114
174115// standard C includes
175116#include <math.h>
r242990r242991
191132#define UNEXPECTED
192133#define ATTR_UNUSED             __attribute__((__unused__))
193134
135// this macro passes an item followed by a string version of itself as two consecutive parameters
136#define NAME(x) x, #x
137
194138/* 8-bit values */
195139typedef unsigned char                       UINT8;
196140typedef signed char                         INT8;
r242990r242991
216160#endif
217161#endif
218162
163#ifdef MAME_DEBUG
164#define assert(x)               do { if (!(x)) throw emu_fatalerror("assert: %s:%d: %s", __FILE__, __LINE__, #x); } while (0)
165#define assert_always(x, msg)   do { if (!(x)) throw emu_fatalerror("Fatal error: %s\nCaused by assert: %s:%d: %s", msg, __FILE__, __LINE__, #x); } while (0)
166#else
167#define assert(x)               do { } while (0)
168//#define assert_always(x, msg)   do { if (!(x)) throw emu_fatalerror("Fatal error: %s (%s:%d)", msg, __FILE__, __LINE__); } while (0)
169#define assert_always(x, msg)   do { } while (0)
170#endif
171
219172/* U64 and S64 are used to wrap long integer constants. */
220173#if defined(__GNUC__) || defined(_MSC_VER)
221174#define U64(val) val##ULL
trunk/src/emu/netlist/nl_dice_compat.h
r242990r242991
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 */
15//#define CHIP(_n, _t) netlist.register_dev(NET_NEW(_t ## _dip), _n);
16#define CHIP(_n, _t) setup.register_dev( new nld_ ## _t ## _dip(), _n);
2217
23#ifdef NETLIST_DEVELOPMENT
24#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
28
2918#define CONNECTION( ... ) CONNECTIONY( CONNECTIONX( __VA_ARGS__ ) )
3019#define CONNECTIONY(_a) _a
3120#define CONNECTIONX(_a, _b, _c, _d) setup.register_link(_a "." # _b, _c "." # _d);
r242990r242991
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
r242990r242991
1// license:GPL-2.0+
2// copyright-holders:Couriersud
3/***************************************************************************
4
5    nl_factory.c
6
7    Discrete netlist implementation.
8
9****************************************************************************
10
11    Couriersud reserves the right to license the code under a less restrictive
12    license going forward.
13
14    Copyright Nicola Salmoria and the MAME team
15    All rights reserved.
16
17    Redistribution and use of this code or any derivative works are permitted
18    provided that the following conditions are met:
19
20    * Redistributions may not be sold, nor may they be used in a commercial
21    product or activity.
22
23    * Redistributions that are modified from the original source must include the
24    complete source code, including the source code for all components used by a
25    binary built from the modified sources. However, as a special exception, the
26    source code distributed need not include anything that is normally distributed
27    (in either source or binary form) with the major components (compiler, kernel,
28    and so on) of the operating system on which the executable runs, unless that
29    component itself accompanies the executable.
30
31    * Redistributions must reproduce the above copyright notice, this list of
32    conditions and the following disclaimer in the documentation and/or other
33    materials provided with the distribution.
34
35    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
36    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
39    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
40    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
41    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
42    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
43    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
44    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
45    POSSIBILITY OF SUCH DAMAGE.
46
47
48****************************************************************************/
49
50#include "nl_factory.h"
51#include "nl_setup.h"
52
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
74netlist_factory_t::netlist_factory_t()
75{
76}
77
78netlist_factory_t::~netlist_factory_t()
79{
80   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
81   {
82      net_device_t_base_factory *p = *e;
83      global_free(p);
84   }
85   m_list.clear();
86}
87
88netlist_device_t *netlist_factory_t::new_device_by_classname(const pstring &classname) const
89{
90   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
91   {
92      net_device_t_base_factory *p = *e;
93      if (strcmp(p->classname(), classname) == 0)
94      {
95         netlist_device_t *ret = p->Create();
96         return ret;
97      }
98      p++;
99   }
100   return NULL; // appease code analysis
101}
102
103netlist_device_t *netlist_factory_t::new_device_by_name(const pstring &name, netlist_setup_t &setup) const
104{
105   net_device_t_base_factory *f = factory_by_name(name, setup);
106   return f->Create();
107}
108
109net_device_t_base_factory * netlist_factory_t::factory_by_name(const pstring &name, netlist_setup_t &setup) const
110{
111   for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e))
112   {
113      net_device_t_base_factory *p = *e;
114      if (strcmp(p->name(), name) == 0)
115      {
116         return p;
117      }
118      p++;
119   }
120   setup.netlist().error("Class %s not found!\n", name.cstr());
121   return NULL; // appease code analysis
122}
trunk/src/emu/netlist/nl_factory.h
r242990r242991
1// license:GPL-2.0+
2// copyright-holders:Couriersud
3/*
4 * nl_factory.h
5 *
6 *
7 */
8
9#ifndef NLFACTORY_H_
10#define NLFACTORY_H_
11
12#include "nl_config.h"
13#include "plists.h"
14#include "nl_base.h"
15#if 0
16#include "nl_time.h"
17#include "nl_util.h"
18#include "pstate.h"
19#endif
20#include "pstring.h"
21
22// -----------------------------------------------------------------------------
23// net_dev class factory
24// -----------------------------------------------------------------------------
25
26class net_device_t_base_factory
27{
28   NETLIST_PREVENT_COPYING(net_device_t_base_factory)
29public:
30   ATTR_COLD net_device_t_base_factory(const pstring &name, const pstring &classname,
31         const pstring &def_param)
32   : m_name(name), m_classname(classname), m_def_param(def_param)
33   {}
34
35   ATTR_COLD virtual ~net_device_t_base_factory() {}
36
37   ATTR_COLD virtual netlist_device_t *Create() const = 0;
38
39   ATTR_COLD const pstring &name() const { return m_name; }
40   ATTR_COLD const pstring &classname() const { return m_classname; }
41   ATTR_COLD const pstring &param_desc() const { return m_def_param; }
42   ATTR_COLD const nl_util::pstring_list term_param_list();
43   ATTR_COLD const nl_util::pstring_list def_params();
44
45protected:
46   pstring m_name;                             /* device name */
47   pstring m_classname;                        /* device class name */
48   pstring m_def_param;                        /* default parameter */
49};
50
51template <class C>
52class net_device_t_factory : public net_device_t_base_factory
53{
54   NETLIST_PREVENT_COPYING(net_device_t_factory)
55public:
56   ATTR_COLD net_device_t_factory(const pstring &name, const pstring &classname,
57         const pstring &def_param)
58   : net_device_t_base_factory(name, classname, def_param) { }
59
60   ATTR_COLD netlist_device_t *Create() const
61   {
62      netlist_device_t *r = nl_alloc(C);
63      //r->init(setup, name);
64      return r;
65   }
66};
67
68class netlist_factory_t
69{
70public:
71   typedef plinearlist_t<net_device_t_base_factory *> list_t;
72
73   ATTR_COLD netlist_factory_t();
74   ATTR_COLD ~netlist_factory_t();
75
76   template<class _C>
77   ATTR_COLD void register_device(const pstring &name, const pstring &classname,
78         const pstring &def_param)
79   {
80      m_list.add(nl_alloc(net_device_t_factory< _C >, name, classname, def_param));
81   }
82
83   ATTR_COLD netlist_device_t *new_device_by_classname(const pstring &classname) const;
84   ATTR_COLD netlist_device_t *new_device_by_name(const pstring &name, netlist_setup_t &setup) const;
85   ATTR_COLD net_device_t_base_factory * factory_by_name(const pstring &name, netlist_setup_t &setup) const;
86
87   const list_t &list() { return m_list; }
88
89private:
90   list_t m_list;
91
92};
93
94
95#endif /* NLFACTORY_H_ */
trunk/src/emu/netlist/nl_lists.h
r242990r242991
5959      }
6060      *i = e;
6161      inc_stat(m_prof_sort);
62      nl_assert(m_end - m_list < _Size);
62      assert(m_end - m_list < _Size);
6363   }
6464
6565   ATTR_HOT inline const entry_t *pop()
trunk/src/emu/netlist/nl_parser.c
r242990r242991
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
r242990r242991
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());
r242990r242991
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++;
r242990r242991
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
r242990r242991
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
r242990r242991
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"
1615#include "analog/nld_twoterm.h"
1716
18//FIXME: we need a nl_getenv
19#include <stdlib.h>
20
2117static NETLIST_START(base)
2218   TTL_INPUT(ttlhigh, 1)
2319   TTL_INPUT(ttllow, 0)
r242990r242991
3834   , m_proxy_cnt(0)
3935{
4036   netlist.set_setup(this);
41   m_factory = nl_alloc(netlist_factory_t);
4237}
4338
4439void netlist_setup_t::init()
4540{
46   nl_initialize_factory(factory());
41   m_factory.initialize();
4742   NETLIST_NAME(base)(*this);
4843}
4944
r242990r242991
5752   m_params_temp.clear();
5853
5954   netlist().set_setup(NULL);
60   nl_free(m_factory);
6155
6256   pstring::resetmem();
6357}
r242990r242991
9589   return dev;
9690}
9791
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
10692template <class T>
10793static void remove_start_with(T &hm, pstring &sw)
10894{
r242990r242991
392378
393379nld_base_d_to_a_proxy *netlist_setup_t::get_d_a_proxy(netlist_output_t &out)
394380{
395   nl_assert(out.isFamily(netlist_terminal_t::LOGIC));
381   assert(out.isFamily(netlist_terminal_t::LOGIC));
396382
397383   //printf("proxy for %s\n", out.name().cstr());;
398384   netlist_logic_output_t &out_cast = dynamic_cast<netlist_logic_output_t &>(out);
r242990r242991
401387   if (proxy == NULL)
402388   {
403389      // create a new one ...
404      proxy = nl_alloc(nld_d_to_a_proxy ,out);
390      proxy = new nld_d_to_a_proxy(out);
405391      pstring x = pstring::sprintf("proxy_da_%s_%d", out.name().cstr(), m_proxy_cnt);
406392      m_proxy_cnt++;
407393
r242990r242991
430416{
431417   if (out.isFamily(netlist_terminal_t::ANALOG) && in.isFamily(netlist_terminal_t::LOGIC))
432418   {
433      nld_a_to_d_proxy *proxy = nl_alloc(nld_a_to_d_proxy, in);
419      nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(in);
434420      pstring x = pstring::sprintf("proxy_ad_%s_%d", in.name().cstr(), m_proxy_cnt);
435421      m_proxy_cnt++;
436422
r242990r242991
466452   else if (inp.isFamily(netlist_terminal_t::LOGIC))
467453   {
468454      NL_VERBOSE_OUT(("connect_terminal_input: connecting proxy\n"));
469      nld_a_to_d_proxy *proxy = nl_alloc(nld_a_to_d_proxy, inp);
455      nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(inp);
470456      pstring x = pstring::sprintf("proxy_ad_%s_%d", inp.name().cstr(), m_proxy_cnt);
471457      m_proxy_cnt++;
472458
r242990r242991
513499
514500void netlist_setup_t::connect_terminals(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2)
515501{
516   //nl_assert(in.isType(netlist_terminal_t::TERMINAL));
517   //nl_assert(out.isType(netlist_terminal_t::TERMINAL));
502   //assert(in.isType(netlist_terminal_t::TERMINAL));
503   //assert(out.isType(netlist_terminal_t::TERMINAL));
518504
519505   if (t1.has_net() && t2.has_net())
520506   {
r242990r242991
534520   else
535521   {
536522      NL_VERBOSE_OUT(("adding net ...\n"));
537      netlist_analog_net_t *anet =  nl_alloc(netlist_analog_net_t);
523      netlist_analog_net_t *anet =  new netlist_analog_net_t();
538524      t1.set_net(*anet);
539525      //m_netlist.solver()->m_nets.add(anet);
540526      // FIXME: Nets should have a unique name
r242990r242991
697683
698684void netlist_setup_t::start_devices()
699685{
700    //FIXME: we need a nl_getenv
701686   if (getenv("NL_LOGS"))
702687   {
703688      NL_VERBOSE_OUT(("Creating dynamic logs ...\n"));
r242990r242991
706691      {
707692         NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
708693         NL_VERBOSE_OUT(("%d: <%s>\n",i, ll[i].cstr()));
709         netlist_device_t *nc = factory().new_device_by_classname("nld_log");
694         netlist_device_t *nc = factory().new_device_by_classname("nld_log", *this);
710695         pstring name = "log_" + ll[i];
711696         register_dev(nc, name);
712697         register_link(name + ".I", ll[i]);
trunk/src/emu/netlist/nl_setup.h
r242990r242991
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"
1314
1415//============================================================
1516//  MACROS / inline netlist definitions
r242990r242991
2324#define ALIAS(_alias, _name)                                                        \
2425   setup.register_alias(# _alias, # _name);
2526
26//#define NET_NEW(_type)  setup.factory().new_device_by_classname(NETLIB_NAME_STR(_type), setup)
27#define NET_NEW(_type)  setup.factory().new_device_by_classname(NETLIB_NAME_STR(_type), setup)
2728
2829#define NET_REGISTER_DEV(_type, _name)                                              \
29      setup.register_dev(NETLIB_NAME_STR(_type), # _name);
30      setup.register_dev(NET_NEW(_type), # _name);
3031
3132#define NET_REMOVE_DEV(_name)                                                       \
3233      setup.remove_dev(# _name);
r242990r242991
6566      setup.namespace_pop();
6667
6768// ----------------------------------------------------------------------------------------
69// FIXME: Clean this up
70// ----------------------------------------------------------------------------------------
71
72//class NETLIB_NAME(analog_callback);
73
74// ----------------------------------------------------------------------------------------
6875// netlist_setup_t
6976// ----------------------------------------------------------------------------------------
7077
71// Forward definition so we keep nl_factory.h out of the public
72class netlist_factory_t;
73
7478class netlist_setup_t
7579{
7680   NETLIST_PREVENT_COPYING(netlist_setup_t)
r242990r242991
113117
114118   netlist_base_t &netlist() { return m_netlist; }
115119   const netlist_base_t &netlist() const { return m_netlist; }
120   netlist_factory_t &factory() { return m_factory; }
121   const netlist_factory_t &factory() const { return m_factory; }
116122
117123   pstring build_fqn(const pstring &obj_name) const;
118124
119125   netlist_device_t *register_dev(netlist_device_t *dev, const pstring &name);
120   netlist_device_t *register_dev(const pstring &classname, const pstring &name);
121126   void remove_dev(const pstring &name);
122127
123128   void register_model(const pstring &model);
r242990r242991
146151   void namespace_push(const pstring &aname);
147152   void namespace_pop();
148153
149    netlist_factory_t &factory() { return *m_factory; }
150    const netlist_factory_t &factory() const { return *m_factory; }
154   /* not ideal, but needed for save_state */
155   tagmap_terminal_t  m_terminals;
151156
152    /* not ideal, but needed for save_state */
153    tagmap_terminal_t  m_terminals;
157   void print_stats() const;
154158
155    void print_stats() const;
156
157159protected:
158160
159161private:
r242990r242991
165167   tagmap_link_t   m_links;
166168   tagmap_nstring_t m_params_temp;
167169
168   netlist_factory_t *m_factory;
170   netlist_factory_t m_factory;
169171
170172   plinearlist_t<pstring> m_models;
171173
trunk/src/emu/netlist/plists.h
r242990r242991
2828      if (m_num_elements == 0)
2929         m_list = NULL;
3030      else
31         m_list = nl_alloc_array(_ListClass, m_num_elements);
31         m_list = new _ListClass[m_num_elements];
3232      m_count = 0;
3333   }
3434
r242990r242991
3838      if (m_num_elements == 0)
3939         m_list = NULL;
4040      else
41         m_list = nl_alloc_array(_ListClass, m_num_elements);
41         m_list = new _ListClass[m_num_elements];
4242      m_count = 0;
4343      for (int i=0; i<rhs.count(); i++)
4444      {
r242990r242991
6060   ATTR_COLD ~plinearlist_t()
6161   {
6262      if (m_list != NULL)
63          nl_free_array(m_list);
63         delete[] m_list;
6464      m_list = NULL;
6565   }
6666
r242990r242991
108108
109109   ATTR_HOT inline void remove_at(const int pos)
110110   {
111      nl_assert((pos>=0) && (pos<m_count));
111      assert((pos>=0) && (pos<m_count));
112112      m_count--;
113113      for (int i = pos; i < m_count; i++)
114114      {
r242990r242991
118118
119119   ATTR_HOT inline void swap(const int pos1, const int pos2)
120120   {
121      nl_assert((pos1>=0) && (pos1<m_count));
122      nl_assert((pos2>=0) && (pos2<m_count));
121      assert((pos1>=0) && (pos1<m_count));
122      assert((pos2>=0) && (pos2<m_count));
123123      _ListClass tmp = m_list[pos1];
124124      m_list[pos1] = m_list[pos2];
125125      m_list[pos2] =tmp;
r242990r242991
157157   {
158158      for (_ListClass *i = m_list; i < m_list + m_count; i++)
159159      {
160         nl_free(*i);
160         delete *i;
161161      }
162162      clear();
163163   }
164164
165165private:
166   ATTR_COLD void resize(const int new_size)
166   ATTR_HOT inline void resize(const int new_size)
167167   {
168168      int cnt = count();
169169      if (new_size > 0)
170170      {
171         _ListClass *m_new = nl_alloc_array(_ListClass, new_size);
171         _ListClass *m_new = new _ListClass[new_size];
172172         _ListClass *pd = m_new;
173173
174174         if (cnt > new_size)
r242990r242991
176176         for (_ListClass *ps = m_list; ps < m_list + cnt; ps++, pd++)
177177            *pd = *ps;
178178         if (m_list != NULL)
179            nl_free_array(m_list);
179            delete[] m_list;
180180         m_list = m_new;
181181         m_count = cnt;
182182      }
183183      else
184184      {
185185         if (m_list != NULL)
186             nl_free_array(m_list);
186            delete[] m_list;
187187         m_list = NULL;
188188         m_count = 0;
189189      }
r242990r242991
331331            }
332332            p = p->m_next;
333333         }
334         nl_assert_always(false, "element not found");
334         assert_always(false, "element not found");
335335      }
336336   }
337337
r242990r242991
357357      _ListClass **p = &m_head;
358358      while (*p != &elem)
359359      {
360         nl_assert(*p != NULL);
360         assert(*p != NULL);
361361         p = &((*p)->m_next);
362362      }
363363      (*p) = elem.m_next;
trunk/src/emu/netlist/pstate.c
r242990r242991
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));
31   pstate_entry_t *p = nl_alloc(pstate_entry_t, stname, dt, owner, size, count, ptr, is_ptr);
30   pstate_entry_t *p = new pstate_entry_t(stname, dt, owner, size, count, ptr, is_ptr);
3231   m_save.add(p);
3332}
3433
r242990r242991
6160      if (m_save[i]->m_dt == DT_CUSTOM)
6261         m_save[i]->m_callback->on_post_load();
6362}
64
65template<> ATTR_COLD void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname)
66{
67    //save_state_ptr(stname, DT_CUSTOM, 0, 1, &state);
68    pstate_entry_t *p = nl_alloc(pstate_entry_t, stname, owner, &state);
69    m_save.add(p);
70    state.register_state(*this, stname);
71}
trunk/src/emu/netlist/pstate.h
r242990r242991
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
r242990r242991
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);
r242990r242991
147145   pstate_entry_t::list_t m_save;
148146};
149147
150template<> ATTR_COLD void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname);
148template<> ATTR_COLD inline void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname)
149{
150   //save_state_ptr(stname, DT_CUSTOM, 0, 1, &state);
151   pstate_entry_t *p = new pstate_entry_t(stname, owner, &state);
152   m_save.add(p);
153   state.register_state(*this, stname);
154}
151155
152156template<> ATTR_COLD inline void pstate_manager_t::save_item(netlist_time &nlt, const void *owner, const pstring &stname)
153157{
trunk/src/emu/netlist/pstring.c
r242990r242991
55
66#include "pstring.h"
77#include <cstdio>
8#include <stdlib.h>
98
109
1110// The following will work on linux, however not on Windows ....
r242990r242991
1413//pstring::str_t *pstring::m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
1514
1615pblockpool pstring::m_pool;
16
1717pstring::str_t pstring::m_zero;
1818
1919/*
r242990r242991
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)
r242990r242991
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
r242990r242991
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/render.h
r242990r242991
4646#ifndef __RENDER_H__
4747#define __RENDER_H__
4848
49//#include "osdepend.h"
49#include "osdepend.h"
5050
5151#include <math.h>
5252
trunk/src/emu/rendfont.c
r242990r242991
1414#include "emuopts.h"
1515#include <zlib.h>
1616
17#include "osdepend.h"
1817#include "uismall.fh"
1918
2019
trunk/src/emu/rendfont.h
r242990r242991
1313
1414#include "render.h"
1515
16// forward instead of include
17class osd_font;
1816
1917//**************************************************************************
2018//  TYPE DEFINITIONS
r242990r242991
9391   dynamic_array<glyph> m_glyphs[256];     // array of glyph subtables
9492   dynamic_array<char> m_rawdata;          // pointer to the raw data for the font
9593   UINT64              m_rawsize;          // size of the raw font data
96   osd_font            *m_osdfont;          // handle to the OSD font
94   osd_font            m_osdfont;          // handle to the OSD font
9795
9896   // constants
9997   static const int CACHED_CHAR_SIZE       = 12;
trunk/src/emu/rendutil.h
r242990r242991
1212#ifndef __RENDUTIL_H__
1313#define __RENDUTIL_H__
1414
15#include "osdepend.h"
1516#include "render.h"
1617
1718#include <math.h>
trunk/src/emu/save.c
r242990r242991
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//-------------------------------------------------
r242990r242991
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//-------------------------------------------------
r242990r242991
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
r242990r242991
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/emu/sound/rf5c400.c
r242990r242991
129129
130130         if (env_phase == PHASE_NONE) break;
131131
132         tmp = rom[(pos>>16) & m_rommask];
132         tmp = rom[pos>>16];
133133         switch ( type )
134134         {
135135            case TYPE_16:
r242990r242991
331331   }
332332
333333   m_stream = stream_alloc(0, 2, clock()/384);
334
335   m_rommask = m_rom.length() - 1;
336334}
337335
338336
trunk/src/emu/sound/rf5c400.h
r242990r242991
9898private:
9999   required_region_ptr<INT16> m_rom;
100100
101   UINT32 m_rommask;
102
103101   sound_stream *m_stream;
104102
105103   double m_env_ar_table[0x9f];
trunk/src/emu/ui/filemngr.c
r242990r242991
2020#include "ui/swlist.h"
2121#include "ui/filemngr.h"
2222#include "ui/filesel.h"
23#include "ui/miscmenu.h"
2423
2524
2625/***************************************************************************
r242990r242991
3130//  ctor
3231//-------------------------------------------------
3332
34ui_menu_file_manager::ui_menu_file_manager(running_machine &machine, render_container *container, const char *warnings) : ui_menu(machine, container)
33ui_menu_file_manager::ui_menu_file_manager(running_machine &machine, render_container *container) : ui_menu(machine, container)
3534{
36   // This warning string is used when accessing from the force_file_manager call, i.e.
37   // when the file manager is loaded top front in the case of mandatory image devices
38   if (warnings)
39      m_warnings.cpy(warnings);
40   else
41      m_warnings.reset();
4235}
4336
4437
r242990r242991
108101   bool first_entry = true;
109102   astring prev_owner;
110103
111   if (m_warnings)
112   {
113      item_append(m_warnings, NULL, MENU_FLAG_DISABLE, NULL);
114      item_append("", NULL, MENU_FLAG_DISABLE, NULL);
115   }
116     
117104   // cycle through all devices for this system
118105   device_iterator iter(machine().root_device());
119106   tagmap_t<UINT8> devtags;
r242990r242991
185172      }
186173   }
187174}
188
189// force file manager menu
190void ui_menu_file_manager::force_file_manager(running_machine &machine, render_container *container, const char *warnings)
191{   
192   // reset the menu stack
193   ui_menu::stack_reset(machine);
194   
195   // add the quit entry followed by the game select entry
196   ui_menu *quit = auto_alloc_clear(machine, ui_menu_quit_game(machine, container));
197   quit->set_special_main_menu(true);
198   ui_menu::stack_push(quit);
199   ui_menu::stack_push(auto_alloc_clear(machine, ui_menu_file_manager(machine, container, warnings)));
200   
201   // force the menus on
202   machine.ui().show_menu();
203   
204   // make sure MAME is paused
205   machine.pause();
206}
trunk/src/emu/ui/filemngr.h
r242990r242991
2020   astring current_file;
2121   device_image_interface *selected_device;
2222
23   static void force_file_manager(running_machine &machine, render_container *container, const char *warnings);
24
25   ui_menu_file_manager(running_machine &machine, render_container *container, const char *warnings);
23   ui_menu_file_manager(running_machine &machine, render_container *container);
2624   virtual ~ui_menu_file_manager();
2725   virtual void populate();
2826   virtual void handle();
2927   virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
3028
3129   void fill_image_line(device_image_interface *img, astring &instance, astring &filename);
32
33private:
34   astring m_warnings;
3530};
3631
3732#endif  /* __UI_FILEMNGR_H__ */
trunk/src/emu/ui/imgcntrl.c
r242990r242991
1616#include "ui/filesel.h"
1717#include "ui/swlist.h"
1818#include "zippath.h"
19#include "audit.h"
2019
2120
2221/***************************************************************************
r242990r242991
133132void ui_menu_control_device_image::load_software_part()
134133{
135134   astring temp_name(sld->list_name(), ":", swi->shortname(), ":", swp->name());
136
137   driver_enumerator drivlist(machine().options(), machine().options().system_name());
138   media_auditor auditor(drivlist);
139   media_auditor::summary summary = auditor.audit_software(sld->list_name(), (software_info *)swi, AUDIT_VALIDATE_FAST);
140   // if everything looks good, load software
141   if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
142      hook_load(temp_name, true);
143   else
144   {
145      popmessage("The selected game is missing one or more required ROM or CHD images. Please select a different game.");
146      state = SELECT_SOFTLIST;
147   }
135   hook_load(temp_name, true);
148136}
149137
150138
r242990r242991
229217      {
230218         swp = swi->first_part();
231219         load_software_part();
220         ui_menu::stack_pop(machine());
232221      }
233222      break;
234223
r242990r242991
236225      switch(submenu_result) {
237226      case ui_menu_software_parts::T_ENTRY: {
238227         load_software_part();
228         ui_menu::stack_pop(machine());
239229         break;
240230      }
241231
trunk/src/emu/ui/imgcntrl.h
r242990r242991
1414#ifndef __UI_IMGCNTRL_H__
1515#define __UI_IMGCNTRL_H__
1616
17#include "drivenum.h"
18
1917// ======================> ui_menu_control_device_image
2018
2119class ui_menu_control_device_image : public ui_menu {
trunk/src/emu/ui/imginfo.c
r0r242991
1/***************************************************************************
2
3    ui/imginfo.c
4
5    Image info screen
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#include "emu.h"
13#include "ui/menu.h"
14#include "ui/imginfo.h"
15
16
17/***************************************************************************
18    IMPLEMENTATION
19***************************************************************************/
20
21//-------------------------------------------------
22//  ctor
23//-------------------------------------------------
24
25ui_menu_image_info::ui_menu_image_info(running_machine &machine, render_container *container) : ui_menu(machine, container)
26{
27}
28
29
30//-------------------------------------------------
31//  dtor
32//-------------------------------------------------
33
34ui_menu_image_info::~ui_menu_image_info()
35{
36}
37
38
39//-------------------------------------------------
40//  populate
41//-------------------------------------------------
42
43void ui_menu_image_info::populate()
44{
45   item_append(machine().system().description, NULL, MENU_FLAG_DISABLE, NULL);
46   item_append("", NULL, MENU_FLAG_DISABLE, NULL);
47
48   image_interface_iterator iter(machine().root_device());
49   for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
50         image_info(image);
51}
52
53
54//-------------------------------------------------
55//  handle
56//-------------------------------------------------
57
58void ui_menu_image_info::handle()
59{
60   // process the menu
61   process(0);
62}
63
64
65//-------------------------------------------------
66//  image_info - display image info for a specific
67//  image interface device
68//-------------------------------------------------
69
70void ui_menu_image_info::image_info(device_image_interface *image)
71{
72   if (image->exists())
73   {
74      // display device type and filename
75      item_append(image->brief_instance_name(), image->basename(), 0, NULL);
76
77      // if image has been loaded through softlist, let's add some more info
78      if (image->software_entry())
79      {
80         astring string;
81
82         // display long filename
83         item_append(image->longname(), "", MENU_FLAG_DISABLE, NULL);
84         
85         // display manufacturer and year
86         string.catprintf("%s, %s", image->manufacturer(), image->year());
87         item_append(string, "", MENU_FLAG_DISABLE, NULL);
88
89         // display supported information, if available
90         switch (image->supported())
91         {
92            case SOFTWARE_SUPPORTED_NO:
93               item_append("Not supported", "", MENU_FLAG_DISABLE, NULL);
94               break;
95            case SOFTWARE_SUPPORTED_PARTIAL:
96               item_append("Partially supported", "", MENU_FLAG_DISABLE, NULL);
97               break;
98            default:
99               break;
100         }
101      }
102   }
103   else
104      item_append(image->brief_instance_name(), "[empty]", 0, NULL);
105   item_append("", NULL, MENU_FLAG_DISABLE, NULL);
106}
trunk/src/emu/ui/imginfo.h
r0r242991
1/***************************************************************************
2
3    ui/imginfo.h
4
5    Image info screen
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#pragma once
13
14#ifndef __UI_IMGINFO_H__
15#define __UI_IMGINFO_H__
16
17class ui_menu_image_info : public ui_menu
18{
19public:
20   ui_menu_image_info(running_machine &machine, render_container *container);
21   virtual ~ui_menu_image_info();
22   virtual void populate();
23   virtual void handle();
24
25private:
26   void image_info(device_image_interface *image);
27};
28
29#endif // __UI_IMGINFO_H__
trunk/src/emu/ui/info.c
r242990r242991
1/***************************************************************************
2
3    ui/info.c
4
5    System and image info screens
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#include "emu.h"
13#include "ui/menu.h"
14#include "ui/info.h"
15#include "ui/ui.h"
16
17/*-------------------------------------------------
18  menu_game_info - handle the game information
19  menu
20 -------------------------------------------------*/
21
22ui_menu_game_info::ui_menu_game_info(running_machine &machine, render_container *container) : ui_menu(machine, container)
23{
24}
25
26ui_menu_game_info::~ui_menu_game_info()
27{
28}
29
30void ui_menu_game_info::populate()
31{
32   astring tempstring;
33   item_append(machine().ui().game_info_astring(tempstring), NULL, MENU_FLAG_MULTILINE, NULL);
34}
35
36void ui_menu_game_info::handle()
37{
38   // process the menu
39   process(0);
40}
41
42
43/*-------------------------------------------------
44  ui_menu_image_info - handle the image information
45  menu
46 -------------------------------------------------*/
47
48ui_menu_image_info::ui_menu_image_info(running_machine &machine, render_container *container) : ui_menu(machine, container)
49{
50}
51
52ui_menu_image_info::~ui_menu_image_info()
53{
54}
55
56void ui_menu_image_info::populate()
57{
58   item_append(machine().system().description, NULL, MENU_FLAG_DISABLE, NULL);
59   item_append("", NULL, MENU_FLAG_DISABLE, NULL);
60
61   image_interface_iterator iter(machine().root_device());
62   for (device_image_interface *image = iter.first(); image != NULL; image = iter.next())
63         image_info(image);
64}
65
66void ui_menu_image_info::handle()
67{
68   // process the menu
69   process(0);
70}
71
72
73/*-------------------------------------------------
74  image_info - display image info for a specific
75  image interface device
76-------------------------------------------------*/
77
78void ui_menu_image_info::image_info(device_image_interface *image)
79{
80   if (image->exists())
81   {
82      // display device type and filename
83      item_append(image->brief_instance_name(), image->basename(), 0, NULL);
84
85      // if image has been loaded through softlist, let's add some more info
86      if (image->software_entry())
87      {
88         astring string;
89
90         // display long filename
91         item_append(image->longname(), "", MENU_FLAG_DISABLE, NULL);
92         
93         // display manufacturer and year
94         string.catprintf("%s, %s", image->manufacturer(), image->year());
95         item_append(string, "", MENU_FLAG_DISABLE, NULL);
96
97         // display supported information, if available
98         switch (image->supported())
99         {
100            case SOFTWARE_SUPPORTED_NO:
101               item_append("Not supported", "", MENU_FLAG_DISABLE, NULL);
102               break;
103            case SOFTWARE_SUPPORTED_PARTIAL:
104               item_append("Partially supported", "", MENU_FLAG_DISABLE, NULL);
105               break;
106            default:
107               break;
108         }
109      }
110   }
111   else
112      item_append(image->brief_instance_name(), "[empty]", 0, NULL);
113   item_append("", NULL, MENU_FLAG_DISABLE, NULL);
114}
trunk/src/emu/ui/info.h
r242990r242991
1/***************************************************************************
2
3    ui/info.h
4
5    System and image info screens
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#pragma once
13
14#ifndef __UI_INFO_H__
15#define __UI_INFO_H__
16
17class ui_menu_game_info : public ui_menu {
18public:
19   ui_menu_game_info(running_machine &machine, render_container *container);
20   virtual ~ui_menu_game_info();
21   virtual void populate();
22   virtual void handle();
23};
24
25
26class ui_menu_image_info : public ui_menu
27{
28public:
29   ui_menu_image_info(running_machine &machine, render_container *container);
30   virtual ~ui_menu_image_info();
31   virtual void populate();
32   virtual void handle();
33
34private:
35   void image_info(device_image_interface *image);
36};
37
38#endif // __UI_INFO_H__
trunk/src/emu/ui/mainmenu.c
r242990r242991
1919#include "ui/filemngr.h"
2020#include "ui/filesel.h"
2121#include "ui/barcode.h"
22#include "ui/info.h"
22#include "ui/imginfo.h"
2323#include "ui/inputmap.h"
2424#include "ui/mainmenu.h"
2525#include "ui/miscmenu.h"
r242990r242991
183183         break;
184184
185185      case IMAGE_MENU_FILE_MANAGER:
186         ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_manager(machine(), container, NULL)));
186         ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_file_manager(machine(), container)));
187187         break;
188188
189189      case TAPE_CONTROL:
trunk/src/emu/ui/miscmenu.c
r242990r242991
1919#include "rendutil.h"
2020
2121#include "uiinput.h"
22#include "ui/ui.h"
2223#include "ui/miscmenu.h"
2324#include "ui/filemngr.h"
2425
25#include "osdepend.h"
2626
2727/*-------------------------------------------------
2828    ui_slider_ui_handler - pushes the slider
r242990r242991
304304
305305
306306/*-------------------------------------------------
307    menu_game_info - handle the game information
308    menu
309-------------------------------------------------*/
310
311ui_menu_game_info::ui_menu_game_info(running_machine &machine, render_container *container) : ui_menu(machine, container)
312{
313}
314
315void ui_menu_game_info::populate()
316{
317   astring tempstring;
318   item_append(machine().ui().game_info_astring(tempstring), NULL, MENU_FLAG_MULTILINE, NULL);
319}
320
321void ui_menu_game_info::handle()
322{
323   /* process the menu */
324   process(0);
325}
326
327ui_menu_game_info::~ui_menu_game_info()
328{
329}
330
331/*-------------------------------------------------
307332    menu_cheat - handle the cheat menu
308333-------------------------------------------------*/
309334
trunk/src/emu/ui/miscmenu.h
r242990r242991
4444   attotime prevtime;
4545};
4646
47class ui_menu_game_info : public ui_menu {
48public:
49   ui_menu_game_info(running_machine &machine, render_container *container);
50   virtual ~ui_menu_game_info();
51   virtual void populate();
52   virtual void handle();
53};
54
4755class ui_menu_cheat : public ui_menu {
4856public:
4957   ui_menu_cheat(running_machine &machine, render_container *container);
trunk/src/emu/ui/selgame.c
r242990r242991
157157      media_auditor::summary summary = auditor.audit_media(AUDIT_VALIDATE_FAST);
158158
159159      // if everything looks good, schedule the new driver
160      if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED)
160      if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE)
161161      {
162162         machine().manager().schedule_new_driver(*driver);
163163         machine().schedule_hard_reset();
trunk/src/emu/ui/slotopt.c
r242990r242991
188188   if (menu_event != NULL && menu_event->itemref != NULL)
189189   {
190190      if ((FPTR)menu_event->itemref == 1 && menu_event->iptkey == IPT_UI_SELECT)
191      {
192         machine().options().add_slot_options(false);
193191         machine().schedule_hard_reset();
194      }
195192      else if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
196193      {
197194         device_slot_interface *slot = (device_slot_interface *)menu_event->itemref;
trunk/src/emu/ui/ui.c
r242990r242991
2020#include "uiinput.h"
2121#include "ui/mainmenu.h"
2222#include "ui/miscmenu.h"
23#include "ui/filemngr.h"
2423#include "ui/viewgfx.h"
2524#include "imagedev/cassette.h"
2625#include <ctype.h>
r242990r242991
307306
308307void ui_manager::display_startup_screens(bool first_time, bool show_disclaimer)
309308{
310   const int maxstate = 4;
309   const int maxstate = 3;
311310   int str = machine().options().seconds_to_run();
312311   bool show_gameinfo = !machine().options().skip_gameinfo();
313312   bool show_warnings = true;
r242990r242991
353352            if (show_gameinfo && game_info_astring(messagebox_text).len() > 0)
354353               set_handler(handler_messagebox_anykey, 0);
355354            break;
356
357         case 3:
358            if (image_mandatory_scan(machine(), messagebox_text).len() > 0)
359            {
360               astring warning;
361               warning.cpy("This driver requires images to be loaded in the following device(s): ").cat(messagebox_text.substr(0, messagebox_text.len() - 2));
362               ui_menu_file_manager::force_file_manager(machine(), &machine().render().ui_container(), warning.cstr());
363            }
364            break;
365355      }
366356
367357      // clear the input memory
trunk/src/emu/video.c
r242990r242991
2020
2121#include "snap.lh"
2222
23#include "osdepend.h"
2423
24
2525//**************************************************************************
2626//  DEBUGGING
2727//**************************************************************************
trunk/src/emu/webengine.c
r242990r242991
1616#include "webengine.h"
1717#include "lua.hpp"
1818
19#include "osdepend.h"
2019
20
2121//**************************************************************************
2222//  WEB ENGINE
2323//**************************************************************************
trunk/src/lib/lib.mak
r242990r242991
3939#-------------------------------------------------
4040
4141UTILOBJS = \
42   $(OSDOBJ)/osdcore.o \
4342   $(LIBOBJ)/util/astring.o \
4443   $(LIBOBJ)/util/avhuff.o \
4544   $(LIBOBJ)/util/aviio.o \
trunk/src/lib/util/corefile.h
r242990r242991
1414#define __COREFILE_H__
1515
1616#include <stdarg.h>
17#include "osdcore.h"
1718#include "astring.h"
1819#include "coretmpl.h"
1920
trunk/src/lib/util/options.h
r242990r242991
1111#ifndef __OPTIONS_H__
1212#define __OPTIONS_H__
1313
14#include "osdcore.h"
1415#include "corefile.h"
1516#include "tagmap.h"
1617
trunk/src/mame/audio/mario.c
r242990r242991
22#include "cpu/z80/z80.h"
33#include "cpu/mcs48/mcs48.h"
44#include "sound/ay8910.h"
5#include "sound/discrete.h"
56
67#include "includes/mario.h"
78
r242990r242991
3839#define I8035_P1_W_AH(M,B,D) I8035_P1_W(M,ACTIVEHIGH_PORT_BIT(I8035_P1_R(M),B,(D)))
3940#define I8035_P2_W_AH(M,B,D) I8035_P2_W(M,ACTIVEHIGH_PORT_BIT(I8035_P2_R(M),B,(D)))
4041
41
42#if !OLD_SOUND
43
44/* ---------------------------------------------------------------------- */
45/* mario sound                                                            */
46/* ---------------------------------------------------------------------- */
47static NETLIST_START(nl_mario_snd0)
48
49    RES(R17, RES_K(27))               /* 20 according to parts list           */
50                                      /* 27 verified, 30K in schematics       */
51    CAP(C14, CAP_U(4.7))              /* verified                             */
52
53    TTL_74123(2H_A)
54    NET_C(2H_A.VCC, V5)
55    NET_C(2H_A.GND, GND)
56    NET_C(SOUND0.Q, 2H_A.B)
57    NET_C(GND, 2H_A.A)
58    NET_C(2H_A.CLRQ, ttlhigh)         /* NOT IN SCHEMATICS                    */
59    DIODE(D1, "1N4148")               /* FIXME: try to identify */
60    TTL_7404_INVERT(1H_A, 2H_A.QQ)
61    NET_C(R17.1, V5)
62    NET_C(R17.2, D1.A, C14.1)
63    NET_C(D1.K, 2H_A.RC)
64    NET_C(C14.2, 2H_A.C)
65
66    RES(R6, RES_K(4.7))               /* verified                             */
67    CAP(C3, CAP_U(10))                /* verified                             */
68
69    NET_C(1H_A.Q, R6.1)
70    NET_C(R6.2, C3.1, 1J_A.FC)
71    NET_C(R6.2, 2J_A.FC)
72    NET_C(C3.2, GND)
73
74    //#define MR_C6       CAP_N(3.9)        /* verified                           */
75
76    SN74LS629(1J_A, CAP_N(3.9))
77    NET_C(1J_A.RNG, V5)
78    NET_C(1J_A.ENQ, ttllow)
79    NET_C(GND, 1J_A.GND)
80
81    //#define MR_C17      CAP_N(22)        /* verified                            */
82
83    SN74LS629(2J_A, CAP_N(22))
84    NET_C(2J_A.RNG, V5)
85    NET_C(2J_A.ENQ, ttllow)
86    NET_C(GND, 2J_A.GND)
87
88    TTL_7486_XOR(1K_A, 1J_A.Y, 2J_A.Y)
89    TTL_7408_AND(2K_A, 2H_A.Q, 1K_A)
90NETLIST_END()
91
92/* ---------------------------------------------------------------------- */
93/* skid sound                                                            */
94/* ---------------------------------------------------------------------- */
95
96// FIXME: Diodes are 1S953
97static NETLIST_START(nl_mario_snd7)
98
99    RES(R61, RES_K(47))
100    CAP(C41, CAP_U(4.7))              /* verified                             */
101
102    TTL_74123(4L_A)
103    NET_C(4L_A.VCC, V5)
104    NET_C(4L_A.GND, GND)
105    NET_C(SOUND7.Q, 4L_A.B)
106    NET_C(GND, 4L_A.A)
107    NET_C(4L_A.CLRQ, ttlhigh)         /* NOT IN SCHEMATICS                    */
108    DIODE(D10, "1N4148")               /* FIXME: try to identify */
109    TTL_7404_INVERT(4J_A, 4L_A.Q)
110    NET_C(R61.1, V5)
111    NET_C(R61.2, D10.A, C41.1)
112    NET_C(D10.K, 4L_A.RC)
113    NET_C(C41.2, 4L_A.C)
114
115    RES(R65, RES_K(10))
116    CAP(C44, CAP_U(3.3))              /* verified                             */
117
118    SN74LS629(4K_A, CAP_U(0.022))
119    NET_C(4K_A.RNG, V5)
120    NET_C(4K_A.ENQ, ttllow)
121    NET_C(GND, 4K_A.GND)
122    NET_C(R65.1, 4J_A.Q)
123    NET_C(R65.2, 4K_A.FC, C44.1)
124    NET_C(C44.2, GND)
125
126    CD_4020(3H, 4K_B.Y, ttllow, V5, GND)
127    TTL_7404_INVERT(4J_B, 3H.Q12)
128
129    RES(R64, RES_K(20))
130    CAP(C43, CAP_U(3.3))              /* verified                             */
131
132    SN74LS629(4K_B, CAP_U(0.0047))
133    NET_C(4K_B.RNG, V5)
134    NET_C(4K_B.ENQ, ttllow)
135    NET_C(GND, 4K_B.GND)
136    NET_C(R64.1, 4J_B.Q)
137    NET_C(R64.2, 4K_B.FC, C43.1)
138    NET_C(C43.2, GND)
139
140    TTL_7486_XOR(1K_C, 3H.Q4, 4K_A.Y)
141    TTL_7408_AND(2K_C, 4L_A.Q, 1K_C)
142
143NETLIST_END()
144
145/* ---------------------------------------------------------------------- */
146/* DAC sound                                                            */
147/* ---------------------------------------------------------------------- */
148static NETLIST_START(nl_mario_dac)
149    RES(R34, RES_M(2))
150    RES(R35, RES_M(1))
151    RES(R36, RES_M(1.8))
152    LM3900(3M_1)
153    NET_C(3M_1.VM, GND)
154    NET_C(3M_1.VP, V5)
155
156    NET_C(DAC.VOUT, R34.1)
157    NET_C(3M_1.MINUS, R34.2, R35.2)
158    NET_C(3M_1.OUT, R35.1)
159    NET_C(3M_1.PLUS, R36.1)
160    NET_C(R36.2, GND)
161
162    RES(R21, RES_M(1.8))
163    RES(R23, RES_K(10))
164    RES(R25, RES_K(10))
165    RES(R37, RES_K(750))
166    RES(R38, RES_K(360))
167    RES(R39, RES_K(750))
168
169    CAP(C18, CAP_P(100))
170    CAP(C19, CAP_U(10))
171    CAP(C20, CAP_U(1))
172    CAP(C30, CAP_P(100))
173
174    LM3900(3M_2)
175    NET_C(3M_2.VM, GND)
176    NET_C(3M_2.VP, V5)
177
178    NET_C(R35.1, C20.1)
179    NET_C(C20.2, R37.1)
180    NET_C(R37.2, R38.2, C18.1, R39.2)
181
182    NET_C(C18.2, GND)
183    NET_C(R38.1, C30.2, 3M_2.MINUS)
184    NET_C(3M_2.OUT, R39.1, C30.1)
185
186    NET_C(R21.1, 3M_2.PLUS)
187    NET_C(R21.2, C19.1, R25.2, R23.1)
188    NET_C(C19.2, R23.2, GND)
189    NET_C(R25.1, V5)
190NETLIST_END()
191
192static NETLIST_START(nl_mario)
193
194    /* Standard stuff */
195
196    SOLVER(Solver, 48000)
197    PARAM(Solver.ACCURACY, 1e-8)
198    PARAM(Solver.SOR_FACTOR, 1.0)
199    PARAM(Solver.GS_THRESHOLD, 5)
200    PARAM(Solver.GS_LOOPS, 4)
201    //PARAM(Solver.LTE,     5e-2) // Default is not enough for paddle control
202    PARAM(Solver.DYNAMIC_TS,  0)
203    ANALOG_INPUT(V5, 5)
204
205    TTL_INPUT(SOUND0, 1)
206    INCLUDE(nl_mario_snd0)
207
208    TTL_INPUT(SOUND7, 1)
209    INCLUDE(nl_mario_snd7)
210
211    R2R_DAC(DAC, 3.4, 10000.0, 8)
212    NET_C(DAC.VGND, GND)
213
214    INCLUDE(nl_mario_dac)
215
216    /* ---------------------------------------------------------------------- */
217    /* mixing                                                                 */
218    /* ---------------------------------------------------------------------- */
219
220    RES(R20, RES_K(22))               /* verified                             */
221    RES(R19, RES_K(22))               /* verified                             */
222    RES(R40, RES_K(22))               /* verified                             */
223    RES(R41, RES_K(100))              /* verified                             */
224    CAP(C31, CAP_U(0.022))            /*                             */
225
226    NET_C(2K_A.Q, R20.1)
227    NET_C(GND, R19.1) //FIXME
228    NET_C(2K_C.Q, R41.1)
229
230#if 1
231    RES(DUM, RES_K(22))
232    NET_C(R39.1, DUM.1)
233    NET_C(DUM.2, GND)
234    FRONTIER(front1, R39.1, R40.1)
235#else
236    NET_C(R39.1, R40.1)
237#endif
238
239    NET_C(R20.2, R19.2, R40.2, R41.2, C31.1)
240    NET_C(C31.2, GND)
241
242    CAP(C32, CAP_U(1))                /* verified                             */
243    RES(R42, RES_K(43))               /* verified                             */
244    RES(R43, RES_K(100))              /* verified                             */
245
246    NET_C(C31.1, C32.1)
247    NET_C(C32.2, R42.1, R43.2, Q10.B)
248    //NET_C(C32.2, R42.1, R43.2)
249    NET_C(R43.1, V5)
250    NET_C(R42.2, GND)
251#if 1
252    RES(R63, RES_K(1))                /*                                      */
253    RES(R62, 150)                     /*                                      */
254
255    QBJT_EB(Q10, "2SC1815")
256
257    NET_C(R62.2, GND)
258    NET_C(R62.1, Q10.E)
259
260    NET_C(R63.1, V5)
261    NET_C(R63.2, Q10.C)
262
263    CAP(C42, CAP_U(0.1))
264    CAP(C47, CAP_U(4.7))
265    RES(VR1, RES_K(10))
266
267    NET_C(C42.1, C47.1, R62.1)
268    NET_C(C42.2, GND)
269    NET_C(C47.2, VR1.1)
270    NET_C(VR1.2, GND)
271#endif
272    /* ---------------------------------------------------------------------- */
273    /* Output                                                                 */
274    /* ---------------------------------------------------------------------- */
275
276    RES(ROUT, 1000000)
277
278    //NET_C(Q10.C, ROUT.1)
279    //NET_C(R43.2, ROUT.1)
280    NET_C(VR1.1, ROUT.1)
281
282    NET_C(GND, ROUT.2)
283
284NETLIST_END()
285
286#else
28742/****************************************************************
28843 *
28944 * Discrete Sound defines
r242990r242991
635390   DISCRETE_TASK_END()
636391
637392DISCRETE_SOUND_END
638#endif
393
639394/****************************************************************
640395 *
641396 * EA / Banking
r242990r242991
743498
744499WRITE8_MEMBER(mario_state::mario_sh_sound_w)
745500{
746#if OLD_SOUND
747501   m_discrete->write(space, DS_DAC, data);
748#else
749   m_audio_dac->write(data);
750#endif
751502}
752503
753504WRITE8_MEMBER(mario_state::mario_sh_p1_w)
r242990r242991
787538/* Mario running sample */
788539WRITE8_MEMBER(mario_state::mario_sh1_w)
789540{
790#if OLD_SOUND
791541   m_discrete->write(space, DS_SOUND0_INP, 0);
792#else
793    m_audio_snd0->write(data);
794#endif
795542}
796543
797544/* Luigi running sample */
798545WRITE8_MEMBER(mario_state::mario_sh2_w)
799546{
800#if OLD_SOUND
801547   m_discrete->write(space, DS_SOUND1_INP, 0);
802#endif
803548}
804549
805550/* Misc samples */
r242990r242991
832577         I8035_P1_W_AH(space, 3, data & 1);
833578         break;
834579      case 7: /* skid */
835#if OLD_SOUND
836580         machine().device<discrete_device>("discrete")->write(space, DS_SOUND7_INP, data & 1);
837#else
838          m_audio_snd7->write((data & 1) ^ 1);
839#endif
840581         break;
841582   }
842583}
r242990r242991
885626   MCFG_CPU_IO_MAP(mario_sound_io_map)
886627
887628   MCFG_SPEAKER_STANDARD_MONO("mono")
888
889#if OLD_SOUND
890629   MCFG_SOUND_ADD("discrete", DISCRETE, 0)
891630   MCFG_DISCRETE_INTF(mario)
892631   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1)
893#else
894    MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000)
895    MCFG_NETLIST_SETUP(nl_mario)
896    MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
897632
898    MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd0", "SOUND0.IN", 0, 1)
899    MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd7", "SOUND7.IN", 0, 1)
900    MCFG_NETLIST_LOGIC_INPUT("snd_nl", "dac", "DAC.VAL", 0, 255)
901
902    MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "ROUT.1")
903    MCFG_NETLIST_ANALOG_MULT_OFFSET(150000.0, 0.0)
904#endif
905
906633MACHINE_CONFIG_END
907634
908635MACHINE_CONFIG_FRAGMENT( masao_audio )
trunk/src/mame/drivers/20pacgal.c
r242990r242991
341341   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
342342INPUT_PORTS_END
343343
344static INPUT_PORTS_START( 25pacmano )
345   PORT_INCLUDE(20pacgal)
346344
347   PORT_MODIFY("SERVICE")
348   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
349   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
350   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
351   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
352   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
353   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
354INPUT_PORTS_END
355345
356346/*************************************
357347 *
r242990r242991
534524 *************************************/
535525
536526GAME( 2006, 25pacman,          0, 25pacman, 25pacman, _20pacgal_state, 25pacman, ROT90, "Namco / Cosmodog", "Pac-Man - 25th Anniversary Edition (Rev 3.00)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
537GAME( 2005, 25pacmano,  25pacman, 20pacgal, 25pacmano,_20pacgal_state, 25pacman, ROT90, "Namco / Cosmodog", "Pac-Man - 25th Anniversary Edition (Rev 2.00)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE)
527GAME( 2005, 25pacmano,  25pacman, 20pacgal, 25pacman, _20pacgal_state, 25pacman, ROT90, "Namco / Cosmodog", "Pac-Man - 25th Anniversary Edition (Rev 2.00)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE)
538528
539529GAME( 2000, 20pacgal,          0, 20pacgal, 20pacgal, _20pacgal_state, 20pacgal, ROT90, "Namco / Cosmodog", "Ms. Pac-Man/Galaga - 20th Anniversary Class of 1981 Reunion (V1.08)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE)
540530GAME( 2000, 20pacgalr4, 20pacgal, 20pacgal, 20pacgal, _20pacgal_state, 20pacgal, ROT90, "Namco / Cosmodog", "Ms. Pac-Man/Galaga - 20th Anniversary Class of 1981 Reunion (V1.04)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE)
trunk/src/mame/drivers/aleck64.c
r242990r242991
336336
337337         if(data & 1) // 0 -> 1 transition
338338         {
339            //for(int i=0;i<0x1000;i+=4)
340            //   space.write_dword(0x007502f4+i,space.read_dword(0xd0000000+i));
339            for(int i=0;i<0x1000;i+=4)
340               space.write_dword(0x007502f4+i,space.read_dword(0xd0000000+i));
341341         }
342342         break;
343343      //0x1e bit 0 probably enables the chip
r242990r242991
349349
350350static ADDRESS_MAP_START( e90_map, AS_PROGRAM, 32, aleck64_state )
351351   AM_IMPORT_FROM( n64_map )
352   AM_RANGE(0xd0000000, 0xd0000fff) AM_RAM // x/y offsets
353   AM_RANGE(0xd0010000, 0xd0010fff) AM_RAM // RGB555 palette
352   AM_RANGE(0xd0000000, 0xd0000fff) AM_RAM
353   AM_RANGE(0xd0010000, 0xd0010fff) AM_RAM
354354   AM_RANGE(0xd0030000, 0xd003001f) AM_READWRITE16(e90_prot_r, e90_prot_w,0xffffffff)
355355ADDRESS_MAP_END
356356
trunk/src/mame/drivers/chihiro.c
r242990r242991
369369#include "debug/debugcon.h"
370370#include "debug/debugcmd.h"
371371#include "debug/debugcpu.h"
372#include "osdcore.h"
372373#include "includes/chihiro.h"
373374
374375#define LOG_PCI
trunk/src/mame/drivers/itech32.c
r242990r242991
7676    Starting with GT Fore!, I.T. moved to a redesigned hardware platform known as the Eagle platform.
7777        It has a main board with a 3Dfx video card and is hard drive based. This series started with
7878        GT Fore! in 2000 and continued through 2006 ending with Golden Tee Complete. This final
79        version included all the courses from all the previous years in the Fore! series.
79        version incuded all the courses from all the previous years in the Fore! series.
8080        The Eagle platform also supports I.T.'s hunting series "Big Buck Hunter", the light game gun
8181        called Carnival King as well as the limited release game Virtual Pool.
8282
r242990r242991
16151615
16161616   PORT_MODIFY("DIPS")
16171617   PORT_DIPNAME( 0x00100000, 0x00000000, "Trackball Orientation" ) PORT_DIPLOCATION("SW1:4")   /* Determined by actual use / trial & error */
1618   PORT_DIPSETTING(          0x00000000, "Normal Mount" )                      /* The manual says "Always on (default)" and "Off -- UNUSED --" */
1618   PORT_DIPSETTING(          0x00000000, "Normal Mount" )                      /* The manual says "Always on (defualt)" and "Off -- UNUSED --" */
16191619   PORT_DIPSETTING(          0x00100000, "45 Degree Angle" )
16201620   PORT_DIPNAME( 0x00200000, 0x00000000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")    /* Single controller version -  has no effect */
16211621   PORT_DIPSETTING(          0x00000000, DEF_STR( Off ) )
r242990r242991
16311631
16321632   PORT_MODIFY("DIPS")
16331633   PORT_DIPNAME( 0x00100000, 0x00000000, "Trackball Orientation" ) PORT_DIPLOCATION("SW1:4")   /* Determined by actual use / trial & error */
1634   PORT_DIPSETTING(          0x00000000, "Normal Mount" )                      /* The manual says "Always on (default)" and "Off -- UNUSED --" */
1634   PORT_DIPSETTING(          0x00000000, "Normal Mount" )                      /* The manual says "Always on (defualt)" and "Off -- UNUSED --" */
16351635   PORT_DIPSETTING(          0x00100000, "45 Degree Angle" )
16361636   PORT_DIPNAME( 0x00200000, 0x00000000, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:3")
16371637   PORT_DIPSETTING(          0x00000000, DEF_STR( Upright ) )
r242990r242991
24502450   ROM_CONTINUE(                 0x08000, 0x08000 )
24512451
24522452   ROM_REGION( 0x880000, "gfx1", 0 )
2453   /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms:
2453   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
24542454   ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
24552455   ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
24562456   ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
r242990r242991
24852485   ROM_CONTINUE(                 0x08000, 0x08000 )
24862486
24872487   ROM_REGION( 0x880000, "gfx1", 0 )
2488   /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms:
2488   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
24892489   ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
24902490   ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
24912491   ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
r242990r242991
25202520   ROM_CONTINUE(                 0x08000, 0x08000 )
25212521
25222522   ROM_REGION( 0x880000, "gfx1", 0 )
2523   /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms:
2523   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
25242524   ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
25252525   ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
25262526   ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
r242990r242991
25552555   ROM_CONTINUE(                 0x08000, 0x08000 )
25562556
25572557   ROM_REGION( 0x880000, "gfx1", 0 )
2558   /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms:
2558   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
25592559   ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
25602560   ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
25612561   ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
r242990r242991
25902590   ROM_CONTINUE(                 0x08000, 0x08000 )
25912591
25922592   ROM_REGION( 0x880000, "gfx1", 0 )
2593   /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms:
2593   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
25942594   ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
25952595   ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
25962596   ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
r242990r242991
26252625   ROM_CONTINUE(                 0x08000, 0x08000 )
26262626
26272627   ROM_REGION( 0x880000, "gfx1", 0 )
2628   /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms:
2628   /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms:
26292629   ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect
26302630   ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) )
26312631   ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) )
r242990r242991
33543354   ROM_LOAD32_BYTE( "gtg3_grom0_3++.grm0_3", 0x000003, 0x100000, CRC(1173a710) SHA1(1f612c1efbf38796707f5b5fecf9d4044691f031) )
33553355   /*
33563356   The above 4 roms have the same exact data as the other sets, but in 8 meg roms instead of 4 meg roms.
3357   This is the only set that specifically checks for these roms in this format
3357   This is the only set that specificaly checks for these roms in this format
33583358   */
33593359   ROM_LOAD32_BYTE( "gtg3_grom1_0+.grm1_0", 0x400000, 0x080000, CRC(80ae7148) SHA1(e19d3390a2a0dad260d770fdbbb64d1f8e43d53f) ) /* actually labeled "GTG3 GROM1_0*" ect */
33603360   ROM_LOAD32_BYTE( "gtg3_grom1_1+.grm1_1", 0x400001, 0x080000, CRC(0f85a618) SHA1(d9ced21c20f9ed6b7f19e7645d75b239ea709b79) )
r242990r242991
40364036   ROM_LOAD32_BYTE( "gt2k_grom1_3.grm1_3", 0x200003, 0x80000, CRC(59f48688) SHA1(37b2c84e487f4f3a9145bef34c573a3716b4a6a7) )
40374037
40384038   /* GT99, GT2K & GT Classic all share the above listed 8 graphics roms and may be labeled GT99, GT2K or GTClassic */
4039   /* The Euro version has different GROM2_x compared to the standard US versions.  GT Supreme PCBs have been seen  */
4039   /* The Euro version has different GROM2_x compared to the standard US versions.  GT Superme PCBs have been seen  */
40404040   /* with GT 2K mask roms as well as all GROMs labeled "GT SUPREME" */
40414041
40424042   ROM_LOAD32_BYTE( "gt_supreme_grom2_0.grm2_0", 0x400000, 0x80000, CRC(33998a3e) SHA1(53832e37c42155eb9c774eb33b8b36fe387fa162) )
r242990r242991
45054505    NOTE: Due to various different upgrade packages from IT, the 3 tier boards can end up with any combination
45064506        of rom boards and sound boards.  For historical reasons, GTG3 3 tier S versions will use the oldest
45074507        sound file set up. Version L will use the newer Ensoniq sample rom and v2.X sound code, while gt97
4508        through gtclassic will use the latest "NR" versions.
4508        through gtclassic will use the lastest "NR" versions.
45094509
45104510  GT Diamond Edition Tournament is a Euro GT98 with different GROM2_0 through GROM2_3
45114511  GT Royal Edition Tournament is a Euro GT99
45124512  GT Supreme Edition Tournament is a Euro GT2K with different GROM2_0 through GROM2_3
45134513     GT Supreme (on a real PCB with actual tournament data) comes up with a different title screen and is (c) 2002
4514     showing the title as GT Supreme Plus! and the Hole-In-One board shows an additional course, Coconut Cove from GT99
4514     showing the title as GT Supreme Plus! and the Hole-In-One board shows an aditional course, Coconut Cove from GT99
45154515     Current emulation does not reproduce this extra title screen due to missing tournament data.
45164516  There doesn't seem to be a Euro version of GT Classic (at least none have been found).
45174517
45184518NOTE: There is an "8 Meg board" version of the P/N 1083 Rev 2 PCB, so GROM0_0 through GROM0_3 are 8 meg roms and labeled "GTxx GROM0_0 **" ect
45194519      while GROM1_0 through GROM1_3 are 4 meg roms matching "4 Meg board" GROM2_0 through GROM2_3 and are labeled "GTxx GROM1_0 *" ect
4520      It is possible to find these rom combinations on any given GT board set.  There is only 1 known GT set which specifically checks for 8 meg
4520      It is possible to find these rom combinations on any given GT board set.  There is only 1 known GT set which specificly checks for 8 meg
45214521      roms under the GROM Checksum test.
45224522
45234523    Parent set will always be gt(year) with the most recent version.  IE: gt97 is Golden Tee '97 v1.30
trunk/src/mame/drivers/naomi.c
r242990r242991
521521Star Horse (satellite)                          840-0056C  23627    6 (128Mb)* 315-6319   315-6213  not present   * +1 (64Mb), requires 837-13785 ARCNET&IO BD
522522Star Horse Progress (satellite) (Rev A)         840-0123C  24122A   7 (128Mb)  315-6319A  315-6213  not present   requires 837-13785 ARCNET&IO BD
523523The King of Route 66 (Rev A)                    840-0087C  23819A  10 (128Mb)  315-6319A  315-6213  not present
524Virtua Striker 3                                840-0061C  23663   11 (128Mb)  315-6319A  315-6213  317-0310-COM
525524Virtua Striker 3 (Rev B)                        840-0061C  23663B  11 (128Mb)  315-6319A  315-6213  317-0310-COM
525Virtua Striker 3 (Rev C)                        840-0061C  23663C  11 (128Mb)  315-6319A  315-6213  317-0310-COM
526526Wave Runner GP                                  840-0064C  24059    6 (128Mb)  315-6319A  315-6213  not present
527527Wild Riders                                     840-0046C  23622   10 (128Mb)  315-6319A  315-6213  317-0301-COM
528528WWF Royal Rumble                                840-0040C  22261    8 (128Mb)  315-6319   315-6213  317-0285-COM
r242990r242991
60146014   ROM_LOAD( "wk1ma10.4c",  0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) )
60156015
60166016   ROM_REGION( 4, "rom_key", 0 )
6017   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(1708ebb9) SHA1(c1115e4dd675f10d5fb41f57c1eea8e6a4f09fed) )
6017   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) )
60186018ROM_END
60196019
60206020ROM_START( wldkicksa )
r242990r242991
60366036   ROM_LOAD( "wk1ma10.4c",  0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) )
60376037
60386038   ROM_REGION( 4, "rom_key", 0 )
6039   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(1708ebb9) SHA1(c1115e4dd675f10d5fb41f57c1eea8e6a4f09fed) )
6039   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) )
60406040ROM_END
60416041
60426042ROM_START( wldkicksb )
r242990r242991
60586058   ROM_LOAD( "wk1ma10.4c",  0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) )
60596059
60606060   ROM_REGION( 4, "rom_key", 0 )
6061   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(1708ebb9) SHA1(c1115e4dd675f10d5fb41f57c1eea8e6a4f09fed) )
6061   ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) )
60626062ROM_END
60636063
60646064ROM_START( toukon4 )
r242990r242991
60856085   ROM_LOAD( "trf1ma15.6l", 0xf000000, 0x1000000, CRC(42d318c5) SHA1(f9fe82ffbfc51fcb52333f94c55a7092e7124fb4) )
60866086
60876087   ROM_REGION( 4, "rom_key", 0 )
6088   ROM_LOAD( "tr4ae-key.bin", 0x000000, 0x000004, CRC(1708ebb9) SHA1(c1115e4dd675f10d5fb41f57c1eea8e6a4f09fed) )
6088   ROM_LOAD( "tr4ae-key.bin", 0x000000, 0x000004, CRC(986a7cee) SHA1(70c3ff80f86de6a0655251658c66a156fb644995) )
60896089ROM_END
60906090
60916091ROM_START( ninjaslt )
r242990r242991
77907790   NAOMI_DEFAULT_EEPROM
77917791
77927792   ROM_REGION( 0xb000000, "rom_board", ROMREGION_ERASEFF)
7793   // rom was handmade from 2 damaged dumps, needs to be verified
7794   ROM_LOAD( "epr-23663.ic22", 0x0000000, 0x0400000, BAD_DUMP CRC(6910a008) SHA1(865affff1cf31321725ef727a17be384555e3aae) )
7793   ROM_LOAD( "epr-23663c.ic22",0x0000000, 0x0400000, CRC(7007fec7) SHA1(523168f0b218d0bd5c815d65bf0caba2c8468c9d) )
77957794   ROM_LOAD( "mpr-23652.ic1",  0x0800000, 0x1000000, CRC(992758a2) SHA1(5e2a25c520c1795128e5026fc00d355c24852ded) )
77967795   ROM_LOAD( "mpr-23653.ic2",  0x1800000, 0x1000000, CRC(e210e932) SHA1(2f6f0a31c3e98b21f1ff3af1680e50b3535b130f) )
77977796   ROM_LOAD( "mpr-23654.ic3",  0x2800000, 0x1000000, CRC(91335971) SHA1(fc7599b836fb7995dd7da940e64b08b3c09cb180) )
r242990r242991
78057804   ROM_LOAD( "mpr-23662.ic11", 0xa800000, 0x0800000, CRC(d6ef7d68) SHA1(4ee396af6c5caf4c5af6e9ad0e03a7ac2c5039f4) )
78067805
78077806   ROM_REGION( 4, "rom_key", 0 )
7808   ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(8c9012fe) SHA1(d81e00d6377a3f0eeed01dc523707e36ca1b434d) )
7807   ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(049f41b0) SHA1(4ea444878c8e9288ec95b1763d48bc92c634acdd) )
78097808ROM_END
78107809
78117810ROM_START( vstrik3cb )
r242990r242991
78277826   ROM_LOAD( "mpr-23662.ic11", 0xa800000, 0x0800000, CRC(d6ef7d68) SHA1(4ee396af6c5caf4c5af6e9ad0e03a7ac2c5039f4) )
78287827
78297828   ROM_REGION( 4, "rom_key", 0 )
7830   ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(8c9012fe) SHA1(d81e00d6377a3f0eeed01dc523707e36ca1b434d) )
7829   ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(049f41b0) SHA1(4ea444878c8e9288ec95b1763d48bc92c634acdd) )
78317830ROM_END
78327831
78337832ROM_START( wldrider )
r242990r242991
78487847   ROM_LOAD( "mpr-23620.ic10", 0x9800000, 0x1000000, CRC(67aa15a9) SHA1(42c24cbf7069c27430a71509a872cd1c4224aaeb) )
78497848
78507849   ROM_REGION( 4, "rom_key", 0 )
7851   ROM_LOAD( "wldrider-key.bin", 0, 4, CRC(7ac4f5fa) SHA1(5d08ecfbdc5f4bf26a9ea521a647c93141e7f635) )
7850   ROM_LOAD( "wldrider-key.bin", 0, 4, CRC(f5a662ad) SHA1(a75b1e490d1f7d57cd8976115572266d1ca05202) )
78527851ROM_END
78537852
78547853ROM_START( vf4cart )
r242990r242991
78707869   ROM_LOAD( "mpr-23784.ic11", 0xa800000, 0x1000000, CRC(f74f2fee) SHA1(84b07baa6d116727e66ef27e24ba6484c3393891) )
78717870
78727871   ROM_REGION( 4, "rom_key", 0 )
7873   ROM_LOAD( "vf4cart-key.bin", 0, 4, CRC(aa8cdd58) SHA1(e282b7d215044a005b50c8553b8056f3d599135c) )
7872   ROM_LOAD( "vf4cart-key.bin", 0, 4, CRC(22838e16) SHA1(afee674dce3cfdd20360c30da2da5ba69f8d4682) )
78747873ROM_END
78757874
78767875// There is also a development cart (171-7885A) with 20x 64Mb FlashROMs instead of 10x 128Mb MaskROMs. Content is the same.
r242990r242991
79937992   ROM_LOAD( "mpr-23703.ic11", 0xa800000, 0x1000000, CRC(702b8b4a) SHA1(3a8dfde458f341e7db20664382b9fce2b6e5d462) )
79947993
79957994   ROM_REGION( 4, "rom_key", 0 )
7996   ROM_LOAD( "clubkrte-key.bin", 0, 4, CRC(5420fd0a) SHA1(06cb480c12f0ddc10e7601d34c5f42dda6ac6145) )
7995   ROM_LOAD( "clubkrte-key.bin", 0, 4, CRC(db426a5d) SHA1(6a6a0b80ec0416605541159efea379dc19fe796d) )
79977996ROM_END
79987997
79997998ROM_START( clubkrtd )
r242990r242991
90359034
90369035/* 840-xxxxx (Sega Naomi 2 cart games) */
90379036/* 0046 */ GAME( 2001, wldrider, naomi2,  naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Wild Riders (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS )
9038/* 0061 */ GAME( 2001, vstrik3c, naomi2,  naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart)", GAME_FLAGS )
9037/* 0061 */ GAME( 2001, vstrik3c, naomi2,  naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart, Rev C)", GAME_FLAGS )
90399038/* 0061 */ GAME( 2001, vstrik3cb,vstrik3c,naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart, Rev B)", GAME_FLAGS )
90409039/* 0062 */ GAME( 2001, clubkrte, naomi2,  naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Club Kart: European Session", GAME_FLAGS )
90419040/* 0062 */ GAME( 2001, clubkrtd, clubkrte,naomi2m2, naomi, naomi_state, naomi2,   ROT0, "Sega", "Club Kart: European Session (Rev D)", GAME_FLAGS )
trunk/src/mame/drivers/nl_pongd.c
r242990r242991
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/mame/drivers/peplus.c
r242990r242991
36873687   ROM_REGION( 0x020000, "gfx1", 0 )
36883688   ROM_LOAD( "mro-cg2153.u72",   0x00000, 0x8000, CRC(004c9c8e) SHA1(ec3fa9d2c658de59e722d9979513d6b0c71d5742) ) /*  05/01/95   @ IGT  L95-1123  */
36893689   ROM_LOAD( "mgo-cg2153.u73",   0x08000, 0x8000, CRC(e6843b35) SHA1(2d5219a3cb054ce8b470797c0496c7e24e94ed81) )
3690   ROM_LOAD( "mbo-cg2153.u74",   0x10000, 0x8000, CRC(e3e28611) SHA1(d040f1df6203dc0bd6a79a391fb90fb930f8dd1a) ) /* Custom Arizona Charlie's Casino card backs */
3690   ROM_LOAD( "mbo-cg2153.u74",   0x10000, 0x8000, CRC(e3e28611) SHA1(d040f1df6203dc0bd6a79a391fb90fb930f8dd1a) ) /* Custom Arizona Charlie's Casino graphics */
36913691   ROM_LOAD( "mxo-cg2153.u75",   0x18000, 0x8000, CRC(3ae44f7e) SHA1(00d625b60bffef6ce622cb50a3aa93b92131f578) )
36923692
36933693   ROM_REGION( 0x100, "proms", 0 )
r242990r242991
47724772  Four of a Kind Bonus Poker
47734773  Deuces Wild Poker
47744774
4775Also uses a Dallas (Maxim) DS1216 SmartWatch RAM for RTC (Real Time Clock) functions
4776
47774775Came out of an IGT machine with belly glass calling it Montana Choice
47784776*/
47794777   ROM_REGION( 0x10000, "maincpu", 0 )
r242990r242991
53935391   ROM_LOAD( "x000055p.u66",   0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) /* Deuces Wild Poker */
53945392
53955393   ROM_REGION( 0x020000, "gfx1", 0 )
5396   ROM_LOAD( "mro-cg2291.u77",  0x00000, 0x8000, CRC(db4e491c) SHA1(e371e7b236962a0f30640c683d3a0a302c51aee9) ) /* Custom The Orleans card backs */
5394   ROM_LOAD( "mro-cg2291.u77",  0x00000, 0x8000, CRC(db4e491c) SHA1(e371e7b236962a0f30640c683d3a0a302c51aee9) ) /* Custom The Orleans graphics */
53975395   ROM_LOAD( "mgo-cg2291.u78",  0x08000, 0x8000, CRC(17bb35f8) SHA1(ba9e8aa3ff42b17c7be6ee46c70db22d8e60e52c) ) /* Compatible with most "standard" game sets */
53985396   ROM_LOAD( "mbo-cg2291.u79",  0x10000, 0x8000, CRC(de1036e4) SHA1(774bbcda301754dc4a606974248847a2264c3827) )
53995397   ROM_LOAD( "mxo-cg2291.u80",  0x18000, 0x8000, CRC(7049403c) SHA1(3a29a00fb8dfdb30dba757c1536151827ea09068) )
r242990r242991
54185416   ROM_LOAD( "x000055p.u66",   0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) /* Deuces Wild Poker */
54195417
54205418   ROM_REGION( 0x020000, "gfx1", 0 )
5421   ROM_LOAD( "mro-cg2399.u72",  0x00000, 0x8000, CRC(0424f4ba) SHA1(c8b192a6f63c8c9937cb3923d27b9ba2c39823cd) ) /* Custom The Fun Ships card backs */
5419   ROM_LOAD( "mro-cg2399.u72",  0x00000, 0x8000, CRC(0424f4ba) SHA1(c8b192a6f63c8c9937cb3923d27b9ba2c39823cd) ) /* Custom The Fun Ships graphics */
54225420   ROM_LOAD( "mgo-cg2399.u73",  0x08000, 0x8000, CRC(5848a2fa) SHA1(4173a473016b7a776d2b59bf3ded0be35bd43721) )
54235421   ROM_LOAD( "mbo-cg2399.u74",  0x10000, 0x8000, CRC(5c3e16f6) SHA1(a4aa457f239527bffa6472e0d6f9d836f796b326) )
54245422   ROM_LOAD( "mxo-cg2399.u75",  0x18000, 0x8000, CRC(bd7669d5) SHA1(4343a9764fd563e2e1cdd8558f2f53f77006b159) )
r242990r242991
54435441   ROM_LOAD( "x000055p.u66",   0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) /* Deuces Wild Poker */
54445442
54455443   ROM_REGION( 0x020000, "gfx1", 0 )
5446   ROM_LOAD( "mro-cg2374.u72",  0x00000, 0x8000, CRC(ceeb714d) SHA1(6de908d04bcaa243195943affa9ad0d725de5c81) ) /* Custom Horseshoe Casino card backs */
5447   ROM_LOAD( "mgo-cg2374.u73",  0x08000, 0x8000, CRC(d0fabad5) SHA1(438ebe074fa3eaa3073ef042f481449f416d0665) )
5448   ROM_LOAD( "mbo-cg2374.u74",  0x10000, 0x8000, CRC(9a0fbc8d) SHA1(aa39f47cbeaf8218fd2d753c9a350e9eab5df5d3) )
5449   ROM_LOAD( "mxo-cg2374.u75",  0x18000, 0x8000, CRC(99814562) SHA1(2d8e132f4cc4edd06332c0327927219513b22832) )
5444   ROM_LOAD( "mro-cg2185.u77",  0x00000, 0x8000, CRC(7e64bd1a) SHA1(e988a380ee58078bf5bdc7747e83aed1393cfad8) ) /*  07/10/95   @ IGT  L95-1506  */
5445   ROM_LOAD( "mgo-cg2185.u78",  0x08000, 0x8000, CRC(d4127893) SHA1(75039c45ba6fd171a66876c91abc3191c7feddfc) )
5446   ROM_LOAD( "mbo-cg2185.u79",  0x10000, 0x8000, CRC(17dba955) SHA1(5f77379c88839b3a04e235e4fb0120c77e17b60e) )
5447   ROM_LOAD( "mxo-cg2185.u80",  0x18000, 0x8000, CRC(583eb3b1) SHA1(4a2952424969917fb1594698a779fe5a1e99bff5) )
54505448
54515449   ROM_REGION( 0x200, "proms", 0 )
5452   ROM_LOAD( "capx2374.u43", 0x0000, 0x0200, CRC(f922e1b8) SHA1(4aa5291c59431c022dc0561a6e3b38209f60286a) )
5450   ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) )
54535451ROM_END
54545452
54555453ROM_START( pex0055pd ) /* Superboard : Deuces Wild Poker (X000055P+XP000035) */
r242990r242991
79407938   ROM_LOAD( "x002374p.u66",   0x00000, 0x10000, CRC(fc4b6c8d) SHA1(b101f9042bd54dbfdeed4c7a3acf3798096f6857) ) /* Super Aces Poker */
79417939
79427940   ROM_REGION( 0x020000, "gfx1", 0 )
7943   ROM_LOAD( "mro-cg2324.u77",  0x00000, 0x8000, CRC(6eceef42) SHA1(a2ddd2a3290c41e510f483c6b633fe0002694d0b) )
7944   ROM_LOAD( "mgo-cg2324.u78",  0x08000, 0x8000, CRC(26d0acbe) SHA1(09a9127deb88185cd5b748bac657461eadb2f48f) )
7945   ROM_LOAD( "mbo-cg2324.u79",  0x10000, 0x8000, CRC(47baee32) SHA1(d8af09022ccb5fc06aa3aa4c200a734b66cbee00) )
7946   ROM_LOAD( "mxo-cg2324.u80",  0x18000, 0x8000, CRC(60449fc0) SHA1(251d1e04786b70c1d2bc7b02f3b69cd58ac76398) )
7941   ROM_LOAD( "mro-cg2374.u72",  0x00000, 0x8000, CRC(ceeb714d) SHA1(6de908d04bcaa243195943affa9ad0d725de5c81) ) /* Custom Horseshoe Casino card backs */
7942   ROM_LOAD( "mgo-cg2374.u73",  0x08000, 0x8000, CRC(d0fabad5) SHA1(438ebe074fa3eaa3073ef042f481449f416d0665) )
7943   ROM_LOAD( "mbo-cg2374.u74",  0x10000, 0x8000, CRC(9a0fbc8d) SHA1(aa39f47cbeaf8218fd2d753c9a350e9eab5df5d3) )
7944   ROM_LOAD( "mxo-cg2374.u75",  0x18000, 0x8000, CRC(99814562) SHA1(2d8e132f4cc4edd06332c0327927219513b22832) )
79477945
79487946   ROM_REGION( 0x200, "proms", 0 )
7949   ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) )
7947   ROM_LOAD( "cap2374.u43", 0x0000, 0x0200, CRC(f922e1b8) SHA1(4aa5291c59431c022dc0561a6e3b38209f60286a) )
79507948ROM_END
79517949
79527950ROM_START( pex2377p ) /* Superboard : Super Double Bonus Poker (X002377P+XP000112) */
r242990r242991
92659263GAMEL(1995, pex0055p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000019) Deuces Wild Poker",   0, layout_pe_poker )
92669264GAMEL(1995, pex0055pa, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000022) Deuces Wild Poker (The Orleans)", 0, layout_pe_poker )
92679265GAMEL(1995, pex0055pb, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000023) Deuces Wild Poker (The Fun Ships)", 0, layout_pe_poker )
9268GAMEL(1995, pex0055pc, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000028) Deuces Wild Poker (Horseshoe)", 0, layout_pe_poker )
9266GAMEL(1995, pex0055pc, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000028) Deuces Wild Poker",  0, layout_pe_poker )
92699267GAMEL(1995, pex0055pd, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000035) Deuces Wild Poker",   0, layout_pe_poker )
92709268GAMEL(1995, pex0055pe, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000038) Deuces Wild Poker",   0, layout_pe_poker )
92719269GAMEL(1995, pex0055pf, pex0055p,  peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000040) Deuces Wild Poker",   0, layout_pe_poker )
r242990r242991
93639361GAMEL(1995, pex2308p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002308P+XP000112) Triple Double Bonus Poker", 0, layout_pe_poker )
93649362GAMEL(1995, pex2310p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002310P+XP000112) Triple Double Bonus Poker", 0, layout_pe_poker )
93659363GAMEL(1995, pex2314p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002314P+XP000112) Triple Bonus Poker Plus", 0, layout_pe_poker )
9366GAMEL(1995, pex2374p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002374P+XP000112) Super Aces Poker",    0, layout_pe_poker )
9364GAMEL(1995, pex2374p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002374P+XP000112) Super Aces Poker (Horseshoe)", 0, layout_pe_poker )
93679365GAMEL(1995, pex2377p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002377P+XP000112) Super Double Bonus Poker", 0, layout_pe_poker )
93689366GAMEL(1995, pex2419p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002419P+XP000064) Deuces Wild Bonus Poker - French", 0, layout_pe_poker )
93699367GAMEL(1995, pex2420p,  0,         peplus,  peplus_poker, peplus_state, peplussb, ROT0,  "IGT - International Game Technology", "Player's Edge Plus (X002420P+XP000064) Deuces Wild Bonus Poker - French", 0, layout_pe_poker )
trunk/src/mame/drivers/snowbros.c
r242990r242991
185185   if (ACCESSING_BITS_0_7) soundlatch_byte_w(space,0,data & 0xff);
186186}
187187
188READ16_MEMBER(snowbros_state::toto_read)
189{
190   int pc = space.device().safe_pc();
191   if ((pc!= 0x3f010) && (pc!= 0x38008)) printf("toto prot %08x %04x\n", pc, mem_mask);
192   return 0x0700;
193}
194
195188/* Snow Bros Memory Map */
196189
197190static ADDRESS_MAP_START( snowbros_map, AS_PROGRAM, 16, snowbros_state )
r242990r242991
19621955   ROM_LOAD16_BYTE( "wb09.bin",     0x60001, 0x10000, CRC(9be718ca) SHA1(5c195e4f13efbdb229201d2408d018861bf389cc) )
19631956ROM_END
19641957
1965ROM_START( toto )
1966   ROM_REGION( 0x40000, "maincpu", 0 )
1967   ROM_LOAD16_BYTE( "u60.5j",  0x00000, 0x20000, CRC(39203792) SHA1(4c8d560be02a514cbf91774c7a0b4a95cf573356) )
1968   ROM_LOAD16_BYTE( "u51.4j",  0x00001, 0x20000, CRC(7b846cd4) SHA1(04aa0bbaab4303fb08dff52d5515f7e764f1be6d))
1969
1970   ROM_REGION( 0x10000, "soundcpu", 0 )    /* 64k for z80 sound code */
1971   ROM_LOAD( "u46.4c",   0x0000, 0x8000, CRC(77b1ef42) SHA1(75e3c8c2b687669cc56f972dd7375dab5185859c) )
1972
1973   ROM_REGION( 0x80000, "gfx1", 0 )
1974   ROM_LOAD( "u107.8k",          0x00000, 0x20000, CRC(4486153b) SHA1(a6dc0c17bf2328ab725bce4aaa0a413a42129fb0) )
1975   ROM_LOAD( "u108.8l",          0x20000, 0x20000, CRC(3286cf5f) SHA1(133366b0e10ab86111247cbedf329e8e3a7f2148) )
1976   ROM_LOAD( "u109.8m",          0x40000, 0x20000, CRC(464d7251) SHA1(f03ee54e9301ea87de4171cecdbad4a5e17929c4) )
1977   ROM_LOAD( "u110.8n",          0x60000, 0x20000, CRC(7dea56df) SHA1(7e7b9238837c6f4221cff416a2de21723d2c9272) )
1978ROM_END
1979
19801958/* Barko */
19811959
19821960ROM_START( honeydol )
r242990r242991
28882866
28892867
28902868
2891DRIVER_INIT_MEMBER(snowbros_state,toto)
2892{
2893   // every single rom has bits 0x10 and 0x08 swapped
2894   UINT8 *src = memregion("maincpu")->base();
2895   int len = memregion("maincpu")->bytes();
2896
2897   for (int i = 0; i < len; i++)
2898   {
2899      src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
2900   }
2901
2902   src = memregion("gfx1")->base();
2903   len = memregion("gfx1")->bytes();
2904
2905   for (int i = 0; i < len; i++)
2906   {
2907      src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
2908   }
2909
2910   src = memregion("soundcpu")->base();
2911   len = memregion("soundcpu")->bytes();
2912
2913   for (int i = 0; i < len; i++)
2914   {
2915      src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
2916   }
2917
2918   // protection? (just return 0x07)
2919   m_maincpu->space(AS_PROGRAM).install_read_handler(0x500006, 0x500007, read16_delegate(FUNC(snowbros_state::toto_read),this));
2920}
2921
2922
2923
29242869GAME( 1990, snowbros,  0,        snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 1)", 0 )
29252870GAME( 1990, snowbrosa, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 2)", 0 )
29262871GAME( 1990, snowbrosb, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan",                        "Snow Bros. - Nick & Tom (set 3)", 0 )
r242990r242991
29302875GAME( 1990, wintbob,   snowbros, wintbob,  snowbros, driver_device, 0, ROT0, "bootleg (Sakowa Project Korea)", "The Winter Bobble (bootleg of Snow Bros.)", 0 )
29312876GAME( 1990, snowbroswb,snowbros, wintbob,  snowbros, driver_device, 0, ROT0, "bootleg",                        "Snow Bros. - Nick & Tom (The Winter Bobble hardware bootleg)", 0 ) // this was probably unhacked back from the more common Winter Bobble to make it look more original
29322877
2933GAME( 1996, toto,      0,        snowbros, snowbros, snowbros_state, toto, ROT0, "SoftClub",                    "Come Back Toto", 0 ) // modified from 'snowbros' code
2934
29352878// none of the games below are on genuine SnowBros hardware, but they clone the functionality of it.
29362879
29372880// SemiCom / Jeil titles are protected, a dumb MCU copies code into RAM at startup, some also check for a specific return value from an address on startup.
trunk/src/mame/drivers/twinkle.c
r242990r242991
254254      m_maincpu(*this, "maincpu"),
255255      m_audiocpu(*this, "audiocpu")
256256   {
257      m_spu_hle[0x200] = 0;
258      m_spu_hle[0x202] = 0;
257259   }
258260
259261   required_device<am53cf96_device> m_am53cf96;
r242990r242991
262264
263265   UINT16 m_spu_ctrl;      // SPU board control register
264266   UINT8 m_spu_shared[0x400];  // SPU/PSX shared dual-ported RAM
267   UINT8 m_spu_hle[0x400];
265268   UINT32 m_spu_ata_dma;
266269   int m_spu_ata_dmarq;
267270
r242990r242991
282285   DECLARE_WRITE16_MEMBER(twinkle_waveram_w);
283286   DECLARE_READ16_MEMBER(shared_68k_r);
284287   DECLARE_WRITE16_MEMBER(shared_68k_w);
285   DECLARE_READ16_MEMBER(unk_68k_r);
286288   DECLARE_WRITE_LINE_MEMBER(spu_ata_irq);
287289   DECLARE_WRITE_LINE_MEMBER(spu_ata_dmarq);
288290   required_device<cpu_device> m_maincpu;
r242990r242991
669671
670672WRITE8_MEMBER(twinkle_state::shared_psx_w)
671673{
672//   printf("shared_psx_w: %04x, %04x, %04x\n", offset, data, mem_mask);
674   //printf("shared_psx_w: %04x, %04x, %04x\n", offset, data, mem_mask);
673675
674676   m_spu_shared[offset] = data;
675677
678   // HLE sound board
679   m_spu_hle[offset] = data;
680
676681   if (offset == 0x03fe && data == 0xff)
677682   {
678//      printf("spu command %02x %02x\n", m_spu_shared[1], m_spu_shared[3]);
683      //printf("spu command %02x %02x\n", m_spu_hle[1], m_spu_hle[3]);
679684
680      m_audiocpu->set_input_line(M68K_IRQ_4, HOLD_LINE);
685      for (int i = 0x200; i < 0x300; i++) m_spu_hle[i] = 0xea;
686
687      switch (m_spu_hle[1])
688      {
689      case 0x91: // hdd sum 1
690         m_spu_hle[0x200] = 0; // ?
691         m_spu_hle[0x202] = 0; // ?
692         break;
693
694      case 0x9a: // hdd sum 2
695         m_spu_hle[0x200] = 0; // ?
696         m_spu_hle[0x202] = 0; // ?
697         m_spu_hle[0x203] = 1; // Must be 1 to pass test
698         break;
699
700      case 0xa1: // version
701         m_spu_hle[0x200] = 0; // ?
702         m_spu_hle[0x202] = 0; // ?
703
704         if (strcmp(machine().system().name, "bmiidx") == 0 ||
705            strcmp(machine().system().name, "bmiidxa") == 0 ||
706            strcmp(machine().system().name, "bmiidxc") == 0 ||
707            strcmp(machine().system().name, "bmiidxca") == 0)
708         {
709            strcpy((char *)&m_spu_hle[0x204], "GQ863JA_A");
710         }
711         else if (strcmp(machine().system().name, "bmiidxs") == 0 ||
712            strcmp(machine().system().name, "bmiidxc2") == 0)
713         {
714            strcpy((char *)&m_spu_hle[0x204], "GC983JA_R");
715         }
716         else if (strcmp(machine().system().name, "bmiidx2") == 0)
717         {
718            strcpy((char *)&m_spu_hle[0x204], "GC985JA_A");
719         }
720         else if (strcmp(machine().system().name, "bmiidx3") == 0 ||
721            strcmp(machine().system().name, "bmiidx3a") == 0)
722         {
723            strcpy((char *)&m_spu_hle[0x204], "GC992JA_A");
724         }
725         else if (strcmp(machine().system().name, "bmiidx4") == 0)
726         {
727            strcpy((char *)&m_spu_hle[0x204], "GCA03JA_A");
728         }
729         else if (strcmp(machine().system().name, "bmiidx5") == 0)
730         {
731            strcpy((char *)&m_spu_hle[0x204], "GCA17JA_A");
732         }
733         else if (strcmp(machine().system().name, "bmiidx6") == 0 ||
734            strcmp(machine().system().name, "bmiidx6a") == 0)
735         {
736            strcpy((char *)&m_spu_hle[0x204], "GCB4UJA_A");
737         }
738         else if (strcmp(machine().system().name, "bmiidx7") == 0)
739         {
740            strcpy((char *)&m_spu_hle[0x204], "GCB44JA_A");
741         }
742         else if (strcmp(machine().system().name, "bmiidx8") == 0)
743         {
744            strcpy((char *)&m_spu_hle[0x204], "GCC44JA_A");
745         }
746         break;
747
748      case 0x30: // play sound [3]=sound code
749      case 0x51: // sound off
750      case 0x25: // spu rom error ([3]==0x0f)
751      case 0x26: // spu rom error ([3]==0x0f)
752      case 0x08: // spu rom error
753      case 0x40: // spu rom error ([3]==0x01 coin sound?)
754      case 0x2f: // spu rom error
755      case 0x52: // spu rom error
756      case 0x04: // spu rom error ([3]==?)
757         m_spu_hle[0x200] = 0;
758         m_spu_hle[0x202] = 0;
759         break;
760      }
681761   }
682762}
683763
684764READ8_MEMBER(twinkle_state::shared_psx_r)
685765{
686   UINT32 result = m_spu_shared[offset];
766   //UINT32 result = m_spu_shared[offset];
767   UINT32 result = m_spu_hle[offset];
687768
688769   //printf("shared_psx_r: %04x, %04x, %04x\n", offset, result, mem_mask);
689770
r242990r242991
722803/*
723804    System control register (Konami always has one)
724805
725    bit 7  = write 0 to ack IRQ 1, write 1 to enable (IRQ 1 appears to be an RF5C400-related timer, or some free-running timing source)
806    bit 7  = write 0 to ack IRQ 1, write 1 to enable (IRQ 1 appears to be vblank)
726807    bit 8  = write 0 to ack IRQ 2, write 1 to enable (IRQ 2 appears to be DMA completion)
727    bit 9  = write 0 to ack IRQ 4, write 1 to enable (IRQ 4 is "command available")
728    bit 10 = write 0 to ack IRQ 6, write 1 to enable (IRQ 6 is the ATA IRQ)
729    bit 11 = watchdog toggle
808    bit 9  = write 0 to ack IRQ 4, write 1 to enable (IRQ 4 appears to be "command sent", unsure how the MIPS causes it yet however)
809    bit 10 = write 0 to ack IRQ 6, write 1 to enable (IRQ 6 is IDE)
810    bit 11 = watchdog toggle?
730811
731812    Other bits unknown.
732813*/
r242990r242991
755836WRITE16_MEMBER(twinkle_state::spu_ata_dma_low_w)
756837{
757838   m_spu_ata_dma = (m_spu_ata_dma & ~0xffff) | data;
839
840   //printf("dma_low %08x\n", m_spu_ata_dma * 2);
758841}
759842
760843WRITE16_MEMBER(twinkle_state::spu_ata_dma_high_w)
761844{
762845   m_spu_ata_dma = (m_spu_ata_dma & 0xffff) | (data << 16);
846
847   //printf("dma_high %08x\n", m_spu_ata_dma * 2);
763848}
764849
765850WRITE_LINE_MEMBER(twinkle_state::spu_ata_dmarq)
r242990r242991
779864            //waveram[m_spu_ata_dma++] = (data >> 8) | (data << 8);
780865            // bp 4a0e ;bmiidx4 checksum
781866            // bp 4d62 ;bmiidx4 dma
782
783            // $$$HACK - game DMAs nothing useful to 0x400000 but all sound plays are 0x400000 or above
784            //           so limit sound RAM to 4MB (there's 6 MB on the board) and let the 5c400's address masking
785            //           work for us until we figure out what's actually going on.
786            if (m_spu_ata_dma < 0x200000)
787            {
788               m_waveram[m_spu_ata_dma++] = data;
789            }
867            m_waveram[m_spu_ata_dma++] = data;
790868         }
791869
792870         m_ata->write_dmack(CLEAR_LINE);
r242990r242991
808886{
809887   UINT16 result = m_spu_shared[offset];
810888
811//   printf("shared_68k_r: %04x, %04x, %04x\n", offset, result, mem_mask);
889   //printf("shared_68k_r: %04x, %04x, %04x\n", offset, result, mem_mask);
812890
813891   return result;
814892}
815893
816894WRITE16_MEMBER(twinkle_state::shared_68k_w)
817895{
818//   printf("shared_68k_w: %04x, %04x, %04x\n", offset, data, mem_mask);
896   //printf("shared_68k_w: %04x, %04x, %04x\n", offset, data, mem_mask);
819897
820898   m_spu_shared[offset] = data & 0xff;
821899}
822900
823READ16_MEMBER(twinkle_state::unk_68k_r)
824{
825   return 0xffff;   // must return 0xff for 68000 POST to complete properly
826}
827
828901static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 16, twinkle_state )
829902   AM_RANGE(0x000000, 0x07ffff) AM_ROM
830903   AM_RANGE(0x100000, 0x13ffff) AM_RAM
831   AM_RANGE(0x200000, 0x200001) AM_READ(unk_68k_r)
832904   // 220000 = LEDs?
833905   AM_RANGE(0x230000, 0x230003) AM_WRITE(twinkle_spu_ctrl_w)
834906   AM_RANGE(0x240000, 0x240003) AM_WRITE(spu_ata_dma_low_w)
r242990r242991
837909   AM_RANGE(0x280000, 0x280fff) AM_READWRITE(shared_68k_r, shared_68k_w)
838910   AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE("ata", ata_interface_device, read_cs0, write_cs0)
839911   // 34000E = ???
840   AM_RANGE(0x34000e, 0x34000f) AM_WRITENOP
841912   AM_RANGE(0x400000, 0x400fff) AM_DEVREADWRITE("rfsnd", rf5c400_device, rf5c400_r, rf5c400_w)
842   AM_RANGE(0x800000, 0xbfffff) AM_READWRITE(twinkle_waveram_r, twinkle_waveram_w )
843   AM_RANGE(0xfe0000, 0xffffff) AM_RAM   // ...and the RAM test checks this last 128k (mirror of the work RAM at 0x100000?)
913   AM_RANGE(0x800000, 0xffffff) AM_READWRITE(twinkle_waveram_r, twinkle_waveram_w )    // 8 MB window wave RAM
844914ADDRESS_MAP_END
845915
846916/* SCSI */
r242990r242991
9411011
9421012   MCFG_CPU_ADD("audiocpu", M68000, 32000000/2)    /* 16.000 MHz */
9431013   MCFG_CPU_PROGRAM_MAP( sound_map )
944   MCFG_CPU_PERIODIC_INT_DRIVER(twinkle_state, irq1_line_assert, 60)
945   MCFG_CPU_PERIODIC_INT_DRIVER(twinkle_state, irq2_line_assert, 60)
9461014
9471015   MCFG_WATCHDOG_TIME_INIT(attotime::from_msec(1200)) /* check TD pin on LTC1232 */
9481016
r242990r242991
10811149   ROM_REGION32_LE( 0x080000, "audiocpu", 0 )\
10821150   ROM_LOAD16_WORD_SWAP( "863a05.2x",    0x000000, 0x080000, CRC(6f42a09e) SHA1(cab5209f90f47b9ee6e721479913ad74e3ba84b1) )\
10831151\
1084   ROM_REGION16_LE(0x400000, "rfsnd", ROMREGION_ERASE00)
1152   ROM_REGION16_LE(0x1800000, "rfsnd", ROMREGION_ERASE00)
10851153
10861154ROM_START( gq863 )
10871155   TWINKLE_BIOS
trunk/src/mame/includes/mario.h
r242990r242991
11#ifndef MARIO_H_
22#define MARIO_H_
33
4#include "sound/discrete.h"
45#include "machine/z80dma.h"
56
6#define OLD_SOUND   (1)
7
8#if !OLD_SOUND
9#include "machine/netlist.h"
10#include "netlist/devices/net_lib.h"
11#else
12#include "sound/discrete.h"
13#endif
14
157/*
168 * From the schematics:
179 *
r242990r242991
5042      m_gfxdecode(*this, "gfxdecode"),
5143      m_palette(*this, "palette"),
5244      m_z80dma(*this, "z80dma"),
53#if OLD_SOUND
5445      m_discrete(*this, "discrete"),
55#else
56      m_audio_snd0(*this, "snd_nl:snd0"),
57        m_audio_snd7(*this, "snd_nl:snd7"),
58        m_audio_dac(*this, "snd_nl:dac"),
59#endif
6046      m_spriteram(*this, "spriteram"),
6147      m_videoram(*this, "videoram"),
6248      m_monitor(0) { }
r242990r242991
6753   required_device<gfxdecode_device> m_gfxdecode;
6854   required_device<palette_device> m_palette;
6955   optional_device<z80dma_device> m_z80dma;
70#if OLD_SOUND
7156   optional_device<discrete_device> m_discrete;
72#else
73   optional_device<netlist_mame_logic_input_t> m_audio_snd0;
74    optional_device<netlist_mame_logic_input_t> m_audio_snd7;
75    optional_device<netlist_mame_logic_input_t> m_audio_dac;
76#endif
7757
7858   /* memory pointers */
7959   required_shared_ptr<UINT8> m_spriteram;
trunk/src/mame/includes/snowbros.h
r242990r242991
5555   DECLARE_DRIVER_INIT(4in1boot);
5656   DECLARE_DRIVER_INIT(3in1semi);
5757   DECLARE_DRIVER_INIT(cookbib2);
58   DECLARE_DRIVER_INIT(toto);
59   DECLARE_READ16_MEMBER(toto_read);
6058   DECLARE_MACHINE_RESET(semiprot);
6159   DECLARE_MACHINE_RESET(finalttr);
6260   UINT32 screen_update_snowbros(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
trunk/src/mame/machine/315-5881_crypt.c
r242990r242991
121121The encryption is done by a stream cipher operating in counter mode, which use a 16-bits internal block cipher.
122122
123123There are 2 "control bits" at the start of the decrypted stream which control the mode of operation: bit #1 set to 1 means
124that the stream needs to be decompressed after being decrypted. More on this later.
124that the decrypted stream needs to be decompressed after being decrypted. More on this later.
125125
126126The next 16-bits are part of the header (they don't belong to the plaintext), but his meaning is unclear. It has been
127127conjectured that it could stablish when to "reset" the process and start processing a new stream (based on some tests
r242990r242991
134134given plaintext word, and the remaining 2 to the next plaintext word.
135135
136136The underlying block cipher consists of two 4-round Feistel Networks (FN): the first one takes the counter (16 bits),
137the game-key (>=27 bits) and the sequence-key (16 bits) and output a middle result (16 bits) which will act as another key
137the game-key (>=26 bits) and the sequence-key (16 bits) and output a middle result (16 bits) which will act as another key
138138for the second one. The second FN will take the encrypted word (16 bits), the game-key, the sequence-key and the result
139139from the first FN and will output the decrypted word (16 bits).
140140
141Each round of the Feistel Networks use four substitution sboxes, each having 6 inputs and 2 outputs. The input is the
142XOR of at most one bit from the previous round and at most one bit from the different keys.
141Each round of the Feistel Networks use four substitution sboxes, each having 6 inputs and 2 outputs. The input can be the
142XOR of at most two "sources bits", being source bits the bits from the previous round and the bits from the different keys.
143143
144144The underlying block cipher has the same structure than the one used by the CPS-2 (Capcom Play System 2) and,
145145indeed, some of the used sboxes are exactly the same and appear in the same FN/round in both systems (this is not evident,
r242990r242991
151151some (encrypted word-decrypted word) pairs suffice. However, due to the weak key scheduling, it should be noted that some
152152related keys can produce the same output bytes for some (short) input sequences.
153153
154The only difference in the decryption process between M2 and M3 is the initialization of the counter. In M3, the counter is
155always set to 0 at the beginning of the decryption while, in M2, the bits #1-#16 of the ciphertext's address are used
156to initialize the counter.
157
154158Note that this implementation considers that the counter initialization for ram decryption is 0 simply because the ram is
155159mapped to multiples of 128K.
156160
r242990r242991
160164chosen so as to make the key for CAPSNK equal to 0.
161165
162166It can be observed that a couple of sboxes have incomplete tables (a 255 value indicate an unknown value). The recovered keys
163as of january/2015 show small randomness and big correlations, making possible that some unseen bits could make the
167as of december/2010 show small randomness and big correlations, making possible that some unseen bits could make the
164168decryption need those incomplete parts.
165169
166170****************************************************************************************/
r242990r242991
474478   {1,29},  {1,71},  {2,4},   {2,54},  {3,8},   {4,56},  {4,73},  {5,11},
475479   {6,51},  {7,92},  {8,89},  {9,9},   {9,10},  {9,39},  {9,41},  {9,58},
476480   {9,59},  {9,86},  {10,90}, {11,6},  {12,64}, {13,49}, {14,44}, {15,40},
477    {16,69}, {17,15}, {18,23}, {18,43}, {19,82}, {20,81}, {21,32}, {22,5},
478   {23,66}, {24,13}, {24,45}, {25,12}, {25,35}, {26,61},
481   {16,69}, {17,15}, {18,23}, {18,43}, {19,82}, {20,81}, {21,32}, {21,61},
482   {22,5},  {23,66}, {24,13}, {24,45}, {25,12}, {25,35}
479483};
480484
481485const int sega_315_5881_crypt_device::fn2_game_key_scheduling[34][2] = {
482486   {0,0},   {1,3},   {2,11},  {3,20},  {4,22},  {5,23},  {6,29},  {7,38},
483487   {8,39},  {9,47},  {9,55},  {9,86},  {9,87},  {9,90},  {10,50}, {10,53},
484488   {11,57}, {12,59}, {13,61}, {13,64}, {14,63}, {15,67}, {16,72}, {17,83},
485    {18,88}, {19,94}, {20,35}, {21,17}, {22,6},  {22,11}, {23,85}, {24,16},
486   {25,25}, {26,92}
489   {18,88}, {19,94}, {20,35}, {21,17}, {21,92}, {22,6},  {22,11}, {23,85},
490   {24,16}, {25,25}
487491};
488492
489493const int sega_315_5881_crypt_device::fn1_sequence_key_scheduling[20][2] = {
trunk/src/mame/machine/naomicrypt.c
r242990r242991
2828{
2929   // name             key              gameid #         year
3030// M2
31   { "wldkicks",        0x052e2901 }, // 25209801    2000
32   { "toukon4",         0x052e2901 }, // 25349801    2000
31   { "wldkicks",        0x00ae2901 }, // 25209801    2000
32   { "toukon4",         0x012e2901 }, // 25349801    2000
3333   { "ninjaslt",        0x000ca510 }, // 25469801    2000
3434   { "ninjaslt4",       0x000ca510 }, // 25469801    2000
3535   { "gunsur2e",        0x000680d0 }, // 25709801    2001
r242990r242991
6868   { "alienfnt",        0x00174343 }, // 840-0048    2001
6969   { "alienfnta",       0x00174343 }, // 840-0048    2001
7070   { "crackdj2",        0x00428247 }, // 840-0068    2001
71   { "vf4cart",         0x06ef2f92 }, // 840-0080    2002
71   { "vf4cart",         0x02ef2f96 }, // 840-0080    2002
7272   { "pstone",          0x000e69c1 }, // 841-0001    1999
7373   { "suchie3",         0x000368e1 }, // 841-0002    1999
7474   { "doa2",            0x0008ad01 }, // 841-0003    1999
trunk/src/mame/mame.lst
r242990r242991
26782678snowbrosd       // MIN16-02 (c) 1990 Toaplan + Dooyong license
26792679wintbob         // bootleg
26802680snowbroswb      //
2681toto         //
26822681// modified snowbros 'clone' hardware
26832682honeydol        // (c) 1995 Barko Corp
26842683twinadv         // (c) 1995 Barko Corp
r242990r242991
54475446starhrsp        // 2003.12.01 Star Horse Progress (satellite) (Rev A)
54485447puyofevp        // 2003.?? Puyo Puyo Fever (prototype)
54495448            // 2003.?? Dragon Treasure
5449            // 2003.?? Rabbit 2
54505450cfield          // 2004.06 Chaos Field
54515451tetkiwam        // 2004.06 Tetris Kiwamemichi (Arcade TV Game List - P.88, Right, 11 from bottom)
54525452trizeal         // 2004.09 Trizeal
r242990r242991
55135513
55145514// NAOMI 2
55155515naomi2          // 2001.?? Naomi 2 BIOS
5516vstrik3c        // 2001.04 Virtua Striker 3 (cartridge)
5516vstrik3        // 2001.04.06 Virtua Striker 3 Ver. 2002
55175517vstrik3cb       // 2001.04 Virtua Striker 3 (Rev B) (cartridge)
5518vstrik3        // 2001.04.06 Virtua Striker 3 Ver. 2002
5518vstrik3c        // 2001.04 Virtua Striker 3 (Rev C) (cartridge)
55195519wldrider        // 2001.05 Wild Riders
55205520clubkrte        // 2001.06 Club Kart: European Session
5521clubkrtd        // 2001.06 Club Kart: European Session (Rev D)
55215522clubkrtc        // 2001.?? Club Kart: European Session (Rev C)
5522clubkrtd        // 2001.06 Club Kart: European Session (Rev D)
55235523beachspi        // 2001.07 Beach Spikers
55245524vf4cart         // 2001.08.02 Virtua Fighter 4 (cartridge)
55255525vf4             // 2001.08.02 Virtua Fighter 4 (GD-ROM)
trunk/src/mess/drivers/comp4.c
r242990r242991
141141static INPUT_PORTS_START( comp4 )
142142   PORT_START("IN.0") // O1
143143   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("R")
144   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
145   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
144   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1")
145   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4")
146146   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7")
147147
148148   PORT_START("IN.1") // O2
149149   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0")
150   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
151   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
150   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2")
151   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5")
152152   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8")
153153
154154   PORT_START("IN.2") // O3
155155   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("E")
156   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
157   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
156   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3")
157   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6")
158158   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9")
159159INPUT_PORTS_END
160160
trunk/src/mess/drivers/splitsec.c
r242990r242991
1// license:BSD-3-Clause
2// copyright-holders:hap
3/***************************************************************************
4
5  Parker Brothers Split Second
6  * TMS1400NLL MP7314-N2 (die labeled MP7314)
7
8
9***************************************************************************/
10
11#include "emu.h"
12#include "cpu/tms0980/tms0980.h"
13#include "sound/speaker.h"
14
15#include "splitsec.lh"
16
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)
20
21
22class splitsec_state : public driver_device
23{
24public:
25   splitsec_state(const machine_config &mconfig, device_type type, const char *tag)
26      : driver_device(mconfig, type, tag),
27      m_maincpu(*this, "maincpu"),
28      m_button_matrix(*this, "IN"),
29      m_speaker(*this, "speaker")
30   { }
31
32   required_device<cpu_device> m_maincpu;
33   required_ioport_array<2> m_button_matrix;
34   required_device<speaker_sound_device> m_speaker;
35
36   UINT16 m_r;
37   UINT16 m_o;
38
39   UINT16 m_leds_state[0x10];
40   UINT16 m_leds_cache[0x10];
41   UINT8 m_leds_decay[0x100];
42
43   DECLARE_READ8_MEMBER(read_k);
44   DECLARE_WRITE16_MEMBER(write_o);
45   DECLARE_WRITE16_MEMBER(write_r);
46
47   TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick);
48   void leds_update();
49
50   virtual void machine_start();
51};
52
53
54
55/***************************************************************************
56
57  LEDs
58
59***************************************************************************/
60
61// The device strobes the outputs very fast, it is unnoticeable to the user.
62// To prevent flickering here, we need to simulate a decay.
63
64// decay time, in steps of 10ms
65#define LEDS_DECAY_TIME 4
66
67void splitsec_state::leds_update()
68{
69   UINT16 active_state[0x10];
70
71   for (int i = 0; i < 0x10; i++)
72   {
73      // update current state
74      if (m_r >> i & 1)
75         m_leds_state[i] = m_o;
76
77      active_state[i] = 0;
78
79      for (int j = 0; j < 0x10; j++)
80      {
81         int di = j << 4 | i;
82
83         // turn on powered leds
84         if (m_leds_state[i] >> j & 1)
85            m_leds_decay[di] = LEDS_DECAY_TIME;
86
87         // determine active state
88         int ds = (m_leds_decay[di] != 0) ? 1 : 0;
89         active_state[i] |= (ds << j);
90      }
91   }
92
93   // on difference, send to output
94   for (int i = 0; i < 0x10; i++)
95      if (m_leds_cache[i] != active_state[i])
96      {
97         for (int j = 0; j < 8; j++)
98            output_set_lamp_value(i*10 + j, active_state[i] >> j & 1);
99      }
100
101   memcpy(m_leds_cache, active_state, sizeof(m_leds_cache));
102}
103
104TIMER_DEVICE_CALLBACK_MEMBER(splitsec_state::leds_decay_tick)
105{
106   // slowly turn off unpowered leds
107   for (int i = 0; i < 0x100; i++)
108      if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i])
109         m_leds_decay[i]--;
110
111   leds_update();
112}
113
114
115
116/***************************************************************************
117
118  I/O
119
120***************************************************************************/
121
122READ8_MEMBER(splitsec_state::read_k)
123{
124   UINT8 k = 0;
125
126   // read selected button rows
127   for (int i = 0; i < 2; i++)
128      if (m_r >> (i+9) & 1)
129         k |= m_button_matrix[i]->read();
130
131   return k;
132}
133
134WRITE16_MEMBER(splitsec_state::write_r)
135{
136   // R8: speaker out
137   m_speaker->level_w(data >> 8 & 1);
138   
139   // R9,R10: input mux
140   // R0-R7: led columns
141   m_r = data;
142   leds_update();
143}
144
145WRITE16_MEMBER(splitsec_state::write_o)
146{
147   // O0-O6: led rows
148   // O7: N/C
149   m_o = data;
150   leds_update();
151}
152
153
154
155/***************************************************************************
156
157  Inputs
158
159***************************************************************************/
160
161static INPUT_PORTS_START( splitsec )
162   PORT_START("IN.0") // R9
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 )
166   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
167
168   PORT_START("IN.1") // R10
169   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
170   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Select")
171   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Start")
172   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
173INPUT_PORTS_END
174
175
176
177/***************************************************************************
178
179  Machine Config
180
181***************************************************************************/
182
183void splitsec_state::machine_start()
184{
185   // zerofill
186   memset(m_leds_state, 0, sizeof(m_leds_state));
187   memset(m_leds_cache, 0, sizeof(m_leds_cache));
188   memset(m_leds_decay, 0, sizeof(m_leds_decay));
189
190   m_r = 0;
191   m_o = 0;
192
193   // register for savestates
194   save_item(NAME(m_leds_state));
195   save_item(NAME(m_leds_cache));
196   save_item(NAME(m_leds_decay));
197
198   save_item(NAME(m_r));
199   save_item(NAME(m_o));
200}
201
202
203static MACHINE_CONFIG_START( splitsec, splitsec_state )
204
205   /* basic machine hardware */
206   MCFG_CPU_ADD("maincpu", TMS1400, MASTER_CLOCK)
207   MCFG_TMS1XXX_READ_K_CB(READ8(splitsec_state, read_k))
208   MCFG_TMS1XXX_WRITE_O_CB(WRITE16(splitsec_state, write_o))
209   MCFG_TMS1XXX_WRITE_R_CB(WRITE16(splitsec_state, write_r))
210
211   MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", splitsec_state, leds_decay_tick, attotime::from_msec(10))
212
213   MCFG_DEFAULT_LAYOUT(layout_splitsec)
214
215   /* no video! */
216
217   /* sound hardware */
218   MCFG_SPEAKER_STANDARD_MONO("mono")
219   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
220   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
221MACHINE_CONFIG_END
222
223
224
225/***************************************************************************
226
227  Game driver(s)
228
229***************************************************************************/
230
231ROM_START( splitsec )
232   ROM_REGION( 0x1000, "maincpu", 0 )
233   ROM_LOAD( "tms1400nll_mp7314", 0x0000, 0x1000, CRC(0cccdf59) SHA1(06a533134a433aaf856b80f0ca239d0498b98d5f) )
234
235   ROM_REGION( 867, "maincpu:mpla", 0 )
236   ROM_LOAD( "tms1100_default_mpla.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) )
237   ROM_REGION( 557, "maincpu:opla", 0 )
238   ROM_LOAD( "tms1400_splitsec_opla.pla", 0, 557, CRC(7539283b) SHA1(f791fa98259fc10c393ff1961d4c93040f1a2932) )
239ROM_END
240
241
242CONS( 1980, splitsec, 0, 0, splitsec, splitsec, driver_device, 0, "Parker Brothers", "Split Second", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING )
trunk/src/mess/includes/msx.h
r242990r242991
2424#include "formats/basicdsk.h"
2525#include "formats/fmsx_cas.h"
2626#include "formats/msx_dsk.h"
27//#include "osdepend.h"
2728#include "hashfile.h"
2829#include "machine/wd_fdc.h"
2930#include "imagedev/floppy.h"
trunk/src/mess/layout/splitsec.lay
r242990r242991
1<?xml version="1.0"?>
2<mamelayout version="2">
3
4<!-- define elements -->
5
6   <element name="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element>
7
8   <element name="lamp_disk" defstate="0">
9      <disk state="1"><color red="1.0" green="0.24" blue="0.26" /></disk>
10      <disk state="0"><color red="0.15" green="0.043" blue="0.047" /></disk>
11   </element>
12   <element name="lamp_rect" defstate="0">
13      <rect state="1"><color red="1.0" green="0.24" blue="0.26" /></rect>
14      <rect state="0"><color red="0.15" green="0.043" blue="0.047" /></rect>
15   </element>
16
17
18<!-- build screen -->
19
20   <view name="Internal Layout">
21      <bounds left="0" right="18" top="0" bottom="28" />
22      <bezel element="static_black">
23         <bounds left="0" right="18" top="0" bottom="28" />
24      </bezel>
25
26   <!-- maze of lamps -->
27
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>
31
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>
35      <bezel name="lamp3" element="lamp_disk"><bounds x="8" y="3" width="2" height="2" /></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>
39
40      <bezel name="lamp15" element="lamp_rect"><bounds x="2" y="6" width="4" height="1" /></bezel>
41      <bezel name="lamp13" element="lamp_rect"><bounds x="7" y="6" width="4" height="1" /></bezel>
42      <bezel name="lamp11" element="lamp_rect"><bounds x="12" y="6" width="4" height="1" /></bezel>
43
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>
47      <bezel name="lamp23" element="lamp_disk"><bounds x="8" y="8" width="2" height="2" /></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>
51
52      <bezel name="lamp35" element="lamp_rect"><bounds x="2" y="11" width="4" height="1" /></bezel>
53      <bezel name="lamp33" element="lamp_rect"><bounds x="7" y="11" width="4" height="1" /></bezel>
54      <bezel name="lamp31" element="lamp_rect"><bounds x="12" y="11" width="4" height="1" /></bezel>
55
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>
59      <bezel name="lamp43" element="lamp_disk"><bounds x="8" y="13" width="2" height="2" /></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>
63
64      <bezel name="lamp55" element="lamp_rect"><bounds x="2" y="16" width="4" height="1" /></bezel>
65      <bezel name="lamp53" element="lamp_rect"><bounds x="7" y="16" width="4" height="1" /></bezel>
66      <bezel name="lamp51" element="lamp_rect"><bounds x="12" y="16" width="4" height="1" /></bezel>
67
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>
71      <bezel name="lamp63" element="lamp_disk"><bounds x="8" y="18" width="2" height="2" /></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>
75
76      <bezel name="lamp75" element="lamp_rect"><bounds x="2" y="21" width="4" height="1" /></bezel>
77      <bezel name="lamp73" element="lamp_rect"><bounds x="7" y="21" width="4" height="1" /></bezel>
78      <bezel name="lamp71" element="lamp_rect"><bounds x="12" y="21" width="4" height="1" /></bezel>
79
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>
87
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>
91
92   </view>
93</mamelayout>
trunk/src/mess/mess.lst
r242990r242991
22692269starwbcp
22702270stopthie
22712271stopthiep
2272splitsec
22732272amico2k
22742273jtc
22752274jtces88
trunk/src/mess/mess.mak
r242990r242991
14901490$(MESSOBJ)/parker.a:            \
14911491   $(MESS_DRIVERS)/cnsector.o  \
14921492   $(MESS_DRIVERS)/merlin.o    \
1493   $(MESS_DRIVERS)/splitsec.o  \
14941493   $(MESS_DRIVERS)/stopthie.o  \
14951494
14961495$(MESSOBJ)/pitronic.a:          \
r242990r242991
21722171$(MESS_DRIVERS)/sitcom.o:   $(MESS_LAYOUT)/sitcom.lh
21732172$(MESS_DRIVERS)/slc1.o:     $(MESS_LAYOUT)/slc1.lh
21742173$(MESS_DRIVERS)/sms.o:      $(MESS_LAYOUT)/sms1.lh
2175$(MESS_DRIVERS)/splitsec.o: $(MESS_LAYOUT)/splitsec.lh
21762174$(MESS_DRIVERS)/starwbc.o:  $(MESS_LAYOUT)/starwbc.lh
21772175$(MESS_DRIVERS)/stopthie.o: $(MESS_LAYOUT)/stopthie.lh
21782176$(MESS_DRIVERS)/super80.o:  $(MESS_LAYOUT)/super80.lh
trunk/src/osd/modules/lib/osdobj_common.c
r242990r242991
346346//  font with the given name
347347//-------------------------------------------------
348348
349osd_font *osd_common_t::font_open(const char *name, int &height)
349osd_font osd_common_t::font_open(const char *name, int &height)
350350{
351351   return NULL;
352352}
r242990r242991
357357//  a given OSD font
358358//-------------------------------------------------
359359
360void osd_common_t::font_close(osd_font *font)
360void osd_common_t::font_close(osd_font font)
361361{
362362}
363363
r242990r242991
370370//  pixel of a black & white font
371371//-------------------------------------------------
372372
373bool osd_common_t::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
373bool osd_common_t::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
374374{
375375   return false;
376376}
trunk/src/osd/modules/lib/osdobj_common.h
r242990r242991
153153   virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
154154
155155   // font overridables
156   virtual osd_font *font_open(const char *name, int &height);
157   virtual void font_close(osd_font *font);
158   virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
156   virtual osd_font font_open(const char *name, int &height);
157   virtual void font_close(osd_font font);
158   virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
159159
160160   // video overridables
161161   virtual void *get_slider_list();
trunk/src/osd/osdcore.c
r242990r242991
5353
5454output_delegate osd_set_output_channel(output_channel channel, output_delegate callback)
5555{
56   if (!(channel < OSD_OUTPUT_CHANNEL_COUNT) || callback.isnull())
57    {
58       throw std::exception();
59    }
56   assert(channel < OSD_OUTPUT_CHANNEL_COUNT);
57   assert(!callback.isnull());
6058
6159   /* return the originals if requested */
6260   output_delegate prevcb = output_cb[channel];
trunk/src/osd/osdepend.h
r242990r242991
2727//============================================================
2828
2929// FIXME: We can do better than this
30class osd_font;
30typedef void *osd_font;
3131
3232// ======================> osd_interface
3333
r242990r242991
5353   virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) = 0;
5454
5555   // font overridables
56   virtual osd_font *font_open(const char *name, int &height) = 0;
57   virtual void font_close(osd_font *font) = 0;
58   virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0;
56   virtual osd_font font_open(const char *name, int &height) = 0;
57   virtual void font_close(osd_font font) = 0;
58   virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0;
5959
6060   // video overridables
6161   virtual void *get_slider_list() = 0; // FIXME: returns slider_state *
trunk/src/osd/osdmini/minimain.c
r242990r242991
5555
5656
5757//============================================================
58//  mini_osd_options
59//============================================================
60
61mini_osd_options::mini_osd_options()
62: osd_options()
63{
64   //add_entries(s_option_entries);
65}
66
67//============================================================
6858//  main
6959//============================================================
7060
r242990r242991
7262{
7363   // cli_frontend does the heavy lifting; if we have osd-specific options, we
7464   // create a derivative of cli_options and add our own
75   mini_osd_options options;
76   mini_osd_interface osd(options);
77   osd.register_options();
65   cli_options options;
66   mini_osd_interface osd;
67   osd.register_options(options);
7868   cli_frontend frontend(options, osd);
7969   return frontend.execute(argc, argv);
8070}
r242990r242991
8474//  constructor
8575//============================================================
8676
87mini_osd_interface::mini_osd_interface(mini_osd_options &options)
88: osd_common_t(options)
77mini_osd_interface::mini_osd_interface()
8978{
9079}
9180
r242990r242991
10695void mini_osd_interface::init(running_machine &machine)
10796{
10897   // call our parent
109   osd_common_t::init(machine);
98   osd_interface::init(machine);
11099
111100   // initialize the video system by allocating a rendering target
112101   our_target = machine.render().target_alloc();
trunk/src/osd/osdmini/osdmini.h
r242990r242991
88
99#include "options.h"
1010#include "osdepend.h"
11#include "modules/lib/osdobj_common.h"
1211
1312
14class mini_osd_options : public osd_options
15{
16public:
17   // construction/destruction
18   mini_osd_options();
19
20};
21
2213//============================================================
2314//  TYPE DEFINITIONS
2415//============================================================
2516
26class mini_osd_interface : public osd_common_t
17class mini_osd_interface : public osd_interface
2718{
2819public:
2920   // construction/destruction
30   mini_osd_interface(mini_osd_options &options);
21   mini_osd_interface();
3122   virtual ~mini_osd_interface();
3223
3324   // general overridables
trunk/src/osd/osdmini/osdmini.mak
r242990r242991
5050OSDSRC = $(SRC)/osd
5151OSDOBJ = $(OBJ)/osd
5252
53OBJDIRS += $(MINIOBJ) \
54   $(OSDOBJ)/modules/sync \
55   $(OSDOBJ)/modules/lib \
56   $(OSDOBJ)/modules/midi
53OBJDIRS += $(MINIOBJ) $(OSDOBJ)/modules/sync
5754
55
56
5857#-------------------------------------------------
5958# OSD core library
6059#-------------------------------------------------
r242990r242991
6564   $(MINIOBJ)/minimisc.o \
6665   $(MINIOBJ)/minisync.o \
6766   $(MINIOBJ)/minitime.o \
67   $(OSDOBJ)/modules/sync/work_mini.o \
6868
6969#-------------------------------------------------
7070# OSD mini library
7171#-------------------------------------------------
7272
7373OSDOBJS = \
74   $(MINIOBJ)/minimain.o \
75   $(OSDOBJ)/modules/sync/work_mini.o \
76   $(OSDOBJ)/modules/lib/osdobj_common.o  \
77   $(OSDOBJ)/modules/midi/none.o \
74   $(MINIOBJ)/minimain.o
7875
7976ifeq ($(OS),Windows_NT)
8077LIBS += -lwinmm -lwsock32
trunk/src/osd/sdl/draw13.c
r242990r242991
134134    const HashT hash() const { return m_hash; }
135135    const UINT32 flags() const { return m_flags; }
136136    const bool is_pixels_owned() const { // do we own / allocated it ?
137        return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC)
138                && (m_copyinfo->func != NULL)) ;
137        return m_sdl_access == SDL_TEXTUREACCESS_STATIC
138                && m_copyinfo->func != NULL ;
139139    }
140140
141141private:
142    Uint32              m_sdl_access;
143142    SDL_Renderer *      m_renderer;
144143    render_texinfo      m_texinfo;            // copy of the texture info
145144    HashT               m_hash;               // hash value for the texture (must be >= pointer size)
r242990r242991
150149
151150    int                 m_format;             // texture format
152151    SDL_BlendMode       m_sdl_blendmode;
152    Uint32              m_sdl_access;
153153
154154    texture_info *      m_next;               // next texture in the list
155155};
r242990r242991
490490   }
491491}
492492
493// FIXME: machine only used to access options.
494493int drawsdl2_init(running_machine &machine, sdl_draw_info *callbacks)
495494{
496495   const char *stemp;
r242990r242991
10081007
10091008texture_info::~texture_info()
10101009{
1011    if ( is_pixels_owned() && (m_pixels != NULL) )
1012        free(m_pixels);
10131010    SDL_DestroyTexture(m_texture_id);
1011    if ( is_pixels_owned() && m_pixels != NULL )
1012        free(m_pixels);
10141013}
10151014
10161015//============================================================
trunk/src/osd/sdl/man/castool.1
r242990r242991
66.\" Cesare Falco <c.falco@ubuntu.com>, February 2011
77.\"
88.\"
9.TH CASTOOL 1 2014-12-15 0.157 "MESS Generic cassette manipulation tool"
9.TH CASTOOL 1 2015-01-18 0.158 "MESS Generic cassette manipulation tool"
1010.\"
1111.\"
1212.\" NAME chapter
trunk/src/osd/sdl/man/chdman.1
r242990r242991
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 2014-12-15 0.157 "MAME Compressed Hunks of Data (CHD) manager"
9.TH CHDMAN 1 2015-01-18 0.158 "MAME Compressed Hunks of Data (CHD) manager"
1010.\"
1111.\" NAME chapter
1212.SH NAME
trunk/src/osd/sdl/man/floptool.1
r242990r242991
66.\" Cesare Falco <c.falco@ubuntu.com>, April 2014
77.\"
88.\"
9.TH FLOPTOOL 1 2014-12-15 0.157 "MESS Generic floppy manipulation tool"
9.TH FLOPTOOL 1 2015-01-18 0.158 "MESS Generic floppy manipulation tool"
1010.\"
1111.\"
1212.\" NAME chapter
trunk/src/osd/sdl/man/imgtool.1
r242990r242991
66.\" Cesare Falco <c.falco@ubuntu.com>, February 2011
77.\"
88.\"
9.TH IMGTOOL 1 2014-12-15 0.157 "MESS media image manipulation tool"
9.TH IMGTOOL 1 2015-01-18 0.158 "MESS media image manipulation tool"
1010.\"
1111.\"
1212.\" NAME chapter
trunk/src/osd/sdl/man/jedutil.1
r242990r242991
88.\" References
99.\" http://aarongiles.com/?p=159
1010.\"
11.TH JEDUTIL 1 2014-12-15 0.157 "MAME JEDEC file utilities"
11.TH JEDUTIL 1 2015-01-18 0.158 "MAME JEDEC file utilities"
1212.\"
1313.\" NAME chapter
1414.SH NAME
trunk/src/osd/sdl/man/ldresample.1
r242990r242991
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 2014-12-15 0.157 "MAME laserdisc audio manipulation tool"
6.TH LDRESAMPLE 1 2015-01-18 0.158 "MAME laserdisc audio manipulation tool"
77.\"
88.\" Please adjust this date whenever revising the manpage.
99.\"
trunk/src/osd/sdl/man/ldverify.1
r242990r242991
55.\" Man page created from source and usage information by
66.\" Cesare Falco <c.falco@ubuntu.com>, August 2008
77.\"
8.TH LDVERIFY 1 2014-12-15 0.157 "MAME laserdisc data checker"
8.TH LDVERIFY 1 2015-01-18 0.158 "MAME laserdisc data checker"
99.\"
1010.\" NAME chapter
1111.SH NAME
trunk/src/osd/sdl/man/mame.6
r242990r242991
1313.\" and updated by Andrew Burton <burtona@gol.com>, July 2003
1414.\"
1515.\"
16.TH MAME 6 2014-12-15 0.157 "MAME \- The Multiple Arcade Machine Emulator"
16.TH MAME 6 2015-01-18 0.158 "MAME \- The Multiple Arcade Machine Emulator"
1717.\"
1818.\"
1919.\" NAME chapter
trunk/src/osd/sdl/man/mess.6
r242990r242991
1616.\" http://www.mess.org/
1717.\"
1818.\"
19.TH MESS 6 2014-12-15 0.157 "The Multiple Emulator Super System (MESS)"
19.TH MESS 6 2015-01-18 0.158 "The Multiple Emulator Super System (MESS)"
2020.\"
2121.\"
2222.\" NAME chapter
trunk/src/osd/sdl/man/romcmp.1
r242990r242991
99.\" References
1010.\" http://www.mame.net/mamefaq.html
1111.\"
12.TH ROMCMP 1 2014-12-15 0.157 "MAME romset checking tool"
12.TH ROMCMP 1 2015-01-18 0.158 "MAME romset checking tool"
1313.\"
1414.\" NAME chapter
1515.SH NAME
trunk/src/osd/sdl/man/testkeys.1
r242990r242991
55.\" Man page created from source and usage information
66.\" Cesare Falco <c.falco@ubuntu.com>, February 2007
77.\"
8.TH TESTKEYS 1 2014-12-15 0.157 "MAME SDL keycode scanner"
8.TH TESTKEYS 1 2015-01-18 0.158 "MAME SDL keycode scanner"
99.\"
1010.\" NAME chapter
1111.SH NAME
trunk/src/osd/sdl/osdsdl.h
r242990r242991
115115//  TYPE DEFINITIONS
116116//============================================================
117117
118typedef void *osd_font;
119
120//============================================================
121//  TYPE DEFINITIONS
122//============================================================
123
118124class sdl_options : public osd_options
119125{
120126public:
r242990r242991
187193   virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
188194
189195   // font overridables
190   virtual osd_font *font_open(const char *name, int &height);
191   virtual void font_close(osd_font *font);
192   virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
196   virtual osd_font font_open(const char *name, int &height);
197   virtual void font_close(osd_font font);
198   virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
193199
194200   virtual void video_register();
195201   virtual void sound_register();
trunk/src/osd/sdl/sdlmain.c
r242990r242991
717717//  font with the given name
718718//-------------------------------------------------
719719
720class osd_font
720osd_font sdl_osd_interface::font_open(const char *_name, int &height)
721721{
722public:
723    CTFontRef m_font;
724};
725
726osd_font *sdl_osd_interface::font_open(const char *_name, int &height)
727{
728722   CFStringRef font_name = NULL;
729723   CTFontRef ct_font = NULL;
730724   CTFontDescriptorRef font_descriptor;
r242990r242991
776770   line_height += CTFontGetLeading(ct_font);
777771   height = ceilf(line_height * EXTRA_HEIGHT);
778772
779   osd_font *ret = global_alloc(osd_font);
780   ret->m_font = ct_font;
781   return ret;
773   return (osd_font)ct_font;
782774}
783775
784776//-------------------------------------------------
r242990r242991
786778//  a given OSD font
787779//-------------------------------------------------
788780
789void sdl_osd_interface::font_close(osd_font *font)
781void sdl_osd_interface::font_close(osd_font font)
790782{
791   CTFontRef ct_font = font->m_font;
783   CTFontRef ct_font = (CTFontRef)font;
792784
793785   if( ct_font != NULL )
794786   {
795787      CFRelease( ct_font );
796788   }
797   global_free(font);
798789}
799790
800791//-------------------------------------------------
r242990r242991
805796//  pixel of a black & white font
806797//-------------------------------------------------
807798
808bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
799bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
809800{
810801   UniChar uni_char;
811802   CGGlyph glyph;
812   CTFontRef ct_font = font->m_font;
803   CTFontRef ct_font = (CTFontRef)font;
813804   const CFIndex count = 1;
814805   CGRect bounding_rect, success_rect;
815806   CGContextRef context_ref;
r242990r242991
10181009//  font with the given name
10191010//-------------------------------------------------
10201011
1021class osd_font
1012osd_font sdl_osd_interface::font_open(const char *_name, int &height)
10221013{
1023public:
1024    TTF_Font *m_font;
1025};
1026
1027osd_font *sdl_osd_interface::font_open(const char *_name, int &height)
1028{
10291014   TTF_Font *font = (TTF_Font *)NULL;
10301015   bool bakedstyles = false;
10311016   int style = 0;
r242990r242991
10961081
10971082   height = TTF_FontLineSkip(font);
10981083
1099   osd_font *ret = global_alloc(osd_font);
1100   ret->m_font = font;
1101   return ret;
1084   return (osd_font)font;
11021085}
11031086
11041087//-------------------------------------------------
r242990r242991
11061089//  a given OSD font
11071090//-------------------------------------------------
11081091
1109void sdl_osd_interface::font_close(osd_font *font)
1092void sdl_osd_interface::font_close(osd_font font)
11101093{
1111   TTF_CloseFont(font->m_font);
1112   global_free(font);
1094   TTF_Font *ttffont;
1095
1096   ttffont = (TTF_Font *)font;
1097
1098   TTF_CloseFont(ttffont);
11131099}
11141100
11151101//-------------------------------------------------
r242990r242991
11201106//  pixel of a black & white font
11211107//-------------------------------------------------
11221108
1123bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
1109bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
11241110{
11251111   TTF_Font *ttffont;
11261112   SDL_Surface *drawsurf;
11271113   SDL_Color fcol = { 0xff, 0xff, 0xff };
11281114   UINT16 ustr[16];
11291115
1130   ttffont = font->m_font;
1116   ttffont = (TTF_Font *)font;
11311117
11321118   memset(ustr,0,sizeof(ustr));
11331119   ustr[0] = (UINT16)chnum;
trunk/src/osd/windows/winmain.c
r242990r242991
719719//  font with the given name
720720//-------------------------------------------------
721721
722osd_font *windows_osd_interface::font_open(const char *_name, int &height)
722osd_font windows_osd_interface::font_open(const char *_name, int &height)
723723{
724724   // accept qualifiers from the name
725725   astring name(_name);
r242990r242991
751751
752752   // create the font
753753   height = logfont.lfHeight;
754   osd_font *font = reinterpret_cast<osd_font *>(CreateFontIndirect(&logfont));
754   osd_font font = reinterpret_cast<osd_font>(CreateFontIndirect(&logfont));
755755   if (font == NULL)
756756      return NULL;
757757
r242990r242991
783783//  a given OSD font
784784//-------------------------------------------------
785785
786void windows_osd_interface::font_close(osd_font *font)
786void windows_osd_interface::font_close(osd_font font)
787787{
788788   // delete the font ojbect
789789   if (font != NULL)
r242990r242991
799799//  pixel of a black & white font
800800//-------------------------------------------------
801801
802bool windows_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
802bool windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs)
803803{
804804   // create a dummy DC to work with
805805   HDC dummyDC = CreateCompatibleDC(NULL);
trunk/src/osd/windows/winmain.h
r242990r242991
253253   virtual void customize_input_type_list(simple_list<input_type_entry> &typelist);
254254
255255   // font overridables
256   virtual osd_font *font_open(const char *name, int &height);
257   virtual void font_close(osd_font *font);
258   virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
256   virtual osd_font font_open(const char *name, int &height);
257   virtual void font_close(osd_font font);
258   virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs);
259259
260260   virtual void video_register();
261261   virtual void sound_register();
trunk/src/tools/nltool.c
r242990r242991
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, ...)
r242990r242991
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{
r242990r242991
7572         src_type.name(), dst_type.name());
7673   throw;
7774}
78#endif
7975
8076struct options_entry oplist[] =
8177{
r242990r242991
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***************************************************************************/
r242990r242991
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   }
r242990r242991
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