Previous 199869 Revisions Next

r31374 Tuesday 22nd July, 2014 at 06:14:55 UTC by Miodrag Milanović
Cleanups and version bump
[src]version.c
[src/emu]clifront.c emupal.c image.c luaengine.c machine.c mame.c memory.c softlist.c video.c webengine.c
[src/emu/bus/a1bus]a1bus.c a1cassette.c a1cffa.c
[src/emu/bus/a2bus]a2diskiing.c a2dx1.c a2mcms.c
[src/emu/bus/amiga/zorro]a2052.c a2232.c a590.c action_replay.c buddha.c cards.c zorro.c
[src/emu/bus/c64]ieee488.c xl80.c
[src/emu/bus/comx35]clm.c
[src/emu/bus/cpc]cpc_pds.c cpc_rs232.c
[src/emu/bus/ecbbus]grip.c
[src/emu/bus/gameboy]gb_slot.c
[src/emu/bus/isa]aga.c cga.c mach32.c mda.c omti8621.c p1_hdc.c vga_ati.c
[src/emu/bus/msx_cart]arc.c ascii.c bm_012.c cartridge.c crossblaim.c dooly.c fmpac.c halnote.c hfox.c holy_quran.c konami.c korean.c majutsushi.c msx_audio.c msx_audio_kb.c msxdos2.c nomapper.c rtype.c super_swangi.c superloderunner.c yamaha.c
[src/emu/bus/msx_slot]bunsetsu.c cartridge.c disk.c fs4600.c music.c panasonic08.c ram.c ram_mm.c rom.c slot.c sony08.c
[src/emu/bus/neogeo]banked_cart.c bootleg_cart.c bootleg_prot.c cmc_cart.c cmc_prot.c fatfury2_cart.c fatfury2_prot.c kof2002_cart.c kof2002_prot.c kof98_cart.c kof98_prot.c mslugx_cart.c mslugx_prot.c neogeo_carts.c neogeo_intf.c neogeo_slot.c pcm2_cart.c pcm2_prot.c pvc_cart.c pvc_prot.c rom.c sbp_prot.c sma_cart.c sma_prot.c
[src/emu/bus/nes]2a03pur.c
[src/emu/bus/plus4]c1551.c
[src/emu/bus/ql]cst_qdisc.c cumana_fdi.c qubide.c rom.c sandy_superdisk.c sandy_superqboard.c trumpcard.c
[src/emu/bus/scsi]scsi.c scsihle.c
[src/emu/bus/vtech/ioexp]carts.c ioexp.c joystick.c printer.c
[src/emu/bus/vtech/memexp]carts.c floppy.c memexp.c memory.c rs232.c wordpro.c
[src/emu/bus/wangpc]lvc.c mvc.c
[src/emu/cpu/alto2]alto2cpu.c
[src/emu/cpu/g65816]g65816.c
[src/emu/cpu/i86]i86.c
[src/emu/cpu/m6809]hd6309.c konami.c
[src/emu/cpu/mb86233]mb86233.c
[src/emu/cpu/mb86235]mb86235.c
[src/emu/cpu/minx]minx.c
[src/emu/cpu/mips]mips3.c mips3drc.c
[src/emu/cpu/powerpc]ppccom.c ppcdrc.c
[src/emu/cpu/rsp]rsp.c
[src/emu/cpu/sh2]sh2.c sh2comn.c sh2drc.c
[src/emu/cpu/sh4]sh4.c sh4dmac.c
[src/emu/cpu/tms34010]tms34010.c
[src/emu/cpu/tms57002]tms57002.c
[src/emu/cpu/tms7000]tms7000.c
[src/emu/cpu/z80]tmpz84c011.c tmpz84c015.c
[src/emu/imagedev]cassette.c
[src/emu/machine]53c810.c 6532riot.c 68307.c 6840ptm.c aakart.c adc0808.c akiko.c amigafdc.c atahle.c autoconfig.c corvushd.c cr511b.c dmac.c eepromser.c gayle.c hd63450.c i8255.c i8271.c keyboard.c mb89363b.c mc68681.c ncr539x.c netlist.c roc10937.c upd765.c wd17xx.c wd7600.c wozfdc.c ym2148.c z80ctc.c
[src/emu/netlist]nl_base.c nl_parser.c nl_setup.c
[src/emu/netlist/analog]nld_bjt.c nld_fourterm.c nld_opamps.c nld_solver.c nld_twoterm.c
[src/emu/netlist/devices]net_lib.c nld_4020.c nld_7400.c nld_74123.c nld_7474.c nld_7490.c nld_74ls629.c nld_9316.c nld_legacy.c nld_ne555.c nld_r2r_dac.c nld_system.c
[src/emu/sound]2203intf.c 2608intf.c 2610intf.c ay8910.c es5506.c k053260.c k054539.c pokey.c rf5c68.c
[src/emu/video]crt9007.c hd44780.c i8275.c mc6845.c resnet.c snes_ppu.c tms3556.c voodoo.c
[src/lib/formats]ap2_dsk.c msx_dsk.c oric_dsk.c rx50_dsk.c
[src/lib/lua]lapi.c lauxlib.c lbaselib.c lbitlib.c lcode.c lcorolib.c lctype.c ldblib.c ldebug.c ldo.c ldump.c lfunc.c lgc.c linit.c liolib.c llex.c lmathlib.c lmem.c loadlib.c lobject.c lopcodes.c loslib.c lparser.c lstate.c lstring.c lstrlib.c ltable.c ltablib.c ltm.c lua.c luac.c lundump.c lvm.c lzio.c
[src/lib/lua/lib]lsqlite3.c
[src/lib/sqlite3]shell.c
[src/lib/util]corealloc.c zippath.c
[src/lib/web]mongoose.c
[src/mame/audio]cage.c cinemat.c dcs.c midway.c
[src/mame/drivers]1942.c 8080bw.c 88games.c aces1.c ajax.c aliens.c alpha68k.c alvg.c amaticmg.c arachnid.c astinvad.c astrof.c atari_s1.c atarigt.c backfire.c bagman.c bfm_sc1.c bfm_sc4.c bfm_sc45_helper.c bfm_sc4h.c blktiger.c blockhl.c bnstars.c boogwing.c bottom9.c byvid.c capcom.c cave.c chanbara.c chihiro.c chqflag.c cliffhgr.c cninja.c cobra.c cocoloco.c coinmstr.c coolridr.c crimfght.c csplayh5.c cubo.c darkseal.c dassault.c dbz.c de_3.c deco32.c dreamwld.c dwarfd.c ecoinf2.c ecoinf3.c fireball.c fortecar.c funworld.c g627.c galaxold.c gbusters.c gcpinbal.c ghosteo.c goldstar.c goodejan.c gp_1.c gstriker.c gticlub.c hornet.c icecold.c igs011.c igs017.c itech32.c jpmmps.c jpmsys5.c kenseim.c kingdrby.c kingpin.c lucky74.c magicard.c malzak.c maygay1b.c maygay1bsw.c maygayv1.c megaphx.c meritm.c metalmx.c midas.c midvunit.c midxunit.c midzeus.c model2.c mpu4hw.c mpu4sw.c mpu4vid.c mrgame.c mustache.c mystwarr.c naomi.c naughtyb.c nbmj9195.c neogeo.c neogeo_noslot.c niyanpai.c nl_pongd.c norautp.c nwk-tr.c nyny.c parodius.c pcxt.c pgm.c phoenix.c play_5.c playmark.c pong.c popeye.c proconn.c quakeat.c rastersp.c re900.c rohga.c rollerg.c rpunch.c sam.c sanremo.c savquest.c scramble.c seattle.c segas16b.c segaxbd.c sg1000a.c simpl156.c simpsons.c skylncr.c spy.c statriv2.c supercrd.c surpratk.c taito_b.c taito_l.c taitopjc.c tapatune.c tatsumi.c tempest.c thunderx.c tigeroad.c timeplt.c triforce.c turbo.c vectrex.c vegas.c vroulet.c williams.c wpc_95.c wpc_dcs.c wpc_s.c wyvernf0.c zr107.c
[src/mame/machine]archimds.c balsente.c bfm_bd1.c fd1094.c midwayic.c ng_memcard.c pcshare.c tigeroad.c wpc_out.c wpc_pic.c
[src/mame/video]armedf.c cps1.c deco16ic.c deco_zoomspr.c decospr.c dkong.c excellent_spr.c gaiden.c galspnbl.c gstriker.c k001005.c k001006.c k051316.c k051960.c k052109.c k053246_k053247_k055673.c k053936.c k054156_k054157_k056832.c k054338.c kaneko16.c konamigx.c mappy.c mb60553.c midzeus2.c model3.c namcos21.c nemesis.c neogeo.c neogeo_spr.c nitedrvr.c nmk16.c pc080sn.c pc090oj.c spbactn.c tc0080vco.c tc0100scn.c tc0480scp.c tecmo_mix.c tecmo_spr.c tetrisp2.c vulgus.c wpc_dmd.c
[src/mess/drivers]a2600.c a310.c a7800.c abc1600.c abc80x.c ace.c alphatro.c altos5.c amiga.c ampro.c amstrad.c apf.c apogee.c apple2.c applix.c at.c atom.c bebox.c bml3.c bullet.c c80.c cc40.c coco12.c coco3.c compis.c crvision.c cybiko.c d6800.c dragon.c einstein.c ep64.c esq5505.c exelv.c fanucspmg.c fb01.c fc100.c fmtowns.c fp1100.c galaxy.c gimix.c hprot1.c interact.c iq151.c isbc.c kim1.c lviv.c mac.c mbc200.c mbee.c mc1000.c mikro80.c mikrosha.c minicom.c mmd1.c ms0515.c ms9540.c msx.c mtx.c myb3k.c mz2000.c mz700.c nascom1.c nes.c newbrain.c next.c ng_aes.c ondra.c orao.c oric.c orion.c osbexec.c osborne1.c partner.c pasopia7.c pc1500.c pc1512.c pc8801.c pcm.c pecom.c pet.c phc25.c poisk1.c ptcsol.c pve500.c px4.c pyl601.c ql.c qx10.c radio86.c rainbow.c samcoupe.c saturn.c sdk85.c sdk86.c selz80.c sg1000.c sorcerer.c special.c spectrum.c sun3.c super80.c svi318.c tecnbras.c ti630.c tiki100.c trs80.c ut88.c vt100.c vtech1.c wicat.c x1.c x1twin.c x68k.c xerox820.c z9001.c zorba.c zx.c
[src/mess/machine]amstrad.c apollo.c apple1.c apple2.c apple3.c beta.c dec_lk201.c genpc.c hp48.c msx.c msx_matsushita.c msx_s1985.c msx_switched.c msx_systemflags.c nes.c radio86.c rmnimbus.c super80.c
[src/mess/tools/castool]main.c
[src/mess/tools/imgtool/modules]hp48.c
[src/mess/video]a7800.c abc1600.c abc806.c bbc.c k1ge.c pc1512.c pc_t1t.c rmnimbus.c vtvideo.c
[src/osd]osdepend.c
[src/osd/modules/debugger]debugqt.c none.c
[src/osd/modules/sound]direct_sound.c js_sound.c none.c
[src/osd/osdmini]minifile.c
[src/osd/sdl]drawogl.c sdlmain.c video.c
[src/osd/windows]output.c vconv.c winmain.c
[src/tools]chdman.c nltool.c

trunk/src/osd/osdepend.c
r31373r31374
3737   // video options
3838   { NULL,                                   NULL,       OPTION_HEADER,     "OSD VIDEO OPTIONS" },
3939// OS X can be trusted to have working hardware OpenGL, so default to it on for the best user experience
40   { OSDOPTION_VIDEO,                        OSDOPTVAL_AUTO,       OPTION_STRING,     "video output method: " },
40   { OSDOPTION_VIDEO,                        OSDOPTVAL_AUTO,    OPTION_STRING,     "video output method: " },
4141   { OSDOPTION_NUMSCREENS "(1-4)",           "1",        OPTION_INTEGER,    "number of screens to create; usually, you want just one" },
4242   { OSDOPTION_WINDOW ";w",                  "0",        OPTION_BOOLEAN,    "enable window mode; otherwise, full screen mode is assumed" },
4343   { OSDOPTION_MAXIMIZE ";max",              "1",        OPTION_BOOLEAN,    "default to maximized windows; otherwise, windows will be minimized" },
r31373r31374
7979
8080   // sound options
8181   { NULL,                                   NULL,  OPTION_HEADER,     "OSD SOUND OPTIONS" },
82   { OSDOPTION_SOUND,                        OSDOPTVAL_AUTO, OPTION_STRING,     "sound output method: " },   
82   { OSDOPTION_SOUND,                        OSDOPTVAL_AUTO, OPTION_STRING,     "sound output method: " },
8383   { OSDOPTION_AUDIO_LATENCY "(1-5)",        "2",   OPTION_INTEGER,    "set audio latency (increase to reduce glitches, decrease for responsiveness)" },
8484
8585   // End of list
r31373r31374
106106
107107osd_interface::osd_interface()
108108   : m_machine(NULL),
109     m_sound(NULL),
110     m_debugger(NULL)
109      m_sound(NULL),
110      m_debugger(NULL)
111111
112112{
113113}
114114
115115void osd_interface::update_option(osd_options &options, const char * key, dynamic_array<const char *> &values)
116116{
117   astring current_value(options.description(key));   
117   astring current_value(options.description(key));
118118   astring new_option_value("");
119119   for (int index = 0; index < values.count(); index++)
120120   {
121121      astring t(values[index]);
122      if (new_option_value.len() > 0)
122      if (new_option_value.len() > 0)
123123      {
124124         if( index != (values.count()-1))
125125            new_option_value.cat(", ");
126126         else
127            new_option_value.cat(" or ");     
127            new_option_value.cat(" or ");
128128      }
129      new_option_value.cat(t);     
129      new_option_value.cat(t);
130130   }
131131   // TODO: core_strdup() is leaked
132   options.set_description(key, core_strdup(current_value.cat(new_option_value).cstr()));   
132   options.set_description(key, core_strdup(current_value.cat(new_option_value).cstr()));
133133}
134   
134
135135void osd_interface::register_options(osd_options &options)
136136{
137137   // Register video options and update options
138   video_options_add("none", NULL);   
138   video_options_add("none", NULL);
139139   video_register();
140140   update_option(options, OSDOPTION_VIDEO, m_video_names);
141   
141
142142   // Register sound options and update options
143   sound_options_add("none", OSD_SOUND_NONE);   
143   sound_options_add("none", OSD_SOUND_NONE);
144144   sound_register();
145145   update_option(options, OSDOPTION_SOUND, m_sound_names);
146   
146
147147   // Register debugger options and update options
148   debugger_options_add("none", OSD_DEBUGGER_NONE);   
149   debugger_options_add("internal", OSD_DEBUGGER_INTERNAL);   
148   debugger_options_add("none", OSD_DEBUGGER_NONE);
149   debugger_options_add("internal", OSD_DEBUGGER_INTERNAL);
150150   debugger_register();
151151   update_option(options, OSDOPTION_DEBUGGER, m_debugger_names);
152152}
r31373r31374
158158
159159osd_interface::~osd_interface()
160160{
161
162161   for(int i= 0; i < m_video_names.count(); ++i)
163162      osd_free(const_cast<char*>(m_video_names[i]));
164163   //m_video_options,reset();
r31373r31374
210209   //
211210
212211   m_machine = &machine;
213   
212
214213   osd_options &options = downcast<osd_options &>(machine.options());
215214   // extract the verbose printing option
216215   if (options.verbose())
217216      g_print_verbose = true;
218     
217
219218   // ensure we get called on the way out
220219   machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(osd_interface::osd_exit), this));
221220}
r31373r31374
251250   // create all of its structures.
252251   //
253252   osd_debugger_type debugger = m_debugger_options.find(machine().options().debugger());
254   if (debugger==NULL)
253   if (debugger==NULL)
255254   {
256255      osd_printf_warning("debugger_init: option %s not found switching to auto\n",machine().options().debugger());
257256      debugger = m_debugger_options.find("auto");
258257   }
259258   m_debugger = (*debugger)(*this);
260   
259
261260   m_debugger->init_debugger();
262261}
263262
r31373r31374
397396      osd_printf_error("video_init: Initialization failed!\n\n\n");
398397      fflush(stderr);
399398      fflush(stdout);
400      exit(-1);   
399      exit(-1);
401400   }
402401
403402   sound_init();
r31373r31374
405404   // we need pause callbacks
406405   machine().add_notifier(MACHINE_NOTIFY_PAUSE, machine_notify_delegate(FUNC(osd_interface::input_pause), this));
407406   machine().add_notifier(MACHINE_NOTIFY_RESUME, machine_notify_delegate(FUNC(osd_interface::input_resume), this));
408   
407
409408   output_init();
410409#ifdef USE_NETWORK
411410   network_init();
r31373r31374
421420bool osd_interface::sound_init()
422421{
423422   osd_sound_type sound = m_sound_options.find(machine().options().sound());
424   if (sound==NULL)
423   if (sound==NULL)
425424   {
426425      osd_printf_warning("sound_init: option %s not found switching to auto\n",machine().options().sound());
427426      sound = m_sound_options.find("auto");
r31373r31374
491490   midi_exit();
492491   debugger_exit();
493492}
494   
493
495494void osd_interface::video_exit()
496495{
497496}
r31373r31374
575574osd_debugger_interface::~osd_debugger_interface()
576575{
577576}
578
trunk/src/osd/osdmini/minifile.c
r31373r31374
177177      *dst = (char *)osd_malloc_array(strlen(path) + 1);
178178      if (*dst != NULL)
179179         strcpy(*dst, path);
180   }   
180   }
181181
182182   return FILERR_NONE;
183183}
trunk/src/osd/sdl/video.c
r31373r31374
623623
624624   // d3d options: extract the data
625625   stemp = options.video();
626   if (strcmp(stemp, "auto") == 0)
626   if (strcmp(stemp, "auto") == 0)
627627   {
628628#ifdef SDLMAME_MACOSX
629629      stemp = "opengl";
630630#else
631631      stemp = "soft";
632#endif     
632#endif
633633   }
634634   if (strcmp(stemp, SDLOPTVAL_SOFT) == 0)
635635      video_config.mode = VIDEO_MODE_SOFT;
trunk/src/osd/sdl/sdlmain.c
r31373r31374
397397
398398void sdl_osd_interface::osd_exit()
399399{
400
401400   osd_interface::osd_exit();
402401
403402   if (!SDLMAME_INIT_IN_WORKER_THREAD)
trunk/src/osd/sdl/drawogl.c
r31373r31374
11431143#else
11441144   if (!sdl->init_context)
11451145   {
1146      screen_device_iterator myiter(window->machine().root_device());
1146      screen_device_iterator myiter(window->machine().root_device());
11471147      for (screen = myiter.first(); screen != NULL; screen = myiter.next())
11481148      {
11491149         if (window->index == 0)
r31373r31374
11661166   {
11671167      // do some one-time OpenGL setup
11681168#if (SDLMAME_SDL2)
1169       // FIXME: SRGB conversion is working on SDL2, may be of use
1170       // when we eventually target gamma and monitor profiles.
1171        //glEnable(GL_FRAMEBUFFER_SRGB);
1169      // FIXME: SRGB conversion is working on SDL2, may be of use
1170      // when we eventually target gamma and monitor profiles.
1171      //glEnable(GL_FRAMEBUFFER_SRGB);
11721172#endif
11731173      glShadeModel(GL_SMOOTH);
11741174      glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
r31373r31374
16441644   }
16451645
16461646   if ( texture->type == TEXTURE_TYPE_NONE && sdl->useglsl &&
1647       texture->xprescale == 1 && texture->yprescale == 1 &&
1648       texsource->rowpixels <= sdl->texture_max_width )
1649    {
1650       texture->type      = TEXTURE_TYPE_SHADER;
1651       texture->texTarget = GL_TEXTURE_2D;
1652       texture->texpow2   = sdl->texpoweroftwo;
1653    }
1647         texture->xprescale == 1 && texture->yprescale == 1 &&
1648         texsource->rowpixels <= sdl->texture_max_width )
1649      {
1650         texture->type      = TEXTURE_TYPE_SHADER;
1651         texture->texTarget = GL_TEXTURE_2D;
1652         texture->texpow2   = sdl->texpoweroftwo;
1653      }
16541654
16551655   // determine if we can skip the copy step
16561656   // if this was not already decided by the shader condition above
r31373r31374
23122312   {
23132313      int srcpix = *src++;
23142314      for (int x2 = 0; x2 < xprescale; x2++)
2315         *dst++ = 0xff000000 | palette[srcpix];
2315         *dst++ = 0xff000000 | palette[srcpix];
23162316   }
23172317   if (xborderpix)
23182318      *dst++ = 0xff000000 | palette[*--src];
r31373r31374
26042604      {
26052605         for (y2 = 0; y2 < texture->yprescale; y2++)
26062606         {
2607            dst = (UINT8 *)(texture->data + (y * texture->yprescale + texture->borderpix + y2) * texture->rawwidth);
2607            dst = (UINT8 *)(texture->data + (y * texture->yprescale + texture->borderpix + y2) * texture->rawwidth);
26082608
26092609            switch (PRIMFLAG_GET_TEXFORMAT(flags))
26102610            {
trunk/src/osd/modules/sound/none.c
r31373r31374
2020}
2121
2222
23const osd_sound_type OSD_SOUND_NONE = &osd_sound_creator<sound_none>;
No newline at end of file
23const osd_sound_type OSD_SOUND_NONE = &osd_sound_creator<sound_none>;
trunk/src/osd/modules/sound/direct_sound.c
r31373r31374
389389      IDirectSoundBuffer_Release(primary_buffer);
390390   primary_buffer = NULL;
391391}
392
trunk/src/osd/modules/sound/js_sound.c
r31373r31374
2222
2323void sound_js::update_audio_stream(const INT16 *buffer, int samples_this_frame)
2424{
25  EM_ASM_ARGS({
26    // Forward audio stream update on to JS backend implementation.
27    jsmess_update_audio_stream($0, $1);
28  }, (unsigned int)buffer, samples_this_frame);
25   EM_ASM_ARGS({
26   // Forward audio stream update on to JS backend implementation.
27   jsmess_update_audio_stream($0, $1);
28   }, (unsigned int)buffer, samples_this_frame);
2929}
3030
3131void sound_js::set_mastervolume(int attenuation)
3232{
33  EM_ASM_ARGS({
34    // Forward volume update on to JS backend implementation.
35    jsmess_set_mastervolume($0);
36  }, attenuation);
33   EM_ASM_ARGS({
34   // Forward volume update on to JS backend implementation.
35   jsmess_set_mastervolume($0);
36   }, attenuation);
3737}
3838
3939const osd_sound_type OSD_SOUND_JS = &osd_sound_creator<sound_js>;
trunk/src/osd/modules/debugger/debugqt.c
r31373r31374
281281
282282   if (firststop)
283283   {
284      bring_main_window_to_front();
284      bring_main_window_to_front();
285285   }
286286
287287   // Set the main window to display the proper cpu
r31373r31374
338338void debugger_qt::debugger_exit()
339339{
340340}
341
trunk/src/osd/modules/debugger/none.c
r31373r31374
3333void debugger_none::debugger_exit()
3434{
3535}
36
trunk/src/osd/windows/vconv.c
r31373r31374
350350   // identify the version number of the EXE
351351   if (!icl_compile)
352352      exe_version = get_exe_version(executable);
353   else
353   else
354354      exe_version = 0x00110000; // assume this for ICL
355355
356356   // special cases
trunk/src/osd/windows/output.c
r31373r31374
128128
129129   // register a notifier for output changes
130130   output_set_notifier(NULL, notifier_callback, NULL);
131   
131
132132   return true;
133133}
134134
trunk/src/osd/windows/winmain.c
r31373r31374
549549   sound_options_add("dsound", OSD_SOUND_DIRECT_SOUND);
550550#if (USE_SDL)
551551   sound_options_add("sdl", OSD_SOUND_SDL);
552#endif   
552#endif
553553   sound_options_add("auto", OSD_SOUND_DIRECT_SOUND); // making Direct Sound audio default one
554554}
555555
r31373r31374
622622
623623   // initialize the subsystems
624624   osd_interface::init_subsystems();
625   
625
626626   // notify listeners of screen configuration
627627   astring tempstring;
628628   for (win_window_info *info = win_window_list; info != NULL; info = info->next)
r31373r31374
683683   win_cleanup_sockets();
684684
685685   osd_interface::osd_exit();
686   
686
687687   // take down the watchdog thread if it exists
688688   if (watchdog_thread != NULL)
689689   {
trunk/src/emu/luaengine.c
r31373r31374
4444lua_engine* lua_engine::luaThis = NULL;
4545
4646
47static void lstop(lua_State *L, lua_Debug *ar)
47static void lstop(lua_State *L, lua_Debug *ar)
4848{
4949   (void)ar;  /* unused arg. */
5050   lua_sethook(L, NULL, 0, 0);
r31373r31374
5252}
5353
5454
55static void laction(int i)
55static void laction(int i)
5656{
5757   signal(i, SIG_DFL); /* if another SIGINT happens before lstop,
58                       terminate process (default action) */
58                              terminate process (default action) */
5959   lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
6060}
6161
6262int lua_engine::report(int status) {
63   if (status != LUA_OK && !lua_isnil(m_lua_state, -1))
63   if (status != LUA_OK && !lua_isnil(m_lua_state, -1))
6464   {
6565      const char *msg = lua_tostring(m_lua_state, -1);
6666      if (msg == NULL) msg = "(error object is not a string)";
r31373r31374
7373}
7474
7575
76static int traceback (lua_State *L)
76static int traceback (lua_State *L)
7777{
78  const char *msg = lua_tostring(L, 1);
79  if (msg)
80    luaL_traceback(L, L, msg, 1);
81  else if (!lua_isnoneornil(L, 1))
82  {  /* is there an error object? */
83    if (!luaL_callmeta(L, 1, "__tostring"))  /* try its 'tostring' metamethod */
84      lua_pushliteral(L, "(no error message)");
85  }
86  return 1;
78   const char *msg = lua_tostring(L, 1);
79   if (msg)
80   luaL_traceback(L, L, msg, 1);
81   else if (!lua_isnoneornil(L, 1))
82   {  /* is there an error object? */
83   if (!luaL_callmeta(L, 1, "__tostring"))  /* try its 'tostring' metamethod */
84      lua_pushliteral(L, "(no error message)");
85   }
86   return 1;
8787}
8888
8989
90int lua_engine::docall(int narg, int nres)
90int lua_engine::docall(int narg, int nres)
9191{
9292   int status;
9393   int base = lua_gettop(m_lua_state) - narg;  /* function index */
r31373r31374
105105#define EOFMARK     "<eof>"
106106#define marklen     (sizeof(EOFMARK)/sizeof(char) - 1)
107107
108int lua_engine::incomplete(int status)
108int lua_engine::incomplete(int status)
109109{
110   if (status == LUA_ERRSYNTAX)
110   if (status == LUA_ERRSYNTAX)
111111   {
112112      size_t lmsg;
113113      const char *msg = lua_tolstring(m_lua_state, -1, &lmsg);
114      if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0)
114      if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0)
115115      {
116116         lua_pop(m_lua_state, 1);
117117         return 1;
r31373r31374
192192{
193193   ioport_field *field = static_cast<ioport_field *>(getparam(L, 1, tname_ioport));
194194   luaL_argcheck(L, lua_isnumber(L, 2), 2, "value expected");
195    field->set_value(lua_tointeger(L, 2));
195   field->set_value(lua_tointeger(L, 2));
196196   return 0;
197197}
198198
r31373r31374
225225
226226void lua_engine::emu_after_done(void *_h, INT32 param)
227227{
228    hook *h = static_cast<hook *>(_h);
229    h->call(this, h->precall(), 0);
230    delete h;
228   hook *h = static_cast<hook *>(_h);
229   h->call(this, h->precall(), 0);
230   delete h;
231231}
232232
233233int lua_engine::emu_after(lua_State *L)
234234{
235235   luaL_argcheck(L, lua_isnumber(L, 1), 1, "waiting duration expected");
236    struct hook *h = new hook;
237    h->set(L, 2);
236   struct hook *h = new hook;
237   h->set(L, 2);
238238   machine().scheduler().timer_set(attotime::from_double(lua_tonumber(L, 1)), timer_expired_delegate(FUNC(lua_engine::emu_after_done), this), 0, h);
239239   return 0;
240240}
r31373r31374
291291
292292void *lua_engine::checkparam(lua_State *L, int idx, const char *tname)
293293{
294  const char *name;
294   const char *name;
295295
296  if(!lua_getmetatable(L, idx))
297    return 0;
296   if(!lua_getmetatable(L, idx))
297   return 0;
298298
299  lua_rawget(L, LUA_REGISTRYINDEX);
300  name = lua_tostring(L, -1);
301  if(!name || strcmp(name, tname)) {
302    lua_pop(L, 1);
303    return 0;
304  }
305  lua_pop(L, 1);
299   lua_rawget(L, LUA_REGISTRYINDEX);
300   name = lua_tostring(L, -1);
301   if(!name || strcmp(name, tname)) {
302   lua_pop(L, 1);
303   return 0;
304   }
305   lua_pop(L, 1);
306306
307  return *static_cast<void **>(lua_touserdata(L, idx));
307   return *static_cast<void **>(lua_touserdata(L, idx));
308308}
309309
310310void *lua_engine::getparam(lua_State *L, int idx, const char *tname)
311311{
312312   void *p = checkparam(L, idx, tname);
313  char msg[256];
314  sprintf(msg, "%s expected", tname);
315  luaL_argcheck(L, p, idx, msg);
316  return p;
313   char msg[256];
314   sprintf(msg, "%s expected", tname);
315   luaL_argcheck(L, p, idx, msg);
316   return p;
317317}
318318
319319void lua_engine::push(lua_State *L, void *p, const char *tname)
320320{
321  void **pp = static_cast<void **>(lua_newuserdata(L, sizeof(void *)));
322  *pp = p;
323  luaL_getmetatable(L, tname);
324  lua_setmetatable(L, -2);
321   void **pp = static_cast<void **>(lua_newuserdata(L, sizeof(void *)));
322   *pp = p;
323   luaL_getmetatable(L, tname);
324   lua_setmetatable(L, -2);
325325}
326326
327327int lua_engine::l_emu_exit(lua_State *L)
r31373r31374
333333int lua_engine::l_emu_start(lua_State *L)
334334{
335335   const char *system_name = luaL_checkstring(L,1);
336   
336
337337   int index = driver_list::find(system_name);
338338   if (index != -1) {
339      machine_manager::instance()->schedule_new_driver(driver_list::driver(index));   
339      machine_manager::instance()->schedule_new_driver(driver_list::driver(index));
340340      luaThis->machine().schedule_hard_reset();
341341   }
342342   return 1;
r31373r31374
377377   fflush(stdout);
378378   char buff[LUA_MAXINPUT];
379379   astring oldbuff;
380   
380
381381   const char *b = LUA_PROMPT;
382   
382
383383   do {
384384      // Wait for input
385      fputs(b, stdout); fflush(stdout);  /* show prompt */       
385      fputs(b, stdout); fflush(stdout);  /* show prompt */
386386      fgets(buff, LUA_MAXINPUT, stdin);
387     
387
388388      // Create message
389389      osd_lock_acquire(lock);
390390      if (msg.ready == 0) {
r31373r31374
395395         msg.done = 0;
396396      }
397397      osd_lock_release(lock);
398     
398
399399      // Wait for response
400400      int done = 0;
401401      do {
r31373r31374
417417      }
418418      msg.done = 0;
419419      osd_lock_release(lock);
420     
420
421421   } while (1);
422422}
423423
r31373r31374
439439   luaThis = this;
440440   m_lua_state = luaL_newstate();  /* create state */
441441   output_notifier_set = false;
442   
442
443443   luaL_checkversion(m_lua_state);
444444   lua_gc(m_lua_state, LUA_GCSTOP, 0);  /* stop collector during initialization */
445445   luaL_openlibs(m_lua_state);  /* open libraries */
446   
446
447447   luaopen_lsqlite3(m_lua_state);
448   
448
449449   luaopen_ioport(m_lua_state);
450450
451   lua_gc(m_lua_state, LUA_GCRESTART, 0);     
451   lua_gc(m_lua_state, LUA_GCRESTART, 0);
452452   msg.ready = 0;
453453   msg.status = 0;
454454   msg.done = 0;
r31373r31374
466466
467467
468468void lua_engine::update_machine()
469{   
469{
470470   lua_newtable(m_lua_state);
471   if (m_machine!=NULL)
471   if (m_machine!=NULL)
472472   {
473473      // Create the ioport array
474474      ioport_port *port = machine().ioport().first_port();
r31373r31374
501501         .addCFunction ("time",        l_emu_time )
502502         .addCFunction ("wait",        l_emu_wait )
503503         .addCFunction ("after",       l_emu_after )
504         .addCFunction ("exit",        l_emu_exit )
505         .addCFunction ("start",      l_emu_start )
504         .addCFunction ("exit",        l_emu_exit )
505         .addCFunction ("start",       l_emu_start )
506506         .beginClass <machine_manager> ("manager")
507507            .addFunction ("machine", &machine_manager::machine)
508508            .addFunction ("options", &machine_manager::options)
r31373r31374
531531
532532void lua_engine::periodic_check()
533533{
534  osd_lock_acquire(lock);
535  if (msg.ready == 1) {
534   osd_lock_acquire(lock);
535   if (msg.ready == 1) {
536536   lua_settop(m_lua_state, 0);
537537   int status = luaL_loadbuffer(m_lua_state, msg.text.cstr(), strlen(msg.text.cstr()), "=stdin");
538538   if (incomplete(status)==0)  /* cannot try to add lines? */
r31373r31374
548548            luai_writestringerror("%s\n", lua_pushfstring(m_lua_state,
549549            "error calling " LUA_QL("print") " (%s)",
550550            lua_tostring(m_lua_state, -1)));
551     }   
551      }
552552   }
553   else
553   else
554554   {
555     status = -1;
555      status = -1;
556556   }
557557   msg.status = status;
558558   msg.response = msg.text;
559559   msg.text = "";
560560   msg.ready = 0;
561561   msg.done = 1;
562  }
563  osd_lock_release(lock);
562   }
563   osd_lock_release(lock);
564564}
565565
566566//-------------------------------------------------
r31373r31374
570570void lua_engine::close()
571571{
572572   lua_settop(m_lua_state, 0);  /* clear stack */
573   lua_close(m_lua_state);   
573   lua_close(m_lua_state);
574574}
575575
576576//-------------------------------------------------
r31373r31374
580580void lua_engine::load_script(const char *filename)
581581{
582582   int s = luaL_loadfile(m_lua_state, filename);
583   report(s);   
583   report(s);
584584   update_machine();
585585   start();
586586}
r31373r31374
592592void lua_engine::load_string(const char *value)
593593{
594594   int s = luaL_loadstring(m_lua_state, value);
595   report(s);   
595   report(s);
596596   update_machine();
597597   start();
598598}
r31373r31374
605605{
606606   resume(m_lua_state);
607607}
608
trunk/src/emu/mame.c
r31373r31374
9494
9595machine_manager* machine_manager::instance(emu_options &options,osd_interface &osd)
9696{
97    if(!m_manager)
97   if(!m_manager)
9898   {
99        m_manager = global_alloc(machine_manager(options,osd));
100    }
101    return m_manager;
99      m_manager = global_alloc(machine_manager(options,osd));
100   }
101   return m_manager;
102102}
103103
104104machine_manager* machine_manager::instance()
105105{
106    return m_manager;
106   return m_manager;
107107}
108108
109109//-------------------------------------------------
r31373r31374
111111//-------------------------------------------------
112112
113113machine_manager::machine_manager(emu_options &options,osd_interface &osd)
114       : m_osd(osd),
115      m_options(options),
116      m_web(options),
117      m_new_driver_pending(NULL),
118      m_machine(NULL)
114      : m_osd(osd),
115      m_options(options),
116      m_web(options),
117      m_new_driver_pending(NULL),
118      m_machine(NULL)
119119{
120120}
121121
r31373r31374
148148/***************************************************************************
149149    CORE IMPLEMENTATION
150150***************************************************************************/
151void machine_manager::update_machine()
152{   
151void machine_manager::update_machine()
152{
153153   m_lua.set_machine(m_machine);
154154   m_web.set_machine(m_machine);
155155   if (m_machine!=NULL) m_web.push_message("update_machine");
r31373r31374
227227            m_options.set_value(OPTION_RAMSIZE, "", OPTION_PRIORITY_CMDLINE, error_string);
228228         }
229229         firstrun = true;
230      }
231      else
230      }
231      else
232232      {
233233         if (machine.exit_pending()) m_options.set_system_name("");
234234      }
235     
235
236236      if (machine.exit_pending() && (!started_empty || (system == &GAME_NAME(___empty))))
237237         exit_pending = true;
238238
r31373r31374
297297-------------------------------------------------*/
298298
299299void CLIB_DECL vlogerror(const char *format, va_list arg)
300{   
300{
301301   if (machine_manager::instance()!=NULL && machine_manager::instance()->machine() != NULL)
302302      machine_manager::instance()->machine()->vlogerror(format, arg);
303303}
304
trunk/src/emu/cpu/sh4/sh4dmac.c
r31373r31374
662662   sh4_dmac_check(2);
663663   sh4_dmac_check(3);
664664}
665
trunk/src/emu/cpu/sh4/sh4.c
r31373r31374
31933193   /* j = 0x9000 */
31943194   SH4OP(MOVWI),      SH4OP(MOVWI),      SH4OP(MOVWI),      SH4OP(MOVWI),      SH4OP(MOVWI),      SH4OP(MOVWI),      SH4OP(MOVWI),      SH4OP(MOVWI),
31953195   SH4OP(MOVWI),      SH4OP(MOVWI),      SH4OP(MOVWI),      SH4OP(MOVWI),      SH4OP(MOVWI),      SH4OP(MOVWI),      SH4OP(MOVWI),      SH4OP(MOVWI),
3196    /* j = 0xa000 */
3196      /* j = 0xa000 */
31973197   SH4OP(BRA),        SH4OP(BRA),        SH4OP(BRA),        SH4OP(BRA),        SH4OP(BRA),        SH4OP(BRA),        SH4OP(BRA),        SH4OP(BRA),
31983198   SH4OP(BRA),        SH4OP(BRA),        SH4OP(BRA),        SH4OP(BRA),        SH4OP(BRA),        SH4OP(BRA),        SH4OP(BRA),        SH4OP(BRA),
31993199   /* j = 0xb000 */
r31373r31374
39683968{
39693969   m_ftcsr_read_callback = callback;
39703970}
3971
trunk/src/emu/cpu/tms7000/tms7000.c
r31373r31374
223223   {
224224      m_timer_handle[tmr] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tms7000_device::simple_timer_cb), this));
225225      m_timer_handle[tmr]->adjust(attotime::never, tmr);
226     
226
227227      m_timer_data[tmr] = 0;
228228      m_timer_control[tmr] = 0;
229229      m_timer_decrementer[tmr] = 0;
230230      m_timer_prescaler[tmr] = 0;
231231      m_timer_capture_latch[tmr] = 0;
232232   }
233   
233
234234   // register for savestates
235235   save_item(NAME(m_irq_state));
236236   save_item(NAME(m_idle_state));
r31373r31374
274274            m_sr & 0x01 ? '?':'.'
275275         );
276276         break;
277     
277
278278      default: break;
279279   }
280280}
r31373r31374
306306   write_p(0x05, 0x00); // ddr a
307307   write_p(0x09, 0x00); // ddr c
308308   write_p(0x0b, 0x00); // ddr d
309   
309
310310   if (!chip_is_cmos())
311311   {
312312      write_p(0x08, 0xff); // port c
313313      write_p(0x0a, 0xff); // port d
314314   }
315   
315
316316   // when _RESET goes inactive (0 to 1)
317317   m_sr = 0;
318318
r31373r31374
345345   if (m_irq_state[extline] != irqstate)
346346   {
347347      m_irq_state[extline] = irqstate;
348     
348
349349      // set/clear internal irq flag
350350      flag_ext_interrupt(extline);
351     
351
352352      if (m_irq_state[extline])
353353      {
354354         // latch timer 1 on INT3
r31373r31374
358358         // on 70cx2, latch timer 2 on INT1
359359         if (extline == TMS7000_INT1_LINE && chip_is_family_70cx2())
360360            m_timer_capture_latch[1] = m_timer_decrementer[1];
361         
361
362362         // clear external if it's edge-triggered (70cx2-only)
363363         if (m_io_control[2] & (0x02 << (4 * extline)))
364364            m_irq_state[extline] = false;
r31373r31374
385385   // global interrupt bit
386386   if (!(m_sr & SR_I))
387387      return;
388   
388
389389   // check for and handle interrupt
390390   for (int irqline = 0; irqline < 5; irqline++)
391391   {
r31373r31374
445445{
446446   // stop possible running timer
447447   m_timer_handle[tmr]->adjust(attotime::never, tmr);
448   
448
449449   if (m_timer_control[tmr] & 0x80)
450450   {
451451      m_timer_decrementer[tmr] = m_timer_data[tmr];
r31373r31374
472472
473473      // set INT2/INT5
474474      m_io_control[tmr] |= 0x08;
475     
475
476476      // cascaded timer
477477      if (tmr == 0 && (m_timer_control[1] & 0xa0) == 0xa0)
478478         timer_tick_pre(tmr + 1);
r31373r31374
482482TIMER_CALLBACK_MEMBER(tms7000_device::simple_timer_cb)
483483{
484484   int tmr = param;
485   
485
486486   // tick and restart timer
487487   timer_tick_low(tmr);
488488   timer_run(tmr);
r31373r31374
521521            return (m_io->read_byte(port) & ~m_port_ddr[port]) | (m_port_latch[port] & m_port_ddr[port]);
522522         break;
523523      }
524     
524
525525      // port direction (note: 7000 doesn't support it for port A)
526526      case 0x05: case 0x09: case 0x0b:
527527         return m_port_ddr[offset / 2 - 2];
r31373r31374
545545         // d1,d3,d5: INT1,2,3 flag (write 1 to clear flag)
546546         // d6-d7: memory mode (currently not implemented)
547547         m_io_control[0] = (m_io_control[0] & (~data & 0x2a)) | (data & 0xd5);
548         
548
549549         // possibly need to reactivate flags
550550         if (data & 0x02)
551551            flag_ext_interrupt(TMS7000_INT1_LINE);
552552         if (data & 0x20)
553553            flag_ext_interrupt(TMS7000_INT3_LINE);
554         
554
555555         check_interrupts();
556556         break;
557     
557
558558      // i/o control (IOCNT1)
559559      case 0x10:
560560         // d0,d2: INT4,5 enable
r31373r31374
568568         // decrementer reload value
569569         m_timer_data[offset >> 4] = data;
570570         break;
571     
571
572572      // timer 1/2 control
573573      case 0x03:
574574         // d5: t1: cmos low-power mode when IDLE opcode is used (not emulated)
r31373r31374
587587         // d7: stop/start timer
588588         m_timer_control[offset >> 4] = data;
589589         timer_reload(offset >> 4);
590         
590
591591         // on cmos chip, clear INT2/INT5 as well
592592         if (~data & 0x80 && chip_is_cmos())
593593            m_io_control[offset >> 4] &= ~0x08;
594         
594
595595         break;
596596
597597      // port data (note: 7000 doesn't support it for port A)
r31373r31374
604604         m_port_latch[port] = data;
605605         break;
606606      }
607     
607
608608      // port direction (note: 7000 doesn't support it for port A)
609609      case 0x05: case 0x09: case 0x0b:
610610         // note: changing port direction does not change(refresh) the output pins
r31373r31374
652652      case 0x0b: reti(); break;
653653      case 0x0d: ldsp(); break;
654654      case 0x0e: push_st(); break;
655     
655
656656      case 0x12: am_r2a(&tms7000_device::op_mov); break;
657657      case 0x13: am_r2a(&tms7000_device::op_and); break;
658658      case 0x14: am_r2a(&tms7000_device::op_or); break;
r31373r31374
757757      case 0x7d: am_i2r(&tms7000_device::op_cmp); break;
758758      case 0x7e: am_i2r(&tms7000_device::op_dac); break;
759759      case 0x7f: am_i2r(&tms7000_device::op_dsb); break;
760     
760
761761      case 0x80: am_p2a(&tms7000_device::op_mov); break;
762762      case 0x82: am_a2p(&tms7000_device::op_mov); break;
763763      case 0x83: am_a2p(&tms7000_device::op_and); break;
r31373r31374
798798      case 0xac: br_inx(); break;
799799      case 0xad: cmpa_inx(); break;
800800      case 0xae: call_inx(); break;
801     
801
802802      case 0xb0: am_a2a(&tms7000_device::op_mov); break; // aka clrc/tsta
803803      case 0xb1: am_b2a(&tms7000_device::op_mov); break; // undocumented
804804      case 0xb2: am_a(&tms7000_device::op_dec); break;
r31373r31374
849849      case 0xdd: am_r(&tms7000_device::op_rrc); break;
850850      case 0xde: am_r(&tms7000_device::op_rl); break;
851851      case 0xdf: am_r(&tms7000_device::op_rlc); break;
852     
852
853853      case 0xe0: jmp(true); break;
854854      case 0xe1: jmp(m_sr & SR_N); break; // jn/jlt
855855      case 0xe2: jmp(m_sr & SR_Z); break; // jz/jeq
r31373r31374
863863      case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7:
864864      case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff:
865865         trap(op << 1); break;
866     
866
867867      default: illegal(op); break;
868868   }
869869}
trunk/src/emu/cpu/z80/tmpz84c011.c
r31373r31374
22
33    Toshiba TMPZ84C011, MPUZ80/TLCS-Z80 ASSP Family
44    Z80 CPU, CTC, CGC, I/O8x5
5   
5
66    TODO:
77    - CGC (clock generator/controller)
88
trunk/src/emu/cpu/z80/tmpz84c015.c
r31373r31374
22
33    Toshiba TMPZ84C015, MPUZ80/TLCS-Z80 ASSP Family
44    Z80 CPU, SIO, CTC, CGC, PIO, WDT
5   
5
66    TODO:
77    - SIO configuration, or should that be up to the driver?
88    - CGC (clock generator/controller)
r31373r31374
133133WRITE8_MEMBER(tmpz84c015_device::irq_priority_w)
134134{
135135   data &= 7;
136   
136
137137   if (data > 5)
138138   {
139139      logerror("tmpz84c015: irq_priority_w undefined state %X\n", data);
140140      data &= 3; // guess
141141   }
142   
142
143143   if (m_irq_priority != data)
144144   {
145145      static const char *dev[3] = { "tmpz84c015_ctc", "tmpz84c015_sio", "tmpz84c015_pio" };
r31373r31374
152152         { 2, 0, 1 }, // 4: pio -> ctc -> sio -> ext
153153         { 1, 2, 0 }  // 5: sio -> pio -> ctc -> ext
154154      };
155     
155
156156      // reconfigure first 3 entries in daisy chain
157157      const z80_daisy_config daisy_chain[] =
158158      {
r31373r31374
162162         { NULL }
163163      };
164164      m_daisy.init(this, daisy_chain);
165     
165
166166      m_irq_priority = data;
167167   }
168168}
169169
170170static MACHINE_CONFIG_FRAGMENT( tmpz84c015 )
171   
171
172172   /* basic machine hardware */
173173   MCFG_Z80SIO0_ADD("tmpz84c015_sio", DERIVED_CLOCK(1,1), 0, 0, 0, 0)
174174   MCFG_Z80DART_OUT_INT_CB(INPUTLINE(DEVICE_SELF, INPUT_LINE_IRQ0))
trunk/src/emu/cpu/mb86233/mb86233.c
r31373r31374
360360      break;
361361
362362      case 0x0F:  /* D = int(D) */
363          switch((m_fpucontrol>>1)&3)
363         switch((m_fpucontrol>>1)&3)
364364         {
365365            //case 0: GETD().i = floor(GETD().f+0.5f); break;
366366            //case 1: GETD().i = ceil(GETD().f); break;
trunk/src/emu/cpu/mb86235/mb86235.c
r31373r31374
7676
7777void mb86235_cpu_device::device_reset()
7878{
79
8079}
8180
8281#if 0
trunk/src/emu/cpu/mips/mips3.c
r31373r31374
29882988   UINT64 mask = U64(0xffffffffffffffff) << shift;
29892989   WDOUBLE_MASKED(offs & ~7, RTVAL64 << shift, mask);
29902990}
2991
trunk/src/emu/cpu/mips/mips3drc.c
r31373r31374
32463246         drcuml->log_printf("-----\n");
32473247   }
32483248}
3249
trunk/src/emu/cpu/alto2/alto2cpu.c
r31373r31374
22372237   case SMC(1,1,1,1, 1, 1):
22382238      f = (a) | cout;
22392239      break;
2240   
2240
22412241   default:
22422242      f = 0;
22432243      break;
trunk/src/emu/cpu/i86/i86.c
r31373r31374
11411141// - 0x60 - 0x6f are an alias to 0x70 - 0x7f.
11421142// - 0xc0,  0xc1, 0xc8, 0xc9 are also aliases where the CPU ignores BIT 1 (*).
11431143//
1144//       Instructions are used in the boot sector for some versions of
1145//      MS-DOS  (e.g. the DEC Rainbow-100 version of DOS 2.x)
1144//      Instructions are used in the boot sector for some versions of
1145//      MS-DOS  (e.g. the DEC Rainbow-100 version of DOS 2.x)
11461146      case 0x60:
11471147      case 0x70: // i_jo
11481148         JMP( OF);
r31373r31374
16721672         CLK(MOV_RI16);
16731673         break;
16741674
1675        case 0xc0: // 0xc0 is 0xc2 - see (*)
1675      case 0xc0: // 0xc0 is 0xc2 - see (*)
16761676      case 0xc2: // i_ret_d16
16771677         {
16781678            UINT32 count = fetch_word();
r31373r31374
17251725         }
17261726         break;
17271727
1728        case 0xc9:  // 0xc9 = 0xcb  - see (*)
1728      case 0xc9:  // 0xc9 = 0xcb  - see (*)
17291729      case 0xcb: // i_retf
17301730         m_ip = POP();
17311731         m_sregs[CS] = POP();
trunk/src/emu/cpu/tms34010/tms34010.c
r31373r31374
16381638
16391639   return CPU_DISASSEMBLE_NAME(tms34020)(this, buffer, pc, oprom, opram, options);
16401640}
1641
trunk/src/emu/cpu/g65816/g65816.c
r31373r31374
133133
134134
135135_5a22_device::_5a22_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
136    : g65816_device(mconfig, _5A22, "5A22", tag, owner, clock, "5a22", __FILE__, CPU_TYPE_5A22, ADDRESS_MAP_NAME(_5a22_map))
136   : g65816_device(mconfig, _5A22, "5A22", tag, owner, clock, "5a22", __FILE__, CPU_TYPE_5A22, ADDRESS_MAP_NAME(_5a22_map))
137137{
138138}
139139
r31373r31374
149149      case 3: FTABLE_OPCODES = g65816i_opcodes_M1X1; break;
150150      case 4: FTABLE_OPCODES = g65816i_opcodes_E; break;
151151   }
152    FTABLE_GET_REG = s_g65816_get_reg[mode];
153    FTABLE_SET_REG = s_g65816_set_reg[mode];
154    FTABLE_SET_LINE = s_g65816_set_line[mode];
155    FTABLE_EXECUTE = s_g65816_execute[mode];
152   FTABLE_GET_REG = s_g65816_get_reg[mode];
153   FTABLE_SET_REG = s_g65816_set_reg[mode];
154   FTABLE_SET_LINE = s_g65816_set_line[mode];
155   FTABLE_EXECUTE = s_g65816_execute[mode];
156156}
157157
158158
r31373r31374
941941         break;
942942      case G65816_P:
943943         m_debugger_temp = (m_flag_n&0x80)         |
944                           ((m_flag_v>>1)&0x40)    |
945                           m_flag_m                |
946                           m_flag_x                |
947                           m_flag_d                |
948                           m_flag_i                |
949                           ((!m_flag_z)<<1)        |
950                           ((m_flag_c>>8)&1);
944                        ((m_flag_v>>1)&0x40)    |
945                        m_flag_m                |
946                        m_flag_x                |
947                        m_flag_d                |
948                        m_flag_i                |
949                        ((!m_flag_z)<<1)        |
950                        ((m_flag_c>>8)&1);
951951         break;
952952      case G65816_A:
953953         m_debugger_temp = m_a | m_b;
r31373r31374
10281028
10291029void _5a22_device::state_export(const device_state_entry &entry)
10301030{
1031    switch (entry.index())
1032    {
1033        case _5A22_FASTROM:
1034            m_debugger_temp = g65816_get_reg(_5A22_FASTROM);
1035            break;
1031   switch (entry.index())
1032   {
1033      case _5A22_FASTROM:
1034         m_debugger_temp = g65816_get_reg(_5A22_FASTROM);
1035         break;
10361036      default:
10371037         g65816_device::state_export(entry);
10381038         break;
trunk/src/emu/cpu/tms57002/tms57002.c
r31373r31374
2222
2323tms57002_device::tms57002_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
2424   : cpu_device(mconfig, TMS57002, "TMS57002", tag, owner, clock, "tms57002", __FILE__),
25     device_sound_interface(mconfig, *this),
26     program_config("program", ENDIANNESS_LITTLE, 32, 8, -2, ADDRESS_MAP_NAME(internal_pgm)),
27     data_config("data", ENDIANNESS_LITTLE, 8, 20)
25      device_sound_interface(mconfig, *this),
26      program_config("program", ENDIANNESS_LITTLE, 32, 8, -2, ADDRESS_MAP_NAME(internal_pgm)),
27      data_config("data", ENDIANNESS_LITTLE, 8, 20)
2828{
2929}
3030
trunk/src/emu/cpu/rsp/rsp.c
r31373r31374
288288   sp_reg_w_func.resolve();
289289   sp_set_status_func.resolve();
290290}
291   
291
292292static CPU_INIT( rsp )
293293{
294294   rsp_state *rsp = get_safe_token(device);
295295   int regIdx;
296   int accumIdx;   
297   
296   int accumIdx;
297
298298   if (LOG_INSTRUCTION_EXECUTION)
299299      rsp->exec_output = fopen("rsp_execute.txt", "wt");
300300
r31373r31374
32593259
32603260rsp_cpu_device::rsp_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, UINT32 clock, cpu_get_info_func get_info)
32613261   : legacy_cpu_device(mconfig, type, tag, owner, clock, get_info),
3262     dp_reg_r_func(*this),
3263     dp_reg_w_func(*this),
3264     sp_reg_r_func(*this),
3265     sp_reg_w_func(*this),
3266     sp_set_status_func(*this)
3262      dp_reg_r_func(*this),
3263      dp_reg_w_func(*this),
3264      sp_reg_r_func(*this),
3265      sp_reg_w_func(*this),
3266      sp_set_status_func(*this)
32673267{
32683268}
32693269
trunk/src/emu/cpu/minx/minx.c
r31373r31374
177177
178178void minx_cpu_device::execute_run()
179179{
180
181180   do
182181   {
183182      m_curpc = GET_MINX_PC;
trunk/src/emu/cpu/powerpc/ppccom.c
r31373r31374
230230}
231231
232232//ppc403_device::ppc403_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
233//   : ppc_device(mconfig, PPC403, "PPC403", tag, owner, clock, "ppc403", 32?, 64?)
233//  : ppc_device(mconfig, PPC403, "PPC403", tag, owner, clock, "ppc403", 32?, 64?)
234234//{
235235//}
236236//
237237//ppc405_device::ppc405_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
238//   : ppc_device(mconfig, PPC405, "PPC405", tag, owner, clock, "ppc405", 32?, 64?)
238//  : ppc_device(mconfig, PPC405, "PPC405", tag, owner, clock, "ppc405", 32?, 64?)
239239//{
240240//}
241241
r31373r31374
28862886{
28872887   m_dcr_write_func = dcr_write_func;
28882888}
2889
trunk/src/emu/cpu/powerpc/ppcdrc.c
r31373r31374
39193919         drcuml->log_printf("-----\n");
39203920   }
39213921}
3922
trunk/src/emu/cpu/m6809/hd6309.c
r31373r31374
180180
181181void hd6309_device::device_pre_save()
182182{
183   if      (m_reg8 == &m_d.b.h)   m_reg = HD6309_A;
184   else if (m_reg8 == &m_d.b.l)   m_reg = HD6309_B;
185   else if (m_reg8 == &m_w.b.h)   m_reg = HD6309_E;
186   else if (m_reg8 == &m_w.b.l)   m_reg = HD6309_F;
187   else if (m_reg8 == &m_cc)      m_reg = HD6309_CC;
188   else if (m_reg8 == &m_dp)      m_reg = HD6309_DP;
189   else if (m_reg8 == &m_md)      m_reg = HD6309_MD;
190   else if (m_reg8 == &m_temp.b.l)   m_reg = HD6309_ZERO_BYTE;
183   if      (m_reg8 == &m_d.b.h)    m_reg = HD6309_A;
184   else if (m_reg8 == &m_d.b.l)    m_reg = HD6309_B;
185   else if (m_reg8 == &m_w.b.h)    m_reg = HD6309_E;
186   else if (m_reg8 == &m_w.b.l)    m_reg = HD6309_F;
187   else if (m_reg8 == &m_cc)       m_reg = HD6309_CC;
188   else if (m_reg8 == &m_dp)       m_reg = HD6309_DP;
189   else if (m_reg8 == &m_md)       m_reg = HD6309_MD;
190   else if (m_reg8 == &m_temp.b.l) m_reg = HD6309_ZERO_BYTE;
191191
192   else if (m_reg16 == &m_d)      m_reg = HD6309_D;
193   else if (m_reg16 == &m_x)      m_reg = HD6309_X;
194   else if (m_reg16 == &m_y)      m_reg = HD6309_Y;
195   else if (m_reg16 == &m_u)      m_reg = HD6309_U;
196   else if (m_reg16 == &m_s)      m_reg = HD6309_S;
197   else if (m_reg16 == &m_pc)      m_reg = HD6309_PC;
198   else if (m_reg16 == &m_w)      m_reg = HD6309_W;
199   else if (m_reg16 == &m_v)      m_reg = HD6309_V;
200   else if (m_reg16 == &m_temp)   m_reg = HD6309_ZERO_WORD;
192   else if (m_reg16 == &m_d)       m_reg = HD6309_D;
193   else if (m_reg16 == &m_x)       m_reg = HD6309_X;
194   else if (m_reg16 == &m_y)       m_reg = HD6309_Y;
195   else if (m_reg16 == &m_u)       m_reg = HD6309_U;
196   else if (m_reg16 == &m_s)       m_reg = HD6309_S;
197   else if (m_reg16 == &m_pc)      m_reg = HD6309_PC;
198   else if (m_reg16 == &m_w)       m_reg = HD6309_W;
199   else if (m_reg16 == &m_v)       m_reg = HD6309_V;
200   else if (m_reg16 == &m_temp)    m_reg = HD6309_ZERO_WORD;
201201   else
202202      m_reg = 0;
203203}
trunk/src/emu/cpu/m6809/konami.c
r31373r31374
9898void konami_cpu_device::device_start()
9999{
100100   super::device_start();
101   
101
102102   // resolve callbacks
103103   m_set_lines.resolve();
104104}
r31373r31374
377377      execute_one();
378378   } while(m_icount > 0);
379379}
380
trunk/src/emu/cpu/sh2/sh2comn.c
r31373r31374
887887
888888   if(m_sh2_state->sleep_mode == 1) { m_sh2_state->sleep_mode = 2; }
889889}
890
trunk/src/emu/cpu/sh2/sh2.c
r31373r31374
149149
150150READ32_MEMBER(sh2_device::sh2_internal_a5)
151151{
152    return 0xa5a5a5a5;
152   return 0xa5a5a5a5;
153153}
154154
155155
r31373r31374
158158-------------------------------------------------*/
159159
160160static ADDRESS_MAP_START( sh2_internal_map, AS_PROGRAM, 32, sh2_device )
161    AM_RANGE(0x40000000, 0xbfffffff) AM_READ(sh2_internal_a5)
162    AM_RANGE(0xe0000000, 0xffffffff) AM_READWRITE(sh2_internal_r, sh2_internal_w)
161   AM_RANGE(0x40000000, 0xbfffffff) AM_READ(sh2_internal_a5)
162   AM_RANGE(0xe0000000, 0xffffffff) AM_READWRITE(sh2_internal_r, sh2_internal_w)
163163ADDRESS_MAP_END
164164
165165
r31373r31374
170170   , m_cpu_type(CPU_TYPE_SH2)
171171   , m_cache(CACHE_SIZE + sizeof(internal_sh2_state))
172172   , m_drcuml(NULL)
173//   , m_drcuml(*this, m_cache, ( LOG_UML ? DRCUML_OPTION_LOG_UML : 0 ) | ( LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 1, 32, 1)
173//  , m_drcuml(*this, m_cache, ( LOG_UML ? DRCUML_OPTION_LOG_UML : 0 ) | ( LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 1, 32, 1)
174174   , m_drcfe(NULL)
175175   , m_drcoptions(0)
176176   , m_sh2_state(NULL)
r31373r31374
207207   , m_cpu_type(cpu_type)
208208   , m_cache(CACHE_SIZE + sizeof(internal_sh2_state))
209209   , m_drcuml(NULL)
210//   , m_drcuml(*this, m_cache, ( LOG_UML ? DRCUML_OPTION_LOG_UML : 0 ) | ( LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 1, 32, 1)
210//  , m_drcuml(*this, m_cache, ( LOG_UML ? DRCUML_OPTION_LOG_UML : 0 ) | ( LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 1, 32, 1)
211211   , m_drcfe(NULL)
212212   , m_drcoptions(0)
213213   , m_sh2_state(NULL)
r31373r31374
25862586   /* initialize the front-end helper */
25872587   m_drcfe = auto_alloc(machine(), sh2_frontend(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE));
25882588
2589    /* compute the register parameters */
2590    for (int regnum = 0; regnum < 16; regnum++)
2591    {
2592        m_regmap[regnum] = uml::mem(&m_sh2_state->r[regnum]);
2593    }
2589   /* compute the register parameters */
2590   for (int regnum = 0; regnum < 16; regnum++)
2591   {
2592      m_regmap[regnum] = uml::mem(&m_sh2_state->r[regnum]);
2593   }
25942594
25952595   /* if we have registers to spare, assign r0, r1, r2 to leftovers */
25962596   /* WARNING: do not use synthetic registers that are mapped here! */
r31373r31374
27122712
27132713#include "sh2comn.c"
27142714#include "sh2drc.c"
2715
trunk/src/emu/cpu/sh2/sh2drc.c
r31373r31374
29782978      m_fastram_select++;
29792979   }
29802980}
2981
trunk/src/emu/video.c
r31373r31374
372372      // reset the state
373373      m_avi_frame = 0;
374374      m_avi_next_frame_time = machine().time();
375   
375
376376      // build up information about this new movie
377377      avi_movie_info info;
378378      info.video_format = 0;
r31373r31374
410410      {
411411         // compute the frame time
412412         m_avi_frame_period = attotime::from_seconds(1000) / info.video_timescale;
413     
413
414414         // create the file and free the string
415415         avi_error avierr = avi_create(fullpath, &info, &m_avi_file);
416416         if (avierr != AVIERR_NONE)
r31373r31374
426426   {
427427      // stop any existing recording
428428      end_recording(format);
429   
429
430430      // reset the state
431431      m_mng_frame = 0;
432      m_mng_next_frame_time = machine().time();   
433   
432      m_mng_next_frame_time = machine().time();
433
434434      // create a new movie file and start recording
435435      m_mng_file.reset(global_alloc(emu_file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS)));
436436      file_error filerr;
r31373r31374
475475      {
476476         avi_close(m_avi_file);
477477         m_avi_file = NULL;
478         
478
479479         // reset the state
480480         m_avi_frame = 0;
481481      }
r31373r31374
12381238            end_recording(MF_AVI);
12391239            break;
12401240         }
1241         
1241
12421242         // advance time
12431243         m_avi_next_frame_time += m_avi_frame_period;
12441244         m_avi_frame++;
12451245      }
12461246   }
1247   
1247
12481248   // handle a MNG recording
12491249   if (m_mng_file != NULL)
12501250   {
r31373r31374
12721272            end_recording(MF_MNG);
12731273            break;
12741274         }
1275         
1275
12761276         // advance time
12771277         m_mng_next_frame_time += m_mng_frame_period;
12781278         m_mng_frame++;
12791279      }
12801280   }
1281   
1281
12821282   g_profiler.stop();
12831283}
12841284
trunk/src/emu/emupal.c
r31373r31374
433433         if (share_ext != NULL)
434434            m_paletteram_ext.set_membits(m_membits);
435435      }
436     
436
437437      // override endianness if provided
438438      if (m_endianness_supplied)
439439      {
trunk/src/emu/imagedev/cassette.c
r31373r31374
3232   m_formats(cassette_default_formats),
3333   m_create_opts(NULL),
3434   m_default_state(CASSETTE_PLAY),
35   m_interface(NULL)   
35   m_interface(NULL)
3636{
3737}
3838
trunk/src/emu/bus/isa/vga_ati.c
r31373r31374
77 *  ATi Graphics Ultra Pro ISA Video card
88 *   - ATi 68800-3 (Mach32, combined VGA and 8514/A)
99 *
10 *   ATi mach64 ISA Video card
11 *    - ATi 88800 (Mach64, combined VGA and 8514/A)
10 *  ATi mach64 ISA Video card
11 *   - ATi 88800 (Mach64, combined VGA and 8514/A)
1212 *
1313 *  Created on: 9/09/2012
1414 */
trunk/src/emu/bus/isa/mda.c
r31373r31374
362362{
363363   if (m_update_row_type == -1)
364364      return;
365   
365
366366   switch (m_update_row_type)
367367   {
368368      case MDA_TEXT_INTEN:
r31373r31374
379379{
380380   if (m_update_row_type == -1)
381381      return;
382   
382
383383   switch (m_update_row_type)
384384   {
385385      case HERCULES_GFX_BLINK:
trunk/src/emu/bus/isa/aga.c
r31373r31374
306306 *************************************/
307307
308308/* colors need fixing in the mda_text_* functions ! */
309MC6845_UPDATE_ROW( isa8_aga_device::mda_text_inten_update_row )
309MC6845_UPDATE_ROW( isa8_aga_device::mda_text_inten_update_row )
310310{
311311   const rgb_t *palette = m_palette->palette()->entry_list_raw();
312312   UINT8 *videoram = m_videoram;
r31373r31374
367367}
368368
369369
370MC6845_UPDATE_ROW( isa8_aga_device::mda_text_blink_update_row )
370MC6845_UPDATE_ROW( isa8_aga_device::mda_text_blink_update_row )
371371{
372372   UINT8 *videoram = m_videoram;
373373   const rgb_t *palette = m_palette->palette()->entry_list_raw();
r31373r31374
429429}
430430
431431
432MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_update_row )
432MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_update_row )
433433{
434434   UINT8 *videoram = m_videoram;
435435   const rgb_t *palette = m_palette->palette()->entry_list_raw();
r31373r31374
460460   }
461461}
462462
463MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_alt_update_row )
463MC6845_UPDATE_ROW( isa8_aga_device::cga_text_inten_alt_update_row )
464464{
465465   const rgb_t *palette = m_palette->palette()->entry_list_raw();
466466   UINT8 *videoram = m_videoram;
r31373r31374
490490   }
491491}
492492
493MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_update_row )
493MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_update_row )
494494{
495495   const rgb_t *palette = m_palette->palette()->entry_list_raw();
496496   UINT8 *videoram = m_videoram;
r31373r31374
524524   }
525525}
526526
527MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_alt_update_row )
527MC6845_UPDATE_ROW( isa8_aga_device::cga_text_blink_alt_update_row )
528528{
529529   const rgb_t *palette = m_palette->palette()->entry_list_raw();
530530   UINT8 *videoram = m_videoram;
r31373r31374
560560   }
561561}
562562
563MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bppl_update_row )
563MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bppl_update_row )
564564{
565565   const rgb_t *palette = m_palette->palette()->entry_list_raw();
566566   UINT8 *videoram = m_videoram;
r31373r31374
586586   }
587587}
588588
589MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bpph_update_row )
589MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_4bpph_update_row )
590590{
591591   UINT8 *videoram = m_videoram;
592592   const rgb_t *palette = m_palette->palette()->entry_list_raw();
r31373r31374
620620   }
621621}
622622
623MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_2bpp_update_row )
623MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_2bpp_update_row )
624624{
625625   UINT8 *videoram = m_videoram;
626626   const rgb_t *palette = m_palette->palette()->entry_list_raw();
r31373r31374
646646   }
647647}
648648
649MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_1bpp_update_row )
649MC6845_UPDATE_ROW( isa8_aga_device::cga_gfx_1bpp_update_row )
650650{
651651   UINT8 *videoram = m_videoram;
652652   const rgb_t *palette = m_palette->palette()->entry_list_raw();
r31373r31374
723723         case 8:
724724            m_mda_mode_control = data;
725725
726            switch (m_mda_mode_control & 0x2a)
726            switch (m_mda_mode_control & 0x2a)
727727            {
728728            case 0x08:
729729               m_update_row_type = MDA_TEXT_INTEN;
r31373r31374
807807         break;
808808      case 8:
809809         m_cga_mode_control = data;
810           
810
811811         //logerror("mode set to %02X\n", m_cga_mode_control & 0x3F );
812812         switch ( m_cga_mode_control & 0x3F ) {
813813         case 0x08: case 0x09: case 0x0C: case 0x0D:
trunk/src/emu/bus/isa/omti8621.c
r31373r31374
229229// and a PC BIOS to make the card bootable on a PC.
230230// we have the Z8 program, we still need the PC BIOS.
231231ROM_START( omti8621 )
232   ROM_REGION(0x4000, OMTI_CPU_REGION, 0)   // disassembles fine as Z8 code
232   ROM_REGION(0x4000, OMTI_CPU_REGION, 0)  // disassembles fine as Z8 code
233233   ROM_LOAD( "omti_8621_102640-b.bin", 0x000000, 0x004000, CRC(e6f20dbb) SHA1(cf1990ad72eac6b296485410f5fa3309a0d6d078) )
234234
235235   ROM_REGION(0x1000, OMTI_BIOS_REGION, 0)
r31373r31374
875875      set_data_transfer(disk->m_esdi_defect_list, sizeof(disk->m_esdi_defect_list));
876876      break;
877877
878#if 0   // this command seems unused by Domain/OS, and it's unclear what the intent of the code is (it makes some versions of GCC quite unhappy)
878#if 0   // this command seems unused by Domain/OS, and it's unclear what the intent of the code is (it makes some versions of GCC quite unhappy)
879879   case OMTI_CMD_ASSIGN_ALTERNATE_TRACK: // 0x11
880880      log_data();
881881      alternate_track_address[0] = get_disk_track(cdb);
r31373r31374
12121212   }
12131213   else
12141214   {
1215//      LOG1(("omti8621_get_sector %x on lun %d", diskaddr, lun));
1215//      LOG1(("omti8621_get_sector %x on lun %d", diskaddr, lun));
12161216
12171217      // restrict length to size of 1 sector (i.e. 1024 Byte)
12181218      length = length < OMTI_DISK_SECTOR_SIZE ? length  : OMTI_DISK_SECTOR_SIZE;
trunk/src/emu/bus/isa/cga.c
r31373r31374
180180{
181181   if (m_update_row_type == -1)
182182      return;
183   
183
184184   switch (m_update_row_type)
185185   {
186186      case CGA_TEXT_INTEN:
r31373r31374
221221{
222222   if (m_update_row_type == -1)
223223      return;
224   
224
225225   switch (m_update_row_type)
226226   {
227227      case PC1512_GFX_4BPP:
trunk/src/emu/bus/isa/p1_hdc.c
r31373r31374
4444   MCFG_WD2010_IN_WF_CB(VCC)
4545   MCFG_WD2010_IN_TK000_CB(VCC)
4646   MCFG_WD2010_IN_SC_CB(VCC)
47   
47
4848   MCFG_HARDDISK_ADD("hard0")
4949   MCFG_HARDDISK_ADD("hard1")
5050MACHINE_CONFIG_END
trunk/src/emu/bus/isa/mach32.c
r31373r31374
3434// SVGA device
3535mach32_device::mach32_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
3636   : ati_vga_device(mconfig, ATIMACH32, "ATi mach32", tag, owner, clock, "mach32", __FILE__),
37     m_8514a(*this,"8514a")
37      m_8514a(*this,"8514a")
3838{
3939}
4040
4141mach32_device::mach32_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
4242   : ati_vga_device(mconfig, type, name, tag, owner, clock, shortname, source),
43     m_8514a(*this,"8514a")
43      m_8514a(*this,"8514a")
4444{
4545}
4646
r31373r31374
9898// SVGA device
9999mach64_device::mach64_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
100100   : mach32_device(mconfig, ATIMACH64, "ATi mach64", tag, owner, clock, "mach64", __FILE__),
101     m_8514a(*this,"8514a")
101      m_8514a(*this,"8514a")
102102{
103103}
104104
105105mach64_device::mach64_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
106106   : mach32_device(mconfig, type, name, tag, owner, clock, shortname, source),
107     m_8514a(*this,"8514a")
107      m_8514a(*this,"8514a")
108108{
109109}
110110
trunk/src/emu/bus/neogeo/cmc_cart.c
r31373r31374
219219   m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
220220   m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2000_GFX_KEY);
221221}
222
trunk/src/emu/bus/neogeo/mslugx_prot.c
r31373r31374
9191   maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2fffe0, 0x2fffef, read16_delegate(FUNC(mslugx_prot_device::mslugx_protection_16_r),this), write16_delegate(FUNC(mslugx_prot_device::mslugx_protection_16_w),this));
9292
9393}
94
95
96
97
98
trunk/src/emu/bus/neogeo/kof2002_prot.c
r31373r31374
1515
1616void kof2002_prot_device::device_start()
1717{
18
1918}
2019
2120void kof2002_prot_device::device_reset()
r31373r31374
8079      memcpy( src+i*0x80000, dst+sec[i], 0x80000 );
8180   }
8281}
83
84
trunk/src/emu/bus/neogeo/sbp_prot.c
r31373r31374
1616
1717void sbp_prot_device::device_start()
1818{
19
2019}
2120
2221void sbp_prot_device::device_reset()
r31373r31374
8281      rom[0x2a6fa / 2] = 0x4e71;
8382      rom[0x2a6fc / 2] = 0x4e71;
8483   }
85}
No newline at end of file
84}
trunk/src/emu/bus/neogeo/sma_cart.c
r31373r31374
173173   m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
174174   m_sma_prot->kof2000_install_protection(maincpu, m_banked_cart);
175175}
176
177
trunk/src/emu/bus/neogeo/pvc_prot.c
r31373r31374
312312   memcpy (&rom[0x100000], &buf[0x800000], 0x100000);
313313   memcpy (&rom[0x200000], &buf[0x100000], 0x700000);
314314}
315
316
317
trunk/src/emu/bus/neogeo/rom.c
r31373r31374
6565void neogeo_rom_device::activate_cart(ACTIVATE_CART_PARAMS)
6666{
6767   m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
68}
No newline at end of file
68}
trunk/src/emu/bus/neogeo/bootleg_prot.c
r31373r31374
192192
193193READ16_MEMBER(ngbootleg_prot_device::kof10th_RAM2_r)
194194{
195//   printf("kof10th_RAM2_r\n");
195//  printf("kof10th_RAM2_r\n");
196196   return m_cartridge_ram2[offset];
197197}
198198
r31373r31374
11281128   /* decrypt gfx */
11291129   cthd2003_c(sprrom,sprrom_size, 0 );
11301130}
1131
trunk/src/emu/bus/neogeo/cmc_prot.c
r31373r31374
1515
1616void cmc_prot_device::device_start()
1717{
18
1918}
2019
2120void cmc_prot_device::device_reset()
r31373r31374
786785   }
787786   #endif
788787}
789
trunk/src/emu/bus/neogeo/neogeo_carts.c
r31373r31374
3636   /* only CMC50 for gfx (& audiocpu)  */
3737   SLOT_INTERFACE_INTERNAL("r_cmc_kof2001",  NEOGEO_CMC_KOF2001_CART)
3838   SLOT_INTERFACE_INTERNAL("r_cmc_kof2000n",  NEOGEO_CMC_KOF2000N_CART)
39   /* CMC50 for gfx (& audiocpu) + NEOPCM2 for YM scramble  */   
39   /* CMC50 for gfx (& audiocpu) + NEOPCM2 for YM scramble  */
4040   SLOT_INTERFACE_INTERNAL("r_pc2_mslug4",  NEOGEO_PCM2_MSLUG4_CART)
4141   SLOT_INTERFACE_INTERNAL("r_pc2_rotd",  NEOGEO_PCM2_ROTD_CART)
4242   SLOT_INTERFACE_INTERNAL("r_pc2_pnyaa",  NEOGEO_PCM2_PNYAA_CART)
4343   SLOT_INTERFACE_INTERNAL("r_ms4plus",  NEOGEO_PCM2_MS4PLUS_CART) // regular encryption but external S1 rom
4444
45   /* CMC50 for gfx (& audiocpu) + NEOPCM2 for YM scramble + additonal prg scramble  */   
45   /* CMC50 for gfx (& audiocpu) + NEOPCM2 for YM scramble + additonal prg scramble  */
4646   SLOT_INTERFACE_INTERNAL("r_k2_kof2002",  NEOGEO_KOF2002_KOF2002_CART)
4747   SLOT_INTERFACE_INTERNAL("r_k2_matrim",  NEOGEO_KOF2002_MATRIM_CART)
4848   SLOT_INTERFACE_INTERNAL("r_k2_samsh5",  NEOGEO_KOF2002_SAMSHO5_CART)
4949   SLOT_INTERFACE_INTERNAL("r_k2_sams5s",  NEOGEO_KOF2002_SAMSHO5SP_CART)
5050   SLOT_INTERFACE_INTERNAL("r_kf2k2pls",  NEOGEO_KOF2002_KF2K2PLS_CART) // regular encryption but external S1 rom
5151
52   /* CMC50 for gfx (& audiocpu) + NEOPCM2 for YM scramble + PVC protection/encryption */   
52   /* CMC50 for gfx (& audiocpu) + NEOPCM2 for YM scramble + PVC protection/encryption */
5353   SLOT_INTERFACE_INTERNAL("r_pv_mslug5",  NEOGEO_PVC_MSLUG5_CART)
5454   SLOT_INTERFACE_INTERNAL("r_pv_svc",  NEOGEO_PVC_SVC_CART)
5555   SLOT_INTERFACE_INTERNAL("r_pv_kf2k3",  NEOGEO_PVC_KOF2003_CART)
5656   SLOT_INTERFACE_INTERNAL("r_pv_kf2k3h",  NEOGEO_PVC_KOF2003H_CART)
57   
57
5858   /* 100% bootleg logic */
5959   SLOT_INTERFACE_INTERNAL("r_garoubl",  NEOGEO_BOOTLEG_GAROUBL_CART)
6060   SLOT_INTERFACE_INTERNAL("r_cthd2003",  NEOGEO_BOOTLEG_CTHD2003_CART)
r31373r31374
8585   SLOT_INTERFACE_INTERNAL("r_kf2k3bl",  NEOGEO_BOOTLEG_HYBRID_KF2K3BL_CART)
8686   SLOT_INTERFACE_INTERNAL("r_kf2k3pl",  NEOGEO_BOOTLEG_HYBRID_KF2K3PL_CART)
8787   SLOT_INTERFACE_INTERNAL("r_kf2k3upl",  NEOGEO_BOOTLEG_HYBRID_KF2K3UPL_CART)
88   
89   
90   
91   
92   
93   
9488
89
90
91
92
93
94
9595SLOT_INTERFACE_END
trunk/src/emu/bus/neogeo/kof98_cart.c
r31373r31374
7575{
7676   m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
7777   m_kof98_prot->install_kof98_protection(maincpu);
78}
No newline at end of file
78}
trunk/src/emu/bus/neogeo/pcm2_cart.c
r31373r31374
131131   m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, PNYAA_GFX_KEY);
132132   m_pcm2_prot->neo_pcm2_snk_1999(ym_region, ym_region_size, 4);
133133}
134
135
trunk/src/emu/bus/neogeo/fatfury2_cart.c
r31373r31374
7070{
7171   m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
7272   m_fatfury2_prot->fatfury2_install_protection(maincpu, m_banked_cart);
73}
No newline at end of file
73}
trunk/src/emu/bus/neogeo/neogeo_slot.c
r31373r31374
7878      {
7979         // create memory regions
8080         len = get_software_region_length("maincpu");
81         m_cart->rom_alloc(len);   ROM = m_cart->get_rom_base();
81         m_cart->rom_alloc(len); ROM = m_cart->get_rom_base();
8282         memcpy(ROM, get_software_region("maincpu"), len);
8383
8484         len = get_software_region_length("fixed");
85         m_cart->fixed_alloc(len);   ROM8 = m_cart->get_fixed_base();
85         m_cart->fixed_alloc(len);   ROM8 = m_cart->get_fixed_base();
8686         memcpy(ROM8, get_software_region("fixed"), len);
8787
8888         if (get_software_region("audiocpu") != NULL)
8989         {
9090            len = get_software_region_length("audiocpu");
91            m_cart->audio_alloc(len + 0x10000);   ROM8 = m_cart->get_audio_base();
91            m_cart->audio_alloc(len + 0x10000); ROM8 = m_cart->get_audio_base();
9292            memcpy(ROM8, get_software_region("audiocpu"), len);
9393            memcpy(ROM8 + 0x10000, get_software_region("audiocpu"), len); // avoid reloading in XML, should just improve banking instead tho?
9494         }
9595
9696         len = get_software_region_length("ymsnd");
97         m_cart->ym_alloc(len);   ROM8 = m_cart->get_ym_base();
97         m_cart->ym_alloc(len);  ROM8 = m_cart->get_ym_base();
9898         memcpy(ROM8, get_software_region("ymsnd"), len);
9999
100100         if (get_software_region("ymsnd.deltat") != NULL)
101101         {
102102            len = get_software_region_length("ymsnd.deltat");
103            m_cart->ymdelta_alloc(len);   ROM8 = m_cart->get_ymdelta_base();
103            m_cart->ymdelta_alloc(len); ROM8 = m_cart->get_ymdelta_base();
104104            memcpy(ROM8, get_software_region("ymsnd.deltat"), len);
105105         }
106106         else
r31373r31374
110110
111111
112112         len = get_software_region_length("sprites");
113         m_cart->sprites_alloc(len);   ROM8 = m_cart->get_sprites_base();
113         m_cart->sprites_alloc(len); ROM8 = m_cart->get_sprites_base();
114114         memcpy(ROM8, get_software_region("sprites"), len);
115115
116116         if (get_software_region("audiocrypt") != NULL)  // encrypted Z80 code
117117         {
118118            len = get_software_region_length("audiocrypt");
119            m_cart->audiocrypt_alloc(len);   ROM8 = m_cart->get_audiocrypt_base();
119            m_cart->audiocrypt_alloc(len);  ROM8 = m_cart->get_audiocrypt_base();
120120            memcpy(ROM8, get_software_region("audiocrypt"), len);
121121            // allocate the audiocpu region to decrypt data into
122122            m_cart->audio_alloc(len + 0x10000);
trunk/src/emu/bus/neogeo/sma_prot.c
r31373r31374
236236
237237void sma_prot_device::sma_install_random_read_handler(cpu_device* maincpu, int addr1, int addr2 )
238238{
239
240239   maincpu->space(AS_PROGRAM).install_read_handler(addr1, addr1 + 1, read16_delegate(FUNC(sma_prot_device::sma_random_r),this));
241240   maincpu->space(AS_PROGRAM).install_read_handler(addr2, addr2 + 1, read16_delegate(FUNC(sma_prot_device::sma_random_r),this));
242241}
r31373r31374
459458      rom[i] = rom[0x73a000/2 + BITSWAP24(i,23,22,21,20,19,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)];
460459   }
461460}
462
463
trunk/src/emu/bus/neogeo/mslugx_cart.c
r31373r31374
7070{
7171   m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
7272   m_mslugx_prot->mslugx_install_protection(maincpu);
73}
No newline at end of file
73}
trunk/src/emu/bus/neogeo/neogeo_intf.c
r31373r31374
2929device_neogeo_cart_interface::~device_neogeo_cart_interface()
3030{
3131}
32
trunk/src/emu/bus/neogeo/kof2002_cart.c
r31373r31374
153153   m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, SAMSHO5SP_GFX_KEY);
154154   m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 6);
155155}
156
trunk/src/emu/bus/neogeo/banked_cart.c
r31373r31374
4747
4848   if (!m_bank_cartridge)
4949      printf("bank_cartridge is null\n");
50   
50
5151   if (m_region && m_bank_cartridge) m_bank_cartridge->set_base(m_region + m_main_cpu_bank_address);
5252}
5353
5454
5555void neogeo_banked_cart_device::neogeo_set_main_cpu_bank_address( UINT32 bank_address )
5656{
57//   if (LOG_MAIN_CPU_BANKING) logerror("MAIN CPU PC %06x: neogeo_set_main_cpu_bank_address %06x\n", m_maincpu->pc(), bank_address);
57//  if (LOG_MAIN_CPU_BANKING) logerror("MAIN CPU PC %06x: neogeo_set_main_cpu_bank_address %06x\n", m_maincpu->pc(), bank_address);
5858
5959   m_main_cpu_bank_address = bank_address;
6060
r31373r31374
9696{
9797   maincpu->space(AS_PROGRAM).install_read_bank(0x200000, 0x2fffff, 0, 0, "cartridge");
9898   maincpu->space(AS_PROGRAM).install_write_handler(0x2ffff0, 0x2fffff, write16_delegate(FUNC(neogeo_banked_cart_device::main_cpu_bank_select_w),this));
99   
99
100100   m_bank_cartridge = machine.root_device().membank("cartridge");
101101   m_region = region;
102102   m_region_size = region_size;
103103
104104   init_banks();
105105}
106
trunk/src/emu/bus/neogeo/pvc_cart.c
r31373r31374
135135   m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
136136   m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2003_GFX_KEY);
137137}
138
139
140
141   
142   
143   
144
trunk/src/emu/bus/neogeo/kof98_prot.c
r31373r31374
1616
1717void kof98_prot_device::device_start()
1818{
19
2019}
2120
2221void kof98_prot_device::device_reset()
r31373r31374
137136
138137   maincpu->space(AS_PROGRAM).install_write_handler(0x20aaaa, 0x20aaab, write16_delegate(FUNC(kof98_prot_device::kof98_prot_w),this));
139138}
140
141
trunk/src/emu/bus/neogeo/bootleg_cart.c
r31373r31374
361361   m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1);
362362   m_bootleg_prot->neogeo_bootleg_cx_decrypt(spr_region, spr_region_size);
363363}
364
365
trunk/src/emu/bus/neogeo/pcm2_prot.c
r31373r31374
8484      src[j]=buf[d]^xordata[value][j&0x7];
8585   }
8686}
87
trunk/src/emu/bus/neogeo/fatfury2_prot.c
r31373r31374
106106   m_fatfury2_prot_data = 0;
107107
108108}
109
trunk/src/emu/bus/comx35/clm.c
r31373r31374
107107      UINT8 code = m_video_ram[((ma + column) & 0x7ff)];
108108      UINT16 addr = (code << 3) | (ra & 0x07);
109109      UINT8 data = m_char_rom->base()[addr & 0x7ff];
110     
110
111111      if (BIT(ra, 3) && column == cursor_x)
112112      {
113113         data = 0xff;
114114      }
115     
115
116116      for (int bit = 0; bit < 8; bit++)
117117      {
118118         int x = (column * 8) + bit;
119         
119
120120         bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(BIT(data, 7) && de);
121         
121
122122         data <<= 1;
123123      }
124124   }
trunk/src/emu/bus/nes/2a03pur.c
r31373r31374
6868
6969 In MESS: supported.
7070
71 This mapper supports up to 1MB of PRG-ROM, in 4k
72 banks located at $8000, $9000, $A000, $B000, $C000,
73 $D000, $E000, and $F000. Each bank is selected by n
74 8-bit register at $5FF8, $5FF9, $5FFA, $5FFB, $5FFC,
75 $5FFD, $5FFE, and $5FFF, respectively, just like NSF
76 banking. These registers are mirrored across the
77 entire $5000-$5FFF region (the register is selected
78 by the low 3 bits), but it is recommended to use the
79 original addresses. The mirroring is merely a
71 This mapper supports up to 1MB of PRG-ROM, in 4k
72 banks located at $8000, $9000, $A000, $B000, $C000,
73 $D000, $E000, and $F000. Each bank is selected by n
74 8-bit register at $5FF8, $5FF9, $5FFA, $5FFB, $5FFC,
75 $5FFD, $5FFE, and $5FFF, respectively, just like NSF
76 banking. These registers are mirrored across the
77 entire $5000-$5FFF region (the register is selected
78 by the low 3 bits), but it is recommended to use the
79 original addresses. The mirroring is merely a
8080 convenience for the hardware implementation.
81 
82 The 8kb CHR region may be RAM or ROM. This project
83 uses CHR-RAM, and the board used by infiniteneslives
81
82 The 8kb CHR region may be RAM or ROM. This project
83 uses CHR-RAM, and the board used by infiniteneslives
8484 for this project may only support CHR-RAM.
85 
86 At power-on, the mapper automatically sets all bits
87 in the $5FFF bank register, placing the highest bank
88 in $F000. This occurs on power-on but not on reset,
89 so any bank that is mapped to $F000 after power-on
85
86 At power-on, the mapper automatically sets all bits
87 in the $5FFF bank register, placing the highest bank
88 in $F000. This occurs on power-on but not on reset,
89 so any bank that is mapped to $F000 after power-on
9090 should contain a valid reset vector.
91 
92 At present, the project uses iNES mapper 30 to
93 designate this mapper. No mapper number has been
91
92 At present, the project uses iNES mapper 30 to
93 designate this mapper. No mapper number has been
9494 officially reserved yet.
9595 -------------------------------------------------*/
9696
trunk/src/emu/bus/cpc/cpc_pds.c
r31373r31374
1717
1818
1919static MACHINE_CONFIG_FRAGMENT( cpc_pds )
20   MCFG_DEVICE_ADD("pio", Z80PIO, XTAL_4MHz)   // no clock on the PCB, so will presume that it uses the CPC's clock
20   MCFG_DEVICE_ADD("pio", Z80PIO, XTAL_4MHz)   // no clock on the PCB, so will presume that it uses the CPC's clock
2121
2222   // no pass-through seen on remake PCBs, unknown if actual hardware had a pass-through port or not
2323MACHINE_CONFIG_END
trunk/src/emu/bus/cpc/cpc_rs232.c
r31373r31374
3333   MCFG_RS232_RXD_HANDLER(DEVWRITELINE("dart",z80dart_device,rxa_w))
3434   MCFG_RS232_DCD_HANDLER(DEVWRITELINE("dart",z80dart_device,dcda_w))
3535   MCFG_RS232_CTS_HANDLER(DEVWRITELINE("dart",z80dart_device,ctsa_w))
36//   MCFG_RS232_RI_HANDLER(DEVWRITELINE("dart",z80dart_device,ria_w))
36//  MCFG_RS232_RI_HANDLER(DEVWRITELINE("dart",z80dart_device,ria_w))
3737
3838   // pass-through
3939   MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0)
trunk/src/emu/bus/msx_slot/bunsetsu.c
r31373r31374
7474         break;
7575   }
7676}
77
trunk/src/emu/bus/msx_slot/ram_mm.c
r31373r31374
7676   m_bank_selected[offset] = data;
7777   m_bank_base[offset] = m_ram + 0x4000 * ( m_bank_selected[offset] & m_bank_mask );
7878}
79
trunk/src/emu/bus/msx_slot/ram.c
r31373r31374
3333      m_ram[offset - m_start_address] = data;
3434   }
3535}
36
trunk/src/emu/bus/msx_slot/music.c
r31373r31374
4545{
4646   m_ym2413->write(space, offset & 1, data);
4747}
48
trunk/src/emu/bus/msx_slot/slot.c
r31373r31374
3232   dev.m_size = size;
3333   dev.m_end_address = dev.m_start_address + dev.m_size;
3434}
35
trunk/src/emu/bus/msx_slot/fs4600.c
r31373r31374
159159      }
160160   }
161161}
162
trunk/src/emu/bus/msx_slot/panasonic08.c
r31373r31374
178178         break;
179179   }
180180}
181
trunk/src/emu/bus/msx_slot/disk.c
r31373r31374
421421
422422
423423msx_slot_disk3_device::msx_slot_disk3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
424    : msx_slot_tc8566_disk_device(mconfig, MSX_SLOT_DISK3, "MSX Internal floppy type 3", tag, owner, clock, "msx_slot_disk3", __FILE__)
424   : msx_slot_tc8566_disk_device(mconfig, MSX_SLOT_DISK3, "MSX Internal floppy type 3", tag, owner, clock, "msx_slot_disk3", __FILE__)
425425{
426426}
427427
r31373r31374
459459         return m_fdc->fifo_r(space, 5);
460460   }
461461
462    return msx_slot_rom_device::read(space, offset);
462   return msx_slot_rom_device::read(space, offset);
463463}
464464
465465
r31373r31374
638638         break;
639639   }
640640}
641
642
trunk/src/emu/bus/msx_slot/rom.c
r31373r31374
6262   }
6363   return 0xFF;
6464}
65
66
trunk/src/emu/bus/msx_slot/sony08.c
r31373r31374
186186         break;
187187   }
188188}
189
trunk/src/emu/bus/msx_slot/cartridge.c
r31373r31374
137137      else
138138      {
139139         UINT32 length = this->length();
140         
140
141141         // determine how much space to allocate
142142         UINT32 length_aligned = 0x10000;
143         
143
144144         if (length <= 0x2000)
145145            length_aligned = 0x2000;
146146         else if (length <= 0x4000)
r31373r31374
165165            return IMAGE_INIT_FAIL;
166166         }
167167
168         // Check if there's some mapper related
168         // Check if there's some mapper related
169169         astring extrainfo;
170170         if (hashfile_extrainfo(*this, extrainfo))
171171         {
r31373r31374
349349   {
350350      return m_cartridge->read_cart(space, offset);
351351   }
352    return 0xFF;
352   return 0xFF;
353353}
354354
355355
r31373r31374
365365
366366
367367msx_slot_yamaha_expansion_device::msx_slot_yamaha_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
368    : msx_slot_cartridge_device(mconfig, MSX_SLOT_YAMAHA_EXPANSION, "MSX Yamaha Expansion slot", tag, owner, clock, "msx_slot_yamaha_expansion", __FILE__)
368   : msx_slot_cartridge_device(mconfig, MSX_SLOT_YAMAHA_EXPANSION, "MSX Yamaha Expansion slot", tag, owner, clock, "msx_slot_yamaha_expansion", __FILE__)
369369{
370370}
371371
r31373r31374
379379      m_cartridge->set_out_irq_cb(DEVCB_WRITELINE(msx_slot_cartridge_device, irq_out));
380380   }
381381}
382
383
trunk/src/emu/bus/vtech/ioexp/carts.c
r31373r31374
11/***************************************************************************
22
3   VTech Laser/VZ I/O Expansion Slot Devices
3    VTech Laser/VZ I/O Expansion Slot Devices
44
55***************************************************************************/
66
trunk/src/emu/bus/vtech/ioexp/joystick.c
r31373r31374
11/***************************************************************************
22
3   VTech Laser/VZ Joystick Interface
3    VTech Laser/VZ Joystick Interface
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
trunk/src/emu/bus/vtech/ioexp/printer.c
r31373r31374
11/***************************************************************************
22
3   VTech Laser/VZ Printer Interface
3    VTech Laser/VZ Printer Interface
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
77
8   VTech PI 20
9   Dick Smith Electronics X-7320
8    VTech PI 20
9    Dick Smith Electronics X-7320
1010
1111***************************************************************************/
1212
trunk/src/emu/bus/vtech/ioexp/ioexp.c
r31373r31374
11/***************************************************************************
22
3   VTech Laser/VZ I/O Expansion Slot
3    VTech Laser/VZ I/O Expansion Slot
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
77
8   30-pin slot
8    30-pin slot
99
1010***************************************************************************/
1111
trunk/src/emu/bus/vtech/memexp/memory.c
r31373r31374
11/***************************************************************************
22
3   VTech Laser/VZ Laser Memory Expansions
3    VTech Laser/VZ Laser Memory Expansions
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
trunk/src/emu/bus/vtech/memexp/floppy.c
r31373r31374
11/***************************************************************************
22
3   VTech Laser/VZ Floppy Controller Cartridge
3    VTech Laser/VZ Floppy Controller Cartridge
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
77
8   Laser DD 20
8    Laser DD 20
99    Dick Smith Electronics X-7304
1010
1111***************************************************************************/
trunk/src/emu/bus/vtech/memexp/memexp.c
r31373r31374
11/***************************************************************************
22
3   VTech Laser/VZ Memory Expansion Slot
3    VTech Laser/VZ Memory Expansion Slot
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
77
8   44-pin slot
8    44-pin slot
99
1010***************************************************************************/
1111
trunk/src/emu/bus/vtech/memexp/rs232.c
r31373r31374
11/***************************************************************************
22
3   Dick Smith VZ-200/300 RS-232 Cartridge
3    Dick Smith VZ-200/300 RS-232 Cartridge
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
trunk/src/emu/bus/vtech/memexp/carts.c
r31373r31374
11/***************************************************************************
22
3   VTech Laser/VZ Memory Expansion Slot Devices
3    VTech Laser/VZ Memory Expansion Slot Devices
44
55***************************************************************************/
66
trunk/src/emu/bus/vtech/memexp/wordpro.c
r31373r31374
11/***************************************************************************
22
3   Dick Smith VZ-300 WordPro Cartridge
3    Dick Smith VZ-300 WordPro Cartridge
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
trunk/src/emu/bus/a2bus/a2dx1.c
r31373r31374
55    a2dx1.c
66
77    Implementation of the Decillionix DX-1 sampler card
8                   
8
99*********************************************************************/
1010
1111#include "a2dx1.h"
r31373r31374
8484{
8585   switch (offset)
8686   {
87      case 1:   // ADC input
87      case 1: // ADC input
8888         return 0;
8989
9090      case 3: // busy flag
91         return 0x80;   // indicate not busy
91         return 0x80;    // indicate not busy
9292
93      case 7:   // 1-bit ADC input (bit 7 of c0n1, probably)
93      case 7: // 1-bit ADC input (bit 7 of c0n1, probably)
9494         return 0;
9595   }
9696
r31373r31374
101101{
102102   switch (offset)
103103   {
104      case 5:   // volume
104      case 5: // volume
105105         m_volume = data;
106106         m_dac->write_unsigned16(data*m_lastdac);
107107         break;
trunk/src/emu/bus/a2bus/a2diskiing.c
r31373r31374
2121
2222const device_type A2BUS_DISKIING = &device_creator<a2bus_diskiing_device>;
2323
24#define WOZFDC_TAG         "wozfdc"
24#define WOZFDC_TAG         "wozfdc"
2525#define DISKII_ROM_REGION  "diskii_rom"
2626
2727static SLOT_INTERFACE_START( a2_floppies )
r31373r31374
120120{
121121   return m_rom[offset];
122122}
123
trunk/src/emu/bus/a2bus/a2mcms.c
r31373r31374
77    Implementation of the Mountain Computer Music System.
88    This was sold standalone and also used as part of the alphaSyntauri
99    and SoundChaser systems.
10
10
1111*********************************************************************/
1212
1313#include "a2mcms.h"
r31373r31374
3535const device_type A2BUS_MCMS1 = &device_creator<a2bus_mcms1_device>;
3636const device_type A2BUS_MCMS2 = &device_creator<a2bus_mcms2_device>;
3737
38#define ENGINE_TAG   "engine"
38#define ENGINE_TAG  "engine"
3939
4040#define MCFG_MCMS_IRQ_CALLBACK(_cb) \
4141   devcb = &mcms_device::set_irq_cb(*device, DEVCB_##_cb);
r31373r31374
109109      m_mcms->control_w(space, CTRL_IRQS, 1);
110110   }
111111
112   return 0xff;
112   return 0xff;
113113}
114114
115115// read at Cn00: light gun in bit 7, bits 0-5 = 'random' number
r31373r31374
130130mcms_device *a2bus_mcms1_device::get_engine(void)
131131{
132132   return m_mcms;
133}   
133}
134134
135135WRITE_LINE_MEMBER(a2bus_mcms1_device::irq_w)
136136{
r31373r31374
208208
209209
210210/*
211   Sound device implementation
211    Sound device implementation
212212*/
213213
214214mcms_device::mcms_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
r31373r31374
257257{
258258   if (tid == 0)
259259   {
260      m_write_irq(ASSERT_LINE);
260      m_write_irq(ASSERT_LINE);
261261      // clear this IRQ in 10 cycles (?)
262262      m_clrtimer->adjust(attotime::from_usec(10), 0);
263263   }
264264   else if (tid == 1)
265265   {
266      m_write_irq(CLEAR_LINE);
266      m_write_irq(CLEAR_LINE);
267267   }
268268}
269269
r31373r31374
307307   }
308308   else
309309   {
310      for (i = 0; i < samples; i++)
310      for (i = 0; i < samples; i++)
311311      {
312312         outL[i] = outR[i] = 0;
313313      }
r31373r31374
319319   m_stream->update();
320320   if (offset >= 0x20)
321321   {
322      if (offset & 1)   // amp
322      if (offset & 1) // amp
323323      {
324324         m_vols[(offset-0x21)/2] = data;
325325      }
326      else   // wavetable page
326      else    // wavetable page
327327      {
328328         m_table[(offset-0x20)/2] = data;
329329      }
330330   }
331331   else
332332   {
333      if (offset & 1)   // freq L
333      if (offset & 1) // freq L
334334      {
335335         if (offset == 0x1f)
336336         {
r31373r31374
344344            m_freq[reg] |= data;
345345         }
346346      }
347      else   // freq H
347      else    // freq H
348348      {
349349         int reg = (offset/2);
350350         m_freq[reg] &= 0x00ff;
r31373r31374
369369         }
370370         else
371371         {
372            m_timer->adjust(attotime::zero, 0, attotime::from_hz(125));
372            m_timer->adjust(attotime::zero, 0, attotime::from_hz(125));
373373         }
374374         break;
375375
376376      case CTRL_DMA:
377         m_enabled = (data == 0) ? false : true;
377         m_enabled = (data == 0) ? false : true;
378378         break;
379379
380380      case CTRL_MASTERVOL:
r31373r31374
382382         break;
383383   }
384384}
385
trunk/src/emu/bus/wangpc/lvc.c
r31373r31374
5757MC6845_UPDATE_ROW( wangpc_lvc_device::crtc_update_row )
5858{
5959   offs_t scroll_y = (((m_scroll >> 8) + 0x15) & 0xff) * 0x80;
60   
60
6161   if (OPTION_80_COL)
6262   {
6363      for (int column = 0; column < x_count; column++)
6464      {
6565         offs_t addr = scroll_y + (m_scroll & 0x3f) + ((ma / 80) * 0x480) + (((ra & 0x0f) << 7) | (column & 0x7f));
6666         UINT16 data = m_video_ram[addr & 0x7fff];
67         
67
6868         for (int bit = 0; bit < 8; bit++)
6969         {
7070            int x = (column * 8) + bit;
7171            int color = (BIT(data, 15) << 1) | BIT(data, 7);
72           
72
7373            if (column == cursor_x) color = 0x03;
74           
74
7575            bitmap.pix32(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black;
76           
76
7777            data <<= 1;
7878         }
7979      }
r31373r31374
8282   {
8383      //offs_t addr = scroll_y + ((m_scroll & 0x3f) << 1) + ((ma / 40) * 0x480) + (((ra & 0x0f) << 7));
8484      offs_t addr = scroll_y + ((m_scroll & 0x3f) << 1) + (y * 0x80);
85     
85
8686      for (int column = 0; column < x_count; column++)
8787      {
8888         UINT32 data = (m_video_ram[(addr + 1) & 0x7fff] << 16) | m_video_ram[addr & 0x7fff];
89         
89
9090         for (int bit = 0; bit < 8; bit++)
9191         {
9292            int x = (column * 8) + bit;
9393            int color = (BIT(data, 31) << 3) | (BIT(data, 23) << 2) | (BIT(data, 15) << 1) | BIT(data, 7);
94           
94
9595            if (column == cursor_x) color = 0x03;
96           
96
9797            bitmap.pix32(vbp + y, hbp + x) = de ? m_palette[color] : rgb_t::black;
98           
98
9999            data <<= 1;
100100         }
101         
101
102102         addr += 2;
103103      }
104104   }
trunk/src/emu/bus/wangpc/mvc.c
r31373r31374
7575   {
7676      offs_t addr = (y * 50) + sx;
7777      UINT16 data = m_bitmap_ram[addr];
78     
78
7979      for (int bit = 0; bit < 16; bit++)
8080      {
8181         int x = (sx * 16) + bit;
8282         int color = BIT(data, 15) && de;
83         
83
8484         bitmap.pix32(vbp + y, hbp + x) = PALETTE_MVC[color];
85         
85
8686         data <<= 1;
8787      }
8888   }
89   
89
9090   for (int column = 0; column < x_count; column++)
9191   {
9292      UINT16 code = m_video_ram[((ma + column) & 0x7ff)];
9393      UINT8 attr = code & 0xff;
94     
94
9595      UINT8 new_ra = ra + 1;
96     
96
9797      if (ATTR_SUPERSCRIPT)
9898      {
9999         new_ra = ra + 3;
r31373r31374
102102      {
103103         new_ra = ra;
104104      }
105     
105
106106      offs_t addr = ((code >> 8) << 4) | (new_ra & 0x0f);
107107      UINT16 data = m_char_ram[addr & 0xfff];
108     
108
109109      if ((column == cursor_x) || (!ra && ATTR_OVERSCORE) || ((ra == 9) && ATTR_UNDERSCORE))
110110      {
111111         data = 0xffff;
112112      }
113     
113
114114      for (int bit = 0; bit < 10; bit++)
115115      {
116116         int x = (column * 10) + bit;
117117         int color = ((BIT(data, 9) & !ATTR_BLANK) ^ ATTR_REVERSE);
118         
118
119119         if ((color | bitmap.pix32(vbp + y, hbp + x)) & ATTR_BOLD) color = 2;
120120         if (color) bitmap.pix32(vbp + y, hbp + x) = de ? PALETTE_MVC[color] : rgb_t::black;
121         
121
122122         data <<= 1;
123123      }
124124   }
trunk/src/emu/bus/msx_cart/holy_quran.c
r31373r31374
115115         break;
116116   }
117117}
118
trunk/src/emu/bus/msx_cart/nomapper.c
r31373r31374
2525   // determine start address
2626   // default to $4000
2727   m_start_address = 0x4000;
28   
28
2929   switch (size)
3030   {
3131      /* 8KB/16KB */
3232      case 0x2000: case 0x4000:
3333      {
3434         UINT16 start = rom[3] << 8 | rom[2];
35         
35
3636         // start address of $0000: call address in the $4000 region: $4000, else $8000
3737         if (start == 0)
3838         {
r31373r31374
4141            else
4242               m_start_address = 0x8000;
4343         }
44         
44
4545         // start address in the $8000 region: $8000, else default
4646         else if ((start & 0xc000) == 0x8000)
4747            m_start_address = 0x8000;
48         
48
4949         break;
5050      }
5151
r31373r31374
5555         if (rom[0] != 'A' && rom[1] != 'B' && rom[0x4000] == 'A' && rom[0x4001] == 'B')
5656         {
5757            UINT16 start = rom[0x4003] << 8 | rom[0x4002];
58           
58
5959            // start address of $0000 and call address in the $4000 region, or start address outside the $8000 region: $0000, else default
6060            if ((start == 0 && (rom[0x4005] & 0xc0) == 0x40) || start < 0x8000 || start >= 0xc000)
6161               m_start_address = 0;
6262         }
63         
63
6464         break;
6565
6666      /* 48KB */
r31373r31374
7070            m_start_address = 0x4000;
7171         else
7272            m_start_address = 0;
73         
73
7474         break;
75     
75
7676      /* 64KB */
7777      default:
7878         m_start_address = 0;
r31373r31374
9090   }
9191   return 0xff;
9292}
93
trunk/src/emu/bus/msx_cart/dooly.c
r31373r31374
6363      }
6464   }
6565}
66
trunk/src/emu/bus/msx_cart/fmpac.c
r31373r31374
169169      m_ym2413->write(space, offset & 1, data);
170170   }
171171}
172
trunk/src/emu/bus/msx_cart/msx_audio.c
r31373r31374
180180{
181181   // Trigger IRQ on the maincpu
182182   // The 8950 seems to trigger an irq on reset, this causes an infinite loop of continuously triggering
183    // the MSX's interrupt handler. The 8950 irq will never be cleared the nms1205's irq handler hook hasn't
183   // the MSX's interrupt handler. The 8950 irq will never be cleared the nms1205's irq handler hook hasn't
184184   // been installed yet.
185//   m_out_irq_cb(state);
185//  m_out_irq_cb(state);
186186}
187187
188188
r31373r31374
383383{
384384   return m_io_config->read();
385385}
386
trunk/src/emu/bus/msx_cart/ascii.c
r31373r31374
136136   UINT32 size = get_rom_size();
137137
138138   if ( size > 256 * 0x4000 )
139   {   
139   {
140140      fatalerror("ascii16: ROM is too big\n");
141141   }
142142
r31373r31374
371371   UINT32 size = get_rom_size();
372372
373373   if ( size > 128 * 0x4000 )
374   {   
374   {
375375      fatalerror("ascii16_sram: ROM is too big\n");
376376   }
377377
r31373r31374
439439      }
440440   }
441441}
442
trunk/src/emu/bus/msx_cart/halnote.c
r31373r31374
155155         break;
156156   }
157157}
158
trunk/src/emu/bus/msx_cart/superloderunner.c
r31373r31374
5858   m_selected_bank = data;
5959   restore_banks();
6060}
61
trunk/src/emu/bus/msx_cart/crossblaim.c
r31373r31374
7878   }
7979   setup_bank();
8080}
81
trunk/src/emu/bus/msx_cart/msxdos2.c
r31373r31374
6363      restore_banks();
6464   }
6565}
66
trunk/src/emu/bus/msx_cart/yamaha.c
r31373r31374
147147   switch (offset & 0x3fff)
148148   {
149149      case 0x3ff0:     // YM-2151 status read
150      case 0x3ff1:    // YM-2151 status read mirror?
150      case 0x3ff1:    // YM-2151 status read mirror?
151151         return m_ym2151->status_r(space, 0);
152152
153153      case 0x3ff2:     // YM-2148 keyboard column read
r31373r31374
155155      case 0x3ff4:     // YM-2148 --
156156      case 0x3ff5:     // YM-2148 MIDI UART data read register
157157      case 0x3ff6:     // YM-2148 MIDI UART status register
158                       // ------x- - 1 = received a byte/receive buffer full?
159                       // -------x - 1 = ready to send next byte/send buffer empty?
158                     // ------x- - 1 = received a byte/receive buffer full?
159                     // -------x - 1 = ready to send next byte/send buffer empty?
160160         return m_ym2148->read(space, offset & 7);
161161   }
162162
r31373r31374
186186      case 0x3ff4:   // YM-2148 External IRQ vector
187187      case 0x3ff5:   // YM-2148 MIDI UART data write register
188188      case 0x3ff6:   // YM-2148 MIDI UART command register
189                     // On startup the sfg01 writes 0x80
190                     // followed by 0x05.
191                     // Other write seen in the code: 0x15
192                     //
193                     // x------- - 1 = reset
194                     // -----x-- - 1 = enable receiving / sending midi data
195                     // -------x - 1 = enable receiving / sending midi data
189                  // On startup the sfg01 writes 0x80
190                  // followed by 0x05.
191                  // Other write seen in the code: 0x15
192                  //
193                  // x------- - 1 = reset
194                  // -----x-- - 1 = enable receiving / sending midi data
195                  // -------x - 1 = enable receiving / sending midi data
196196         m_ym2148->write(space, offset & 7, data);
197197         break;
198198
r31373r31374
201201         break;
202202   }
203203}
204
trunk/src/emu/bus/msx_cart/cartridge.c
r31373r31374
3838   SLOT_INTERFACE_INTERNAL("superloderunner", MSX_CART_SUPERLODERUNNER)
3939   SLOT_INTERFACE_INTERNAL("synthesizer", MSX_CART_SYNTHESIZER)
4040   SLOT_INTERFACE_INTERNAL("cross_blaim", MSX_CART_CROSSBLAIM)
41//   SLOT_INTERFACE_INTERNAL("disk_rom", MSX_CART_DISK_ROM)
41//  SLOT_INTERFACE_INTERNAL("disk_rom", MSX_CART_DISK_ROM)
4242   SLOT_INTERFACE_INTERNAL("korean_80in1", MSX_CART_KOREAN_80IN1)
4343   SLOT_INTERFACE_INTERNAL("korean_90in1", MSX_CART_KOREAN_90IN1)
4444   SLOT_INTERFACE_INTERNAL("korean_126in1", MSX_CART_KOREAN_126IN1)
r31373r31374
9292   SLOT_INTERFACE("sfg01", MSX_CART_SFG01)
9393   SLOT_INTERFACE("sfg05", MSX_CART_SFG05)
9494SLOT_INTERFACE_END
95
trunk/src/emu/bus/msx_cart/msx_audio_kb.c
r31373r31374
309309   SLOT_INTERFACE("hxmu901", MSX_AUDIO_KB_HXMU901)
310310   SLOT_INTERFACE("nms1160", MSX_AUDIO_KB_NMS1160)
311311SLOT_INTERFACE_END
312
313
trunk/src/emu/bus/msx_cart/konami.c
r31373r31374
712712         }
713713         switch (offset & 0x1800)
714714         {
715            case 0x1000:      // 0x9000-0x97ff
715            case 0x1000:        // 0x9000-0x97ff
716716               m_selected_bank[2] = data;
717717               m_scc_active = ( ( data & 0x3f ) == 0x3f );
718718               setup_bank(2);
719719               break;
720720
721            case 0x1800:      // 0x9800-0x9fff
721            case 0x1800:        // 0x9800-0x9fff
722722               if ( m_scc_active )
723723               {
724724                  offset &= 0xff;
725   
725
726726                  if (offset < 0x80)
727727                  {
728728                     m_k052539->k051649_waveform_w(space, offset, data);
r31373r31374
837837   // The Snatcher Sound cartridge has 64KB RAM available by selecting ram banks 0-7
838838
839839   for (int i = 0; i < 8; i++)
840   {   
840   {
841841      m_ram_bank[i] = get_ram_base() + i * 0x2000;
842842   }
843843}
r31373r31374
933933{
934934   return m_vlm5030->bsy() ? 0x10 : 0x00;
935935}
936
trunk/src/emu/bus/msx_cart/korean.c
r31373r31374
294294      setup_bank(bank);
295295   }
296296}
297
trunk/src/emu/bus/msx_cart/bm_012.c
r31373r31374
108108   m_mdthru->write_txd(state);
109109   m_tmpz84c015af->rxb_w(state);
110110}
111
112
trunk/src/emu/bus/msx_cart/majutsushi.c
r31373r31374
111111         break;
112112   }
113113}
114
trunk/src/emu/bus/msx_cart/rtype.c
r31373r31374
7474      m_bank_base[1] = get_rom_base() + m_selected_bank * 0x4000;
7575   }
7676}
77
trunk/src/emu/bus/msx_cart/hfox.c
r31373r31374
7575         break;
7676   }
7777}
78
trunk/src/emu/bus/msx_cart/arc.c
r31373r31374
6060{
6161   return ((m_7f & 0x03) == 0x03) ? 0xda : 0xff;
6262}
63
trunk/src/emu/bus/msx_cart/super_swangi.c
r31373r31374
6868      logerror("msx_cart_super_swangi: unhandled write %02x to %04x\n", data, offset);
6969   }
7070}
71
trunk/src/emu/bus/gameboy/gb_slot.c
r31373r31374
543543
544544      if (count == 4876)
545545      {
546//         printf("Li Cheng %d\n", count);
546//          printf("Li Cheng %d\n", count);
547547         type = GB_MBC_LICHENG;
548548      }
549549      if (count == 4138 || count == 4125)
550550      {
551551         // Zhi Huan Wang uses 4138
552552         // most sintax use 4125
553//         printf("Sintax %d!\n", count);
553//          printf("Sintax %d!\n", count);
554554         type = GB_MBC_SINTAX;
555555      }
556556   }
trunk/src/emu/bus/ecbbus/grip.c
r31373r31374
232232   {
233233      UINT16 address = (m_page << 12) | (((ma + column) & 0xfff) << 3) | (ra & 0x07);
234234      UINT8 data = m_video_ram[address];
235     
235
236236      for (int bit = 0; bit < 8; bit++)
237237      {
238238         int x = (column * 8) + bit;
239239         int color = (m_flash ? 0 : BIT(data, bit)) && de;
240         
240
241241         bitmap.pix32(vbp + y, hbp + x) = m_palette->pen(color);
242242      }
243243   }
trunk/src/emu/bus/a1bus/a1bus.c
r31373r31374
44
55  license: BSD-3-Clause
66  copyright-holders: R. Belmont
7
7
88***************************************************************************/
99
1010#include "emu.h"
r31373r31374
203203{
204204   m_a1bus->install_bank(start, end, mask, mirror, tag, data);
205205}
206
trunk/src/emu/bus/a1bus/a1cassette.c
r31373r31374
33    a1cassette.c
44
55    Apple I Cassette Interface
6
6
77*********************************************************************/
88
99#include "a1cassette.h"
r31373r31374
196196
197197   cassette_toggle_output();
198198}
199
trunk/src/emu/bus/a1bus/a1cffa.c
r31373r31374
22
33    a1cffa.c
44
5   Rich Dreher's Compact Flash for Apple I
6 
5    Rich Dreher's Compact Flash for Apple I
6
77*********************************************************************/
88
99#include "a1cffa.h"
r31373r31374
153153
154154   }
155155}
156
trunk/src/emu/bus/ql/trumpcard.c
r31373r31374
1717//  MACROS/CONSTANTS
1818//**************************************************************************
1919
20#define WD1772_TAG      "wd1772"
20#define WD1772_TAG      "wd1772"
2121
2222
2323
r31373r31374
238238   {
239239      m_fdc->write(space, offset & 0x03, data);
240240   }
241   
241
242242   if (offset == 0x1e000)
243243   {
244244      /*
245245
246         bit      description
246          bit     description
247247
248         0       DRIVE1
249         1       DRIVE0
250         2       MOTOR
251         3       SIDE
252         4       
253         5       
254         6       
255         7       
248          0       DRIVE1
249          1       DRIVE0
250          2       MOTOR
251          3       SIDE
252          4
253          5
254          6
255          7
256256
257257      */
258258
259259      floppy_image_device *floppy = NULL;
260260
261      if (BIT(data, 1))
261      if (BIT(data, 1))
262262      {
263263         floppy = m_floppy0->get_device();
264264      }
trunk/src/emu/bus/ql/cst_qdisc.c
r31373r31374
33/**********************************************************************
44
55    CST QL Disc Interface emulation
6   
6
77    Copyright MESS Team.
88    Visit http://mamedev.org for licensing and usage restrictions.
99
trunk/src/emu/bus/ql/sandy_superqboard.c
r31373r31374
1717//  MACROS/CONSTANTS
1818//**************************************************************************
1919
20#define WD1772_TAG      "ic3"
21#define TTL74273_TAG   "ic10"
22#define CENTRONICS_TAG   "j2"
20#define WD1772_TAG      "ic3"
21#define TTL74273_TAG    "ic10"
22#define CENTRONICS_TAG  "j2"
2323
2424
2525
r31373r31374
289289
290290   m_latch->write(0);
291291   m_centronics->write_strobe(1);
292   
292
293293   m_fd6 = 0;
294294   m_fd7 = 0;
295295   m_status = 0;
r31373r31374
313313         case 0:
314314            data = m_fdc->read(space, offset & 0x03);
315315            break;
316         
316
317317         case 3:
318318            /*
319319
320               bit      description
320                bit     description
321321
322               0       BUSY
323               1       mouse pin 8 (middle button)
324               2       mouse pin 1 (right button)
325               3       mouse pin 2 (left button)
326               4       mouse pin 4 flip-flop Q (Y direction)
327               5       mouse pin 3 flip-flop Q (X direction)
328               6       INT3 (Y interrupt)
329               7       INT2 (X interrupt)
322                0       BUSY
323                1       mouse pin 8 (middle button)
324                2       mouse pin 1 (right button)
325                3       mouse pin 2 (left button)
326                4       mouse pin 4 flip-flop Q (Y direction)
327                5       mouse pin 3 flip-flop Q (X direction)
328                6       INT3 (Y interrupt)
329                7       INT2 (X interrupt)
330330
331331            */
332332
r31373r31374
378378            {
379379            /*
380380
381               bit      description
381                bit     description
382382
383               0       SIDE ONE
384               1       DSEL0
385               2       DSEL1
386               3       M ON0
387               4       /DDEN
388               5       STROBE inverted
389               6       enable printer interrupt (GAL pin 11)
390               7       enable mouse interrupt (GAL pin 9)
383                0       SIDE ONE
384                1       DSEL0
385                2       DSEL1
386                3       M ON0
387                4       /DDEN
388                5       STROBE inverted
389                6       enable printer interrupt (GAL pin 11)
390                7       enable mouse interrupt (GAL pin 9)
391391
392392            */
393393
394394            floppy_image_device *floppy = NULL;
395395
396            if (BIT(data, 1))
396            if (BIT(data, 1))
397397            {
398398               floppy = m_floppy0->get_device();
399399            }
trunk/src/emu/bus/ql/rom.c
r31373r31374
133133
134134SLOT_INTERFACE_START( ql_rom_cartridge_cards )
135135   SLOT_INTERFACE("mhd", MIRACLE_HARD_DISK)
136   
136
137137   // the following need ROMs from the software list
138138   SLOT_INTERFACE_INTERNAL("standard", QL_STANDARD_ROM_CARTRIDGE)
139139SLOT_INTERFACE_END
trunk/src/emu/bus/ql/sandy_superdisk.c
r31373r31374
1717//  MACROS/CONSTANTS
1818//**************************************************************************
1919
20#define WD1772_TAG      "wd1772"
21#define TTL74273_TAG   "ttl74273"
22#define CENTRONICS_TAG   "centronics"
20#define WD1772_TAG      "wd1772"
21#define TTL74273_TAG    "ttl74273"
22#define CENTRONICS_TAG  "centronics"
2323
2424
2525
r31373r31374
170170         case 0:
171171            data = m_fdc->read(space, offset & 0x03);
172172            break;
173         
173
174174         case 3:
175175            /*
176176
177               bit      description
177                bit     description
178178
179               0       BUSY
180               1       
181               2       
182               3       
183               4       
184               5       
185               6       
186               7       
179                0       BUSY
180                1
181                2
182                3
183                4
184                5
185                6
186                7
187187
188188            */
189189
r31373r31374
221221            {
222222            /*
223223
224               bit      description
224                bit     description
225225
226               0       SIDE ONE
227               1       DSEL0
228               2       DSEL1
229               3       M ON0
230               4       /DDEN
231               5       STROBE inverted
232               6       enable printer interrupt
233               7       
226                0       SIDE ONE
227                1       DSEL0
228                2       DSEL1
229                3       M ON0
230                4       /DDEN
231                5       STROBE inverted
232                6       enable printer interrupt
233                7
234234
235235            */
236236
237237            floppy_image_device *floppy = NULL;
238238
239            if (BIT(data, 1))
239            if (BIT(data, 1))
240240            {
241241               floppy = m_floppy0->get_device();
242242            }
trunk/src/emu/bus/ql/qubide.c
r31373r31374
269269         case 0: case 0x0e: case 0x0f:
270270            m_ata->write_cs1(space, 0x05, data, 0xff);
271271            break;
272         
272
273273         case 0x08: case 0x0a: case 0x0c:
274274            m_ata_data = (data << 8) | (m_ata_data & 0xff);
275275            break;
trunk/src/emu/bus/ql/cumana_fdi.c
r31373r31374
22// copyright-holders:Curt Coder
33/**********************************************************************
44
5   Cumana Floppy Disk Interface emulation   
5    Cumana Floppy Disk Interface emulation
66
77    Copyright MESS Team.
88    Visit http://mamedev.org for licensing and usage restrictions.
trunk/src/emu/bus/amiga/zorro/buddha.c
r31373r31374
11/***************************************************************************
22
3   Buddha
3    Buddha
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
77
8   Zorro-II IDE controller
8    Zorro-II IDE controller
99
1010***************************************************************************/
1111
trunk/src/emu/bus/amiga/zorro/a2052.c
r31373r31374
11/***************************************************************************
22
3   Commodore A2052
3    Commodore A2052
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
77
8   Zorro-II RAM Expansion (0.5, 1 or 2 MB)
8    Zorro-II RAM Expansion (0.5, 1 or 2 MB)
99
1010***************************************************************************/
1111
trunk/src/emu/bus/amiga/zorro/a2232.c
r31373r31374
11/***************************************************************************
22
3   Commodore A2232
3    Commodore A2232
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
77
8   Zorro-II Serial Card
8    Zorro-II Serial Card
99
1010***************************************************************************/
1111
trunk/src/emu/bus/amiga/zorro/action_replay.c
r31373r31374
11/***************************************************************************
22
3   Datel Action Replay
3    Datel Action Replay
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
77
8   Freezer cartridge for Amiga 500 and Amiga 2000
8    Freezer cartridge for Amiga 500 and Amiga 2000
99
10   Skeleton device, just loads the ROMs and generates the NMI
11   for now.
10    Skeleton device, just loads the ROMs and generates the NMI
11    for now.
1212
13   Hardware notes:
14   - http://www.mways.co.uk/amiga/howtocode/text/actionreplay.php
13    Hardware notes:
14    - http://www.mways.co.uk/amiga/howtocode/text/actionreplay.php
1515
1616***************************************************************************/
1717
trunk/src/emu/bus/amiga/zorro/zorro.c
r31373r31374
11/***************************************************************************
22
3   Amiga Zorro Slots
3    Amiga Zorro Slots
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
77
8   86-pin Expansion Slot (Zorro-I), Zorro-II, Zorro-III
8    86-pin Expansion Slot (Zorro-I), Zorro-II, Zorro-III
99
1010***************************************************************************/
1111
trunk/src/emu/bus/amiga/zorro/cards.c
r31373r31374
11/***************************************************************************
22
3   Amiga Zorro Cards
3    Amiga Zorro Cards
44
55***************************************************************************/
66
trunk/src/emu/bus/amiga/zorro/a590.c
r31373r31374
11/***************************************************************************
22
3   Commodore A590 / A2091
3    Commodore A590 / A2091
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
77
8   DMAC based HD controller for the Amiga 500 and Zorro-II
8    DMAC based HD controller for the Amiga 500 and Zorro-II
99
1010***************************************************************************/
1111
trunk/src/emu/bus/c64/xl80.c
r31373r31374
8484MC6845_UPDATE_ROW( c64_xl80_device::crtc_update_row )
8585{
8686   const pen_t *pen = m_palette->pens();
87   
87
8888   for (int column = 0; column < x_count; column++)
8989   {
9090      UINT8 code = m_ram[((ma + column) & 0x7ff)];
9191      UINT16 addr = (code << 3) | (ra & 0x07);
9292      UINT8 data = m_char_rom->base()[addr & 0x7ff];
93     
93
9494      if (column == cursor_x)
9595      {
9696         data = 0xff;
9797      }
98     
98
9999      for (int bit = 0; bit < 8; bit++)
100100      {
101101         int x = (column * 8) + bit;
102102         int color = BIT(data, 7) && de;
103         
103
104104         bitmap.pix32(vbp + y, hbp + x) = pen[color];
105         
105
106106         data <<= 1;
107107      }
108108   }
trunk/src/emu/bus/c64/ieee488.c
r31373r31374
150150   MCFG_TPI6525_OUT_PB_CB(DEVWRITE8(IEEE488_TAG, ieee488_device, dio_w))
151151   MCFG_TPI6525_IN_PC_CB(READ8(c64_ieee488_device, tpi_pc_r))
152152   MCFG_TPI6525_OUT_PC_CB(WRITE8(c64_ieee488_device, tpi_pc_w))
153   
153
154154   MCFG_CBM_IEEE488_ADD(NULL)
155155   MCFG_C64_PASSTHRU_EXPANSION_SLOT_ADD()
156156MACHINE_CONFIG_END
trunk/src/emu/bus/scsi/scsi.c
r31373r31374
7474
7575void SCSI_PORT_DEVICE::device_start()
7676{
77   const char *deviceName[] =
77   const char *deviceName[] =
7878   {
7979      SCSI_PORT_DEVICE1,
8080      SCSI_PORT_DEVICE2,
trunk/src/emu/bus/scsi/scsihle.c
r31373r31374
124124
125125void scsihle_device::data_out(UINT8 data)
126126{
127//   printf( "%s data out %02x\n", tag(), data );
127//  printf( "%s data out %02x\n", tag(), data );
128128   output_data0(BIT(data, 0));
129129   output_data1(BIT(data, 1));
130130   output_data2(BIT(data, 2));
r31373r31374
396396
397397WRITE_LINE_MEMBER( scsihle_device::input_sel )
398398{
399//   printf( "sel %d %d %02x\n", state, m_phase, m_input_data );
399//  printf( "sel %d %d %02x\n", state, m_phase, m_input_data );
400400   switch (m_phase)
401401   {
402402   case SCSI_PHASE_BUS_FREE:
trunk/src/emu/bus/plus4/c1551.c
r31373r31374
365365   MCFG_TPI6525_IN_PB_CB(READ8(c1551_device, tpi1_pb_r))
366366   MCFG_TPI6525_IN_PC_CB(READ8(c1551_device, tpi1_pc_r))
367367   MCFG_TPI6525_OUT_PC_CB(WRITE8(c1551_device, tpi1_pc_w))
368   
368
369369   MCFG_DEVICE_ADD(C64H156_TAG, C64H156, XTAL_16MHz)
370370   MCFG_64H156_BYTE_CALLBACK(DEVWRITELINE(C64H156_TAG, c64h156_device, atni_w))
371371   MCFG_FLOPPY_DRIVE_ADD(C64H156_TAG":0", c1551_floppies, "525ssqd", c1551_device::floppy_formats)
trunk/src/emu/memory.c
r31373r31374
49764976      }
49774977   }
49784978}
4979
trunk/src/emu/image.c
r31373r31374
310310    image_battery_load_by_name - retrieves the battery
311311    backed RAM for an image. A filename may be supplied
312312    to the function.
313
313
314314    The function comes in two flavors, depending on
315   what should happen when no battery is available:
315    what should happen when no battery is available:
316316    we could fill the memory with a given value, or
317    pass a default battery (for a pre-initialized
317    pass a default battery (for a pre-initialized
318318    battery from factory)
319319-------------------------------------------------*/
320320
r31373r31374
339339{
340340   file_error filerr;
341341   int bytes_read = 0;
342   
342
343343   assert_always(buffer && (length > 0), "Must specify sensical buffer/length");
344   
344
345345   /* try to open the battery file and read it in, if possible */
346346   emu_file file(options.nvram_directory(), OPEN_FLAG_READ);
347347   filerr = file.open(filename);
trunk/src/emu/video/tms3556.c
r31373r31374
8383      device_memory_interface(mconfig, *this),
8484      m_space_config("videoram", ENDIANNESS_LITTLE, 8, 17, 0, NULL, *ADDRESS_MAP_NAME(tms3556)),
8585      m_reg_access_phase(0),
86       m_row_col_written(0),
87       m_bamp_written(0),
88        m_colrow(0),
89        m_vdp_acmpxy_mode(dma_write),
90        m_vdp_acmpxy(0),
91        m_vdp_acmp(0),
92        m_init_read(0),
86      m_row_col_written(0),
87      m_bamp_written(0),
88      m_colrow(0),
89      m_vdp_acmpxy_mode(dma_write),
90      m_vdp_acmpxy(0),
91      m_vdp_acmp(0),
92      m_init_read(0),
9393      m_scanline(0),
9494      m_blink(0),
9595      m_blink_count(0),
r31373r31374
113113   save_item(NAME(m_control_regs));
114114   save_item(NAME(m_address_regs));
115115   save_item(NAME(m_reg_access_phase));
116    save_item(NAME(m_row_col_written));
117    save_item(NAME(m_bamp_written));
118    save_item(NAME(m_colrow));
116   save_item(NAME(m_row_col_written));
117   save_item(NAME(m_bamp_written));
118   save_item(NAME(m_colrow));
119119//    save_item(NAME(m_vdp_acmpxy_mode)); // FIXME : mame cannot save enum
120    save_item(NAME(m_vdp_acmpxy));
121    save_item(NAME(m_vdp_acmp));
120   save_item(NAME(m_vdp_acmpxy));
121   save_item(NAME(m_vdp_acmp));
122122   save_item(NAME(m_scanline));
123123   save_item(NAME(m_blink));
124124   save_item(NAME(m_blink_count));
r31373r31374
148148
149149READ8_MEMBER( tms3556_device::vram_r )
150150{
151    UINT8 ret;
152    if (m_bamp_written) {
153        m_bamp_written=false;
154        m_vdp_acmpxy_mode=dma_write;
155        if (m_init_read)
156            m_vdp_acmp=VDP_BAMP;
157        else
158            m_vdp_acmp=(VDP_BAMP-1)&0xFFFF;
159    }
151   UINT8 ret;
152   if (m_bamp_written) {
153      m_bamp_written=false;
154      m_vdp_acmpxy_mode=dma_write;
155      if (m_init_read)
156         m_vdp_acmp=VDP_BAMP;
157      else
158         m_vdp_acmp=(VDP_BAMP-1)&0xFFFF;
159   }
160160
161    if (m_row_col_written) {
162        m_row_col_written=0;
163        m_vdp_acmpxy_mode=dma_read;
164        if (m_init_read)
165            m_vdp_acmpxy=m_colrow;
166        else
167            m_vdp_acmpxy=(m_colrow-1)&0xFFFF;
168    }
161   if (m_row_col_written) {
162      m_row_col_written=0;
163      m_vdp_acmpxy_mode=dma_read;
164      if (m_init_read)
165         m_vdp_acmpxy=m_colrow;
166      else
167         m_vdp_acmpxy=(m_colrow-1)&0xFFFF;
168   }
169169
170    m_init_read=false;
171    if (m_vdp_acmpxy_mode==dma_read) {
172        ret=readbyte(m_vdp_acmpxy);
173        m_vdp_acmpxy++;
174        if (m_vdp_acmpxy==VDP_BAMTF) m_vdp_acmpxy=VDP_BAMP;
175    } else {
176        ret=readbyte(m_vdp_acmp);
177        m_vdp_acmp++;
178        if (m_vdp_acmp==VDP_BAMTF) m_vdp_acmp=VDP_BAMP;
179    }
180    return ret;
170   m_init_read=false;
171   if (m_vdp_acmpxy_mode==dma_read) {
172      ret=readbyte(m_vdp_acmpxy);
173      m_vdp_acmpxy++;
174      if (m_vdp_acmpxy==VDP_BAMTF) m_vdp_acmpxy=VDP_BAMP;
175   } else {
176      ret=readbyte(m_vdp_acmp);
177      m_vdp_acmp++;
178      if (m_vdp_acmp==VDP_BAMTF) m_vdp_acmp=VDP_BAMP;
179   }
180   return ret;
181181}
182182
183183//-------------------------------------------------
r31373r31374
186186
187187WRITE8_MEMBER( tms3556_device::vram_w )
188188{
189   if (m_bamp_written) {
190       m_bamp_written=false;
191       m_vdp_acmpxy_mode=dma_read;
192       m_vdp_acmp=VDP_BAMP;
193    }
189   if (m_bamp_written) {
190      m_bamp_written=false;
191      m_vdp_acmpxy_mode=dma_read;
192      m_vdp_acmp=VDP_BAMP;
193   }
194194
195    if (m_row_col_written) {
196       m_row_col_written=0;
197       m_vdp_acmpxy_mode=dma_write;
198       m_vdp_acmpxy=m_colrow;
199    }
195   if (m_row_col_written) {
196      m_row_col_written=0;
197      m_vdp_acmpxy_mode=dma_write;
198      m_vdp_acmpxy=m_colrow;
199   }
200200
201    if (m_vdp_acmpxy_mode==dma_write) {
202       writebyte(m_vdp_acmpxy,data);
203       m_vdp_acmpxy++;
204       if (m_vdp_acmpxy==VDP_BAMTF) m_vdp_acmpxy=VDP_BAMP;
205    } else {
206       writebyte(m_vdp_acmp,data);
207       m_vdp_acmp++;
208       if (m_vdp_acmp==VDP_BAMTF) m_vdp_acmp=VDP_BAMP;
209    }
201   if (m_vdp_acmpxy_mode==dma_write) {
202      writebyte(m_vdp_acmpxy,data);
203      m_vdp_acmpxy++;
204      if (m_vdp_acmpxy==VDP_BAMTF) m_vdp_acmpxy=VDP_BAMP;
205   } else {
206      writebyte(m_vdp_acmp,data);
207      m_vdp_acmp++;
208      if (m_vdp_acmp==VDP_BAMTF) m_vdp_acmp=VDP_BAMP;
209   }
210210
211211}
212212
r31373r31374
220220   if (LOG) logerror("TMS3556 Reg Read: %06x\n", offset);
221221
222222   int reply = 0; // FIXME : will send internal status (VBL, HBL...)
223    m_reg_access_phase=0;
223   m_reg_access_phase=0;
224224   return reply;
225225}
226226
r31373r31374
230230
231231WRITE8_MEMBER( tms3556_device::reg_w )
232232{
233    static int reg2=0; // FIXME : this static makes that only one TMS3556 will be present in one system...
234    static int reg=0;
233   static int reg2=0; // FIXME : this static makes that only one TMS3556 will be present in one system...
234   static int reg=0;
235235
236236   if (LOG) logerror("TMS3556 Reg Write: %06x = %02x\n", offset, data);
237237
238    switch (m_reg_access_phase) {
239    case 0:
240       reg=data&0x0F;
241       reg2=(data&0xF0)>>4;
242       if (reg!=0)
243          m_reg_access_phase=1;
244       return;
238   switch (m_reg_access_phase) {
239   case 0:
240      reg=data&0x0F;
241      reg2=(data&0xF0)>>4;
242      if (reg!=0)
243         m_reg_access_phase=1;
244      return;
245245
246    case 1:
247       if (reg<8) {
248                  m_control_regs[reg]=data;
249                  // leve un flag si le dernier registre ecrit est row ou col
250                  if ((reg==2) || (reg==1)) {
251                     m_colrow=(m_control_regs[2]<<8)|m_control_regs[1];
252                     m_row_col_written=true;
253                     }
246   case 1:
247      if (reg<8) {
248               m_control_regs[reg]=data;
249               // leve un flag si le dernier registre ecrit est row ou col
250               if ((reg==2) || (reg==1)) {
251                  m_colrow=(m_control_regs[2]<<8)|m_control_regs[1];
252                  m_row_col_written=true;
253                  }
254254
255                  if (reg2==0) {
256                     m_reg_access_phase=0;
257                     return;
258                  }
259                  else {
260                       m_reg_access_phase=1;
261                       reg=reg2;
262                       reg2=0;
263                       return;
264                  }
265        } else {
266               m_address_regs[reg-8]=(m_control_regs[2]<<8)|m_control_regs[1];
267               // cas speciaux de decalage pour les generateurs
268               if ((reg>=0xB) && (reg<=0xE)) {
269                  m_address_regs[reg-8]+=2;
270                  m_address_regs[reg-8]&=0xFFFF;
271               } else {
272                 m_address_regs[reg-8]+=1;
273                 m_address_regs[reg-8]&=0xFFFF;
274               }
275               if (reg==9) {
276                  m_row_col_written=false;
277                  m_bamp_written=true;
278                  m_reg_access_phase=0;
279                  return;
280               } else {
281                  m_row_col_written=0;
282                  m_bamp_written=false;
283                  m_reg_access_phase=2;//???
284                  return;
285               }
286               logerror("VDP16[%d] = x%x",reg,m_address_regs[reg-8]);
287               if (reg2==0) {
288                  m_reg_access_phase=0;
289                  return;
290               }
291               else {
292                    m_reg_access_phase=1;
293                    reg=reg2;
294                    reg2=0;
295                    return;
296               }
297       }
298       case 2:
299            m_reg_access_phase=0;
300            return;
301    }
255               if (reg2==0) {
256                  m_reg_access_phase=0;
257                  return;
258               }
259               else {
260                  m_reg_access_phase=1;
261                  reg=reg2;
262                  reg2=0;
263                  return;
264               }
265      } else {
266            m_address_regs[reg-8]=(m_control_regs[2]<<8)|m_control_regs[1];
267            // cas speciaux de decalage pour les generateurs
268            if ((reg>=0xB) && (reg<=0xE)) {
269               m_address_regs[reg-8]+=2;
270               m_address_regs[reg-8]&=0xFFFF;
271            } else {
272               m_address_regs[reg-8]+=1;
273               m_address_regs[reg-8]&=0xFFFF;
274            }
275            if (reg==9) {
276               m_row_col_written=false;
277               m_bamp_written=true;
278               m_reg_access_phase=0;
279               return;
280            } else {
281               m_row_col_written=0;
282               m_bamp_written=false;
283               m_reg_access_phase=2;//???
284               return;
285            }
286            logerror("VDP16[%d] = x%x",reg,m_address_regs[reg-8]);
287            if (reg2==0) {
288               m_reg_access_phase=0;
289               return;
290            }
291            else {
292               m_reg_access_phase=1;
293               reg=reg2;
294               reg2=0;
295               return;
296            }
297      }
298      case 2:
299         m_reg_access_phase=0;
300         return;
301   }
302302}
303303
304304//--------------------------------------------------------------------------
r31373r31374
307307
308308READ8_MEMBER( tms3556_device::initptr_r )
309309{
310    m_init_read=true;
311    return 0xff;
310   m_init_read=true;
311   return 0xff;
312312}
313313
314314
trunk/src/emu/video/mc6845.c
r31373r31374
15171517MC6845_UPDATE_ROW( mos8563_device::vdc_update_row )
15181518{
15191519   const pen_t *pen = m_palette->pens();
1520   
1520
15211521   ra += (m_vert_scroll & 0x0f);
15221522   ra &= 0x0f;
1523   
1523
15241524   UINT8 cth = (m_horiz_char >> 4) + (HSS_DBL ? 0 : 1);
15251525   UINT8 cdh = (m_horiz_char & 0x0f) + (HSS_DBL ? 0 : 1);
15261526   UINT8 cdv = m_vert_char_disp;
1527   
1527
15281528   for (int column = 0; column < x_count; column++)
15291529   {
15301530      UINT8 code = read_videoram(ma + column);
15311531      UINT8 attr = 0;
1532     
1532
15331533      int fg = m_color >> 4;
15341534      int bg = m_color & 0x0f;
1535     
1535
15361536      if (HSS_ATTR)
15371537      {
15381538         offs_t attr_addr = m_attribute_addr + ma + column;
15391539         attr = read_videoram(attr_addr);
15401540      }
1541     
1541
15421542      if (HSS_TEXT)
15431543      {
15441544         if (HSS_ATTR)
r31373r31374
15461546            fg = ATTR_FOREGROUND;
15471547            bg = ATTR_BACKGROUND;
15481548         }
1549         
1549
15501550         if (VSS_RVS) code ^= 0xff;
1551         
1551
15521552         for (int bit = 0; bit < cdh; bit++)
15531553         {
15541554            int x = (m_horiz_scroll & 0x0f) - cth + (column * cth) + bit;
15551555            if (x < 0) x = 0;
15561556            int color = BIT(code, 7) ? fg : bg;
1557           
1557
15581558            bitmap.pix32(vbp + y, hbp + x) = pen[de ? color : 0];
15591559         }
15601560      }
r31373r31374
15641564         {
15651565            fg = ATTR_COLOR;
15661566         }
1567         
1567
15681568         offs_t font_addr;
1569         
1569
15701570         if (m_max_ras_addr < 16)
15711571         {
15721572            font_addr = ((m_char_base_addr & 0xe0) << 8) | (ATTR_ALTERNATE_CHARSET << 12) | (code << 4) | (ra & 0x0f);
r31373r31374
15751575         {
15761576            font_addr = ((m_char_base_addr & 0xc0) << 8) | (ATTR_ALTERNATE_CHARSET << 13) | (code << 5) | (ra & 0x1f);
15771577         }
1578         
1578
15791579         UINT8 data = read_videoram(font_addr);
1580         
1580
15811581         if (ra >= cdv) data = 0;
15821582         if (ATTR_UNDERLINE && (ra == m_underline_ras)) data = 0xff;
15831583         if (ATTR_BLINK && !m_char_blink_state) data = 0;
15841584         if (ATTR_REVERSE) data ^= 0xff;
15851585         if (column == cursor_x) data ^= 0xff;
15861586         if (VSS_RVS) data ^= 0xff;
1587         
1587
15881588         for (int bit = 0; bit < cdh; bit++)
15891589         {
15901590            int x = (m_horiz_scroll & 0x0f) - cth + (column * cth) + bit;
15911591            if (x < 0) x = 0;
15921592            int color = BIT(data, 7) ? fg : bg;
1593           
1593
15941594            bitmap.pix32(vbp + y, hbp + x) = pen[de ? color : 0];
1595           
1595
15961596            if ((bit < 8) || !HSS_SEMI) data <<= 1;
15971597         }
15981598      }
trunk/src/emu/video/resnet.c
r31373r31374
612612      int level = ((inputs >> i) & 1);
613613      if (di.rgb[channel].R[i] != 0.0 && !level)
614614      {
615          // There is no difference in the calculation of the "low" input
616          // (transistor conducting to ground) between TTL output and
617          // open collector output. This is documented explicitly in the
618          // code below (no difference if / else.
615         // There is no difference in the calculation of the "low" input
616         // (transistor conducting to ground) between TTL output and
617         // open collector output. This is documented explicitly in the
618         // code below (no difference if / else.
619619         if (OpenCol)
620620         {
621621            rTotal += 1.0 / di.rgb[channel].R[i];
trunk/src/emu/video/voodoo.c
r31373r31374
56665666
56675667voodoo_device::voodoo_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
56685668   : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
5669     m_fbmem(0),
5670     m_tmumem0(0),
5671     m_tmumem1(0),
5672     m_screen(NULL),
5673     m_cputag(NULL),
5674     m_vblank(*this),
5675     m_stall(*this)
5669      m_fbmem(0),
5670      m_tmumem0(0),
5671      m_tmumem1(0),
5672      m_screen(NULL),
5673      m_cputag(NULL),
5674      m_vblank(*this),
5675      m_stall(*this)
56765676{
56775677   m_token = global_alloc_clear(voodoo_state);
56785678}
trunk/src/emu/video/i8275.c
r31373r31374
224224         //if (LOG) logerror("I8275 '%s' y %u x %u VRTC 0\n", tag(), y, x);
225225         m_write_vrtc(0);
226226      }
227     
227
228228      if (m_scanline <= (m_vrtc_scanline - SCANLINES_PER_ROW))
229229      {
230230         if (lc == 0)
r31373r31374
233233            {
234234               m_status |= ST_DU;
235235               m_du = true;
236               
236
237237               //if (LOG) logerror("I8275 '%s' y %u x %u DMA Underrun\n", tag(), y, x);
238               
238
239239               m_write_drq(0);
240240            }
241241
r31373r31374
254254            }
255255         }
256256      }
257     
257
258258      if (m_scanline == m_irq_scanline)
259259      {
260260         if (m_status & ST_IE)
r31373r31374
264264            m_write_irq(ASSERT_LINE);
265265         }
266266      }
267     
267
268268      if (m_scanline == m_vrtc_scanline)
269269      {
270270         //if (LOG) logerror("I8275 '%s' y %u x %u VRTC 1\n", tag(), y, x);
r31373r31374
288288         m_char_blink &= 0x3f;
289289         m_stored_attr = 0;
290290      }
291     
291
292292      if (m_scanline == m_vrtc_drq_scanline)
293293      {
294294         // swap line buffers
r31373r31374
614614         }
615615         else
616616         {
617            m_drq_on_timer->adjust(attotime::zero);   
617            m_drq_on_timer->adjust(attotime::zero);
618618         }
619619      }
620620
trunk/src/emu/video/snes_ppu.c
r31373r31374
217217#if SNES_LAYER_DEBUG
218218   memset(&m_debug_options, 0, sizeof(m_debug_options));
219219#endif
220   
220
221221   m_vram = auto_alloc_array(machine(), UINT8, SNES_VRAM_SIZE);
222222   m_cgram = auto_alloc_array(machine(), UINT16, SNES_CGRAM_SIZE/2);
223223   m_oam_ram = auto_alloc_array(machine(), UINT16, SNES_OAM_SIZE/2);
224   
224
225225   /* Inititialize registers/variables */
226226   m_update_windows = 1;
227227   m_beam.latch_vert = 0;
r31373r31374
232232   m_mode = 0;
233233   m_ppu1_version = 1;  // 5C77 chip version number, read by STAT77, only '1' is known
234234   m_ppu2_version = 3;  // 5C78 chip version number, read by STAT78, only '2' & '3' encountered so far.
235   
235
236236   m_cgram_address = 0;
237237   m_read_ophct = 0;
238238   m_read_opvct = 0;
239   
239
240240   PPU_REG(VMAIN) = 0x80;
241241   // what about other regs?
242   
242
243243   /* Inititialize mosaic table */
244244   for (int j = 0; j < 16; j++)
245245   {
246246      for (int i = 0; i < 4096; i++)
247247         m_mosaic_table[j][i] = (i / (j + 1)) * (j + 1);
248248   }
249   
249
250250   /* Init VRAM */
251251   memset(m_vram, 0, SNES_VRAM_SIZE);
252   
252
253253   /* Init Palette RAM */
254254   memset((UINT8 *)m_cgram, 0, SNES_CGRAM_SIZE);
255   
255
256256   /* Init oam RAM */
257257   memset((UINT8 *)m_oam_ram, 0xff, SNES_OAM_SIZE);
258258
r31373r31374
268268      save_item(NAME(m_scanlines[i].layer), i);
269269      save_item(NAME(m_scanlines[i].blend_exception), i);
270270   }
271   
271
272272   for (int i = 0; i < 6; i++)
273273   {
274274      save_item(NAME(m_layer[i].window1_enabled), i);
r31373r31374
288288      save_item(NAME(m_layer[i].sub_bg_enabled), i);
289289      save_item(NAME(m_layer[i].hoffs), i);
290290      save_item(NAME(m_layer[i].voffs), i);
291     
291
292292      save_item(NAME(m_clipmasks[i]), i);
293293   }
294   
294
295295   save_item(NAME(m_oam.address_low));
296296   save_item(NAME(m_oam.address_high));
297297   save_item(NAME(m_oam.saved_address_low));
r31373r31374
306306   save_item(NAME(m_oam.first_sprite));
307307   save_item(NAME(m_oam.flip));
308308   save_item(NAME(m_oam.write_latch));
309   
309
310310   save_item(NAME(m_beam.latch_horz));
311311   save_item(NAME(m_beam.latch_vert));
312312   save_item(NAME(m_beam.current_horz));
313313   save_item(NAME(m_beam.current_vert));
314314   save_item(NAME(m_beam.last_visible_line));
315315   save_item(NAME(m_beam.interlace_count));
316   
316
317317   save_item(NAME(m_mode7.repeat));
318318   save_item(NAME(m_mode7.hflip));
319319   save_item(NAME(m_mode7.vflip));
r31373r31374
326326   save_item(NAME(m_mode7.hor_offset));
327327   save_item(NAME(m_mode7.ver_offset));
328328   save_item(NAME(m_mode7.extbg));
329   
329
330330   save_item(NAME(m_mosaic_size));
331331   save_item(NAME(m_clip_to_black));
332332   save_item(NAME(m_prevent_color_math));
r31373r31374
335335   save_item(NAME(m_direct_color));
336336   save_item(NAME(m_ppu_last_scroll));
337337   save_item(NAME(m_mode7_last_scroll));
338   
338
339339   save_item(NAME(m_ppu1_open_bus));
340340   save_item(NAME(m_ppu2_open_bus));
341341   save_item(NAME(m_ppu1_version));
r31373r31374
344344   save_item(NAME(m_window1_right));
345345   save_item(NAME(m_window2_left));
346346   save_item(NAME(m_window2_right));
347   
347
348348   save_item(NAME(m_update_windows));
349349   save_item(NAME(m_update_offsets));
350350   save_item(NAME(m_update_oam_list));
r31373r31374
357357   save_item(NAME(m_color_modes));
358358   save_item(NAME(m_stat77));
359359   save_item(NAME(m_stat78));
360   
360
361361   save_item(NAME(m_htmult));
362362   save_item(NAME(m_cgram_address));
363363   save_item(NAME(m_read_ophct));
r31373r31374
369369   save_item(NAME(m_vram_fgr_shift));
370370   save_item(NAME(m_vram_read_buffer));
371371   save_item(NAME(m_vmadd));
372   
372
373373   save_item(NAME(m_regs));
374   
374
375375   save_pointer(NAME(m_vram), SNES_VRAM_SIZE);
376376   save_pointer(NAME(m_cgram), SNES_CGRAM_SIZE/2);
377377   save_pointer(NAME(m_oam_ram), SNES_OAM_SIZE/2);
trunk/src/emu/video/crt9007.c
r31373r31374
431431
432432   //if (LOG)
433433   //{
434   //   logerror("CRT9007 '%s' Screen: %u x %u @ %f Hz\n", tag(), horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
435   //   logerror("CRT9007 '%s' Visible Area: (%u, %u) - (%u, %u)\n", tag(), visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y);
434   //  logerror("CRT9007 '%s' Screen: %u x %u @ %f Hz\n", tag(), horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
435   //  logerror("CRT9007 '%s' Visible Area: (%u, %u) - (%u, %u)\n", tag(), visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y);
436436   //}
437437
438438   //m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh);
trunk/src/emu/video/hd44780.c
r31373r31374
189189   if (m_active_ram == DDRAM)
190190   {
191191      int max_ac = (m_num_line == 1) ? 0x4f : 0x67;
192     
192
193193      if (m_ac > max_ac)
194194         m_ac -= max_ac + 1;
195195      else if (m_ac < 0)
r31373r31374
214214void hd44780_device::shift_display(int direction)
215215{
216216   m_disp_shift += direction;
217   
217
218218   if (m_disp_shift == 0x50)
219219      m_disp_shift = 0;
220220   else if (m_disp_shift == -1)
trunk/src/emu/webengine.c
r31373r31374
103103      array.append(data);
104104   }
105105
106   // add all sliders
106   // add all sliders
107107   for (curslider = (slider_state*)machine().osd().get_slider_list(); curslider != NULL; curslider = curslider->next)
108108   {
109109      INT32 curval = (*curslider->update)(machine(), curslider->arg, &tempstring, SLIDER_NOCHANGE);
r31373r31374
258258      file.close();
259259      mg_send_header(conn, "Cache-Control", "no-cache, no-store, must-revalidate");
260260      mg_send_header(conn, "Pragma", "no-cache");
261      mg_send_header(conn, "Expires", "0");         
261      mg_send_header(conn, "Expires", "0");
262262      mg_send_file(conn, fullpath.cstr());
263263      return MG_MORE; // It is important to return MG_MORE after mg_send_file!
264264   }
r31373r31374
266266}
267267
268268static int ev_handler(struct mg_connection *conn, enum mg_event ev) {
269  if (ev == MG_REQUEST) {
269   if (ev == MG_REQUEST) {
270270   if (conn->is_websocket) {
271271      // This handler is called for each incoming websocket frame, one or more
272272      // times for connection lifetime.
273273      // Echo websocket data back to the client.
274274      return conn->content_len == 4 && !memcmp(conn->content, "exit", 4) ? MG_FALSE : MG_TRUE;
275    } else {
276      web_engine *engine = static_cast<web_engine *>(conn->server_param);   
275   } else {
276      web_engine *engine = static_cast<web_engine *>(conn->server_param);
277277      return engine->begin_request_handler(conn);
278278   }
279  } else if (ev== MG_WS_CONNECT) {
279   } else if (ev== MG_WS_CONNECT) {
280280   // New websocket connection. Send connection ID back to the client.
281281   mg_websocket_printf(conn, WEBSOCKET_OPCODE_TEXT, "update_machine");
282282   return MG_FALSE;
283  } else if (ev == MG_AUTH) {
284    return MG_TRUE;
285  } else {
286    return MG_FALSE;
287  }
283   } else if (ev == MG_AUTH) {
284   return MG_TRUE;
285   } else {
286   return MG_FALSE;
287   }
288288}
289289
290290static int iterate_callback(struct mg_connection *c, enum mg_event ev) {
291  if (ev == MG_POLL && c->is_websocket) {
292    char buf[20];
293    int len = snprintf(buf, sizeof(buf), "%lu",
294     (unsigned long) * (time_t *) c->callback_param);
295    mg_websocket_write(c, 1, buf, len);
296  }
297  return MG_TRUE;
291   if (ev == MG_POLL && c->is_websocket) {
292   char buf[20];
293   int len = snprintf(buf, sizeof(buf), "%lu",
294      (unsigned long) * (time_t *) c->callback_param);
295   mg_websocket_write(c, 1, buf, len);
296   }
297   return MG_TRUE;
298298}
299299
300300static void *serve(void *server) {
r31373r31374
304304   if (current_timer - last_timer > 0) {
305305      last_timer = current_timer;
306306      mg_iterate_over_connections((struct mg_server *)server, iterate_callback, &current_timer);
307   } 
307   }
308308   return NULL;
309309}
310310
r31373r31374
322322{
323323   if (m_options.http()) {
324324      m_server = mg_create_server(this, ev_handler);
325     
325
326326      mg_set_option(m_server, "listening_port", options.http_port());
327327      mg_set_option(m_server, "document_root",  options.http_path());
328     
328
329329      mg_start_thread(serve, m_server);
330330   }
331331
r31373r31374
349349{
350350   m_exiting_core = 1;
351351   // Cleanup, and free server instance
352   mg_destroy_server(&m_server);   
352   mg_destroy_server(&m_server);
353353}
354354
355355static int websocket_callback(struct mg_connection *c, enum mg_event ev) {
356  if (c->is_websocket) {
357    const char *message = (const char *)c->callback_param;
358    mg_websocket_write(c, 1, message, strlen(message));
359  }
360  return MG_TRUE;
356   if (c->is_websocket) {
357   const char *message = (const char *)c->callback_param;
358   mg_websocket_write(c, 1, message, strlen(message));
359   }
360   return MG_TRUE;
361361}
362362
363363void web_engine::push_message(const char *message)
trunk/src/emu/clifront.c
r31373r31374
197197            throw emu_fatalerror(MAMERR_FATALERROR, NULL);
198198         }
199199      }
200     
200
201201      m_options.parse_standard_inis(option_errors);
202202      // parse the command line, adding any system-specific options
203203      if (!m_options.parse_command_line(argc, argv, option_errors))
r31373r31374
232232         }
233233         if (option_errors)
234234            osd_printf_error("Error in command line:\n%s\n", option_errors.trimspace().cstr());
235     
235
236236         // if we can't find it, give an appropriate error
237237         const game_driver *system = m_options.system();
238238         if (system == NULL && *(m_options.system_name()) != 0)
trunk/src/emu/machine/autoconfig.c
r31373r31374
11/***************************************************************************
22
3   Amiga Autoconfig
3    Amiga Autoconfig
44
55***************************************************************************/
66
trunk/src/emu/machine/keyboard.c
r31373r31374
88Example of usage in a driver.
99
1010In MACHINE_CONFIG
11       
12   MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0)
13   MCFG_GENERIC_KEYBOARD_CB(WRITE8(xxx_state, kbd_put))
1411
12    MCFG_DEVICE_ADD(KEYBOARD_TAG, GENERIC_KEYBOARD, 0)
13    MCFG_GENERIC_KEYBOARD_CB(WRITE8(xxx_state, kbd_put))
14
1515In the code:
1616
1717WRITE8_MEMBER( xxx_state::kbd_put )
trunk/src/emu/machine/aakart.c
r31373r31374
9191
9292void aakart_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
9393{
94    if(id == TX_TIMER && m_new_command & 1)
95    {
96        switch(m_tx_latch)
97        {
98            case 0x00:
99            case 0x02:
100            case 0x03:
101            case 0x07:
102                // ---- -x-- scroll lock
103                // ---- --x- num lock
104                // ---- ---x caps lock
105                break;
106            case 0x20:
107                m_rx = 0x81;
108                m_out_tx_cb(ASSERT_LINE);
109                break;
110            case 0x30:
111            case 0x31:
112            case 0x32:
113            case 0x33:
114                m_keyb_enable = m_tx_latch & 1;
115                m_mouse_enable = (m_tx_latch & 2) >> 1;
116                if(m_keyb_enable & 1 && m_keyb_state & 1)
117                {
118                    //printf("Got row\n");
119                    m_rx = m_keyb_row;
120                    m_out_tx_cb(ASSERT_LINE);
121                }
94   if(id == TX_TIMER && m_new_command & 1)
95   {
96      switch(m_tx_latch)
97      {
98         case 0x00:
99         case 0x02:
100         case 0x03:
101         case 0x07:
102            // ---- -x-- scroll lock
103            // ---- --x- num lock
104            // ---- ---x caps lock
105            break;
106         case 0x20:
107            m_rx = 0x81;
108            m_out_tx_cb(ASSERT_LINE);
109            break;
110         case 0x30:
111         case 0x31:
112         case 0x32:
113         case 0x33:
114            m_keyb_enable = m_tx_latch & 1;
115            m_mouse_enable = (m_tx_latch & 2) >> 1;
116            if(m_keyb_enable & 1 && m_keyb_state & 1)
117            {
118               //printf("Got row\n");
119               m_rx = m_keyb_row;
120               m_out_tx_cb(ASSERT_LINE);
121            }
122122
123                break;
124            case 0x3f:
125                if(m_keyb_enable & 1 && m_keyb_state & 1)
126                {
127                    //printf("Got col\n");
128                    m_rx = m_keyb_col;
129                    m_out_tx_cb(ASSERT_LINE);
130                    m_keyb_state = 0;
131                }
123            break;
124         case 0x3f:
125            if(m_keyb_enable & 1 && m_keyb_state & 1)
126            {
127               //printf("Got col\n");
128               m_rx = m_keyb_col;
129               m_out_tx_cb(ASSERT_LINE);
130               m_keyb_state = 0;
131            }
132132
133                break;
134            case 0xfd:
135                m_rx = 0xfd;
136                m_out_tx_cb(ASSERT_LINE);
137                break;
138            case 0xfe:
139                m_rx = 0xfe;
140                m_out_tx_cb(ASSERT_LINE);
141                break;
142            case 0xff:
143                m_rx = 0xff;
144                m_out_tx_cb(ASSERT_LINE);
145                break;
146            default:
147                //printf("%02x %02x %02x\n",m_tx_latch,m_rx_latch,m_keyb_enable);
148                break;
149        }
133            break;
134         case 0xfd:
135            m_rx = 0xfd;
136            m_out_tx_cb(ASSERT_LINE);
137            break;
138         case 0xfe:
139            m_rx = 0xfe;
140            m_out_tx_cb(ASSERT_LINE);
141            break;
142         case 0xff:
143            m_rx = 0xff;
144            m_out_tx_cb(ASSERT_LINE);
145            break;
146         default:
147            //printf("%02x %02x %02x\n",m_tx_latch,m_rx_latch,m_keyb_enable);
148            break;
149      }
150150
151        //m_new_command &= ~1;
152        m_out_rx_cb(ASSERT_LINE);
153    }
151      //m_new_command &= ~1;
152      m_out_rx_cb(ASSERT_LINE);
153   }
154154
155155}
156156
r31373r31374
162162
163163READ8_MEMBER( aakart_device::read )
164164{
165    m_out_tx_cb(CLEAR_LINE);
166    //debugger_break(machine());
165   m_out_tx_cb(CLEAR_LINE);
166   //debugger_break(machine());
167167   return m_rx;
168168}
169169
r31373r31374
172172   // if(m_new_command) printf("skip cmd %02x\n",data);
173173
174174   m_tx_latch = data;
175    m_out_rx_cb(CLEAR_LINE);
176    m_new_command |= 1;
175   m_out_rx_cb(CLEAR_LINE);
176   m_new_command |= 1;
177177}
178178
179179void aakart_device::send_keycode_down(UINT8 row, UINT8 col)
180180{
181    //printf("keycode down\n");
182    m_keyb_row = row | 0xc0;
183    m_keyb_col = col | 0xc0;
184    m_keyb_state = 1;
181   //printf("keycode down\n");
182   m_keyb_row = row | 0xc0;
183   m_keyb_col = col | 0xc0;
184   m_keyb_state = 1;
185185}
186186
187187void aakart_device::send_keycode_up(UINT8 row, UINT8 col)
188188{
189    //printf("keycode up\n");
190    m_keyb_row = row | 0xd0;
191    m_keyb_col = col | 0xd0;
192    m_keyb_state = 1;
189   //printf("keycode up\n");
190   m_keyb_row = row | 0xd0;
191   m_keyb_col = col | 0xd0;
192   m_keyb_state = 1;
193193}
trunk/src/emu/machine/ncr539x.c
r31373r31374
5757   "Command",              // 3
5858   "Status",               // 4
5959   "Interrupt Status",     // 5
60   "Internal State",      // 6
61   "Current FIFO/Internal State",   // 7
62   "Control Register 1",   // 8
60   "Internal State",       // 6
61   "Current FIFO/Internal State",  // 7
62   "Control Register 1",   // 8
6363   "0x9",
6464   "0xA",
6565   "Control Register 2",
r31373r31374
434434WRITE8_MEMBER( ncr539x_device::write )
435435{
436436   #if VERBOSE
437   //if (offset != 2)
437   //if (offset != 2)
438438   printf("539x: Write %02x @ %s (%02x) (PC=%x)\n", data, wrregs[offset], offset, space.device().safe_pc());
439439   #endif
440440
trunk/src/emu/machine/netlist.c
r31373r31374
439439      switch (s->m_dt)
440440      {
441441         case DT_DOUBLE:
442                {
443                    double *td = s->resolved<double>();
444                    if (td != NULL) save_pointer(td, s->m_name, s->m_count);
445                }
442            {
443               double *td = s->resolved<double>();
444               if (td != NULL) save_pointer(td, s->m_name, s->m_count);
445            }
446446            break;
447447         case DT_INT64:
448448            save_pointer((INT64 *) s->m_ptr, s->m_name, s->m_count);
trunk/src/emu/machine/akiko.c
r31373r31374
11/***************************************************************************
22
3   Akiko
3    Akiko
44
5   ASIC used in the Amiga CD32. Commodore Part number 391563-01.
5    ASIC used in the Amiga CD32. Commodore Part number 391563-01.
66
7   - CD-ROM controller
8   - Builtin 1KB NVRAM
9   - Chunky to planar converter
10   - 2x CIA chips
7    - CD-ROM controller
8    - Builtin 1KB NVRAM
9    - Chunky to planar converter
10    - 2x CIA chips
1111
1212***************************************************************************/
1313
trunk/src/emu/machine/wozfdc.c
r31373r31374
4242//  LIVE DEVICE
4343//**************************************************************************
4444
45wozfdc_device::wozfdc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
45wozfdc_device::wozfdc_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
4646   device_t(mconfig, type, name, tag, owner, clock, shortname, source)
4747{
4848}
r31373r31374
9999   }
100100   else
101101   {
102      switch (drvsel & 3)
102      switch (drvsel & 3)
103103      {
104104         case 0:
105105            newflop = floppy0->get_device();
r31373r31374
213213            floppy->stp_w(false);
214214            floppy->stp_w(true);
215215         }
216      }               
216      }
217217   }
218218}
219219
r31373r31374
396396      cur_lss.write_start_time = cur_lss.tm;
397397      cur_lss.write_position = 0;
398398   }
399   
399
400400   predicted_lss.tm = attotime::never;
401401}
402402
r31373r31374
409409   while(cur_lss.tm < tm) {
410410      lss_predict(tm);
411411      commit_predicted();
412   }     
412   }
413413}
414414
415415void wozfdc_device::lss_predict(attotime limit)
r31373r31374
450450
451451         if(mode_write) {
452452            if((write_line_active && !(address & 0x80)) ||
453               (!write_line_active && (address & 0x80))) {
453               (!write_line_active && (address & 0x80))) {
454454               write_line_active = !write_line_active;
455455               assert(predicted_lss.write_position != 32);
456456               predicted_lss.write_buffer[predicted_lss.write_position++] = cycles_to_time(cycles);
r31373r31374
538538{
539539   switch (offset)
540540   {
541      case 0:   // clear drive select bit 0
541      case 0: // clear drive select bit 0
542542         drvsel &= ~1;
543543         break;
544544
545      case 1:   // set drive select bit 0
545      case 1: // set drive select bit 0
546546         drvsel |= 1;
547547         break;
548548
549      case 2:   // clear drive select bit 1
549      case 2: // clear drive select bit 1
550550         drvsel &= ~2;
551551         break;
552552
553      case 3:   // set drive select bit 1
553      case 3: // set drive select bit 1
554554         drvsel |= 2;
555555         break;
556556
557      case 4:   // clear enable 1
557      case 4: // clear enable 1
558558         enable1 = 0;
559559         break;
560560
561      case 5:   // set enable 1
561      case 5: // set enable 1
562562         enable1 = 1;
563563         break;
564564
565      case 6:   // clear side 2
565      case 6: // clear side 2
566566      case 7: // set side 2
567567         break;
568568
569      default:   // cod8-c0df are not FDC related
569      default:    // cod8-c0df are not FDC related
570570         break;
571571   }
572572}
573
trunk/src/emu/machine/gayle.c
r31373r31374
11/***************************************************************************
22
3   GAYLE
3    GAYLE
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
77
8   Gate array used in the Amiga 600 and Amiga 1200 computers.
8    Gate array used in the Amiga 600 and Amiga 1200 computers.
99
1010***************************************************************************/
1111
trunk/src/emu/machine/adc0808.c
r31373r31374
8989            /* sample input */
9090            double vref_pos = m_in_vref_pos_cb();
9191            double vref_neg = m_in_vref_neg_cb();
92           
92
9393            double input = 0;
94           
94
9595            switch (m_address)
9696            {
9797               case 0:
r31373r31374
117117                  break;
118118               case 7:
119119                  input = m_in_in_7_cb();
120                  break;                 
120                  break;
121121               break;
122122            }
123123            m_sar = (255 * (input - vref_neg)) / (vref_pos - vref_neg);
trunk/src/emu/machine/6840ptm.c
r31373r31374
8989   m_out1_cb.resolve_safe();
9090   m_out2_cb.resolve_safe();
9191   m_irq_cb.resolve_safe();
92   
92
9393   for (int i = 0; i < 3; i++)
9494   {
9595      if ( m_external_clock[i] == 0 )
9696         m_external_clock[i] = 1;
9797   }
98     
98
9999   m_timer[0] = timer_alloc(0);
100100   m_timer[1] = timer_alloc(1);
101101   m_timer[2] = timer_alloc(2);
trunk/src/emu/machine/roc10937.c
r31373r31374
199199   }
200200}
201201
202WRITE_LINE_MEMBER( rocvfd_t::sclk )
203{
204   shift_clock(state);
202WRITE_LINE_MEMBER( rocvfd_t::sclk )
203{
204   shift_clock(state);
205205}
206206
207WRITE_LINE_MEMBER( rocvfd_t::data )
208{
207WRITE_LINE_MEMBER( rocvfd_t::data )
208{
209209   m_data = state;
210210}
211211
212WRITE_LINE_MEMBER( rocvfd_t::por )
212WRITE_LINE_MEMBER( rocvfd_t::por )
213213{
214214   //If line goes low, reset mode is engaged, until such a time as it goes high again.
215215   if (!state)
trunk/src/emu/machine/upd765.c
r31373r31374
25232523      tc_w((m_cr1 & 0x01) ? true : false);
25242524   }
25252525}
2526
2527
trunk/src/emu/machine/amigafdc.c
r31373r31374
238238               if(adkcon & 0x0400) {
239239                  if(dma_state == DMA_WAIT_START) {
240240                     cur_live.bit_counter = 0;
241                     
241
242242                     if(!(dsklen & 0x3fff))
243243                        dma_done();
244244                     else if(dsklen & 0x4000) {
r31373r31374
286286            if(cur_live.bit_counter != 8)
287287               fatalerror("amiga_fdc::live_run - cur_live.bit_counter != 8\n");
288288            cur_live.bit_counter = 0;
289           
289
290290            switch(dma_state) {
291291            case DMA_IDLE:
292292            case DMA_WAIT_START:
293293               break;
294               
294
295295            case DMA_RUNNING_BYTE_0:
296296               dma_state = DMA_RUNNING_BYTE_1;
297297               break;
298               
298
299299            case DMA_RUNNING_BYTE_1: {
300300               dma_value = dma_read();
301301               break;
302302            }
303303            }
304304         }
305           
305
306306         cur_live.state = RUNNING;
307307         checkpoint();
308308         break;
r31373r31374
331331               cur_live.bit_counter = 0;
332332               dma_value = dma_read();
333333            }
334         }         
334         }
335335      } else {
336336         dskbyt |= 0x4000;
337337         if(dsklen & 0x4000)
trunk/src/emu/machine/mc68681.c
r31373r31374
246246      {
247247         UINT8 csr = m_chanA->get_chan_CSR();
248248
249         if ((csr & 0xf0) == 0xd0)   // tx is timer driven
249         if ((csr & 0xf0) == 0xd0)   // tx is timer driven
250250         {
251251            m_chanA->tx_clock_w(half_period);
252252         }
253         if ((csr & 0x0f) == 0x0d)    // rx is timer driven
253         if ((csr & 0x0f) == 0x0d)   // rx is timer driven
254254         {
255255            m_chanA->rx_clock_w(half_period);
256256         }
257257
258         csr = m_chanB->get_chan_CSR();
259         if ((csr & 0xf0) == 0xd0)   // tx is timer driven
258         csr = m_chanB->get_chan_CSR();
259         if ((csr & 0xf0) == 0xd0)   // tx is timer driven
260260         {
261261            m_chanB->tx_clock_w(half_period);
262262         }
263         if ((csr & 0x0f) == 0x0d)    // rx is timer driven
263         if ((csr & 0x0f) == 0x0d)   // rx is timer driven
264264         {
265265            m_chanB->rx_clock_w(half_period);
266266         }
r31373r31374
721721
722722void mc68681_channel::tra_complete()
723723{
724//   printf("%s ch %d Tx complete\n", tag(), m_ch);
724//  printf("%s ch %d Tx complete\n", tag(), m_ch);
725725   tx_ready = 1;
726726   SR |= STATUS_TRANSMITTER_READY;
727727
r31373r31374
11471147{
11481148   return CSR;
11491149}
1150
trunk/src/emu/machine/i8271.c
r31373r31374
10461046
10471047         /* these two do not appear to be set at all! ?? */
10481048
1049         if (m_floppy[0])
1049         if (m_floppy[0])
10501050         {
10511051            if (m_floppy[0]->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
10521052            {
r31373r31374
10541054            }
10551055         }
10561056
1057         if (m_floppy[1])
1057         if (m_floppy[1])
10581058         {
10591059            if (m_floppy[1]->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
10601060            {
trunk/src/emu/machine/wd7600.c
r31373r31374
284284// Keyboard
285285WRITE8_MEMBER( wd7600_device::keyb_data_w )
286286{
287//   if(LOG) logerror("WD7600 '%s': keyboard data write %02x\n", tag(), data);
287//  if(LOG) logerror("WD7600 '%s': keyboard data write %02x\n", tag(), data);
288288   m_keybc->data_w(space,0,data);
289289}
290290
291291READ8_MEMBER( wd7600_device::keyb_data_r )
292292{
293293   UINT8 ret = m_keybc->data_r(space,0);
294//   if(LOG) logerror("WD7600 '%s': keyboard data read %02x\n", tag(), ret);
294//  if(LOG) logerror("WD7600 '%s': keyboard data read %02x\n", tag(), ret);
295295   return ret;
296296}
297297
298298WRITE8_MEMBER( wd7600_device::keyb_cmd_w )
299299{
300//   if(LOG) logerror("WD7600 '%s': keyboard command %02x\n", tag(), data);
300//  if(LOG) logerror("WD7600 '%s': keyboard command %02x\n", tag(), data);
301301   m_keybc->command_w(space,0,data);
302302}
303303
trunk/src/emu/machine/corvushd.c
r31373r31374
224224         //
225225         // Prep Commands
226226         //
227         case PREP_MODE_SELECT:             
227         case PREP_MODE_SELECT:
228228         case PREP_RESET_DRIVE:
229229         case PREP_FORMAT_DRIVE:
230230         case PREP_FILL_DRIVE_OMNI:
r31373r31374
692692
693693   // This firmware string and revision were taken from the Corvus firmware
694694   // file CORVB184.CLR found on the SSE SoftBox distribution disk.
695   strcpy((char *) m_buffer.drive_param_response.firmware_desc, "V18.4     -- CONST II - 11/82  ");   
695   strcpy((char *) m_buffer.drive_param_response.firmware_desc, "V18.4     -- CONST II - 11/82  ");
696696   m_buffer.drive_param_response.firmware_rev = 37;
697697
698698   // Controller ROM version
699699   m_buffer.drive_param_response.rom_version = ROM_VERSION;
700700
701701   //
702    // Track information
702   // Track information
703703   //
704704   m_buffer.drive_param_response.track_info.sectors_per_track = m_sectors_per_track;
705705   m_buffer.drive_param_response.track_info.tracks_per_cylinder = m_tracks_per_cylinder;
r31373r31374
766766//
767767// Enter prep mode.  In prep mode, only prep mode commands may be executed.
768768//
769// A "prep block" is 512 bytes of machine code that the host sends to the
769// A "prep block" is 512 bytes of machine code that the host sends to the
770770// controller.  The controller will jump to this code after receiving it,
771771// and it is what actually implements prep mode commands.  This HLE ignores
772// the prep block from the host. 
772// the prep block from the host.
773773//
774774// On the Rev B/H drives (which we emulate), a prep block is Z80 machine
775775// code and only one prep block can be sent.  Sending the "put drive into
r31373r31374
778778// distribution disk returns error 0x8f (unrecognized command) for this case.
779779//
780780// On the OmniDrive and Bank, a prep block is 6801 machine code.  These
781// controllers allow multiple prep blocks to be sent.  The first time the
781// controllers allow multiple prep blocks to be sent.  The first time the
782782// "put drive into prep mode" command is sent puts the drive into prep mode.
783// The command can then be sent again up to 3 times with more prep blocks. 
783// The command can then be sent again up to 3 times with more prep blocks.
784784// (Mass Storage GTI, pages 50-51)
785785//
786786// Pass:
r31373r31374
791791//      Status of command
792792//
793793UINT8 corvus_hdc_t::corvus_enter_prep_mode(UINT8 drv, UINT8 *prep_block) {
794   // on rev b/h drives, sending the "put drive into prep mode"
794   // on rev b/h drives, sending the "put drive into prep mode"
795795   // command when already in prep mode is an error.
796796   if (m_prep_mode) {
797797      logerror("corvus_enter_prep_mode: Attempt to enter prep mode while in prep mode\n");
r31373r31374
809809
810810   m_prep_mode = true;
811811   m_prep_drv = drv;
812   return STAT_SUCCESS;   
812   return STAT_SUCCESS;
813813}
814814
815815
r31373r31374
826826   LOG(("corvus_exit_prep_mode: Prep mode exited\n"));
827827   m_prep_mode = false;
828828   m_prep_drv = 0;
829   return STAT_SUCCESS;   
829   return STAT_SUCCESS;
830830}
831831
832832
r31373r31374
852852   LOG(("corvus_read_firmware_block: Reading firmware head: 0x%2.2x, sector: 0x%2.2x, relative_sector: 0x%2.2x\n",
853853      head, sector, relative_sector));
854854
855   status = corvus_read_sector(m_prep_drv, relative_sector, m_buffer.read_512_response.data, 512);       
855   status = corvus_read_sector(m_prep_drv, relative_sector, m_buffer.read_512_response.data, 512);
856856   return status;
857857}
858858
r31373r31374
880880   LOG(("corvus_write_firmware_block: Writing firmware head: 0x%2.2x, sector: 0x%2.2x, relative_sector: 0x%2.2x\n",
881881      head, sector, relative_sector));
882882
883   status = corvus_write_sector(m_prep_drv, relative_sector, buffer, 512);
883   status = corvus_write_sector(m_prep_drv, relative_sector, buffer, 512);
884884   return status;
885885}
886886
r31373r31374
10671067               break;
10681068            case PREP_MODE_SELECT:
10691069               m_buffer.single_byte_response.status =
1070                  corvus_enter_prep_mode(m_buffer.prep_mode_command.drive,
1070                  corvus_enter_prep_mode(m_buffer.prep_mode_command.drive,
10711071                     m_buffer.prep_mode_command.prep_block);
10721072               break;
10731073            default:
r31373r31374
10821082               // when already in prep mode, some drives allow this command to
10831083               // be sent again.  see corvus_enter_prep_mode() for details.
10841084               m_buffer.single_byte_response.status =
1085                  corvus_enter_prep_mode(m_buffer.prep_mode_command.drive,
1085                  corvus_enter_prep_mode(m_buffer.prep_mode_command.drive,
10861086                     m_buffer.prep_mode_command.prep_block);
10871087               break;
10881088            case PREP_RESET_DRIVE:
1089               m_buffer.single_byte_response.status =
1089               m_buffer.single_byte_response.status =
10901090                  corvus_exit_prep_mode();
10911091               break;
10921092            case PREP_READ_FIRMWARE:
r31373r31374
11051105               break;
11061106            case PREP_VERIFY:
11071107               m_buffer.verify_drive_response.status = STAT_SUCCESS;
1108               m_buffer.verify_drive_response.bad_sectors = 0;
1108               m_buffer.verify_drive_response.bad_sectors = 0;
11091109               break;
11101110            default:
11111111               m_xmit_bytes = 1;
trunk/src/emu/machine/dmac.c
r31373r31374
462462
463463   if (m_dma_active)
464464   {
465
466465   }
467466}
trunk/src/emu/machine/53c810.c
r31373r31374
608608
609609void lsi53c810_device::add_opcode(UINT8 op, UINT8 mask, opcode_handler_delegate handler)
610610{
611   for (int i = 0; i < 256; i++)
611   for (int i = 0; i < 256; i++)
612612   {
613      if ((i & mask) == op)
613      if ((i & mask) == op)
614614      {
615615         dma_opcode[i] = handler;
616616      }
r31373r31374
629629   m_irq_cb.bind_relative_to(*owner());
630630   m_dma_cb.bind_relative_to(*owner());
631631   m_fetch_cb.bind_relative_to(*owner());
632   
632
633633   for (int i = 0; i < 256; i++)
634634   {
635635      dma_opcode[i] = opcode_handler_delegate(FUNC(lsi53c810_device::dmaop_invalid), this);
trunk/src/emu/machine/6532riot.c
r31373r31374
307307         if (!(*port->m_in_cb).isnull())
308308         {
309309            port->m_in = (*port->m_in_cb)(0);
310         
310
311311            /* changes to port A need to update the PA7 state */
312312            if (port == &m_port[0])
313313            {
trunk/src/emu/machine/hd63450.c
r31373r31374
489489{
490490   bool ostate = m_drq_state[0];
491491   m_drq_state[0] = state;
492   
492
493493   if((m_reg[0].ocr & 2) && (state && !ostate))
494494   {
495495      // in cycle steal mode drq is supposed to be edge triggered
r31373r31374
518518{
519519   bool ostate = m_drq_state[2];
520520   m_drq_state[2] = state;
521   
521
522522   if((m_reg[2].ocr & 2) && (state && !ostate))
523523   {
524524      single_transfer(2);
r31373r31374
532532{
533533   bool ostate = m_drq_state[3];
534534   m_drq_state[3] = state;
535   
535
536536   if((m_reg[3].ocr & 2) && (state && !ostate))
537537   {
538538      single_transfer(3);
trunk/src/emu/machine/i8255.c
r31373r31374
286286   m_out_pa_cb.resolve_safe();
287287   m_out_pb_cb.resolve_safe();
288288   m_out_pc_cb.resolve_safe();
289   
289
290290   // register for state saving
291291   save_item(NAME(m_control));
292292   save_item(NAME(m_output));
r31373r31374
522522         m_out_pb_cb((offs_t)0, m_output[port]);
523523      else
524524         m_out_pc_cb((offs_t)0, m_output[port]);
525     
525
526526      // set output buffer full flag
527527      set_obf(port, 0);
528528
trunk/src/emu/machine/cr511b.c
r31373r31374
11/***************************************************************************
22
3   CR-511-B CD-ROM drive
3    CR-511-B CD-ROM drive
44
55    license: MAME, GPL-2.0+
66    copyright-holders: Dirk Best
77
8   CD-ROM drive with a custom MKE/Panasonic interface as used in the
9   Commodore CDTV and early SoundBlaster cards.
8    CD-ROM drive with a custom MKE/Panasonic interface as used in the
9    Commodore CDTV and early SoundBlaster cards.
1010
1111***************************************************************************/
1212
r31373r31374
109109
110110WRITE8_MEMBER ( cr511b_device::write )
111111{
112
113112}
114113
115114WRITE_LINE_MEMBER( cr511b_device::enable_w )
trunk/src/emu/machine/wd17xx.c
r31373r31374
11/***************************************************************************
22
3   !!! DEPRECATED, USE src/emu/wd_fdc.h FOR NEW DRIVERS !!!
3    !!! DEPRECATED, USE src/emu/wd_fdc.h FOR NEW DRIVERS !!!
44
55    wd17xx.c
66
r31373r31374
20242024
20252025   for (int i = 0; i < 4; i++)
20262026   {
2027      if (m_floppy_drive_tags[i])
2027      if (m_floppy_drive_tags[i])
20282028      {
20292029         legacy_floppy_image_device *img = siblingdevice<legacy_floppy_image_device>(m_floppy_drive_tags[i]);
20302030
2031         if (img)
2031         if (img)
20322032         {
20332033            img->floppy_drive_set_controller(this);
20342034            img->floppy_drive_set_index_pulse_callback(wd17xx_index_pulse_callback);
trunk/src/emu/machine/ym2148.c
r31373r31374
124124   }
125125   if ((m_status & STATUS_TRANSMIT_READY) && (m_control & CONTROL_TRANSMIT_IRQ_ENABLE))
126126   {
127//      m_irq_state = ASSERT_LINE;
127//      m_irq_state = ASSERT_LINE;
128128   }
129129
130130   m_irq_handler(m_irq_state);
r31373r31374
205205{
206206   m_rxd = state;
207207}
208
trunk/src/emu/machine/z80ctc.c
r31373r31374
137137   m_zc1_cb.resolve_safe();
138138   m_zc2_cb.resolve_safe();
139139   m_zc3_cb.resolve_safe();
140   
140
141141   // start each channel
142142   m_channel[0].start(this, 0);
143143   m_channel[1].start(this, 1);
r31373r31374
520520         m_device->m_zc3_cb(0);
521521         break;
522522   }
523   
523
524524   // reset the down counter
525525   m_down = m_tconst;
526526}
trunk/src/emu/machine/mb89363b.c
r31373r31374
1/*
1/*
22  (this acts as a trampoline to 2x i8255 chips)
33
44
r31373r31374
1212    Note: MB89363B is compatible with 8255
1313
1414    Pin Assignment:
15                                          +5v                                         
16                         P P P P P P P P P V   P P P P P P P P P                       
17                     N N 5 4 4 4 4 4 4 4 4 C N 1 1 1 1 1 1 1 1 2 N N                   
18                     C C 3 0 1 2 3 4 5 6 7 C C 7 6 5 4 3 2 1 0 3 C C                   
19                                                                                       
20                     | | ^ ^ ^ ^ ^ ^ ^ ^ ^ | | ^ ^ ^ ^ ^ ^ ^ ^ ^ | |                   
21                     | | | | | | | | | | | | | | | | | | | | | | | |                   
22                     | | v v v v v v v v v | | v v v v v v v v v | |                   
23                .-------------------------------------------------------.             
24                |    6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4    |             
25                |    4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1    |             
26      P52   <-> | 65                                                 40 | <->    P22   
27      P51   <-> | 66                                                 39 | <->    P21   
28      P50   <-> | 67                                                 38 | <->    P20   
29      P54   <-> | 68                                                 37 | <->    P24   
30      P55   <-> | 69                                                 36 | <->    P25   
31      P56   <-> | 70                                                 35 | <->    P26   
32      P57   <-> | 71                                                 34 | <->    P27   
33       NC   --- | 72                   MB89363B                      33 | ---    NC   
15                                          +5v
16                         P P P P P P P P P V   P P P P P P P P P
17                     N N 5 4 4 4 4 4 4 4 4 C N 1 1 1 1 1 1 1 1 2 N N
18                     C C 3 0 1 2 3 4 5 6 7 C C 7 6 5 4 3 2 1 0 3 C C
19
20                     | | ^ ^ ^ ^ ^ ^ ^ ^ ^ | | ^ ^ ^ ^ ^ ^ ^ ^ ^ | |
21                     | | | | | | | | | | | | | | | | | | | | | | | |
22                     | | v v v v v v v v v | | v v v v v v v v v | |
23                .-------------------------------------------------------.
24                |    6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4    |
25                |    4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1    |
26      P52   <-> | 65                                                 40 | <->    P22
27      P51   <-> | 66                                                 39 | <->    P21
28      P50   <-> | 67                                                 38 | <->    P20
29      P54   <-> | 68                                                 37 | <->    P24
30      P55   <-> | 69                                                 36 | <->    P25
31      P56   <-> | 70                                                 35 | <->    P26
32      P57   <-> | 71                                                 34 | <->    P27
33       NC   --- | 72                   MB89363B                      33 | ---    NC
3434       NC   --- | 73                                                 32 | <--    RSLCT1
3535      GND   --> | 74                                                 31 | <--    RSLCT0
36      CS2   --> | 75                                                 30 | <--    GND   
37        R   --> | 76                                                 29 | <--    CS1   
38      P30   <-> | 77                                                 28 | <->    P00   
39      P31   <-> | 78                                                 27 | <->    P01   
40      P32   <-> | 79                                                 26 | <->    P02   
41      P33   <-> | 80                                                 25 | <->    P03   
42                 \                     1 1 1 1 1 1 1 1 1 1 2 2 2 2 2    |             
43                  \  1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4    |             
44                   -----------------------------------------------------'             
45                     ^ ^ ^ ^ ^ ^ | | ^ | ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ |                   
46                     | | | | | | | | | | | | | | | | | | | | | | | |                   
47                     v v v v | | | | | | | v v v v v v v v v v v v |                   
48                                                                                       
49                     P P P P W R N N R N O D D D D D D D D P P P P N                   
50                     3 3 3 3   S C C H C U B B B B B B B B 0 0 0 0 C                   
51                     4 5 6 7   T     /   S 0 1 2 3 4 5 6 7 7 6 5 4                     
52                                     R   /                                             
53                                     L   I                                             
54                                         N                                             
55                                         S                                             
36      CS2   --> | 75                                                 30 | <--    GND
37        R   --> | 76                                                 29 | <--    CS1
38      P30   <-> | 77                                                 28 | <->    P00
39      P31   <-> | 78                                                 27 | <->    P01
40      P32   <-> | 79                                                 26 | <->    P02
41      P33   <-> | 80                                                 25 | <->    P03
42                 \                     1 1 1 1 1 1 1 1 1 1 2 2 2 2 2    |
43                  \  1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4    |
44                   -----------------------------------------------------'
45                     ^ ^ ^ ^ ^ ^ | | ^ | ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ |
46                     | | | | | | | | | | | | | | | | | | | | | | | |
47                     v v v v | | | | | | | v v v v v v v v v v v v |
5648
49                     P P P P W R N N R N O D D D D D D D D P P P P N
50                     3 3 3 3   S C C H C U B B B B B B B B 0 0 0 0 C
51                     4 5 6 7   T     /   S 0 1 2 3 4 5 6 7 7 6 5 4
52                                     R   /
53                                     L   I
54                                         N
55                                         S
56
5757    Block Diagram / Pin Descriptions:
5858    http://www.mess.org/_media/datasheets/fujitsu/mb89363b_partial.pdf
5959
trunk/src/emu/machine/atahle.c
r31373r31374
708708            case IDE_CS1_ACTIVE_STATUS:
709709               /*
710710
711                  bit    description
711                   bit     description
712712
713                  0       master active
714                  1       slave active
715                  2       complement of active disk head bit 0
716                  3       complement of active disk head bit 1
717                  4       complement of active disk head bit 2
718                  5       complement of active disk head bit 3
719                  6       write in progress
720                  7       floppy present (unused)
713                   0       master active
714                   1       slave active
715                   2       complement of active disk head bit 0
716                   3       complement of active disk head bit 1
717                   4       complement of active disk head bit 2
718                   5       complement of active disk head bit 3
719                   6       write in progress
720                   7       floppy present (unused)
721721
722722               */
723723               if (device_selected())
trunk/src/emu/machine/eepromser.c
r31373r31374
763763eeprom_serial_x24c44_device::eeprom_serial_x24c44_device(const machine_config &mconfig, device_type devtype, const char *name, const char *tag, device_t *owner, const char *shortname, const char *file)
764764   : eeprom_serial_base_device(mconfig, devtype, name, tag, owner, shortname, file)
765765{
766
767766}
768767
769768
r31373r31374
785784   m_ram_length=0xf;
786785
787786   for (i=0;i<16;i++){
788      m_ram_data[i]=read(i);   //autoreload at power up
787      m_ram_data[i]=read(i);  //autoreload at power up
789788   }
790789   m_reading=0;
791790   m_store_latch=0;
r31373r31374
828827   }else{
829828      LOG0(("Store command with store latch not set!\n"));
830829   }
831   
830
832831}
833832
834833//-------------------------------------------------
r31373r31374
902901         copy_ram_to_eeprom();
903902         set_state(STATE_IN_RESET);
904903         break;
905         
904
906905      default:
907906         throw emu_fatalerror("execute_command called with invalid command %d\n", m_command);
908907   }
r31373r31374
959958         {
960959            // if we have enough bits for a command + address, check it out
961960            m_command_address_accum = (m_command_address_accum << 1) | m_di_state;
962   
961
963962            m_bits_accum=m_bits_accum+1;
964           
963
965964            if (m_bits_accum == 2 + m_command_address_bits){
966965               //read command is only 2 bits all other are 3 bits!!!
967966
968967                  parse_command_and_address_2_bit();
969968
970969            }
971           
970
972971            if (!m_reading){
973972            if (m_bits_accum == 3 + m_command_address_bits){
974973               execute_command();
r31373r31374
983982      case STATE_READING_DATA:
984983         if (event == EVENT_CLK_RISING_EDGE)
985984         {
986         
987985            int bit_index = m_bits_accum++;
988986
989987            if (bit_index % m_data_bits == 0 && (bit_index == 0 || m_streaming_enabled)){
990
991988               m_shift_register=m_ram_data[m_address];
992               
989
993990               //m_shift_register=BITSWAP16(m_shift_register,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
994991               //m_shift_register=BITSWAP16(m_shift_register,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8);
995992               m_shift_register= BITSWAP16(m_shift_register,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
996993
997994               m_shift_register=m_shift_register<<16;
998               
995
999996               LOG1(("read from RAM addr %02X data(from ram) %04X ,m_shift_register vale %04X \n",m_address,m_ram_data[m_address],m_shift_register));
1000997               }
1001998            else{
1002           
1003999               m_shift_register = (m_shift_register << 1) | 1;
10041000
10051001            }
r31373r31374
10231019      case STATE_WAIT_FOR_DATA:
10241020         if (event == EVENT_CLK_RISING_EDGE)
10251021         {
1026           
10271022            m_shift_register = (m_shift_register << 1) | m_di_state;
10281023            if (++m_bits_accum == m_data_bits){
1029                       
10301024            //m_shift_register=BITSWAP16(m_shift_register, 0, 1, 2, 3, 4, 5,6,7, 8, 9,10,11,12,13,14,15);
10311025            //m_shift_register=BITSWAP16(m_shift_register, 7, 6, 5, 4, 3, 2,1,0,15,14,13,12,11,10, 9, 8);
10321026            m_shift_register=BITSWAP16(m_shift_register,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
r31373r31374
10421036         }
10431037         break;
10441038
1045         
1039
10461040      // CS is asserted; waiting for completion; watch for CS falling
10471041      case STATE_WAIT_FOR_COMPLETION:
10481042         if (event == EVENT_CS_FALLING_EDGE)
r31373r31374
10591053
10601054void eeprom_serial_x24c44_device::parse_command_and_address()
10611055{
1062
10631056   //command is start_bit - 4bit_address - 3bit_command
10641057
10651058   // set the defaults
r31373r31374
10681061   m_address = (m_command_address_accum >> 3) & 0x0f;
10691062
10701063   LOG1(("EEPROM: command= %04X, address %02X\n", m_command_address_accum& 0x07, m_address));
1071   
1064
10721065   switch (m_command_address_accum & 0x07)
10731066   {
1074      case 0:   //reset write enable latch
1067      case 0: //reset write enable latch
10751068            LOG0(("Lock eeprom\n"));
1076            m_command = COMMAND_LOCK;   break;
1069            m_command = COMMAND_LOCK;   break;
10771070      case 3: //write data into ram
10781071            LOG0(("Write to ram\n"));
1079            m_command = COMMAND_WRITE;   break;
1072            m_command = COMMAND_WRITE;  break;
10801073      case 4: //set write enable latch
10811074            LOG0(("Unlock eeprom\n"));
1082            m_command = COMMAND_UNLOCK;   break;
1075            m_command = COMMAND_UNLOCK; break;
10831076      case 1: //store ram data in eeprom
10841077            LOG0(("copy ram to eeprom\n"));
10851078            m_command = COMMAND_COPY_RAM_TO_EEPROM;   break;
10861079      case 5: //reload eeprom data into ram
10871080            LOG0(("copy eeprom to ram\n"));
1088            m_command = COMMAND_COPY_EEPROM_TO_RAM;   break;
1081            m_command = COMMAND_COPY_EEPROM_TO_RAM; break;
10891082      case 2: //reserved (Sleep on x2444)
10901083         m_command = COMMAND_INVALID;
1091            break;           
1084            break;
10921085
10931086   }
10941087
r31373r31374
10961089
10971090void eeprom_serial_x24c44_device::parse_command_and_address_2_bit()
10981091{
1099
1100   
11011092   if ((m_command_address_accum & 0x03) == 0x03){
1102     
11031093      m_command = COMMAND_READ;
11041094      m_address = ((m_command_address_accum >> 2) & 0x0f);
11051095      m_shift_register = 0;
r31373r31374
11081098      m_reading=1;
11091099      m_bits_accum=0;
11101100   }
1111   
1101
11121102   // warn about out-of-range addresses
11131103   if (m_address >= (1 << m_address_bits))
11141104      LOG1(("EEPROM: out-of-range address 0x%X provided (maximum should be 0x%X)\n", m_address, (1 << m_address_bits) - 1));
trunk/src/emu/machine/68307.c
r31373r31374
1515READ8_MEMBER( m68307cpu_device::m68307_internal_serial_r )
1616{
1717   m68307cpu_device *m68k = this;
18   
18
1919   if (offset&1) return m_duart->read(*m68k->program, offset>>1);
2020   return 0x0000;
2121}
trunk/src/emu/netlist/devices/nld_legacy.c
r31373r31374
2222
2323NETLIB_UPDATE(nicRSFF)
2424{
25    if (!INPLOGIC(m_S))
26    {
27        OUTLOGIC(m_Q,  1, NLTIME_FROM_NS(20));
28        OUTLOGIC(m_QQ, 0, NLTIME_FROM_NS(20));
29    }
30    else if (!INPLOGIC(m_R))
25   if (!INPLOGIC(m_S))
3126   {
27      OUTLOGIC(m_Q,  1, NLTIME_FROM_NS(20));
28      OUTLOGIC(m_QQ, 0, NLTIME_FROM_NS(20));
29   }
30   else if (!INPLOGIC(m_R))
31   {
3232      OUTLOGIC(m_Q,  0, NLTIME_FROM_NS(20));
3333      OUTLOGIC(m_QQ, 1, NLTIME_FROM_NS(20));
3434   }
trunk/src/emu/netlist/devices/net_lib.c
r31373r31374
8989   ENTRY(D,                    DIODE,                  "model")
9090   ENTRY(VCVS,                 VCVS,                   "-")        // FIXME: STD parameters ?
9191   ENTRY(VCCS,                 VCCS,                   "-")
92    ENTRY(CCCS,                 CCCS,                   "-")
93    ENTRY(dummy_input,          DUMMY_INPUT,            "-")
92   ENTRY(CCCS,                 CCCS,                   "-")
93   ENTRY(dummy_input,          DUMMY_INPUT,            "-")
9494   ENTRY(QBJT_EB,              QBJT_EB,                "model")
9595   ENTRY(QBJT_switch,          QBJT_SW,                "model")
9696   ENTRY(ttl_input,            TTL_INPUT,              "IN")
r31373r31374
103103   ENTRY(gnd,                  GND,                    "-")
104104   ENTRY(switch2,              SWITCH2,                "-")
105105   ENTRY(nicRSFF,              NETDEV_RSFF,            "+S,R")
106    ENTRY(4020,                 CD_4020,                "+IP,RESET,VDD,VSS")
107    //ENTRY(4066,                 CD_4066,                "+A,B")
106   ENTRY(4020,                 CD_4020,                "+IP,RESET,VDD,VSS")
107   //ENTRY(4066,                 CD_4066,                "+A,B")
108108   ENTRY(7400,                 TTL_7400_NAND,          "+A,B")
109109   ENTRY(7402,                 TTL_7402_NOR,           "+A,B")
110110   ENTRY(7404,                 TTL_7404_INVERT,        "+A")
111    ENTRY(7408,                 TTL_7408_AND,           "+A,B")
111   ENTRY(7408,                 TTL_7408_AND,           "+A,B")
112112   ENTRY(7410,                 TTL_7410_NAND,          "+A,B,C")
113    ENTRY(7411,                 TTL_7411_AND,           "+A,B,C")
113   ENTRY(7411,                 TTL_7411_AND,           "+A,B,C")
114114   ENTRY(7420,                 TTL_7420_NAND,          "+A,B,C,D")
115115   ENTRY(7425,                 TTL_7425_NOR,           "+A,B,C,D")
116116   ENTRY(7427,                 TTL_7427_NOR,           "+A,B,C")
117117   ENTRY(7430,                 TTL_7430_NAND,          "+A,B,C,D,E,F,G,H")
118    ENTRY(7432,                 TTL_7432_OR,            "+A,B")
119    ENTRY(7437,                 TTL_7437_NAND,          "+A,B")
118   ENTRY(7432,                 TTL_7432_OR,            "+A,B")
119   ENTRY(7437,                 TTL_7437_NAND,          "+A,B")
120120   ENTRY(7450,                 TTL_7450_ANDORINVERT,   "+A,B,C,D")
121121   ENTRY(7486,                 TTL_7486_XOR,           "+A,B")
122122   ENTRY(7448,                 TTL_7448,               "+A,B,C,D,LTQ,BIQ,RBIQ")
r31373r31374
126126   ENTRY(7493,                 TTL_7493,               "+CLKA,CLKB,R1,R2")
127127   ENTRY(74107,                TTL_74107,              "+CLK,J,K,CLRQ")
128128   ENTRY(74107A,               TTL_74107A,             "+CLK,J,K,CLRQ")
129    ENTRY(74123,                TTL_74123,              "-")
129   ENTRY(74123,                TTL_74123,              "-")
130130   ENTRY(74153,                TTL_74153,              "+C0,C1,C2,C3,A,B,G")
131131   ENTRY(SN74LS629,            SN74LS629,              "CAP")
132132   ENTRY(9316,                 TTL_9316,               "+CLK,ENP,ENT,CLRQ,LOADQ,A,B,C,D")
133133   ENTRY(NE555,                NE555,                  "-")
134    ENTRY(r2r_dac,              R2R_DAC,                "+VIN,R,N")
134   ENTRY(r2r_dac,              R2R_DAC,                "+VIN,R,N")
135135   ENTRY(4020_dip,             CD_4020_DIP,            "-")
136    ENTRY(4066_dip,             CD_4066_DIP,            "-")
136   ENTRY(4066_dip,             CD_4066_DIP,            "-")
137137   ENTRY(7400_dip,             TTL_7400_DIP,           "-")
138138   ENTRY(7402_dip,             TTL_7402_DIP,           "-")
139139   ENTRY(7404_dip,             TTL_7404_DIP,           "-")
140    ENTRY(7408_dip,             TTL_7408_DIP,           "-")
140   ENTRY(7408_dip,             TTL_7408_DIP,           "-")
141141   ENTRY(7410_dip,             TTL_7410_DIP,           "-")
142    ENTRY(7411_dip,             TTL_7411_DIP,           "-")
142   ENTRY(7411_dip,             TTL_7411_DIP,           "-")
143143   ENTRY(7420_dip,             TTL_7420_DIP,           "-")
144144   ENTRY(7425_dip,             TTL_7425_DIP,           "-")
145145   ENTRY(7427_dip,             TTL_7427_DIP,           "-")
146146   ENTRY(7430_dip,             TTL_7430_DIP,           "-")
147    ENTRY(7432_dip,             TTL_7432_DIP,           "-")
148    ENTRY(7437_dip,             TTL_7437_DIP,           "-")
147   ENTRY(7432_dip,             TTL_7432_DIP,           "-")
148   ENTRY(7437_dip,             TTL_7437_DIP,           "-")
149149   ENTRY(7448_dip,             TTL_7448_DIP,           "-")
150150   ENTRY(7450_dip,             TTL_7450_DIP,           "-")
151151   ENTRY(7474_dip,             TTL_7474_DIP,           "-")
r31373r31374
154154   ENTRY(7490_dip,             TTL_7490_DIP,           "-")
155155   ENTRY(7493_dip,             TTL_7493_DIP,           "-")
156156   ENTRY(74107_dip,            TTL_74107_DIP,          "-")
157    ENTRY(74123_dip,            TTL_74123_DIP,          "-")
157   ENTRY(74123_dip,            TTL_74123_DIP,          "-")
158158   ENTRY(74153_dip,            TTL_74153_DIP,          "-")
159159   ENTRY(9316_dip,             TTL_9316_DIP,           "-")
160160   ENTRY(SN74LS629_dip,        SN74LS629_DIP,          "1.CAP1,2.CAP2")
trunk/src/emu/netlist/devices/nld_system.c
r31373r31374
8989
9090ATTR_COLD void nld_d_to_a_proxy::start()
9191{
92    nld_base_d_to_a_proxy::start();
92   nld_base_d_to_a_proxy::start();
9393
94    register_sub(m_RV, "RV");
95    register_terminal("1", m_RV.m_P);
96    register_terminal("2", m_RV.m_N);
94   register_sub(m_RV, "RV");
95   register_terminal("1", m_RV.m_P);
96   register_terminal("2", m_RV.m_N);
9797
98    register_output("_Q", m_Q);
99    register_subalias("Q", m_RV.m_P);
98   register_output("_Q", m_Q);
99   register_subalias("Q", m_RV.m_P);
100100
101    connect(m_RV.m_N, m_Q);
102    m_Q.initial(0.0);
101   connect(m_RV.m_N, m_Q);
102   m_Q.initial(0.0);
103103}
104104
105105ATTR_COLD void nld_d_to_a_proxy::reset()
106106{
107    m_RV.do_reset();
107   m_RV.do_reset();
108108}
109109
110110ATTR_COLD netlist_core_terminal_t &nld_d_to_a_proxy::out()
111111{
112    return m_RV.m_P;
112   return m_RV.m_P;
113113}
114114
115115ATTR_HOT ATTR_ALIGN void nld_d_to_a_proxy::update()
116116{
117    const int state = INPLOGIC(m_I);
118    if (state != m_last_state)
119    {
120        m_last_state = state;
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;
117   const int state = INPLOGIC(m_I);
118   if (state != m_last_state)
119   {
120      m_last_state = state;
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
124        // We only need to update the net first if this is a time stepping net
125        if (m_RV.m_P.net().as_analog().solver()->is_timestep())
126        {
127            m_RV.update_dev();
128            m_RV.set(1.0 / R, V, 0.0);
129            m_RV.m_P.schedule_after(NLTIME_FROM_NS(1));
130        }
131        else
132        {
133            m_RV.set(1.0 / R, V, 0.0);
134            m_RV.update_dev();
135        }
136    }
124      // We only need to update the net first if this is a time stepping net
125      if (m_RV.m_P.net().as_analog().solver()->is_timestep())
126      {
127         m_RV.update_dev();
128         m_RV.set(1.0 / R, V, 0.0);
129         m_RV.m_P.schedule_after(NLTIME_FROM_NS(1));
130      }
131      else
132      {
133         m_RV.set(1.0 / R, V, 0.0);
134         m_RV.update_dev();
135      }
136   }
137137}
trunk/src/emu/netlist/devices/nld_4020.c
r31373r31374
1010   register_sub(sub, "sub");
1111
1212   register_input("RESET", m_RESET);
13    register_subalias("IP", sub.m_IP);
14    register_subalias("Q1", sub.m_Q[0]);
15    register_subalias("Q4", sub.m_Q[3]);
16    register_subalias("Q5", sub.m_Q[4]);
17    register_subalias("Q6", sub.m_Q[5]);
18    register_subalias("Q7", sub.m_Q[6]);
19    register_subalias("Q8", sub.m_Q[7]);
20    register_subalias("Q9", sub.m_Q[8]);
21    register_subalias("Q10", sub.m_Q[9]);
22    register_subalias("Q11", sub.m_Q[10]);
23    register_subalias("Q12", sub.m_Q[11]);
24    register_subalias("Q13", sub.m_Q[12]);
25    register_subalias("Q14", sub.m_Q[13]);
26    register_subalias("VDD", m_supply.m_vdd);
27    register_subalias("VSS", m_supply.m_vss);
13   register_subalias("IP", sub.m_IP);
14   register_subalias("Q1", sub.m_Q[0]);
15   register_subalias("Q4", sub.m_Q[3]);
16   register_subalias("Q5", sub.m_Q[4]);
17   register_subalias("Q6", sub.m_Q[5]);
18   register_subalias("Q7", sub.m_Q[6]);
19   register_subalias("Q8", sub.m_Q[7]);
20   register_subalias("Q9", sub.m_Q[8]);
21   register_subalias("Q10", sub.m_Q[9]);
22   register_subalias("Q11", sub.m_Q[10]);
23   register_subalias("Q12", sub.m_Q[11]);
24   register_subalias("Q13", sub.m_Q[12]);
25   register_subalias("Q14", sub.m_Q[13]);
26   register_subalias("VDD", m_supply.m_vdd);
27   register_subalias("VSS", m_supply.m_vss);
2828}
2929
3030NETLIB_RESET(4020)
r31373r31374
3838   register_input("IP", m_IP);
3939
4040   register_output("Q1", m_Q[0]);
41    register_output("Q4", m_Q[3]);
42    register_output("Q5", m_Q[4]);
43    register_output("Q6", m_Q[5]);
44    register_output("Q7", m_Q[6]);
45    register_output("Q8", m_Q[8]);
46    register_output("Q9", m_Q[8]);
47    register_output("Q10", m_Q[9]);
48    register_output("Q11", m_Q[10]);
49    register_output("Q12", m_Q[11]);
50    register_output("Q13", m_Q[12]);
41   register_output("Q4", m_Q[3]);
42   register_output("Q5", m_Q[4]);
43   register_output("Q6", m_Q[5]);
44   register_output("Q7", m_Q[6]);
45   register_output("Q8", m_Q[8]);
46   register_output("Q9", m_Q[8]);
47   register_output("Q10", m_Q[9]);
48   register_output("Q11", m_Q[10]);
49   register_output("Q12", m_Q[11]);
50   register_output("Q13", m_Q[12]);
5151   register_output("Q14", m_Q[13]);
5252
5353   save(NAME(m_cnt));
r31373r31374
6262NETLIB_UPDATE(4020_sub)
6363{
6464   UINT8 cnt = m_cnt;
65    cnt = ( cnt + 1) & 0x3fff;
66    update_outputs(cnt);
65   cnt = ( cnt + 1) & 0x3fff;
66   update_outputs(cnt);
6767   m_cnt = cnt;
6868}
6969
7070NETLIB_UPDATE(4020)
7171{
72
73    if (INPLOGIC(m_RESET))
74    {
75        sub.m_cnt = 0;
76        sub.m_IP.inactivate();
77        static const netlist_time reset_time = netlist_time::from_nsec(140);
78        OUTLOGIC(sub.m_Q[0], 0, reset_time);
79        for (int i=3; i<14; i++)
80            OUTLOGIC(sub.m_Q[i], 0, reset_time);
81    }
82    else
83        sub.m_IP.activate_hl();
72   if (INPLOGIC(m_RESET))
73   {
74      sub.m_cnt = 0;
75      sub.m_IP.inactivate();
76      static const netlist_time reset_time = netlist_time::from_nsec(140);
77      OUTLOGIC(sub.m_Q[0], 0, reset_time);
78      for (int i=3; i<14; i++)
79         OUTLOGIC(sub.m_Q[i], 0, reset_time);
80   }
81   else
82      sub.m_IP.activate_hl();
8483}
8584
8685inline NETLIB_FUNC_VOID(4020_sub, update_outputs, (const UINT16 cnt))
8786{
88    static const netlist_time out_delayQn[14] = {
89            NLTIME_FROM_NS(180), NLTIME_FROM_NS(280),
90            NLTIME_FROM_NS(380), NLTIME_FROM_NS(480),
91            NLTIME_FROM_NS(580), NLTIME_FROM_NS(680),
92            NLTIME_FROM_NS(780), NLTIME_FROM_NS(880),
93            NLTIME_FROM_NS(980), NLTIME_FROM_NS(1080),
94            NLTIME_FROM_NS(1180), NLTIME_FROM_NS(1280),
95            NLTIME_FROM_NS(1380), NLTIME_FROM_NS(1480),
96    };
87   static const netlist_time out_delayQn[14] = {
88         NLTIME_FROM_NS(180), NLTIME_FROM_NS(280),
89         NLTIME_FROM_NS(380), NLTIME_FROM_NS(480),
90         NLTIME_FROM_NS(580), NLTIME_FROM_NS(680),
91         NLTIME_FROM_NS(780), NLTIME_FROM_NS(880),
92         NLTIME_FROM_NS(980), NLTIME_FROM_NS(1080),
93         NLTIME_FROM_NS(1180), NLTIME_FROM_NS(1280),
94         NLTIME_FROM_NS(1380), NLTIME_FROM_NS(1480),
95   };
9796
98    OUTLOGIC(m_Q[0], 0, out_delayQn[0]);
99    for (int i=3; i<14; i++)
100        OUTLOGIC(m_Q[i], (cnt >> i) & 1, out_delayQn[i]);
97   OUTLOGIC(m_Q[0], 0, out_delayQn[0]);
98   for (int i=3; i<14; i++)
99      OUTLOGIC(m_Q[i], (cnt >> i) & 1, out_delayQn[i]);
101100}
102101
103102NETLIB_START(4020_dip)
104103{
105104   NETLIB_NAME(4020)::start();
106105
107    /*          +--------------+
108    *      Q12 |1     ++    16| VDD
109    *      Q13 |2           15| Q11
110    *      Q14 |3           14| Q10
111    *       Q6 |4    4020   13| Q8
112    *       Q5 |5           12| Q9
113    *       Q7 |6           11| RESET
114    *       Q4 |7           10| IP (Input pulses)
115    *      VSS |8            9| Q1
116    *          +--------------+
117    */
106      /*          +--------------+
107      *      Q12 |1     ++    16| VDD
108      *      Q13 |2           15| Q11
109      *      Q14 |3           14| Q10
110      *       Q6 |4    4020   13| Q8
111      *       Q5 |5           12| Q9
112      *       Q7 |6           11| RESET
113      *       Q4 |7           10| IP (Input pulses)
114      *      VSS |8            9| Q1
115      *          +--------------+
116      */
118117
119118   register_subalias("1", sub.m_Q[11]);
120119   register_subalias("2", sub.m_Q[12]);
r31373r31374
123122   register_subalias("5", sub.m_Q[4]);
124123   register_subalias("6", sub.m_Q[6]);
125124   register_subalias("7", sub.m_Q[3]);
126    register_subalias("8", m_supply.m_vss);
125   register_subalias("8", m_supply.m_vss);
127126
128127   register_subalias("9", sub.m_Q[1]);
129128   register_subalias("10", sub.m_IP);
r31373r31374
132131   register_subalias("13", sub.m_Q[7]);
133132   register_subalias("14", sub.m_Q[9]);
134133   register_subalias("15", sub.m_Q[10]);
135    register_subalias("16", m_supply.m_vdd);
134   register_subalias("16", m_supply.m_vdd);
136135}
137136
138137NETLIB_UPDATE(4020_dip)
trunk/src/emu/netlist/devices/nld_7490.c
r31373r31374
2020   register_output("QD", m_Q[3]);
2121
2222   save(NAME(m_cnt));
23    save(NAME(m_last_A));
24    save(NAME(m_last_B));
23   save(NAME(m_last_A));
24   save(NAME(m_last_B));
2525
2626}
2727
r31373r31374
6161         m_cnt = 0;
6262      update_outputs();
6363   }
64    m_last_A = INPLOGIC(m_A);
65    m_last_B = INPLOGIC(m_B);
64   m_last_A = INPLOGIC(m_A);
65   m_last_B = INPLOGIC(m_B);
6666}
6767
6868NETLIB_FUNC_VOID(7490, update_outputs, (void))
trunk/src/emu/netlist/devices/nld_7400.c
r31373r31374
99nld_7400::truthtable_t nld_7400::m_ttbl;
1010
1111const char *nld_7400::m_desc[] = {
12        "A,B,PQ,PA,PB|Q",
13        "0,X,X,X,X|1|22",
14        "X,0,X,X,X|1|22",
15        "1,1,X,X,X|0|15",
16        ""
12      "A,B,PQ,PA,PB|Q",
13      "0,X,X,X,X|1|22",
14      "X,0,X,X,X|1|22",
15      "1,1,X,X,X|0|15",
16      ""
1717};
1818
1919#endif
trunk/src/emu/netlist/devices/nld_ne555.c
r31373r31374
8080
8181   if (!m_last_out && out)
8282   {
83       m_RDIS.update_dev();
84       // FIXME: Should be delayed by 100ns
83      m_RDIS.update_dev();
84      // FIXME: Should be delayed by 100ns
8585      OUTANALOG(m_OUT, TERMANALOG(m_R1.m_P));
8686      m_RDIS.set_R(R_OFF);
8787   }
8888   else if (m_last_out && !out)
8989   {
90        m_RDIS.update_dev();
90      m_RDIS.update_dev();
9191      OUTANALOG(m_OUT, TERMANALOG(m_R3.m_N));
9292      m_RDIS.set_R(R_ON);
9393   }
trunk/src/emu/netlist/devices/nld_74123.c
r31373r31374
1010
1111NETLIB_START(74123)
1212{
13   register_sub(m_RP, "RP");
14   register_sub(m_RN, "RN");
1315
14    register_sub(m_RP, "RP");
15    register_sub(m_RN, "RN");
16   register_input("A", m_A);
17   register_input("B", m_B);
18   register_input("CLRQ", m_CLRQ);
19   register_output("Q", m_Q);
20   register_output("QQ", m_QQ);
1621
17    register_input("A", m_A);
18    register_input("B", m_B);
19    register_input("CLRQ", m_CLRQ);
20    register_output("Q", m_Q);
21    register_output("QQ", m_QQ);
22   register_input("_CV", m_CV); // internal
2223
23    register_input("_CV", m_CV); // internal
24   register_subalias("GND", m_RN.m_N);
25   register_subalias("VCC", m_RP.m_P);
26   register_subalias("C",   m_RN.m_N);
27   register_subalias("RC",  m_RN.m_P);
2428
25    register_subalias("GND", m_RN.m_N);
26    register_subalias("VCC", m_RP.m_P);
27    register_subalias("C",   m_RN.m_N);
28    register_subalias("RC",  m_RN.m_P);
29   register_param("K", m_K, 0.4);
30   register_param("RI", m_RI, 400.0); // around 250 for HC series, 400 on LS/TTL, estimated from datasheets
2931
30    register_param("K", m_K, 0.4);
31    register_param("RI", m_RI, 400.0); // around 250 for HC series, 400 on LS/TTL, estimated from datasheets
32   connect(m_RN.m_P, m_RP.m_N);
33   connect(m_CV, m_RN.m_P);
3234
33    connect(m_RN.m_P, m_RP.m_N);
34    connect(m_CV, m_RN.m_P);
35   save(NAME(m_last_trig));
36   save(NAME(m_state));
37   save(NAME(m_KP));
3538
36    save(NAME(m_last_trig));
37    save(NAME(m_state));
38    save(NAME(m_KP));
39
40    m_KP = 1.0 / (1.0 + exp(m_K.Value()));
39   m_KP = 1.0 / (1.0 + exp(m_K.Value()));
4140}
4241
4342NETLIB_UPDATE(74123)
4443{
45    const netlist_sig_t m_trig = (INPLOGIC(m_A) ^ 1) & INPLOGIC(m_B) & INPLOGIC(m_CLRQ);
44   const netlist_sig_t m_trig = (INPLOGIC(m_A) ^ 1) & INPLOGIC(m_B) & INPLOGIC(m_CLRQ);
4645
47    if (!INPLOGIC(m_CLRQ))
48    {
49        OUTLOGIC(m_Q, 0, NLTIME_FROM_NS(10));
50        OUTLOGIC(m_QQ, 1, NLTIME_FROM_NS(10));
51        /* quick charge until trigger */
52        /* FIXME: SGS datasheet shows quick charge to 5V,
53         * though schematics indicate quick charge to Vhigh only.
54         */
55        m_RP.set_R(R_ON);
56        m_RN.set_R(R_OFF);
57        m_state = 2; //charging (quick)
58    }
59    else if (!m_last_trig && m_trig)
60    {
61        // FIXME: Timing!
62        OUTLOGIC(m_Q, 1, NLTIME_FROM_NS(10));
63        OUTLOGIC(m_QQ, 0, NLTIME_FROM_NS(10));
64        m_RN.set_R(R_ON);
65        m_RP.set_R(R_OFF);
66        m_state = 1; // discharging
67    }
46   if (!INPLOGIC(m_CLRQ))
47   {
48      OUTLOGIC(m_Q, 0, NLTIME_FROM_NS(10));
49      OUTLOGIC(m_QQ, 1, NLTIME_FROM_NS(10));
50      /* quick charge until trigger */
51      /* FIXME: SGS datasheet shows quick charge to 5V,
52       * though schematics indicate quick charge to Vhigh only.
53       */
54      m_RP.set_R(R_ON);
55      m_RN.set_R(R_OFF);
56      m_state = 2; //charging (quick)
57   }
58   else if (!m_last_trig && m_trig)
59   {
60      // FIXME: Timing!
61      OUTLOGIC(m_Q, 1, NLTIME_FROM_NS(10));
62      OUTLOGIC(m_QQ, 0, NLTIME_FROM_NS(10));
63      m_RN.set_R(R_ON);
64      m_RP.set_R(R_OFF);
65      m_state = 1; // discharging
66   }
6867
69    m_last_trig = m_trig;
68   m_last_trig = m_trig;
7069
71    if (m_state == 1)
72    {
73        const double vLow = m_KP * TERMANALOG(m_RP.m_P);
74        if (INPANALOG(m_CV) < vLow)
75        {
76            m_RN.set_R(R_OFF);
77            m_state = 2; // charging
78        }
79    }
80    else if (m_state == 2)
81    {
82        const double vHigh = TERMANALOG(m_RP.m_P) * (1.0 - m_KP);
83        if (INPANALOG(m_CV) > vHigh)
84        {
85            m_RP.set_R(R_OFF);
86            OUTLOGIC(m_Q, 0, NLTIME_FROM_NS(10));
87            OUTLOGIC(m_QQ, 1, NLTIME_FROM_NS(10));
88            m_state = 0; // waiting
89        }
90    }
70   if (m_state == 1)
71   {
72      const double vLow = m_KP * TERMANALOG(m_RP.m_P);
73      if (INPANALOG(m_CV) < vLow)
74      {
75         m_RN.set_R(R_OFF);
76         m_state = 2; // charging
77      }
78   }
79   else if (m_state == 2)
80   {
81      const double vHigh = TERMANALOG(m_RP.m_P) * (1.0 - m_KP);
82      if (INPANALOG(m_CV) > vHigh)
83      {
84         m_RP.set_R(R_OFF);
85         OUTLOGIC(m_Q, 0, NLTIME_FROM_NS(10));
86         OUTLOGIC(m_QQ, 1, NLTIME_FROM_NS(10));
87         m_state = 0; // waiting
88      }
89   }
9190}
9291
9392NETLIB_RESET(74123)
9493{
95    m_RP.do_reset();
96    m_RN.do_reset();
94   m_RP.do_reset();
95   m_RN.do_reset();
9796
98    m_RP.set_R(R_OFF);
99    m_RN.set_R(R_OFF);
97   m_RP.set_R(R_OFF);
98   m_RN.set_R(R_OFF);
10099
101    m_last_trig = 0;
102    m_state = 0;
103    m_QQ.initial(1);
100   m_last_trig = 0;
101   m_state = 0;
102   m_QQ.initial(1);
104103}
105104
106105NETLIB_START(74123_dip)
trunk/src/emu/netlist/devices/nld_74ls629.c
r31373r31374
5151
5252   save(NAME(m_enableq));
5353   save(NAME(m_inc));
54    save(NAME(m_out));
54   save(NAME(m_out));
5555}
5656
5757NETLIB_RESET(SN74LS629clk)
r31373r31374
6565{
6666   if (!m_enableq)
6767   {
68       m_out = m_out ^ 1;
68      m_out = m_out ^ 1;
6969      OUTLOGIC(m_Y, m_out, m_inc);
7070   }
7171   else
r31373r31374
103103NETLIB_UPDATE(SN74LS629)
104104{
105105   {
106       // recompute
106      // recompute
107107      double  freq;
108108      double  v_freq_2, v_freq_3, v_freq_4;
109109      double  v_freq = INPANALOG(m_FC);
trunk/src/emu/netlist/devices/nld_9316.c
r31373r31374
4848
4949NETLIB_RESET(9316_subABCD)
5050{
51    m_A.inactivate();
52    m_B.inactivate();
53    m_C.inactivate();
54    m_D.inactivate();
51   m_A.inactivate();
52   m_B.inactivate();
53   m_C.inactivate();
54   m_D.inactivate();
5555}
5656
5757ATTR_HOT inline UINT8 NETLIB_NAME(9316_subABCD::read_ABCD)()
5858{
59    return (INPLOGIC_PASSIVE(m_D) << 3) | (INPLOGIC_PASSIVE(m_C) << 2) | (INPLOGIC_PASSIVE(m_B) << 1) | (INPLOGIC_PASSIVE(m_A) << 0);
59   return (INPLOGIC_PASSIVE(m_D) << 3) | (INPLOGIC_PASSIVE(m_C) << 2) | (INPLOGIC_PASSIVE(m_B) << 1) | (INPLOGIC_PASSIVE(m_A) << 0);
6060}
6161
6262NETLIB_UPDATE(9316_subABCD)
trunk/src/emu/netlist/devices/nld_7474.c
r31373r31374
77
88ATTR_HOT inline void NETLIB_NAME(7474sub)::newstate(const UINT8 stateQ, const UINT8 stateQQ)
99{
10    // 0: High-to-low 40 ns, 1: Low-to-high 25 ns
10   // 0: High-to-low 40 ns, 1: Low-to-high 25 ns
1111   static const netlist_time delay[2] = { NLTIME_FROM_NS(40), NLTIME_FROM_NS(25) };
1212   OUTLOGIC(m_Q, stateQ, delay[stateQ]);
1313   OUTLOGIC(m_QQ, stateQQ, delay[stateQQ]);
r31373r31374
2525NETLIB_UPDATE(7474)
2626{
2727   if (INPLOGIC(m_PREQ) && INPLOGIC(m_CLRQ))
28    {
29        m_D.activate();
30        sub.m_nextD = INPLOGIC(m_D);
31        sub.m_CLK.activate_lh();
32    }
28   {
29      m_D.activate();
30      sub.m_nextD = INPLOGIC(m_D);
31      sub.m_CLK.activate_lh();
32   }
3333   else if (!INPLOGIC(m_PREQ))
3434   {
3535      sub.newstate(1, 0);
r31373r31374
4343      m_D.inactivate();
4444   }
4545   else
46    {
47        sub.newstate(1, 1);
48        sub.m_CLK.inactivate();
49        m_D.inactivate();
50    }
46   {
47      sub.newstate(1, 1);
48      sub.m_CLK.inactivate();
49      m_D.inactivate();
50   }
5151}
5252
5353NETLIB_START(7474)
trunk/src/emu/netlist/devices/nld_r2r_dac.c
r31373r31374
77
88NETLIB_START(r2r_dac)
99{
10    NETLIB_NAME(twoterm)::start();
11    register_terminal("VOUT", m_P);
12    register_terminal("VGND", m_N);
13    register_param("R", m_R, 1.0);
14    register_param("VIN", m_VIN, 1.0);
15    register_param("N", m_num, 1);
16    register_param("VAL", m_val, 1);
10   NETLIB_NAME(twoterm)::start();
11   register_terminal("VOUT", m_P);
12   register_terminal("VGND", m_N);
13   register_param("R", m_R, 1.0);
14   register_param("VIN", m_VIN, 1.0);
15   register_param("N", m_num, 1);
16   register_param("VAL", m_val, 1);
1717}
1818
1919NETLIB_RESET(r2r_dac)
2020{
21    NETLIB_NAME(twoterm)::reset();
21   NETLIB_NAME(twoterm)::reset();
2222}
2323
2424NETLIB_UPDATE(r2r_dac)
2525{
26    NETLIB_NAME(twoterm)::update();
26   NETLIB_NAME(twoterm)::update();
2727}
2828
2929NETLIB_UPDATE_PARAM(r2r_dac)
3030{
31    //printf("updating %s to %f\n", name().cstr(), m_R.Value());
31   //printf("updating %s to %f\n", name().cstr(), m_R.Value());
3232
33    update_dev();
33   update_dev();
3434
35    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
37    this->set(1.0 / m_R.Value(), V, 0.0);
37   this->set(1.0 / m_R.Value(), V, 0.0);
3838}
39
trunk/src/emu/netlist/nl_base.c
r31373r31374
2424//FIXME: set to proper values
2525netlist_logic_family_desc_t netlist_family_CD4000 =
2626{
27        0.8, // m_low_thresh_V
28        2.0, // m_high_thresh_V
29        0.3, // m_low_V  - these depend on sinked/sourced current. Values should be suitable for typical applications.
30        3.7, // m_high_V
31        1.0, // m_R_low;
32        130.0, //  m_R_high;
27      0.8, // m_low_thresh_V
28      2.0, // m_high_thresh_V
29      0.3, // m_low_V  - these depend on sinked/sourced current. Values should be suitable for typical applications.
30      3.7, // m_high_V
31      1.0, // m_R_low;
32      130.0, //  m_R_high;
3333};
3434
3535// ----------------------------------------------------------------------------------------
r31373r31374
4242   , pstate_callback_t()
4343   , m_qsize(0)
4444{
45    this->init_object(nl, "QUEUE");
45   this->init_object(nl, "QUEUE");
4646}
4747
4848void netlist_queue_t::register_state(pstate_manager_t &manager, const pstring &module)
r31373r31374
187187      m_solver->start_dev();
188188
189189   NL_VERBOSE_OUT(("Initializing devices ...\n"));
190    for (netlist_device_t * const * entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
191    {
190   for (netlist_device_t * const * entry = m_devices.first(); entry != NULL; entry = m_devices.next(entry))
191   {
192192      netlist_device_t *dev = *entry;
193193      if (dev != m_solver)
194194         dev->start_dev();
r31373r31374
229229   // Reset all devices once !
230230   for (int i = 0; i < m_devices.count(); i++)
231231   {
232       m_devices[i]->do_reset();
232      m_devices[i]->do_reset();
233233   }
234234
235235   // Step all devices once !
236    for (int i = 0; i < m_devices.count(); i++)
237    {
238        m_devices[i]->update_dev();
236   for (int i = 0; i < m_devices.count(); i++)
237   {
238      m_devices[i]->update_dev();
239239   }
240240
241241   // FIXME: some const devices rely on this
242242   /* make sure params are set now .. */
243    for (int i = 0; i < m_devices.count(); i++)
244    {
245        m_devices[i]->update_param();
243   for (int i = 0; i < m_devices.count(); i++)
244   {
245      m_devices[i]->update_param();
246246   }
247247}
248248
r31373r31374
463463
464464ATTR_COLD netlist_net_t::netlist_net_t(const family_t afamily)
465465   : netlist_object_t(NET, afamily)
466    , m_new_Q(0)
467    , m_cur_Q (0)
468    , m_railterminal(NULL)
466   , m_new_Q(0)
467   , m_cur_Q (0)
468   , m_railterminal(NULL)
469469   , m_time(netlist_time::zero)
470470   , m_active(0)
471471   , m_in_queue(2)
472    , m_cur_Analog(0.0)
472   , m_cur_Analog(0.0)
473473{
474474};
475475
476476ATTR_COLD netlist_net_t::~netlist_net_t()
477477{
478    if (isInitialized())
479        netlist().remove_save_items(this);
478   if (isInitialized())
479      netlist().remove_save_items(this);
480480}
481481
482482ATTR_COLD void netlist_net_t::init_object(netlist_base_t &nl, const pstring &aname)
r31373r31374
548548   save(NAME(m_time));
549549   save(NAME(m_active));
550550   save(NAME(m_in_queue));
551    save(NAME(m_cur_Analog));
552    save(NAME(m_cur_Q));
553    save(NAME(m_new_Q));
551   save(NAME(m_cur_Analog));
552   save(NAME(m_cur_Q));
553   save(NAME(m_new_Q));
554554   netlist_object_t::save_register();
555555}
556556
557557ATTR_HOT ATTR_ALIGN static inline void update_dev(const netlist_core_terminal_t *inp, const UINT32 mask)
558558{
559    if ((inp->state() & mask) != 0)
560    {
561        netlist_core_device_t &netdev = inp->netdev();
562        begin_timing(netdev.total_time);
563        inc_stat(netdev.stat_count);
564        netdev.update_dev();
565        end_timing(netdev().total_time);
566    }
559   if ((inp->state() & mask) != 0)
560   {
561      netlist_core_device_t &netdev = inp->netdev();
562      begin_timing(netdev.total_time);
563      inc_stat(netdev.stat_count);
564      netdev.update_dev();
565      end_timing(netdev().total_time);
566   }
567567}
568568
569569ATTR_HOT ATTR_ALIGN inline void netlist_net_t::update_devs()
r31373r31374
572572   assert(this->isRailNet());
573573
574574   const UINT32 masks[4] = { 1, 5, 3, 1 };
575    const UINT32 mask = masks[ (m_cur_Q  << 1) | m_new_Q ];
575   const UINT32 mask = masks[ (m_cur_Q  << 1) | m_new_Q ];
576576   netlist_core_terminal_t *p = m_list_active.first();
577577
578578   m_in_queue = 2; /* mark as taken ... */
579579   m_cur_Q = m_new_Q;
580580
581581   switch (m_active)
582    {
583    case 2:
584        update_dev(p, mask);
585        p = m_list_active.next(p);
586        if (p == NULL) break;
587    case 1:
588        update_dev(p, mask);
589        break;
590    default:
591        while (p != NULL)
592        {
593            update_dev(p, mask);
594            p = m_list_active.next(p);
595        }
596        break;
597    }
582   {
583   case 2:
584      update_dev(p, mask);
585      p = m_list_active.next(p);
586      if (p == NULL) break;
587   case 1:
588      update_dev(p, mask);
589      break;
590   default:
591      while (p != NULL)
592      {
593         update_dev(p, mask);
594         p = m_list_active.next(p);
595      }
596      break;
597   }
598598
599599}
600600
r31373r31374
604604   m_active = 0;
605605   m_in_queue = 2;
606606
607    m_new_Q = 0;
608    m_cur_Q = 0;
609    m_cur_Analog = 0.0;
607   m_new_Q = 0;
608   m_cur_Q = 0;
609   m_cur_Analog = 0.0;
610610
611611   /* rebuild m_list */
612612
r31373r31374
614614   for (int i=0; i < m_core_terms.count(); i++)
615615      m_list_active.add(*m_core_terms[i]);
616616
617    for (int i=0; i < m_core_terms.count(); i++)
618        m_core_terms[i]->do_reset();
617   for (int i=0; i < m_core_terms.count(); i++)
618      m_core_terms[i]->do_reset();
619619
620    for (int i=0; i < m_core_terms.count(); i++)
621        if (m_core_terms[i]->state() != netlist_input_t::STATE_INP_PASSIVE)
622            m_active++;
620   for (int i=0; i < m_core_terms.count(); i++)
621      if (m_core_terms[i]->state() != netlist_input_t::STATE_INP_PASSIVE)
622         m_active++;
623623}
624624
625625ATTR_COLD void netlist_net_t::register_con(netlist_core_terminal_t &terminal)
r31373r31374
634634
635635ATTR_COLD void netlist_net_t::move_connections(netlist_net_t *dest_net)
636636{
637    for (int i = 0; i < m_core_terms.count(); i++)
638    {
639        netlist_core_terminal_t *p = m_core_terms[i];
640        dest_net->register_con(*p);
641    }
642    m_core_terms.clear(); // FIXME: othernet needs to be free'd from memory
637   for (int i = 0; i < m_core_terms.count(); i++)
638   {
639      netlist_core_terminal_t *p = m_core_terms[i];
640      dest_net->register_con(*p);
641   }
642   m_core_terms.clear(); // FIXME: othernet needs to be free'd from memory
643643}
644644
645645ATTR_COLD void netlist_net_t::merge_net(netlist_net_t *othernet)
r31373r31374
648648   if (othernet == NULL)
649649      return; // Nothing to do
650650
651    if (othernet == this)
652    {
653        netlist().warning("Connecting %s to itself. This may be right, though\n", this->name().cstr());
654        return; // Nothing to do
655    }
651   if (othernet == this)
652   {
653      netlist().warning("Connecting %s to itself. This may be right, though\n", this->name().cstr());
654      return; // Nothing to do
655   }
656656
657657   if (this->isRailNet() && othernet->isRailNet())
658658      netlist().error("Trying to merge two rail nets: %s and %s\n", this->name().cstr(), othernet->name().cstr());
r31373r31374
664664   }
665665   else
666666   {
667       othernet->move_connections(this);
667      othernet->move_connections(this);
668668   }
669669}
670670
r31373r31374
673673// ----------------------------------------------------------------------------------------
674674
675675ATTR_COLD netlist_logic_net_t::netlist_logic_net_t()
676    : netlist_net_t(LOGIC)
676   : netlist_net_t(LOGIC)
677677{
678678};
679679
680680
681681ATTR_COLD void netlist_logic_net_t::reset()
682682{
683    netlist_net_t::reset();
683   netlist_net_t::reset();
684684}
685685
686686ATTR_COLD void netlist_logic_net_t::save_register()
687687{
688    netlist_net_t::save_register();
688   netlist_net_t::save_register();
689689}
690690
691691// ----------------------------------------------------------------------------------------
r31373r31374
693693// ----------------------------------------------------------------------------------------
694694
695695ATTR_COLD netlist_analog_net_t::netlist_analog_net_t()
696    : netlist_net_t(ANALOG)
697    , m_DD_n_m_1(0.0)
698    , m_h_n_m_1(1e-6)
699    , m_solver(NULL)
696   : netlist_net_t(ANALOG)
697   , m_DD_n_m_1(0.0)
698   , m_h_n_m_1(1e-6)
699   , m_solver(NULL)
700700{
701701};
702702
703703ATTR_COLD void netlist_analog_net_t::reset()
704704{
705    netlist_net_t::reset();
705   netlist_net_t::reset();
706706}
707707
708708ATTR_COLD void netlist_analog_net_t::save_register()
709709{
710    save(NAME(m_DD_n_m_1));
711    save(NAME(m_h_n_m_1));
712    netlist_net_t::save_register();
710   save(NAME(m_DD_n_m_1));
711   save(NAME(m_h_n_m_1));
712   netlist_net_t::save_register();
713713}
714714
715715ATTR_COLD bool netlist_analog_net_t::already_processed(list_t *groups, int cur_group)
716716{
717    if (isRailNet())
718        return true;
719    for (int i = 0; i <= cur_group; i++)
720    {
721        if (groups[i].contains(this))
722            return true;
723    }
724    return false;
717   if (isRailNet())
718      return true;
719   for (int i = 0; i <= cur_group; i++)
720   {
721      if (groups[i].contains(this))
722         return true;
723   }
724   return false;
725725}
726726
727727ATTR_COLD void netlist_analog_net_t::process_net(list_t *groups, int &cur_group)
728728{
729    if (num_cons() == 0)
730        return;
731    /* add the net */
732    //SOLVER_VERBOSE_OUT(("add %d - %s\n", cur_group, name().cstr()));
733    groups[cur_group].add(this);
734    for (int i = 0; i < m_core_terms.count(); i++)
735    {
736        netlist_core_terminal_t *p = m_core_terms[i];
737        //SOLVER_VERBOSE_OUT(("terminal %s\n", p->name().cstr()));
738        if (p->isType(netlist_terminal_t::TERMINAL))
739        {
740            //SOLVER_VERBOSE_OUT(("isterminal\n"));
741            netlist_terminal_t *pt = static_cast<netlist_terminal_t *>(p);
742            netlist_analog_net_t *other_net = &pt->m_otherterm->net().as_analog();
743            if (!other_net->already_processed(groups, cur_group))
744                other_net->process_net(groups, cur_group);
745        }
746    }
729   if (num_cons() == 0)
730      return;
731   /* add the net */
732   //SOLVER_VERBOSE_OUT(("add %d - %s\n", cur_group, name().cstr()));
733   groups[cur_group].add(this);
734   for (int i = 0; i < m_core_terms.count(); i++)
735   {
736      netlist_core_terminal_t *p = m_core_terms[i];
737      //SOLVER_VERBOSE_OUT(("terminal %s\n", p->name().cstr()));
738      if (p->isType(netlist_terminal_t::TERMINAL))
739      {
740         //SOLVER_VERBOSE_OUT(("isterminal\n"));
741         netlist_terminal_t *pt = static_cast<netlist_terminal_t *>(p);
742         netlist_analog_net_t *other_net = &pt->m_otherterm->net().as_analog();
743         if (!other_net->already_processed(groups, cur_group))
744            other_net->process_net(groups, cur_group);
745      }
746   }
747747}
748748
749749
r31373r31374
780780
781781ATTR_HOT void netlist_terminal_t::schedule_solve()
782782{
783    // FIXME: Remove this after we found a way to remove *ALL* twoterms connected to railnets only.
784    if (net().as_analog().solver() != NULL)
785        net().as_analog().solver()->update_forced();
783   // FIXME: Remove this after we found a way to remove *ALL* twoterms connected to railnets only.
784   if (net().as_analog().solver() != NULL)
785      net().as_analog().solver()->update_forced();
786786}
787787
788788ATTR_HOT void netlist_terminal_t::schedule_after(const netlist_time &after)
789789{
790    // FIXME: Remove this after we found a way to remove *ALL* twoterms connected to railnets only.
791    if (net().as_analog().solver() != NULL)
792        net().as_analog().solver()->update_after(after);
790   // FIXME: Remove this after we found a way to remove *ALL* twoterms connected to railnets only.
791   if (net().as_analog().solver() != NULL)
792      net().as_analog().solver()->update_after(after);
793793}
794794
795795ATTR_COLD void netlist_terminal_t::reset()
r31373r31374
843843ATTR_COLD netlist_logic_output_t::netlist_logic_output_t()
844844   : netlist_output_t(OUTPUT, LOGIC), m_proxy(NULL)
845845{
846    this->set_net(m_my_net);
846   this->set_net(m_my_net);
847847}
848848
849849ATTR_COLD void netlist_logic_output_t::initial(const netlist_sig_t val)
r31373r31374
867867ATTR_COLD netlist_analog_output_t::netlist_analog_output_t()
868868   : netlist_output_t(OUTPUT, ANALOG), m_proxied_net(NULL)
869869{
870    this->set_net(m_my_net);
870   this->set_net(m_my_net);
871871
872872   net().as_analog().m_cur_Analog = 0.98;
873873}
r31373r31374
995995{
996996   netlist_logic_net_t &net = m_Q.net().as_logic();
997997   // this is only called during setup ...
998    net.toggle_new_Q();
998   net.toggle_new_Q();
999999   net.set_time(netlist().time() + m_inc);
10001000}
10011001
trunk/src/emu/netlist/analog/nld_opamps.c
r31373r31374
88
99NETLIST_START(opamp_lm3900)
1010
11    /*
12     *  Fast norton opamp model without bandwidth
13     */
11   /*
12    *  Fast norton opamp model without bandwidth
13    */
1414
15    /* Terminal definitions for calling netlists */
15   /* Terminal definitions for calling netlists */
1616
17    ALIAS(PLUS, R1.1) // Positive input
18    ALIAS(MINUS, R2.1) // Negative input
19    ALIAS(OUT, G1.OP) // Opamp output ...
20    ALIAS(VM, G1.ON)  // V- terminal
21    ALIAS(VP, DUMMY.I)  // V+ terminal
17   ALIAS(PLUS, R1.1) // Positive input
18   ALIAS(MINUS, R2.1) // Negative input
19   ALIAS(OUT, G1.OP) // Opamp output ...
20   ALIAS(VM, G1.ON)  // V- terminal
21   ALIAS(VP, DUMMY.I)  // V+ terminal
2222
23    DUMMY_INPUT(DUMMY)
23   DUMMY_INPUT(DUMMY)
2424
25    /* The opamp model */
25   /* The opamp model */
2626
27    RES(R1, 1)
28    RES(R2, 1)
29    NET_C(R1.1, G1.IP)
30    NET_C(R2.1, G1.IN)
31    NET_C(R1.2, R2.2, G1.ON)
32    VCVS(G1)
33    PARAM(G1.G, 10000000)
34    //PARAM(G1.RI, 100)
35    PARAM(G1.RO, RES_K(8))
27   RES(R1, 1)
28   RES(R2, 1)
29   NET_C(R1.1, G1.IP)
30   NET_C(R2.1, G1.IN)
31   NET_C(R1.2, R2.2, G1.ON)
32   VCVS(G1)
33   PARAM(G1.G, 10000000)
34   //PARAM(G1.RI, 100)
35   PARAM(G1.RO, RES_K(8))
3636
3737NETLIST_END()
38
trunk/src/emu/netlist/analog/nld_twoterm.c
r31373r31374
4040// ----------------------------------------------------------------------------------------
4141
4242ATTR_COLD NETLIB_NAME(twoterm)::NETLIB_NAME(twoterm)(const family_t afamily)
43        : netlist_device_t(afamily)
43      : netlist_device_t(afamily)
4444{
4545   m_P.m_otherterm = &m_N;
4646   m_N.m_otherterm = &m_P;
4747}
4848
4949ATTR_COLD NETLIB_NAME(twoterm)::NETLIB_NAME(twoterm)()
50        : netlist_device_t(TWOTERM)
50      : netlist_device_t(TWOTERM)
5151{
52    m_P.m_otherterm = &m_N;
53    m_N.m_otherterm = &m_P;
52   m_P.m_otherterm = &m_N;
53   m_N.m_otherterm = &m_P;
5454}
5555
5656NETLIB_START(twoterm)
r31373r31374
113113{
114114   //printf("updating %s to %f\n", name().cstr(), m_R.Value());
115115
116    // FIXME: Only attached nets should be brought up to current time
117    //netlist().solver()->update_to_current_time(); // bring up current time
118    update_dev();
116   // FIXME: Only attached nets should be brought up to current time
117   //netlist().solver()->update_to_current_time(); // bring up current time
118   update_dev();
119119   if (m_R.Value() > 1e-9)
120120      set_R(m_R.Value());
121121   else
r31373r31374
162162      v = (exp(v) - 1.0) / (exp(1.0) - 1.0);
163163
164164   // FIXME: Only attached nets should be brought up to current time
165    //netlist().solver()->update_to_current_time(); // bring up current time
165   //netlist().solver()->update_to_current_time(); // bring up current time
166166
167    m_R1.update_dev();
168    m_R2.update_dev();
167   m_R1.update_dev();
168   m_R2.update_dev();
169169
170    m_R1.set_R(MAX(m_R.Value() * v, netlist().gmin()));
170   m_R1.set_R(MAX(m_R.Value() * v, netlist().gmin()));
171171   m_R2.set_R(MAX(m_R.Value() * (1.0 - v), netlist().gmin()));
172172
173173}
trunk/src/emu/netlist/analog/nld_fourterm.c
r31373r31374
1313
1414NETLIB_START(VCCS)
1515{
16    start_internal(1.0 / netlist().gmin());
16   start_internal(1.0 / netlist().gmin());
1717   m_gfac = 1.0;
1818}
1919
2020void NETLIB_NAME(VCCS)::start_internal(const double def_RI)
2121{
22    register_param("G", m_G, 1.0);
23    register_param("RI", m_RI, def_RI);
22   register_param("G", m_G, 1.0);
23   register_param("RI", m_RI, def_RI);
2424
25    register_terminal("IP", m_IP);
26    register_terminal("IN", m_IN);
27    register_terminal("OP", m_OP);
28    register_terminal("ON", m_ON);
25   register_terminal("IP", m_IP);
26   register_terminal("IN", m_IN);
27   register_terminal("OP", m_OP);
28   register_terminal("ON", m_ON);
2929
30    register_terminal("_OP1", m_OP1);
31    register_terminal("_ON1", m_ON1);
30   register_terminal("_OP1", m_OP1);
31   register_terminal("_ON1", m_ON1);
3232
33    m_IP.m_otherterm = &m_IN; // <= this should be NULL and terminal be filtered out prior to solving...
34    m_IN.m_otherterm = &m_IP; // <= this should be NULL and terminal be filtered out prior to solving...
33   m_IP.m_otherterm = &m_IN; // <= this should be NULL and terminal be filtered out prior to solving...
34   m_IN.m_otherterm = &m_IP; // <= this should be NULL and terminal be filtered out prior to solving...
3535
36    m_OP.m_otherterm = &m_IP;
37    m_OP1.m_otherterm = &m_IN;
36   m_OP.m_otherterm = &m_IP;
37   m_OP1.m_otherterm = &m_IN;
3838
39    m_ON.m_otherterm = &m_IP;
40    m_ON1.m_otherterm = &m_IN;
39   m_ON.m_otherterm = &m_IP;
40   m_ON1.m_otherterm = &m_IN;
4141
42    connect(m_OP, m_OP1);
43    connect(m_ON, m_ON1);
42   connect(m_OP, m_OP1);
43   connect(m_ON, m_ON1);
4444}
4545
4646NETLIB_RESET(VCCS)
r31373r31374
8282
8383NETLIB_START(CCCS)
8484{
85    start_internal(1.0);
86    m_gfac = 1.0 / m_RI.Value();
85   start_internal(1.0);
86   m_gfac = 1.0 / m_RI.Value();
8787}
8888
8989NETLIB_RESET(CCCS)
9090{
91    NETLIB_NAME(VCCS)::reset();
91   NETLIB_NAME(VCCS)::reset();
9292}
9393
9494NETLIB_UPDATE_PARAM(CCCS)
9595{
96    NETLIB_NAME(VCCS)::update_param();
96   NETLIB_NAME(VCCS)::update_param();
9797}
9898
9999NETLIB_UPDATE(CCCS)
100100{
101    NETLIB_NAME(VCCS)::update();
101   NETLIB_NAME(VCCS)::update();
102102}
103103
104104// ----------------------------------------------------------------------------------------
trunk/src/emu/netlist/analog/nld_solver.c
r31373r31374
4141
4242vector_ops_t *vector_ops_t::create_ops(const int size)
4343{
44    switch (size)
45    {
46        case 1:
47            return new vector_ops_impl_t<1>();
48        case 2:
49            return new vector_ops_impl_t<2>();
50        case 3:
51            return new vector_ops_impl_t<3>();
52        case 4:
53            return new vector_ops_impl_t<4>();
54        case 5:
55            return new vector_ops_impl_t<5>();
56        case 6:
57            return new vector_ops_impl_t<6>();
58        case 7:
59            return new vector_ops_impl_t<7>();
60        case 8:
61            return new vector_ops_impl_t<8>();
62        case 9:
63            return new vector_ops_impl_t<9>();
64        case 10:
65            return new vector_ops_impl_t<10>();
66        case 11:
67            return new vector_ops_impl_t<11>();
68        case 12:
69            return new vector_ops_impl_t<12>();
70        default:
71            return new vector_ops_impl_t<0>(size);
72    }
44   switch (size)
45   {
46      case 1:
47         return new vector_ops_impl_t<1>();
48      case 2:
49         return new vector_ops_impl_t<2>();
50      case 3:
51         return new vector_ops_impl_t<3>();
52      case 4:
53         return new vector_ops_impl_t<4>();
54      case 5:
55         return new vector_ops_impl_t<5>();
56      case 6:
57         return new vector_ops_impl_t<6>();
58      case 7:
59         return new vector_ops_impl_t<7>();
60      case 8:
61         return new vector_ops_impl_t<8>();
62      case 9:
63         return new vector_ops_impl_t<9>();
64      case 10:
65         return new vector_ops_impl_t<10>();
66      case 11:
67         return new vector_ops_impl_t<11>();
68      case 12:
69         return new vector_ops_impl_t<12>();
70      default:
71         return new vector_ops_impl_t<0>(size);
72   }
7373}
7474
7575ATTR_COLD void terms_t::add(netlist_terminal_t *term, int net_other)
7676{
77    m_term.add(term);
78    m_net_other.add(net_other);
79    m_gt.add(0.0);
80    m_go.add(0.0);
81    m_Idr.add(0.0);
82    m_other_curanalog.add(NULL);
77   m_term.add(term);
78   m_net_other.add(net_other);
79   m_gt.add(0.0);
80   m_go.add(0.0);
81   m_Idr.add(0.0);
82   m_other_curanalog.add(NULL);
8383}
8484
8585ATTR_COLD void terms_t::set_pointers()
8686{
87    for (int i = 0; i < count(); i++)
88    {
89        m_term[i]->m_gt1 = &m_gt[i];
90        m_term[i]->m_go1 = &m_go[i];
91        m_term[i]->m_Idr1 = &m_Idr[i];
92        m_other_curanalog[i] = &m_term[i]->m_otherterm->net().as_analog().m_cur_Analog;
93    }
87   for (int i = 0; i < count(); i++)
88   {
89      m_term[i]->m_gt1 = &m_gt[i];
90      m_term[i]->m_go1 = &m_go[i];
91      m_term[i]->m_Idr1 = &m_Idr[i];
92      m_other_curanalog[i] = &m_term[i]->m_otherterm->net().as_analog().m_cur_Analog;
93   }
9494
95    m_ops = vector_ops_t::create_ops(m_gt.count());
95   m_ops = vector_ops_t::create_ops(m_gt.count());
9696}
9797
9898// ----------------------------------------------------------------------------------------
r31373r31374
106106
107107ATTR_COLD netlist_matrix_solver_t::~netlist_matrix_solver_t()
108108{
109    for (int i = 0; i < m_inps.count(); i++)
110        delete m_inps[i];
109   for (int i = 0; i < m_inps.count(); i++)
110      delete m_inps[i];
111111}
112112
113113ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets)
r31373r31374
118118
119119   for (int k = 0; k < nets.count(); k++)
120120   {
121        m_nets.add(nets[k]);
122    }
121      m_nets.add(nets[k]);
122   }
123123
124124   for (int k = 0; k < nets.count(); k++)
125125   {
r31373r31374
129129
130130      net->m_solver = this;
131131
132        for (int i = 0; i < net->m_core_terms.count(); i++)
132      for (int i = 0; i < net->m_core_terms.count(); i++)
133133      {
134          netlist_core_terminal_t *p = net->m_core_terms[i];
134         netlist_core_terminal_t *p = net->m_core_terms[i];
135135         NL_VERBOSE_OUT(("%s %s %d\n", p->name().cstr(), net->name().cstr(), (int) net->isRailNet()));
136136         switch (p->type())
137137         {
r31373r31374
160160               NL_VERBOSE_OUT(("Added terminal\n"));
161161               break;
162162            case netlist_terminal_t::INPUT:
163                {
164                        netlist_analog_output_t *net_proxy_output = NULL;
165                        for (int i = 0; i < m_inps.count(); i++)
166                            if (m_inps[i]->m_proxied_net == &p->net().as_analog())
167                            {
168                                net_proxy_output = m_inps[i];
169                                break;
170                            }
163               {
164                  netlist_analog_output_t *net_proxy_output = NULL;
165                  for (int i = 0; i < m_inps.count(); i++)
166                     if (m_inps[i]->m_proxied_net == &p->net().as_analog())
167                     {
168                        net_proxy_output = m_inps[i];
169                        break;
170                     }
171171
172                        if (net_proxy_output == NULL)
173                        {
174                            net_proxy_output = new netlist_analog_output_t();
175                            net_proxy_output->init_object(*this, this->name() + "." + pstring::sprintf("m%d", m_inps.count()));
176                            m_inps.add(net_proxy_output);
177                            net_proxy_output->m_proxied_net = &p->net().as_analog();
178                        }
179                        net_proxy_output->net().register_con(*p);
180                        // FIXME: repeated
181                        net_proxy_output->net().rebuild_list();
182                        NL_VERBOSE_OUT(("Added input\n"));
183                }
184                    break;
172                  if (net_proxy_output == NULL)
173                  {
174                     net_proxy_output = new netlist_analog_output_t();
175                     net_proxy_output->init_object(*this, this->name() + "." + pstring::sprintf("m%d", m_inps.count()));
176                     m_inps.add(net_proxy_output);
177                     net_proxy_output->m_proxied_net = &p->net().as_analog();
178                  }
179                  net_proxy_output->net().register_con(*p);
180                  // FIXME: repeated
181                  net_proxy_output->net().rebuild_list();
182                  NL_VERBOSE_OUT(("Added input\n"));
183               }
184               break;
185185            default:
186186               netlist().error("unhandled element found\n");
187187               break;
r31373r31374
194194
195195ATTR_HOT void netlist_matrix_solver_t::update_inputs()
196196{
197    // avoid recursive calls. Inputs are updated outside this call
198    for (netlist_analog_output_t * const *p = m_inps.first(); p != NULL; p = m_inps.next(p))
199        (*p)->set_Q((*p)->m_proxied_net->m_cur_Analog);
197   // avoid recursive calls. Inputs are updated outside this call
198   for (netlist_analog_output_t * const *p = m_inps.first(); p != NULL; p = m_inps.next(p))
199      (*p)->set_Q((*p)->m_proxied_net->m_cur_Analog);
200200
201201}
202202
r31373r31374
218218
219219ATTR_COLD void netlist_matrix_solver_t::start()
220220{
221    register_output("Q_sync", m_Q_sync);
222    register_input("FB_sync", m_fb_sync);
223    connect(m_fb_sync, m_Q_sync);
221   register_output("Q_sync", m_Q_sync);
222   register_input("FB_sync", m_fb_sync);
223   connect(m_fb_sync, m_Q_sync);
224224}
225225
226226ATTR_COLD void netlist_matrix_solver_t::reset()
r31373r31374
230230
231231ATTR_COLD void netlist_matrix_solver_t::update()
232232{
233    const double new_timestep = solve();
233   const double new_timestep = solve();
234234
235    if (m_params.m_dynamic && is_timestep() && new_timestep > 0)
236        m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(new_timestep));
235   if (m_params.m_dynamic && is_timestep() && new_timestep > 0)
236      m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(new_timestep));
237237}
238238
239239ATTR_COLD void netlist_matrix_solver_t::update_forced()
240240{
241    ATTR_UNUSED const double new_timestep = solve();
241   ATTR_UNUSED const double new_timestep = solve();
242242
243    if (m_params.m_dynamic && is_timestep())
244        m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(m_params.m_min_timestep));
243   if (m_params.m_dynamic && is_timestep())
244      m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(m_params.m_min_timestep));
245245}
246246
247247ATTR_HOT void netlist_matrix_solver_t::step(const netlist_time delta)
r31373r31374
254254template<class C >
255255void netlist_matrix_solver_t::solve_base(C *p)
256256{
257    if (is_dynamic())
258    {
259        int this_resched;
260        int newton_loops = 0;
261        do
262        {
263            update_dynamic();
264            // Gauss-Seidel will revert to Gaussian elemination if steps exceeded.
265            this_resched = p->vsolve_non_dynamic();
266            newton_loops++;
267        } while (this_resched > 1 && newton_loops < m_params.m_nr_loops);
257   if (is_dynamic())
258   {
259      int this_resched;
260      int newton_loops = 0;
261      do
262      {
263         update_dynamic();
264         // Gauss-Seidel will revert to Gaussian elemination if steps exceeded.
265         this_resched = p->vsolve_non_dynamic();
266         newton_loops++;
267      } while (this_resched > 1 && newton_loops < m_params.m_nr_loops);
268268
269        // reschedule ....
270        if (this_resched > 1 && !m_Q_sync.net().is_queued())
271        {
272            netlist().warning("NEWTON_LOOPS exceeded ... reschedule");
273            m_Q_sync.net().reschedule_in_queue(m_params.m_nt_sync_delay);
274        }
275    }
276    else
277    {
278        p->vsolve_non_dynamic();
279    }
269      // reschedule ....
270      if (this_resched > 1 && !m_Q_sync.net().is_queued())
271      {
272         netlist().warning("NEWTON_LOOPS exceeded ... reschedule");
273         m_Q_sync.net().reschedule_in_queue(m_params.m_nt_sync_delay);
274      }
275   }
276   else
277   {
278      p->vsolve_non_dynamic();
279   }
280280}
281281
282282ATTR_HOT double netlist_matrix_solver_t::solve()
283283{
284
285284   netlist_time now = netlist().time();
286285   netlist_time delta = now - m_last_step;
287286
288287   // We are already up to date. Avoid oscillations.
289288   if (delta < netlist_time::from_nsec(1))
290       return -1.0;
289      return -1.0;
291290
292291   /* update all terminals for new time step */
293292   m_last_step = now;
r31373r31374
297296
298297   const double next_time_step = vsolve();
299298
300    update_inputs();
299   update_inputs();
301300   return next_time_step;
302301}
303302
r31373r31374
330329{
331330   register_output("Q_step", m_Q_step);
332331
333    register_param("SYNC_DELAY", m_sync_delay, NLTIME_FROM_NS(10).as_double());
332   register_param("SYNC_DELAY", m_sync_delay, NLTIME_FROM_NS(10).as_double());
334333
335334   register_param("FREQ", m_freq, 48000.0);
336335
337336   register_param("ACCURACY", m_accuracy, 1e-7);
338    register_param("GS_LOOPS", m_gs_loops, 9);              // Gauss-Seidel loops
339    register_param("GS_THRESHOLD", m_gs_threshold, 5);      // below this value, gaussian elimination is used
340    register_param("NR_LOOPS", m_nr_loops, 25);             // Newton-Raphson loops
337   register_param("GS_LOOPS", m_gs_loops, 9);              // Gauss-Seidel loops
338   register_param("GS_THRESHOLD", m_gs_threshold, 5);      // below this value, gaussian elimination is used
339   register_param("NR_LOOPS", m_nr_loops, 25);             // Newton-Raphson loops
341340   register_param("PARALLEL", m_parallel, 0);
342    register_param("SOR_FACTOR", m_sor, 1.059);
343    register_param("GMIN", m_gmin, NETLIST_GMIN_DEFAULT);
344    register_param("DYNAMIC_TS", m_dynamic, 0);
345    register_param("LTE", m_lte, 5e-5);                     // diff/timestep
341   register_param("SOR_FACTOR", m_sor, 1.059);
342   register_param("GMIN", m_gmin, NETLIST_GMIN_DEFAULT);
343   register_param("DYNAMIC_TS", m_dynamic, 0);
344   register_param("LTE", m_lte, 5e-5);                     // diff/timestep
346345   register_param("MIN_TIMESTEP", m_min_timestep, 1e-6);   // double timestep resolution
347346
348347   // internal staff
r31373r31374
366365
367366NETLIB_NAME(solver)::~NETLIB_NAME(solver)()
368367{
369    for (int i = 0; i < m_mat_solvers.count(); i++)
370        m_mat_solvers[i]->log_stats();
368   for (int i = 0; i < m_mat_solvers.count(); i++)
369      m_mat_solvers[i]->log_stats();
371370
372371   netlist_matrix_solver_t * const *e = m_mat_solvers.first();
373372   while (e != NULL)
r31373r31374
382381NETLIB_UPDATE(solver)
383382{
384383   if (m_params.m_dynamic)
385       return;
384      return;
386385
387    const int t_cnt = m_mat_solvers.count();
386   const int t_cnt = m_mat_solvers.count();
388387
389388#if HAS_OPENMP && USE_OPENMP
390389   if (m_parallel.Value())
r31373r31374
407406            this_resched[i] = m_mat_solvers[i]->solve();
408407      }
409408#else
410    for (int i = 0; i < t_cnt; i++)
411    {
412        if (m_mat_solvers[i]->is_timestep())
413            {
414                // Ignore return value
415                ATTR_UNUSED const double ts = m_mat_solvers[i]->solve();
416            }
417    }
409   for (int i = 0; i < t_cnt; i++)
410   {
411      if (m_mat_solvers[i]->is_timestep())
412         {
413            // Ignore return value
414            ATTR_UNUSED const double ts = m_mat_solvers[i]->solve();
415         }
416   }
418417#endif
419418
420    /* step circuit */
421    if (!m_Q_step.net().is_queued())
422    {
423        m_Q_step.net().push_to_queue(netlist_time::from_double(m_params.m_max_timestep));
424    }
419   /* step circuit */
420   if (!m_Q_step.net().is_queued())
421   {
422      m_Q_step.net().push_to_queue(netlist_time::from_double(m_params.m_max_timestep));
423   }
425424}
426425
427426template <int m_N, int _storage_N>
428427netlist_matrix_solver_t * NETLIB_NAME(solver)::create_solver(int size, const int gs_threshold, const bool use_specific)
429428{
430    if (use_specific && m_N == 1)
431        return new netlist_matrix_solver_direct1_t(m_params);
432    else if (use_specific && m_N == 2)
433        return new netlist_matrix_solver_direct2_t(m_params);
434    else
435    {
436        if (size >= gs_threshold)
437            return new netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N>(m_params, size);
438        else
439            return new netlist_matrix_solver_direct_t<m_N, _storage_N>(m_params, size);
440    }
429   if (use_specific && m_N == 1)
430      return new netlist_matrix_solver_direct1_t(m_params);
431   else if (use_specific && m_N == 2)
432      return new netlist_matrix_solver_direct2_t(m_params);
433   else
434   {
435      if (size >= gs_threshold)
436         return new netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N>(m_params, size);
437      else
438         return new netlist_matrix_solver_direct_t<m_N, _storage_N>(m_params, size);
439   }
441440}
442441
443442ATTR_COLD void NETLIB_NAME(solver)::post_start()
r31373r31374
447446   const int gs_threshold = m_gs_threshold.Value();
448447   const bool use_specific = true;
449448
450    m_params.m_accuracy = m_accuracy.Value();
451    m_params.m_gs_loops = m_gs_loops.Value();
452    m_params.m_nr_loops = m_nr_loops.Value();
453    m_params.m_nt_sync_delay = m_sync_delay.Value();
454    m_params.m_lte = m_lte.Value();
455    m_params.m_sor = m_sor.Value();
449   m_params.m_accuracy = m_accuracy.Value();
450   m_params.m_gs_loops = m_gs_loops.Value();
451   m_params.m_nr_loops = m_nr_loops.Value();
452   m_params.m_nt_sync_delay = m_sync_delay.Value();
453   m_params.m_lte = m_lte.Value();
454   m_params.m_sor = m_sor.Value();
456455
457    m_params.m_min_timestep = m_min_timestep.Value();
458    m_params.m_dynamic = (m_dynamic.Value() == 1 ? true : false);
459    m_params.m_max_timestep = netlist_time::from_hz(m_freq.Value()).as_double();
456   m_params.m_min_timestep = m_min_timestep.Value();
457   m_params.m_dynamic = (m_dynamic.Value() == 1 ? true : false);
458   m_params.m_max_timestep = netlist_time::from_hz(m_freq.Value()).as_double();
460459
461    if (m_params.m_dynamic)
462    {
463        m_params.m_max_timestep *= 1000.0;
464    }
465    else
466    {
467        m_params.m_min_timestep = m_params.m_max_timestep;
468    }
460   if (m_params.m_dynamic)
461   {
462      m_params.m_max_timestep *= 1000.0;
463   }
464   else
465   {
466      m_params.m_min_timestep = m_params.m_max_timestep;
467   }
469468
470469   netlist().log("Scanning net groups ...");
471470   // determine net groups
472471   for (netlist_net_t * const *pn = netlist().m_nets.first(); pn != NULL; pn = netlist().m_nets.next(pn))
473472   {
474       SOLVER_VERBOSE_OUT(("processing %s\n", (*pn)->name().cstr()));
475       if (!(*pn)->isRailNet())
476       {
477           SOLVER_VERBOSE_OUT(("   ==> not a rail net\n"));
478           netlist_analog_net_t *n = &(*pn)->as_analog();
479           if (!n->already_processed(groups, cur_group))
480           {
481               cur_group++;
482               n->process_net(groups, cur_group);
483           }
484       }
473      SOLVER_VERBOSE_OUT(("processing %s\n", (*pn)->name().cstr()));
474      if (!(*pn)->isRailNet())
475      {
476         SOLVER_VERBOSE_OUT(("   ==> not a rail net\n"));
477         netlist_analog_net_t *n = &(*pn)->as_analog();
478         if (!n->already_processed(groups, cur_group))
479         {
480            cur_group++;
481            n->process_net(groups, cur_group);
482         }
483      }
485484   }
486485
487486   // setup the solvers
r31373r31374
497496            ms = create_solver<1,1>(1, gs_threshold, use_specific);
498497            break;
499498         case 2:
500                ms = create_solver<2,2>(2, gs_threshold, use_specific);
499            ms = create_solver<2,2>(2, gs_threshold, use_specific);
501500            break;
502501         case 3:
503                ms = create_solver<3,3>(3, gs_threshold, use_specific);
502            ms = create_solver<3,3>(3, gs_threshold, use_specific);
504503            break;
505504         case 4:
506                ms = create_solver<4,4>(4, gs_threshold, use_specific);
505            ms = create_solver<4,4>(4, gs_threshold, use_specific);
507506            break;
508507         case 5:
509                ms = create_solver<5,5>(5, gs_threshold, use_specific);
508            ms = create_solver<5,5>(5, gs_threshold, use_specific);
510509            break;
511510         case 6:
512                ms = create_solver<6,6>(6, gs_threshold, use_specific);
511            ms = create_solver<6,6>(6, gs_threshold, use_specific);
513512            break;
514            case 7:
515                ms = create_solver<7,7>(7, gs_threshold, use_specific);
516                break;
517            case 8:
518                ms = create_solver<8,8>(8, gs_threshold, use_specific);
519                break;
520            case 12:
521                ms = create_solver<12,12>(12, gs_threshold, use_specific);
522                break;
523            default:
513         case 7:
514            ms = create_solver<7,7>(7, gs_threshold, use_specific);
515            break;
516         case 8:
517            ms = create_solver<8,8>(8, gs_threshold, use_specific);
518            break;
519         case 12:
520            ms = create_solver<12,12>(12, gs_threshold, use_specific);
521            break;
522         default:
524523            if (net_count <= 16)
525524            {
526                   ms = create_solver<0,16>(net_count, gs_threshold, use_specific);
525               ms = create_solver<0,16>(net_count, gs_threshold, use_specific);
527526            }
528527            else if (net_count <= 32)
529528            {
530                   ms = create_solver<0,32>(net_count, gs_threshold, use_specific);
529               ms = create_solver<0,32>(net_count, gs_threshold, use_specific);
531530            }
532531            else if (net_count <= 64)
533532            {
534                   ms = create_solver<0,64>(net_count, gs_threshold, use_specific);
533               ms = create_solver<0,64>(net_count, gs_threshold, use_specific);
535534            }
536535            else
537536            {
r31373r31374
544543
545544      register_sub(*ms, pstring::sprintf("Solver %d",m_mat_solvers.count()));
546545
547        ms->vsetup(groups[i]);
546      ms->vsetup(groups[i]);
548547
549        m_mat_solvers.add(ms);
548      m_mat_solvers.add(ms);
550549
551        netlist().log("Solver %s", ms->name().cstr());
552        netlist().log("       # %d ==> %d nets", i, groups[i].count()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
550      netlist().log("Solver %s", ms->name().cstr());
551      netlist().log("       # %d ==> %d nets", i, groups[i].count()); //, (*(*groups[i].first())->m_core_terms.first())->name().cstr());
553552      netlist().log("       has %s elements", ms->is_dynamic() ? "dynamic" : "no dynamic");
554553      netlist().log("       has %s elements", ms->is_timestep() ? "timestep" : "no timestep");
555554      for (int j=0; j<groups[i].count(); j++)
556555      {
557          netlist().log("Net %d: %s", j, groups[i][j]->name().cstr());
556         netlist().log("Net %d: %s", j, groups[i][j]->name().cstr());
558557         netlist_net_t *n = groups[i][j];
559558         for (int k = 0; k < n->m_core_terms.count(); k++)
560559         {
561             const netlist_core_terminal_t *p = n->m_core_terms[k];
562             netlist().log("   %s", p->name().cstr());
560            const netlist_core_terminal_t *p = n->m_core_terms[k];
561            netlist().log("   %s", p->name().cstr());
563562         }
564563      }
565564   }
566565}
567
trunk/src/emu/netlist/analog/nld_bjt.c
r31373r31374
115115
116116NETLIB_UPDATE(QBJT_switch)
117117{
118    if (!m_RB.m_P.net().isRailNet())
119        m_RB.m_P.schedule_solve();   // Basis
120    else if (!m_RB.m_N.net().isRailNet())
121        m_RB.m_N.schedule_solve();   // Emitter
122    else if (!m_RC.m_P.net().isRailNet())
123        m_RC.m_P.schedule_solve();   // Collector
118   if (!m_RB.m_P.net().isRailNet())
119      m_RB.m_P.schedule_solve();   // Basis
120   else if (!m_RB.m_N.net().isRailNet())
121      m_RB.m_N.schedule_solve();   // Emitter
122   else if (!m_RC.m_P.net().isRailNet())
123      m_RC.m_P.schedule_solve();   // Collector
124124}
125125
126126
trunk/src/emu/netlist/nl_parser.c
r31373r31374
385385   {
386386      pstring t1 = get_identifier();
387387      m_setup.register_link(last , t1);
388       NL_VERBOSE_OUT(("Parser: Connect: %s %s\n", last.cstr(), t1.cstr()));
388      NL_VERBOSE_OUT(("Parser: Connect: %s %s\n", last.cstr(), t1.cstr()));
389389      token_t n = get_token();
390390      if (n.is(m_tok_param_right))
391391         break;
trunk/src/emu/netlist/nl_setup.c
r31373r31374
9292template <class T>
9393static void remove_start_with(T &hm, pstring &sw)
9494{
95    for (int i = hm.count() - 1; i >= 0; i++)
96    {
97        pstring x = hm[i]->name();
95   for (int i = hm.count() - 1; i >= 0; i++)
96   {
97      pstring x = hm[i]->name();
9898      if (sw.equals(x.substr(0, sw.len())))
9999      {
100100         NL_VERBOSE_OUT(("removing %s\n", hm[i]->name().cstr()));
r31373r31374
167167      case netlist_terminal_t::NETLIST:
168168         return "NETLIST";
169169         break;
170        case netlist_terminal_t::QUEUE:
171            return "QUEUE";
170      case netlist_terminal_t::QUEUE:
171         return "QUEUE";
172172         break;
173173   }
174174   // FIXME: noreturn
r31373r31374
264264      case netlist_terminal_t::NETLIST:
265265         netlist().error("Netlist registration not yet supported - %s\n", name.cstr());
266266         break;
267        case netlist_terminal_t::QUEUE:
268            netlist().error("QUEUE registration not yet supported - %s\n", name.cstr());
269            break;
267      case netlist_terminal_t::QUEUE:
268         netlist().error("QUEUE registration not yet supported - %s\n", name.cstr());
269         break;
270270   }
271271}
272272
r31373r31374
407407
408408      for (int i = 0; i < out.net().m_core_terms.count(); i++)
409409      {
410           netlist_core_terminal_t *p = out.net().m_core_terms[i];
410         netlist_core_terminal_t *p = out.net().m_core_terms[i];
411411         p->clear_net(); // de-link from all nets ...
412412         connect(proxy->out(), *p);
413413      }
r31373r31374
444444   }
445445   else
446446   {
447       if (in.has_net())
448           out.net().merge_net(&in.net());
449       else
450           out.net().register_con(in);
447      if (in.has_net())
448         out.net().merge_net(&in.net());
449      else
450         out.net().register_con(in);
451451   }
452452}
453453
r31373r31374
485485{
486486   if (out.isFamily(netlist_terminal_t::ANALOG))
487487   {
488       NL_VERBOSE_OUT(("connect_terminal_output: %s %s\n", in.name().cstr(), out.name().cstr()));
488      NL_VERBOSE_OUT(("connect_terminal_output: %s %s\n", in.name().cstr(), out.name().cstr()));
489489      /* no proxy needed, just merge existing terminal net */
490490      if (in.has_net())
491491         out.net().merge_net(&in.net());
r31373r31374
650650   pstring errstr("");
651651
652652   netlist().log("looking for terminals not connected ...");
653    for (int i = 0; i < m_terminals.count(); i++)
654    {
653   for (int i = 0; i < m_terminals.count(); i++)
654   {
655655      if (!m_terminals[i]->has_net())
656656         errstr += pstring::sprintf("Found terminal %s without a net\n",
657                 m_terminals[i]->name().cstr());
657               m_terminals[i]->name().cstr());
658658      else if (m_terminals[i]->net().num_cons() == 0)
659659         netlist().warning("Found terminal %s without connections",
660                 m_terminals[i]->name().cstr());
660               m_terminals[i]->name().cstr());
661661   }
662662   if (errstr != "")
663663      netlist().error("%s", errstr.cstr());
trunk/src/emu/machine.c
r31373r31374
292292
293293   // allocate autoboot timer
294294   m_autoboot_timer = scheduler().timer_alloc(timer_expired_delegate(FUNC(running_machine::autoboot_callback), this));
295   
295
296296   manager().update_machine();
297297}
298298
trunk/src/emu/softlist.c
r31373r31374
11451145            else
11461146               parse_error("Invalid dataarea endianness");
11471147         }
1148         
1148
11491149         add_rom_entry(attrvalues[0], NULL, 0, strtol(attrvalues[1], NULL, 0), regionflags);
11501150      }
11511151      else
trunk/src/emu/sound/k053260.c
r31373r31374
9292
9393void k053260_device::device_reset()
9494{
95
96   for (int i = 0; i < 4; i++)
95   for (int i = 0; i < 4; i++)
9796   {
9897      m_channels[i].rate = 0;
9998      m_channels[i].size = 0;
trunk/src/emu/sound/pokey.c
r31373r31374
274274   {
275275      m_POTx[i] = 0;
276276   }
277   
277
278278   m_pot0_r_cb.resolve();
279279   m_pot1_r_cb.resolve();
280280   m_pot2_r_cb.resolve();
trunk/src/emu/sound/es5506.c
r31373r31374
155155      m_region3(NULL),
156156      m_channels(0),
157157      m_irq_cb(*this),
158      m_read_port_cb(*this)     
158      m_read_port_cb(*this)
159159{
160160   for (int i = 0; i < 4; i++)
161161   {
trunk/src/emu/sound/2608intf.c
r31373r31374
128128void ym2608_device::device_start()
129129{
130130   ay8910_device::device_start();
131   
131
132132   int rate = clock()/72;
133133   void *pcmbufa;
134134   int  pcmsizea;
trunk/src/emu/sound/2203intf.c
r31373r31374
118118void ym2203_device::device_start()
119119{
120120   ay8910_device::device_start();
121   
121
122122   int rate = clock()/72; /* ??? */
123123
124124   m_irq_handler.resolve();
trunk/src/emu/sound/k054539.c
r31373r31374
491491void k054539_device::device_start()
492492{
493493   m_timer = timer_alloc(0);
494   
494
495495   // resolve / bind callbacks
496496   m_timer_handler.resolve_safe();
497497   m_apan_cb.bind_relative_to(*owner());
498   
498
499499   for (int i = 0; i < 8; i++)
500500      gain[i] = 1.0;
501501
trunk/src/emu/sound/2610intf.c
r31373r31374
139139void ym2610_device::device_start()
140140{
141141   ay8910_device::device_start();
142   
142
143143   int rate = clock()/72;
144144   void *pcmbufa,*pcmbufb;
145145   int  pcmsizea,pcmsizeb;
trunk/src/emu/sound/rf5c68.c
r31373r31374
3737void rf5c68_device::device_start()
3838{
3939   m_sample_end_cb.bind_relative_to(*owner());
40   
40
4141   /* allocate memory for the chip */
4242   memset(m_data, 0xff, sizeof(m_data));
4343
trunk/src/emu/sound/ay8910.c
r31373r31374
389389
390390static const ay8910_device::ay_ym_param ay8910_param =
391391{
392    800000, 8000000,
393    16,
394    { 15950, 15350, 15090, 14760, 14275, 13620, 12890, 11370,
395        10600,  8590,  7190,  5985,  4820,  3945,  3017,  2345 }
392   800000, 8000000,
393   16,
394   { 15950, 15350, 15090, 14760, 14275, 13620, 12890, 11370,
395      10600,  8590,  7190,  5985,  4820,  3945,  3017,  2345 }
396396};
397397
398398static const ay8910_device::mosfet_param ay8910_mosfet_param =
399399{
400    1.465385778,
401    4.9,
402    16,
403    {
404          0.00076,
405          0.80536,
406          1.13106,
407          1.65952,
408          2.42261,
409          3.60536,
410          5.34893,
411          8.96871,
412         10.97202,
413         19.32370,
414         29.01935,
415         38.82026,
416         55.50539,
417         78.44395,
418        109.49257,
419        153.72985,
420    }
400   1.465385778,
401   4.9,
402   16,
403   {
404         0.00076,
405         0.80536,
406         1.13106,
407         1.65952,
408         2.42261,
409         3.60536,
410         5.34893,
411         8.96871,
412         10.97202,
413         19.32370,
414         29.01935,
415         38.82026,
416         55.50539,
417         78.44395,
418      109.49257,
419      153.72985,
420   }
421421};
422422
423423
r31373r31374
523523
524524INLINE void build_mosfet_resistor_table(const ay8910_device::mosfet_param &par, const double rd, INT32 *tab)
525525{
526    int j;
526   int j;
527527
528    for (j=0; j < par.m_count; j++)
529    {
530        const double Vd = 5.0;
531        const double Vg = par.m_Vg - par.m_Vth;
532        const double kn = par.m_Kn[j] / 1.0e6;
533        const double p2 = 1.0 / (2.0 * kn * rd) + Vg;
534        const double Vs = p2 - sqrt(p2 * p2 - Vg * Vg);
528   for (j=0; j < par.m_count; j++)
529   {
530      const double Vd = 5.0;
531      const double Vg = par.m_Vg - par.m_Vth;
532      const double kn = par.m_Kn[j] / 1.0e6;
533      const double p2 = 1.0 / (2.0 * kn * rd) + Vg;
534      const double Vs = p2 - sqrt(p2 * p2 - Vg * Vg);
535535
536        const double res = rd * ( Vd / Vs - 1.0);
537        /* That's the biggest value we can stream on to netlist. */
536      const double res = rd * ( Vd / Vs - 1.0);
537      /* That's the biggest value we can stream on to netlist. */
538538
539        if (res > (1 << 28))
540            tab[j] = (1 << 28);
541        else
542            tab[j] = res;
543        //printf("%d %f %10d\n", j, rd / (res + rd) * 5.0, tab[j]);
544    }
539      if (res > (1 << 28))
540         tab[j] = (1 << 28);
541      else
542         tab[j] = res;
543      //printf("%d %f %10d\n", j, rd / (res + rd) * 5.0, tab[j]);
544   }
545545}
546546
547547
r31373r31374
814814
815815   if ((m_flags & AY8910_RESISTOR_OUTPUT) != 0)
816816   {
817       if (m_type != PSG_TYPE_AY)
818           fatalerror("AY8910_RESISTOR_OUTPUT currently only supported for AY8910 devices.");
817      if (m_type != PSG_TYPE_AY)
818         fatalerror("AY8910_RESISTOR_OUTPUT currently only supported for AY8910 devices.");
819819
820       for (chan=0; chan < AY8910_NUM_CHANNELS; chan++)
820      for (chan=0; chan < AY8910_NUM_CHANNELS; chan++)
821821      {
822822         build_mosfet_resistor_table(ay8910_mosfet_param, m_res_load[chan], m_vol_table[chan]);
823823         build_mosfet_resistor_table(ay8910_mosfet_param, m_res_load[chan], m_env_table[chan]);
r31373r31374
11101110ay8910_device::ay8910_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
11111111   : device_t(mconfig, AY8910, "AY-3-8910A", tag, owner, clock, "ay8910", __FILE__),
11121112      device_sound_interface(mconfig, *this),
1113        m_type(PSG_TYPE_AY),
1113      m_type(PSG_TYPE_AY),
11141114      m_streams(3),
11151115      m_ioports(2),
11161116      m_ready(0),
r31373r31374
11491149}
11501150
11511151ay8910_device::ay8910_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock,
1152                      psg_type_t psg_type, int streams, int ioports, const char *shortname, const char *source)
1152                        psg_type_t psg_type, int streams, int ioports, const char *shortname, const char *source)
11531153   : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
11541154      device_sound_interface(mconfig, *this),
1155        m_type(psg_type),
1155      m_type(psg_type),
11561156      m_streams(streams),
11571157      m_ioports(ioports),
11581158      m_ready(0),
trunk/src/lib/lua/lauxlib.c
r31373r31374
3131*/
3232
3333
34#define LEVELS1   12   /* size of the first part of the stack */
35#define LEVELS2   10   /* size of the second part of the stack */
34#define LEVELS1 12  /* size of the first part of the stack */
35#define LEVELS2 10  /* size of the second part of the stack */
3636
3737
3838
r31373r31374
4141** return 1 + string at top if find a good name.
4242*/
4343static int findfield (lua_State *L, int objidx, int level) {
44  if (level == 0 || !lua_istable(L, -1))
45    return 0;  /* not found */
46  lua_pushnil(L);  /* start 'next' loop */
47  while (lua_next(L, -2)) {  /* for each pair in table */
48    if (lua_type(L, -2) == LUA_TSTRING) {  /* ignore non-string keys */
49      if (lua_rawequal(L, objidx, -1)) {  /* found object? */
50        lua_pop(L, 1);  /* remove value (but keep name) */
51        return 1;
52      }
53      else if (findfield(L, objidx, level - 1)) {  /* try recursively */
54        lua_remove(L, -2);  /* remove table (but keep name) */
55        lua_pushliteral(L, ".");
56        lua_insert(L, -2);  /* place '.' between the two names */
57        lua_concat(L, 3);
58        return 1;
59      }
60    }
61    lua_pop(L, 1);  /* remove value */
62  }
63  return 0;  /* not found */
44   if (level == 0 || !lua_istable(L, -1))
45   return 0;  /* not found */
46   lua_pushnil(L);  /* start 'next' loop */
47   while (lua_next(L, -2)) {  /* for each pair in table */
48   if (lua_type(L, -2) == LUA_TSTRING) {  /* ignore non-string keys */
49      if (lua_rawequal(L, objidx, -1)) {  /* found object? */
50      lua_pop(L, 1);  /* remove value (but keep name) */
51      return 1;
52      }
53      else if (findfield(L, objidx, level - 1)) {  /* try recursively */
54      lua_remove(L, -2);  /* remove table (but keep name) */
55      lua_pushliteral(L, ".");
56      lua_insert(L, -2);  /* place '.' between the two names */
57      lua_concat(L, 3);
58      return 1;
59      }
60   }
61   lua_pop(L, 1);  /* remove value */
62   }
63   return 0;  /* not found */
6464}
6565
6666
6767static int pushglobalfuncname (lua_State *L, lua_Debug *ar) {
68  int top = lua_gettop(L);
69  lua_getinfo(L, "f", ar);  /* push function */
70  lua_pushglobaltable(L);
71  if (findfield(L, top + 1, 2)) {
72    lua_copy(L, -1, top + 1);  /* move name to proper place */
73    lua_pop(L, 2);  /* remove pushed values */
74    return 1;
75  }
76  else {
77    lua_settop(L, top);  /* remove function and global table */
78    return 0;
79  }
68   int top = lua_gettop(L);
69   lua_getinfo(L, "f", ar);  /* push function */
70   lua_pushglobaltable(L);
71   if (findfield(L, top + 1, 2)) {
72   lua_copy(L, -1, top + 1);  /* move name to proper place */
73   lua_pop(L, 2);  /* remove pushed values */
74   return 1;
75   }
76   else {
77   lua_settop(L, top);  /* remove function and global table */
78   return 0;
79   }
8080}
8181
8282
8383static void pushfuncname (lua_State *L, lua_Debug *ar) {
84  if (*ar->namewhat != '\0')  /* is there a name? */
85    lua_pushfstring(L, "function " LUA_QS, ar->name);
86  else if (*ar->what == 'm')  /* main? */
87      lua_pushliteral(L, "main chunk");
88  else if (*ar->what == 'C') {
89    if (pushglobalfuncname(L, ar)) {
90      lua_pushfstring(L, "function " LUA_QS, lua_tostring(L, -1));
91      lua_remove(L, -2);  /* remove name */
92    }
93    else
94      lua_pushliteral(L, "?");
95  }
96  else
97    lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined);
84   if (*ar->namewhat != '\0')  /* is there a name? */
85   lua_pushfstring(L, "function " LUA_QS, ar->name);
86   else if (*ar->what == 'm')  /* main? */
87      lua_pushliteral(L, "main chunk");
88   else if (*ar->what == 'C') {
89   if (pushglobalfuncname(L, ar)) {
90      lua_pushfstring(L, "function " LUA_QS, lua_tostring(L, -1));
91      lua_remove(L, -2);  /* remove name */
92   }
93   else
94      lua_pushliteral(L, "?");
95   }
96   else
97   lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined);
9898}
9999
100100
101101static int countlevels (lua_State *L) {
102  lua_Debug ar;
103  int li = 1, le = 1;
104  /* find an upper bound */
105  while (lua_getstack(L, le, &ar)) { li = le; le *= 2; }
106  /* do a binary search */
107  while (li < le) {
108    int m = (li + le)/2;
109    if (lua_getstack(L, m, &ar)) li = m + 1;
110    else le = m;
111  }
112  return le - 1;
102   lua_Debug ar;
103   int li = 1, le = 1;
104   /* find an upper bound */
105   while (lua_getstack(L, le, &ar)) { li = le; le *= 2; }
106   /* do a binary search */
107   while (li < le) {
108   int m = (li + le)/2;
109   if (lua_getstack(L, m, &ar)) li = m + 1;
110   else le = m;
111   }
112   return le - 1;
113113}
114114
115115
116116LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1,
117                                const char *msg, int level) {
118  lua_Debug ar;
119  int top = lua_gettop(L);
120  int numlevels = countlevels(L1);
121  int mark = (numlevels > LEVELS1 + LEVELS2) ? LEVELS1 : 0;
122  if (msg) lua_pushfstring(L, "%s\n", msg);
123  lua_pushliteral(L, "stack traceback:");
124  while (lua_getstack(L1, level++, &ar)) {
125    if (level == mark) {  /* too many levels? */
126      lua_pushliteral(L, "\n\t...");  /* add a '...' */
127      level = numlevels - LEVELS2;  /* and skip to last ones */
128    }
129    else {
130      lua_getinfo(L1, "Slnt", &ar);
131      lua_pushfstring(L, "\n\t%s:", ar.short_src);
132      if (ar.currentline > 0)
133        lua_pushfstring(L, "%d:", ar.currentline);
134      lua_pushliteral(L, " in ");
135      pushfuncname(L, &ar);
136      if (ar.istailcall)
137        lua_pushliteral(L, "\n\t(...tail calls...)");
138      lua_concat(L, lua_gettop(L) - top);
139    }
140  }
141  lua_concat(L, lua_gettop(L) - top);
117                        const char *msg, int level) {
118   lua_Debug ar;
119   int top = lua_gettop(L);
120   int numlevels = countlevels(L1);
121   int mark = (numlevels > LEVELS1 + LEVELS2) ? LEVELS1 : 0;
122   if (msg) lua_pushfstring(L, "%s\n", msg);
123   lua_pushliteral(L, "stack traceback:");
124   while (lua_getstack(L1, level++, &ar)) {
125   if (level == mark) {  /* too many levels? */
126      lua_pushliteral(L, "\n\t...");  /* add a '...' */
127      level = numlevels - LEVELS2;  /* and skip to last ones */
128   }
129   else {
130      lua_getinfo(L1, "Slnt", &ar);
131      lua_pushfstring(L, "\n\t%s:", ar.short_src);
132      if (ar.currentline > 0)
133      lua_pushfstring(L, "%d:", ar.currentline);
134      lua_pushliteral(L, " in ");
135      pushfuncname(L, &ar);
136      if (ar.istailcall)
137      lua_pushliteral(L, "\n\t(...tail calls...)");
138      lua_concat(L, lua_gettop(L) - top);
139   }
140   }
141   lua_concat(L, lua_gettop(L) - top);
142142}
143143
144144/* }====================================================== */
r31373r31374
151151*/
152152
153153LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) {
154  lua_Debug ar;
155  if (!lua_getstack(L, 0, &ar))  /* no stack frame? */
156    return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
157  lua_getinfo(L, "n", &ar);
158  if (strcmp(ar.namewhat, "method") == 0) {
159    narg--;  /* do not count `self' */
160    if (narg == 0)  /* error is in the self argument itself? */
161      return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
162                           ar.name, extramsg);
163  }
164  if (ar.name == NULL)
165    ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?";
166  return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)",
167                        narg, ar.name, extramsg);
154   lua_Debug ar;
155   if (!lua_getstack(L, 0, &ar))  /* no stack frame? */
156   return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
157   lua_getinfo(L, "n", &ar);
158   if (strcmp(ar.namewhat, "method") == 0) {
159   narg--;  /* do not count `self' */
160   if (narg == 0)  /* error is in the self argument itself? */
161      return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
162                     ar.name, extramsg);
163   }
164   if (ar.name == NULL)
165   ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?";
166   return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)",
167                  narg, ar.name, extramsg);
168168}
169169
170170
171171static int typeerror (lua_State *L, int narg, const char *tname) {
172  const char *msg = lua_pushfstring(L, "%s expected, got %s",
173                                    tname, luaL_typename(L, narg));
174  return luaL_argerror(L, narg, msg);
172   const char *msg = lua_pushfstring(L, "%s expected, got %s",
173                           tname, luaL_typename(L, narg));
174   return luaL_argerror(L, narg, msg);
175175}
176176
177177
178178static void tag_error (lua_State *L, int narg, int tag) {
179  typeerror(L, narg, lua_typename(L, tag));
179   typeerror(L, narg, lua_typename(L, tag));
180180}
181181
182182
183183LUALIB_API void luaL_where (lua_State *L, int level) {
184  lua_Debug ar;
185  if (lua_getstack(L, level, &ar)) {  /* check function at level */
186    lua_getinfo(L, "Sl", &ar);  /* get info about it */
187    if (ar.currentline > 0) {  /* is there info? */
188      lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline);
189      return;
190    }
191  }
192  lua_pushliteral(L, "");  /* else, no information available... */
184   lua_Debug ar;
185   if (lua_getstack(L, level, &ar)) {  /* check function at level */
186   lua_getinfo(L, "Sl", &ar);  /* get info about it */
187   if (ar.currentline > 0) {  /* is there info? */
188      lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline);
189      return;
190   }
191   }
192   lua_pushliteral(L, "");  /* else, no information available... */
193193}
194194
195195
196196LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
197  va_list argp;
198  va_start(argp, fmt);
199  luaL_where(L, 1);
200  lua_pushvfstring(L, fmt, argp);
201  va_end(argp);
202  lua_concat(L, 2);
203  return lua_error(L);
197   va_list argp;
198   va_start(argp, fmt);
199   luaL_where(L, 1);
200   lua_pushvfstring(L, fmt, argp);
201   va_end(argp);
202   lua_concat(L, 2);
203   return lua_error(L);
204204}
205205
206206
207207LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) {
208  int en = errno;  /* calls to Lua API may change this value */
209  if (stat) {
210    lua_pushboolean(L, 1);
211    return 1;
212  }
213  else {
214    lua_pushnil(L);
215    if (fname)
216      lua_pushfstring(L, "%s: %s", fname, strerror(en));
217    else
218      lua_pushstring(L, strerror(en));
219    lua_pushinteger(L, en);
220    return 3;
221  }
208   int en = errno;  /* calls to Lua API may change this value */
209   if (stat) {
210   lua_pushboolean(L, 1);
211   return 1;
212   }
213   else {
214   lua_pushnil(L);
215   if (fname)
216      lua_pushfstring(L, "%s: %s", fname, strerror(en));
217   else
218      lua_pushstring(L, strerror(en));
219   lua_pushinteger(L, en);
220   return 3;
221   }
222222}
223223
224224
225#if !defined(inspectstat)   /* { */
225#if !defined(inspectstat)   /* { */
226226
227227#if defined(LUA_USE_POSIX)
228228
r31373r31374
232232** use appropriate macros to interpret 'pclose' return status
233233*/
234234#define inspectstat(stat,what)  \
235   if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \
236   else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = "signal"; }
235   if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \
236   else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = "signal"; }
237237
238238#else
239239
r31373r31374
241241
242242#endif
243243
244#endif            /* } */
244#endif              /* } */
245245
246246
247247LUALIB_API int luaL_execresult (lua_State *L, int stat) {
248  const char *what = "exit";  /* type of termination */
249  if (stat == -1)  /* error? */
250    return luaL_fileresult(L, 0, NULL);
251  else {
252    inspectstat(stat, what);  /* interpret result */
253    if (*what == 'e' && stat == 0)  /* successful termination? */
254      lua_pushboolean(L, 1);
255    else
256      lua_pushnil(L);
257    lua_pushstring(L, what);
258    lua_pushinteger(L, stat);
259    return 3;  /* return true/nil,what,code */
260  }
248   const char *what = "exit";  /* type of termination */
249   if (stat == -1)  /* error? */
250   return luaL_fileresult(L, 0, NULL);
251   else {
252   inspectstat(stat, what);  /* interpret result */
253   if (*what == 'e' && stat == 0)  /* successful termination? */
254      lua_pushboolean(L, 1);
255   else
256      lua_pushnil(L);
257   lua_pushstring(L, what);
258   lua_pushinteger(L, stat);
259   return 3;  /* return true/nil,what,code */
260   }
261261}
262262
263263/* }====================================================== */
r31373r31374
270270*/
271271
272272LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) {
273  luaL_getmetatable(L, tname);  /* try to get metatable */
274  if (!lua_isnil(L, -1))  /* name already in use? */
275    return 0;  /* leave previous value on top, but return 0 */
276  lua_pop(L, 1);
277  lua_newtable(L);  /* create metatable */
278  lua_pushvalue(L, -1);
279  lua_setfield(L, LUA_REGISTRYINDEX, tname);  /* registry.name = metatable */
280  return 1;
273   luaL_getmetatable(L, tname);  /* try to get metatable */
274   if (!lua_isnil(L, -1))  /* name already in use? */
275   return 0;  /* leave previous value on top, but return 0 */
276   lua_pop(L, 1);
277   lua_newtable(L);  /* create metatable */
278   lua_pushvalue(L, -1);
279   lua_setfield(L, LUA_REGISTRYINDEX, tname);  /* registry.name = metatable */
280   return 1;
281281}
282282
283283
284284LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) {
285  luaL_getmetatable(L, tname);
286  lua_setmetatable(L, -2);
285   luaL_getmetatable(L, tname);
286   lua_setmetatable(L, -2);
287287}
288288
289289
290290LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) {
291  void *p = lua_touserdata(L, ud);
292  if (p != NULL) {  /* value is a userdata? */
293    if (lua_getmetatable(L, ud)) {  /* does it have a metatable? */
294      luaL_getmetatable(L, tname);  /* get correct metatable */
295      if (!lua_rawequal(L, -1, -2))  /* not the same? */
296        p = NULL;  /* value is a userdata with wrong metatable */
297      lua_pop(L, 2);  /* remove both metatables */
298      return p;
299    }
300  }
301  return NULL;  /* value is not a userdata with a metatable */
291   void *p = lua_touserdata(L, ud);
292   if (p != NULL) {  /* value is a userdata? */
293   if (lua_getmetatable(L, ud)) {  /* does it have a metatable? */
294      luaL_getmetatable(L, tname);  /* get correct metatable */
295      if (!lua_rawequal(L, -1, -2))  /* not the same? */
296      p = NULL;  /* value is a userdata with wrong metatable */
297      lua_pop(L, 2);  /* remove both metatables */
298      return p;
299   }
300   }
301   return NULL;  /* value is not a userdata with a metatable */
302302}
303303
304304
305305LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {
306  void *p = luaL_testudata(L, ud, tname);
307  if (p == NULL) typeerror(L, ud, tname);
308  return p;
306   void *p = luaL_testudata(L, ud, tname);
307   if (p == NULL) typeerror(L, ud, tname);
308   return p;
309309}
310310
311311/* }====================================================== */
r31373r31374
318318*/
319319
320320LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
321                                 const char *const lst[]) {
322  const char *name = (def) ? luaL_optstring(L, narg, def) :
323                             luaL_checkstring(L, narg);
324  int i;
325  for (i=0; lst[i]; i++)
326    if (strcmp(lst[i], name) == 0)
327      return i;
328  return luaL_argerror(L, narg,
329                       lua_pushfstring(L, "invalid option " LUA_QS, name));
321                           const char *const lst[]) {
322   const char *name = (def) ? luaL_optstring(L, narg, def) :
323                        luaL_checkstring(L, narg);
324   int i;
325   for (i=0; lst[i]; i++)
326   if (strcmp(lst[i], name) == 0)
327      return i;
328   return luaL_argerror(L, narg,
329                  lua_pushfstring(L, "invalid option " LUA_QS, name));
330330}
331331
332332
333333LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg) {
334  /* keep some extra space to run error routines, if needed */
335  const int extra = LUA_MINSTACK;
336  if (!lua_checkstack(L, space + extra)) {
337    if (msg)
338      luaL_error(L, "stack overflow (%s)", msg);
339    else
340      luaL_error(L, "stack overflow");
341  }
334   /* keep some extra space to run error routines, if needed */
335   const int extra = LUA_MINSTACK;
336   if (!lua_checkstack(L, space + extra)) {
337   if (msg)
338      luaL_error(L, "stack overflow (%s)", msg);
339   else
340      luaL_error(L, "stack overflow");
341   }
342342}
343343
344344
345345LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) {
346  if (lua_type(L, narg) != t)
347    tag_error(L, narg, t);
346   if (lua_type(L, narg) != t)
347   tag_error(L, narg, t);
348348}
349349
350350
351351LUALIB_API void luaL_checkany (lua_State *L, int narg) {
352  if (lua_type(L, narg) == LUA_TNONE)
353    luaL_argerror(L, narg, "value expected");
352   if (lua_type(L, narg) == LUA_TNONE)
353   luaL_argerror(L, narg, "value expected");
354354}
355355
356356
357357LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) {
358  const char *s = lua_tolstring(L, narg, len);
359  if (!s) tag_error(L, narg, LUA_TSTRING);
360  return s;
358   const char *s = lua_tolstring(L, narg, len);
359   if (!s) tag_error(L, narg, LUA_TSTRING);
360   return s;
361361}
362362
363363
364364LUALIB_API const char *luaL_optlstring (lua_State *L, int narg,
365                                        const char *def, size_t *len) {
366  if (lua_isnoneornil(L, narg)) {
367    if (len)
368      *len = (def ? strlen(def) : 0);
369    return def;
370  }
371  else return luaL_checklstring(L, narg, len);
365                              const char *def, size_t *len) {
366   if (lua_isnoneornil(L, narg)) {
367   if (len)
368      *len = (def ? strlen(def) : 0);
369   return def;
370   }
371   else return luaL_checklstring(L, narg, len);
372372}
373373
374374
375375LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) {
376  int isnum;
377  lua_Number d = lua_tonumberx(L, narg, &isnum);
378  if (!isnum)
379    tag_error(L, narg, LUA_TNUMBER);
380  return d;
376   int isnum;
377   lua_Number d = lua_tonumberx(L, narg, &isnum);
378   if (!isnum)
379   tag_error(L, narg, LUA_TNUMBER);
380   return d;
381381}
382382
383383
384384LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) {
385  return luaL_opt(L, luaL_checknumber, narg, def);
385   return luaL_opt(L, luaL_checknumber, narg, def);
386386}
387387
388388
389389LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) {
390  int isnum;
391  lua_Integer d = lua_tointegerx(L, narg, &isnum);
392  if (!isnum)
393    tag_error(L, narg, LUA_TNUMBER);
394  return d;
390   int isnum;
391   lua_Integer d = lua_tointegerx(L, narg, &isnum);
392   if (!isnum)
393   tag_error(L, narg, LUA_TNUMBER);
394   return d;
395395}
396396
397397
398398LUALIB_API lua_Unsigned luaL_checkunsigned (lua_State *L, int narg) {
399  int isnum;
400  lua_Unsigned d = lua_tounsignedx(L, narg, &isnum);
401  if (!isnum)
402    tag_error(L, narg, LUA_TNUMBER);
403  return d;
399   int isnum;
400   lua_Unsigned d = lua_tounsignedx(L, narg, &isnum);
401   if (!isnum)
402   tag_error(L, narg, LUA_TNUMBER);
403   return d;
404404}
405405
406406
407407LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg,
408                                                      lua_Integer def) {
409  return luaL_opt(L, luaL_checkinteger, narg, def);
408                                          lua_Integer def) {
409   return luaL_opt(L, luaL_checkinteger, narg, def);
410410}
411411
412412
413413LUALIB_API lua_Unsigned luaL_optunsigned (lua_State *L, int narg,
414                                                        lua_Unsigned def) {
415  return luaL_opt(L, luaL_checkunsigned, narg, def);
414                                          lua_Unsigned def) {
415   return luaL_opt(L, luaL_checkunsigned, narg, def);
416416}
417417
418418/* }====================================================== */
r31373r31374
428428** check whether buffer is using a userdata on the stack as a temporary
429429** buffer
430430*/
431#define buffonstack(B)   ((B)->b != (B)->initb)
431#define buffonstack(B)  ((B)->b != (B)->initb)
432432
433433
434434/*
435435** returns a pointer to a free area with at least 'sz' bytes
436436*/
437437LUALIB_API char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz) {
438  lua_State *L = B->L;
439  if (B->size - B->n < sz) {  /* not enough space? */
440    char *newbuff;
441    size_t newsize = B->size * 2;  /* double buffer size */
442    if (newsize - B->n < sz)  /* not big enough? */
443      newsize = B->n + sz;
444    if (newsize < B->n || newsize - B->n < sz)
445      luaL_error(L, "buffer too large");
446    /* create larger buffer */
447    newbuff = (char *)lua_newuserdata(L, newsize * sizeof(char));
448    /* move content to new buffer */
449    memcpy(newbuff, B->b, B->n * sizeof(char));
450    if (buffonstack(B))
451      lua_remove(L, -2);  /* remove old buffer */
452    B->b = newbuff;
453    B->size = newsize;
454  }
455  return &B->b[B->n];
438   lua_State *L = B->L;
439   if (B->size - B->n < sz) {  /* not enough space? */
440   char *newbuff;
441   size_t newsize = B->size * 2;  /* double buffer size */
442   if (newsize - B->n < sz)  /* not big enough? */
443      newsize = B->n + sz;
444   if (newsize < B->n || newsize - B->n < sz)
445      luaL_error(L, "buffer too large");
446   /* create larger buffer */
447   newbuff = (char *)lua_newuserdata(L, newsize * sizeof(char));
448   /* move content to new buffer */
449   memcpy(newbuff, B->b, B->n * sizeof(char));
450   if (buffonstack(B))
451      lua_remove(L, -2);  /* remove old buffer */
452   B->b = newbuff;
453   B->size = newsize;
454   }
455   return &B->b[B->n];
456456}
457457
458458
459459LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) {
460  char *b = luaL_prepbuffsize(B, l);
461  memcpy(b, s, l * sizeof(char));
462  luaL_addsize(B, l);
460   char *b = luaL_prepbuffsize(B, l);
461   memcpy(b, s, l * sizeof(char));
462   luaL_addsize(B, l);
463463}
464464
465465
466466LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) {
467  luaL_addlstring(B, s, strlen(s));
467   luaL_addlstring(B, s, strlen(s));
468468}
469469
470470
471471LUALIB_API void luaL_pushresult (luaL_Buffer *B) {
472  lua_State *L = B->L;
473  lua_pushlstring(L, B->b, B->n);
474  if (buffonstack(B))
475    lua_remove(L, -2);  /* remove old buffer */
472   lua_State *L = B->L;
473   lua_pushlstring(L, B->b, B->n);
474   if (buffonstack(B))
475   lua_remove(L, -2);  /* remove old buffer */
476476}
477477
478478
479479LUALIB_API void luaL_pushresultsize (luaL_Buffer *B, size_t sz) {
480  luaL_addsize(B, sz);
481  luaL_pushresult(B);
480   luaL_addsize(B, sz);
481   luaL_pushresult(B);
482482}
483483
484484
485485LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
486  lua_State *L = B->L;
487  size_t l;
488  const char *s = lua_tolstring(L, -1, &l);
489  if (buffonstack(B))
490    lua_insert(L, -2);  /* put value below buffer */
491  luaL_addlstring(B, s, l);
492  lua_remove(L, (buffonstack(B)) ? -2 : -1);  /* remove value */
486   lua_State *L = B->L;
487   size_t l;
488   const char *s = lua_tolstring(L, -1, &l);
489   if (buffonstack(B))
490   lua_insert(L, -2);  /* put value below buffer */
491   luaL_addlstring(B, s, l);
492   lua_remove(L, (buffonstack(B)) ? -2 : -1);  /* remove value */
493493}
494494
495495
496496LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {
497  B->L = L;
498  B->b = B->initb;
499  B->n = 0;
500  B->size = LUAL_BUFFERSIZE;
497   B->L = L;
498   B->b = B->initb;
499   B->n = 0;
500   B->size = LUAL_BUFFERSIZE;
501501}
502502
503503
504504LUALIB_API char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz) {
505  luaL_buffinit(L, B);
506  return luaL_prepbuffsize(B, sz);
505   luaL_buffinit(L, B);
506   return luaL_prepbuffsize(B, sz);
507507}
508508
509509/* }====================================================== */
r31373r31374
516516*/
517517
518518/* index of free-list header */
519#define freelist   0
519#define freelist    0
520520
521521
522522LUALIB_API int luaL_ref (lua_State *L, int t) {
523  int ref;
524  if (lua_isnil(L, -1)) {
525    lua_pop(L, 1);  /* remove from stack */
526    return LUA_REFNIL;  /* `nil' has a unique fixed reference */
527  }
528  t = lua_absindex(L, t);
529  lua_rawgeti(L, t, freelist);  /* get first free element */
530  ref = (int)lua_tointeger(L, -1);  /* ref = t[freelist] */
531  lua_pop(L, 1);  /* remove it from stack */
532  if (ref != 0) {  /* any free element? */
533    lua_rawgeti(L, t, ref);  /* remove it from list */
534    lua_rawseti(L, t, freelist);  /* (t[freelist] = t[ref]) */
535  }
536  else  /* no free elements */
537    ref = (int)lua_rawlen(L, t) + 1;  /* get a new reference */
538  lua_rawseti(L, t, ref);
539  return ref;
523   int ref;
524   if (lua_isnil(L, -1)) {
525   lua_pop(L, 1);  /* remove from stack */
526   return LUA_REFNIL;  /* `nil' has a unique fixed reference */
527   }
528   t = lua_absindex(L, t);
529   lua_rawgeti(L, t, freelist);  /* get first free element */
530   ref = (int)lua_tointeger(L, -1);  /* ref = t[freelist] */
531   lua_pop(L, 1);  /* remove it from stack */
532   if (ref != 0) {  /* any free element? */
533   lua_rawgeti(L, t, ref);  /* remove it from list */
534   lua_rawseti(L, t, freelist);  /* (t[freelist] = t[ref]) */
535   }
536   else  /* no free elements */
537   ref = (int)lua_rawlen(L, t) + 1;  /* get a new reference */
538   lua_rawseti(L, t, ref);
539   return ref;
540540}
541541
542542
543543LUALIB_API void luaL_unref (lua_State *L, int t, int ref) {
544  if (ref >= 0) {
545    t = lua_absindex(L, t);
546    lua_rawgeti(L, t, freelist);
547    lua_rawseti(L, t, ref);  /* t[ref] = t[freelist] */
548    lua_pushinteger(L, ref);
549    lua_rawseti(L, t, freelist);  /* t[freelist] = ref */
550  }
544   if (ref >= 0) {
545   t = lua_absindex(L, t);
546   lua_rawgeti(L, t, freelist);
547   lua_rawseti(L, t, ref);  /* t[ref] = t[freelist] */
548   lua_pushinteger(L, ref);
549   lua_rawseti(L, t, freelist);  /* t[freelist] = ref */
550   }
551551}
552552
553553/* }====================================================== */
r31373r31374
560560*/
561561
562562typedef struct LoadF {
563  int n;  /* number of pre-read characters */
564  FILE *f;  /* file being read */
565  char buff[LUAL_BUFFERSIZE];  /* area for reading file */
563   int n;  /* number of pre-read characters */
564   FILE *f;  /* file being read */
565   char buff[LUAL_BUFFERSIZE];  /* area for reading file */
566566} LoadF;
567567
568568
569569static const char *getF (lua_State *L, void *ud, size_t *size) {
570  LoadF *lf = (LoadF *)ud;
571  (void)L;  /* not used */
572  if (lf->n > 0) {  /* are there pre-read characters to be read? */
573    *size = lf->n;  /* return them (chars already in buffer) */
574    lf->n = 0;  /* no more pre-read characters */
575  }
576  else {  /* read a block from file */
577    /* 'fread' can return > 0 *and* set the EOF flag. If next call to
578       'getF' called 'fread', it might still wait for user input.
579       The next check avoids this problem. */
580    if (feof(lf->f)) return NULL;
581    *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f);  /* read block */
582  }
583  return lf->buff;
570   LoadF *lf = (LoadF *)ud;
571   (void)L;  /* not used */
572   if (lf->n > 0) {  /* are there pre-read characters to be read? */
573   *size = lf->n;  /* return them (chars already in buffer) */
574   lf->n = 0;  /* no more pre-read characters */
575   }
576   else {  /* read a block from file */
577   /* 'fread' can return > 0 *and* set the EOF flag. If next call to
578      'getF' called 'fread', it might still wait for user input.
579      The next check avoids this problem. */
580   if (feof(lf->f)) return NULL;
581   *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f);  /* read block */
582   }
583   return lf->buff;
584584}
585585
586586
587587static int errfile (lua_State *L, const char *what, int fnameindex) {
588  const char *serr = strerror(errno);
589  const char *filename = lua_tostring(L, fnameindex) + 1;
590  lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr);
591  lua_remove(L, fnameindex);
592  return LUA_ERRFILE;
588   const char *serr = strerror(errno);
589   const char *filename = lua_tostring(L, fnameindex) + 1;
590   lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr);
591   lua_remove(L, fnameindex);
592   return LUA_ERRFILE;
593593}
594594
595595
596596static int skipBOM (LoadF *lf) {
597  const char *p = "\xEF\xBB\xBF";  /* Utf8 BOM mark */
598  int c;
599  lf->n = 0;
600  do {
601    c = getc(lf->f);
602    if (c == EOF || c != *(const unsigned char *)p++) return c;
603    lf->buff[lf->n++] = c;  /* to be read by the parser */
604  } while (*p != '\0');
605  lf->n = 0;  /* prefix matched; discard it */
606  return getc(lf->f);  /* return next character */
597   const char *p = "\xEF\xBB\xBF";  /* Utf8 BOM mark */
598   int c;
599   lf->n = 0;
600   do {
601   c = getc(lf->f);
602   if (c == EOF || c != *(const unsigned char *)p++) return c;
603   lf->buff[lf->n++] = c;  /* to be read by the parser */
604   } while (*p != '\0');
605   lf->n = 0;  /* prefix matched; discard it */
606   return getc(lf->f);  /* return next character */
607607}
608608
609609
r31373r31374
615615** a first-line comment).
616616*/
617617static int skipcomment (LoadF *lf, int *cp) {
618  int c = *cp = skipBOM(lf);
619  if (c == '#') {  /* first line is a comment (Unix exec. file)? */
620    do {  /* skip first line */
621      c = getc(lf->f);
622    } while (c != EOF && c != '\n') ;
623    *cp = getc(lf->f);  /* skip end-of-line, if present */
624    return 1;  /* there was a comment */
625  }
626  else return 0;  /* no comment */
618   int c = *cp = skipBOM(lf);
619   if (c == '#') {  /* first line is a comment (Unix exec. file)? */
620   do {  /* skip first line */
621      c = getc(lf->f);
622   } while (c != EOF && c != '\n') ;
623   *cp = getc(lf->f);  /* skip end-of-line, if present */
624   return 1;  /* there was a comment */
625   }
626   else return 0;  /* no comment */
627627}
628628
629629
630630LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename,
631                                             const char *mode) {
632  LoadF lf;
633  int status, readstatus;
634  int c;
635  int fnameindex = lua_gettop(L) + 1;  /* index of filename on the stack */
636  if (filename == NULL) {
637    lua_pushliteral(L, "=stdin");
638    lf.f = stdin;
639  }
640  else {
641    lua_pushfstring(L, "@%s", filename);
642    lf.f = fopen(filename, "r");
643    if (lf.f == NULL) return errfile(L, "open", fnameindex);
644  }
645  if (skipcomment(&lf, &c))  /* read initial portion */
646    lf.buff[lf.n++] = '\n';  /* add line to correct line numbers */
647  if (c == LUA_SIGNATURE[0] && filename) {  /* binary file? */
648    lf.f = freopen(filename, "rb", lf.f);  /* reopen in binary mode */
649    if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
650    skipcomment(&lf, &c);  /* re-read initial portion */
651  }
652  if (c != EOF)
653    lf.buff[lf.n++] = c;  /* 'c' is the first character of the stream */
654  status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode);
655  readstatus = ferror(lf.f);
656  if (filename) fclose(lf.f);  /* close file (even in case of errors) */
657  if (readstatus) {
658    lua_settop(L, fnameindex);  /* ignore results from `lua_load' */
659    return errfile(L, "read", fnameindex);
660  }
661  lua_remove(L, fnameindex);
662  return status;
631                                    const char *mode) {
632   LoadF lf;
633   int status, readstatus;
634   int c;
635   int fnameindex = lua_gettop(L) + 1;  /* index of filename on the stack */
636   if (filename == NULL) {
637   lua_pushliteral(L, "=stdin");
638   lf.f = stdin;
639   }
640   else {
641   lua_pushfstring(L, "@%s", filename);
642   lf.f = fopen(filename, "r");
643   if (lf.f == NULL) return errfile(L, "open", fnameindex);
644   }
645   if (skipcomment(&lf, &c))  /* read initial portion */
646   lf.buff[lf.n++] = '\n';  /* add line to correct line numbers */
647   if (c == LUA_SIGNATURE[0] && filename) {  /* binary file? */
648   lf.f = freopen(filename, "rb", lf.f);  /* reopen in binary mode */
649   if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
650   skipcomment(&lf, &c);  /* re-read initial portion */
651   }
652   if (c != EOF)
653   lf.buff[lf.n++] = c;  /* 'c' is the first character of the stream */
654   status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode);
655   readstatus = ferror(lf.f);
656   if (filename) fclose(lf.f);  /* close file (even in case of errors) */
657   if (readstatus) {
658   lua_settop(L, fnameindex);  /* ignore results from `lua_load' */
659   return errfile(L, "read", fnameindex);
660   }
661   lua_remove(L, fnameindex);
662   return status;
663663}
664664
665665
666666typedef struct LoadS {
667  const char *s;
668  size_t size;
667   const char *s;
668   size_t size;
669669} LoadS;
670670
671671
672672static const char *getS (lua_State *L, void *ud, size_t *size) {
673  LoadS *ls = (LoadS *)ud;
674  (void)L;  /* not used */
675  if (ls->size == 0) return NULL;
676  *size = ls->size;
677  ls->size = 0;
678  return ls->s;
673   LoadS *ls = (LoadS *)ud;
674   (void)L;  /* not used */
675   if (ls->size == 0) return NULL;
676   *size = ls->size;
677   ls->size = 0;
678   return ls->s;
679679}
680680
681681
682682LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t size,
683                                 const char *name, const char *mode) {
684  LoadS ls;
685  ls.s = buff;
686  ls.size = size;
687  return lua_load(L, getS, &ls, name, mode);
683                           const char *name, const char *mode) {
684   LoadS ls;
685   ls.s = buff;
686   ls.size = size;
687   return lua_load(L, getS, &ls, name, mode);
688688}
689689
690690
691691LUALIB_API int luaL_loadstring (lua_State *L, const char *s) {
692  return luaL_loadbuffer(L, s, strlen(s), s);
692   return luaL_loadbuffer(L, s, strlen(s), s);
693693}
694694
695695/* }====================================================== */
r31373r31374
697697
698698
699699LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {
700  if (!lua_getmetatable(L, obj))  /* no metatable? */
701    return 0;
702  lua_pushstring(L, event);
703  lua_rawget(L, -2);
704  if (lua_isnil(L, -1)) {
705    lua_pop(L, 2);  /* remove metatable and metafield */
706    return 0;
707  }
708  else {
709    lua_remove(L, -2);  /* remove only metatable */
710    return 1;
711  }
700   if (!lua_getmetatable(L, obj))  /* no metatable? */
701   return 0;
702   lua_pushstring(L, event);
703   lua_rawget(L, -2);
704   if (lua_isnil(L, -1)) {
705   lua_pop(L, 2);  /* remove metatable and metafield */
706   return 0;
707   }
708   else {
709   lua_remove(L, -2);  /* remove only metatable */
710   return 1;
711   }
712712}
713713
714714
715715LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) {
716  obj = lua_absindex(L, obj);
717  if (!luaL_getmetafield(L, obj, event))  /* no metafield? */
718    return 0;
719  lua_pushvalue(L, obj);
720  lua_call(L, 1, 1);
721  return 1;
716   obj = lua_absindex(L, obj);
717   if (!luaL_getmetafield(L, obj, event))  /* no metafield? */
718   return 0;
719   lua_pushvalue(L, obj);
720   lua_call(L, 1, 1);
721   return 1;
722722}
723723
724724
725725LUALIB_API int luaL_len (lua_State *L, int idx) {
726  int l;
727  int isnum;
728  lua_len(L, idx);
729  l = (int)lua_tointegerx(L, -1, &isnum);
730  if (!isnum)
731    luaL_error(L, "object length is not a number");
732  lua_pop(L, 1);  /* remove object */
733  return l;
726   int l;
727   int isnum;
728   lua_len(L, idx);
729   l = (int)lua_tointegerx(L, -1, &isnum);
730   if (!isnum)
731   luaL_error(L, "object length is not a number");
732   lua_pop(L, 1);  /* remove object */
733   return l;
734734}
735735
736736
737737LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {
738  if (!luaL_callmeta(L, idx, "__tostring")) {  /* no metafield? */
739    switch (lua_type(L, idx)) {
740      case LUA_TNUMBER:
741      case LUA_TSTRING:
742        lua_pushvalue(L, idx);
743        break;
744      case LUA_TBOOLEAN:
745        lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false"));
746        break;
747      case LUA_TNIL:
748        lua_pushliteral(L, "nil");
749        break;
750      default:
751        lua_pushfstring(L, "%s: %p", luaL_typename(L, idx),
752                                            lua_topointer(L, idx));
753        break;
754    }
755  }
756  return lua_tolstring(L, -1, len);
738   if (!luaL_callmeta(L, idx, "__tostring")) {  /* no metafield? */
739   switch (lua_type(L, idx)) {
740      case LUA_TNUMBER:
741      case LUA_TSTRING:
742      lua_pushvalue(L, idx);
743      break;
744      case LUA_TBOOLEAN:
745      lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false"));
746      break;
747      case LUA_TNIL:
748      lua_pushliteral(L, "nil");
749      break;
750      default:
751      lua_pushfstring(L, "%s: %p", luaL_typename(L, idx),
752                                 lua_topointer(L, idx));
753      break;
754   }
755   }
756   return lua_tolstring(L, -1, len);
757757}
758758
759759
r31373r31374
765765#if defined(LUA_COMPAT_MODULE)
766766
767767static const char *luaL_findtable (lua_State *L, int idx,
768                                   const char *fname, int szhint) {
769  const char *e;
770  if (idx) lua_pushvalue(L, idx);
771  do {
772    e = strchr(fname, '.');
773    if (e == NULL) e = fname + strlen(fname);
774    lua_pushlstring(L, fname, e - fname);
775    lua_rawget(L, -2);
776    if (lua_isnil(L, -1)) {  /* no such field? */
777      lua_pop(L, 1);  /* remove this nil */
778      lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */
779      lua_pushlstring(L, fname, e - fname);
780      lua_pushvalue(L, -2);
781      lua_settable(L, -4);  /* set new table into field */
782    }
783    else if (!lua_istable(L, -1)) {  /* field has a non-table value? */
784      lua_pop(L, 2);  /* remove table and value */
785      return fname;  /* return problematic part of the name */
786    }
787    lua_remove(L, -2);  /* remove previous table */
788    fname = e + 1;
789  } while (*e == '.');
790  return NULL;
768                           const char *fname, int szhint) {
769   const char *e;
770   if (idx) lua_pushvalue(L, idx);
771   do {
772   e = strchr(fname, '.');
773   if (e == NULL) e = fname + strlen(fname);
774   lua_pushlstring(L, fname, e - fname);
775   lua_rawget(L, -2);
776   if (lua_isnil(L, -1)) {  /* no such field? */
777      lua_pop(L, 1);  /* remove this nil */
778      lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */
779      lua_pushlstring(L, fname, e - fname);
780      lua_pushvalue(L, -2);
781      lua_settable(L, -4);  /* set new table into field */
782   }
783   else if (!lua_istable(L, -1)) {  /* field has a non-table value? */
784      lua_pop(L, 2);  /* remove table and value */
785      return fname;  /* return problematic part of the name */
786   }
787   lua_remove(L, -2);  /* remove previous table */
788   fname = e + 1;
789   } while (*e == '.');
790   return NULL;
791791}
792792
793793
r31373r31374
795795** Count number of elements in a luaL_Reg list.
796796*/
797797static int libsize (const luaL_Reg *l) {
798  int size = 0;
799  for (; l && l->name; l++) size++;
800  return size;
798   int size = 0;
799   for (; l && l->name; l++) size++;
800   return size;
801801}
802802
803803
r31373r31374
808808** the module table.
809809*/
810810LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname,
811                                 int sizehint) {
812  luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1);  /* get _LOADED table */
813  lua_getfield(L, -1, modname);  /* get _LOADED[modname] */
814  if (!lua_istable(L, -1)) {  /* not found? */
815    lua_pop(L, 1);  /* remove previous result */
816    /* try global variable (and create one if it does not exist) */
817    lua_pushglobaltable(L);
818    if (luaL_findtable(L, 0, modname, sizehint) != NULL)
819      luaL_error(L, "name conflict for module " LUA_QS, modname);
820    lua_pushvalue(L, -1);
821    lua_setfield(L, -3, modname);  /* _LOADED[modname] = new table */
822  }
823  lua_remove(L, -2);  /* remove _LOADED table */
811                           int sizehint) {
812   luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1);  /* get _LOADED table */
813   lua_getfield(L, -1, modname);  /* get _LOADED[modname] */
814   if (!lua_istable(L, -1)) {  /* not found? */
815   lua_pop(L, 1);  /* remove previous result */
816   /* try global variable (and create one if it does not exist) */
817   lua_pushglobaltable(L);
818   if (luaL_findtable(L, 0, modname, sizehint) != NULL)
819      luaL_error(L, "name conflict for module " LUA_QS, modname);
820   lua_pushvalue(L, -1);
821   lua_setfield(L, -3, modname);  /* _LOADED[modname] = new table */
822   }
823   lua_remove(L, -2);  /* remove _LOADED table */
824824}
825825
826826
827827LUALIB_API void luaL_openlib (lua_State *L, const char *libname,
828                               const luaL_Reg *l, int nup) {
829  luaL_checkversion(L);
830  if (libname) {
831    luaL_pushmodule(L, libname, libsize(l));  /* get/create library table */
832    lua_insert(L, -(nup + 1));  /* move library table to below upvalues */
833  }
834  if (l)
835    luaL_setfuncs(L, l, nup);
836  else
837    lua_pop(L, nup);  /* remove upvalues */
828                        const luaL_Reg *l, int nup) {
829   luaL_checkversion(L);
830   if (libname) {
831   luaL_pushmodule(L, libname, libsize(l));  /* get/create library table */
832   lua_insert(L, -(nup + 1));  /* move library table to below upvalues */
833   }
834   if (l)
835   luaL_setfuncs(L, l, nup);
836   else
837   lua_pop(L, nup);  /* remove upvalues */
838838}
839839
840840#endif
r31373r31374
846846** Returns with only the table at the stack.
847847*/
848848LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
849  luaL_checkversion(L);
850  luaL_checkstack(L, nup, "too many upvalues");
851  for (; l->name != NULL; l++) {  /* fill the table with given functions */
852    int i;
853    for (i = 0; i < nup; i++)  /* copy upvalues to the top */
854      lua_pushvalue(L, -nup);
855    lua_pushcclosure(L, l->func, nup);  /* closure with those upvalues */
856    lua_setfield(L, -(nup + 2), l->name);
857  }
858  lua_pop(L, nup);  /* remove upvalues */
849   luaL_checkversion(L);
850   luaL_checkstack(L, nup, "too many upvalues");
851   for (; l->name != NULL; l++) {  /* fill the table with given functions */
852   int i;
853   for (i = 0; i < nup; i++)  /* copy upvalues to the top */
854      lua_pushvalue(L, -nup);
855   lua_pushcclosure(L, l->func, nup);  /* closure with those upvalues */
856   lua_setfield(L, -(nup + 2), l->name);
857   }
858   lua_pop(L, nup);  /* remove upvalues */
859859}
860860
861861
r31373r31374
864864** into the stack
865865*/
866866LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) {
867  lua_getfield(L, idx, fname);
868  if (lua_istable(L, -1)) return 1;  /* table already there */
869  else {
870    lua_pop(L, 1);  /* remove previous result */
871    idx = lua_absindex(L, idx);
872    lua_newtable(L);
873    lua_pushvalue(L, -1);  /* copy to be left at top */
874    lua_setfield(L, idx, fname);  /* assign new table to field */
875    return 0;  /* false, because did not find table there */
876  }
867   lua_getfield(L, idx, fname);
868   if (lua_istable(L, -1)) return 1;  /* table already there */
869   else {
870   lua_pop(L, 1);  /* remove previous result */
871   idx = lua_absindex(L, idx);
872   lua_newtable(L);
873   lua_pushvalue(L, -1);  /* copy to be left at top */
874   lua_setfield(L, idx, fname);  /* assign new table to field */
875   return 0;  /* false, because did not find table there */
876   }
877877}
878878
879879
r31373r31374
884884** Leaves resulting module on the top.
885885*/
886886LUALIB_API void luaL_requiref (lua_State *L, const char *modname,
887                               lua_CFunction openf, int glb) {
888  lua_pushcfunction(L, openf);
889  lua_pushstring(L, modname);  /* argument to open function */
890  lua_call(L, 1, 1);  /* open module */
891  luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
892  lua_pushvalue(L, -2);  /* make copy of module (call result) */
893  lua_setfield(L, -2, modname);  /* _LOADED[modname] = module */
894  lua_pop(L, 1);  /* remove _LOADED table */
895  if (glb) {
896    lua_pushvalue(L, -1);  /* copy of 'mod' */
897    lua_setglobal(L, modname);  /* _G[modname] = module */
898  }
887                        lua_CFunction openf, int glb) {
888   lua_pushcfunction(L, openf);
889   lua_pushstring(L, modname);  /* argument to open function */
890   lua_call(L, 1, 1);  /* open module */
891   luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
892   lua_pushvalue(L, -2);  /* make copy of module (call result) */
893   lua_setfield(L, -2, modname);  /* _LOADED[modname] = module */
894   lua_pop(L, 1);  /* remove _LOADED table */
895   if (glb) {
896   lua_pushvalue(L, -1);  /* copy of 'mod' */
897   lua_setglobal(L, modname);  /* _G[modname] = module */
898   }
899899}
900900
901901
902902LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p,
903                                                               const char *r) {
904  const char *wild;
905  size_t l = strlen(p);
906  luaL_Buffer b;
907  luaL_buffinit(L, &b);
908  while ((wild = strstr(s, p)) != NULL) {
909    luaL_addlstring(&b, s, wild - s);  /* push prefix */
910    luaL_addstring(&b, r);  /* push replacement in place of pattern */
911    s = wild + l;  /* continue after `p' */
912  }
913  luaL_addstring(&b, s);  /* push last suffix */
914  luaL_pushresult(&b);
915  return lua_tostring(L, -1);
903                                                const char *r) {
904   const char *wild;
905   size_t l = strlen(p);
906   luaL_Buffer b;
907   luaL_buffinit(L, &b);
908   while ((wild = strstr(s, p)) != NULL) {
909   luaL_addlstring(&b, s, wild - s);  /* push prefix */
910   luaL_addstring(&b, r);  /* push replacement in place of pattern */
911   s = wild + l;  /* continue after `p' */
912   }
913   luaL_addstring(&b, s);  /* push last suffix */
914   luaL_pushresult(&b);
915   return lua_tostring(L, -1);
916916}
917917
918918
919919static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
920  (void)ud; (void)osize;  /* not used */
921  if (nsize == 0) {
922    free(ptr);
923    return NULL;
924  }
925  else
926    return realloc(ptr, nsize);
920   (void)ud; (void)osize;  /* not used */
921   if (nsize == 0) {
922   free(ptr);
923   return NULL;
924   }
925   else
926   return realloc(ptr, nsize);
927927}
928928
929929
930930static int panic (lua_State *L) {
931  luai_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n",
932                   lua_tostring(L, -1));
933  return 0;  /* return to Lua to abort */
931   luai_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n",
932               lua_tostring(L, -1));
933   return 0;  /* return to Lua to abort */
934934}
935935
936936
937937LUALIB_API lua_State *luaL_newstate (void) {
938  lua_State *L = lua_newstate(l_alloc, NULL);
939  if (L) lua_atpanic(L, &panic);
940  return L;
938   lua_State *L = lua_newstate(l_alloc, NULL);
939   if (L) lua_atpanic(L, &panic);
940   return L;
941941}
942942
943943
944944LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver) {
945  const lua_Number *v = lua_version(L);
946  if (v != lua_version(NULL))
947    luaL_error(L, "multiple Lua VMs detected");
948  else if (*v != ver)
949    luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f",
950                  ver, *v);
951  /* check conversions number -> integer types */
952  lua_pushnumber(L, -(lua_Number)0x1234);
953  if (lua_tointeger(L, -1) != -0x1234 ||
954      lua_tounsigned(L, -1) != (lua_Unsigned)-0x1234)
955    luaL_error(L, "bad conversion number->int;"
956                  " must recompile Lua with proper settings");
957  lua_pop(L, 1);
945   const lua_Number *v = lua_version(L);
946   if (v != lua_version(NULL))
947   luaL_error(L, "multiple Lua VMs detected");
948   else if (*v != ver)
949   luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f",
950               ver, *v);
951   /* check conversions number -> integer types */
952   lua_pushnumber(L, -(lua_Number)0x1234);
953   if (lua_tointeger(L, -1) != -0x1234 ||
954      lua_tounsigned(L, -1) != (lua_Unsigned)-0x1234)
955   luaL_error(L, "bad conversion number->int;"
956               " must recompile Lua with proper settings");
957   lua_pop(L, 1);
958958}
959
trunk/src/lib/lua/ldebug.c
r31373r31374
3030
3131
3232
33#define noLuaClosure(f)      ((f) == NULL || (f)->c.tt == LUA_TCCL)
33#define noLuaClosure(f)     ((f) == NULL || (f)->c.tt == LUA_TCCL)
3434
3535
3636static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name);
3737
3838
3939static int currentpc (CallInfo *ci) {
40  lua_assert(isLua(ci));
41  return pcRel(ci->u.l.savedpc, ci_func(ci)->p);
40   lua_assert(isLua(ci));
41   return pcRel(ci->u.l.savedpc, ci_func(ci)->p);
4242}
4343
4444
4545static int currentline (CallInfo *ci) {
46  return getfuncline(ci_func(ci)->p, currentpc(ci));
46   return getfuncline(ci_func(ci)->p, currentpc(ci));
4747}
4848
4949
r31373r31374
5151** this function can be called asynchronous (e.g. during a signal)
5252*/
5353LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) {
54  if (func == NULL || mask == 0) {  /* turn off hooks? */
55    mask = 0;
56    func = NULL;
57  }
58  if (isLua(L->ci))
59    L->oldpc = L->ci->u.l.savedpc;
60  L->hook = func;
61  L->basehookcount = count;
62  resethookcount(L);
63  L->hookmask = cast_byte(mask);
64  return 1;
54   if (func == NULL || mask == 0) {  /* turn off hooks? */
55   mask = 0;
56   func = NULL;
57   }
58   if (isLua(L->ci))
59   L->oldpc = L->ci->u.l.savedpc;
60   L->hook = func;
61   L->basehookcount = count;
62   resethookcount(L);
63   L->hookmask = cast_byte(mask);
64   return 1;
6565}
6666
6767
6868LUA_API lua_Hook lua_gethook (lua_State *L) {
69  return L->hook;
69   return L->hook;
7070}
7171
7272
7373LUA_API int lua_gethookmask (lua_State *L) {
74  return L->hookmask;
74   return L->hookmask;
7575}
7676
7777
7878LUA_API int lua_gethookcount (lua_State *L) {
79  return L->basehookcount;
79   return L->basehookcount;
8080}
8181
8282
8383LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) {
84  int status;
85  CallInfo *ci;
86  if (level < 0) return 0;  /* invalid (negative) level */
87  lua_lock(L);
88  for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous)
89    level--;
90  if (level == 0 && ci != &L->base_ci) {  /* level found? */
91    status = 1;
92    ar->i_ci = ci;
93  }
94  else status = 0;  /* no such level */
95  lua_unlock(L);
96  return status;
84   int status;
85   CallInfo *ci;
86   if (level < 0) return 0;  /* invalid (negative) level */
87   lua_lock(L);
88   for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous)
89   level--;
90   if (level == 0 && ci != &L->base_ci) {  /* level found? */
91   status = 1;
92   ar->i_ci = ci;
93   }
94   else status = 0;  /* no such level */
95   lua_unlock(L);
96   return status;
9797}
9898
9999
100100static const char *upvalname (Proto *p, int uv) {
101  TString *s = check_exp(uv < p->sizeupvalues, p->upvalues[uv].name);
102  if (s == NULL) return "?";
103  else return getstr(s);
101   TString *s = check_exp(uv < p->sizeupvalues, p->upvalues[uv].name);
102   if (s == NULL) return "?";
103   else return getstr(s);
104104}
105105
106106
107107static const char *findvararg (CallInfo *ci, int n, StkId *pos) {
108  int nparams = clLvalue(ci->func)->p->numparams;
109  if (n >= ci->u.l.base - ci->func - nparams)
110    return NULL;  /* no such vararg */
111  else {
112    *pos = ci->func + nparams + n;
113    return "(*vararg)";  /* generic name for any vararg */
114  }
108   int nparams = clLvalue(ci->func)->p->numparams;
109   if (n >= ci->u.l.base - ci->func - nparams)
110   return NULL;  /* no such vararg */
111   else {
112   *pos = ci->func + nparams + n;
113   return "(*vararg)";  /* generic name for any vararg */
114   }
115115}
116116
117117
118118static const char *findlocal (lua_State *L, CallInfo *ci, int n,
119                              StkId *pos) {
120  const char *name = NULL;
121  StkId base;
122  if (isLua(ci)) {
123    if (n < 0)  /* access to vararg values? */
124      return findvararg(ci, -n, pos);
125    else {
126      base = ci->u.l.base;
127      name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));
128    }
129  }
130  else
131    base = ci->func + 1;
132  if (name == NULL) {  /* no 'standard' name? */
133    StkId limit = (ci == L->ci) ? L->top : ci->next->func;
134    if (limit - base >= n && n > 0)  /* is 'n' inside 'ci' stack? */
135      name = "(*temporary)";  /* generic name for any valid slot */
136    else
137      return NULL;  /* no name */
138  }
139  *pos = base + (n - 1);
140  return name;
119                        StkId *pos) {
120   const char *name = NULL;
121   StkId base;
122   if (isLua(ci)) {
123   if (n < 0)  /* access to vararg values? */
124      return findvararg(ci, -n, pos);
125   else {
126      base = ci->u.l.base;
127      name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci));
128   }
129   }
130   else
131   base = ci->func + 1;
132   if (name == NULL) {  /* no 'standard' name? */
133   StkId limit = (ci == L->ci) ? L->top : ci->next->func;
134   if (limit - base >= n && n > 0)  /* is 'n' inside 'ci' stack? */
135      name = "(*temporary)";  /* generic name for any valid slot */
136   else
137      return NULL;  /* no name */
138   }
139   *pos = base + (n - 1);
140   return name;
141141}
142142
143143
144144LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
145  const char *name;
146  lua_lock(L);
147  if (ar == NULL) {  /* information about non-active function? */
148    if (!isLfunction(L->top - 1))  /* not a Lua function? */
149      name = NULL;
150    else  /* consider live variables at function start (parameters) */
151      name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0);
152  }
153  else {  /* active function; get information through 'ar' */
154    StkId pos = 0;  /* to avoid warnings */
155    name = findlocal(L, ar->i_ci, n, &pos);
156    if (name) {
157      setobj2s(L, L->top, pos);
158      api_incr_top(L);
159    }
160  }
161  lua_unlock(L);
162  return name;
145   const char *name;
146   lua_lock(L);
147   if (ar == NULL) {  /* information about non-active function? */
148   if (!isLfunction(L->top - 1))  /* not a Lua function? */
149      name = NULL;
150   else  /* consider live variables at function start (parameters) */
151      name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0);
152   }
153   else {  /* active function; get information through 'ar' */
154   StkId pos = 0;  /* to avoid warnings */
155   name = findlocal(L, ar->i_ci, n, &pos);
156   if (name) {
157      setobj2s(L, L->top, pos);
158      api_incr_top(L);
159   }
160   }
161   lua_unlock(L);
162   return name;
163163}
164164
165165
166166LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
167  StkId pos = 0;  /* to avoid warnings */
168  const char *name = findlocal(L, ar->i_ci, n, &pos);
169  lua_lock(L);
170  if (name)
171    setobjs2s(L, pos, L->top - 1);
172  L->top--;  /* pop value */
173  lua_unlock(L);
174  return name;
167   StkId pos = 0;  /* to avoid warnings */
168   const char *name = findlocal(L, ar->i_ci, n, &pos);
169   lua_lock(L);
170   if (name)
171   setobjs2s(L, pos, L->top - 1);
172   L->top--;  /* pop value */
173   lua_unlock(L);
174   return name;
175175}
176176
177177
178178static void funcinfo (lua_Debug *ar, Closure *cl) {
179  if (noLuaClosure(cl)) {
180    ar->source = "=[C]";
181    ar->linedefined = -1;
182    ar->lastlinedefined = -1;
183    ar->what = "C";
184  }
185  else {
186    Proto *p = cl->l.p;
187    ar->source = p->source ? getstr(p->source) : "=?";
188    ar->linedefined = p->linedefined;
189    ar->lastlinedefined = p->lastlinedefined;
190    ar->what = (ar->linedefined == 0) ? "main" : "Lua";
191  }
192  luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE);
179   if (noLuaClosure(cl)) {
180   ar->source = "=[C]";
181   ar->linedefined = -1;
182   ar->lastlinedefined = -1;
183   ar->what = "C";
184   }
185   else {
186   Proto *p = cl->l.p;
187   ar->source = p->source ? getstr(p->source) : "=?";
188   ar->linedefined = p->linedefined;
189   ar->lastlinedefined = p->lastlinedefined;
190   ar->what = (ar->linedefined == 0) ? "main" : "Lua";
191   }
192   luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE);
193193}
194194
195195
196196static void collectvalidlines (lua_State *L, Closure *f) {
197  if (noLuaClosure(f)) {
198    setnilvalue(L->top);
199    api_incr_top(L);
200  }
201  else {
202    int i;
203    TValue v;
204    int *lineinfo = f->l.p->lineinfo;
205    Table *t = luaH_new(L);  /* new table to store active lines */
206    sethvalue(L, L->top, t);  /* push it on stack */
207    api_incr_top(L);
208    setbvalue(&v, 1);  /* boolean 'true' to be the value of all indices */
209    for (i = 0; i < f->l.p->sizelineinfo; i++)  /* for all lines with code */
210      luaH_setint(L, t, lineinfo[i], &v);  /* table[line] = true */
211  }
197   if (noLuaClosure(f)) {
198   setnilvalue(L->top);
199   api_incr_top(L);
200   }
201   else {
202   int i;
203   TValue v;
204   int *lineinfo = f->l.p->lineinfo;
205   Table *t = luaH_new(L);  /* new table to store active lines */
206   sethvalue(L, L->top, t);  /* push it on stack */
207   api_incr_top(L);
208   setbvalue(&v, 1);  /* boolean 'true' to be the value of all indices */
209   for (i = 0; i < f->l.p->sizelineinfo; i++)  /* for all lines with code */
210      luaH_setint(L, t, lineinfo[i], &v);  /* table[line] = true */
211   }
212212}
213213
214214
215215static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar,
216                       Closure *f, CallInfo *ci) {
217  int status = 1;
218  for (; *what; what++) {
219    switch (*what) {
220      case 'S': {
221        funcinfo(ar, f);
222        break;
223      }
224      case 'l': {
225        ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1;
226        break;
227      }
228      case 'u': {
229        ar->nups = (f == NULL) ? 0 : f->c.nupvalues;
230        if (noLuaClosure(f)) {
231          ar->isvararg = 1;
232          ar->nparams = 0;
233        }
234        else {
235          ar->isvararg = f->l.p->is_vararg;
236          ar->nparams = f->l.p->numparams;
237        }
238        break;
239      }
240      case 't': {
241        ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0;
242        break;
243      }
244      case 'n': {
245        /* calling function is a known Lua function? */
246        if (ci && !(ci->callstatus & CIST_TAIL) && isLua(ci->previous))
247          ar->namewhat = getfuncname(L, ci->previous, &ar->name);
248        else
249          ar->namewhat = NULL;
250        if (ar->namewhat == NULL) {
251          ar->namewhat = "";  /* not found */
252          ar->name = NULL;
253        }
254        break;
255      }
256      case 'L':
257      case 'f':  /* handled by lua_getinfo */
258        break;
259      default: status = 0;  /* invalid option */
260    }
261  }
262  return status;
216                  Closure *f, CallInfo *ci) {
217   int status = 1;
218   for (; *what; what++) {
219   switch (*what) {
220      case 'S': {
221      funcinfo(ar, f);
222      break;
223      }
224      case 'l': {
225      ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1;
226      break;
227      }
228      case 'u': {
229      ar->nups = (f == NULL) ? 0 : f->c.nupvalues;
230      if (noLuaClosure(f)) {
231         ar->isvararg = 1;
232         ar->nparams = 0;
233      }
234      else {
235         ar->isvararg = f->l.p->is_vararg;
236         ar->nparams = f->l.p->numparams;
237      }
238      break;
239      }
240      case 't': {
241      ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0;
242      break;
243      }
244      case 'n': {
245      /* calling function is a known Lua function? */
246      if (ci && !(ci->callstatus & CIST_TAIL) && isLua(ci->previous))
247         ar->namewhat = getfuncname(L, ci->previous, &ar->name);
248      else
249         ar->namewhat = NULL;
250      if (ar->namewhat == NULL) {
251         ar->namewhat = "";  /* not found */
252         ar->name = NULL;
253      }
254      break;
255      }
256      case 'L':
257      case 'f':  /* handled by lua_getinfo */
258      break;
259      default: status = 0;  /* invalid option */
260   }
261   }
262   return status;
263263}
264264
265265
266266LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
267  int status;
268  Closure *cl;
269  CallInfo *ci;
270  StkId func;
271  lua_lock(L);
272  if (*what == '>') {
273    ci = NULL;
274    func = L->top - 1;
275    api_check(L, ttisfunction(func), "function expected");
276    what++;  /* skip the '>' */
277    L->top--;  /* pop function */
278  }
279  else {
280    ci = ar->i_ci;
281    func = ci->func;
282    lua_assert(ttisfunction(ci->func));
283  }
284  cl = ttisclosure(func) ? clvalue(func) : NULL;
285  status = auxgetinfo(L, what, ar, cl, ci);
286  if (strchr(what, 'f')) {
287    setobjs2s(L, L->top, func);
288    api_incr_top(L);
289  }
290  if (strchr(what, 'L'))
291    collectvalidlines(L, cl);
292  lua_unlock(L);
293  return status;
267   int status;
268   Closure *cl;
269   CallInfo *ci;
270   StkId func;
271   lua_lock(L);
272   if (*what == '>') {
273   ci = NULL;
274   func = L->top - 1;
275   api_check(L, ttisfunction(func), "function expected");
276   what++;  /* skip the '>' */
277   L->top--;  /* pop function */
278   }
279   else {
280   ci = ar->i_ci;
281   func = ci->func;
282   lua_assert(ttisfunction(ci->func));
283   }
284   cl = ttisclosure(func) ? clvalue(func) : NULL;
285   status = auxgetinfo(L, what, ar, cl, ci);
286   if (strchr(what, 'f')) {
287   setobjs2s(L, L->top, func);
288   api_incr_top(L);
289   }
290   if (strchr(what, 'L'))
291   collectvalidlines(L, cl);
292   lua_unlock(L);
293   return status;
294294}
295295
296296
r31373r31374
301301*/
302302
303303static const char *getobjname (Proto *p, int lastpc, int reg,
304                               const char **name);
304                        const char **name);
305305
306306
307307/*
308308** find a "name" for the RK value 'c'
309309*/
310310static void kname (Proto *p, int pc, int c, const char **name) {
311  if (ISK(c)) {  /* is 'c' a constant? */
312    TValue *kvalue = &p->k[INDEXK(c)];
313    if (ttisstring(kvalue)) {  /* literal constant? */
314      *name = svalue(kvalue);  /* it is its own name */
315      return;
316    }
317    /* else no reasonable name found */
318  }
319  else {  /* 'c' is a register */
320    const char *what = getobjname(p, pc, c, name); /* search for 'c' */
321    if (what && *what == 'c') {  /* found a constant name? */
322      return;  /* 'name' already filled */
323    }
324    /* else no reasonable name found */
325  }
326  *name = "?";  /* no reasonable name found */
311   if (ISK(c)) {  /* is 'c' a constant? */
312   TValue *kvalue = &p->k[INDEXK(c)];
313   if (ttisstring(kvalue)) {  /* literal constant? */
314      *name = svalue(kvalue);  /* it is its own name */
315      return;
316   }
317   /* else no reasonable name found */
318   }
319   else {  /* 'c' is a register */
320   const char *what = getobjname(p, pc, c, name); /* search for 'c' */
321   if (what && *what == 'c') {  /* found a constant name? */
322      return;  /* 'name' already filled */
323   }
324   /* else no reasonable name found */
325   }
326   *name = "?";  /* no reasonable name found */
327327}
328328
329329
330330static int filterpc (int pc, int jmptarget) {
331  if (pc < jmptarget)  /* is code conditional (inside a jump)? */
332    return -1;  /* cannot know who sets that register */
333  else return pc;  /* current position sets that register */
331   if (pc < jmptarget)  /* is code conditional (inside a jump)? */
332   return -1;  /* cannot know who sets that register */
333   else return pc;  /* current position sets that register */
334334}
335335
336336
r31373r31374
338338** try to find last instruction before 'lastpc' that modified register 'reg'
339339*/
340340static int findsetreg (Proto *p, int lastpc, int reg) {
341  int pc;
342  int setreg = -1;  /* keep last instruction that changed 'reg' */
343  int jmptarget = 0;  /* any code before this address is conditional */
344  for (pc = 0; pc < lastpc; pc++) {
345    Instruction i = p->code[pc];
346    OpCode op = GET_OPCODE(i);
347    int a = GETARG_A(i);
348    switch (op) {
349      case OP_LOADNIL: {
350        int b = GETARG_B(i);
351        if (a <= reg && reg <= a + b)  /* set registers from 'a' to 'a+b' */
352          setreg = filterpc(pc, jmptarget);
353        break;
354      }
355      case OP_TFORCALL: {
356        if (reg >= a + 2)  /* affect all regs above its base */
357          setreg = filterpc(pc, jmptarget);
358        break;
359      }
360      case OP_CALL:
361      case OP_TAILCALL: {
362        if (reg >= a)  /* affect all registers above base */
363          setreg = filterpc(pc, jmptarget);
364        break;
365      }
366      case OP_JMP: {
367        int b = GETARG_sBx(i);
368        int dest = pc + 1 + b;
369        /* jump is forward and do not skip `lastpc'? */
370        if (pc < dest && dest <= lastpc) {
371          if (dest > jmptarget)
372            jmptarget = dest;  /* update 'jmptarget' */
373        }
374        break;
375      }
376      case OP_TEST: {
377        if (reg == a)  /* jumped code can change 'a' */
378          setreg = filterpc(pc, jmptarget);
379        break;
380      }
381      default:
382        if (testAMode(op) && reg == a)  /* any instruction that set A */
383          setreg = filterpc(pc, jmptarget);
384        break;
385    }
386  }
387  return setreg;
341   int pc;
342   int setreg = -1;  /* keep last instruction that changed 'reg' */
343   int jmptarget = 0;  /* any code before this address is conditional */
344   for (pc = 0; pc < lastpc; pc++) {
345   Instruction i = p->code[pc];
346   OpCode op = GET_OPCODE(i);
347   int a = GETARG_A(i);
348   switch (op) {
349      case OP_LOADNIL: {
350      int b = GETARG_B(i);
351      if (a <= reg && reg <= a + b)  /* set registers from 'a' to 'a+b' */
352         setreg = filterpc(pc, jmptarget);
353      break;
354      }
355      case OP_TFORCALL: {
356      if (reg >= a + 2)  /* affect all regs above its base */
357         setreg = filterpc(pc, jmptarget);
358      break;
359      }
360      case OP_CALL:
361      case OP_TAILCALL: {
362      if (reg >= a)  /* affect all registers above base */
363         setreg = filterpc(pc, jmptarget);
364      break;
365      }
366      case OP_JMP: {
367      int b = GETARG_sBx(i);
368      int dest = pc + 1 + b;
369      /* jump is forward and do not skip `lastpc'? */
370      if (pc < dest && dest <= lastpc) {
371         if (dest > jmptarget)
372         jmptarget = dest;  /* update 'jmptarget' */
373      }
374      break;
375      }
376      case OP_TEST: {
377      if (reg == a)  /* jumped code can change 'a' */
378         setreg = filterpc(pc, jmptarget);
379      break;
380      }
381      default:
382      if (testAMode(op) && reg == a)  /* any instruction that set A */
383         setreg = filterpc(pc, jmptarget);
384      break;
385   }
386   }
387   return setreg;
388388}
389389
390390
391391static const char *getobjname (Proto *p, int lastpc, int reg,
392                               const char **name) {
393  int pc;
394  *name = luaF_getlocalname(p, reg + 1, lastpc);
395  if (*name)  /* is a local? */
396    return "local";
397  /* else try symbolic execution */
398  pc = findsetreg(p, lastpc, reg);
399  if (pc != -1) {  /* could find instruction? */
400    Instruction i = p->code[pc];
401    OpCode op = GET_OPCODE(i);
402    switch (op) {
403      case OP_MOVE: {
404        int b = GETARG_B(i);  /* move from 'b' to 'a' */
405        if (b < GETARG_A(i))
406          return getobjname(p, pc, b, name);  /* get name for 'b' */
407        break;
408      }
409      case OP_GETTABUP:
410      case OP_GETTABLE: {
411        int k = GETARG_C(i);  /* key index */
412        int t = GETARG_B(i);  /* table index */
413        const char *vn = (op == OP_GETTABLE)  /* name of indexed variable */
414                         ? luaF_getlocalname(p, t + 1, pc)
415                         : upvalname(p, t);
416        kname(p, pc, k, name);
417        return (vn && strcmp(vn, LUA_ENV) == 0) ? "global" : "field";
418      }
419      case OP_GETUPVAL: {
420        *name = upvalname(p, GETARG_B(i));
421        return "upvalue";
422      }
423      case OP_LOADK:
424      case OP_LOADKX: {
425        int b = (op == OP_LOADK) ? GETARG_Bx(i)
426                                 : GETARG_Ax(p->code[pc + 1]);
427        if (ttisstring(&p->k[b])) {
428          *name = svalue(&p->k[b]);
429          return "constant";
430        }
431        break;
432      }
433      case OP_SELF: {
434        int k = GETARG_C(i);  /* key index */
435        kname(p, pc, k, name);
436        return "method";
437      }
438      default: break;  /* go through to return NULL */
439    }
440  }
441  return NULL;  /* could not find reasonable name */
392                        const char **name) {
393   int pc;
394   *name = luaF_getlocalname(p, reg + 1, lastpc);
395   if (*name)  /* is a local? */
396   return "local";
397   /* else try symbolic execution */
398   pc = findsetreg(p, lastpc, reg);
399   if (pc != -1) {  /* could find instruction? */
400   Instruction i = p->code[pc];
401   OpCode op = GET_OPCODE(i);
402   switch (op) {
403      case OP_MOVE: {
404      int b = GETARG_B(i);  /* move from 'b' to 'a' */
405      if (b < GETARG_A(i))
406         return getobjname(p, pc, b, name);  /* get name for 'b' */
407      break;
408      }
409      case OP_GETTABUP:
410      case OP_GETTABLE: {
411      int k = GETARG_C(i);  /* key index */
412      int t = GETARG_B(i);  /* table index */
413      const char *vn = (op == OP_GETTABLE)  /* name of indexed variable */
414                     ? luaF_getlocalname(p, t + 1, pc)
415                     : upvalname(p, t);
416      kname(p, pc, k, name);
417      return (vn && strcmp(vn, LUA_ENV) == 0) ? "global" : "field";
418      }
419      case OP_GETUPVAL: {
420      *name = upvalname(p, GETARG_B(i));
421      return "upvalue";
422      }
423      case OP_LOADK:
424      case OP_LOADKX: {
425      int b = (op == OP_LOADK) ? GETARG_Bx(i)
426                           : GETARG_Ax(p->code[pc + 1]);
427      if (ttisstring(&p->k[b])) {
428         *name = svalue(&p->k[b]);
429         return "constant";
430      }
431      break;
432      }
433      case OP_SELF: {
434      int k = GETARG_C(i);  /* key index */
435      kname(p, pc, k, name);
436      return "method";
437      }
438      default: break;  /* go through to return NULL */
439   }
440   }
441   return NULL;  /* could not find reasonable name */
442442}
443443
444444
445445static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) {
446  TMS tm;
447  Proto *p = ci_func(ci)->p;  /* calling function */
448  int pc = currentpc(ci);  /* calling instruction index */
449  Instruction i = p->code[pc];  /* calling instruction */
450  switch (GET_OPCODE(i)) {
451    case OP_CALL:
452    case OP_TAILCALL:  /* get function name */
453      return getobjname(p, pc, GETARG_A(i), name);
454    case OP_TFORCALL: {  /* for iterator */
455      *name = "for iterator";
456       return "for iterator";
457    }
458    /* all other instructions can call only through metamethods */
459    case OP_SELF:
460    case OP_GETTABUP:
461    case OP_GETTABLE: tm = TM_INDEX; break;
462    case OP_SETTABUP:
463    case OP_SETTABLE: tm = TM_NEWINDEX; break;
464    case OP_EQ: tm = TM_EQ; break;
465    case OP_ADD: tm = TM_ADD; break;
466    case OP_SUB: tm = TM_SUB; break;
467    case OP_MUL: tm = TM_MUL; break;
468    case OP_DIV: tm = TM_DIV; break;
469    case OP_MOD: tm = TM_MOD; break;
470    case OP_POW: tm = TM_POW; break;
471    case OP_UNM: tm = TM_UNM; break;
472    case OP_LEN: tm = TM_LEN; break;
473    case OP_LT: tm = TM_LT; break;
474    case OP_LE: tm = TM_LE; break;
475    case OP_CONCAT: tm = TM_CONCAT; break;
476    default:
477      return NULL;  /* else no useful name can be found */
478  }
479  *name = getstr(G(L)->tmname[tm]);
480  return "metamethod";
446   TMS tm;
447   Proto *p = ci_func(ci)->p;  /* calling function */
448   int pc = currentpc(ci);  /* calling instruction index */
449   Instruction i = p->code[pc];  /* calling instruction */
450   switch (GET_OPCODE(i)) {
451   case OP_CALL:
452   case OP_TAILCALL:  /* get function name */
453      return getobjname(p, pc, GETARG_A(i), name);
454   case OP_TFORCALL: {  /* for iterator */
455      *name = "for iterator";
456      return "for iterator";
457   }
458   /* all other instructions can call only through metamethods */
459   case OP_SELF:
460   case OP_GETTABUP:
461   case OP_GETTABLE: tm = TM_INDEX; break;
462   case OP_SETTABUP:
463   case OP_SETTABLE: tm = TM_NEWINDEX; break;
464   case OP_EQ: tm = TM_EQ; break;
465   case OP_ADD: tm = TM_ADD; break;
466   case OP_SUB: tm = TM_SUB; break;
467   case OP_MUL: tm = TM_MUL; break;
468   case OP_DIV: tm = TM_DIV; break;
469   case OP_MOD: tm = TM_MOD; break;
470   case OP_POW: tm = TM_POW; break;
471   case OP_UNM: tm = TM_UNM; break;
472   case OP_LEN: tm = TM_LEN; break;
473   case OP_LT: tm = TM_LT; break;
474   case OP_LE: tm = TM_LE; break;
475   case OP_CONCAT: tm = TM_CONCAT; break;
476   default:
477      return NULL;  /* else no useful name can be found */
478   }
479   *name = getstr(G(L)->tmname[tm]);
480   return "metamethod";
481481}
482482
483483/* }====================================================== */
r31373r31374
489489** (used only for error messages, so efficiency is not a big concern)
490490*/
491491static int isinstack (CallInfo *ci, const TValue *o) {
492  StkId p;
493  for (p = ci->u.l.base; p < ci->top; p++)
494    if (o == p) return 1;
495  return 0;
492   StkId p;
493   for (p = ci->u.l.base; p < ci->top; p++)
494   if (o == p) return 1;
495   return 0;
496496}
497497
498498
499499static const char *getupvalname (CallInfo *ci, const TValue *o,
500                                 const char **name) {
501  LClosure *c = ci_func(ci);
502  int i;
503  for (i = 0; i < c->nupvalues; i++) {
504    if (c->upvals[i]->v == o) {
505      *name = upvalname(c->p, i);
506      return "upvalue";
507    }
508  }
509  return NULL;
500                           const char **name) {
501   LClosure *c = ci_func(ci);
502   int i;
503   for (i = 0; i < c->nupvalues; i++) {
504   if (c->upvals[i]->v == o) {
505      *name = upvalname(c->p, i);
506      return "upvalue";
507   }
508   }
509   return NULL;
510510}
511511
512512
513513l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
514  CallInfo *ci = L->ci;
515  const char *name = NULL;
516  const char *t = objtypename(o);
517  const char *kind = NULL;
518  if (isLua(ci)) {
519    kind = getupvalname(ci, o, &name);  /* check whether 'o' is an upvalue */
520    if (!kind && isinstack(ci, o))  /* no? try a register */
521      kind = getobjname(ci_func(ci)->p, currentpc(ci),
522                        cast_int(o - ci->u.l.base), &name);
523  }
524  if (kind)
525    luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)",
526                op, kind, name, t);
527  else
528    luaG_runerror(L, "attempt to %s a %s value", op, t);
514   CallInfo *ci = L->ci;
515   const char *name = NULL;
516   const char *t = objtypename(o);
517   const char *kind = NULL;
518   if (isLua(ci)) {
519   kind = getupvalname(ci, o, &name);  /* check whether 'o' is an upvalue */
520   if (!kind && isinstack(ci, o))  /* no? try a register */
521      kind = getobjname(ci_func(ci)->p, currentpc(ci),
522                  cast_int(o - ci->u.l.base), &name);
523   }
524   if (kind)
525   luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)",
526            op, kind, name, t);
527   else
528   luaG_runerror(L, "attempt to %s a %s value", op, t);
529529}
530530
531531
532532l_noret luaG_concaterror (lua_State *L, StkId p1, StkId p2) {
533  if (ttisstring(p1) || ttisnumber(p1)) p1 = p2;
534  lua_assert(!ttisstring(p1) && !ttisnumber(p1));
535  luaG_typeerror(L, p1, "concatenate");
533   if (ttisstring(p1) || ttisnumber(p1)) p1 = p2;
534   lua_assert(!ttisstring(p1) && !ttisnumber(p1));
535   luaG_typeerror(L, p1, "concatenate");
536536}
537537
538538
539539l_noret luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) {
540  TValue temp;
541  if (luaV_tonumber(p1, &temp) == NULL)
542    p2 = p1;  /* first operand is wrong */
543  luaG_typeerror(L, p2, "perform arithmetic on");
540   TValue temp;
541   if (luaV_tonumber(p1, &temp) == NULL)
542   p2 = p1;  /* first operand is wrong */
543   luaG_typeerror(L, p2, "perform arithmetic on");
544544}
545545
546546
547547l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) {
548  const char *t1 = objtypename(p1);
549  const char *t2 = objtypename(p2);
550  if (t1 == t2)
551    luaG_runerror(L, "attempt to compare two %s values", t1);
552  else
553    luaG_runerror(L, "attempt to compare %s with %s", t1, t2);
548   const char *t1 = objtypename(p1);
549   const char *t2 = objtypename(p2);
550   if (t1 == t2)
551   luaG_runerror(L, "attempt to compare two %s values", t1);
552   else
553   luaG_runerror(L, "attempt to compare %s with %s", t1, t2);
554554}
555555
556556
557557static void addinfo (lua_State *L, const char *msg) {
558  CallInfo *ci = L->ci;
559  if (isLua(ci)) {  /* is Lua code? */
560    char buff[LUA_IDSIZE];  /* add file:line information */
561    int line = currentline(ci);
562    TString *src = ci_func(ci)->p->source;
563    if (src)
564      luaO_chunkid(buff, getstr(src), LUA_IDSIZE);
565    else {  /* no source available; use "?" instead */
566      buff[0] = '?'; buff[1] = '\0';
567    }
568    luaO_pushfstring(L, "%s:%d: %s", buff, line, msg);
569  }
558   CallInfo *ci = L->ci;
559   if (isLua(ci)) {  /* is Lua code? */
560   char buff[LUA_IDSIZE];  /* add file:line information */
561   int line = currentline(ci);
562   TString *src = ci_func(ci)->p->source;
563   if (src)
564      luaO_chunkid(buff, getstr(src), LUA_IDSIZE);
565   else {  /* no source available; use "?" instead */
566      buff[0] = '?'; buff[1] = '\0';
567   }
568   luaO_pushfstring(L, "%s:%d: %s", buff, line, msg);
569   }
570570}
571571
572572
573573l_noret luaG_errormsg (lua_State *L) {
574  if (L->errfunc != 0) {  /* is there an error handling function? */
575    StkId errfunc = restorestack(L, L->errfunc);
576    if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR);
577    setobjs2s(L, L->top, L->top - 1);  /* move argument */
578    setobjs2s(L, L->top - 1, errfunc);  /* push function */
579    L->top++;
580    luaD_call(L, L->top - 2, 1, 0);  /* call it */
581  }
582  luaD_throw(L, LUA_ERRRUN);
574   if (L->errfunc != 0) {  /* is there an error handling function? */
575   StkId errfunc = restorestack(L, L->errfunc);
576   if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR);
577   setobjs2s(L, L->top, L->top - 1);  /* move argument */
578   setobjs2s(L, L->top - 1, errfunc);  /* push function */
579   L->top++;
580   luaD_call(L, L->top - 2, 1, 0);  /* call it */
581   }
582   luaD_throw(L, LUA_ERRRUN);
583583}
584584
585585
586586l_noret luaG_runerror (lua_State *L, const char *fmt, ...) {
587  va_list argp;
588  va_start(argp, fmt);
589  addinfo(L, luaO_pushvfstring(L, fmt, argp));
590  va_end(argp);
591  luaG_errormsg(L);
587   va_list argp;
588   va_start(argp, fmt);
589   addinfo(L, luaO_pushvfstring(L, fmt, argp));
590   va_end(argp);
591   luaG_errormsg(L);
592592}
593
trunk/src/lib/lua/lcorolib.c
r31373r31374
1818
1919
2020static int auxresume (lua_State *L, lua_State *co, int narg) {
21  int status;
22  if (!lua_checkstack(co, narg)) {
23    lua_pushliteral(L, "too many arguments to resume");
24    return -1;  /* error flag */
25  }
26  if (lua_status(co) == LUA_OK && lua_gettop(co) == 0) {
27    lua_pushliteral(L, "cannot resume dead coroutine");
28    return -1;  /* error flag */
29  }
30  lua_xmove(L, co, narg);
31  status = lua_resume(co, L, narg);
32  if (status == LUA_OK || status == LUA_YIELD) {
33    int nres = lua_gettop(co);
34    if (!lua_checkstack(L, nres + 1)) {
35      lua_pop(co, nres);  /* remove results anyway */
36      lua_pushliteral(L, "too many results to resume");
37      return -1;  /* error flag */
38    }
39    lua_xmove(co, L, nres);  /* move yielded values */
40    return nres;
41  }
42  else {
43    lua_xmove(co, L, 1);  /* move error message */
44    return -1;  /* error flag */
45  }
21   int status;
22   if (!lua_checkstack(co, narg)) {
23   lua_pushliteral(L, "too many arguments to resume");
24   return -1;  /* error flag */
25   }
26   if (lua_status(co) == LUA_OK && lua_gettop(co) == 0) {
27   lua_pushliteral(L, "cannot resume dead coroutine");
28   return -1;  /* error flag */
29   }
30   lua_xmove(L, co, narg);
31   status = lua_resume(co, L, narg);
32   if (status == LUA_OK || status == LUA_YIELD) {
33   int nres = lua_gettop(co);
34   if (!lua_checkstack(L, nres + 1)) {
35      lua_pop(co, nres);  /* remove results anyway */
36      lua_pushliteral(L, "too many results to resume");
37      return -1;  /* error flag */
38   }
39   lua_xmove(co, L, nres);  /* move yielded values */
40   return nres;
41   }
42   else {
43   lua_xmove(co, L, 1);  /* move error message */
44   return -1;  /* error flag */
45   }
4646}
4747
4848
4949static int luaB_coresume (lua_State *L) {
50  lua_State *co = lua_tothread(L, 1);
51  int r;
52  luaL_argcheck(L, co, 1, "coroutine expected");
53  r = auxresume(L, co, lua_gettop(L) - 1);
54  if (r < 0) {
55    lua_pushboolean(L, 0);
56    lua_insert(L, -2);
57    return 2;  /* return false + error message */
58  }
59  else {
60    lua_pushboolean(L, 1);
61    lua_insert(L, -(r + 1));
62    return r + 1;  /* return true + `resume' returns */
63  }
50   lua_State *co = lua_tothread(L, 1);
51   int r;
52   luaL_argcheck(L, co, 1, "coroutine expected");
53   r = auxresume(L, co, lua_gettop(L) - 1);
54   if (r < 0) {
55   lua_pushboolean(L, 0);
56   lua_insert(L, -2);
57   return 2;  /* return false + error message */
58   }
59   else {
60   lua_pushboolean(L, 1);
61   lua_insert(L, -(r + 1));
62   return r + 1;  /* return true + `resume' returns */
63   }
6464}
6565
6666
6767static int luaB_auxwrap (lua_State *L) {
68  lua_State *co = lua_tothread(L, lua_upvalueindex(1));
69  int r = auxresume(L, co, lua_gettop(L));
70  if (r < 0) {
71    if (lua_isstring(L, -1)) {  /* error object is a string? */
72      luaL_where(L, 1);  /* add extra info */
73      lua_insert(L, -2);
74      lua_concat(L, 2);
75    }
76    return lua_error(L);  /* propagate error */
77  }
78  return r;
68   lua_State *co = lua_tothread(L, lua_upvalueindex(1));
69   int r = auxresume(L, co, lua_gettop(L));
70   if (r < 0) {
71   if (lua_isstring(L, -1)) {  /* error object is a string? */
72      luaL_where(L, 1);  /* add extra info */
73      lua_insert(L, -2);
74      lua_concat(L, 2);
75   }
76   return lua_error(L);  /* propagate error */
77   }
78   return r;
7979}
8080
8181
8282static int luaB_cocreate (lua_State *L) {
83  lua_State *NL;
84  luaL_checktype(L, 1, LUA_TFUNCTION);
85  NL = lua_newthread(L);
86  lua_pushvalue(L, 1);  /* move function to top */
87  lua_xmove(L, NL, 1);  /* move function from L to NL */
88  return 1;
83   lua_State *NL;
84   luaL_checktype(L, 1, LUA_TFUNCTION);
85   NL = lua_newthread(L);
86   lua_pushvalue(L, 1);  /* move function to top */
87   lua_xmove(L, NL, 1);  /* move function from L to NL */
88   return 1;
8989}
9090
9191
9292static int luaB_cowrap (lua_State *L) {
93  luaB_cocreate(L);
94  lua_pushcclosure(L, luaB_auxwrap, 1);
95  return 1;
93   luaB_cocreate(L);
94   lua_pushcclosure(L, luaB_auxwrap, 1);
95   return 1;
9696}
9797
9898
9999static int luaB_yield (lua_State *L) {
100  return lua_yield(L, lua_gettop(L));
100   return lua_yield(L, lua_gettop(L));
101101}
102102
103103
104104static int luaB_costatus (lua_State *L) {
105  lua_State *co = lua_tothread(L, 1);
106  luaL_argcheck(L, co, 1, "coroutine expected");
107  if (L == co) lua_pushliteral(L, "running");
108  else {
109    switch (lua_status(co)) {
110      case LUA_YIELD:
111        lua_pushliteral(L, "suspended");
112        break;
113      case LUA_OK: {
114        lua_Debug ar;
115        if (lua_getstack(co, 0, &ar) > 0)  /* does it have frames? */
116          lua_pushliteral(L, "normal");  /* it is running */
117        else if (lua_gettop(co) == 0)
118            lua_pushliteral(L, "dead");
119        else
120          lua_pushliteral(L, "suspended");  /* initial state */
121        break;
122      }
123      default:  /* some error occurred */
124        lua_pushliteral(L, "dead");
125        break;
126    }
127  }
128  return 1;
105   lua_State *co = lua_tothread(L, 1);
106   luaL_argcheck(L, co, 1, "coroutine expected");
107   if (L == co) lua_pushliteral(L, "running");
108   else {
109   switch (lua_status(co)) {
110      case LUA_YIELD:
111      lua_pushliteral(L, "suspended");
112      break;
113      case LUA_OK: {
114      lua_Debug ar;
115      if (lua_getstack(co, 0, &ar) > 0)  /* does it have frames? */
116         lua_pushliteral(L, "normal");  /* it is running */
117      else if (lua_gettop(co) == 0)
118         lua_pushliteral(L, "dead");
119      else
120         lua_pushliteral(L, "suspended");  /* initial state */
121      break;
122      }
123      default:  /* some error occurred */
124      lua_pushliteral(L, "dead");
125      break;
126   }
127   }
128   return 1;
129129}
130130
131131
132132static int luaB_corunning (lua_State *L) {
133  int ismain = lua_pushthread(L);
134  lua_pushboolean(L, ismain);
135  return 2;
133   int ismain = lua_pushthread(L);
134   lua_pushboolean(L, ismain);
135   return 2;
136136}
137137
138138
139139static const luaL_Reg co_funcs[] = {
140  {"create", luaB_cocreate},
141  {"resume", luaB_coresume},
142  {"running", luaB_corunning},
143  {"status", luaB_costatus},
144  {"wrap", luaB_cowrap},
145  {"yield", luaB_yield},
146  {NULL, NULL}
140   {"create", luaB_cocreate},
141   {"resume", luaB_coresume},
142   {"running", luaB_corunning},
143   {"status", luaB_costatus},
144   {"wrap", luaB_cowrap},
145   {"yield", luaB_yield},
146   {NULL, NULL}
147147};
148148
149149
150150
151151LUAMOD_API int luaopen_coroutine (lua_State *L) {
152  luaL_newlib(L, co_funcs);
153  return 1;
152   luaL_newlib(L, co_funcs);
153   return 1;
154154}
155
trunk/src/lib/lua/ltablib.c
r31373r31374
1616#include "lualib.h"
1717
1818
19#define aux_getn(L,n)   (luaL_checktype(L, n, LUA_TTABLE), luaL_len(L, n))
19#define aux_getn(L,n)   (luaL_checktype(L, n, LUA_TTABLE), luaL_len(L, n))
2020
2121
2222
2323#if defined(LUA_COMPAT_MAXN)
2424static int maxn (lua_State *L) {
25  lua_Number max = 0;
26  luaL_checktype(L, 1, LUA_TTABLE);
27  lua_pushnil(L);  /* first key */
28  while (lua_next(L, 1)) {
29    lua_pop(L, 1);  /* remove value */
30    if (lua_type(L, -1) == LUA_TNUMBER) {
31      lua_Number v = lua_tonumber(L, -1);
32      if (v > max) max = v;
33    }
34  }
35  lua_pushnumber(L, max);
36  return 1;
25   lua_Number max = 0;
26   luaL_checktype(L, 1, LUA_TTABLE);
27   lua_pushnil(L);  /* first key */
28   while (lua_next(L, 1)) {
29   lua_pop(L, 1);  /* remove value */
30   if (lua_type(L, -1) == LUA_TNUMBER) {
31      lua_Number v = lua_tonumber(L, -1);
32      if (v > max) max = v;
33   }
34   }
35   lua_pushnumber(L, max);
36   return 1;
3737}
3838#endif
3939
4040
4141static int tinsert (lua_State *L) {
42  int e = aux_getn(L, 1) + 1;  /* first empty element */
43  int pos;  /* where to insert new element */
44  switch (lua_gettop(L)) {
45    case 2: {  /* called with only 2 arguments */
46      pos = e;  /* insert new element at the end */
47      break;
48    }
49    case 3: {
50      int i;
51      pos = luaL_checkint(L, 2);  /* 2nd argument is the position */
52      luaL_argcheck(L, 1 <= pos && pos <= e, 2, "position out of bounds");
53      for (i = e; i > pos; i--) {  /* move up elements */
54        lua_rawgeti(L, 1, i-1);
55        lua_rawseti(L, 1, i);  /* t[i] = t[i-1] */
56      }
57      break;
58    }
59    default: {
60      return luaL_error(L, "wrong number of arguments to " LUA_QL("insert"));
61    }
62  }
63  lua_rawseti(L, 1, pos);  /* t[pos] = v */
64  return 0;
42   int e = aux_getn(L, 1) + 1;  /* first empty element */
43   int pos;  /* where to insert new element */
44   switch (lua_gettop(L)) {
45   case 2: {  /* called with only 2 arguments */
46      pos = e;  /* insert new element at the end */
47      break;
48   }
49   case 3: {
50      int i;
51      pos = luaL_checkint(L, 2);  /* 2nd argument is the position */
52      luaL_argcheck(L, 1 <= pos && pos <= e, 2, "position out of bounds");
53      for (i = e; i > pos; i--) {  /* move up elements */
54      lua_rawgeti(L, 1, i-1);
55      lua_rawseti(L, 1, i);  /* t[i] = t[i-1] */
56      }
57      break;
58   }
59   default: {
60      return luaL_error(L, "wrong number of arguments to " LUA_QL("insert"));
61   }
62   }
63   lua_rawseti(L, 1, pos);  /* t[pos] = v */
64   return 0;
6565}
6666
6767
6868static int tremove (lua_State *L) {
69  int size = aux_getn(L, 1);
70  int pos = luaL_optint(L, 2, size);
71  if (pos != size)  /* validate 'pos' if given */
72    luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds");
73  lua_rawgeti(L, 1, pos);  /* result = t[pos] */
74  for ( ; pos < size; pos++) {
75    lua_rawgeti(L, 1, pos+1);
76    lua_rawseti(L, 1, pos);  /* t[pos] = t[pos+1] */
77  }
78  lua_pushnil(L);
79  lua_rawseti(L, 1, pos);  /* t[pos] = nil */
80  return 1;
69   int size = aux_getn(L, 1);
70   int pos = luaL_optint(L, 2, size);
71   if (pos != size)  /* validate 'pos' if given */
72   luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds");
73   lua_rawgeti(L, 1, pos);  /* result = t[pos] */
74   for ( ; pos < size; pos++) {
75   lua_rawgeti(L, 1, pos+1);
76   lua_rawseti(L, 1, pos);  /* t[pos] = t[pos+1] */
77   }
78   lua_pushnil(L);
79   lua_rawseti(L, 1, pos);  /* t[pos] = nil */
80   return 1;
8181}
8282
8383
8484static void addfield (lua_State *L, luaL_Buffer *b, int i) {
85  lua_rawgeti(L, 1, i);
86  if (!lua_isstring(L, -1))
87    luaL_error(L, "invalid value (%s) at index %d in table for "
88                  LUA_QL("concat"), luaL_typename(L, -1), i);
89  luaL_addvalue(b);
85   lua_rawgeti(L, 1, i);
86   if (!lua_isstring(L, -1))
87   luaL_error(L, "invalid value (%s) at index %d in table for "
88               LUA_QL("concat"), luaL_typename(L, -1), i);
89   luaL_addvalue(b);
9090}
9191
9292
9393static int tconcat (lua_State *L) {
94  luaL_Buffer b;
95  size_t lsep;
96  int i, last;
97  const char *sep = luaL_optlstring(L, 2, "", &lsep);
98  luaL_checktype(L, 1, LUA_TTABLE);
99  i = luaL_optint(L, 3, 1);
100  last = luaL_opt(L, luaL_checkint, 4, luaL_len(L, 1));
101  luaL_buffinit(L, &b);
102  for (; i < last; i++) {
103    addfield(L, &b, i);
104    luaL_addlstring(&b, sep, lsep);
105  }
106  if (i == last)  /* add last value (if interval was not empty) */
107    addfield(L, &b, i);
108  luaL_pushresult(&b);
109  return 1;
94   luaL_Buffer b;
95   size_t lsep;
96   int i, last;
97   const char *sep = luaL_optlstring(L, 2, "", &lsep);
98   luaL_checktype(L, 1, LUA_TTABLE);
99   i = luaL_optint(L, 3, 1);
100   last = luaL_opt(L, luaL_checkint, 4, luaL_len(L, 1));
101   luaL_buffinit(L, &b);
102   for (; i < last; i++) {
103   addfield(L, &b, i);
104   luaL_addlstring(&b, sep, lsep);
105   }
106   if (i == last)  /* add last value (if interval was not empty) */
107   addfield(L, &b, i);
108   luaL_pushresult(&b);
109   return 1;
110110}
111111
112112
r31373r31374
117117*/
118118
119119static int pack (lua_State *L) {
120  int n = lua_gettop(L);  /* number of elements to pack */
121  lua_createtable(L, n, 1);  /* create result table */
122  lua_pushinteger(L, n);
123  lua_setfield(L, -2, "n");  /* t.n = number of elements */
124  if (n > 0) {  /* at least one element? */
125    int i;
126    lua_pushvalue(L, 1);
127    lua_rawseti(L, -2, 1);  /* insert first element */
128    lua_replace(L, 1);  /* move table into index 1 */
129    for (i = n; i >= 2; i--)  /* assign other elements */
130      lua_rawseti(L, 1, i);
131  }
132  return 1;  /* return table */
120   int n = lua_gettop(L);  /* number of elements to pack */
121   lua_createtable(L, n, 1);  /* create result table */
122   lua_pushinteger(L, n);
123   lua_setfield(L, -2, "n");  /* t.n = number of elements */
124   if (n > 0) {  /* at least one element? */
125   int i;
126   lua_pushvalue(L, 1);
127   lua_rawseti(L, -2, 1);  /* insert first element */
128   lua_replace(L, 1);  /* move table into index 1 */
129   for (i = n; i >= 2; i--)  /* assign other elements */
130      lua_rawseti(L, 1, i);
131   }
132   return 1;  /* return table */
133133}
134134
135135
136136static int unpack (lua_State *L) {
137  int i, e, n;
138  luaL_checktype(L, 1, LUA_TTABLE);
139  i = luaL_optint(L, 2, 1);
140  e = luaL_opt(L, luaL_checkint, 3, luaL_len(L, 1));
141  if (i > e) return 0;  /* empty range */
142  n = e - i + 1;  /* number of elements */
143  if (n <= 0 || !lua_checkstack(L, n))  /* n <= 0 means arith. overflow */
144    return luaL_error(L, "too many results to unpack");
145  lua_rawgeti(L, 1, i);  /* push arg[i] (avoiding overflow problems) */
146  while (i++ < e)  /* push arg[i + 1...e] */
147    lua_rawgeti(L, 1, i);
148  return n;
137   int i, e, n;
138   luaL_checktype(L, 1, LUA_TTABLE);
139   i = luaL_optint(L, 2, 1);
140   e = luaL_opt(L, luaL_checkint, 3, luaL_len(L, 1));
141   if (i > e) return 0;  /* empty range */
142   n = e - i + 1;  /* number of elements */
143   if (n <= 0 || !lua_checkstack(L, n))  /* n <= 0 means arith. overflow */
144   return luaL_error(L, "too many results to unpack");
145   lua_rawgeti(L, 1, i);  /* push arg[i] (avoiding overflow problems) */
146   while (i++ < e)  /* push arg[i + 1...e] */
147   lua_rawgeti(L, 1, i);
148   return n;
149149}
150150
151151/* }====================================================== */
r31373r31374
162162
163163
164164static void set2 (lua_State *L, int i, int j) {
165  lua_rawseti(L, 1, i);
166  lua_rawseti(L, 1, j);
165   lua_rawseti(L, 1, i);
166   lua_rawseti(L, 1, j);
167167}
168168
169169static int sort_comp (lua_State *L, int a, int b) {
170  if (!lua_isnil(L, 2)) {  /* function? */
171    int res;
172    lua_pushvalue(L, 2);
173    lua_pushvalue(L, a-1);  /* -1 to compensate function */
174    lua_pushvalue(L, b-2);  /* -2 to compensate function and `a' */
175    lua_call(L, 2, 1);
176    res = lua_toboolean(L, -1);
177    lua_pop(L, 1);
178    return res;
179  }
180  else  /* a < b? */
181    return lua_compare(L, a, b, LUA_OPLT);
170   if (!lua_isnil(L, 2)) {  /* function? */
171   int res;
172   lua_pushvalue(L, 2);
173   lua_pushvalue(L, a-1);  /* -1 to compensate function */
174   lua_pushvalue(L, b-2);  /* -2 to compensate function and `a' */
175   lua_call(L, 2, 1);
176   res = lua_toboolean(L, -1);
177   lua_pop(L, 1);
178   return res;
179   }
180   else  /* a < b? */
181   return lua_compare(L, a, b, LUA_OPLT);
182182}
183183
184184static void auxsort (lua_State *L, int l, int u) {
185  while (l < u) {  /* for tail recursion */
186    int i, j;
187    /* sort elements a[l], a[(l+u)/2] and a[u] */
188    lua_rawgeti(L, 1, l);
189    lua_rawgeti(L, 1, u);
190    if (sort_comp(L, -1, -2))  /* a[u] < a[l]? */
191      set2(L, l, u);  /* swap a[l] - a[u] */
192    else
193      lua_pop(L, 2);
194    if (u-l == 1) break;  /* only 2 elements */
195    i = (l+u)/2;
196    lua_rawgeti(L, 1, i);
197    lua_rawgeti(L, 1, l);
198    if (sort_comp(L, -2, -1))  /* a[i]<a[l]? */
199      set2(L, i, l);
200    else {
201      lua_pop(L, 1);  /* remove a[l] */
202      lua_rawgeti(L, 1, u);
203      if (sort_comp(L, -1, -2))  /* a[u]<a[i]? */
204        set2(L, i, u);
205      else
206        lua_pop(L, 2);
207    }
208    if (u-l == 2) break;  /* only 3 elements */
209    lua_rawgeti(L, 1, i);  /* Pivot */
210    lua_pushvalue(L, -1);
211    lua_rawgeti(L, 1, u-1);
212    set2(L, i, u-1);
213    /* a[l] <= P == a[u-1] <= a[u], only need to sort from l+1 to u-2 */
214    i = l; j = u-1;
215    for (;;) {  /* invariant: a[l..i] <= P <= a[j..u] */
216      /* repeat ++i until a[i] >= P */
217      while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {
218        if (i>=u) luaL_error(L, "invalid order function for sorting");
219        lua_pop(L, 1);  /* remove a[i] */
220      }
221      /* repeat --j until a[j] <= P */
222      while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) {
223        if (j<=l) luaL_error(L, "invalid order function for sorting");
224        lua_pop(L, 1);  /* remove a[j] */
225      }
226      if (j<i) {
227        lua_pop(L, 3);  /* pop pivot, a[i], a[j] */
228        break;
229      }
230      set2(L, i, j);
231    }
232    lua_rawgeti(L, 1, u-1);
233    lua_rawgeti(L, 1, i);
234    set2(L, u-1, i);  /* swap pivot (a[u-1]) with a[i] */
235    /* a[l..i-1] <= a[i] == P <= a[i+1..u] */
236    /* adjust so that smaller half is in [j..i] and larger one in [l..u] */
237    if (i-l < u-i) {
238      j=l; i=i-1; l=i+2;
239    }
240    else {
241      j=i+1; i=u; u=j-2;
242    }
243    auxsort(L, j, i);  /* call recursively the smaller one */
244  }  /* repeat the routine for the larger one */
185   while (l < u) {  /* for tail recursion */
186   int i, j;
187   /* sort elements a[l], a[(l+u)/2] and a[u] */
188   lua_rawgeti(L, 1, l);
189   lua_rawgeti(L, 1, u);
190   if (sort_comp(L, -1, -2))  /* a[u] < a[l]? */
191      set2(L, l, u);  /* swap a[l] - a[u] */
192   else
193      lua_pop(L, 2);
194   if (u-l == 1) break;  /* only 2 elements */
195   i = (l+u)/2;
196   lua_rawgeti(L, 1, i);
197   lua_rawgeti(L, 1, l);
198   if (sort_comp(L, -2, -1))  /* a[i]<a[l]? */
199      set2(L, i, l);
200   else {
201      lua_pop(L, 1);  /* remove a[l] */
202      lua_rawgeti(L, 1, u);
203      if (sort_comp(L, -1, -2))  /* a[u]<a[i]? */
204      set2(L, i, u);
205      else
206      lua_pop(L, 2);
207   }
208   if (u-l == 2) break;  /* only 3 elements */
209   lua_rawgeti(L, 1, i);  /* Pivot */
210   lua_pushvalue(L, -1);
211   lua_rawgeti(L, 1, u-1);
212   set2(L, i, u-1);
213   /* a[l] <= P == a[u-1] <= a[u], only need to sort from l+1 to u-2 */
214   i = l; j = u-1;
215   for (;;) {  /* invariant: a[l..i] <= P <= a[j..u] */
216      /* repeat ++i until a[i] >= P */
217      while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {
218      if (i>=u) luaL_error(L, "invalid order function for sorting");
219      lua_pop(L, 1);  /* remove a[i] */
220      }
221      /* repeat --j until a[j] <= P */
222      while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) {
223      if (j<=l) luaL_error(L, "invalid order function for sorting");
224      lua_pop(L, 1);  /* remove a[j] */
225      }
226      if (j<i) {
227      lua_pop(L, 3);  /* pop pivot, a[i], a[j] */
228      break;
229      }
230      set2(L, i, j);
231   }
232   lua_rawgeti(L, 1, u-1);
233   lua_rawgeti(L, 1, i);
234   set2(L, u-1, i);  /* swap pivot (a[u-1]) with a[i] */
235   /* a[l..i-1] <= a[i] == P <= a[i+1..u] */
236   /* adjust so that smaller half is in [j..i] and larger one in [l..u] */
237   if (i-l < u-i) {
238      j=l; i=i-1; l=i+2;
239   }
240   else {
241      j=i+1; i=u; u=j-2;
242   }
243   auxsort(L, j, i);  /* call recursively the smaller one */
244   }  /* repeat the routine for the larger one */
245245}
246246
247247static int sort (lua_State *L) {
248  int n = aux_getn(L, 1);
249  luaL_checkstack(L, 40, "");  /* assume array is smaller than 2^40 */
250  if (!lua_isnoneornil(L, 2))  /* is there a 2nd argument? */
251    luaL_checktype(L, 2, LUA_TFUNCTION);
252  lua_settop(L, 2);  /* make sure there is two arguments */
253  auxsort(L, 1, n);
254  return 0;
248   int n = aux_getn(L, 1);
249   luaL_checkstack(L, 40, "");  /* assume array is smaller than 2^40 */
250   if (!lua_isnoneornil(L, 2))  /* is there a 2nd argument? */
251   luaL_checktype(L, 2, LUA_TFUNCTION);
252   lua_settop(L, 2);  /* make sure there is two arguments */
253   auxsort(L, 1, n);
254   return 0;
255255}
256256
257257/* }====================================================== */
258258
259259
260260static const luaL_Reg tab_funcs[] = {
261  {"concat", tconcat},
261   {"concat", tconcat},
262262#if defined(LUA_COMPAT_MAXN)
263  {"maxn", maxn},
263   {"maxn", maxn},
264264#endif
265  {"insert", tinsert},
266  {"pack", pack},
267  {"unpack", unpack},
268  {"remove", tremove},
269  {"sort", sort},
270  {NULL, NULL}
265   {"insert", tinsert},
266   {"pack", pack},
267   {"unpack", unpack},
268   {"remove", tremove},
269   {"sort", sort},
270   {NULL, NULL}
271271};
272272
273273
274274LUAMOD_API int luaopen_table (lua_State *L) {
275  luaL_newlib(L, tab_funcs);
275   luaL_newlib(L, tab_funcs);
276276#if defined(LUA_COMPAT_UNPACK)
277  /* _G.unpack = table.unpack */
278  lua_getfield(L, -1, "unpack");
279  lua_setglobal(L, "unpack");
277   /* _G.unpack = table.unpack */
278   lua_getfield(L, -1, "unpack");
279   lua_setglobal(L, "unpack");
280280#endif
281  return 1;
281   return 1;
282282}
283
trunk/src/lib/lua/liolib.c
r31373r31374
1010** should not affect non-POSIX systems
1111*/
1212#if !defined(_FILE_OFFSET_BITS)
13#define   _LARGEFILE_SOURCE   1
14#define _FILE_OFFSET_BITS   64
13#define _LARGEFILE_SOURCE   1
14#define _FILE_OFFSET_BITS   64
1515#endif
1616
1717
r31373r31374
3737** the standard ones.
3838*/
3939#define lua_checkmode(mode) \
40   (*mode != '\0' && strchr("rwa", *(mode++)) != NULL &&   \
41   (*mode != '+' || ++mode) &&  /* skip if char is '+' */   \
42   (*mode != 'b' || ++mode) &&  /* skip if char is 'b' */   \
40   (*mode != '\0' && strchr("rwa", *(mode++)) != NULL &&   \
41   (*mode != '+' || ++mode) &&  /* skip if char is '+' */  \
42   (*mode != 'b' || ++mode) &&  /* skip if char is 'b' */  \
4343   (*mode == '\0'))
4444
4545#endif
r31373r31374
5151** =======================================================
5252*/
5353
54#if !defined(lua_popen)   /* { */
54#if !defined(lua_popen) /* { */
5555
56#if defined(LUA_USE_POPEN)   /* { */
56#if defined(LUA_USE_POPEN)  /* { */
5757
58#define lua_popen(L,c,m)   ((void)L, fflush(NULL), popen(c,m))
59#define lua_pclose(L,file)   ((void)L, pclose(file))
58#define lua_popen(L,c,m)    ((void)L, fflush(NULL), popen(c,m))
59#define lua_pclose(L,file)  ((void)L, pclose(file))
6060
61#elif defined(LUA_WIN)      /* }{ */
61#elif defined(LUA_WIN)      /* }{ */
6262
63#define lua_popen(L,c,m)      ((void)L, _popen(c,m))
64#define lua_pclose(L,file)      ((void)L, _pclose(file))
63#define lua_popen(L,c,m)        ((void)L, _popen(c,m))
64#define lua_pclose(L,file)      ((void)L, _pclose(file))
6565
6666
67#else            /* }{ */
67#else               /* }{ */
6868
69#define lua_popen(L,c,m)      ((void)((void)c, m),  \
69#define lua_popen(L,c,m)        ((void)((void)c, m),  \
7070      luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
71#define lua_pclose(L,file)      ((void)((void)L, file), -1)
71#define lua_pclose(L,file)      ((void)((void)L, file), -1)
7272
7373
74#endif            /* } */
74#endif              /* } */
7575
76#endif         /* } */
76#endif          /* } */
7777
7878/* }====================================================== */
7979
r31373r31374
8484** =======================================================
8585*/
8686
87#if !defined(lua_fseek)   && !defined(LUA_ANSI)   /* { */
87#if !defined(lua_fseek) && !defined(LUA_ANSI)   /* { */
8888
89#if defined(LUA_USE_POSIX)   /* { */
89#if defined(LUA_USE_POSIX)  /* { */
9090
91#define l_fseek(f,o,w)      fseeko(f,o,w)
92#define l_ftell(f)      ftello(f)
93#define l_seeknum      off_t
91#define l_fseek(f,o,w)      fseeko(f,o,w)
92#define l_ftell(f)      ftello(f)
93#define l_seeknum       off_t
9494
9595#elif defined(LUA_WIN) && !defined(_CRTIMP_TYPEINFO) \
96   && defined(_MSC_VER) && (_MSC_VER >= 1400)   /* }{ */
96   && defined(_MSC_VER) && (_MSC_VER >= 1400)  /* }{ */
9797/* Windows (but not DDK) and Visual C++ 2005 or higher */
9898
99#define l_fseek(f,o,w)      _fseeki64(f,o,w)
100#define l_ftell(f)      _ftelli64(f)
101#define l_seeknum      __int64
99#define l_fseek(f,o,w)      _fseeki64(f,o,w)
100#define l_ftell(f)      _ftelli64(f)
101#define l_seeknum       __int64
102102
103#endif   /* } */
103#endif  /* } */
104104
105#endif         /* } */
105#endif          /* } */
106106
107107
108#if !defined(l_fseek)      /* default definitions */
109#define l_fseek(f,o,w)      fseek(f,o,w)
110#define l_ftell(f)      ftell(f)
111#define l_seeknum      long
108#if !defined(l_fseek)       /* default definitions */
109#define l_fseek(f,o,w)      fseek(f,o,w)
110#define l_ftell(f)      ftell(f)
111#define l_seeknum       long
112112#endif
113113
114114/* }====================================================== */
115115
116116
117#define IO_PREFIX   "_IO_"
118#define IO_INPUT   (IO_PREFIX "input")
119#define IO_OUTPUT   (IO_PREFIX "output")
117#define IO_PREFIX   "_IO_"
118#define IO_INPUT    (IO_PREFIX "input")
119#define IO_OUTPUT   (IO_PREFIX "output")
120120
121121
122122typedef luaL_Stream LStream;
123123
124124
125#define tolstream(L)   ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE))
125#define tolstream(L)    ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE))
126126
127#define isclosed(p)   ((p)->closef == NULL)
127#define isclosed(p) ((p)->closef == NULL)
128128
129129
130130static int io_type (lua_State *L) {
131  LStream *p;
132  luaL_checkany(L, 1);
133  p = (LStream *)luaL_testudata(L, 1, LUA_FILEHANDLE);
134  if (p == NULL)
135    lua_pushnil(L);  /* not a file */
136  else if (isclosed(p))
137    lua_pushliteral(L, "closed file");
138  else
139    lua_pushliteral(L, "file");
140  return 1;
131   LStream *p;
132   luaL_checkany(L, 1);
133   p = (LStream *)luaL_testudata(L, 1, LUA_FILEHANDLE);
134   if (p == NULL)
135   lua_pushnil(L);  /* not a file */
136   else if (isclosed(p))
137   lua_pushliteral(L, "closed file");
138   else
139   lua_pushliteral(L, "file");
140   return 1;
141141}
142142
143143
144144static int f_tostring (lua_State *L) {
145  LStream *p = tolstream(L);
146  if (isclosed(p))
147    lua_pushliteral(L, "file (closed)");
148  else
149    lua_pushfstring(L, "file (%p)", p->f);
150  return 1;
145   LStream *p = tolstream(L);
146   if (isclosed(p))
147   lua_pushliteral(L, "file (closed)");
148   else
149   lua_pushfstring(L, "file (%p)", p->f);
150   return 1;
151151}
152152
153153
154154static FILE *tofile (lua_State *L) {
155  LStream *p = tolstream(L);
156  if (isclosed(p))
157    luaL_error(L, "attempt to use a closed file");
158  lua_assert(p->f);
159  return p->f;
155   LStream *p = tolstream(L);
156   if (isclosed(p))
157   luaL_error(L, "attempt to use a closed file");
158   lua_assert(p->f);
159   return p->f;
160160}
161161
162162
r31373r31374
166166** file is not left opened.
167167*/
168168static LStream *newprefile (lua_State *L) {
169  LStream *p = (LStream *)lua_newuserdata(L, sizeof(LStream));
170  p->closef = NULL;  /* mark file handle as 'closed' */
171  luaL_setmetatable(L, LUA_FILEHANDLE);
172  return p;
169   LStream *p = (LStream *)lua_newuserdata(L, sizeof(LStream));
170   p->closef = NULL;  /* mark file handle as 'closed' */
171   luaL_setmetatable(L, LUA_FILEHANDLE);
172   return p;
173173}
174174
175175
176176static int aux_close (lua_State *L) {
177  LStream *p = tolstream(L);
178  lua_CFunction cf = p->closef;
179  p->closef = NULL;  /* mark stream as closed */
180  return (*cf)(L);  /* close it */
177   LStream *p = tolstream(L);
178   lua_CFunction cf = p->closef;
179   p->closef = NULL;  /* mark stream as closed */
180   return (*cf)(L);  /* close it */
181181}
182182
183183
184184static int io_close (lua_State *L) {
185  if (lua_isnone(L, 1))  /* no argument? */
186    lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT);  /* use standard output */
187  tofile(L);  /* make sure argument is an open stream */
188  return aux_close(L);
185   if (lua_isnone(L, 1))  /* no argument? */
186   lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT);  /* use standard output */
187   tofile(L);  /* make sure argument is an open stream */
188   return aux_close(L);
189189}
190190
191191
192192static int f_gc (lua_State *L) {
193  LStream *p = tolstream(L);
194  if (!isclosed(p) && p->f != NULL)
195    aux_close(L);  /* ignore closed and incompletely open files */
196  return 0;
193   LStream *p = tolstream(L);
194   if (!isclosed(p) && p->f != NULL)
195   aux_close(L);  /* ignore closed and incompletely open files */
196   return 0;
197197}
198198
199199
r31373r31374
201201** function to close regular files
202202*/
203203static int io_fclose (lua_State *L) {
204  LStream *p = tolstream(L);
205  int res = fclose(p->f);
206  return luaL_fileresult(L, (res == 0), NULL);
204   LStream *p = tolstream(L);
205   int res = fclose(p->f);
206   return luaL_fileresult(L, (res == 0), NULL);
207207}
208208
209209
210210static LStream *newfile (lua_State *L) {
211  LStream *p = newprefile(L);
212  p->f = NULL;
213  p->closef = &io_fclose;
214  return p;
211   LStream *p = newprefile(L);
212   p->f = NULL;
213   p->closef = &io_fclose;
214   return p;
215215}
216216
217217
218218static void opencheck (lua_State *L, const char *fname, const char *mode) {
219  LStream *p = newfile(L);
220  p->f = fopen(fname, mode);
221  if (p->f == NULL)
222    luaL_error(L, "cannot open file " LUA_QS " (%s)", fname, strerror(errno));
219   LStream *p = newfile(L);
220   p->f = fopen(fname, mode);
221   if (p->f == NULL)
222   luaL_error(L, "cannot open file " LUA_QS " (%s)", fname, strerror(errno));
223223}
224224
225225
226226static int io_open (lua_State *L) {
227  const char *filename = luaL_checkstring(L, 1);
228  const char *mode = luaL_optstring(L, 2, "r");
229  LStream *p = newfile(L);
230  const char *md = mode;  /* to traverse/check mode */
231  luaL_argcheck(L, lua_checkmode(md), 2, "invalid mode");
232  p->f = fopen(filename, mode);
233  return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;
227   const char *filename = luaL_checkstring(L, 1);
228   const char *mode = luaL_optstring(L, 2, "r");
229   LStream *p = newfile(L);
230   const char *md = mode;  /* to traverse/check mode */
231   luaL_argcheck(L, lua_checkmode(md), 2, "invalid mode");
232   p->f = fopen(filename, mode);
233   return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;
234234}
235235
236236
r31373r31374
238238** function to close 'popen' files
239239*/
240240static int io_pclose (lua_State *L) {
241  LStream *p = tolstream(L);
242  return luaL_execresult(L, lua_pclose(L, p->f));
241   LStream *p = tolstream(L);
242   return luaL_execresult(L, lua_pclose(L, p->f));
243243}
244244
245245
246246static int io_popen (lua_State *L) {
247  const char *filename = luaL_checkstring(L, 1);
248  const char *mode = luaL_optstring(L, 2, "r");
249  LStream *p = newprefile(L);
250  p->f = lua_popen(L, filename, mode);
251  p->closef = &io_pclose;
252  return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;
247   const char *filename = luaL_checkstring(L, 1);
248   const char *mode = luaL_optstring(L, 2, "r");
249   LStream *p = newprefile(L);
250   p->f = lua_popen(L, filename, mode);
251   p->closef = &io_pclose;
252   return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;
253253}
254254
255255
256256static int io_tmpfile (lua_State *L) {
257  LStream *p = newfile(L);
258  p->f = tmpfile();
259  return (p->f == NULL) ? luaL_fileresult(L, 0, NULL) : 1;
257   LStream *p = newfile(L);
258   p->f = tmpfile();
259   return (p->f == NULL) ? luaL_fileresult(L, 0, NULL) : 1;
260260}
261261
262262
263263static FILE *getiofile (lua_State *L, const char *findex) {
264  LStream *p;
265  lua_getfield(L, LUA_REGISTRYINDEX, findex);
266  p = (LStream *)lua_touserdata(L, -1);
267  if (isclosed(p))
268    luaL_error(L, "standard %s file is closed", findex + strlen(IO_PREFIX));
269  return p->f;
264   LStream *p;
265   lua_getfield(L, LUA_REGISTRYINDEX, findex);
266   p = (LStream *)lua_touserdata(L, -1);
267   if (isclosed(p))
268   luaL_error(L, "standard %s file is closed", findex + strlen(IO_PREFIX));
269   return p->f;
270270}
271271
272272
273273static int g_iofile (lua_State *L, const char *f, const char *mode) {
274  if (!lua_isnoneornil(L, 1)) {
275    const char *filename = lua_tostring(L, 1);
276    if (filename)
277      opencheck(L, filename, mode);
278    else {
279      tofile(L);  /* check that it's a valid file handle */
280      lua_pushvalue(L, 1);
281    }
282    lua_setfield(L, LUA_REGISTRYINDEX, f);
283  }
284  /* return current value */
285  lua_getfield(L, LUA_REGISTRYINDEX, f);
286  return 1;
274   if (!lua_isnoneornil(L, 1)) {
275   const char *filename = lua_tostring(L, 1);
276   if (filename)
277      opencheck(L, filename, mode);
278   else {
279      tofile(L);  /* check that it's a valid file handle */
280      lua_pushvalue(L, 1);
281   }
282   lua_setfield(L, LUA_REGISTRYINDEX, f);
283   }
284   /* return current value */
285   lua_getfield(L, LUA_REGISTRYINDEX, f);
286   return 1;
287287}
288288
289289
290290static int io_input (lua_State *L) {
291  return g_iofile(L, IO_INPUT, "r");
291   return g_iofile(L, IO_INPUT, "r");
292292}
293293
294294
295295static int io_output (lua_State *L) {
296  return g_iofile(L, IO_OUTPUT, "w");
296   return g_iofile(L, IO_OUTPUT, "w");
297297}
298298
299299
r31373r31374
301301
302302
303303static void aux_lines (lua_State *L, int toclose) {
304  int i;
305  int n = lua_gettop(L) - 1;  /* number of arguments to read */
306  /* ensure that arguments will fit here and into 'io_readline' stack */
307  luaL_argcheck(L, n <= LUA_MINSTACK - 3, LUA_MINSTACK - 3, "too many options");
308  lua_pushvalue(L, 1);  /* file handle */
309  lua_pushinteger(L, n);  /* number of arguments to read */
310  lua_pushboolean(L, toclose);  /* close/not close file when finished */
311  for (i = 1; i <= n; i++) lua_pushvalue(L, i + 1);  /* copy arguments */
312  lua_pushcclosure(L, io_readline, 3 + n);
304   int i;
305   int n = lua_gettop(L) - 1;  /* number of arguments to read */
306   /* ensure that arguments will fit here and into 'io_readline' stack */
307   luaL_argcheck(L, n <= LUA_MINSTACK - 3, LUA_MINSTACK - 3, "too many options");
308   lua_pushvalue(L, 1);  /* file handle */
309   lua_pushinteger(L, n);  /* number of arguments to read */
310   lua_pushboolean(L, toclose);  /* close/not close file when finished */
311   for (i = 1; i <= n; i++) lua_pushvalue(L, i + 1);  /* copy arguments */
312   lua_pushcclosure(L, io_readline, 3 + n);
313313}
314314
315315
316316static int f_lines (lua_State *L) {
317  tofile(L);  /* check that it's a valid file handle */
318  aux_lines(L, 0);
319  return 1;
317   tofile(L);  /* check that it's a valid file handle */
318   aux_lines(L, 0);
319   return 1;
320320}
321321
322322
323323static int io_lines (lua_State *L) {
324  int toclose;
325  if (lua_isnone(L, 1)) lua_pushnil(L);  /* at least one argument */
326  if (lua_isnil(L, 1)) {  /* no file name? */
327    lua_getfield(L, LUA_REGISTRYINDEX, IO_INPUT);  /* get default input */
328    lua_replace(L, 1);  /* put it at index 1 */
329    tofile(L);  /* check that it's a valid file handle */
330    toclose = 0;  /* do not close it after iteration */
331  }
332  else {  /* open a new file */
333    const char *filename = luaL_checkstring(L, 1);
334    opencheck(L, filename, "r");
335    lua_replace(L, 1);  /* put file at index 1 */
336    toclose = 1;  /* close it after iteration */
337  }
338  aux_lines(L, toclose);
339  return 1;
324   int toclose;
325   if (lua_isnone(L, 1)) lua_pushnil(L);  /* at least one argument */
326   if (lua_isnil(L, 1)) {  /* no file name? */
327   lua_getfield(L, LUA_REGISTRYINDEX, IO_INPUT);  /* get default input */
328   lua_replace(L, 1);  /* put it at index 1 */
329   tofile(L);  /* check that it's a valid file handle */
330   toclose = 0;  /* do not close it after iteration */
331   }
332   else {  /* open a new file */
333   const char *filename = luaL_checkstring(L, 1);
334   opencheck(L, filename, "r");
335   lua_replace(L, 1);  /* put file at index 1 */
336   toclose = 1;  /* close it after iteration */
337   }
338   aux_lines(L, toclose);
339   return 1;
340340}
341341
342342
r31373r31374
348348
349349
350350static int read_number (lua_State *L, FILE *f) {
351  lua_Number d;
352  if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {
353    lua_pushnumber(L, d);
354    return 1;
355  }
356  else {
357   lua_pushnil(L);  /* "result" to be removed */
358   return 0;  /* read fails */
359  }
351   lua_Number d;
352   if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {
353   lua_pushnumber(L, d);
354   return 1;
355   }
356   else {
357   lua_pushnil(L);  /* "result" to be removed */
358   return 0;  /* read fails */
359   }
360360}
361361
362362
363363static int test_eof (lua_State *L, FILE *f) {
364  int c = getc(f);
365  ungetc(c, f);
366  lua_pushlstring(L, NULL, 0);
367  return (c != EOF);
364   int c = getc(f);
365   ungetc(c, f);
366   lua_pushlstring(L, NULL, 0);
367   return (c != EOF);
368368}
369369
370370
371371static int read_line (lua_State *L, FILE *f, int chop) {
372  luaL_Buffer b;
373  luaL_buffinit(L, &b);
374  for (;;) {
375    size_t l;
376    char *p = luaL_prepbuffer(&b);
377    if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) {  /* eof? */
378      luaL_pushresult(&b);  /* close buffer */
379      return (lua_rawlen(L, -1) > 0);  /* check whether read something */
380    }
381    l = strlen(p);
382    if (l == 0 || p[l-1] != '\n')
383      luaL_addsize(&b, l);
384    else {
385      luaL_addsize(&b, l - chop);  /* chop 'eol' if needed */
386      luaL_pushresult(&b);  /* close buffer */
387      return 1;  /* read at least an `eol' */
388    }
389  }
372   luaL_Buffer b;
373   luaL_buffinit(L, &b);
374   for (;;) {
375   size_t l;
376   char *p = luaL_prepbuffer(&b);
377   if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) {  /* eof? */
378      luaL_pushresult(&b);  /* close buffer */
379      return (lua_rawlen(L, -1) > 0);  /* check whether read something */
380   }
381   l = strlen(p);
382   if (l == 0 || p[l-1] != '\n')
383      luaL_addsize(&b, l);
384   else {
385      luaL_addsize(&b, l - chop);  /* chop 'eol' if needed */
386      luaL_pushresult(&b);  /* close buffer */
387      return 1;  /* read at least an `eol' */
388   }
389   }
390390}
391391
392392
393#define MAX_SIZE_T   (~(size_t)0)
393#define MAX_SIZE_T  (~(size_t)0)
394394
395395static void read_all (lua_State *L, FILE *f) {
396  size_t rlen = LUAL_BUFFERSIZE;  /* how much to read in each cycle */
397  luaL_Buffer b;
398  luaL_buffinit(L, &b);
399  for (;;) {
400    char *p = luaL_prepbuffsize(&b, rlen);
401    size_t nr = fread(p, sizeof(char), rlen, f);
402    luaL_addsize(&b, nr);
403    if (nr < rlen) break;  /* eof? */
404    else if (rlen <= (MAX_SIZE_T / 4))  /* avoid buffers too large */
405      rlen *= 2;  /* double buffer size at each iteration */
406  }
407  luaL_pushresult(&b);  /* close buffer */
396   size_t rlen = LUAL_BUFFERSIZE;  /* how much to read in each cycle */
397   luaL_Buffer b;
398   luaL_buffinit(L, &b);
399   for (;;) {
400   char *p = luaL_prepbuffsize(&b, rlen);
401   size_t nr = fread(p, sizeof(char), rlen, f);
402   luaL_addsize(&b, nr);
403   if (nr < rlen) break;  /* eof? */
404   else if (rlen <= (MAX_SIZE_T / 4))  /* avoid buffers too large */
405      rlen *= 2;  /* double buffer size at each iteration */
406   }
407   luaL_pushresult(&b);  /* close buffer */
408408}
409409
410410
411411static int read_chars (lua_State *L, FILE *f, size_t n) {
412  size_t nr;  /* number of chars actually read */
413  char *p;
414  luaL_Buffer b;
415  luaL_buffinit(L, &b);
416  p = luaL_prepbuffsize(&b, n);  /* prepare buffer to read whole block */
417  nr = fread(p, sizeof(char), n, f);  /* try to read 'n' chars */
418  luaL_addsize(&b, nr);
419  luaL_pushresult(&b);  /* close buffer */
420  return (nr > 0);  /* true iff read something */
412   size_t nr;  /* number of chars actually read */
413   char *p;
414   luaL_Buffer b;
415   luaL_buffinit(L, &b);
416   p = luaL_prepbuffsize(&b, n);  /* prepare buffer to read whole block */
417   nr = fread(p, sizeof(char), n, f);  /* try to read 'n' chars */
418   luaL_addsize(&b, nr);
419   luaL_pushresult(&b);  /* close buffer */
420   return (nr > 0);  /* true iff read something */
421421}
422422
423423
424424static int g_read (lua_State *L, FILE *f, int first) {
425  int nargs = lua_gettop(L) - 1;
426  int success;
427  int n;
428  clearerr(f);
429  if (nargs == 0) {  /* no arguments? */
430    success = read_line(L, f, 1);
431    n = first+1;  /* to return 1 result */
432  }
433  else {  /* ensure stack space for all results and for auxlib's buffer */
434    luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments");
435    success = 1;
436    for (n = first; nargs-- && success; n++) {
437      if (lua_type(L, n) == LUA_TNUMBER) {
438        size_t l = (size_t)lua_tointeger(L, n);
439        success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l);
440      }
441      else {
442        const char *p = lua_tostring(L, n);
443        luaL_argcheck(L, p && p[0] == '*', n, "invalid option");
444        switch (p[1]) {
445          case 'n':  /* number */
446            success = read_number(L, f);
447            break;
448          case 'l':  /* line */
449            success = read_line(L, f, 1);
450            break;
451          case 'L':  /* line with end-of-line */
452            success = read_line(L, f, 0);
453            break;
454          case 'a':  /* file */
455            read_all(L, f);  /* read entire file */
456            success = 1; /* always success */
457            break;
458          default:
459            return luaL_argerror(L, n, "invalid format");
460        }
461      }
462    }
463  }
464  if (ferror(f))
465    return luaL_fileresult(L, 0, NULL);
466  if (!success) {
467    lua_pop(L, 1);  /* remove last result */
468    lua_pushnil(L);  /* push nil instead */
469  }
470  return n - first;
425   int nargs = lua_gettop(L) - 1;
426   int success;
427   int n;
428   clearerr(f);
429   if (nargs == 0) {  /* no arguments? */
430   success = read_line(L, f, 1);
431   n = first+1;  /* to return 1 result */
432   }
433   else {  /* ensure stack space for all results and for auxlib's buffer */
434   luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments");
435   success = 1;
436   for (n = first; nargs-- && success; n++) {
437      if (lua_type(L, n) == LUA_TNUMBER) {
438      size_t l = (size_t)lua_tointeger(L, n);
439      success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l);
440      }
441      else {
442      const char *p = lua_tostring(L, n);
443      luaL_argcheck(L, p && p[0] == '*', n, "invalid option");
444      switch (p[1]) {
445         case 'n':  /* number */
446         success = read_number(L, f);
447         break;
448         case 'l':  /* line */
449         success = read_line(L, f, 1);
450         break;
451         case 'L':  /* line with end-of-line */
452         success = read_line(L, f, 0);
453         break;
454         case 'a':  /* file */
455         read_all(L, f);  /* read entire file */
456         success = 1; /* always success */
457         break;
458         default:
459         return luaL_argerror(L, n, "invalid format");
460      }
461      }
462   }
463   }
464   if (ferror(f))
465   return luaL_fileresult(L, 0, NULL);
466   if (!success) {
467   lua_pop(L, 1);  /* remove last result */
468   lua_pushnil(L);  /* push nil instead */
469   }
470   return n - first;
471471}
472472
473473
474474static int io_read (lua_State *L) {
475  return g_read(L, getiofile(L, IO_INPUT), 1);
475   return g_read(L, getiofile(L, IO_INPUT), 1);
476476}
477477
478478
479479static int f_read (lua_State *L) {
480  return g_read(L, tofile(L), 2);
480   return g_read(L, tofile(L), 2);
481481}
482482
483483
484484static int io_readline (lua_State *L) {
485  LStream *p = (LStream *)lua_touserdata(L, lua_upvalueindex(1));
486  int i;
487  int n = (int)lua_tointeger(L, lua_upvalueindex(2));
488  if (isclosed(p))  /* file is already closed? */
489    return luaL_error(L, "file is already closed");
490  lua_settop(L , 1);
491  for (i = 1; i <= n; i++)  /* push arguments to 'g_read' */
492    lua_pushvalue(L, lua_upvalueindex(3 + i));
493  n = g_read(L, p->f, 2);  /* 'n' is number of results */
494  lua_assert(n > 0);  /* should return at least a nil */
495  if (!lua_isnil(L, -n))  /* read at least one value? */
496    return n;  /* return them */
497  else {  /* first result is nil: EOF or error */
498    if (n > 1) {  /* is there error information? */
499      /* 2nd result is error message */
500      return luaL_error(L, "%s", lua_tostring(L, -n + 1));
501    }
502    if (lua_toboolean(L, lua_upvalueindex(3))) {  /* generator created file? */
503      lua_settop(L, 0);
504      lua_pushvalue(L, lua_upvalueindex(1));
505      aux_close(L);  /* close it */
506    }
507    return 0;
508  }
485   LStream *p = (LStream *)lua_touserdata(L, lua_upvalueindex(1));
486   int i;
487   int n = (int)lua_tointeger(L, lua_upvalueindex(2));
488   if (isclosed(p))  /* file is already closed? */
489   return luaL_error(L, "file is already closed");
490   lua_settop(L , 1);
491   for (i = 1; i <= n; i++)  /* push arguments to 'g_read' */
492   lua_pushvalue(L, lua_upvalueindex(3 + i));
493   n = g_read(L, p->f, 2);  /* 'n' is number of results */
494   lua_assert(n > 0);  /* should return at least a nil */
495   if (!lua_isnil(L, -n))  /* read at least one value? */
496   return n;  /* return them */
497   else {  /* first result is nil: EOF or error */
498   if (n > 1) {  /* is there error information? */
499      /* 2nd result is error message */
500      return luaL_error(L, "%s", lua_tostring(L, -n + 1));
501   }
502   if (lua_toboolean(L, lua_upvalueindex(3))) {  /* generator created file? */
503      lua_settop(L, 0);
504      lua_pushvalue(L, lua_upvalueindex(1));
505      aux_close(L);  /* close it */
506   }
507   return 0;
508   }
509509}
510510
511511/* }====================================================== */
512512
513513
514514static int g_write (lua_State *L, FILE *f, int arg) {
515  int nargs = lua_gettop(L) - arg;
516  int status = 1;
517  for (; nargs--; arg++) {
518    if (lua_type(L, arg) == LUA_TNUMBER) {
519      /* optimization: could be done exactly as for strings */
520      status = status &&
521          fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0;
522    }
523    else {
524      size_t l;
525      const char *s = luaL_checklstring(L, arg, &l);
526      status = status && (fwrite(s, sizeof(char), l, f) == l);
527    }
528  }
529  if (status) return 1;  /* file handle already on stack top */
530  else return luaL_fileresult(L, status, NULL);
515   int nargs = lua_gettop(L) - arg;
516   int status = 1;
517   for (; nargs--; arg++) {
518   if (lua_type(L, arg) == LUA_TNUMBER) {
519      /* optimization: could be done exactly as for strings */
520      status = status &&
521         fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0;
522   }
523   else {
524      size_t l;
525      const char *s = luaL_checklstring(L, arg, &l);
526      status = status && (fwrite(s, sizeof(char), l, f) == l);
527   }
528   }
529   if (status) return 1;  /* file handle already on stack top */
530   else return luaL_fileresult(L, status, NULL);
531531}
532532
533533
534534static int io_write (lua_State *L) {
535  return g_write(L, getiofile(L, IO_OUTPUT), 1);
535   return g_write(L, getiofile(L, IO_OUTPUT), 1);
536536}
537537
538538
539539static int f_write (lua_State *L) {
540  FILE *f = tofile(L);
541  lua_pushvalue(L, 1);  /* push file at the stack top (to be returned) */
542  return g_write(L, f, 2);
540   FILE *f = tofile(L);
541   lua_pushvalue(L, 1);  /* push file at the stack top (to be returned) */
542   return g_write(L, f, 2);
543543}
544544
545545
546546static int f_seek (lua_State *L) {
547  static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END};
548  static const char *const modenames[] = {"set", "cur", "end", NULL};
549  FILE *f = tofile(L);
550  int op = luaL_checkoption(L, 2, "cur", modenames);
551  lua_Number p3 = luaL_optnumber(L, 3, 0);
552  l_seeknum offset = (l_seeknum)p3;
553  luaL_argcheck(L, (lua_Number)offset == p3, 3,
554                  "not an integer in proper range");
555  op = l_fseek(f, offset, mode[op]);
556  if (op)
557    return luaL_fileresult(L, 0, NULL);  /* error */
558  else {
559    lua_pushnumber(L, (lua_Number)(1.0 * l_ftell(f)));
560    return 1;
561  }
547   static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END};
548   static const char *const modenames[] = {"set", "cur", "end", NULL};
549   FILE *f = tofile(L);
550   int op = luaL_checkoption(L, 2, "cur", modenames);
551   lua_Number p3 = luaL_optnumber(L, 3, 0);
552   l_seeknum offset = (l_seeknum)p3;
553   luaL_argcheck(L, (lua_Number)offset == p3, 3,
554               "not an integer in proper range");
555   op = l_fseek(f, offset, mode[op]);
556   if (op)
557   return luaL_fileresult(L, 0, NULL);  /* error */
558   else {
559   lua_pushnumber(L, (lua_Number)(1.0 * l_ftell(f)));
560   return 1;
561   }
562562}
563563
564564
565565static int f_setvbuf (lua_State *L) {
566  static const int mode[] = {_IONBF, _IOFBF, _IOLBF};
567  static const char *const modenames[] = {"no", "full", "line", NULL};
568  FILE *f = tofile(L);
569  int op = luaL_checkoption(L, 2, NULL, modenames);
570  lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE);
571  int res = setvbuf(f, NULL, mode[op], sz);
572  return luaL_fileresult(L, res == 0, NULL);
566   static const int mode[] = {_IONBF, _IOFBF, _IOLBF};
567   static const char *const modenames[] = {"no", "full", "line", NULL};
568   FILE *f = tofile(L);
569   int op = luaL_checkoption(L, 2, NULL, modenames);
570   lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE);
571   int res = setvbuf(f, NULL, mode[op], sz);
572   return luaL_fileresult(L, res == 0, NULL);
573573}
574574
575575
576576
577577static int io_flush (lua_State *L) {
578  return luaL_fileresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL);
578   return luaL_fileresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL);
579579}
580580
581581
582582static int f_flush (lua_State *L) {
583  return luaL_fileresult(L, fflush(tofile(L)) == 0, NULL);
583   return luaL_fileresult(L, fflush(tofile(L)) == 0, NULL);
584584}
585585
586586
r31373r31374
588588** functions for 'io' library
589589*/
590590static const luaL_Reg iolib[] = {
591  {"close", io_close},
592  {"flush", io_flush},
593  {"input", io_input},
594  {"lines", io_lines},
595  {"open", io_open},
596  {"output", io_output},
597  {"popen", io_popen},
598  {"read", io_read},
599  {"tmpfile", io_tmpfile},
600  {"type", io_type},
601  {"write", io_write},
602  {NULL, NULL}
591   {"close", io_close},
592   {"flush", io_flush},
593   {"input", io_input},
594   {"lines", io_lines},
595   {"open", io_open},
596   {"output", io_output},
597   {"popen", io_popen},
598   {"read", io_read},
599   {"tmpfile", io_tmpfile},
600   {"type", io_type},
601   {"write", io_write},
602   {NULL, NULL}
603603};
604604
605605
r31373r31374
607607** methods for file handles
608608*/
609609static const luaL_Reg flib[] = {
610  {"close", io_close},
611  {"flush", f_flush},
612  {"lines", f_lines},
613  {"read", f_read},
614  {"seek", f_seek},
615  {"setvbuf", f_setvbuf},
616  {"write", f_write},
617  {"__gc", f_gc},
618  {"__tostring", f_tostring},
619  {NULL, NULL}
610   {"close", io_close},
611   {"flush", f_flush},
612   {"lines", f_lines},
613   {"read", f_read},
614   {"seek", f_seek},
615   {"setvbuf", f_setvbuf},
616   {"write", f_write},
617   {"__gc", f_gc},
618   {"__tostring", f_tostring},
619   {NULL, NULL}
620620};
621621
622622
623623static void createmeta (lua_State *L) {
624  luaL_newmetatable(L, LUA_FILEHANDLE);  /* create metatable for file handles */
625  lua_pushvalue(L, -1);  /* push metatable */
626  lua_setfield(L, -2, "__index");  /* metatable.__index = metatable */
627  luaL_setfuncs(L, flib, 0);  /* add file methods to new metatable */
628  lua_pop(L, 1);  /* pop new metatable */
624   luaL_newmetatable(L, LUA_FILEHANDLE);  /* create metatable for file handles */
625   lua_pushvalue(L, -1);  /* push metatable */
626   lua_setfield(L, -2, "__index");  /* metatable.__index = metatable */
627   luaL_setfuncs(L, flib, 0);  /* add file methods to new metatable */
628   lua_pop(L, 1);  /* pop new metatable */
629629}
630630
631631
r31373r31374
633633** function to (not) close the standard files stdin, stdout, and stderr
634634*/
635635static int io_noclose (lua_State *L) {
636  LStream *p = tolstream(L);
637  p->closef = &io_noclose;  /* keep file opened */
638  lua_pushnil(L);
639  lua_pushliteral(L, "cannot close standard file");
640  return 2;
636   LStream *p = tolstream(L);
637   p->closef = &io_noclose;  /* keep file opened */
638   lua_pushnil(L);
639   lua_pushliteral(L, "cannot close standard file");
640   return 2;
641641}
642642
643643
644644static void createstdfile (lua_State *L, FILE *f, const char *k,
645                           const char *fname) {
646  LStream *p = newprefile(L);
647  p->f = f;
648  p->closef = &io_noclose;
649  if (k != NULL) {
650    lua_pushvalue(L, -1);
651    lua_setfield(L, LUA_REGISTRYINDEX, k);  /* add file to registry */
652  }
653  lua_setfield(L, -2, fname);  /* add file to module */
645                     const char *fname) {
646   LStream *p = newprefile(L);
647   p->f = f;
648   p->closef = &io_noclose;
649   if (k != NULL) {
650   lua_pushvalue(L, -1);
651   lua_setfield(L, LUA_REGISTRYINDEX, k);  /* add file to registry */
652   }
653   lua_setfield(L, -2, fname);  /* add file to module */
654654}
655655
656656
657657LUAMOD_API int luaopen_io (lua_State *L) {
658  luaL_newlib(L, iolib);  /* new module */
659  createmeta(L);
660  /* create (and set) default files */
661  createstdfile(L, stdin, IO_INPUT, "stdin");
662  createstdfile(L, stdout, IO_OUTPUT, "stdout");
663  createstdfile(L, stderr, NULL, "stderr");
664  return 1;
658   luaL_newlib(L, iolib);  /* new module */
659   createmeta(L);
660   /* create (and set) default files */
661   createstdfile(L, stdin, IO_INPUT, "stdin");
662   createstdfile(L, stdout, IO_OUTPUT, "stdout");
663   createstdfile(L, stderr, NULL, "stderr");
664   return 1;
665665}
666
trunk/src/lib/lua/lstrlib.c
r31373r31374
2525** pattern-matching. This limit is arbitrary.
2626*/
2727#if !defined(LUA_MAXCAPTURES)
28#define LUA_MAXCAPTURES      32
28#define LUA_MAXCAPTURES     32
2929#endif
3030
3131
3232/* macro to `unsign' a character */
33#define uchar(c)   ((unsigned char)(c))
33#define uchar(c)    ((unsigned char)(c))
3434
3535
3636
3737static int str_len (lua_State *L) {
38  size_t l;
39  luaL_checklstring(L, 1, &l);
40  lua_pushinteger(L, (lua_Integer)l);
41  return 1;
38   size_t l;
39   luaL_checklstring(L, 1, &l);
40   lua_pushinteger(L, (lua_Integer)l);
41   return 1;
4242}
4343
4444
4545/* translate a relative string position: negative means back from end */
4646static size_t posrelat (ptrdiff_t pos, size_t len) {
47  if (pos >= 0) return (size_t)pos;
48  else if (0u - (size_t)pos > len) return 0;
49  else return len - ((size_t)-pos) + 1;
47   if (pos >= 0) return (size_t)pos;
48   else if (0u - (size_t)pos > len) return 0;
49   else return len - ((size_t)-pos) + 1;
5050}
5151
5252
5353static int str_sub (lua_State *L) {
54  size_t l;
55  const char *s = luaL_checklstring(L, 1, &l);
56  size_t start = posrelat(luaL_checkinteger(L, 2), l);
57  size_t end = posrelat(luaL_optinteger(L, 3, -1), l);
58  if (start < 1) start = 1;
59  if (end > l) end = l;
60  if (start <= end)
61    lua_pushlstring(L, s + start - 1, end - start + 1);
62  else lua_pushliteral(L, "");
63  return 1;
54   size_t l;
55   const char *s = luaL_checklstring(L, 1, &l);
56   size_t start = posrelat(luaL_checkinteger(L, 2), l);
57   size_t end = posrelat(luaL_optinteger(L, 3, -1), l);
58   if (start < 1) start = 1;
59   if (end > l) end = l;
60   if (start <= end)
61   lua_pushlstring(L, s + start - 1, end - start + 1);
62   else lua_pushliteral(L, "");
63   return 1;
6464}
6565
6666
6767static int str_reverse (lua_State *L) {
68  size_t l, i;
69  luaL_Buffer b;
70  const char *s = luaL_checklstring(L, 1, &l);
71  char *p = luaL_buffinitsize(L, &b, l);
72  for (i = 0; i < l; i++)
73    p[i] = s[l - i - 1];
74  luaL_pushresultsize(&b, l);
75  return 1;
68   size_t l, i;
69   luaL_Buffer b;
70   const char *s = luaL_checklstring(L, 1, &l);
71   char *p = luaL_buffinitsize(L, &b, l);
72   for (i = 0; i < l; i++)
73   p[i] = s[l - i - 1];
74   luaL_pushresultsize(&b, l);
75   return 1;
7676}
7777
7878
7979static int str_lower (lua_State *L) {
80  size_t l;
81  size_t i;
82  luaL_Buffer b;
83  const char *s = luaL_checklstring(L, 1, &l);
84  char *p = luaL_buffinitsize(L, &b, l);
85  for (i=0; i<l; i++)
86    p[i] = tolower(uchar(s[i]));
87  luaL_pushresultsize(&b, l);
88  return 1;
80   size_t l;
81   size_t i;
82   luaL_Buffer b;
83   const char *s = luaL_checklstring(L, 1, &l);
84   char *p = luaL_buffinitsize(L, &b, l);
85   for (i=0; i<l; i++)
86   p[i] = tolower(uchar(s[i]));
87   luaL_pushresultsize(&b, l);
88   return 1;
8989}
9090
9191
9292static int str_upper (lua_State *L) {
93  size_t l;
94  size_t i;
95  luaL_Buffer b;
96  const char *s = luaL_checklstring(L, 1, &l);
97  char *p = luaL_buffinitsize(L, &b, l);
98  for (i=0; i<l; i++)
99    p[i] = toupper(uchar(s[i]));
100  luaL_pushresultsize(&b, l);
101  return 1;
93   size_t l;
94   size_t i;
95   luaL_Buffer b;
96   const char *s = luaL_checklstring(L, 1, &l);
97   char *p = luaL_buffinitsize(L, &b, l);
98   for (i=0; i<l; i++)
99   p[i] = toupper(uchar(s[i]));
100   luaL_pushresultsize(&b, l);
101   return 1;
102102}
103103
104104
105105/* reasonable limit to avoid arithmetic overflow */
106#define MAXSIZE      ((~(size_t)0) >> 1)
106#define MAXSIZE     ((~(size_t)0) >> 1)
107107
108108static int str_rep (lua_State *L) {
109  size_t l, lsep;
110  const char *s = luaL_checklstring(L, 1, &l);
111  int n = luaL_checkint(L, 2);
112  const char *sep = luaL_optlstring(L, 3, "", &lsep);
113  if (n <= 0) lua_pushliteral(L, "");
114  else if (l + lsep < l || l + lsep >= MAXSIZE / n)  /* may overflow? */
115    return luaL_error(L, "resulting string too large");
116  else {
117    size_t totallen = n * l + (n - 1) * lsep;
118    luaL_Buffer b;
119    char *p = luaL_buffinitsize(L, &b, totallen);
120    while (n-- > 1) {  /* first n-1 copies (followed by separator) */
121      memcpy(p, s, l * sizeof(char)); p += l;
122      if (lsep > 0) {  /* avoid empty 'memcpy' (may be expensive) */
123        memcpy(p, sep, lsep * sizeof(char)); p += lsep;
124      }
125    }
126    memcpy(p, s, l * sizeof(char));  /* last copy (not followed by separator) */
127    luaL_pushresultsize(&b, totallen);
128  }
129  return 1;
109   size_t l, lsep;
110   const char *s = luaL_checklstring(L, 1, &l);
111   int n = luaL_checkint(L, 2);
112   const char *sep = luaL_optlstring(L, 3, "", &lsep);
113   if (n <= 0) lua_pushliteral(L, "");
114   else if (l + lsep < l || l + lsep >= MAXSIZE / n)  /* may overflow? */
115   return luaL_error(L, "resulting string too large");
116   else {
117   size_t totallen = n * l + (n - 1) * lsep;
118   luaL_Buffer b;
119   char *p = luaL_buffinitsize(L, &b, totallen);
120   while (n-- > 1) {  /* first n-1 copies (followed by separator) */
121      memcpy(p, s, l * sizeof(char)); p += l;
122      if (lsep > 0) {  /* avoid empty 'memcpy' (may be expensive) */
123      memcpy(p, sep, lsep * sizeof(char)); p += lsep;
124      }
125   }
126   memcpy(p, s, l * sizeof(char));  /* last copy (not followed by separator) */
127   luaL_pushresultsize(&b, totallen);
128   }
129   return 1;
130130}
131131
132132
133133static int str_byte (lua_State *L) {
134  size_t l;
135  const char *s = luaL_checklstring(L, 1, &l);
136  size_t posi = posrelat(luaL_optinteger(L, 2, 1), l);
137  size_t pose = posrelat(luaL_optinteger(L, 3, posi), l);
138  int n, i;
139  if (posi < 1) posi = 1;
140  if (pose > l) pose = l;
141  if (posi > pose) return 0;  /* empty interval; return no values */
142  n = (int)(pose -  posi + 1);
143  if (posi + n <= pose)  /* (size_t -> int) overflow? */
144    return luaL_error(L, "string slice too long");
145  luaL_checkstack(L, n, "string slice too long");
146  for (i=0; i<n; i++)
147    lua_pushinteger(L, uchar(s[posi+i-1]));
148  return n;
134   size_t l;
135   const char *s = luaL_checklstring(L, 1, &l);
136   size_t posi = posrelat(luaL_optinteger(L, 2, 1), l);
137   size_t pose = posrelat(luaL_optinteger(L, 3, posi), l);
138   int n, i;
139   if (posi < 1) posi = 1;
140   if (pose > l) pose = l;
141   if (posi > pose) return 0;  /* empty interval; return no values */
142   n = (int)(pose -  posi + 1);
143   if (posi + n <= pose)  /* (size_t -> int) overflow? */
144   return luaL_error(L, "string slice too long");
145   luaL_checkstack(L, n, "string slice too long");
146   for (i=0; i<n; i++)
147   lua_pushinteger(L, uchar(s[posi+i-1]));
148   return n;
149149}
150150
151151
152152static int str_char (lua_State *L) {
153  int n = lua_gettop(L);  /* number of arguments */
154  int i;
155  luaL_Buffer b;
156  char *p = luaL_buffinitsize(L, &b, n);
157  for (i=1; i<=n; i++) {
158    int c = luaL_checkint(L, i);
159    luaL_argcheck(L, uchar(c) == c, i, "value out of range");
160    p[i - 1] = uchar(c);
161  }
162  luaL_pushresultsize(&b, n);
163  return 1;
153   int n = lua_gettop(L);  /* number of arguments */
154   int i;
155   luaL_Buffer b;
156   char *p = luaL_buffinitsize(L, &b, n);
157   for (i=1; i<=n; i++) {
158   int c = luaL_checkint(L, i);
159   luaL_argcheck(L, uchar(c) == c, i, "value out of range");
160   p[i - 1] = uchar(c);
161   }
162   luaL_pushresultsize(&b, n);
163   return 1;
164164}
165165
166166
167167static int writer (lua_State *L, const void* b, size_t size, void* B) {
168  (void)L;
169  luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);
170  return 0;
168   (void)L;
169   luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);
170   return 0;
171171}
172172
173173
174174static int str_dump (lua_State *L) {
175  luaL_Buffer b;
176  luaL_checktype(L, 1, LUA_TFUNCTION);
177  lua_settop(L, 1);
178  luaL_buffinit(L,&b);
179  if (lua_dump(L, writer, &b) != 0)
180    return luaL_error(L, "unable to dump given function");
181  luaL_pushresult(&b);
182  return 1;
175   luaL_Buffer b;
176   luaL_checktype(L, 1, LUA_TFUNCTION);
177   lua_settop(L, 1);
178   luaL_buffinit(L,&b);
179   if (lua_dump(L, writer, &b) != 0)
180   return luaL_error(L, "unable to dump given function");
181   luaL_pushresult(&b);
182   return 1;
183183}
184184
185185
r31373r31374
191191*/
192192
193193
194#define CAP_UNFINISHED   (-1)
195#define CAP_POSITION   (-2)
194#define CAP_UNFINISHED  (-1)
195#define CAP_POSITION    (-2)
196196
197197
198198typedef struct MatchState {
199  int matchdepth;  /* control for recursive depth (to avoid C stack overflow) */
200  const char *src_init;  /* init of source string */
201  const char *src_end;  /* end ('\0') of source string */
202  const char *p_end;  /* end ('\0') of pattern */
203  lua_State *L;
204  int level;  /* total number of captures (finished or unfinished) */
205  struct {
206    const char *init;
207    ptrdiff_t len;
208  } capture[LUA_MAXCAPTURES];
199   int matchdepth;  /* control for recursive depth (to avoid C stack overflow) */
200   const char *src_init;  /* init of source string */
201   const char *src_end;  /* end ('\0') of source string */
202   const char *p_end;  /* end ('\0') of pattern */
203   lua_State *L;
204   int level;  /* total number of captures (finished or unfinished) */
205   struct {
206   const char *init;
207   ptrdiff_t len;
208   } capture[LUA_MAXCAPTURES];
209209} MatchState;
210210
211211
r31373r31374
215215
216216/* maximum recursion depth for 'match' */
217217#if !defined(MAXCCALLS)
218#define MAXCCALLS   200
218#define MAXCCALLS   200
219219#endif
220220
221221
222#define L_ESC      '%'
223#define SPECIALS   "^$*+?.([%-"
222#define L_ESC       '%'
223#define SPECIALS    "^$*+?.([%-"
224224
225225
226226static int check_capture (MatchState *ms, int l) {
227  l -= '1';
228  if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED)
229    return luaL_error(ms->L, "invalid capture index %%%d", l + 1);
230  return l;
227   l -= '1';
228   if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED)
229   return luaL_error(ms->L, "invalid capture index %%%d", l + 1);
230   return l;
231231}
232232
233233
234234static int capture_to_close (MatchState *ms) {
235  int level = ms->level;
236  for (level--; level>=0; level--)
237    if (ms->capture[level].len == CAP_UNFINISHED) return level;
238  return luaL_error(ms->L, "invalid pattern capture");
235   int level = ms->level;
236   for (level--; level>=0; level--)
237   if (ms->capture[level].len == CAP_UNFINISHED) return level;
238   return luaL_error(ms->L, "invalid pattern capture");
239239}
240240
241241
242242static const char *classend (MatchState *ms, const char *p) {
243  switch (*p++) {
244    case L_ESC: {
245      if (p == ms->p_end)
246        luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")");
247      return p+1;
248    }
249    case '[': {
250      if (*p == '^') p++;
251      do {  /* look for a `]' */
252        if (p == ms->p_end)
253          luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")");
254        if (*(p++) == L_ESC && p < ms->p_end)
255          p++;  /* skip escapes (e.g. `%]') */
256      } while (*p != ']');
257      return p+1;
258    }
259    default: {
260      return p;
261    }
262  }
243   switch (*p++) {
244   case L_ESC: {
245      if (p == ms->p_end)
246      luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")");
247      return p+1;
248   }
249   case '[': {
250      if (*p == '^') p++;
251      do {  /* look for a `]' */
252      if (p == ms->p_end)
253         luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")");
254      if (*(p++) == L_ESC && p < ms->p_end)
255         p++;  /* skip escapes (e.g. `%]') */
256      } while (*p != ']');
257      return p+1;
258   }
259   default: {
260      return p;
261   }
262   }
263263}
264264
265265
266266static int match_class (int c, int cl) {
267  int res;
268  switch (tolower(cl)) {
269    case 'a' : res = isalpha(c); break;
270    case 'c' : res = iscntrl(c); break;
271    case 'd' : res = isdigit(c); break;
272    case 'g' : res = isgraph(c); break;
273    case 'l' : res = islower(c); break;
274    case 'p' : res = ispunct(c); break;
275    case 's' : res = isspace(c); break;
276    case 'u' : res = isupper(c); break;
277    case 'w' : res = isalnum(c); break;
278    case 'x' : res = isxdigit(c); break;
279    case 'z' : res = (c == 0); break;  /* deprecated option */
280    default: return (cl == c);
281  }
282  return (islower(cl) ? res : !res);
267   int res;
268   switch (tolower(cl)) {
269   case 'a' : res = isalpha(c); break;
270   case 'c' : res = iscntrl(c); break;
271   case 'd' : res = isdigit(c); break;
272   case 'g' : res = isgraph(c); break;
273   case 'l' : res = islower(c); break;
274   case 'p' : res = ispunct(c); break;
275   case 's' : res = isspace(c); break;
276   case 'u' : res = isupper(c); break;
277   case 'w' : res = isalnum(c); break;
278   case 'x' : res = isxdigit(c); break;
279   case 'z' : res = (c == 0); break;  /* deprecated option */
280   default: return (cl == c);
281   }
282   return (islower(cl) ? res : !res);
283283}
284284
285285
286286static int matchbracketclass (int c, const char *p, const char *ec) {
287  int sig = 1;
288  if (*(p+1) == '^') {
289    sig = 0;
290    p++;  /* skip the `^' */
291  }
292  while (++p < ec) {
293    if (*p == L_ESC) {
294      p++;
295      if (match_class(c, uchar(*p)))
296        return sig;
297    }
298    else if ((*(p+1) == '-') && (p+2 < ec)) {
299      p+=2;
300      if (uchar(*(p-2)) <= c && c <= uchar(*p))
301        return sig;
302    }
303    else if (uchar(*p) == c) return sig;
304  }
305  return !sig;
287   int sig = 1;
288   if (*(p+1) == '^') {
289   sig = 0;
290   p++;  /* skip the `^' */
291   }
292   while (++p < ec) {
293   if (*p == L_ESC) {
294      p++;
295      if (match_class(c, uchar(*p)))
296      return sig;
297   }
298   else if ((*(p+1) == '-') && (p+2 < ec)) {
299      p+=2;
300      if (uchar(*(p-2)) <= c && c <= uchar(*p))
301      return sig;
302   }
303   else if (uchar(*p) == c) return sig;
304   }
305   return !sig;
306306}
307307
308308
309309static int singlematch (MatchState *ms, const char *s, const char *p,
310                        const char *ep) {
311  if (s >= ms->src_end)
312    return 0;
313  else {
314    int c = uchar(*s);
315    switch (*p) {
316      case '.': return 1;  /* matches any char */
317      case L_ESC: return match_class(c, uchar(*(p+1)));
318      case '[': return matchbracketclass(c, p, ep-1);
319      default:  return (uchar(*p) == c);
320    }
321  }
310                  const char *ep) {
311   if (s >= ms->src_end)
312   return 0;
313   else {
314   int c = uchar(*s);
315   switch (*p) {
316      case '.': return 1;  /* matches any char */
317      case L_ESC: return match_class(c, uchar(*(p+1)));
318      case '[': return matchbracketclass(c, p, ep-1);
319      default:  return (uchar(*p) == c);
320   }
321   }
322322}
323323
324324
325325static const char *matchbalance (MatchState *ms, const char *s,
326                                   const char *p) {
327  if (p >= ms->p_end - 1)
328    luaL_error(ms->L, "malformed pattern "
329                      "(missing arguments to " LUA_QL("%%b") ")");
330  if (*s != *p) return NULL;
331  else {
332    int b = *p;
333    int e = *(p+1);
334    int cont = 1;
335    while (++s < ms->src_end) {
336      if (*s == e) {
337        if (--cont == 0) return s+1;
338      }
339      else if (*s == b) cont++;
340    }
341  }
342  return NULL;  /* string ends out of balance */
326                           const char *p) {
327   if (p >= ms->p_end - 1)
328   luaL_error(ms->L, "malformed pattern "
329                  "(missing arguments to " LUA_QL("%%b") ")");
330   if (*s != *p) return NULL;
331   else {
332   int b = *p;
333   int e = *(p+1);
334   int cont = 1;
335   while (++s < ms->src_end) {
336      if (*s == e) {
337      if (--cont == 0) return s+1;
338      }
339      else if (*s == b) cont++;
340   }
341   }
342   return NULL;  /* string ends out of balance */
343343}
344344
345345
346346static const char *max_expand (MatchState *ms, const char *s,
347                                 const char *p, const char *ep) {
348  ptrdiff_t i = 0;  /* counts maximum expand for item */
349  while (singlematch(ms, s + i, p, ep))
350    i++;
351  /* keeps trying to match with the maximum repetitions */
352  while (i>=0) {
353    const char *res = match(ms, (s+i), ep+1);
354    if (res) return res;
355    i--;  /* else didn't match; reduce 1 repetition to try again */
356  }
357  return NULL;
347                           const char *p, const char *ep) {
348   ptrdiff_t i = 0;  /* counts maximum expand for item */
349   while (singlematch(ms, s + i, p, ep))
350   i++;
351   /* keeps trying to match with the maximum repetitions */
352   while (i>=0) {
353   const char *res = match(ms, (s+i), ep+1);
354   if (res) return res;
355   i--;  /* else didn't match; reduce 1 repetition to try again */
356   }
357   return NULL;
358358}
359359
360360
361361static const char *min_expand (MatchState *ms, const char *s,
362                                 const char *p, const char *ep) {
363  for (;;) {
364    const char *res = match(ms, s, ep+1);
365    if (res != NULL)
366      return res;
367    else if (singlematch(ms, s, p, ep))
368      s++;  /* try with one more repetition */
369    else return NULL;
370  }
362                           const char *p, const char *ep) {
363   for (;;) {
364   const char *res = match(ms, s, ep+1);
365   if (res != NULL)
366      return res;
367   else if (singlematch(ms, s, p, ep))
368      s++;  /* try with one more repetition */
369   else return NULL;
370   }
371371}
372372
373373
374374static const char *start_capture (MatchState *ms, const char *s,
375                                    const char *p, int what) {
376  const char *res;
377  int level = ms->level;
378  if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures");
379  ms->capture[level].init = s;
380  ms->capture[level].len = what;
381  ms->level = level+1;
382  if ((res=match(ms, s, p)) == NULL)  /* match failed? */
383    ms->level--;  /* undo capture */
384  return res;
375                           const char *p, int what) {
376   const char *res;
377   int level = ms->level;
378   if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures");
379   ms->capture[level].init = s;
380   ms->capture[level].len = what;
381   ms->level = level+1;
382   if ((res=match(ms, s, p)) == NULL)  /* match failed? */
383   ms->level--;  /* undo capture */
384   return res;
385385}
386386
387387
388388static const char *end_capture (MatchState *ms, const char *s,
389                                  const char *p) {
390  int l = capture_to_close(ms);
391  const char *res;
392  ms->capture[l].len = s - ms->capture[l].init;  /* close capture */
393  if ((res = match(ms, s, p)) == NULL)  /* match failed? */
394    ms->capture[l].len = CAP_UNFINISHED;  /* undo capture */
395  return res;
389                           const char *p) {
390   int l = capture_to_close(ms);
391   const char *res;
392   ms->capture[l].len = s - ms->capture[l].init;  /* close capture */
393   if ((res = match(ms, s, p)) == NULL)  /* match failed? */
394   ms->capture[l].len = CAP_UNFINISHED;  /* undo capture */
395   return res;
396396}
397397
398398
399399static const char *match_capture (MatchState *ms, const char *s, int l) {
400  size_t len;
401  l = check_capture(ms, l);
402  len = ms->capture[l].len;
403  if ((size_t)(ms->src_end-s) >= len &&
404      memcmp(ms->capture[l].init, s, len) == 0)
405    return s+len;
406  else return NULL;
400   size_t len;
401   l = check_capture(ms, l);
402   len = ms->capture[l].len;
403   if ((size_t)(ms->src_end-s) >= len &&
404      memcmp(ms->capture[l].init, s, len) == 0)
405   return s+len;
406   else return NULL;
407407}
408408
409409
410410static const char *match (MatchState *ms, const char *s, const char *p) {
411  if (ms->matchdepth-- == 0)
412    luaL_error(ms->L, "pattern too complex");
413  init: /* using goto's to optimize tail recursion */
414  if (p != ms->p_end) {  /* end of pattern? */
415    switch (*p) {
416      case '(': {  /* start capture */
417        if (*(p + 1) == ')')  /* position capture? */
418          s = start_capture(ms, s, p + 2, CAP_POSITION);
419        else
420          s = start_capture(ms, s, p + 1, CAP_UNFINISHED);
421        break;
422      }
423      case ')': {  /* end capture */
424        s = end_capture(ms, s, p + 1);
425        break;
426      }
427      case '$': {
428        if ((p + 1) != ms->p_end)  /* is the `$' the last char in pattern? */
429          goto dflt;  /* no; go to default */
430        s = (s == ms->src_end) ? s : NULL;  /* check end of string */
431        break;
432      }
433      case L_ESC: {  /* escaped sequences not in the format class[*+?-]? */
434        switch (*(p + 1)) {
435          case 'b': {  /* balanced string? */
436            s = matchbalance(ms, s, p + 2);
437            if (s != NULL) {
438              p += 4; goto init;  /* return match(ms, s, p + 4); */
439            }  /* else fail (s == NULL) */
440            break;
441          }
442          case 'f': {  /* frontier? */
443            const char *ep; char previous;
444            p += 2;
445            if (*p != '[')
446              luaL_error(ms->L, "missing " LUA_QL("[") " after "
447                                 LUA_QL("%%f") " in pattern");
448            ep = classend(ms, p);  /* points to what is next */
449            previous = (s == ms->src_init) ? '\0' : *(s - 1);
450            if (!matchbracketclass(uchar(previous), p, ep - 1) &&
451               matchbracketclass(uchar(*s), p, ep - 1)) {
452              p = ep; goto init;  /* return match(ms, s, ep); */
453            }
454            s = NULL;  /* match failed */
455            break;
456          }
457          case '0': case '1': case '2': case '3':
458          case '4': case '5': case '6': case '7':
459          case '8': case '9': {  /* capture results (%0-%9)? */
460            s = match_capture(ms, s, uchar(*(p + 1)));
461            if (s != NULL) {
462              p += 2; goto init;  /* return match(ms, s, p + 2) */
463            }
464            break;
465          }
466          default: goto dflt;
467        }
468        break;
469      }
470      default: dflt: {  /* pattern class plus optional suffix */
471        const char *ep = classend(ms, p);  /* points to optional suffix */
472        /* does not match at least once? */
473        if (!singlematch(ms, s, p, ep)) {
474          if (*ep == '*' || *ep == '?' || *ep == '-') {  /* accept empty? */
475            p = ep + 1; goto init;  /* return match(ms, s, ep + 1); */
476          }
477          else  /* '+' or no suffix */
478            s = NULL;  /* fail */
479        }
480        else {  /* matched once */
481          switch (*ep) {  /* handle optional suffix */
482            case '?': {  /* optional */
483              const char *res;
484              if ((res = match(ms, s + 1, ep + 1)) != NULL)
485                s = res;
486              else {
487                p = ep + 1; goto init;  /* else return match(ms, s, ep + 1); */
488              }
489              break;
490            }
491            case '+':  /* 1 or more repetitions */
492              s++;  /* 1 match already done */
493              /* go through */
494            case '*':  /* 0 or more repetitions */
495              s = max_expand(ms, s, p, ep);
496              break;
497            case '-':  /* 0 or more repetitions (minimum) */
498              s = min_expand(ms, s, p, ep);
499              break;
500            default:  /* no suffix */
501              s++; p = ep; goto init;  /* return match(ms, s + 1, ep); */
502          }
503        }
504        break;
505      }
506    }
507  }
508  ms->matchdepth++;
509  return s;
411   if (ms->matchdepth-- == 0)
412   luaL_error(ms->L, "pattern too complex");
413   init: /* using goto's to optimize tail recursion */
414   if (p != ms->p_end) {  /* end of pattern? */
415   switch (*p) {
416      case '(': {  /* start capture */
417      if (*(p + 1) == ')')  /* position capture? */
418         s = start_capture(ms, s, p + 2, CAP_POSITION);
419      else
420         s = start_capture(ms, s, p + 1, CAP_UNFINISHED);
421      break;
422      }
423      case ')': {  /* end capture */
424      s = end_capture(ms, s, p + 1);
425      break;
426      }
427      case '$': {
428      if ((p + 1) != ms->p_end)  /* is the `$' the last char in pattern? */
429         goto dflt;  /* no; go to default */
430      s = (s == ms->src_end) ? s : NULL;  /* check end of string */
431      break;
432      }
433      case L_ESC: {  /* escaped sequences not in the format class[*+?-]? */
434      switch (*(p + 1)) {
435         case 'b': {  /* balanced string? */
436         s = matchbalance(ms, s, p + 2);
437         if (s != NULL) {
438            p += 4; goto init;  /* return match(ms, s, p + 4); */
439         }  /* else fail (s == NULL) */
440         break;
441         }
442         case 'f': {  /* frontier? */
443         const char *ep; char previous;
444         p += 2;
445         if (*p != '[')
446            luaL_error(ms->L, "missing " LUA_QL("[") " after "
447                           LUA_QL("%%f") " in pattern");
448         ep = classend(ms, p);  /* points to what is next */
449         previous = (s == ms->src_init) ? '\0' : *(s - 1);
450         if (!matchbracketclass(uchar(previous), p, ep - 1) &&
451            matchbracketclass(uchar(*s), p, ep - 1)) {
452            p = ep; goto init;  /* return match(ms, s, ep); */
453         }
454         s = NULL;  /* match failed */
455         break;
456         }
457         case '0': case '1': case '2': case '3':
458         case '4': case '5': case '6': case '7':
459         case '8': case '9': {  /* capture results (%0-%9)? */
460         s = match_capture(ms, s, uchar(*(p + 1)));
461         if (s != NULL) {
462            p += 2; goto init;  /* return match(ms, s, p + 2) */
463         }
464         break;
465         }
466         default: goto dflt;
467      }
468      break;
469      }
470      default: dflt: {  /* pattern class plus optional suffix */
471      const char *ep = classend(ms, p);  /* points to optional suffix */
472      /* does not match at least once? */
473      if (!singlematch(ms, s, p, ep)) {
474         if (*ep == '*' || *ep == '?' || *ep == '-') {  /* accept empty? */
475         p = ep + 1; goto init;  /* return match(ms, s, ep + 1); */
476         }
477         else  /* '+' or no suffix */
478         s = NULL;  /* fail */
479      }
480      else {  /* matched once */
481         switch (*ep) {  /* handle optional suffix */
482         case '?': {  /* optional */
483            const char *res;
484            if ((res = match(ms, s + 1, ep + 1)) != NULL)
485            s = res;
486            else {
487            p = ep + 1; goto init;  /* else return match(ms, s, ep + 1); */
488            }
489            break;
490         }
491         case '+':  /* 1 or more repetitions */
492            s++;  /* 1 match already done */
493            /* go through */
494         case '*':  /* 0 or more repetitions */
495            s = max_expand(ms, s, p, ep);
496            break;
497         case '-':  /* 0 or more repetitions (minimum) */
498            s = min_expand(ms, s, p, ep);
499            break;
500         default:  /* no suffix */
501            s++; p = ep; goto init;  /* return match(ms, s + 1, ep); */
502         }
503      }
504      break;
505      }
506   }
507   }
508   ms->matchdepth++;
509   return s;
510510}
511511
512512
513513
514514static const char *lmemfind (const char *s1, size_t l1,
515                               const char *s2, size_t l2) {
516  if (l2 == 0) return s1;  /* empty strings are everywhere */
517  else if (l2 > l1) return NULL;  /* avoids a negative `l1' */
518  else {
519    const char *init;  /* to search for a `*s2' inside `s1' */
520    l2--;  /* 1st char will be checked by `memchr' */
521    l1 = l1-l2;  /* `s2' cannot be found after that */
522    while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) {
523      init++;   /* 1st char is already checked */
524      if (memcmp(init, s2+1, l2) == 0)
525        return init-1;
526      else {  /* correct `l1' and `s1' to try again */
527        l1 -= init-s1;
528        s1 = init;
529      }
530    }
531    return NULL;  /* not found */
532  }
515                        const char *s2, size_t l2) {
516   if (l2 == 0) return s1;  /* empty strings are everywhere */
517   else if (l2 > l1) return NULL;  /* avoids a negative `l1' */
518   else {
519   const char *init;  /* to search for a `*s2' inside `s1' */
520   l2--;  /* 1st char will be checked by `memchr' */
521   l1 = l1-l2;  /* `s2' cannot be found after that */
522   while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) {
523      init++;   /* 1st char is already checked */
524      if (memcmp(init, s2+1, l2) == 0)
525      return init-1;
526      else {  /* correct `l1' and `s1' to try again */
527      l1 -= init-s1;
528      s1 = init;
529      }
530   }
531   return NULL;  /* not found */
532   }
533533}
534534
535535
536536static void push_onecapture (MatchState *ms, int i, const char *s,
537                                                    const char *e) {
538  if (i >= ms->level) {
539    if (i == 0)  /* ms->level == 0, too */
540      lua_pushlstring(ms->L, s, e - s);  /* add whole match */
541    else
542      luaL_error(ms->L, "invalid capture index");
543  }
544  else {
545    ptrdiff_t l = ms->capture[i].len;
546    if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture");
547    if (l == CAP_POSITION)
548      lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);
549    else
550      lua_pushlstring(ms->L, ms->capture[i].init, l);
551  }
537                                       const char *e) {
538   if (i >= ms->level) {
539   if (i == 0)  /* ms->level == 0, too */
540      lua_pushlstring(ms->L, s, e - s);  /* add whole match */
541   else
542      luaL_error(ms->L, "invalid capture index");
543   }
544   else {
545   ptrdiff_t l = ms->capture[i].len;
546   if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture");
547   if (l == CAP_POSITION)
548      lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);
549   else
550      lua_pushlstring(ms->L, ms->capture[i].init, l);
551   }
552552}
553553
554554
555555static int push_captures (MatchState *ms, const char *s, const char *e) {
556  int i;
557  int nlevels = (ms->level == 0 && s) ? 1 : ms->level;
558  luaL_checkstack(ms->L, nlevels, "too many captures");
559  for (i = 0; i < nlevels; i++)
560    push_onecapture(ms, i, s, e);
561  return nlevels;  /* number of strings pushed */
556   int i;
557   int nlevels = (ms->level == 0 && s) ? 1 : ms->level;
558   luaL_checkstack(ms->L, nlevels, "too many captures");
559   for (i = 0; i < nlevels; i++)
560   push_onecapture(ms, i, s, e);
561   return nlevels;  /* number of strings pushed */
562562}
563563
564564
565565/* check whether pattern has no special characters */
566566static int nospecials (const char *p, size_t l) {
567  size_t upto = 0;
568  do {
569    if (strpbrk(p + upto, SPECIALS))
570      return 0;  /* pattern has a special character */
571    upto += strlen(p + upto) + 1;  /* may have more after \0 */
572  } while (upto <= l);
573  return 1;  /* no special chars found */
567   size_t upto = 0;
568   do {
569   if (strpbrk(p + upto, SPECIALS))
570      return 0;  /* pattern has a special character */
571   upto += strlen(p + upto) + 1;  /* may have more after \0 */
572   } while (upto <= l);
573   return 1;  /* no special chars found */
574574}
575575
576576
577577static int str_find_aux (lua_State *L, int find) {
578  size_t ls, lp;
579  const char *s = luaL_checklstring(L, 1, &ls);
580  const char *p = luaL_checklstring(L, 2, &lp);
581  size_t init = posrelat(luaL_optinteger(L, 3, 1), ls);
582  if (init < 1) init = 1;
583  else if (init > ls + 1) {  /* start after string's end? */
584    lua_pushnil(L);  /* cannot find anything */
585    return 1;
586  }
587  /* explicit request or no special characters? */
588  if (find && (lua_toboolean(L, 4) || nospecials(p, lp))) {
589    /* do a plain search */
590    const char *s2 = lmemfind(s + init - 1, ls - init + 1, p, lp);
591    if (s2) {
592      lua_pushinteger(L, s2 - s + 1);
593      lua_pushinteger(L, s2 - s + lp);
594      return 2;
595    }
596  }
597  else {
598    MatchState ms;
599    const char *s1 = s + init - 1;
600    int anchor = (*p == '^');
601    if (anchor) {
602      p++; lp--;  /* skip anchor character */
603    }
604    ms.L = L;
605    ms.matchdepth = MAXCCALLS;
606    ms.src_init = s;
607    ms.src_end = s + ls;
608    ms.p_end = p + lp;
609    do {
610      const char *res;
611      ms.level = 0;
612      lua_assert(ms.matchdepth == MAXCCALLS);
613      if ((res=match(&ms, s1, p)) != NULL) {
614        if (find) {
615          lua_pushinteger(L, s1 - s + 1);  /* start */
616          lua_pushinteger(L, res - s);   /* end */
617          return push_captures(&ms, NULL, 0) + 2;
618        }
619        else
620          return push_captures(&ms, s1, res);
621      }
622    } while (s1++ < ms.src_end && !anchor);
623  }
624  lua_pushnil(L);  /* not found */
625  return 1;
578   size_t ls, lp;
579   const char *s = luaL_checklstring(L, 1, &ls);
580   const char *p = luaL_checklstring(L, 2, &lp);
581   size_t init = posrelat(luaL_optinteger(L, 3, 1), ls);
582   if (init < 1) init = 1;
583   else if (init > ls + 1) {  /* start after string's end? */
584   lua_pushnil(L);  /* cannot find anything */
585   return 1;
586   }
587   /* explicit request or no special characters? */
588   if (find && (lua_toboolean(L, 4) || nospecials(p, lp))) {
589   /* do a plain search */
590   const char *s2 = lmemfind(s + init - 1, ls - init + 1, p, lp);
591   if (s2) {
592      lua_pushinteger(L, s2 - s + 1);
593      lua_pushinteger(L, s2 - s + lp);
594      return 2;
595   }
596   }
597   else {
598   MatchState ms;
599   const char *s1 = s + init - 1;
600   int anchor = (*p == '^');
601   if (anchor) {
602      p++; lp--;  /* skip anchor character */
603   }
604   ms.L = L;
605   ms.matchdepth = MAXCCALLS;
606   ms.src_init = s;
607   ms.src_end = s + ls;
608   ms.p_end = p + lp;
609   do {
610      const char *res;
611      ms.level = 0;
612      lua_assert(ms.matchdepth == MAXCCALLS);
613      if ((res=match(&ms, s1, p)) != NULL) {
614      if (find) {
615         lua_pushinteger(L, s1 - s + 1);  /* start */
616         lua_pushinteger(L, res - s);   /* end */
617         return push_captures(&ms, NULL, 0) + 2;
618      }
619      else
620         return push_captures(&ms, s1, res);
621      }
622   } while (s1++ < ms.src_end && !anchor);
623   }
624   lua_pushnil(L);  /* not found */
625   return 1;
626626}
627627
628628
629629static int str_find (lua_State *L) {
630  return str_find_aux(L, 1);
630   return str_find_aux(L, 1);
631631}
632632
633633
634634static int str_match (lua_State *L) {
635  return str_find_aux(L, 0);
635   return str_find_aux(L, 0);
636636}
637637
638638
639639static int gmatch_aux (lua_State *L) {
640  MatchState ms;
641  size_t ls, lp;
642  const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls);
643  const char *p = lua_tolstring(L, lua_upvalueindex(2), &lp);
644  const char *src;
645  ms.L = L;
646  ms.matchdepth = MAXCCALLS;
647  ms.src_init = s;
648  ms.src_end = s+ls;
649  ms.p_end = p + lp;
650  for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3));
651       src <= ms.src_end;
652       src++) {
653    const char *e;
654    ms.level = 0;
655    lua_assert(ms.matchdepth == MAXCCALLS);
656    if ((e = match(&ms, src, p)) != NULL) {
657      lua_Integer newstart = e-s;
658      if (e == src) newstart++;  /* empty match? go at least one position */
659      lua_pushinteger(L, newstart);
660      lua_replace(L, lua_upvalueindex(3));
661      return push_captures(&ms, src, e);
662    }
663  }
664  return 0;  /* not found */
640   MatchState ms;
641   size_t ls, lp;
642   const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls);
643   const char *p = lua_tolstring(L, lua_upvalueindex(2), &lp);
644   const char *src;
645   ms.L = L;
646   ms.matchdepth = MAXCCALLS;
647   ms.src_init = s;
648   ms.src_end = s+ls;
649   ms.p_end = p + lp;
650   for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3));
651      src <= ms.src_end;
652      src++) {
653   const char *e;
654   ms.level = 0;
655   lua_assert(ms.matchdepth == MAXCCALLS);
656   if ((e = match(&ms, src, p)) != NULL) {
657      lua_Integer newstart = e-s;
658      if (e == src) newstart++;  /* empty match? go at least one position */
659      lua_pushinteger(L, newstart);
660      lua_replace(L, lua_upvalueindex(3));
661      return push_captures(&ms, src, e);
662   }
663   }
664   return 0;  /* not found */
665665}
666666
667667
668668static int gmatch (lua_State *L) {
669  luaL_checkstring(L, 1);
670  luaL_checkstring(L, 2);
671  lua_settop(L, 2);
672  lua_pushinteger(L, 0);
673  lua_pushcclosure(L, gmatch_aux, 3);
674  return 1;
669   luaL_checkstring(L, 1);
670   luaL_checkstring(L, 2);
671   lua_settop(L, 2);
672   lua_pushinteger(L, 0);
673   lua_pushcclosure(L, gmatch_aux, 3);
674   return 1;
675675}
676676
677677
678678static void add_s (MatchState *ms, luaL_Buffer *b, const char *s,
679                                                   const char *e) {
680  size_t l, i;
681  const char *news = lua_tolstring(ms->L, 3, &l);
682  for (i = 0; i < l; i++) {
683    if (news[i] != L_ESC)
684      luaL_addchar(b, news[i]);
685    else {
686      i++;  /* skip ESC */
687      if (!isdigit(uchar(news[i]))) {
688        if (news[i] != L_ESC)
689          luaL_error(ms->L, "invalid use of " LUA_QL("%c")
690                           " in replacement string", L_ESC);
691        luaL_addchar(b, news[i]);
692      }
693      else if (news[i] == '0')
694          luaL_addlstring(b, s, e - s);
695      else {
696        push_onecapture(ms, news[i] - '1', s, e);
697        luaL_addvalue(b);  /* add capture to accumulated result */
698      }
699    }
700  }
679                                       const char *e) {
680   size_t l, i;
681   const char *news = lua_tolstring(ms->L, 3, &l);
682   for (i = 0; i < l; i++) {
683   if (news[i] != L_ESC)
684      luaL_addchar(b, news[i]);
685   else {
686      i++;  /* skip ESC */
687      if (!isdigit(uchar(news[i]))) {
688      if (news[i] != L_ESC)
689         luaL_error(ms->L, "invalid use of " LUA_QL("%c")
690                     " in replacement string", L_ESC);
691      luaL_addchar(b, news[i]);
692      }
693      else if (news[i] == '0')
694         luaL_addlstring(b, s, e - s);
695      else {
696      push_onecapture(ms, news[i] - '1', s, e);
697      luaL_addvalue(b);  /* add capture to accumulated result */
698      }
699   }
700   }
701701}
702702
703703
704704static void add_value (MatchState *ms, luaL_Buffer *b, const char *s,
705                                       const char *e, int tr) {
706  lua_State *L = ms->L;
707  switch (tr) {
708    case LUA_TFUNCTION: {
709      int n;
710      lua_pushvalue(L, 3);
711      n = push_captures(ms, s, e);
712      lua_call(L, n, 1);
713      break;
714    }
715    case LUA_TTABLE: {
716      push_onecapture(ms, 0, s, e);
717      lua_gettable(L, 3);
718      break;
719    }
720    default: {  /* LUA_TNUMBER or LUA_TSTRING */
721      add_s(ms, b, s, e);
722      return;
723    }
724  }
725  if (!lua_toboolean(L, -1)) {  /* nil or false? */
726    lua_pop(L, 1);
727    lua_pushlstring(L, s, e - s);  /* keep original text */
728  }
729  else if (!lua_isstring(L, -1))
730    luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1));
731  luaL_addvalue(b);  /* add result to accumulator */
705                              const char *e, int tr) {
706   lua_State *L = ms->L;
707   switch (tr) {
708   case LUA_TFUNCTION: {
709      int n;
710      lua_pushvalue(L, 3);
711      n = push_captures(ms, s, e);
712      lua_call(L, n, 1);
713      break;
714   }
715   case LUA_TTABLE: {
716      push_onecapture(ms, 0, s, e);
717      lua_gettable(L, 3);
718      break;
719   }
720   default: {  /* LUA_TNUMBER or LUA_TSTRING */
721      add_s(ms, b, s, e);
722      return;
723   }
724   }
725   if (!lua_toboolean(L, -1)) {  /* nil or false? */
726   lua_pop(L, 1);
727   lua_pushlstring(L, s, e - s);  /* keep original text */
728   }
729   else if (!lua_isstring(L, -1))
730   luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1));
731   luaL_addvalue(b);  /* add result to accumulator */
732732}
733733
734734
735735static int str_gsub (lua_State *L) {
736  size_t srcl, lp;
737  const char *src = luaL_checklstring(L, 1, &srcl);
738  const char *p = luaL_checklstring(L, 2, &lp);
739  int tr = lua_type(L, 3);
740  size_t max_s = luaL_optinteger(L, 4, srcl+1);
741  int anchor = (*p == '^');
742  size_t n = 0;
743  MatchState ms;
744  luaL_Buffer b;
745  luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING ||
746                   tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3,
747                      "string/function/table expected");
748  luaL_buffinit(L, &b);
749  if (anchor) {
750    p++; lp--;  /* skip anchor character */
751  }
752  ms.L = L;
753  ms.matchdepth = MAXCCALLS;
754  ms.src_init = src;
755  ms.src_end = src+srcl;
756  ms.p_end = p + lp;
757  while (n < max_s) {
758    const char *e;
759    ms.level = 0;
760    lua_assert(ms.matchdepth == MAXCCALLS);
761    e = match(&ms, src, p);
762    if (e) {
763      n++;
764      add_value(&ms, &b, src, e, tr);
765    }
766    if (e && e>src) /* non empty match? */
767      src = e;  /* skip it */
768    else if (src < ms.src_end)
769      luaL_addchar(&b, *src++);
770    else break;
771    if (anchor) break;
772  }
773  luaL_addlstring(&b, src, ms.src_end-src);
774  luaL_pushresult(&b);
775  lua_pushinteger(L, n);  /* number of substitutions */
776  return 2;
736   size_t srcl, lp;
737   const char *src = luaL_checklstring(L, 1, &srcl);
738   const char *p = luaL_checklstring(L, 2, &lp);
739   int tr = lua_type(L, 3);
740   size_t max_s = luaL_optinteger(L, 4, srcl+1);
741   int anchor = (*p == '^');
742   size_t n = 0;
743   MatchState ms;
744   luaL_Buffer b;
745   luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING ||
746               tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3,
747                  "string/function/table expected");
748   luaL_buffinit(L, &b);
749   if (anchor) {
750   p++; lp--;  /* skip anchor character */
751   }
752   ms.L = L;
753   ms.matchdepth = MAXCCALLS;
754   ms.src_init = src;
755   ms.src_end = src+srcl;
756   ms.p_end = p + lp;
757   while (n < max_s) {
758   const char *e;
759   ms.level = 0;
760   lua_assert(ms.matchdepth == MAXCCALLS);
761   e = match(&ms, src, p);
762   if (e) {
763      n++;
764      add_value(&ms, &b, src, e, tr);
765   }
766   if (e && e>src) /* non empty match? */
767      src = e;  /* skip it */
768   else if (src < ms.src_end)
769      luaL_addchar(&b, *src++);
770   else break;
771   if (anchor) break;
772   }
773   luaL_addlstring(&b, src, ms.src_end-src);
774   luaL_pushresult(&b);
775   lua_pushinteger(L, n);  /* number of substitutions */
776   return 2;
777777}
778778
779779/* }====================================================== */
r31373r31374
791791** 'string.format'; LUA_INTFRM_T is the integer type corresponding to
792792** the previous length
793793*/
794#if !defined(LUA_INTFRMLEN)   /* { */
794#if !defined(LUA_INTFRMLEN) /* { */
795795#if defined(LUA_USE_LONGLONG)
796796
797#define LUA_INTFRMLEN      "ll"
798#define LUA_INTFRM_T      long long
797#define LUA_INTFRMLEN       "ll"
798#define LUA_INTFRM_T        long long
799799
800800#else
801801
802#define LUA_INTFRMLEN      "l"
803#define LUA_INTFRM_T      long
802#define LUA_INTFRMLEN       "l"
803#define LUA_INTFRM_T        long
804804
805805#endif
806#endif            /* } */
806#endif              /* } */
807807
808808
809809/*
r31373r31374
813813*/
814814#if !defined(LUA_FLTFRMLEN)
815815
816#define LUA_FLTFRMLEN      ""
817#define LUA_FLTFRM_T      double
816#define LUA_FLTFRMLEN       ""
817#define LUA_FLTFRM_T        double
818818
819819#endif
820820
821821
822822/* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */
823#define MAX_ITEM   512
823#define MAX_ITEM    512
824824/* valid flags in a format specification */
825#define FLAGS   "-+ #0"
825#define FLAGS   "-+ #0"
826826/*
827827** maximum size of each format specification (such as '%-099.99d')
828828** (+10 accounts for %99.99x plus margin of error)
829829*/
830#define MAX_FORMAT   (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10)
830#define MAX_FORMAT  (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10)
831831
832832
833833static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
834  size_t l;
835  const char *s = luaL_checklstring(L, arg, &l);
836  luaL_addchar(b, '"');
837  while (l--) {
838    if (*s == '"' || *s == '\\' || *s == '\n') {
839      luaL_addchar(b, '\\');
840      luaL_addchar(b, *s);
841    }
842    else if (*s == '\0' || iscntrl(uchar(*s))) {
843      char buff[10];
844      if (!isdigit(uchar(*(s+1))))
845        sprintf(buff, "\\%d", (int)uchar(*s));
846      else
847        sprintf(buff, "\\%03d", (int)uchar(*s));
848      luaL_addstring(b, buff);
849    }
850    else
851      luaL_addchar(b, *s);
852    s++;
853  }
854  luaL_addchar(b, '"');
834   size_t l;
835   const char *s = luaL_checklstring(L, arg, &l);
836   luaL_addchar(b, '"');
837   while (l--) {
838   if (*s == '"' || *s == '\\' || *s == '\n') {
839      luaL_addchar(b, '\\');
840      luaL_addchar(b, *s);
841   }
842   else if (*s == '\0' || iscntrl(uchar(*s))) {
843      char buff[10];
844      if (!isdigit(uchar(*(s+1))))
845      sprintf(buff, "\\%d", (int)uchar(*s));
846      else
847      sprintf(buff, "\\%03d", (int)uchar(*s));
848      luaL_addstring(b, buff);
849   }
850   else
851      luaL_addchar(b, *s);
852   s++;
853   }
854   luaL_addchar(b, '"');
855855}
856856
857857static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
858  const char *p = strfrmt;
859  while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++;  /* skip flags */
860  if ((size_t)(p - strfrmt) >= sizeof(FLAGS)/sizeof(char))
861    luaL_error(L, "invalid format (repeated flags)");
862  if (isdigit(uchar(*p))) p++;  /* skip width */
863  if (isdigit(uchar(*p))) p++;  /* (2 digits at most) */
864  if (*p == '.') {
865    p++;
866    if (isdigit(uchar(*p))) p++;  /* skip precision */
867    if (isdigit(uchar(*p))) p++;  /* (2 digits at most) */
868  }
869  if (isdigit(uchar(*p)))
870    luaL_error(L, "invalid format (width or precision too long)");
871  *(form++) = '%';
872  memcpy(form, strfrmt, (p - strfrmt + 1) * sizeof(char));
873  form += p - strfrmt + 1;
874  *form = '\0';
875  return p;
858   const char *p = strfrmt;
859   while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++;  /* skip flags */
860   if ((size_t)(p - strfrmt) >= sizeof(FLAGS)/sizeof(char))
861   luaL_error(L, "invalid format (repeated flags)");
862   if (isdigit(uchar(*p))) p++;  /* skip width */
863   if (isdigit(uchar(*p))) p++;  /* (2 digits at most) */
864   if (*p == '.') {
865   p++;
866   if (isdigit(uchar(*p))) p++;  /* skip precision */
867   if (isdigit(uchar(*p))) p++;  /* (2 digits at most) */
868   }
869   if (isdigit(uchar(*p)))
870   luaL_error(L, "invalid format (width or precision too long)");
871   *(form++) = '%';
872   memcpy(form, strfrmt, (p - strfrmt + 1) * sizeof(char));
873   form += p - strfrmt + 1;
874   *form = '\0';
875   return p;
876876}
877877
878878
r31373r31374
880880** add length modifier into formats
881881*/
882882static void addlenmod (char *form, const char *lenmod) {
883  size_t l = strlen(form);
884  size_t lm = strlen(lenmod);
885  char spec = form[l - 1];
886  strcpy(form + l - 1, lenmod);
887  form[l + lm - 1] = spec;
888  form[l + lm] = '\0';
883   size_t l = strlen(form);
884   size_t lm = strlen(lenmod);
885   char spec = form[l - 1];
886   strcpy(form + l - 1, lenmod);
887   form[l + lm - 1] = spec;
888   form[l + lm] = '\0';
889889}
890890
891891
892892static int str_format (lua_State *L) {
893  int top = lua_gettop(L);
894  int arg = 1;
895  size_t sfl;
896  const char *strfrmt = luaL_checklstring(L, arg, &sfl);
897  const char *strfrmt_end = strfrmt+sfl;
898  luaL_Buffer b;
899  luaL_buffinit(L, &b);
900  while (strfrmt < strfrmt_end) {
901    if (*strfrmt != L_ESC)
902      luaL_addchar(&b, *strfrmt++);
903    else if (*++strfrmt == L_ESC)
904      luaL_addchar(&b, *strfrmt++);  /* %% */
905    else { /* format item */
906      char form[MAX_FORMAT];  /* to store the format (`%...') */
907      char *buff = luaL_prepbuffsize(&b, MAX_ITEM);  /* to put formatted item */
908      int nb = 0;  /* number of bytes in added item */
909      if (++arg > top)
910        luaL_argerror(L, arg, "no value");
911      strfrmt = scanformat(L, strfrmt, form);
912      switch (*strfrmt++) {
913        case 'c': {
914          nb = sprintf(buff, form, luaL_checkint(L, arg));
915          break;
916        }
917        case 'd': case 'i': {
918          lua_Number n = luaL_checknumber(L, arg);
919          LUA_INTFRM_T ni = (LUA_INTFRM_T)n;
920          lua_Number diff = n - (lua_Number)ni;
921          luaL_argcheck(L, -1 < diff && diff < 1, arg,
922                        "not a number in proper range");
923          addlenmod(form, LUA_INTFRMLEN);
924          nb = sprintf(buff, form, ni);
925          break;
926        }
927        case 'o': case 'u': case 'x': case 'X': {
928          lua_Number n = luaL_checknumber(L, arg);
929          unsigned LUA_INTFRM_T ni = (unsigned LUA_INTFRM_T)n;
930          lua_Number diff = n - (lua_Number)ni;
931          luaL_argcheck(L, -1 < diff && diff < 1, arg,
932                        "not a non-negative number in proper range");
933          addlenmod(form, LUA_INTFRMLEN);
934          nb = sprintf(buff, form, ni);
935          break;
936        }
937        case 'e': case 'E': case 'f':
893   int top = lua_gettop(L);
894   int arg = 1;
895   size_t sfl;
896   const char *strfrmt = luaL_checklstring(L, arg, &sfl);
897   const char *strfrmt_end = strfrmt+sfl;
898   luaL_Buffer b;
899   luaL_buffinit(L, &b);
900   while (strfrmt < strfrmt_end) {
901   if (*strfrmt != L_ESC)
902      luaL_addchar(&b, *strfrmt++);
903   else if (*++strfrmt == L_ESC)
904      luaL_addchar(&b, *strfrmt++);  /* %% */
905   else { /* format item */
906      char form[MAX_FORMAT];  /* to store the format (`%...') */
907      char *buff = luaL_prepbuffsize(&b, MAX_ITEM);  /* to put formatted item */
908      int nb = 0;  /* number of bytes in added item */
909      if (++arg > top)
910      luaL_argerror(L, arg, "no value");
911      strfrmt = scanformat(L, strfrmt, form);
912      switch (*strfrmt++) {
913      case 'c': {
914         nb = sprintf(buff, form, luaL_checkint(L, arg));
915         break;
916      }
917      case 'd': case 'i': {
918         lua_Number n = luaL_checknumber(L, arg);
919         LUA_INTFRM_T ni = (LUA_INTFRM_T)n;
920         lua_Number diff = n - (lua_Number)ni;
921         luaL_argcheck(L, -1 < diff && diff < 1, arg,
922                  "not a number in proper range");
923         addlenmod(form, LUA_INTFRMLEN);
924         nb = sprintf(buff, form, ni);
925         break;
926      }
927      case 'o': case 'u': case 'x': case 'X': {
928         lua_Number n = luaL_checknumber(L, arg);
929         unsigned LUA_INTFRM_T ni = (unsigned LUA_INTFRM_T)n;
930         lua_Number diff = n - (lua_Number)ni;
931         luaL_argcheck(L, -1 < diff && diff < 1, arg,
932                  "not a non-negative number in proper range");
933         addlenmod(form, LUA_INTFRMLEN);
934         nb = sprintf(buff, form, ni);
935         break;
936      }
937      case 'e': case 'E': case 'f':
938938#if defined(LUA_USE_AFORMAT)
939        case 'a': case 'A':
939      case 'a': case 'A':
940940#endif
941        case 'g': case 'G': {
942          addlenmod(form, LUA_FLTFRMLEN);
943          nb = sprintf(buff, form, (LUA_FLTFRM_T)luaL_checknumber(L, arg));
944          break;
945        }
946        case 'q': {
947          addquoted(L, &b, arg);
948          break;
949        }
950        case 's': {
951          size_t l;
952          const char *s = luaL_tolstring(L, arg, &l);
953          if (!strchr(form, '.') && l >= 100) {
954            /* no precision and string is too long to be formatted;
955               keep original string */
956            luaL_addvalue(&b);
957            break;
958          }
959          else {
960            nb = sprintf(buff, form, s);
961            lua_pop(L, 1);  /* remove result from 'luaL_tolstring' */
962            break;
963          }
964        }
965        default: {  /* also treat cases `pnLlh' */
966          return luaL_error(L, "invalid option " LUA_QL("%%%c") " to "
967                               LUA_QL("format"), *(strfrmt - 1));
968        }
969      }
970      luaL_addsize(&b, nb);
971    }
972  }
973  luaL_pushresult(&b);
974  return 1;
941      case 'g': case 'G': {
942         addlenmod(form, LUA_FLTFRMLEN);
943         nb = sprintf(buff, form, (LUA_FLTFRM_T)luaL_checknumber(L, arg));
944         break;
945      }
946      case 'q': {
947         addquoted(L, &b, arg);
948         break;
949      }
950      case 's': {
951         size_t l;
952         const char *s = luaL_tolstring(L, arg, &l);
953         if (!strchr(form, '.') && l >= 100) {
954         /* no precision and string is too long to be formatted;
955            keep original string */
956         luaL_addvalue(&b);
957         break;
958         }
959         else {
960         nb = sprintf(buff, form, s);
961         lua_pop(L, 1);  /* remove result from 'luaL_tolstring' */
962         break;
963         }
964      }
965      default: {  /* also treat cases `pnLlh' */
966         return luaL_error(L, "invalid option " LUA_QL("%%%c") " to "
967                        LUA_QL("format"), *(strfrmt - 1));
968      }
969      }
970      luaL_addsize(&b, nb);
971   }
972   }
973   luaL_pushresult(&b);
974   return 1;
975975}
976976
977977/* }====================================================== */
978978
979979
980980static const luaL_Reg strlib[] = {
981  {"byte", str_byte},
982  {"char", str_char},
983  {"dump", str_dump},
984  {"find", str_find},
985  {"format", str_format},
986  {"gmatch", gmatch},
987  {"gsub", str_gsub},
988  {"len", str_len},
989  {"lower", str_lower},
990  {"match", str_match},
991  {"rep", str_rep},
992  {"reverse", str_reverse},
993  {"sub", str_sub},
994  {"upper", str_upper},
995  {NULL, NULL}
981   {"byte", str_byte},
982   {"char", str_char},
983   {"dump", str_dump},
984   {"find", str_find},
985   {"format", str_format},
986   {"gmatch", gmatch},
987   {"gsub", str_gsub},
988   {"len", str_len},
989   {"lower", str_lower},
990   {"match", str_match},
991   {"rep", str_rep},
992   {"reverse", str_reverse},
993   {"sub", str_sub},
994   {"upper", str_upper},
995   {NULL, NULL}
996996};
997997
998998
999999static void createmetatable (lua_State *L) {
1000  lua_createtable(L, 0, 1);  /* table to be metatable for strings */
1001  lua_pushliteral(L, "");  /* dummy string */
1002  lua_pushvalue(L, -2);  /* copy table */
1003  lua_setmetatable(L, -2);  /* set table as metatable for strings */
1004  lua_pop(L, 1);  /* pop dummy string */
1005  lua_pushvalue(L, -2);  /* get string library */
1006  lua_setfield(L, -2, "__index");  /* metatable.__index = string */
1007  lua_pop(L, 1);  /* pop metatable */
1000   lua_createtable(L, 0, 1);  /* table to be metatable for strings */
1001   lua_pushliteral(L, "");  /* dummy string */
1002   lua_pushvalue(L, -2);  /* copy table */
1003   lua_setmetatable(L, -2);  /* set table as metatable for strings */
1004   lua_pop(L, 1);  /* pop dummy string */
1005   lua_pushvalue(L, -2);  /* get string library */
1006   lua_setfield(L, -2, "__index");  /* metatable.__index = string */
1007   lua_pop(L, 1);  /* pop metatable */
10081008}
10091009
10101010
r31373r31374
10121012** Open string library
10131013*/
10141014LUAMOD_API int luaopen_string (lua_State *L) {
1015  luaL_newlib(L, strlib);
1016  createmetatable(L);
1017  return 1;
1015   luaL_newlib(L, strlib);
1016   createmetatable(L);
1017   return 1;
10181018}
1019
trunk/src/lib/lua/ldo.c
r31373r31374
5050
5151#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP)
5252/* C++ exceptions */
53#define LUAI_THROW(L,c)      throw(c)
53#define LUAI_THROW(L,c)     throw(c)
5454#define LUAI_TRY(L,c,a) \
5555   try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; }
56#define luai_jmpbuf      int  /* dummy variable */
56#define luai_jmpbuf     int  /* dummy variable */
5757
5858#elif defined(LUA_USE_ULONGJMP)
5959/* in Unix, try _longjmp/_setjmp (more efficient) */
60#define LUAI_THROW(L,c)      _longjmp((c)->b, 1)
61#define LUAI_TRY(L,c,a)      if (_setjmp((c)->b) == 0) { a }
62#define luai_jmpbuf      jmp_buf
60#define LUAI_THROW(L,c)     _longjmp((c)->b, 1)
61#define LUAI_TRY(L,c,a)     if (_setjmp((c)->b) == 0) { a }
62#define luai_jmpbuf     jmp_buf
6363
6464#else
6565/* default handling with long jumps */
66#define LUAI_THROW(L,c)      longjmp((c)->b, 1)
67#define LUAI_TRY(L,c,a)      if (setjmp((c)->b) == 0) { a }
68#define luai_jmpbuf      jmp_buf
66#define LUAI_THROW(L,c)     longjmp((c)->b, 1)
67#define LUAI_TRY(L,c,a)     if (setjmp((c)->b) == 0) { a }
68#define luai_jmpbuf     jmp_buf
6969
7070#endif
7171
r31373r31374
7575
7676/* chain list of long jump buffers */
7777struct lua_longjmp {
78  struct lua_longjmp *previous;
79  luai_jmpbuf b;
80  volatile int status;  /* error code */
78   struct lua_longjmp *previous;
79   luai_jmpbuf b;
80   volatile int status;  /* error code */
8181};
8282
8383
8484static void seterrorobj (lua_State *L, int errcode, StkId oldtop) {
85  switch (errcode) {
86    case LUA_ERRMEM: {  /* memory error? */
87      setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */
88      break;
89    }
90    case LUA_ERRERR: {
91      setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling"));
92      break;
93    }
94    default: {
95      setobjs2s(L, oldtop, L->top - 1);  /* error message on current top */
96      break;
97    }
98  }
99  L->top = oldtop + 1;
85   switch (errcode) {
86   case LUA_ERRMEM: {  /* memory error? */
87      setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */
88      break;
89   }
90   case LUA_ERRERR: {
91      setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling"));
92      break;
93   }
94   default: {
95      setobjs2s(L, oldtop, L->top - 1);  /* error message on current top */
96      break;
97   }
98   }
99   L->top = oldtop + 1;
100100}
101101
102102
103103l_noret luaD_throw (lua_State *L, int errcode) {
104  if (L->errorJmp) {  /* thread has an error handler? */
105    L->errorJmp->status = errcode;  /* set status */
106    LUAI_THROW(L, L->errorJmp);  /* jump to it */
107  }
108  else {  /* thread has no error handler */
109    L->status = cast_byte(errcode);  /* mark it as dead */
110    if (G(L)->mainthread->errorJmp) {  /* main thread has a handler? */
111      setobjs2s(L, G(L)->mainthread->top++, L->top - 1);  /* copy error obj. */
112      luaD_throw(G(L)->mainthread, errcode);  /* re-throw in main thread */
113    }
114    else {  /* no handler at all; abort */
115      if (G(L)->panic) {  /* panic function? */
116        lua_unlock(L);
117        G(L)->panic(L);  /* call it (last chance to jump out) */
118      }
119      abort();
120    }
121  }
104   if (L->errorJmp) {  /* thread has an error handler? */
105   L->errorJmp->status = errcode;  /* set status */
106   LUAI_THROW(L, L->errorJmp);  /* jump to it */
107   }
108   else {  /* thread has no error handler */
109   L->status = cast_byte(errcode);  /* mark it as dead */
110   if (G(L)->mainthread->errorJmp) {  /* main thread has a handler? */
111      setobjs2s(L, G(L)->mainthread->top++, L->top - 1);  /* copy error obj. */
112      luaD_throw(G(L)->mainthread, errcode);  /* re-throw in main thread */
113   }
114   else {  /* no handler at all; abort */
115      if (G(L)->panic) {  /* panic function? */
116      lua_unlock(L);
117      G(L)->panic(L);  /* call it (last chance to jump out) */
118      }
119      abort();
120   }
121   }
122122}
123123
124124
125125int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {
126  unsigned short oldnCcalls = L->nCcalls;
127  struct lua_longjmp lj;
128  lj.status = LUA_OK;
129  lj.previous = L->errorJmp;  /* chain new error handler */
130  L->errorJmp = &lj;
131  LUAI_TRY(L, &lj,
132    (*f)(L, ud);
133  );
134  L->errorJmp = lj.previous;  /* restore old error handler */
135  L->nCcalls = oldnCcalls;
136  return lj.status;
126   unsigned short oldnCcalls = L->nCcalls;
127   struct lua_longjmp lj;
128   lj.status = LUA_OK;
129   lj.previous = L->errorJmp;  /* chain new error handler */
130   L->errorJmp = &lj;
131   LUAI_TRY(L, &lj,
132   (*f)(L, ud);
133   );
134   L->errorJmp = lj.previous;  /* restore old error handler */
135   L->nCcalls = oldnCcalls;
136   return lj.status;
137137}
138138
139139/* }====================================================== */
140140
141141
142142static void correctstack (lua_State *L, TValue *oldstack) {
143  CallInfo *ci;
144  GCObject *up;
145  L->top = (L->top - oldstack) + L->stack;
146  for (up = L->openupval; up != NULL; up = up->gch.next)
147    gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack;
148  for (ci = L->ci; ci != NULL; ci = ci->previous) {
149    ci->top = (ci->top - oldstack) + L->stack;
150    ci->func = (ci->func - oldstack) + L->stack;
151    if (isLua(ci))
152      ci->u.l.base = (ci->u.l.base - oldstack) + L->stack;
153  }
143   CallInfo *ci;
144   GCObject *up;
145   L->top = (L->top - oldstack) + L->stack;
146   for (up = L->openupval; up != NULL; up = up->gch.next)
147   gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack;
148   for (ci = L->ci; ci != NULL; ci = ci->previous) {
149   ci->top = (ci->top - oldstack) + L->stack;
150   ci->func = (ci->func - oldstack) + L->stack;
151   if (isLua(ci))
152      ci->u.l.base = (ci->u.l.base - oldstack) + L->stack;
153   }
154154}
155155
156156
157157/* some space for error handling */
158#define ERRORSTACKSIZE   (LUAI_MAXSTACK + 200)
158#define ERRORSTACKSIZE  (LUAI_MAXSTACK + 200)
159159
160160
161161void luaD_reallocstack (lua_State *L, int newsize) {
162  TValue *oldstack = L->stack;
163  int lim = L->stacksize;
164  lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE);
165  lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK);
166  luaM_reallocvector(L, L->stack, L->stacksize, newsize, TValue);
167  for (; lim < newsize; lim++)
168    setnilvalue(L->stack + lim); /* erase new segment */
169  L->stacksize = newsize;
170  L->stack_last = L->stack + newsize - EXTRA_STACK;
171  correctstack(L, oldstack);
162   TValue *oldstack = L->stack;
163   int lim = L->stacksize;
164   lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE);
165   lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK);
166   luaM_reallocvector(L, L->stack, L->stacksize, newsize, TValue);
167   for (; lim < newsize; lim++)
168   setnilvalue(L->stack + lim); /* erase new segment */
169   L->stacksize = newsize;
170   L->stack_last = L->stack + newsize - EXTRA_STACK;
171   correctstack(L, oldstack);
172172}
173173
174174
175175void luaD_growstack (lua_State *L, int n) {
176  int size = L->stacksize;
177  if (size > LUAI_MAXSTACK)  /* error after extra size? */
178    luaD_throw(L, LUA_ERRERR);
179  else {
180    int needed = cast_int(L->top - L->stack) + n + EXTRA_STACK;
181    int newsize = 2 * size;
182    if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK;
183    if (newsize < needed) newsize = needed;
184    if (newsize > LUAI_MAXSTACK) {  /* stack overflow? */
185      luaD_reallocstack(L, ERRORSTACKSIZE);
186      luaG_runerror(L, "stack overflow");
187    }
188    else
189      luaD_reallocstack(L, newsize);
190  }
176   int size = L->stacksize;
177   if (size > LUAI_MAXSTACK)  /* error after extra size? */
178   luaD_throw(L, LUA_ERRERR);
179   else {
180   int needed = cast_int(L->top - L->stack) + n + EXTRA_STACK;
181   int newsize = 2 * size;
182   if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK;
183   if (newsize < needed) newsize = needed;
184   if (newsize > LUAI_MAXSTACK) {  /* stack overflow? */
185      luaD_reallocstack(L, ERRORSTACKSIZE);
186      luaG_runerror(L, "stack overflow");
187   }
188   else
189      luaD_reallocstack(L, newsize);
190   }
191191}
192192
193193
194194static int stackinuse (lua_State *L) {
195  CallInfo *ci;
196  StkId lim = L->top;
197  for (ci = L->ci; ci != NULL; ci = ci->previous) {
198    lua_assert(ci->top <= L->stack_last);
199    if (lim < ci->top) lim = ci->top;
200  }
201  return cast_int(lim - L->stack) + 1;  /* part of stack in use */
195   CallInfo *ci;
196   StkId lim = L->top;
197   for (ci = L->ci; ci != NULL; ci = ci->previous) {
198   lua_assert(ci->top <= L->stack_last);
199   if (lim < ci->top) lim = ci->top;
200   }
201   return cast_int(lim - L->stack) + 1;  /* part of stack in use */
202202}
203203
204204
205205void luaD_shrinkstack (lua_State *L) {
206  int inuse = stackinuse(L);
207  int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK;
208  if (goodsize > LUAI_MAXSTACK) goodsize = LUAI_MAXSTACK;
209  if (inuse > LUAI_MAXSTACK ||  /* handling stack overflow? */
210      goodsize >= L->stacksize)  /* would grow instead of shrink? */
211    condmovestack(L);  /* don't change stack (change only for debugging) */
212  else
213    luaD_reallocstack(L, goodsize);  /* shrink it */
206   int inuse = stackinuse(L);
207   int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK;
208   if (goodsize > LUAI_MAXSTACK) goodsize = LUAI_MAXSTACK;
209   if (inuse > LUAI_MAXSTACK ||  /* handling stack overflow? */
210      goodsize >= L->stacksize)  /* would grow instead of shrink? */
211   condmovestack(L);  /* don't change stack (change only for debugging) */
212   else
213   luaD_reallocstack(L, goodsize);  /* shrink it */
214214}
215215
216216
217217void luaD_hook (lua_State *L, int event, int line) {
218  lua_Hook hook = L->hook;
219  if (hook && L->allowhook) {
220    CallInfo *ci = L->ci;
221    ptrdiff_t top = savestack(L, L->top);
222    ptrdiff_t ci_top = savestack(L, ci->top);
223    lua_Debug ar;
224    ar.event = event;
225    ar.currentline = line;
226    ar.i_ci = ci;
227    luaD_checkstack(L, LUA_MINSTACK);  /* ensure minimum stack size */
228    ci->top = L->top + LUA_MINSTACK;
229    lua_assert(ci->top <= L->stack_last);
230    L->allowhook = 0;  /* cannot call hooks inside a hook */
231    ci->callstatus |= CIST_HOOKED;
232    lua_unlock(L);
233    (*hook)(L, &ar);
234    lua_lock(L);
235    lua_assert(!L->allowhook);
236    L->allowhook = 1;
237    ci->top = restorestack(L, ci_top);
238    L->top = restorestack(L, top);
239    ci->callstatus &= ~CIST_HOOKED;
240  }
218   lua_Hook hook = L->hook;
219   if (hook && L->allowhook) {
220   CallInfo *ci = L->ci;
221   ptrdiff_t top = savestack(L, L->top);
222   ptrdiff_t ci_top = savestack(L, ci->top);
223   lua_Debug ar;
224   ar.event = event;
225   ar.currentline = line;
226   ar.i_ci = ci;
227   luaD_checkstack(L, LUA_MINSTACK);  /* ensure minimum stack size */
228   ci->top = L->top + LUA_MINSTACK;
229   lua_assert(ci->top <= L->stack_last);
230   L->allowhook = 0;  /* cannot call hooks inside a hook */
231   ci->callstatus |= CIST_HOOKED;
232   lua_unlock(L);
233   (*hook)(L, &ar);
234   lua_lock(L);
235   lua_assert(!L->allowhook);
236   L->allowhook = 1;
237   ci->top = restorestack(L, ci_top);
238   L->top = restorestack(L, top);
239   ci->callstatus &= ~CIST_HOOKED;
240   }
241241}
242242
243243
244244static void callhook (lua_State *L, CallInfo *ci) {
245  int hook = LUA_HOOKCALL;
246  ci->u.l.savedpc++;  /* hooks assume 'pc' is already incremented */
247  if (isLua(ci->previous) &&
248      GET_OPCODE(*(ci->previous->u.l.savedpc - 1)) == OP_TAILCALL) {
249    ci->callstatus |= CIST_TAIL;
250    hook = LUA_HOOKTAILCALL;
251  }
252  luaD_hook(L, hook, -1);
253  ci->u.l.savedpc--;  /* correct 'pc' */
245   int hook = LUA_HOOKCALL;
246   ci->u.l.savedpc++;  /* hooks assume 'pc' is already incremented */
247   if (isLua(ci->previous) &&
248      GET_OPCODE(*(ci->previous->u.l.savedpc - 1)) == OP_TAILCALL) {
249   ci->callstatus |= CIST_TAIL;
250   hook = LUA_HOOKTAILCALL;
251   }
252   luaD_hook(L, hook, -1);
253   ci->u.l.savedpc--;  /* correct 'pc' */
254254}
255255
256256
257257static StkId adjust_varargs (lua_State *L, Proto *p, int actual) {
258  int i;
259  int nfixargs = p->numparams;
260  StkId base, fixed;
261  lua_assert(actual >= nfixargs);
262  /* move fixed parameters to final position */
263  luaD_checkstack(L, p->maxstacksize);  /* check again for new 'base' */
264  fixed = L->top - actual;  /* first fixed argument */
265  base = L->top;  /* final position of first argument */
266  for (i=0; i<nfixargs; i++) {
267    setobjs2s(L, L->top++, fixed + i);
268    setnilvalue(fixed + i);
269  }
270  return base;
258   int i;
259   int nfixargs = p->numparams;
260   StkId base, fixed;
261   lua_assert(actual >= nfixargs);
262   /* move fixed parameters to final position */
263   luaD_checkstack(L, p->maxstacksize);  /* check again for new 'base' */
264   fixed = L->top - actual;  /* first fixed argument */
265   base = L->top;  /* final position of first argument */
266   for (i=0; i<nfixargs; i++) {
267   setobjs2s(L, L->top++, fixed + i);
268   setnilvalue(fixed + i);
269   }
270   return base;
271271}
272272
273273
274274static StkId tryfuncTM (lua_State *L, StkId func) {
275  const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);
276  StkId p;
277  ptrdiff_t funcr = savestack(L, func);
278  if (!ttisfunction(tm))
279    luaG_typeerror(L, func, "call");
280  /* Open a hole inside the stack at `func' */
281  for (p = L->top; p > func; p--) setobjs2s(L, p, p-1);
282  incr_top(L);
283  func = restorestack(L, funcr);  /* previous call may change stack */
284  setobj2s(L, func, tm);  /* tag method is the new function to be called */
285  return func;
275   const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);
276   StkId p;
277   ptrdiff_t funcr = savestack(L, func);
278   if (!ttisfunction(tm))
279   luaG_typeerror(L, func, "call");
280   /* Open a hole inside the stack at `func' */
281   for (p = L->top; p > func; p--) setobjs2s(L, p, p-1);
282   incr_top(L);
283   func = restorestack(L, funcr);  /* previous call may change stack */
284   setobj2s(L, func, tm);  /* tag method is the new function to be called */
285   return func;
286286}
287287
288288
r31373r31374
294294** returns true if function has been executed (C function)
295295*/
296296int luaD_precall (lua_State *L, StkId func, int nresults) {
297  lua_CFunction f;
298  CallInfo *ci;
299  int n;  /* number of arguments (Lua) or returns (C) */
300  ptrdiff_t funcr = savestack(L, func);
301  switch (ttype(func)) {
302    case LUA_TLCF:  /* light C function */
303      f = fvalue(func);
304      goto Cfunc;
305    case LUA_TCCL: {  /* C closure */
306      f = clCvalue(func)->f;
307     Cfunc:
308      luaD_checkstack(L, LUA_MINSTACK);  /* ensure minimum stack size */
309      ci = next_ci(L);  /* now 'enter' new function */
310      ci->nresults = nresults;
311      ci->func = restorestack(L, funcr);
312      ci->top = L->top + LUA_MINSTACK;
313      lua_assert(ci->top <= L->stack_last);
314      ci->callstatus = 0;
315      luaC_checkGC(L);  /* stack grow uses memory */
316      if (L->hookmask & LUA_MASKCALL)
317        luaD_hook(L, LUA_HOOKCALL, -1);
318      lua_unlock(L);
319      n = (*f)(L);  /* do the actual call */
320      lua_lock(L);
321      api_checknelems(L, n);
322      luaD_poscall(L, L->top - n);
323      return 1;
324    }
325    case LUA_TLCL: {  /* Lua function: prepare its call */
326      StkId base;
327      Proto *p = clLvalue(func)->p;
328      n = cast_int(L->top - func) - 1;  /* number of real arguments */
329      luaD_checkstack(L, p->maxstacksize);
330      for (; n < p->numparams; n++)
331        setnilvalue(L->top++);  /* complete missing arguments */
332      if (!p->is_vararg) {
333        func = restorestack(L, funcr);
334        base = func + 1;
335      }
336      else {
337        base = adjust_varargs(L, p, n);
338        func = restorestack(L, funcr);  /* previous call can change stack */
339      }
340      ci = next_ci(L);  /* now 'enter' new function */
341      ci->nresults = nresults;
342      ci->func = func;
343      ci->u.l.base = base;
344      ci->top = base + p->maxstacksize;
345      lua_assert(ci->top <= L->stack_last);
346      ci->u.l.savedpc = p->code;  /* starting point */
347      ci->callstatus = CIST_LUA;
348      L->top = ci->top;
349      luaC_checkGC(L);  /* stack grow uses memory */
350      if (L->hookmask & LUA_MASKCALL)
351        callhook(L, ci);
352      return 0;
353    }
354    default: {  /* not a function */
355      func = tryfuncTM(L, func);  /* retry with 'function' tag method */
356      return luaD_precall(L, func, nresults);  /* now it must be a function */
357    }
358  }
297   lua_CFunction f;
298   CallInfo *ci;
299   int n;  /* number of arguments (Lua) or returns (C) */
300   ptrdiff_t funcr = savestack(L, func);
301   switch (ttype(func)) {
302   case LUA_TLCF:  /* light C function */
303      f = fvalue(func);
304      goto Cfunc;
305   case LUA_TCCL: {  /* C closure */
306      f = clCvalue(func)->f;
307      Cfunc:
308      luaD_checkstack(L, LUA_MINSTACK);  /* ensure minimum stack size */
309      ci = next_ci(L);  /* now 'enter' new function */
310      ci->nresults = nresults;
311      ci->func = restorestack(L, funcr);
312      ci->top = L->top + LUA_MINSTACK;
313      lua_assert(ci->top <= L->stack_last);
314      ci->callstatus = 0;
315      luaC_checkGC(L);  /* stack grow uses memory */
316      if (L->hookmask & LUA_MASKCALL)
317      luaD_hook(L, LUA_HOOKCALL, -1);
318      lua_unlock(L);
319      n = (*f)(L);  /* do the actual call */
320      lua_lock(L);
321      api_checknelems(L, n);
322      luaD_poscall(L, L->top - n);
323      return 1;
324   }
325   case LUA_TLCL: {  /* Lua function: prepare its call */
326      StkId base;
327      Proto *p = clLvalue(func)->p;
328      n = cast_int(L->top - func) - 1;  /* number of real arguments */
329      luaD_checkstack(L, p->maxstacksize);
330      for (; n < p->numparams; n++)
331      setnilvalue(L->top++);  /* complete missing arguments */
332      if (!p->is_vararg) {
333      func = restorestack(L, funcr);
334      base = func + 1;
335      }
336      else {
337      base = adjust_varargs(L, p, n);
338      func = restorestack(L, funcr);  /* previous call can change stack */
339      }
340      ci = next_ci(L);  /* now 'enter' new function */
341      ci->nresults = nresults;
342      ci->func = func;
343      ci->u.l.base = base;
344      ci->top = base + p->maxstacksize;
345      lua_assert(ci->top <= L->stack_last);
346      ci->u.l.savedpc = p->code;  /* starting point */
347      ci->callstatus = CIST_LUA;
348      L->top = ci->top;
349      luaC_checkGC(L);  /* stack grow uses memory */
350      if (L->hookmask & LUA_MASKCALL)
351      callhook(L, ci);
352      return 0;
353   }
354   default: {  /* not a function */
355      func = tryfuncTM(L, func);  /* retry with 'function' tag method */
356      return luaD_precall(L, func, nresults);  /* now it must be a function */
357   }
358   }
359359}
360360
361361
362362int luaD_poscall (lua_State *L, StkId firstResult) {
363  StkId res;
364  int wanted, i;
365  CallInfo *ci = L->ci;
366  if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) {
367    if (L->hookmask & LUA_MASKRET) {
368      ptrdiff_t fr = savestack(L, firstResult);  /* hook may change stack */
369      luaD_hook(L, LUA_HOOKRET, -1);
370      firstResult = restorestack(L, fr);
371    }
372    L->oldpc = ci->previous->u.l.savedpc;  /* 'oldpc' for caller function */
373  }
374  res = ci->func;  /* res == final position of 1st result */
375  wanted = ci->nresults;
376  L->ci = ci = ci->previous;  /* back to caller */
377  /* move results to correct place */
378  for (i = wanted; i != 0 && firstResult < L->top; i--)
379    setobjs2s(L, res++, firstResult++);
380  while (i-- > 0)
381    setnilvalue(res++);
382  L->top = res;
383  return (wanted - LUA_MULTRET);  /* 0 iff wanted == LUA_MULTRET */
363   StkId res;
364   int wanted, i;
365   CallInfo *ci = L->ci;
366   if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) {
367   if (L->hookmask & LUA_MASKRET) {
368      ptrdiff_t fr = savestack(L, firstResult);  /* hook may change stack */
369      luaD_hook(L, LUA_HOOKRET, -1);
370      firstResult = restorestack(L, fr);
371   }
372   L->oldpc = ci->previous->u.l.savedpc;  /* 'oldpc' for caller function */
373   }
374   res = ci->func;  /* res == final position of 1st result */
375   wanted = ci->nresults;
376   L->ci = ci = ci->previous;  /* back to caller */
377   /* move results to correct place */
378   for (i = wanted; i != 0 && firstResult < L->top; i--)
379   setobjs2s(L, res++, firstResult++);
380   while (i-- > 0)
381   setnilvalue(res++);
382   L->top = res;
383   return (wanted - LUA_MULTRET);  /* 0 iff wanted == LUA_MULTRET */
384384}
385385
386386
r31373r31374
391391** function position.
392392*/
393393void luaD_call (lua_State *L, StkId func, int nResults, int allowyield) {
394  if (++L->nCcalls >= LUAI_MAXCCALLS) {
395    if (L->nCcalls == LUAI_MAXCCALLS)
396      luaG_runerror(L, "C stack overflow");
397    else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3)))
398      luaD_throw(L, LUA_ERRERR);  /* error while handing stack error */
399  }
400  if (!allowyield) L->nny++;
401  if (!luaD_precall(L, func, nResults))  /* is a Lua function? */
402    luaV_execute(L);  /* call it */
403  if (!allowyield) L->nny--;
404  L->nCcalls--;
394   if (++L->nCcalls >= LUAI_MAXCCALLS) {
395   if (L->nCcalls == LUAI_MAXCCALLS)
396      luaG_runerror(L, "C stack overflow");
397   else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3)))
398      luaD_throw(L, LUA_ERRERR);  /* error while handing stack error */
399   }
400   if (!allowyield) L->nny++;
401   if (!luaD_precall(L, func, nResults))  /* is a Lua function? */
402   luaV_execute(L);  /* call it */
403   if (!allowyield) L->nny--;
404   L->nCcalls--;
405405}
406406
407407
408408static void finishCcall (lua_State *L) {
409  CallInfo *ci = L->ci;
410  int n;
411  lua_assert(ci->u.c.k != NULL);  /* must have a continuation */
412  lua_assert(L->nny == 0);
413  if (ci->callstatus & CIST_YPCALL) {  /* was inside a pcall? */
414    ci->callstatus &= ~CIST_YPCALL;  /* finish 'lua_pcall' */
415    L->errfunc = ci->u.c.old_errfunc;
416  }
417  /* finish 'lua_callk'/'lua_pcall' */
418  adjustresults(L, ci->nresults);
419  /* call continuation function */
420  if (!(ci->callstatus & CIST_STAT))  /* no call status? */
421    ci->u.c.status = LUA_YIELD;  /* 'default' status */
422  lua_assert(ci->u.c.status != LUA_OK);
423  ci->callstatus = (ci->callstatus & ~(CIST_YPCALL | CIST_STAT)) | CIST_YIELDED;
424  lua_unlock(L);
425  n = (*ci->u.c.k)(L);
426  lua_lock(L);
427  api_checknelems(L, n);
428  /* finish 'luaD_precall' */
429  luaD_poscall(L, L->top - n);
409   CallInfo *ci = L->ci;
410   int n;
411   lua_assert(ci->u.c.k != NULL);  /* must have a continuation */
412   lua_assert(L->nny == 0);
413   if (ci->callstatus & CIST_YPCALL) {  /* was inside a pcall? */
414   ci->callstatus &= ~CIST_YPCALL;  /* finish 'lua_pcall' */
415   L->errfunc = ci->u.c.old_errfunc;
416   }
417   /* finish 'lua_callk'/'lua_pcall' */
418   adjustresults(L, ci->nresults);
419   /* call continuation function */
420   if (!(ci->callstatus & CIST_STAT))  /* no call status? */
421   ci->u.c.status = LUA_YIELD;  /* 'default' status */
422   lua_assert(ci->u.c.status != LUA_OK);
423   ci->callstatus = (ci->callstatus & ~(CIST_YPCALL | CIST_STAT)) | CIST_YIELDED;
424   lua_unlock(L);
425   n = (*ci->u.c.k)(L);
426   lua_lock(L);
427   api_checknelems(L, n);
428   /* finish 'luaD_precall' */
429   luaD_poscall(L, L->top - n);
430430}
431431
432432
433433static void unroll (lua_State *L, void *ud) {
434  UNUSED(ud);
435  for (;;) {
436    if (L->ci == &L->base_ci)  /* stack is empty? */
437      return;  /* coroutine finished normally */
438    if (!isLua(L->ci))  /* C function? */
439      finishCcall(L);
440    else {  /* Lua function */
441      luaV_finishOp(L);  /* finish interrupted instruction */
442      luaV_execute(L);  /* execute down to higher C 'boundary' */
443    }
444  }
434   UNUSED(ud);
435   for (;;) {
436   if (L->ci == &L->base_ci)  /* stack is empty? */
437      return;  /* coroutine finished normally */
438   if (!isLua(L->ci))  /* C function? */
439      finishCcall(L);
440   else {  /* Lua function */
441      luaV_finishOp(L);  /* finish interrupted instruction */
442      luaV_execute(L);  /* execute down to higher C 'boundary' */
443   }
444   }
445445}
446446
447447
r31373r31374
449449** check whether thread has a suspended protected call
450450*/
451451static CallInfo *findpcall (lua_State *L) {
452  CallInfo *ci;
453  for (ci = L->ci; ci != NULL; ci = ci->previous) {  /* search for a pcall */
454    if (ci->callstatus & CIST_YPCALL)
455      return ci;
456  }
457  return NULL;  /* no pending pcall */
452   CallInfo *ci;
453   for (ci = L->ci; ci != NULL; ci = ci->previous) {  /* search for a pcall */
454   if (ci->callstatus & CIST_YPCALL)
455      return ci;
456   }
457   return NULL;  /* no pending pcall */
458458}
459459
460460
461461static int recover (lua_State *L, int status) {
462  StkId oldtop;
463  CallInfo *ci = findpcall(L);
464  if (ci == NULL) return 0;  /* no recovery point */
465  /* "finish" luaD_pcall */
466  oldtop = restorestack(L, ci->extra);
467  luaF_close(L, oldtop);
468  seterrorobj(L, status, oldtop);
469  L->ci = ci;
470  L->allowhook = ci->u.c.old_allowhook;
471  L->nny = 0;  /* should be zero to be yieldable */
472  luaD_shrinkstack(L);
473  L->errfunc = ci->u.c.old_errfunc;
474  ci->callstatus |= CIST_STAT;  /* call has error status */
475  ci->u.c.status = status;  /* (here it is) */
476  return 1;  /* continue running the coroutine */
462   StkId oldtop;
463   CallInfo *ci = findpcall(L);
464   if (ci == NULL) return 0;  /* no recovery point */
465   /* "finish" luaD_pcall */
466   oldtop = restorestack(L, ci->extra);
467   luaF_close(L, oldtop);
468   seterrorobj(L, status, oldtop);
469   L->ci = ci;
470   L->allowhook = ci->u.c.old_allowhook;
471   L->nny = 0;  /* should be zero to be yieldable */
472   luaD_shrinkstack(L);
473   L->errfunc = ci->u.c.old_errfunc;
474   ci->callstatus |= CIST_STAT;  /* call has error status */
475   ci->u.c.status = status;  /* (here it is) */
476   return 1;  /* continue running the coroutine */
477477}
478478
479479
r31373r31374
483483** error handler and should not kill the coroutine.)
484484*/
485485static l_noret resume_error (lua_State *L, const char *msg, StkId firstArg) {
486  L->top = firstArg;  /* remove args from the stack */
487  setsvalue2s(L, L->top, luaS_new(L, msg));  /* push error message */
488  api_incr_top(L);
489  luaD_throw(L, -1);  /* jump back to 'lua_resume' */
486   L->top = firstArg;  /* remove args from the stack */
487   setsvalue2s(L, L->top, luaS_new(L, msg));  /* push error message */
488   api_incr_top(L);
489   luaD_throw(L, -1);  /* jump back to 'lua_resume' */
490490}
491491
492492
r31373r31374
494494** do the work for 'lua_resume' in protected mode
495495*/
496496static void resume (lua_State *L, void *ud) {
497  int nCcalls = L->nCcalls;
498  StkId firstArg = cast(StkId, ud);
499  CallInfo *ci = L->ci;
500  if (nCcalls >= LUAI_MAXCCALLS)
501    resume_error(L, "C stack overflow", firstArg);
502  if (L->status == LUA_OK) {  /* may be starting a coroutine */
503    if (ci != &L->base_ci)  /* not in base level? */
504      resume_error(L, "cannot resume non-suspended coroutine", firstArg);
505    /* coroutine is in base level; start running it */
506    if (!luaD_precall(L, firstArg - 1, LUA_MULTRET))  /* Lua function? */
507      luaV_execute(L);  /* call it */
508  }
509  else if (L->status != LUA_YIELD)
510    resume_error(L, "cannot resume dead coroutine", firstArg);
511  else {  /* resuming from previous yield */
512    L->status = LUA_OK;
513    ci->func = restorestack(L, ci->extra);
514    if (isLua(ci))  /* yielded inside a hook? */
515      luaV_execute(L);  /* just continue running Lua code */
516    else {  /* 'common' yield */
517      if (ci->u.c.k != NULL) {  /* does it have a continuation? */
518        int n;
519        ci->u.c.status = LUA_YIELD;  /* 'default' status */
520        ci->callstatus |= CIST_YIELDED;
521        lua_unlock(L);
522        n = (*ci->u.c.k)(L);  /* call continuation */
523        lua_lock(L);
524        api_checknelems(L, n);
525        firstArg = L->top - n;  /* yield results come from continuation */
526      }
527      luaD_poscall(L, firstArg);  /* finish 'luaD_precall' */
528    }
529    unroll(L, NULL);
530  }
531  lua_assert(nCcalls == L->nCcalls);
497   int nCcalls = L->nCcalls;
498   StkId firstArg = cast(StkId, ud);
499   CallInfo *ci = L->ci;
500   if (nCcalls >= LUAI_MAXCCALLS)
501   resume_error(L, "C stack overflow", firstArg);
502   if (L->status == LUA_OK) {  /* may be starting a coroutine */
503   if (ci != &L->base_ci)  /* not in base level? */
504      resume_error(L, "cannot resume non-suspended coroutine", firstArg);
505   /* coroutine is in base level; start running it */
506   if (!luaD_precall(L, firstArg - 1, LUA_MULTRET))  /* Lua function? */
507      luaV_execute(L);  /* call it */
508   }
509   else if (L->status != LUA_YIELD)
510   resume_error(L, "cannot resume dead coroutine", firstArg);
511   else {  /* resuming from previous yield */
512   L->status = LUA_OK;
513   ci->func = restorestack(L, ci->extra);
514   if (isLua(ci))  /* yielded inside a hook? */
515      luaV_execute(L);  /* just continue running Lua code */
516   else {  /* 'common' yield */
517      if (ci->u.c.k != NULL) {  /* does it have a continuation? */
518      int n;
519      ci->u.c.status = LUA_YIELD;  /* 'default' status */
520      ci->callstatus |= CIST_YIELDED;
521      lua_unlock(L);
522      n = (*ci->u.c.k)(L);  /* call continuation */
523      lua_lock(L);
524      api_checknelems(L, n);
525      firstArg = L->top - n;  /* yield results come from continuation */
526      }
527      luaD_poscall(L, firstArg);  /* finish 'luaD_precall' */
528   }
529   unroll(L, NULL);
530   }
531   lua_assert(nCcalls == L->nCcalls);
532532}
533533
534534
535535LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) {
536  int status;
537  int oldnny = L->nny;  /* save 'nny' */
538  lua_lock(L);
539  luai_userstateresume(L, nargs);
540  L->nCcalls = (from) ? from->nCcalls + 1 : 1;
541  L->nny = 0;  /* allow yields */
542  api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs);
543  status = luaD_rawrunprotected(L, resume, L->top - nargs);
544  if (status == -1)  /* error calling 'lua_resume'? */
545    status = LUA_ERRRUN;
546  else {  /* yield or regular error */
547    while (status != LUA_OK && status != LUA_YIELD) {  /* error? */
548      if (recover(L, status))  /* recover point? */
549        status = luaD_rawrunprotected(L, unroll, NULL);  /* run continuation */
550      else {  /* unrecoverable error */
551        L->status = cast_byte(status);  /* mark thread as `dead' */
552        seterrorobj(L, status, L->top);
553        L->ci->top = L->top;
554        break;
555      }
556    }
557    lua_assert(status == L->status);
558  }
559  L->nny = oldnny;  /* restore 'nny' */
560  L->nCcalls--;
561  lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0));
562  lua_unlock(L);
563  return status;
536   int status;
537   int oldnny = L->nny;  /* save 'nny' */
538   lua_lock(L);
539   luai_userstateresume(L, nargs);
540   L->nCcalls = (from) ? from->nCcalls + 1 : 1;
541   L->nny = 0;  /* allow yields */
542   api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs);
543   status = luaD_rawrunprotected(L, resume, L->top - nargs);
544   if (status == -1)  /* error calling 'lua_resume'? */
545   status = LUA_ERRRUN;
546   else {  /* yield or regular error */
547   while (status != LUA_OK && status != LUA_YIELD) {  /* error? */
548      if (recover(L, status))  /* recover point? */
549      status = luaD_rawrunprotected(L, unroll, NULL);  /* run continuation */
550      else {  /* unrecoverable error */
551      L->status = cast_byte(status);  /* mark thread as `dead' */
552      seterrorobj(L, status, L->top);
553      L->ci->top = L->top;
554      break;
555      }
556   }
557   lua_assert(status == L->status);
558   }
559   L->nny = oldnny;  /* restore 'nny' */
560   L->nCcalls--;
561   lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0));
562   lua_unlock(L);
563   return status;
564564}
565565
566566
567567LUA_API int lua_yieldk (lua_State *L, int nresults, int ctx, lua_CFunction k) {
568  CallInfo *ci = L->ci;
569  luai_userstateyield(L, nresults);
570  lua_lock(L);
571  api_checknelems(L, nresults);
572  if (L->nny > 0) {
573    if (L != G(L)->mainthread)
574      luaG_runerror(L, "attempt to yield across a C-call boundary");
575    else
576      luaG_runerror(L, "attempt to yield from outside a coroutine");
577  }
578  L->status = LUA_YIELD;
579  ci->extra = savestack(L, ci->func);  /* save current 'func' */
580  if (isLua(ci)) {  /* inside a hook? */
581    api_check(L, k == NULL, "hooks cannot continue after yielding");
582  }
583  else {
584    if ((ci->u.c.k = k) != NULL)  /* is there a continuation? */
585      ci->u.c.ctx = ctx;  /* save context */
586    ci->func = L->top - nresults - 1;  /* protect stack below results */
587    luaD_throw(L, LUA_YIELD);
588  }
589  lua_assert(ci->callstatus & CIST_HOOKED);  /* must be inside a hook */
590  lua_unlock(L);
591  return 0;  /* return to 'luaD_hook' */
568   CallInfo *ci = L->ci;
569   luai_userstateyield(L, nresults);
570   lua_lock(L);
571   api_checknelems(L, nresults);
572   if (L->nny > 0) {
573   if (L != G(L)->mainthread)
574      luaG_runerror(L, "attempt to yield across a C-call boundary");
575   else
576      luaG_runerror(L, "attempt to yield from outside a coroutine");
577   }
578   L->status = LUA_YIELD;
579   ci->extra = savestack(L, ci->func);  /* save current 'func' */
580   if (isLua(ci)) {  /* inside a hook? */
581   api_check(L, k == NULL, "hooks cannot continue after yielding");
582   }
583   else {
584   if ((ci->u.c.k = k) != NULL)  /* is there a continuation? */
585      ci->u.c.ctx = ctx;  /* save context */
586   ci->func = L->top - nresults - 1;  /* protect stack below results */
587   luaD_throw(L, LUA_YIELD);
588   }
589   lua_assert(ci->callstatus & CIST_HOOKED);  /* must be inside a hook */
590   lua_unlock(L);
591   return 0;  /* return to 'luaD_hook' */
592592}
593593
594594
595595int luaD_pcall (lua_State *L, Pfunc func, void *u,
596                ptrdiff_t old_top, ptrdiff_t ef) {
597  int status;
598  CallInfo *old_ci = L->ci;
599  lu_byte old_allowhooks = L->allowhook;
600  unsigned short old_nny = L->nny;
601  ptrdiff_t old_errfunc = L->errfunc;
602  L->errfunc = ef;
603  status = luaD_rawrunprotected(L, func, u);
604  if (status != LUA_OK) {  /* an error occurred? */
605    StkId oldtop = restorestack(L, old_top);
606    luaF_close(L, oldtop);  /* close possible pending closures */
607    seterrorobj(L, status, oldtop);
608    L->ci = old_ci;
609    L->allowhook = old_allowhooks;
610    L->nny = old_nny;
611    luaD_shrinkstack(L);
612  }
613  L->errfunc = old_errfunc;
614  return status;
596            ptrdiff_t old_top, ptrdiff_t ef) {
597   int status;
598   CallInfo *old_ci = L->ci;
599   lu_byte old_allowhooks = L->allowhook;
600   unsigned short old_nny = L->nny;
601   ptrdiff_t old_errfunc = L->errfunc;
602   L->errfunc = ef;
603   status = luaD_rawrunprotected(L, func, u);
604   if (status != LUA_OK) {  /* an error occurred? */
605   StkId oldtop = restorestack(L, old_top);
606   luaF_close(L, oldtop);  /* close possible pending closures */
607   seterrorobj(L, status, oldtop);
608   L->ci = old_ci;
609   L->allowhook = old_allowhooks;
610   L->nny = old_nny;
611   luaD_shrinkstack(L);
612   }
613   L->errfunc = old_errfunc;
614   return status;
615615}
616616
617617
r31373r31374
620620** Execute a protected parser.
621621*/
622622struct SParser {  /* data to `f_parser' */
623  ZIO *z;
624  Mbuffer buff;  /* dynamic structure used by the scanner */
625  Dyndata dyd;  /* dynamic structures used by the parser */
626  const char *mode;
627  const char *name;
623   ZIO *z;
624   Mbuffer buff;  /* dynamic structure used by the scanner */
625   Dyndata dyd;  /* dynamic structures used by the parser */
626   const char *mode;
627   const char *name;
628628};
629629
630630
631631static void checkmode (lua_State *L, const char *mode, const char *x) {
632  if (mode && strchr(mode, x[0]) == NULL) {
633    luaO_pushfstring(L,
634       "attempt to load a %s chunk (mode is " LUA_QS ")", x, mode);
635    luaD_throw(L, LUA_ERRSYNTAX);
636  }
632   if (mode && strchr(mode, x[0]) == NULL) {
633   luaO_pushfstring(L,
634      "attempt to load a %s chunk (mode is " LUA_QS ")", x, mode);
635   luaD_throw(L, LUA_ERRSYNTAX);
636   }
637637}
638638
639639
640640static void f_parser (lua_State *L, void *ud) {
641  int i;
642  Closure *cl;
643  struct SParser *p = cast(struct SParser *, ud);
644  int c = zgetc(p->z);  /* read first character */
645  if (c == LUA_SIGNATURE[0]) {
646    checkmode(L, p->mode, "binary");
647    cl = luaU_undump(L, p->z, &p->buff, p->name);
648  }
649  else {
650    checkmode(L, p->mode, "text");
651    cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c);
652  }
653  lua_assert(cl->l.nupvalues == cl->l.p->sizeupvalues);
654  for (i = 0; i < cl->l.nupvalues; i++) {  /* initialize upvalues */
655    UpVal *up = luaF_newupval(L);
656    cl->l.upvals[i] = up;
657    luaC_objbarrier(L, cl, up);
658  }
641   int i;
642   Closure *cl;
643   struct SParser *p = cast(struct SParser *, ud);
644   int c = zgetc(p->z);  /* read first character */
645   if (c == LUA_SIGNATURE[0]) {
646   checkmode(L, p->mode, "binary");
647   cl = luaU_undump(L, p->z, &p->buff, p->name);
648   }
649   else {
650   checkmode(L, p->mode, "text");
651   cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c);
652   }
653   lua_assert(cl->l.nupvalues == cl->l.p->sizeupvalues);
654   for (i = 0; i < cl->l.nupvalues; i++) {  /* initialize upvalues */
655   UpVal *up = luaF_newupval(L);
656   cl->l.upvals[i] = up;
657   luaC_objbarrier(L, cl, up);
658   }
659659}
660660
661661
662662int luaD_protectedparser (lua_State *L, ZIO *z, const char *name,
663                                        const char *mode) {
664  struct SParser p;
665  int status;
666  L->nny++;  /* cannot yield during parsing */
667  p.z = z; p.name = name; p.mode = mode;
668  p.dyd.actvar.arr = NULL; p.dyd.actvar.size = 0;
669  p.dyd.gt.arr = NULL; p.dyd.gt.size = 0;
670  p.dyd.label.arr = NULL; p.dyd.label.size = 0;
671  luaZ_initbuffer(L, &p.buff);
672  status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc);
673  luaZ_freebuffer(L, &p.buff);
674  luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size);
675  luaM_freearray(L, p.dyd.gt.arr, p.dyd.gt.size);
676  luaM_freearray(L, p.dyd.label.arr, p.dyd.label.size);
677  L->nny--;
678  return status;
663                              const char *mode) {
664   struct SParser p;
665   int status;
666   L->nny++;  /* cannot yield during parsing */
667   p.z = z; p.name = name; p.mode = mode;
668   p.dyd.actvar.arr = NULL; p.dyd.actvar.size = 0;
669   p.dyd.gt.arr = NULL; p.dyd.gt.size = 0;
670   p.dyd.label.arr = NULL; p.dyd.label.size = 0;
671   luaZ_initbuffer(L, &p.buff);
672   status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc);
673   luaZ_freebuffer(L, &p.buff);
674   luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size);
675   luaM_freearray(L, p.dyd.gt.arr, p.dyd.gt.size);
676   luaM_freearray(L, p.dyd.label.arr, p.dyd.label.size);
677   L->nny--;
678   return status;
679679}
680
681
trunk/src/lib/lua/ldump.c
r31373r31374
1616#include "lundump.h"
1717
1818typedef struct {
19 lua_State* L;
20 lua_Writer writer;
21 void* data;
22 int strip;
23 int status;
19   lua_State* L;
20   lua_Writer writer;
21   void* data;
22   int strip;
23   int status;
2424} DumpState;
2525
26#define DumpMem(b,n,size,D)   DumpBlock(b,(n)*(size),D)
27#define DumpVar(x,D)      DumpMem(&x,1,sizeof(x),D)
26#define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D)
27#define DumpVar(x,D)        DumpMem(&x,1,sizeof(x),D)
2828
2929static void DumpBlock(const void* b, size_t size, DumpState* D)
3030{
31 if (D->status==0)
32 {
33  lua_unlock(D->L);
34  D->status=(*D->writer)(D->L,b,size,D->data);
35  lua_lock(D->L);
36 }
31   if (D->status==0)
32   {
33   lua_unlock(D->L);
34   D->status=(*D->writer)(D->L,b,size,D->data);
35   lua_lock(D->L);
36   }
3737}
3838
3939static void DumpChar(int y, DumpState* D)
4040{
41 char x=(char)y;
42 DumpVar(x,D);
41   char x=(char)y;
42   DumpVar(x,D);
4343}
4444
4545static void DumpInt(int x, DumpState* D)
4646{
47 DumpVar(x,D);
47   DumpVar(x,D);
4848}
4949
5050static void DumpNumber(lua_Number x, DumpState* D)
5151{
52 DumpVar(x,D);
52   DumpVar(x,D);
5353}
5454
5555static void DumpVector(const void* b, int n, size_t size, DumpState* D)
5656{
57 DumpInt(n,D);
58 DumpMem(b,n,size,D);
57   DumpInt(n,D);
58   DumpMem(b,n,size,D);
5959}
6060
6161static void DumpString(const TString* s, DumpState* D)
6262{
63 if (s==NULL)
64 {
65  size_t size=0;
66  DumpVar(size,D);
67 }
68 else
69 {
70  size_t size=s->tsv.len+1;      /* include trailing '\0' */
71  DumpVar(size,D);
72  DumpBlock(getstr(s),size*sizeof(char),D);
73 }
63   if (s==NULL)
64   {
65   size_t size=0;
66   DumpVar(size,D);
67   }
68   else
69   {
70   size_t size=s->tsv.len+1;       /* include trailing '\0' */
71   DumpVar(size,D);
72   DumpBlock(getstr(s),size*sizeof(char),D);
73   }
7474}
7575
76#define DumpCode(f,D)    DumpVector(f->code,f->sizecode,sizeof(Instruction),D)
76#define DumpCode(f,D)    DumpVector(f->code,f->sizecode,sizeof(Instruction),D)
7777
7878static void DumpFunction(const Proto* f, DumpState* D);
7979
8080static void DumpConstants(const Proto* f, DumpState* D)
8181{
82 int i,n=f->sizek;
83 DumpInt(n,D);
84 for (i=0; i<n; i++)
85 {
86  const TValue* o=&f->k[i];
87  DumpChar(ttypenv(o),D);
88  switch (ttypenv(o))
89  {
90   case LUA_TNIL:
82   int i,n=f->sizek;
83   DumpInt(n,D);
84   for (i=0; i<n; i++)
85   {
86   const TValue* o=&f->k[i];
87   DumpChar(ttypenv(o),D);
88   switch (ttypenv(o))
89   {
90   case LUA_TNIL:
9191   break;
92   case LUA_TBOOLEAN:
92   case LUA_TBOOLEAN:
9393   DumpChar(bvalue(o),D);
9494   break;
95   case LUA_TNUMBER:
95   case LUA_TNUMBER:
9696   DumpNumber(nvalue(o),D);
9797   break;
98   case LUA_TSTRING:
98   case LUA_TSTRING:
9999   DumpString(rawtsvalue(o),D);
100100   break;
101    default: lua_assert(0);
102  }
103 }
104 n=f->sizep;
105 DumpInt(n,D);
106 for (i=0; i<n; i++) DumpFunction(f->p[i],D);
101   default: lua_assert(0);
102   }
103   }
104   n=f->sizep;
105   DumpInt(n,D);
106   for (i=0; i<n; i++) DumpFunction(f->p[i],D);
107107}
108108
109109static void DumpUpvalues(const Proto* f, DumpState* D)
110110{
111 int i,n=f->sizeupvalues;
112 DumpInt(n,D);
113 for (i=0; i<n; i++)
114 {
115  DumpChar(f->upvalues[i].instack,D);
116  DumpChar(f->upvalues[i].idx,D);
117 }
111   int i,n=f->sizeupvalues;
112   DumpInt(n,D);
113   for (i=0; i<n; i++)
114   {
115   DumpChar(f->upvalues[i].instack,D);
116   DumpChar(f->upvalues[i].idx,D);
117   }
118118}
119119
120120static void DumpDebug(const Proto* f, DumpState* D)
121121{
122 int i,n;
123 DumpString((D->strip) ? NULL : f->source,D);
124 n= (D->strip) ? 0 : f->sizelineinfo;
125 DumpVector(f->lineinfo,n,sizeof(int),D);
126 n= (D->strip) ? 0 : f->sizelocvars;
127 DumpInt(n,D);
128 for (i=0; i<n; i++)
129 {
130  DumpString(f->locvars[i].varname,D);
131  DumpInt(f->locvars[i].startpc,D);
132  DumpInt(f->locvars[i].endpc,D);
133 }
134 n= (D->strip) ? 0 : f->sizeupvalues;
135 DumpInt(n,D);
136 for (i=0; i<n; i++) DumpString(f->upvalues[i].name,D);
122   int i,n;
123   DumpString((D->strip) ? NULL : f->source,D);
124   n= (D->strip) ? 0 : f->sizelineinfo;
125   DumpVector(f->lineinfo,n,sizeof(int),D);
126   n= (D->strip) ? 0 : f->sizelocvars;
127   DumpInt(n,D);
128   for (i=0; i<n; i++)
129   {
130   DumpString(f->locvars[i].varname,D);
131   DumpInt(f->locvars[i].startpc,D);
132   DumpInt(f->locvars[i].endpc,D);
133   }
134   n= (D->strip) ? 0 : f->sizeupvalues;
135   DumpInt(n,D);
136   for (i=0; i<n; i++) DumpString(f->upvalues[i].name,D);
137137}
138138
139139static void DumpFunction(const Proto* f, DumpState* D)
140140{
141 DumpInt(f->linedefined,D);
142 DumpInt(f->lastlinedefined,D);
143 DumpChar(f->numparams,D);
144 DumpChar(f->is_vararg,D);
145 DumpChar(f->maxstacksize,D);
146 DumpCode(f,D);
147 DumpConstants(f,D);
148 DumpUpvalues(f,D);
149 DumpDebug(f,D);
141   DumpInt(f->linedefined,D);
142   DumpInt(f->lastlinedefined,D);
143   DumpChar(f->numparams,D);
144   DumpChar(f->is_vararg,D);
145   DumpChar(f->maxstacksize,D);
146   DumpCode(f,D);
147   DumpConstants(f,D);
148   DumpUpvalues(f,D);
149   DumpDebug(f,D);
150150}
151151
152152static void DumpHeader(DumpState* D)
153153{
154 lu_byte h[LUAC_HEADERSIZE];
155 luaU_header(h);
156 DumpBlock(h,LUAC_HEADERSIZE,D);
154   lu_byte h[LUAC_HEADERSIZE];
155   luaU_header(h);
156   DumpBlock(h,LUAC_HEADERSIZE,D);
157157}
158158
159159/*
r31373r31374
161161*/
162162int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip)
163163{
164 DumpState D;
165 D.L=L;
166 D.writer=w;
167 D.data=data;
168 D.strip=strip;
169 D.status=0;
170 DumpHeader(&D);
171 DumpFunction(f,&D);
172 return D.status;
164   DumpState D;
165   D.L=L;
166   D.writer=w;
167   D.data=data;
168   D.strip=strip;
169   D.status=0;
170   DumpHeader(&D);
171   DumpFunction(f,&D);
172   return D.status;
173173}
trunk/src/lib/lua/lbitlib.c
r31373r31374
1515
1616/* number of bits to consider in a number */
1717#if !defined(LUA_NBITS)
18#define LUA_NBITS   32
18#define LUA_NBITS   32
1919#endif
2020
2121
22#define ALLONES      (~(((~(lua_Unsigned)0) << (LUA_NBITS - 1)) << 1))
22#define ALLONES     (~(((~(lua_Unsigned)0) << (LUA_NBITS - 1)) << 1))
2323
2424/* macro to trim extra bits */
25#define trim(x)      ((x) & ALLONES)
25#define trim(x)     ((x) & ALLONES)
2626
2727
2828/* builds a number with 'n' ones (1 <= n <= LUA_NBITS) */
29#define mask(n)      (~((ALLONES << 1) << ((n) - 1)))
29#define mask(n)     (~((ALLONES << 1) << ((n) - 1)))
3030
3131
3232typedef lua_Unsigned b_uint;
r31373r31374
3434
3535
3636static b_uint andaux (lua_State *L) {
37  int i, n = lua_gettop(L);
38  b_uint r = ~(b_uint)0;
39  for (i = 1; i <= n; i++)
40    r &= luaL_checkunsigned(L, i);
41  return trim(r);
37   int i, n = lua_gettop(L);
38   b_uint r = ~(b_uint)0;
39   for (i = 1; i <= n; i++)
40   r &= luaL_checkunsigned(L, i);
41   return trim(r);
4242}
4343
4444
4545static int b_and (lua_State *L) {
46  b_uint r = andaux(L);
47  lua_pushunsigned(L, r);
48  return 1;
46   b_uint r = andaux(L);
47   lua_pushunsigned(L, r);
48   return 1;
4949}
5050
5151
5252static int b_test (lua_State *L) {
53  b_uint r = andaux(L);
54  lua_pushboolean(L, r != 0);
55  return 1;
53   b_uint r = andaux(L);
54   lua_pushboolean(L, r != 0);
55   return 1;
5656}
5757
5858
5959static int b_or (lua_State *L) {
60  int i, n = lua_gettop(L);
61  b_uint r = 0;
62  for (i = 1; i <= n; i++)
63    r |= luaL_checkunsigned(L, i);
64  lua_pushunsigned(L, trim(r));
65  return 1;
60   int i, n = lua_gettop(L);
61   b_uint r = 0;
62   for (i = 1; i <= n; i++)
63   r |= luaL_checkunsigned(L, i);
64   lua_pushunsigned(L, trim(r));
65   return 1;
6666}
6767
6868
6969static int b_xor (lua_State *L) {
70  int i, n = lua_gettop(L);
71  b_uint r = 0;
72  for (i = 1; i <= n; i++)
73    r ^= luaL_checkunsigned(L, i);
74  lua_pushunsigned(L, trim(r));
75  return 1;
70   int i, n = lua_gettop(L);
71   b_uint r = 0;
72   for (i = 1; i <= n; i++)
73   r ^= luaL_checkunsigned(L, i);
74   lua_pushunsigned(L, trim(r));
75   return 1;
7676}
7777
7878
7979static int b_not (lua_State *L) {
80  b_uint r = ~luaL_checkunsigned(L, 1);
81  lua_pushunsigned(L, trim(r));
82  return 1;
80   b_uint r = ~luaL_checkunsigned(L, 1);
81   lua_pushunsigned(L, trim(r));
82   return 1;
8383}
8484
8585
8686static int b_shift (lua_State *L, b_uint r, int i) {
87  if (i < 0) {  /* shift right? */
88    i = -i;
89    r = trim(r);
90    if (i >= LUA_NBITS) r = 0;
91    else r >>= i;
92  }
93  else {  /* shift left */
94    if (i >= LUA_NBITS) r = 0;
95    else r <<= i;
96    r = trim(r);
97  }
98  lua_pushunsigned(L, r);
99  return 1;
87   if (i < 0) {  /* shift right? */
88   i = -i;
89   r = trim(r);
90   if (i >= LUA_NBITS) r = 0;
91   else r >>= i;
92   }
93   else {  /* shift left */
94   if (i >= LUA_NBITS) r = 0;
95   else r <<= i;
96   r = trim(r);
97   }
98   lua_pushunsigned(L, r);
99   return 1;
100100}
101101
102102
103103static int b_lshift (lua_State *L) {
104  return b_shift(L, luaL_checkunsigned(L, 1), luaL_checkint(L, 2));
104   return b_shift(L, luaL_checkunsigned(L, 1), luaL_checkint(L, 2));
105105}
106106
107107
108108static int b_rshift (lua_State *L) {
109  return b_shift(L, luaL_checkunsigned(L, 1), -luaL_checkint(L, 2));
109   return b_shift(L, luaL_checkunsigned(L, 1), -luaL_checkint(L, 2));
110110}
111111
112112
113113static int b_arshift (lua_State *L) {
114  b_uint r = luaL_checkunsigned(L, 1);
115  int i = luaL_checkint(L, 2);
116  if (i < 0 || !(r & ((b_uint)1 << (LUA_NBITS - 1))))
117    return b_shift(L, r, -i);
118  else {  /* arithmetic shift for 'negative' number */
119    if (i >= LUA_NBITS) r = ALLONES;
120    else
121      r = trim((r >> i) | ~(~(b_uint)0 >> i));  /* add signal bit */
122    lua_pushunsigned(L, r);
123    return 1;
124  }
114   b_uint r = luaL_checkunsigned(L, 1);
115   int i = luaL_checkint(L, 2);
116   if (i < 0 || !(r & ((b_uint)1 << (LUA_NBITS - 1))))
117   return b_shift(L, r, -i);
118   else {  /* arithmetic shift for 'negative' number */
119   if (i >= LUA_NBITS) r = ALLONES;
120   else
121      r = trim((r >> i) | ~(~(b_uint)0 >> i));  /* add signal bit */
122   lua_pushunsigned(L, r);
123   return 1;
124   }
125125}
126126
127127
128128static int b_rot (lua_State *L, int i) {
129  b_uint r = luaL_checkunsigned(L, 1);
130  i &= (LUA_NBITS - 1);  /* i = i % NBITS */
131  r = trim(r);
132  if (i != 0)  /* avoid undefined shift of LUA_NBITS when i == 0 */
133    r = (r << i) | (r >> (LUA_NBITS - i));
134  lua_pushunsigned(L, trim(r));
135  return 1;
129   b_uint r = luaL_checkunsigned(L, 1);
130   i &= (LUA_NBITS - 1);  /* i = i % NBITS */
131   r = trim(r);
132   if (i != 0)  /* avoid undefined shift of LUA_NBITS when i == 0 */
133   r = (r << i) | (r >> (LUA_NBITS - i));
134   lua_pushunsigned(L, trim(r));
135   return 1;
136136}
137137
138138
139139static int b_lrot (lua_State *L) {
140  return b_rot(L, luaL_checkint(L, 2));
140   return b_rot(L, luaL_checkint(L, 2));
141141}
142142
143143
144144static int b_rrot (lua_State *L) {
145  return b_rot(L, -luaL_checkint(L, 2));
145   return b_rot(L, -luaL_checkint(L, 2));
146146}
147147
148148
r31373r31374
153153** 'width' being used uninitialized.)
154154*/
155155static int fieldargs (lua_State *L, int farg, int *width) {
156  int f = luaL_checkint(L, farg);
157  int w = luaL_optint(L, farg + 1, 1);
158  luaL_argcheck(L, 0 <= f, farg, "field cannot be negative");
159  luaL_argcheck(L, 0 < w, farg + 1, "width must be positive");
160  if (f + w > LUA_NBITS)
161    luaL_error(L, "trying to access non-existent bits");
162  *width = w;
163  return f;
156   int f = luaL_checkint(L, farg);
157   int w = luaL_optint(L, farg + 1, 1);
158   luaL_argcheck(L, 0 <= f, farg, "field cannot be negative");
159   luaL_argcheck(L, 0 < w, farg + 1, "width must be positive");
160   if (f + w > LUA_NBITS)
161   luaL_error(L, "trying to access non-existent bits");
162   *width = w;
163   return f;
164164}
165165
166166
167167static int b_extract (lua_State *L) {
168  int w;
169  b_uint r = luaL_checkunsigned(L, 1);
170  int f = fieldargs(L, 2, &w);
171  r = (r >> f) & mask(w);
172  lua_pushunsigned(L, r);
173  return 1;
168   int w;
169   b_uint r = luaL_checkunsigned(L, 1);
170   int f = fieldargs(L, 2, &w);
171   r = (r >> f) & mask(w);
172   lua_pushunsigned(L, r);
173   return 1;
174174}
175175
176176
177177static int b_replace (lua_State *L) {
178  int w;
179  b_uint r = luaL_checkunsigned(L, 1);
180  b_uint v = luaL_checkunsigned(L, 2);
181  int f = fieldargs(L, 3, &w);
182  int m = mask(w);
183  v &= m;  /* erase bits outside given width */
184  r = (r & ~(m << f)) | (v << f);
185  lua_pushunsigned(L, r);
186  return 1;
178   int w;
179   b_uint r = luaL_checkunsigned(L, 1);
180   b_uint v = luaL_checkunsigned(L, 2);
181   int f = fieldargs(L, 3, &w);
182   int m = mask(w);
183   v &= m;  /* erase bits outside given width */
184   r = (r & ~(m << f)) | (v << f);
185   lua_pushunsigned(L, r);
186   return 1;
187187}
188188
189189
190190static const luaL_Reg bitlib[] = {
191  {"arshift", b_arshift},
192  {"band", b_and},
193  {"bnot", b_not},
194  {"bor", b_or},
195  {"bxor", b_xor},
196  {"btest", b_test},
197  {"extract", b_extract},
198  {"lrotate", b_lrot},
199  {"lshift", b_lshift},
200  {"replace", b_replace},
201  {"rrotate", b_rrot},
202  {"rshift", b_rshift},
203  {NULL, NULL}
191   {"arshift", b_arshift},
192   {"band", b_and},
193   {"bnot", b_not},
194   {"bor", b_or},
195   {"bxor", b_xor},
196   {"btest", b_test},
197   {"extract", b_extract},
198   {"lrotate", b_lrot},
199   {"lshift", b_lshift},
200   {"replace", b_replace},
201   {"rrotate", b_rrot},
202   {"rshift", b_rshift},
203   {NULL, NULL}
204204};
205205
206206
207207
208208LUAMOD_API int luaopen_bit32 (lua_State *L) {
209  luaL_newlib(L, bitlib);
210  return 1;
209   luaL_newlib(L, bitlib);
210   return 1;
211211}
212
trunk/src/lib/lua/luac.c
r31373r31374
2020#include "lundump.h"
2121
2222static void PrintFunction(const Proto* f, int full);
23#define luaU_print   PrintFunction
23#define luaU_print  PrintFunction
2424
25#define PROGNAME   "luac"      /* default program name */
26#define OUTPUT      PROGNAME ".out"   /* default output file */
25#define PROGNAME    "luac"      /* default program name */
26#define OUTPUT      PROGNAME ".out" /* default output file */
2727
28static int listing=0;         /* list bytecodes? */
29static int dumping=1;         /* dump bytecodes? */
30static int stripping=0;         /* strip debug information? */
31static char Output[]={ OUTPUT };   /* default output file name */
32static const char* output=Output;   /* actual output file name */
33static const char* progname=PROGNAME;   /* actual program name */
28static int listing=0;           /* list bytecodes? */
29static int dumping=1;           /* dump bytecodes? */
30static int stripping=0;         /* strip debug information? */
31static char Output[]={ OUTPUT };    /* default output file name */
32static const char* output=Output;   /* actual output file name */
33static const char* progname=PROGNAME;   /* actual program name */
3434
3535static void fatal(const char* message)
3636{
37 fprintf(stderr,"%s: %s\n",progname,message);
38 exit(EXIT_FAILURE);
37   fprintf(stderr,"%s: %s\n",progname,message);
38   exit(EXIT_FAILURE);
3939}
4040
4141static void cannot(const char* what)
4242{
43 fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno));
44 exit(EXIT_FAILURE);
43   fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno));
44   exit(EXIT_FAILURE);
4545}
4646
4747static void usage(const char* message)
4848{
49 if (*message=='-')
50  fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message);
51 else
52  fprintf(stderr,"%s: %s\n",progname,message);
53 fprintf(stderr,
54  "usage: %s [options] [filenames]\n"
55  "Available options are:\n"
56  "  -l       list (use -l -l for full listing)\n"
57  "  -o name  output to file " LUA_QL("name") " (default is \"%s\")\n"
58  "  -p       parse only\n"
59  "  -s       strip debug information\n"
60  "  -v       show version information\n"
61  "  --       stop handling options\n"
62  "  -        stop handling options and process stdin\n"
63  ,progname,Output);
64 exit(EXIT_FAILURE);
49   if (*message=='-')
50   fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message);
51   else
52   fprintf(stderr,"%s: %s\n",progname,message);
53   fprintf(stderr,
54   "usage: %s [options] [filenames]\n"
55   "Available options are:\n"
56   "  -l       list (use -l -l for full listing)\n"
57   "  -o name  output to file " LUA_QL("name") " (default is \"%s\")\n"
58   "  -p       parse only\n"
59   "  -s       strip debug information\n"
60   "  -v       show version information\n"
61   "  --       stop handling options\n"
62   "  -        stop handling options and process stdin\n"
63   ,progname,Output);
64   exit(EXIT_FAILURE);
6565}
6666
67#define IS(s)   (strcmp(argv[i],s)==0)
67#define IS(s)   (strcmp(argv[i],s)==0)
6868
6969static int doargs(int argc, char* argv[])
7070{
71 int i;
72 int version=0;
73 if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0];
74 for (i=1; i<argc; i++)
75 {
76  if (*argv[i]!='-')         /* end of options; keep it */
77   break;
78  else if (IS("--"))         /* end of options; skip it */
79  {
80   ++i;
81   if (version) ++version;
82   break;
83  }
84  else if (IS("-"))         /* end of options; use stdin */
85   break;
86  else if (IS("-l"))         /* list */
87   ++listing;
88  else if (IS("-o"))         /* output file */
89  {
90   output=argv[++i];
91   if (output==NULL || *output==0 || (*output=='-' && output[1]!=0))
92    usage(LUA_QL("-o") " needs argument");
93   if (IS("-")) output=NULL;
94  }
95  else if (IS("-p"))         /* parse only */
96   dumping=0;
97  else if (IS("-s"))         /* strip debug information */
98   stripping=1;
99  else if (IS("-v"))         /* show version */
100   ++version;
101  else               /* unknown option */
102   usage(argv[i]);
103 }
104 if (i==argc && (listing || !dumping))
105 {
106  dumping=0;
107  argv[--i]=Output;
108 }
109 if (version)
110 {
111  printf("%s\n",LUA_COPYRIGHT);
112  if (version==argc-1) exit(EXIT_SUCCESS);
113 }
114 return i;
71   int i;
72   int version=0;
73   if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0];
74   for (i=1; i<argc; i++)
75   {
76   if (*argv[i]!='-')          /* end of options; keep it */
77   break;
78   else if (IS("--"))          /* end of options; skip it */
79   {
80   ++i;
81   if (version) ++version;
82   break;
83   }
84   else if (IS("-"))           /* end of options; use stdin */
85   break;
86   else if (IS("-l"))          /* list */
87   ++listing;
88   else if (IS("-o"))          /* output file */
89   {
90   output=argv[++i];
91   if (output==NULL || *output==0 || (*output=='-' && output[1]!=0))
92   usage(LUA_QL("-o") " needs argument");
93   if (IS("-")) output=NULL;
94   }
95   else if (IS("-p"))          /* parse only */
96   dumping=0;
97   else if (IS("-s"))          /* strip debug information */
98   stripping=1;
99   else if (IS("-v"))          /* show version */
100   ++version;
101   else                    /* unknown option */
102   usage(argv[i]);
103   }
104   if (i==argc && (listing || !dumping))
105   {
106   dumping=0;
107   argv[--i]=Output;
108   }
109   if (version)
110   {
111   printf("%s\n",LUA_COPYRIGHT);
112   if (version==argc-1) exit(EXIT_SUCCESS);
113   }
114   return i;
115115}
116116
117117#define FUNCTION "(function()end)();"
118118
119119static const char* reader(lua_State *L, void *ud, size_t *size)
120120{
121 UNUSED(L);
122 if ((*(int*)ud)--)
123 {
124  *size=sizeof(FUNCTION)-1;
125  return FUNCTION;
126 }
127 else
128 {
129  *size=0;
130  return NULL;
131 }
121   UNUSED(L);
122   if ((*(int*)ud)--)
123   {
124   *size=sizeof(FUNCTION)-1;
125   return FUNCTION;
126   }
127   else
128   {
129   *size=0;
130   return NULL;
131   }
132132}
133133
134134#define toproto(L,i) getproto(L->top+(i))
135135
136136static const Proto* combine(lua_State* L, int n)
137137{
138 if (n==1)
139  return toproto(L,-1);
140 else
141 {
142  Proto* f;
143  int i=n;
144  if (lua_load(L,reader,&i,"=(" PROGNAME ")",NULL)!=LUA_OK) fatal(lua_tostring(L,-1));
145  f=toproto(L,-1);
146  for (i=0; i<n; i++)
147  {
148   f->p[i]=toproto(L,i-n-1);
149   if (f->p[i]->sizeupvalues>0) f->p[i]->upvalues[0].instack=0;
150  }
151  f->sizelineinfo=0;
152  return f;
153 }
138   if (n==1)
139   return toproto(L,-1);
140   else
141   {
142   Proto* f;
143   int i=n;
144   if (lua_load(L,reader,&i,"=(" PROGNAME ")",NULL)!=LUA_OK) fatal(lua_tostring(L,-1));
145   f=toproto(L,-1);
146   for (i=0; i<n; i++)
147   {
148   f->p[i]=toproto(L,i-n-1);
149   if (f->p[i]->sizeupvalues>0) f->p[i]->upvalues[0].instack=0;
150   }
151   f->sizelineinfo=0;
152   return f;
153   }
154154}
155155
156156static int writer(lua_State* L, const void* p, size_t size, void* u)
157157{
158 UNUSED(L);
159 return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0);
158   UNUSED(L);
159   return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0);
160160}
161161
162162static int pmain(lua_State* L)
163163{
164 int argc=(int)lua_tointeger(L,1);
165 char** argv=(char**)lua_touserdata(L,2);
166 const Proto* f;
167 int i;
168 if (!lua_checkstack(L,argc)) fatal("too many input files");
169 for (i=0; i<argc; i++)
170 {
171  const char* filename=IS("-") ? NULL : argv[i];
172  if (luaL_loadfile(L,filename)!=LUA_OK) fatal(lua_tostring(L,-1));
173 }
174 f=combine(L,argc);
175 if (listing) luaU_print(f,listing>1);
176 if (dumping)
177 {
178  FILE* D= (output==NULL) ? stdout : fopen(output,"wb");
179  if (D==NULL) cannot("open");
180  lua_lock(L);
181  luaU_dump(L,f,writer,D,stripping);
182  lua_unlock(L);
183  if (ferror(D)) cannot("write");
184  if (fclose(D)) cannot("close");
185 }
186 return 0;
164   int argc=(int)lua_tointeger(L,1);
165   char** argv=(char**)lua_touserdata(L,2);
166   const Proto* f;
167   int i;
168   if (!lua_checkstack(L,argc)) fatal("too many input files");
169   for (i=0; i<argc; i++)
170   {
171   const char* filename=IS("-") ? NULL : argv[i];
172   if (luaL_loadfile(L,filename)!=LUA_OK) fatal(lua_tostring(L,-1));
173   }
174   f=combine(L,argc);
175   if (listing) luaU_print(f,listing>1);
176   if (dumping)
177   {
178   FILE* D= (output==NULL) ? stdout : fopen(output,"wb");
179   if (D==NULL) cannot("open");
180   lua_lock(L);
181   luaU_dump(L,f,writer,D,stripping);
182   lua_unlock(L);
183   if (ferror(D)) cannot("write");
184   if (fclose(D)) cannot("close");
185   }
186   return 0;
187187}
188188
189189int main(int argc, char* argv[])
190190{
191 lua_State* L;
192 int i=doargs(argc,argv);
193 argc-=i; argv+=i;
194 if (argc<=0) usage("no input files given");
195 L=luaL_newstate();
196 if (L==NULL) fatal("cannot create state: not enough memory");
197 lua_pushcfunction(L,&pmain);
198 lua_pushinteger(L,argc);
199 lua_pushlightuserdata(L,argv);
200 if (lua_pcall(L,2,0,0)!=LUA_OK) fatal(lua_tostring(L,-1));
201 lua_close(L);
202 return EXIT_SUCCESS;
191   lua_State* L;
192   int i=doargs(argc,argv);
193   argc-=i; argv+=i;
194   if (argc<=0) usage("no input files given");
195   L=luaL_newstate();
196   if (L==NULL) fatal("cannot create state: not enough memory");
197   lua_pushcfunction(L,&pmain);
198   lua_pushinteger(L,argc);
199   lua_pushlightuserdata(L,argv);
200   if (lua_pcall(L,2,0,0)!=LUA_OK) fatal(lua_tostring(L,-1));
201   lua_close(L);
202   return EXIT_SUCCESS;
203203}
204204
205205/*
r31373r31374
218218#include "lobject.h"
219219#include "lopcodes.h"
220220
221#define VOID(p)      ((const void*)(p))
221#define VOID(p)     ((const void*)(p))
222222
223223static void PrintString(const TString* ts)
224224{
225 const char* s=getstr(ts);
226 size_t i,n=ts->tsv.len;
227 printf("%c",'"');
228 for (i=0; i<n; i++)
229 {
230  int c=(int)(unsigned char)s[i];
231  switch (c)
232  {
233   case '"':  printf("\\\""); break;
234   case '\\': printf("\\\\"); break;
235   case '\a': printf("\\a"); break;
236   case '\b': printf("\\b"); break;
237   case '\f': printf("\\f"); break;
238   case '\n': printf("\\n"); break;
239   case '\r': printf("\\r"); break;
240   case '\t': printf("\\t"); break;
241   case '\v': printf("\\v"); break;
242   default:   if (isprint(c))
243            printf("%c",c);
225   const char* s=getstr(ts);
226   size_t i,n=ts->tsv.len;
227   printf("%c",'"');
228   for (i=0; i<n; i++)
229   {
230   int c=(int)(unsigned char)s[i];
231   switch (c)
232   {
233   case '"':  printf("\\\""); break;
234   case '\\': printf("\\\\"); break;
235   case '\a': printf("\\a"); break;
236   case '\b': printf("\\b"); break;
237   case '\f': printf("\\f"); break;
238   case '\n': printf("\\n"); break;
239   case '\r': printf("\\r"); break;
240   case '\t': printf("\\t"); break;
241   case '\v': printf("\\v"); break;
242   default:    if (isprint(c))
243         printf("%c",c);
244244      else
245245         printf("\\%03d",c);
246  }
247 }
248 printf("%c",'"');
246   }
247   }
248   printf("%c",'"');
249249}
250250
251251static void PrintConstant(const Proto* f, int i)
252252{
253 const TValue* o=&f->k[i];
254 switch (ttypenv(o))
255 {
256  case LUA_TNIL:
253   const TValue* o=&f->k[i];
254   switch (ttypenv(o))
255   {
256   case LUA_TNIL:
257257   printf("nil");
258258   break;
259  case LUA_TBOOLEAN:
259   case LUA_TBOOLEAN:
260260   printf(bvalue(o) ? "true" : "false");
261261   break;
262  case LUA_TNUMBER:
262   case LUA_TNUMBER:
263263   printf(LUA_NUMBER_FMT,nvalue(o));
264264   break;
265  case LUA_TSTRING:
265   case LUA_TSTRING:
266266   PrintString(rawtsvalue(o));
267267   break;
268  default:            /* cannot happen */
268   default:                /* cannot happen */
269269   printf("? type=%d",ttype(o));
270270   break;
271 }
271   }
272272}
273273
274274#define UPVALNAME(x) ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-")
275#define MYK(x)      (-1-(x))
275#define MYK(x)      (-1-(x))
276276
277277static void PrintCode(const Proto* f)
278278{
279 const Instruction* code=f->code;
280 int pc,n=f->sizecode;
281 for (pc=0; pc<n; pc++)
282 {
283  Instruction i=code[pc];
284  OpCode o=GET_OPCODE(i);
285  int a=GETARG_A(i);
286  int b=GETARG_B(i);
287  int c=GETARG_C(i);
288  int ax=GETARG_Ax(i);
289  int bx=GETARG_Bx(i);
290  int sbx=GETARG_sBx(i);
291  int line=getfuncline(f,pc);
292  printf("\t%d\t",pc+1);
293  if (line>0) printf("[%d]\t",line); else printf("[-]\t");
294  printf("%-9s\t",luaP_opnames[o]);
295  switch (getOpMode(o))
296  {
297   case iABC:
298    printf("%d",a);
299    if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (MYK(INDEXK(b))) : b);
300    if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (MYK(INDEXK(c))) : c);
301    break;
302   case iABx:
303    printf("%d",a);
304    if (getBMode(o)==OpArgK) printf(" %d",MYK(bx));
305    if (getBMode(o)==OpArgU) printf(" %d",bx);
306    break;
307   case iAsBx:
308    printf("%d %d",a,sbx);
309    break;
310   case iAx:
311    printf("%d",MYK(ax));
312    break;
313  }
314  switch (o)
315  {
316   case OP_LOADK:
317    printf("\t; "); PrintConstant(f,bx);
318    break;
319   case OP_GETUPVAL:
320   case OP_SETUPVAL:
321    printf("\t; %s",UPVALNAME(b));
322    break;
323   case OP_GETTABUP:
324    printf("\t; %s",UPVALNAME(b));
325    if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); }
326    break;
327   case OP_SETTABUP:
328    printf("\t; %s",UPVALNAME(a));
329    if (ISK(b)) { printf(" "); PrintConstant(f,INDEXK(b)); }
330    if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); }
331    break;
332   case OP_GETTABLE:
333   case OP_SELF:
334    if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); }
335    break;
336   case OP_SETTABLE:
337   case OP_ADD:
338   case OP_SUB:
339   case OP_MUL:
340   case OP_DIV:
341   case OP_POW:
342   case OP_EQ:
343   case OP_LT:
344   case OP_LE:
345    if (ISK(b) || ISK(c))
346    {
347     printf("\t; ");
348     if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-");
349     printf(" ");
350     if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-");
351    }
352    break;
353   case OP_JMP:
354   case OP_FORLOOP:
355   case OP_FORPREP:
356   case OP_TFORLOOP:
357    printf("\t; to %d",sbx+pc+2);
358    break;
359   case OP_CLOSURE:
360    printf("\t; %p",VOID(f->p[bx]));
361    break;
362   case OP_SETLIST:
363    if (c==0) printf("\t; %d",(int)code[++pc]); else printf("\t; %d",c);
364    break;
365   case OP_EXTRAARG:
366    printf("\t; "); PrintConstant(f,ax);
367    break;
368   default:
369    break;
370  }
371  printf("\n");
372 }
279   const Instruction* code=f->code;
280   int pc,n=f->sizecode;
281   for (pc=0; pc<n; pc++)
282   {
283   Instruction i=code[pc];
284   OpCode o=GET_OPCODE(i);
285   int a=GETARG_A(i);
286   int b=GETARG_B(i);
287   int c=GETARG_C(i);
288   int ax=GETARG_Ax(i);
289   int bx=GETARG_Bx(i);
290   int sbx=GETARG_sBx(i);
291   int line=getfuncline(f,pc);
292   printf("\t%d\t",pc+1);
293   if (line>0) printf("[%d]\t",line); else printf("[-]\t");
294   printf("%-9s\t",luaP_opnames[o]);
295   switch (getOpMode(o))
296   {
297   case iABC:
298   printf("%d",a);
299   if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (MYK(INDEXK(b))) : b);
300   if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (MYK(INDEXK(c))) : c);
301   break;
302   case iABx:
303   printf("%d",a);
304   if (getBMode(o)==OpArgK) printf(" %d",MYK(bx));
305   if (getBMode(o)==OpArgU) printf(" %d",bx);
306   break;
307   case iAsBx:
308   printf("%d %d",a,sbx);
309   break;
310   case iAx:
311   printf("%d",MYK(ax));
312   break;
313   }
314   switch (o)
315   {
316   case OP_LOADK:
317   printf("\t; "); PrintConstant(f,bx);
318   break;
319   case OP_GETUPVAL:
320   case OP_SETUPVAL:
321   printf("\t; %s",UPVALNAME(b));
322   break;
323   case OP_GETTABUP:
324   printf("\t; %s",UPVALNAME(b));
325   if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); }
326   break;
327   case OP_SETTABUP:
328   printf("\t; %s",UPVALNAME(a));
329   if (ISK(b)) { printf(" "); PrintConstant(f,INDEXK(b)); }
330   if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); }
331   break;
332   case OP_GETTABLE:
333   case OP_SELF:
334   if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); }
335   break;
336   case OP_SETTABLE:
337   case OP_ADD:
338   case OP_SUB:
339   case OP_MUL:
340   case OP_DIV:
341   case OP_POW:
342   case OP_EQ:
343   case OP_LT:
344   case OP_LE:
345   if (ISK(b) || ISK(c))
346   {
347      printf("\t; ");
348      if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-");
349      printf(" ");
350      if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-");
351   }
352   break;
353   case OP_JMP:
354   case OP_FORLOOP:
355   case OP_FORPREP:
356   case OP_TFORLOOP:
357   printf("\t; to %d",sbx+pc+2);
358   break;
359   case OP_CLOSURE:
360   printf("\t; %p",VOID(f->p[bx]));
361   break;
362   case OP_SETLIST:
363   if (c==0) printf("\t; %d",(int)code[++pc]); else printf("\t; %d",c);
364   break;
365   case OP_EXTRAARG:
366   printf("\t; "); PrintConstant(f,ax);
367   break;
368   default:
369   break;
370   }
371   printf("\n");
372   }
373373}
374374
375#define SS(x)   ((x==1)?"":"s")
376#define S(x)   (int)(x),SS(x)
375#define SS(x)   ((x==1)?"":"s")
376#define S(x)    (int)(x),SS(x)
377377
378378static void PrintHeader(const Proto* f)
379379{
380 const char* s=f->source ? getstr(f->source) : "=?";
381 if (*s=='@' || *s=='=')
382  s++;
383 else if (*s==LUA_SIGNATURE[0])
384  s="(bstring)";
385 else
386  s="(string)";
387 printf("\n%s <%s:%d,%d> (%d instruction%s at %p)\n",
388    (f->linedefined==0)?"main":"function",s,
380   const char* s=f->source ? getstr(f->source) : "=?";
381   if (*s=='@' || *s=='=')
382   s++;
383   else if (*s==LUA_SIGNATURE[0])
384   s="(bstring)";
385   else
386   s="(string)";
387   printf("\n%s <%s:%d,%d> (%d instruction%s at %p)\n",
388   (f->linedefined==0)?"main":"function",s,
389389   f->linedefined,f->lastlinedefined,
390390   S(f->sizecode),VOID(f));
391 printf("%d%s param%s, %d slot%s, %d upvalue%s, ",
391   printf("%d%s param%s, %d slot%s, %d upvalue%s, ",
392392   (int)(f->numparams),f->is_vararg?"+":"",SS(f->numparams),
393393   S(f->maxstacksize),S(f->sizeupvalues));
394 printf("%d local%s, %d constant%s, %d function%s\n",
394   printf("%d local%s, %d constant%s, %d function%s\n",
395395   S(f->sizelocvars),S(f->sizek),S(f->sizep));
396396}
397397
398398static void PrintDebug(const Proto* f)
399399{
400 int i,n;
401 n=f->sizek;
402 printf("constants (%d) for %p:\n",n,VOID(f));
403 for (i=0; i<n; i++)
404 {
405  printf("\t%d\t",i+1);
406  PrintConstant(f,i);
407  printf("\n");
408 }
409 n=f->sizelocvars;
410 printf("locals (%d) for %p:\n",n,VOID(f));
411 for (i=0; i<n; i++)
412 {
413  printf("\t%d\t%s\t%d\t%d\n",
414  i,getstr(f->locvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1);
415 }
416 n=f->sizeupvalues;
417 printf("upvalues (%d) for %p:\n",n,VOID(f));
418 for (i=0; i<n; i++)
419 {
420  printf("\t%d\t%s\t%d\t%d\n",
421  i,UPVALNAME(i),f->upvalues[i].instack,f->upvalues[i].idx);
422 }
400   int i,n;
401   n=f->sizek;
402   printf("constants (%d) for %p:\n",n,VOID(f));
403   for (i=0; i<n; i++)
404   {
405   printf("\t%d\t",i+1);
406   PrintConstant(f,i);
407   printf("\n");
408   }
409   n=f->sizelocvars;
410   printf("locals (%d) for %p:\n",n,VOID(f));
411   for (i=0; i<n; i++)
412   {
413   printf("\t%d\t%s\t%d\t%d\n",
414   i,getstr(f->locvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1);
415   }
416   n=f->sizeupvalues;
417   printf("upvalues (%d) for %p:\n",n,VOID(f));
418   for (i=0; i<n; i++)
419   {
420   printf("\t%d\t%s\t%d\t%d\n",
421   i,UPVALNAME(i),f->upvalues[i].instack,f->upvalues[i].idx);
422   }
423423}
424424
425425static void PrintFunction(const Proto* f, int full)
426426{
427 int i,n=f->sizep;
428 PrintHeader(f);
429 PrintCode(f);
430 if (full) PrintDebug(f);
431 for (i=0; i<n; i++) PrintFunction(f->p[i],full);
427   int i,n=f->sizep;
428   PrintHeader(f);
429   PrintCode(f);
430   if (full) PrintDebug(f);
431   for (i=0; i<n; i++) PrintFunction(f->p[i],full);
432432}
trunk/src/lib/lua/loslib.c
r31373r31374
2626#if !defined(LUA_STRFTIMEOPTIONS)
2727
2828#if !defined(LUA_USE_POSIX)
29#define LUA_STRFTIMEOPTIONS   { "aAbBcdHIjmMpSUwWxXyYz%", "" }
29#define LUA_STRFTIMEOPTIONS { "aAbBcdHIjmMpSUwWxXyYz%", "" }
3030#else
3131#define LUA_STRFTIMEOPTIONS \
3232   { "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%", "" \
33     "", "E", "cCxXyY",  \
34     "O", "deHImMSuUVwWy" }
33      "", "E", "cCxXyY",  \
34      "O", "deHImMSuUVwWy" }
3535#endif
3636
3737#endif
r31373r31374
4444*/
4545#if defined(LUA_USE_MKSTEMP)
4646#include <unistd.h>
47#define LUA_TMPNAMBUFSIZE   32
47#define LUA_TMPNAMBUFSIZE   32
4848#define lua_tmpnam(b,e) { \
49        strcpy(b, "/tmp/lua_XXXXXX"); \
50        e = mkstemp(b); \
51        if (e != -1) close(e); \
52        e = (e == -1); }
49      strcpy(b, "/tmp/lua_XXXXXX"); \
50      e = mkstemp(b); \
51      if (e != -1) close(e); \
52      e = (e == -1); }
5353
5454#elif !defined(lua_tmpnam)
5555
56#define LUA_TMPNAMBUFSIZE   L_tmpnam
57#define lua_tmpnam(b,e)      { e = (tmpnam(b) == NULL); }
56#define LUA_TMPNAMBUFSIZE   L_tmpnam
57#define lua_tmpnam(b,e)     { e = (tmpnam(b) == NULL); }
5858
5959#endif
6060
r31373r31374
6565*/
6666#if defined(LUA_USE_GMTIME_R)
6767
68#define l_gmtime(t,r)      gmtime_r(t,r)
69#define l_localtime(t,r)   localtime_r(t,r)
68#define l_gmtime(t,r)       gmtime_r(t,r)
69#define l_localtime(t,r)    localtime_r(t,r)
7070
7171#elif !defined(l_gmtime)
7272
73#define l_gmtime(t,r)      ((void)r, gmtime(t))
74#define l_localtime(t,r)     ((void)r, localtime(t))
73#define l_gmtime(t,r)       ((void)r, gmtime(t))
74#define l_localtime(t,r)    ((void)r, localtime(t))
7575
7676#endif
7777
7878
7979
8080static int os_execute (lua_State *L) {
81  const char *cmd = luaL_optstring(L, 1, NULL);
82  int stat = system(cmd);
83  if (cmd != NULL)
84    return luaL_execresult(L, stat);
85  else {
86    lua_pushboolean(L, stat);  /* true if there is a shell */
87    return 1;
88  }
81   const char *cmd = luaL_optstring(L, 1, NULL);
82   int stat = system(cmd);
83   if (cmd != NULL)
84   return luaL_execresult(L, stat);
85   else {
86   lua_pushboolean(L, stat);  /* true if there is a shell */
87   return 1;
88   }
8989}
9090
9191
9292static int os_remove (lua_State *L) {
93  const char *filename = luaL_checkstring(L, 1);
94  return luaL_fileresult(L, remove(filename) == 0, filename);
93   const char *filename = luaL_checkstring(L, 1);
94   return luaL_fileresult(L, remove(filename) == 0, filename);
9595}
9696
9797
9898static int os_rename (lua_State *L) {
99  const char *fromname = luaL_checkstring(L, 1);
100  const char *toname = luaL_checkstring(L, 2);
101  return luaL_fileresult(L, rename(fromname, toname) == 0, NULL);
99   const char *fromname = luaL_checkstring(L, 1);
100   const char *toname = luaL_checkstring(L, 2);
101   return luaL_fileresult(L, rename(fromname, toname) == 0, NULL);
102102}
103103
104104
105105static int os_tmpname (lua_State *L) {
106  char buff[LUA_TMPNAMBUFSIZE];
107  int err;
108  lua_tmpnam(buff, err);
109  if (err)
110    return luaL_error(L, "unable to generate a unique filename");
111  lua_pushstring(L, buff);
112  return 1;
106   char buff[LUA_TMPNAMBUFSIZE];
107   int err;
108   lua_tmpnam(buff, err);
109   if (err)
110   return luaL_error(L, "unable to generate a unique filename");
111   lua_pushstring(L, buff);
112   return 1;
113113}
114114
115115
116116static int os_getenv (lua_State *L) {
117  lua_pushstring(L, getenv(luaL_checkstring(L, 1)));  /* if NULL push nil */
118  return 1;
117   lua_pushstring(L, getenv(luaL_checkstring(L, 1)));  /* if NULL push nil */
118   return 1;
119119}
120120
121121
122122static int os_clock (lua_State *L) {
123  lua_pushnumber(L, ((lua_Number)(1.0*clock()))/(lua_Number)CLOCKS_PER_SEC);
124  return 1;
123   lua_pushnumber(L, ((lua_Number)(1.0*clock()))/(lua_Number)CLOCKS_PER_SEC);
124   return 1;
125125}
126126
127127
r31373r31374
134134*/
135135
136136static void setfield (lua_State *L, const char *key, int value) {
137  lua_pushinteger(L, value);
138  lua_setfield(L, -2, key);
137   lua_pushinteger(L, value);
138   lua_setfield(L, -2, key);
139139}
140140
141141static void setboolfield (lua_State *L, const char *key, int value) {
142  if (value < 0)  /* undefined? */
143    return;  /* does not set field */
144  lua_pushboolean(L, value);
145  lua_setfield(L, -2, key);
142   if (value < 0)  /* undefined? */
143   return;  /* does not set field */
144   lua_pushboolean(L, value);
145   lua_setfield(L, -2, key);
146146}
147147
148148static int getboolfield (lua_State *L, const char *key) {
149  int res;
150  lua_getfield(L, -1, key);
151  res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1);
152  lua_pop(L, 1);
153  return res;
149   int res;
150   lua_getfield(L, -1, key);
151   res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1);
152   lua_pop(L, 1);
153   return res;
154154}
155155
156156
157157static int getfield (lua_State *L, const char *key, int d) {
158  int res, isnum;
159  lua_getfield(L, -1, key);
160  res = (int)lua_tointegerx(L, -1, &isnum);
161  if (!isnum) {
162    if (d < 0)
163      return luaL_error(L, "field " LUA_QS " missing in date table", key);
164    res = d;
165  }
166  lua_pop(L, 1);
167  return res;
158   int res, isnum;
159   lua_getfield(L, -1, key);
160   res = (int)lua_tointegerx(L, -1, &isnum);
161   if (!isnum) {
162   if (d < 0)
163      return luaL_error(L, "field " LUA_QS " missing in date table", key);
164   res = d;
165   }
166   lua_pop(L, 1);
167   return res;
168168}
169169
170170
171171static const char *checkoption (lua_State *L, const char *conv, char *buff) {
172  static const char *const options[] = LUA_STRFTIMEOPTIONS;
173  unsigned int i;
174  for (i = 0; i < sizeof(options)/sizeof(options[0]); i += 2) {
175    if (*conv != '\0' && strchr(options[i], *conv) != NULL) {
176      buff[1] = *conv;
177      if (*options[i + 1] == '\0') {  /* one-char conversion specifier? */
178        buff[2] = '\0';  /* end buffer */
179        return conv + 1;
180      }
181      else if (*(conv + 1) != '\0' &&
182               strchr(options[i + 1], *(conv + 1)) != NULL) {
183        buff[2] = *(conv + 1);  /* valid two-char conversion specifier */
184        buff[3] = '\0';  /* end buffer */
185        return conv + 2;
186      }
187    }
188  }
189  luaL_argerror(L, 1,
190    lua_pushfstring(L, "invalid conversion specifier '%%%s'", conv));
191  return conv;  /* to avoid warnings */
172   static const char *const options[] = LUA_STRFTIMEOPTIONS;
173   unsigned int i;
174   for (i = 0; i < sizeof(options)/sizeof(options[0]); i += 2) {
175   if (*conv != '\0' && strchr(options[i], *conv) != NULL) {
176      buff[1] = *conv;
177      if (*options[i + 1] == '\0') {  /* one-char conversion specifier? */
178      buff[2] = '\0';  /* end buffer */
179      return conv + 1;
180      }
181      else if (*(conv + 1) != '\0' &&
182            strchr(options[i + 1], *(conv + 1)) != NULL) {
183      buff[2] = *(conv + 1);  /* valid two-char conversion specifier */
184      buff[3] = '\0';  /* end buffer */
185      return conv + 2;
186      }
187   }
188   }
189   luaL_argerror(L, 1,
190   lua_pushfstring(L, "invalid conversion specifier '%%%s'", conv));
191   return conv;  /* to avoid warnings */
192192}
193193
194194
195195static int os_date (lua_State *L) {
196  const char *s = luaL_optstring(L, 1, "%c");
197  time_t t = luaL_opt(L, luaL_checknumber, 2, time(NULL));
198  struct tm tmr, *stm;
199  if (*s == '!') {  /* UTC? */
200    stm = l_gmtime(&t, &tmr);
201    s++;  /* skip `!' */
202  }
203  else
204    stm = l_localtime(&t, &tmr);
205  if (stm == NULL)  /* invalid date? */
206    lua_pushnil(L);
207  else if (strcmp(s, "*t") == 0) {
208    lua_createtable(L, 0, 9);  /* 9 = number of fields */
209    setfield(L, "sec", stm->tm_sec);
210    setfield(L, "min", stm->tm_min);
211    setfield(L, "hour", stm->tm_hour);
212    setfield(L, "day", stm->tm_mday);
213    setfield(L, "month", stm->tm_mon+1);
214    setfield(L, "year", stm->tm_year+1900);
215    setfield(L, "wday", stm->tm_wday+1);
216    setfield(L, "yday", stm->tm_yday+1);
217    setboolfield(L, "isdst", stm->tm_isdst);
218  }
219  else {
220    char cc[4];
221    luaL_Buffer b;
222    cc[0] = '%';
223    luaL_buffinit(L, &b);
224    while (*s) {
225      if (*s != '%')  /* no conversion specifier? */
226        luaL_addchar(&b, *s++);
227      else {
228        size_t reslen;
229        char buff[200];  /* should be big enough for any conversion result */
230        s = checkoption(L, s + 1, cc);
231        reslen = strftime(buff, sizeof(buff), cc, stm);
232        luaL_addlstring(&b, buff, reslen);
233      }
234    }
235    luaL_pushresult(&b);
236  }
237  return 1;
196   const char *s = luaL_optstring(L, 1, "%c");
197   time_t t = luaL_opt(L, luaL_checknumber, 2, time(NULL));
198   struct tm tmr, *stm;
199   if (*s == '!') {  /* UTC? */
200   stm = l_gmtime(&t, &tmr);
201   s++;  /* skip `!' */
202   }
203   else
204   stm = l_localtime(&t, &tmr);
205   if (stm == NULL)  /* invalid date? */
206   lua_pushnil(L);
207   else if (strcmp(s, "*t") == 0) {
208   lua_createtable(L, 0, 9);  /* 9 = number of fields */
209   setfield(L, "sec", stm->tm_sec);
210   setfield(L, "min", stm->tm_min);
211   setfield(L, "hour", stm->tm_hour);
212   setfield(L, "day", stm->tm_mday);
213   setfield(L, "month", stm->tm_mon+1);
214   setfield(L, "year", stm->tm_year+1900);
215   setfield(L, "wday", stm->tm_wday+1);
216   setfield(L, "yday", stm->tm_yday+1);
217   setboolfield(L, "isdst", stm->tm_isdst);
218   }
219   else {
220   char cc[4];
221   luaL_Buffer b;
222   cc[0] = '%';
223   luaL_buffinit(L, &b);
224   while (*s) {
225      if (*s != '%')  /* no conversion specifier? */
226      luaL_addchar(&b, *s++);
227      else {
228      size_t reslen;
229      char buff[200];  /* should be big enough for any conversion result */
230      s = checkoption(L, s + 1, cc);
231      reslen = strftime(buff, sizeof(buff), cc, stm);
232      luaL_addlstring(&b, buff, reslen);
233      }
234   }
235   luaL_pushresult(&b);
236   }
237   return 1;
238238}
239239
240240
241241static int os_time (lua_State *L) {
242  time_t t;
243  if (lua_isnoneornil(L, 1))  /* called without args? */
244    t = time(NULL);  /* get current time */
245  else {
246    struct tm ts;
247    luaL_checktype(L, 1, LUA_TTABLE);
248    lua_settop(L, 1);  /* make sure table is at the top */
249    ts.tm_sec = getfield(L, "sec", 0);
250    ts.tm_min = getfield(L, "min", 0);
251    ts.tm_hour = getfield(L, "hour", 12);
252    ts.tm_mday = getfield(L, "day", -1);
253    ts.tm_mon = getfield(L, "month", -1) - 1;
254    ts.tm_year = getfield(L, "year", -1) - 1900;
255    ts.tm_isdst = getboolfield(L, "isdst");
256    t = mktime(&ts);
257  }
258  if (t == (time_t)(-1))
259    lua_pushnil(L);
260  else
261    lua_pushnumber(L, (lua_Number)t);
262  return 1;
242   time_t t;
243   if (lua_isnoneornil(L, 1))  /* called without args? */
244   t = time(NULL);  /* get current time */
245   else {
246   struct tm ts;
247   luaL_checktype(L, 1, LUA_TTABLE);
248   lua_settop(L, 1);  /* make sure table is at the top */
249   ts.tm_sec = getfield(L, "sec", 0);
250   ts.tm_min = getfield(L, "min", 0);
251   ts.tm_hour = getfield(L, "hour", 12);
252   ts.tm_mday = getfield(L, "day", -1);
253   ts.tm_mon = getfield(L, "month", -1) - 1;
254   ts.tm_year = getfield(L, "year", -1) - 1900;
255   ts.tm_isdst = getboolfield(L, "isdst");
256   t = mktime(&ts);
257   }
258   if (t == (time_t)(-1))
259   lua_pushnil(L);
260   else
261   lua_pushnumber(L, (lua_Number)t);
262   return 1;
263263}
264264
265265
266266static int os_difftime (lua_State *L) {
267  lua_pushnumber(L, difftime((luaL_checknumber(L, 1)),
268                             (luaL_optnumber(L, 2, 0))));
269  return 1;
267   lua_pushnumber(L, difftime((luaL_checknumber(L, 1)),
268                        (luaL_optnumber(L, 2, 0))));
269   return 1;
270270}
271271
272272/* }====================================================== */
273273
274274
275275static int os_setlocale (lua_State *L) {
276  static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY,
277                      LC_NUMERIC, LC_TIME};
278  static const char *const catnames[] = {"all", "collate", "ctype", "monetary",
279     "numeric", "time", NULL};
280  const char *l = luaL_optstring(L, 1, NULL);
281  int op = luaL_checkoption(L, 2, "all", catnames);
282  lua_pushstring(L, setlocale(cat[op], l));
283  return 1;
276   static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY,
277                  LC_NUMERIC, LC_TIME};
278   static const char *const catnames[] = {"all", "collate", "ctype", "monetary",
279      "numeric", "time", NULL};
280   const char *l = luaL_optstring(L, 1, NULL);
281   int op = luaL_checkoption(L, 2, "all", catnames);
282   lua_pushstring(L, setlocale(cat[op], l));
283   return 1;
284284}
285285
286286
287287static int os_exit (lua_State *L) {
288  int status;
289  if (lua_isboolean(L, 1))
290    status = (lua_toboolean(L, 1) ? EXIT_SUCCESS : EXIT_FAILURE);
291  else
292    status = luaL_optint(L, 1, EXIT_SUCCESS);
293  if (lua_toboolean(L, 2))
294    lua_close(L);
295  if (L) exit(status);  /* 'if' to avoid warnings for unreachable 'return' */
296  return 0;
288   int status;
289   if (lua_isboolean(L, 1))
290   status = (lua_toboolean(L, 1) ? EXIT_SUCCESS : EXIT_FAILURE);
291   else
292   status = luaL_optint(L, 1, EXIT_SUCCESS);
293   if (lua_toboolean(L, 2))
294   lua_close(L);
295   if (L) exit(status);  /* 'if' to avoid warnings for unreachable 'return' */
296   return 0;
297297}
298298
299299
300300static const luaL_Reg syslib[] = {
301  {"clock",     os_clock},
302  {"date",      os_date},
303  {"difftime",  os_difftime},
304  {"execute",   os_execute},
305  {"exit",      os_exit},
306  {"getenv",    os_getenv},
307  {"remove",    os_remove},
308  {"rename",    os_rename},
309  {"setlocale", os_setlocale},
310  {"time",      os_time},
311  {"tmpname",   os_tmpname},
312  {NULL, NULL}
301   {"clock",     os_clock},
302   {"date",      os_date},
303   {"difftime",  os_difftime},
304   {"execute",   os_execute},
305   {"exit",      os_exit},
306   {"getenv",    os_getenv},
307   {"remove",    os_remove},
308   {"rename",    os_rename},
309   {"setlocale", os_setlocale},
310   {"time",      os_time},
311   {"tmpname",   os_tmpname},
312   {NULL, NULL}
313313};
314314
315315/* }====================================================== */
r31373r31374
317317
318318
319319LUAMOD_API int luaopen_os (lua_State *L) {
320  luaL_newlib(L, syslib);
321  return 1;
320   luaL_newlib(L, syslib);
321   return 1;
322322}
323
trunk/src/lib/lua/lundump.c
r31373r31374
2121#include "lzio.h"
2222
2323typedef struct {
24 lua_State* L;
25 ZIO* Z;
26 Mbuffer* b;
27 const char* name;
24   lua_State* L;
25   ZIO* Z;
26   Mbuffer* b;
27   const char* name;
2828} LoadState;
2929
3030static l_noret error(LoadState* S, const char* why)
3131{
32 luaO_pushfstring(S->L,"%s: %s precompiled chunk",S->name,why);
33 luaD_throw(S->L,LUA_ERRSYNTAX);
32   luaO_pushfstring(S->L,"%s: %s precompiled chunk",S->name,why);
33   luaD_throw(S->L,LUA_ERRSYNTAX);
3434}
3535
36#define LoadMem(S,b,n,size)   LoadBlock(S,b,(n)*(size))
37#define LoadByte(S)      (lu_byte)LoadChar(S)
38#define LoadVar(S,x)      LoadMem(S,&x,1,sizeof(x))
39#define LoadVector(S,b,n,size)   LoadMem(S,b,n,size)
36#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size))
37#define LoadByte(S)     (lu_byte)LoadChar(S)
38#define LoadVar(S,x)        LoadMem(S,&x,1,sizeof(x))
39#define LoadVector(S,b,n,size)  LoadMem(S,b,n,size)
4040
4141#if !defined(luai_verifycode)
42#define luai_verifycode(L,b,f)   /* empty */
42#define luai_verifycode(L,b,f)  /* empty */
4343#endif
4444
4545static void LoadBlock(LoadState* S, void* b, size_t size)
4646{
47 if (luaZ_read(S->Z,b,size)!=0) error(S,"truncated");
47   if (luaZ_read(S->Z,b,size)!=0) error(S,"truncated");
4848}
4949
5050static int LoadChar(LoadState* S)
5151{
52 char x;
53 LoadVar(S,x);
54 return x;
52   char x;
53   LoadVar(S,x);
54   return x;
5555}
5656
5757static int LoadInt(LoadState* S)
5858{
59 int x;
60 LoadVar(S,x);
61 if (x<0) error(S,"corrupted");
62 return x;
59   int x;
60   LoadVar(S,x);
61   if (x<0) error(S,"corrupted");
62   return x;
6363}
6464
6565static lua_Number LoadNumber(LoadState* S)
6666{
67 lua_Number x;
68 LoadVar(S,x);
69 return x;
67   lua_Number x;
68   LoadVar(S,x);
69   return x;
7070}
7171
7272static TString* LoadString(LoadState* S)
7373{
74 size_t size;
75 LoadVar(S,size);
76 if (size==0)
77  return NULL;
78 else
79 {
80  char* s=luaZ_openspace(S->L,S->b,size);
81  LoadBlock(S,s,size*sizeof(char));
82  return luaS_newlstr(S->L,s,size-1);      /* remove trailing '\0' */
83 }
74   size_t size;
75   LoadVar(S,size);
76   if (size==0)
77   return NULL;
78   else
79   {
80   char* s=luaZ_openspace(S->L,S->b,size);
81   LoadBlock(S,s,size*sizeof(char));
82   return luaS_newlstr(S->L,s,size-1);     /* remove trailing '\0' */
83   }
8484}
8585
8686static void LoadCode(LoadState* S, Proto* f)
8787{
88 int n=LoadInt(S);
89 f->code=luaM_newvector(S->L,n,Instruction);
90 f->sizecode=n;
91 LoadVector(S,f->code,n,sizeof(Instruction));
88   int n=LoadInt(S);
89   f->code=luaM_newvector(S->L,n,Instruction);
90   f->sizecode=n;
91   LoadVector(S,f->code,n,sizeof(Instruction));
9292}
9393
9494static void LoadFunction(LoadState* S, Proto* f);
9595
9696static void LoadConstants(LoadState* S, Proto* f)
9797{
98 int i,n;
99 n=LoadInt(S);
100 f->k=luaM_newvector(S->L,n,TValue);
101 f->sizek=n;
102 for (i=0; i<n; i++) setnilvalue(&f->k[i]);
103 for (i=0; i<n; i++)
104 {
105  TValue* o=&f->k[i];
106  int t=LoadChar(S);
107  switch (t)
108  {
109   case LUA_TNIL:
98   int i,n;
99   n=LoadInt(S);
100   f->k=luaM_newvector(S->L,n,TValue);
101   f->sizek=n;
102   for (i=0; i<n; i++) setnilvalue(&f->k[i]);
103   for (i=0; i<n; i++)
104   {
105   TValue* o=&f->k[i];
106   int t=LoadChar(S);
107   switch (t)
108   {
109   case LUA_TNIL:
110110   setnilvalue(o);
111111   break;
112   case LUA_TBOOLEAN:
112   case LUA_TBOOLEAN:
113113   setbvalue(o,LoadChar(S));
114114   break;
115   case LUA_TNUMBER:
115   case LUA_TNUMBER:
116116   setnvalue(o,LoadNumber(S));
117117   break;
118   case LUA_TSTRING:
118   case LUA_TSTRING:
119119   setsvalue2n(S->L,o,LoadString(S));
120120   break;
121    default: lua_assert(0);
122  }
123 }
124 n=LoadInt(S);
125 f->p=luaM_newvector(S->L,n,Proto*);
126 f->sizep=n;
127 for (i=0; i<n; i++) f->p[i]=NULL;
128 for (i=0; i<n; i++)
129 {
130  f->p[i]=luaF_newproto(S->L);
131  LoadFunction(S,f->p[i]);
132 }
121   default: lua_assert(0);
122   }
123   }
124   n=LoadInt(S);
125   f->p=luaM_newvector(S->L,n,Proto*);
126   f->sizep=n;
127   for (i=0; i<n; i++) f->p[i]=NULL;
128   for (i=0; i<n; i++)
129   {
130   f->p[i]=luaF_newproto(S->L);
131   LoadFunction(S,f->p[i]);
132   }
133133}
134134
135135static void LoadUpvalues(LoadState* S, Proto* f)
136136{
137 int i,n;
138 n=LoadInt(S);
139 f->upvalues=luaM_newvector(S->L,n,Upvaldesc);
140 f->sizeupvalues=n;
141 for (i=0; i<n; i++) f->upvalues[i].name=NULL;
142 for (i=0; i<n; i++)
143 {
144  f->upvalues[i].instack=LoadByte(S);
145  f->upvalues[i].idx=LoadByte(S);
146 }
137   int i,n;
138   n=LoadInt(S);
139   f->upvalues=luaM_newvector(S->L,n,Upvaldesc);
140   f->sizeupvalues=n;
141   for (i=0; i<n; i++) f->upvalues[i].name=NULL;
142   for (i=0; i<n; i++)
143   {
144   f->upvalues[i].instack=LoadByte(S);
145   f->upvalues[i].idx=LoadByte(S);
146   }
147147}
148148
149149static void LoadDebug(LoadState* S, Proto* f)
150150{
151 int i,n;
152 f->source=LoadString(S);
153 n=LoadInt(S);
154 f->lineinfo=luaM_newvector(S->L,n,int);
155 f->sizelineinfo=n;
156 LoadVector(S,f->lineinfo,n,sizeof(int));
157 n=LoadInt(S);
158 f->locvars=luaM_newvector(S->L,n,LocVar);
159 f->sizelocvars=n;
160 for (i=0; i<n; i++) f->locvars[i].varname=NULL;
161 for (i=0; i<n; i++)
162 {
163  f->locvars[i].varname=LoadString(S);
164  f->locvars[i].startpc=LoadInt(S);
165  f->locvars[i].endpc=LoadInt(S);
166 }
167 n=LoadInt(S);
168 for (i=0; i<n; i++) f->upvalues[i].name=LoadString(S);
151   int i,n;
152   f->source=LoadString(S);
153   n=LoadInt(S);
154   f->lineinfo=luaM_newvector(S->L,n,int);
155   f->sizelineinfo=n;
156   LoadVector(S,f->lineinfo,n,sizeof(int));
157   n=LoadInt(S);
158   f->locvars=luaM_newvector(S->L,n,LocVar);
159   f->sizelocvars=n;
160   for (i=0; i<n; i++) f->locvars[i].varname=NULL;
161   for (i=0; i<n; i++)
162   {
163   f->locvars[i].varname=LoadString(S);
164   f->locvars[i].startpc=LoadInt(S);
165   f->locvars[i].endpc=LoadInt(S);
166   }
167   n=LoadInt(S);
168   for (i=0; i<n; i++) f->upvalues[i].name=LoadString(S);
169169}
170170
171171static void LoadFunction(LoadState* S, Proto* f)
172172{
173 f->linedefined=LoadInt(S);
174 f->lastlinedefined=LoadInt(S);
175 f->numparams=LoadByte(S);
176 f->is_vararg=LoadByte(S);
177 f->maxstacksize=LoadByte(S);
178 LoadCode(S,f);
179 LoadConstants(S,f);
180 LoadUpvalues(S,f);
181 LoadDebug(S,f);
173   f->linedefined=LoadInt(S);
174   f->lastlinedefined=LoadInt(S);
175   f->numparams=LoadByte(S);
176   f->is_vararg=LoadByte(S);
177   f->maxstacksize=LoadByte(S);
178   LoadCode(S,f);
179   LoadConstants(S,f);
180   LoadUpvalues(S,f);
181   LoadDebug(S,f);
182182}
183183
184184/* the code below must be consistent with the code in luaU_header */
185#define N0   LUAC_HEADERSIZE
186#define N1   (sizeof(LUA_SIGNATURE)-sizeof(char))
187#define N2   N1+2
188#define N3   N2+6
185#define N0  LUAC_HEADERSIZE
186#define N1  (sizeof(LUA_SIGNATURE)-sizeof(char))
187#define N2  N1+2
188#define N3  N2+6
189189
190190static void LoadHeader(LoadState* S)
191191{
192 lu_byte h[LUAC_HEADERSIZE];
193 lu_byte s[LUAC_HEADERSIZE];
194 luaU_header(h);
195 memcpy(s,h,sizeof(char));         /* first char already read */
196 LoadBlock(S,s+sizeof(char),LUAC_HEADERSIZE-sizeof(char));
197 if (memcmp(h,s,N0)==0) return;
198 if (memcmp(h,s,N1)!=0) error(S,"not a");
199 if (memcmp(h,s,N2)!=0) error(S,"version mismatch in");
200 if (memcmp(h,s,N3)!=0) error(S,"incompatible"); else error(S,"corrupted");
192   lu_byte h[LUAC_HEADERSIZE];
193   lu_byte s[LUAC_HEADERSIZE];
194   luaU_header(h);
195   memcpy(s,h,sizeof(char));           /* first char already read */
196   LoadBlock(S,s+sizeof(char),LUAC_HEADERSIZE-sizeof(char));
197   if (memcmp(h,s,N0)==0) return;
198   if (memcmp(h,s,N1)!=0) error(S,"not a");
199   if (memcmp(h,s,N2)!=0) error(S,"version mismatch in");
200   if (memcmp(h,s,N3)!=0) error(S,"incompatible"); else error(S,"corrupted");
201201}
202202
203203/*
r31373r31374
205205*/
206206Closure* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name)
207207{
208 LoadState S;
209 Closure* cl;
210 if (*name=='@' || *name=='=')
211  S.name=name+1;
212 else if (*name==LUA_SIGNATURE[0])
213  S.name="binary string";
214 else
215  S.name=name;
216 S.L=L;
217 S.Z=Z;
218 S.b=buff;
219 LoadHeader(&S);
220 cl=luaF_newLclosure(L,1);
221 setclLvalue(L,L->top,cl); incr_top(L);
222 cl->l.p=luaF_newproto(L);
223 LoadFunction(&S,cl->l.p);
224 if (cl->l.p->sizeupvalues != 1)
225 {
226  Proto* p=cl->l.p;
227  cl=luaF_newLclosure(L,cl->l.p->sizeupvalues);
228  cl->l.p=p;
229  setclLvalue(L,L->top-1,cl);
230 }
231 luai_verifycode(L,buff,cl->l.p);
232 return cl;
208   LoadState S;
209   Closure* cl;
210   if (*name=='@' || *name=='=')
211   S.name=name+1;
212   else if (*name==LUA_SIGNATURE[0])
213   S.name="binary string";
214   else
215   S.name=name;
216   S.L=L;
217   S.Z=Z;
218   S.b=buff;
219   LoadHeader(&S);
220   cl=luaF_newLclosure(L,1);
221   setclLvalue(L,L->top,cl); incr_top(L);
222   cl->l.p=luaF_newproto(L);
223   LoadFunction(&S,cl->l.p);
224   if (cl->l.p->sizeupvalues != 1)
225   {
226   Proto* p=cl->l.p;
227   cl=luaF_newLclosure(L,cl->l.p->sizeupvalues);
228   cl->l.p=p;
229   setclLvalue(L,L->top-1,cl);
230   }
231   luai_verifycode(L,buff,cl->l.p);
232   return cl;
233233}
234234
235#define MYINT(s)   (s[0]-'0')
236#define VERSION      MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)
237#define FORMAT      0      /* this is the official format */
235#define MYINT(s)    (s[0]-'0')
236#define VERSION     MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)
237#define FORMAT      0       /* this is the official format */
238238
239239/*
240240* make header for precompiled chunks
r31373r31374
243243*/
244244void luaU_header (lu_byte* h)
245245{
246 int x=1;
247 memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-sizeof(char));
248 h+=sizeof(LUA_SIGNATURE)-sizeof(char);
249 *h++=cast_byte(VERSION);
250 *h++=cast_byte(FORMAT);
251 *h++=cast_byte(*(char*)&x);         /* endianness */
252 *h++=cast_byte(sizeof(int));
253 *h++=cast_byte(sizeof(size_t));
254 *h++=cast_byte(sizeof(Instruction));
255 *h++=cast_byte(sizeof(lua_Number));
256 *h++=cast_byte(((lua_Number)0.5)==0);      /* is lua_Number integral? */
257 memcpy(h,LUAC_TAIL,sizeof(LUAC_TAIL)-sizeof(char));
246   int x=1;
247   memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-sizeof(char));
248   h+=sizeof(LUA_SIGNATURE)-sizeof(char);
249   *h++=cast_byte(VERSION);
250   *h++=cast_byte(FORMAT);
251   *h++=cast_byte(*(char*)&x);         /* endianness */
252   *h++=cast_byte(sizeof(int));
253   *h++=cast_byte(sizeof(size_t));
254   *h++=cast_byte(sizeof(Instruction));
255   *h++=cast_byte(sizeof(lua_Number));
256   *h++=cast_byte(((lua_Number)0.5)==0);       /* is lua_Number integral? */
257   memcpy(h,LUAC_TAIL,sizeof(LUAC_TAIL)-sizeof(char));
258258}
trunk/src/lib/lua/lib/lsqlite3.c
r31373r31374
5151
5252/* compile time features */
5353#if !defined(SQLITE_OMIT_PROGRESS_CALLBACK)
54    #define SQLITE_OMIT_PROGRESS_CALLBACK 0
54   #define SQLITE_OMIT_PROGRESS_CALLBACK 0
5555#endif
5656#if !defined(LSQLITE_OMIT_UPDATE_HOOK)
57    #define LSQLITE_OMIT_UPDATE_HOOK 0
57   #define LSQLITE_OMIT_UPDATE_HOOK 0
5858#endif
5959
6060typedef struct sdb sdb;
r31373r31374
6363
6464/* to use as C user data so i know what function sqlite is calling */
6565struct sdb_func {
66    /* references to associated lua values */
67    int fn_step;
68    int fn_finalize;
69    int udata;
66   /* references to associated lua values */
67   int fn_step;
68   int fn_finalize;
69   int udata;
7070
71    sdb *db;
72    char aggregate;
71   sdb *db;
72   char aggregate;
7373
74    sdb_func *next;
74   sdb_func *next;
7575};
7676
7777/* information about database */
7878struct sdb {
79    /* associated lua state */
80    lua_State *L;
81    /* sqlite database handle */
82    sqlite3 *db;
79   /* associated lua state */
80   lua_State *L;
81   /* sqlite database handle */
82   sqlite3 *db;
8383
84    /* sql functions stack usage */
85    sdb_func *func;         /* top SQL function being called */
84   /* sql functions stack usage */
85   sdb_func *func;         /* top SQL function being called */
8686
87    /* references */
88    int busy_cb;        /* busy callback */
89    int busy_udata;
87   /* references */
88   int busy_cb;        /* busy callback */
89   int busy_udata;
9090
91    int progress_cb;    /* progress handler */
92    int progress_udata;
91   int progress_cb;    /* progress handler */
92   int progress_udata;
9393
94    int trace_cb;       /* trace callback */
95    int trace_udata;
94   int trace_cb;       /* trace callback */
95   int trace_udata;
9696
9797#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK
9898
99    int update_hook_cb; /* update_hook callback */
100    int update_hook_udata;
99   int update_hook_cb; /* update_hook callback */
100   int update_hook_udata;
101101
102    int commit_hook_cb; /* commit_hook callback */
103    int commit_hook_udata;
102   int commit_hook_cb; /* commit_hook callback */
103   int commit_hook_udata;
104104
105    int rollback_hook_cb; /* rollback_hook callback */
106    int rollback_hook_udata;
105   int rollback_hook_cb; /* rollback_hook callback */
106   int rollback_hook_udata;
107107
108108#endif
109109};
r31373r31374
120120*/
121121
122122static void vm_push_column(lua_State *L, sqlite3_stmt *vm, int idx) {
123    switch (sqlite3_column_type(vm, idx)) {
124        case SQLITE_INTEGER:
125            {
126                sqlite_int64 i64 = sqlite3_column_int64(vm, idx);
127                lua_Number n = (lua_Number)i64;
128                if (n == i64)
129                    lua_pushnumber(L, n);
130                else
131                    lua_pushlstring(L, (const char*)sqlite3_column_text(vm, idx), sqlite3_column_bytes(vm, idx));
132            }
133            break;
134        case SQLITE_FLOAT:
135            lua_pushnumber(L, sqlite3_column_double(vm, idx));
136            break;
137        case SQLITE_TEXT:
138            lua_pushlstring(L, (const char*)sqlite3_column_text(vm, idx), sqlite3_column_bytes(vm, idx));
139            break;
140        case SQLITE_BLOB:
141            lua_pushlstring(L, (const char*)sqlite3_column_blob(vm, idx), sqlite3_column_bytes(vm, idx));
142            break;
143        case SQLITE_NULL:
144            lua_pushnil(L);
145            break;
146        default:
147            lua_pushnil(L);
148            break;
149    }
123   switch (sqlite3_column_type(vm, idx)) {
124      case SQLITE_INTEGER:
125         {
126            sqlite_int64 i64 = sqlite3_column_int64(vm, idx);
127            lua_Number n = (lua_Number)i64;
128            if (n == i64)
129               lua_pushnumber(L, n);
130            else
131               lua_pushlstring(L, (const char*)sqlite3_column_text(vm, idx), sqlite3_column_bytes(vm, idx));
132         }
133         break;
134      case SQLITE_FLOAT:
135         lua_pushnumber(L, sqlite3_column_double(vm, idx));
136         break;
137      case SQLITE_TEXT:
138         lua_pushlstring(L, (const char*)sqlite3_column_text(vm, idx), sqlite3_column_bytes(vm, idx));
139         break;
140      case SQLITE_BLOB:
141         lua_pushlstring(L, (const char*)sqlite3_column_blob(vm, idx), sqlite3_column_bytes(vm, idx));
142         break;
143      case SQLITE_NULL:
144         lua_pushnil(L);
145         break;
146      default:
147         lua_pushnil(L);
148         break;
149   }
150150}
151151
152152/* virtual machine information */
153153struct sdb_vm {
154    sdb *db;                /* associated database handle */
155    sqlite3_stmt *vm;       /* virtual machine */
154   sdb *db;                /* associated database handle */
155   sqlite3_stmt *vm;       /* virtual machine */
156156
157    /* sqlite3_step info */
158    int columns;            /* number of columns in result */
159    char has_values;        /* true when step succeeds */
157   /* sqlite3_step info */
158   int columns;            /* number of columns in result */
159   char has_values;        /* true when step succeeds */
160160
161    char temp;              /* temporary vm used in db:rows */
161   char temp;              /* temporary vm used in db:rows */
162162};
163163
164164/* called with sql text on the lua stack */
165165static sdb_vm *newvm(lua_State *L, sdb *db) {
166    sdb_vm *svm = (sdb_vm*)lua_newuserdata(L, sizeof(sdb_vm));
166   sdb_vm *svm = (sdb_vm*)lua_newuserdata(L, sizeof(sdb_vm));
167167
168    luaL_getmetatable(L, sqlite_vm_meta);
169    lua_setmetatable(L, -2);        /* set metatable */
168   luaL_getmetatable(L, sqlite_vm_meta);
169   lua_setmetatable(L, -2);        /* set metatable */
170170
171    svm->db = db;
172    svm->columns = 0;
173    svm->has_values = 0;
174    svm->vm = NULL;
175    svm->temp = 0;
171   svm->db = db;
172   svm->columns = 0;
173   svm->has_values = 0;
174   svm->vm = NULL;
175   svm->temp = 0;
176176
177    /* add an entry on the database table: svm -> sql text */
178    lua_pushlightuserdata(L, db);
179    lua_rawget(L, LUA_REGISTRYINDEX);
180    lua_pushlightuserdata(L, svm);
181    lua_pushvalue(L, -4); /* the sql text */
182    lua_rawset(L, -3);
183    lua_pop(L, 1);
177   /* add an entry on the database table: svm -> sql text */
178   lua_pushlightuserdata(L, db);
179   lua_rawget(L, LUA_REGISTRYINDEX);
180   lua_pushlightuserdata(L, svm);
181   lua_pushvalue(L, -4); /* the sql text */
182   lua_rawset(L, -3);
183   lua_pop(L, 1);
184184
185    return svm;
185   return svm;
186186}
187187
188188static int cleanupvm(lua_State *L, sdb_vm *svm) {
189    /* remove entry in database table - no harm if not present in the table */
190    lua_pushlightuserdata(L, svm->db);
191    lua_rawget(L, LUA_REGISTRYINDEX);
192    lua_pushlightuserdata(L, svm);
193    lua_pushnil(L);
194    lua_rawset(L, -3);
195    lua_pop(L, 1);
189   /* remove entry in database table - no harm if not present in the table */
190   lua_pushlightuserdata(L, svm->db);
191   lua_rawget(L, LUA_REGISTRYINDEX);
192   lua_pushlightuserdata(L, svm);
193   lua_pushnil(L);
194   lua_rawset(L, -3);
195   lua_pop(L, 1);
196196
197    svm->columns = 0;
198    svm->has_values = 0;
197   svm->columns = 0;
198   svm->has_values = 0;
199199
200    if (!svm->vm) return 0;
200   if (!svm->vm) return 0;
201201
202    lua_pushnumber(L, sqlite3_finalize(svm->vm));
203    svm->vm = NULL;
204    return 1;
202   lua_pushnumber(L, sqlite3_finalize(svm->vm));
203   svm->vm = NULL;
204   return 1;
205205}
206206
207207static int stepvm(lua_State *L, sdb_vm *svm) {
208208   // MAME: fixed Visual Studio compiler warning lsqlite3.c(235) : warning C4701: potentially uninitialized local variable 'result' used
209    int result = 0;
210    int loop_limit = 3;
211    while ( loop_limit-- ) {
212        result = sqlite3_step(svm->vm);
213        if ( result==SQLITE_ERROR ) {
214          result = sqlite3_reset (svm->vm);
215        }
216        if ( result==SQLITE_SCHEMA ) {
217            sqlite3_stmt *vn;
218            const char *sql;
219            /* recover sql text */
220            lua_pushlightuserdata(L, svm->db);
221            lua_rawget(L, LUA_REGISTRYINDEX);
222            lua_pushlightuserdata(L, svm);
223            lua_rawget(L, -2); /* sql text */
224            sql = luaL_checkstring(L, -1);
225            /* re-prepare */
226            result = sqlite3_prepare(svm->db->db, sql, -1, &vn, NULL);
227            if (result != SQLITE_OK) break;
228            sqlite3_transfer_bindings(svm->vm, vn);
229            sqlite3_finalize(svm->vm);
230            svm->vm = vn;
231            lua_pop(L,2);
232        } else {
233          break;
234        }
235    }
236    return result;
209   int result = 0;
210   int loop_limit = 3;
211   while ( loop_limit-- ) {
212      result = sqlite3_step(svm->vm);
213      if ( result==SQLITE_ERROR ) {
214         result = sqlite3_reset (svm->vm);
215      }
216      if ( result==SQLITE_SCHEMA ) {
217         sqlite3_stmt *vn;
218         const char *sql;
219         /* recover sql text */
220         lua_pushlightuserdata(L, svm->db);
221         lua_rawget(L, LUA_REGISTRYINDEX);
222         lua_pushlightuserdata(L, svm);
223         lua_rawget(L, -2); /* sql text */
224         sql = luaL_checkstring(L, -1);
225         /* re-prepare */
226         result = sqlite3_prepare(svm->db->db, sql, -1, &vn, NULL);
227         if (result != SQLITE_OK) break;
228         sqlite3_transfer_bindings(svm->vm, vn);
229         sqlite3_finalize(svm->vm);
230         svm->vm = vn;
231         lua_pop(L,2);
232      } else {
233         break;
234      }
235   }
236   return result;
237237}
238238
239239static sdb_vm *lsqlite_getvm(lua_State *L, int index) {
240    sdb_vm *svm = (sdb_vm*)luaL_checkudata(L, index, sqlite_vm_meta);
241    if (svm == NULL) luaL_argerror(L, index, "bad sqlite virtual machine");
242    return svm;
240   sdb_vm *svm = (sdb_vm*)luaL_checkudata(L, index, sqlite_vm_meta);
241   if (svm == NULL) luaL_argerror(L, index, "bad sqlite virtual machine");
242   return svm;
243243}
244244
245245static sdb_vm *lsqlite_checkvm(lua_State *L, int index) {
246    sdb_vm *svm = lsqlite_getvm(L, index);
247    if (svm->vm == NULL) luaL_argerror(L, index, "attempt to use closed sqlite virtual machine");
248    return svm;
246   sdb_vm *svm = lsqlite_getvm(L, index);
247   if (svm->vm == NULL) luaL_argerror(L, index, "attempt to use closed sqlite virtual machine");
248   return svm;
249249}
250250
251251static int dbvm_isopen(lua_State *L) {
252    sdb_vm *svm = lsqlite_getvm(L, 1);
253    lua_pushboolean(L, svm->vm != NULL ? 1 : 0);
254    return 1;
252   sdb_vm *svm = lsqlite_getvm(L, 1);
253   lua_pushboolean(L, svm->vm != NULL ? 1 : 0);
254   return 1;
255255}
256256
257257static int dbvm_tostring(lua_State *L) {
258    char buff[39];
259    sdb_vm *svm = lsqlite_getvm(L, 1);
260    if (svm->vm == NULL)
261        strcpy(buff, "closed");
262    else
263        sprintf(buff, "%p", svm);
264    lua_pushfstring(L, "sqlite virtual machine (%s)", buff);
265    return 1;
258   char buff[39];
259   sdb_vm *svm = lsqlite_getvm(L, 1);
260   if (svm->vm == NULL)
261      strcpy(buff, "closed");
262   else
263      sprintf(buff, "%p", svm);
264   lua_pushfstring(L, "sqlite virtual machine (%s)", buff);
265   return 1;
266266}
267267
268268static int dbvm_gc(lua_State *L) {
269    sdb_vm *svm = lsqlite_getvm(L, 1);
270    if (svm->vm != NULL)  /* ignore closed vms */
271        cleanupvm(L, svm);
272    return 0;
269   sdb_vm *svm = lsqlite_getvm(L, 1);
270   if (svm->vm != NULL)  /* ignore closed vms */
271      cleanupvm(L, svm);
272   return 0;
273273}
274274
275275static int dbvm_step(lua_State *L) {
276    int result;
277    sdb_vm *svm = lsqlite_checkvm(L, 1);
276   int result;
277   sdb_vm *svm = lsqlite_checkvm(L, 1);
278278
279    result = stepvm(L, svm);
280    svm->has_values = result == SQLITE_ROW ? 1 : 0;
281    svm->columns = sqlite3_data_count(svm->vm);
279   result = stepvm(L, svm);
280   svm->has_values = result == SQLITE_ROW ? 1 : 0;
281   svm->columns = sqlite3_data_count(svm->vm);
282282
283    lua_pushnumber(L, result);
284    return 1;
283   lua_pushnumber(L, result);
284   return 1;
285285}
286286
287287static int dbvm_finalize(lua_State *L) {
288    sdb_vm *svm = lsqlite_checkvm(L, 1);
289    return cleanupvm(L, svm);
288   sdb_vm *svm = lsqlite_checkvm(L, 1);
289   return cleanupvm(L, svm);
290290}
291291
292292static int dbvm_reset(lua_State *L) {
293    sdb_vm *svm = lsqlite_checkvm(L, 1);
294    sqlite3_reset(svm->vm);
295    lua_pushnumber(L, sqlite3_errcode(svm->db->db));
296    return 1;
293   sdb_vm *svm = lsqlite_checkvm(L, 1);
294   sqlite3_reset(svm->vm);
295   lua_pushnumber(L, sqlite3_errcode(svm->db->db));
296   return 1;
297297}
298298
299299static void dbvm_check_contents(lua_State *L, sdb_vm *svm) {
300    if (!svm->has_values) {
301        luaL_error(L, "misuse of function");
302    }
300   if (!svm->has_values) {
301      luaL_error(L, "misuse of function");
302   }
303303}
304304
305305static void dbvm_check_index(lua_State *L, sdb_vm *svm, int index) {
306    if (index < 0 || index >= svm->columns) {
307        luaL_error(L, "index out of range [0..%d]", svm->columns - 1);
308    }
306   if (index < 0 || index >= svm->columns) {
307      luaL_error(L, "index out of range [0..%d]", svm->columns - 1);
308   }
309309}
310310
311311static void dbvm_check_bind_index(lua_State *L, sdb_vm *svm, int index) {
312    if (index < 1 || index > sqlite3_bind_parameter_count(svm->vm)) {
313        luaL_error(L, "bind index out of range [1..%d]", sqlite3_bind_parameter_count(svm->vm));
314    }
312   if (index < 1 || index > sqlite3_bind_parameter_count(svm->vm)) {
313      luaL_error(L, "bind index out of range [1..%d]", sqlite3_bind_parameter_count(svm->vm));
314   }
315315}
316316
317317/*
r31373r31374
320320** =======================================================
321321*/
322322static int dbvm_columns(lua_State *L) {
323    sdb_vm *svm = lsqlite_checkvm(L, 1);
324    lua_pushnumber(L, sqlite3_column_count(svm->vm));
325    return 1;
323   sdb_vm *svm = lsqlite_checkvm(L, 1);
324   lua_pushnumber(L, sqlite3_column_count(svm->vm));
325   return 1;
326326}
327327
328328/*
r31373r31374
332332*/
333333
334334static int dbvm_get_value(lua_State *L) {
335    sdb_vm *svm = lsqlite_checkvm(L, 1);
336    int index = luaL_checkint(L, 2);
337    dbvm_check_contents(L, svm);
338    dbvm_check_index(L, svm, index);
339    vm_push_column(L, svm->vm, index);
340    return 1;
335   sdb_vm *svm = lsqlite_checkvm(L, 1);
336   int index = luaL_checkint(L, 2);
337   dbvm_check_contents(L, svm);
338   dbvm_check_index(L, svm, index);
339   vm_push_column(L, svm->vm, index);
340   return 1;
341341}
342342
343343static int dbvm_get_name(lua_State *L) {
344    sdb_vm *svm = lsqlite_checkvm(L, 1);
345    int index = luaL_checknumber(L, 2);
346    dbvm_check_index(L, svm, index);
347    lua_pushstring(L, sqlite3_column_name(svm->vm, index));
348    return 1;
344   sdb_vm *svm = lsqlite_checkvm(L, 1);
345   int index = luaL_checknumber(L, 2);
346   dbvm_check_index(L, svm, index);
347   lua_pushstring(L, sqlite3_column_name(svm->vm, index));
348   return 1;
349349}
350350
351351static int dbvm_get_type(lua_State *L) {
352    sdb_vm *svm = lsqlite_checkvm(L, 1);
353    int index = luaL_checknumber(L, 2);
354    dbvm_check_index(L, svm, index);
355    lua_pushstring(L, sqlite3_column_decltype(svm->vm, index));
356    return 1;
352   sdb_vm *svm = lsqlite_checkvm(L, 1);
353   int index = luaL_checknumber(L, 2);
354   dbvm_check_index(L, svm, index);
355   lua_pushstring(L, sqlite3_column_decltype(svm->vm, index));
356   return 1;
357357}
358358
359359static int dbvm_get_values(lua_State *L) {
360    sdb_vm *svm = lsqlite_checkvm(L, 1);
361    sqlite3_stmt *vm = svm->vm;
362    int columns = svm->columns;
363    int n;
364    dbvm_check_contents(L, svm);
360   sdb_vm *svm = lsqlite_checkvm(L, 1);
361   sqlite3_stmt *vm = svm->vm;
362   int columns = svm->columns;
363   int n;
364   dbvm_check_contents(L, svm);
365365
366    lua_newtable(L);
367    for (n = 0; n < columns;) {
368        vm_push_column(L, vm, n++);
369        lua_rawseti(L, -2, n);
370    }
371    return 1;
366   lua_newtable(L);
367   for (n = 0; n < columns;) {
368      vm_push_column(L, vm, n++);
369      lua_rawseti(L, -2, n);
370   }
371   return 1;
372372}
373373
374374static int dbvm_get_names(lua_State *L) {
375    sdb_vm *svm = lsqlite_checkvm(L, 1);
376    sqlite3_stmt *vm = svm->vm;
377    int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */
378    int n;
375   sdb_vm *svm = lsqlite_checkvm(L, 1);
376   sqlite3_stmt *vm = svm->vm;
377   int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */
378   int n;
379379
380    lua_newtable(L);
381    for (n = 0; n < columns;) {
382        lua_pushstring(L, sqlite3_column_name(vm, n++));
383        lua_rawseti(L, -2, n);
384    }
385    return 1;
380   lua_newtable(L);
381   for (n = 0; n < columns;) {
382      lua_pushstring(L, sqlite3_column_name(vm, n++));
383      lua_rawseti(L, -2, n);
384   }
385   return 1;
386386}
387387
388388static int dbvm_get_types(lua_State *L) {
389    sdb_vm *svm = lsqlite_checkvm(L, 1);
390    sqlite3_stmt *vm = svm->vm;
391    int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */
392    int n;
389   sdb_vm *svm = lsqlite_checkvm(L, 1);
390   sqlite3_stmt *vm = svm->vm;
391   int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */
392   int n;
393393
394    lua_newtable(L);
395    for (n = 0; n < columns;) {
396        lua_pushstring(L, sqlite3_column_decltype(vm, n++));
397        lua_rawseti(L, -2, n);
398    }
399    return 1;
394   lua_newtable(L);
395   for (n = 0; n < columns;) {
396      lua_pushstring(L, sqlite3_column_decltype(vm, n++));
397      lua_rawseti(L, -2, n);
398   }
399   return 1;
400400}
401401
402402static int dbvm_get_uvalues(lua_State *L) {
403    sdb_vm *svm = lsqlite_checkvm(L, 1);
404    sqlite3_stmt *vm = svm->vm;
405    int columns = svm->columns;
406    int n;
407    dbvm_check_contents(L, svm);
403   sdb_vm *svm = lsqlite_checkvm(L, 1);
404   sqlite3_stmt *vm = svm->vm;
405   int columns = svm->columns;
406   int n;
407   dbvm_check_contents(L, svm);
408408
409    lua_checkstack(L, columns);
410    for (n = 0; n < columns; ++n)
411        vm_push_column(L, vm, n);
412    return columns;
409   lua_checkstack(L, columns);
410   for (n = 0; n < columns; ++n)
411      vm_push_column(L, vm, n);
412   return columns;
413413}
414414
415415static int dbvm_get_unames(lua_State *L) {
416    sdb_vm *svm = lsqlite_checkvm(L, 1);
417    sqlite3_stmt *vm = svm->vm;
418    int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */
419    int n;
416   sdb_vm *svm = lsqlite_checkvm(L, 1);
417   sqlite3_stmt *vm = svm->vm;
418   int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */
419   int n;
420420
421    lua_checkstack(L, columns);
422    for (n = 0; n < columns; ++n)
423        lua_pushstring(L, sqlite3_column_name(vm, n));
424    return columns;
421   lua_checkstack(L, columns);
422   for (n = 0; n < columns; ++n)
423      lua_pushstring(L, sqlite3_column_name(vm, n));
424   return columns;
425425}
426426
427427static int dbvm_get_utypes(lua_State *L) {
428    sdb_vm *svm = lsqlite_checkvm(L, 1);
429    sqlite3_stmt *vm = svm->vm;
430    int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */
431    int n;
428   sdb_vm *svm = lsqlite_checkvm(L, 1);
429   sqlite3_stmt *vm = svm->vm;
430   int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */
431   int n;
432432
433    lua_checkstack(L, columns);
434    for (n = 0; n < columns; ++n)
435        lua_pushstring(L, sqlite3_column_decltype(vm, n));
436    return columns;
433   lua_checkstack(L, columns);
434   for (n = 0; n < columns; ++n)
435      lua_pushstring(L, sqlite3_column_decltype(vm, n));
436   return columns;
437437}
438438
439439static int dbvm_get_named_values(lua_State *L) {
440    sdb_vm *svm = lsqlite_checkvm(L, 1);
441    sqlite3_stmt *vm = svm->vm;
442    int columns = svm->columns;
443    int n;
444    dbvm_check_contents(L, svm);
440   sdb_vm *svm = lsqlite_checkvm(L, 1);
441   sqlite3_stmt *vm = svm->vm;
442   int columns = svm->columns;
443   int n;
444   dbvm_check_contents(L, svm);
445445
446    lua_newtable(L);
447    for (n = 0; n < columns; ++n) {
448        lua_pushstring(L, sqlite3_column_name(vm, n));
449        vm_push_column(L, vm, n);
450        lua_rawset(L, -3);
451    }
452    return 1;
446   lua_newtable(L);
447   for (n = 0; n < columns; ++n) {
448      lua_pushstring(L, sqlite3_column_name(vm, n));
449      vm_push_column(L, vm, n);
450      lua_rawset(L, -3);
451   }
452   return 1;
453453}
454454
455455static int dbvm_get_named_types(lua_State *L) {
456    sdb_vm *svm = lsqlite_checkvm(L, 1);
457    sqlite3_stmt *vm = svm->vm;
458    int columns = sqlite3_column_count(vm);
459    int n;
456   sdb_vm *svm = lsqlite_checkvm(L, 1);
457   sqlite3_stmt *vm = svm->vm;
458   int columns = sqlite3_column_count(vm);
459   int n;
460460
461    lua_newtable(L);
462    for (n = 0; n < columns; ++n) {
463        lua_pushstring(L, sqlite3_column_name(vm, n));
464        lua_pushstring(L, sqlite3_column_decltype(vm, n));
465        lua_rawset(L, -3);
466    }
467    return 1;
461   lua_newtable(L);
462   for (n = 0; n < columns; ++n) {
463      lua_pushstring(L, sqlite3_column_name(vm, n));
464      lua_pushstring(L, sqlite3_column_decltype(vm, n));
465      lua_rawset(L, -3);
466   }
467   return 1;
468468}
469469
470470/*
r31373r31374
474474*/
475475
476476static int dbvm_bind_index(lua_State *L, sqlite3_stmt *vm, int index, int lindex) {
477    switch (lua_type(L, lindex)) {
478        case LUA_TSTRING:
479            return sqlite3_bind_text(vm, index, lua_tostring(L, lindex), lua_strlen(L, lindex), SQLITE_TRANSIENT);
480        case LUA_TNUMBER:
481            return sqlite3_bind_double(vm, index, lua_tonumber(L, lindex));
482        case LUA_TBOOLEAN:
483            return sqlite3_bind_int(vm, index, lua_toboolean(L, lindex) ? 1 : 0);
484        case LUA_TNONE:
485        case LUA_TNIL:
486            return sqlite3_bind_null(vm, index);
487        default:
488            luaL_error(L, "index (%d) - invalid data type for bind (%s)", index, lua_typename(L, lua_type(L, lindex)));
489            return SQLITE_MISUSE; /*!*/
490    }
477   switch (lua_type(L, lindex)) {
478      case LUA_TSTRING:
479         return sqlite3_bind_text(vm, index, lua_tostring(L, lindex), lua_strlen(L, lindex), SQLITE_TRANSIENT);
480      case LUA_TNUMBER:
481         return sqlite3_bind_double(vm, index, lua_tonumber(L, lindex));
482      case LUA_TBOOLEAN:
483         return sqlite3_bind_int(vm, index, lua_toboolean(L, lindex) ? 1 : 0);
484      case LUA_TNONE:
485      case LUA_TNIL:
486         return sqlite3_bind_null(vm, index);
487      default:
488         luaL_error(L, "index (%d) - invalid data type for bind (%s)", index, lua_typename(L, lua_type(L, lindex)));
489         return SQLITE_MISUSE; /*!*/
490   }
491491}
492492
493493
494494static int dbvm_bind_parameter_count(lua_State *L) {
495    sdb_vm *svm = lsqlite_checkvm(L, 1);
496    lua_pushnumber(L, sqlite3_bind_parameter_count(svm->vm));
497    return 1;
495   sdb_vm *svm = lsqlite_checkvm(L, 1);
496   lua_pushnumber(L, sqlite3_bind_parameter_count(svm->vm));
497   return 1;
498498}
499499
500500static int dbvm_bind_parameter_name(lua_State *L) {
501    sdb_vm *svm = lsqlite_checkvm(L, 1);
502    int index = luaL_checknumber(L, 2);
503    dbvm_check_bind_index(L, svm, index);
504    lua_pushstring(L, sqlite3_bind_parameter_name(svm->vm, index));
505    return 1;
501   sdb_vm *svm = lsqlite_checkvm(L, 1);
502   int index = luaL_checknumber(L, 2);
503   dbvm_check_bind_index(L, svm, index);
504   lua_pushstring(L, sqlite3_bind_parameter_name(svm->vm, index));
505   return 1;
506506}
507507
508508static int dbvm_bind(lua_State *L) {
509    sdb_vm *svm = lsqlite_checkvm(L, 1);
510    sqlite3_stmt *vm = svm->vm;
511    int index = luaL_checkint(L, 2);
512    int result;
509   sdb_vm *svm = lsqlite_checkvm(L, 1);
510   sqlite3_stmt *vm = svm->vm;
511   int index = luaL_checkint(L, 2);
512   int result;
513513
514    dbvm_check_bind_index(L, svm, index);
515    result = dbvm_bind_index(L, vm, index, 3);
514   dbvm_check_bind_index(L, svm, index);
515   result = dbvm_bind_index(L, vm, index, 3);
516516
517    lua_pushnumber(L, result);
518    return 1;
517   lua_pushnumber(L, result);
518   return 1;
519519}
520520
521521static int dbvm_bind_blob(lua_State *L) {
522    sdb_vm *svm = lsqlite_checkvm(L, 1);
523    int index = luaL_checkint(L, 2);
524    const char *value = luaL_checkstring(L, 3);
525    int len = lua_strlen(L, 3);
522   sdb_vm *svm = lsqlite_checkvm(L, 1);
523   int index = luaL_checkint(L, 2);
524   const char *value = luaL_checkstring(L, 3);
525   int len = lua_strlen(L, 3);
526526
527    lua_pushnumber(L, sqlite3_bind_blob(svm->vm, index, value, len, SQLITE_TRANSIENT));
528    return 1;
527   lua_pushnumber(L, sqlite3_bind_blob(svm->vm, index, value, len, SQLITE_TRANSIENT));
528   return 1;
529529}
530530
531531static int dbvm_bind_values(lua_State *L) {
532    sdb_vm *svm = lsqlite_checkvm(L, 1);
533    sqlite3_stmt *vm = svm->vm;
534    int top = lua_gettop(L);
535    int result, n;
532   sdb_vm *svm = lsqlite_checkvm(L, 1);
533   sqlite3_stmt *vm = svm->vm;
534   int top = lua_gettop(L);
535   int result, n;
536536
537    if (top - 1 != sqlite3_bind_parameter_count(vm))
538        luaL_error(L,
539            "incorrect number of parameters to bind (%d given, %d to bind)",
540            top - 1,
541            sqlite3_bind_parameter_count(vm)
542        );
537   if (top - 1 != sqlite3_bind_parameter_count(vm))
538      luaL_error(L,
539         "incorrect number of parameters to bind (%d given, %d to bind)",
540         top - 1,
541         sqlite3_bind_parameter_count(vm)
542      );
543543
544    for (n = 2; n <= top; ++n) {
545        if ((result = dbvm_bind_index(L, vm, n - 1, n)) != SQLITE_OK) {
546            lua_pushnumber(L, result);
547            return 1;
548        }
549    }
544   for (n = 2; n <= top; ++n) {
545      if ((result = dbvm_bind_index(L, vm, n - 1, n)) != SQLITE_OK) {
546         lua_pushnumber(L, result);
547         return 1;
548      }
549   }
550550
551    lua_pushnumber(L, SQLITE_OK);
552    return 1;
551   lua_pushnumber(L, SQLITE_OK);
552   return 1;
553553}
554554
555555static int dbvm_bind_names(lua_State *L) {
556    sdb_vm *svm = lsqlite_checkvm(L, 1);
557    sqlite3_stmt *vm = svm->vm;
558    int count = sqlite3_bind_parameter_count(vm);
559    const char *name;
560    int result, n;
561    luaL_checktype(L, 2, LUA_TTABLE);
556   sdb_vm *svm = lsqlite_checkvm(L, 1);
557   sqlite3_stmt *vm = svm->vm;
558   int count = sqlite3_bind_parameter_count(vm);
559   const char *name;
560   int result, n;
561   luaL_checktype(L, 2, LUA_TTABLE);
562562
563    for (n = 1; n <= count; ++n) {
564        name = sqlite3_bind_parameter_name(vm, n);
565        if (name && (name[0] == ':' || name[0] == '$')) {
566            lua_pushstring(L, ++name);
567            lua_gettable(L, 2);
568            result = dbvm_bind_index(L, vm, n, -1);
569            lua_pop(L, 1);
570        }
571        else {
572            lua_pushnumber(L, n);
573            lua_gettable(L, 2);
574            result = dbvm_bind_index(L, vm, n, -1);
575            lua_pop(L, 1);
576        }
563   for (n = 1; n <= count; ++n) {
564      name = sqlite3_bind_parameter_name(vm, n);
565      if (name && (name[0] == ':' || name[0] == '$')) {
566         lua_pushstring(L, ++name);
567         lua_gettable(L, 2);
568         result = dbvm_bind_index(L, vm, n, -1);
569         lua_pop(L, 1);
570      }
571      else {
572         lua_pushnumber(L, n);
573         lua_gettable(L, 2);
574         result = dbvm_bind_index(L, vm, n, -1);
575         lua_pop(L, 1);
576      }
577577
578        if (result != SQLITE_OK) {
579            lua_pushnumber(L, result);
580            return 1;
581        }
582    }
578      if (result != SQLITE_OK) {
579         lua_pushnumber(L, result);
580         return 1;
581      }
582   }
583583
584    lua_pushnumber(L, SQLITE_OK);
585    return 1;
584   lua_pushnumber(L, SQLITE_OK);
585   return 1;
586586}
587587
588588/*
r31373r31374
599599** Creates a new 'table' and leaves it in the stack
600600*/
601601static sdb *newdb (lua_State *L) {
602    sdb *db = (sdb*)lua_newuserdata(L, sizeof(sdb));
603    db->L = L;
604    db->db = NULL;  /* database handle is currently `closed' */
605    db->func = NULL;
602   sdb *db = (sdb*)lua_newuserdata(L, sizeof(sdb));
603   db->L = L;
604   db->db = NULL;  /* database handle is currently `closed' */
605   db->func = NULL;
606606
607    db->busy_cb =
608    db->busy_udata =
609    db->progress_cb =
610    db->progress_udata =
611    db->trace_cb =
612    db->trace_udata =
607   db->busy_cb =
608   db->busy_udata =
609   db->progress_cb =
610   db->progress_udata =
611   db->trace_cb =
612   db->trace_udata =
613613#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK
614    db->update_hook_cb =
615    db->update_hook_udata =
616    db->commit_hook_cb =
617    db->commit_hook_udata =
618    db->rollback_hook_cb =
619    db->rollback_hook_udata =
614   db->update_hook_cb =
615   db->update_hook_udata =
616   db->commit_hook_cb =
617   db->commit_hook_udata =
618   db->rollback_hook_cb =
619   db->rollback_hook_udata =
620620#endif
621     LUA_NOREF;
621      LUA_NOREF;
622622
623    luaL_getmetatable(L, sqlite_meta);
624    lua_setmetatable(L, -2);        /* set metatable */
623   luaL_getmetatable(L, sqlite_meta);
624   lua_setmetatable(L, -2);        /* set metatable */
625625
626    /* to keep track of 'open' virtual machines */
627    lua_pushlightuserdata(L, db);
628    lua_newtable(L);
629    lua_rawset(L, LUA_REGISTRYINDEX);
626   /* to keep track of 'open' virtual machines */
627   lua_pushlightuserdata(L, db);
628   lua_newtable(L);
629   lua_rawset(L, LUA_REGISTRYINDEX);
630630
631    return db;
631   return db;
632632}
633633
634634static int cleanupdb(lua_State *L, sdb *db) {
635    sdb_func *func;
636    sdb_func *func_next;
637    int top;
638    int result;
635   sdb_func *func;
636   sdb_func *func_next;
637   int top;
638   int result;
639639
640    /* free associated virtual machines */
641    lua_pushlightuserdata(L, db);
642    lua_rawget(L, LUA_REGISTRYINDEX);
640   /* free associated virtual machines */
641   lua_pushlightuserdata(L, db);
642   lua_rawget(L, LUA_REGISTRYINDEX);
643643
644    /* close all used handles */
645    top = lua_gettop(L);
646    lua_pushnil(L);
647    while (lua_next(L, -2)) {
648        sdb_vm *svm = (sdb_vm *)lua_touserdata(L, -2); /* key: vm; val: sql text */
649        cleanupvm(L, svm);
644   /* close all used handles */
645   top = lua_gettop(L);
646   lua_pushnil(L);
647   while (lua_next(L, -2)) {
648      sdb_vm *svm = (sdb_vm *)lua_touserdata(L, -2); /* key: vm; val: sql text */
649      cleanupvm(L, svm);
650650
651        lua_settop(L, top);
652        lua_pushnil(L);
653    }
651      lua_settop(L, top);
652      lua_pushnil(L);
653   }
654654
655    lua_pop(L, 1); /* pop vm table */
655   lua_pop(L, 1); /* pop vm table */
656656
657    /* remove entry in lua registry table */
658    lua_pushlightuserdata(L, db);
659    lua_pushnil(L);
660    lua_rawset(L, LUA_REGISTRYINDEX);
657   /* remove entry in lua registry table */
658   lua_pushlightuserdata(L, db);
659   lua_pushnil(L);
660   lua_rawset(L, LUA_REGISTRYINDEX);
661661
662    /* 'free' all references */
663    luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb);
664    luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata);
665    luaL_unref(L, LUA_REGISTRYINDEX, db->progress_cb);
666    luaL_unref(L, LUA_REGISTRYINDEX, db->progress_udata);
667    luaL_unref(L, LUA_REGISTRYINDEX, db->trace_cb);
668    luaL_unref(L, LUA_REGISTRYINDEX, db->trace_udata);
662   /* 'free' all references */
663   luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb);
664   luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata);
665   luaL_unref(L, LUA_REGISTRYINDEX, db->progress_cb);
666   luaL_unref(L, LUA_REGISTRYINDEX, db->progress_udata);
667   luaL_unref(L, LUA_REGISTRYINDEX, db->trace_cb);
668   luaL_unref(L, LUA_REGISTRYINDEX, db->trace_udata);
669669#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK
670    luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_cb);
671    luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_udata);
672    luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_cb);
673    luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_udata);
674    luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_cb);
675    luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_udata);
670   luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_cb);
671   luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_udata);
672   luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_cb);
673   luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_udata);
674   luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_cb);
675   luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_udata);
676676#endif
677677
678    /* close database */
679    result = sqlite3_close(db->db);
680    db->db = NULL;
678   /* close database */
679   result = sqlite3_close(db->db);
680   db->db = NULL;
681681
682    /* free associated memory with created functions */
683    func = db->func;
684    while (func) {
685        func_next = func->next;
686        luaL_unref(L, LUA_REGISTRYINDEX, func->fn_step);
687        luaL_unref(L, LUA_REGISTRYINDEX, func->fn_finalize);
688        luaL_unref(L, LUA_REGISTRYINDEX, func->udata);
689        free(func);
690        func = func_next;
691    }
692    db->func = NULL;
693    return result;
682   /* free associated memory with created functions */
683   func = db->func;
684   while (func) {
685      func_next = func->next;
686      luaL_unref(L, LUA_REGISTRYINDEX, func->fn_step);
687      luaL_unref(L, LUA_REGISTRYINDEX, func->fn_finalize);
688      luaL_unref(L, LUA_REGISTRYINDEX, func->udata);
689      free(func);
690      func = func_next;
691   }
692   db->func = NULL;
693   return result;
694694}
695695
696696static sdb *lsqlite_getdb(lua_State *L, int index) {
697    sdb *db = (sdb*)luaL_checkudata(L, index, sqlite_meta);
698    if (db == NULL) luaL_typerror(L, index, "sqlite database");
699    return db;
697   sdb *db = (sdb*)luaL_checkudata(L, index, sqlite_meta);
698   if (db == NULL) luaL_typerror(L, index, "sqlite database");
699   return db;
700700}
701701
702702static sdb *lsqlite_checkdb(lua_State *L, int index) {
703    sdb *db = lsqlite_getdb(L, index);
704    if (db->db == NULL) luaL_argerror(L, index, "attempt to use closed sqlite database");
705    return db;
703   sdb *db = lsqlite_getdb(L, index);
704   if (db->db == NULL) luaL_argerror(L, index, "attempt to use closed sqlite database");
705   return db;
706706}
707707
708708
r31373r31374
712712** =======================================================
713713*/
714714typedef struct {
715    sqlite3_context *ctx;
716    int ud;
715   sqlite3_context *ctx;
716   int ud;
717717} lcontext;
718718
719719static lcontext *lsqlite_make_context(lua_State *L) {
720    lcontext *ctx = (lcontext*)lua_newuserdata(L, sizeof(lcontext));
721    lua_rawgeti(L, LUA_REGISTRYINDEX, sqlite_ctx_meta_ref);
722    lua_setmetatable(L, -2);
723    ctx->ctx = NULL;
724    ctx->ud = LUA_NOREF;
725    return ctx;
720   lcontext *ctx = (lcontext*)lua_newuserdata(L, sizeof(lcontext));
721   lua_rawgeti(L, LUA_REGISTRYINDEX, sqlite_ctx_meta_ref);
722   lua_setmetatable(L, -2);
723   ctx->ctx = NULL;
724   ctx->ud = LUA_NOREF;
725   return ctx;
726726}
727727
728728static lcontext *lsqlite_getcontext(lua_State *L, int index) {
729    lcontext *ctx = (lcontext*)luaL_checkudata(L, index, sqlite_ctx_meta);
730    if (ctx == NULL) luaL_typerror(L, index, "sqlite context");
731    return ctx;
729   lcontext *ctx = (lcontext*)luaL_checkudata(L, index, sqlite_ctx_meta);
730   if (ctx == NULL) luaL_typerror(L, index, "sqlite context");
731   return ctx;
732732}
733733
734734static lcontext *lsqlite_checkcontext(lua_State *L, int index) {
735    lcontext *ctx = lsqlite_getcontext(L, index);
736    if (ctx->ctx == NULL) luaL_argerror(L, index, "invalid sqlite context");
737    return ctx;
735   lcontext *ctx = lsqlite_getcontext(L, index);
736   if (ctx->ctx == NULL) luaL_argerror(L, index, "invalid sqlite context");
737   return ctx;
738738}
739739
740740static int lcontext_tostring(lua_State *L) {
741    char buff[39];
742    lcontext *ctx = lsqlite_getcontext(L, 1);
743    if (ctx->ctx == NULL)
744        strcpy(buff, "closed");
745    else
746        sprintf(buff, "%p", ctx->ctx);
747    lua_pushfstring(L, "sqlite function context (%s)", buff);
748    return 1;
741   char buff[39];
742   lcontext *ctx = lsqlite_getcontext(L, 1);
743   if (ctx->ctx == NULL)
744      strcpy(buff, "closed");
745   else
746      sprintf(buff, "%p", ctx->ctx);
747   lua_pushfstring(L, "sqlite function context (%s)", buff);
748   return 1;
749749}
750750
751751static void lcontext_check_aggregate(lua_State *L, lcontext *ctx) {
752    sdb_func *func = (sdb_func*)sqlite3_user_data(ctx->ctx);
753    if (!func->aggregate) {
754        luaL_error(L, "attempt to call aggregate method from scalar function");
755    }
752   sdb_func *func = (sdb_func*)sqlite3_user_data(ctx->ctx);
753   if (!func->aggregate) {
754      luaL_error(L, "attempt to call aggregate method from scalar function");
755   }
756756}
757757
758758static int lcontext_user_data(lua_State *L) {
759    lcontext *ctx = lsqlite_checkcontext(L, 1);
760    sdb_func *func = (sdb_func*)sqlite3_user_data(ctx->ctx);
761    lua_rawgeti(L, LUA_REGISTRYINDEX, func->udata);
762    return 1;
759   lcontext *ctx = lsqlite_checkcontext(L, 1);
760   sdb_func *func = (sdb_func*)sqlite3_user_data(ctx->ctx);
761   lua_rawgeti(L, LUA_REGISTRYINDEX, func->udata);
762   return 1;
763763}
764764
765765static int lcontext_get_aggregate_context(lua_State *L) {
766    lcontext *ctx = lsqlite_checkcontext(L, 1);
767    lcontext_check_aggregate(L, ctx);
768    lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->ud);
769    return 1;
766   lcontext *ctx = lsqlite_checkcontext(L, 1);
767   lcontext_check_aggregate(L, ctx);
768   lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->ud);
769   return 1;
770770}
771771
772772static int lcontext_set_aggregate_context(lua_State *L) {
773    lcontext *ctx = lsqlite_checkcontext(L, 1);
774    lcontext_check_aggregate(L, ctx);
775    lua_settop(L, 2);
776    luaL_unref(L, LUA_REGISTRYINDEX, ctx->ud);
777    ctx->ud = luaL_ref(L, LUA_REGISTRYINDEX);
778    return 0;
773   lcontext *ctx = lsqlite_checkcontext(L, 1);
774   lcontext_check_aggregate(L, ctx);
775   lua_settop(L, 2);
776   luaL_unref(L, LUA_REGISTRYINDEX, ctx->ud);
777   ctx->ud = luaL_ref(L, LUA_REGISTRYINDEX);
778   return 0;
779779}
780780
781781static int lcontext_aggregate_count(lua_State *L) {
782    lcontext *ctx = lsqlite_checkcontext(L, 1);
783    lcontext_check_aggregate(L, ctx);
784    lua_pushnumber(L, sqlite3_aggregate_count(ctx->ctx));
785    return 1;
782   lcontext *ctx = lsqlite_checkcontext(L, 1);
783   lcontext_check_aggregate(L, ctx);
784   lua_pushnumber(L, sqlite3_aggregate_count(ctx->ctx));
785   return 1;
786786}
787787
788788#if 0
r31373r31374
791791#endif
792792
793793static int lcontext_result(lua_State *L) {
794    lcontext *ctx = lsqlite_checkcontext(L, 1);
795    switch (lua_type(L, 2)) {
796        case LUA_TNUMBER:
797            sqlite3_result_double(ctx->ctx, luaL_checknumber(L, 2));
798            break;
799        case LUA_TSTRING:
800            sqlite3_result_text(ctx->ctx, luaL_checkstring(L, 2), lua_strlen(L, 2), SQLITE_TRANSIENT);
801            break;
802        case LUA_TNIL:
803        case LUA_TNONE:
804            sqlite3_result_null(ctx->ctx);
805            break;
806        default:
807            luaL_error(L, "invalid result type %s", lua_typename(L, 2));
808            break;
809    }
794   lcontext *ctx = lsqlite_checkcontext(L, 1);
795   switch (lua_type(L, 2)) {
796      case LUA_TNUMBER:
797         sqlite3_result_double(ctx->ctx, luaL_checknumber(L, 2));
798         break;
799      case LUA_TSTRING:
800         sqlite3_result_text(ctx->ctx, luaL_checkstring(L, 2), lua_strlen(L, 2), SQLITE_TRANSIENT);
801         break;
802      case LUA_TNIL:
803      case LUA_TNONE:
804         sqlite3_result_null(ctx->ctx);
805         break;
806      default:
807         luaL_error(L, "invalid result type %s", lua_typename(L, 2));
808         break;
809   }
810810
811    return 0;
811   return 0;
812812}
813813
814814static int lcontext_result_blob(lua_State *L) {
815    lcontext *ctx = lsqlite_checkcontext(L, 1);
816    const char *blob = luaL_checkstring(L, 2);
817    int size = lua_strlen(L, 2);
818    sqlite3_result_blob(ctx->ctx, (const void*)blob, size, SQLITE_TRANSIENT);
819    return 0;
815   lcontext *ctx = lsqlite_checkcontext(L, 1);
816   const char *blob = luaL_checkstring(L, 2);
817   int size = lua_strlen(L, 2);
818   sqlite3_result_blob(ctx->ctx, (const void*)blob, size, SQLITE_TRANSIENT);
819   return 0;
820820}
821821
822822static int lcontext_result_double(lua_State *L) {
823    lcontext *ctx = lsqlite_checkcontext(L, 1);
824    double d = luaL_checknumber(L, 2);
825    sqlite3_result_double(ctx->ctx, d);
826    return 0;
823   lcontext *ctx = lsqlite_checkcontext(L, 1);
824   double d = luaL_checknumber(L, 2);
825   sqlite3_result_double(ctx->ctx, d);
826   return 0;
827827}
828828
829829static int lcontext_result_error(lua_State *L) {
830    lcontext *ctx = lsqlite_checkcontext(L, 1);
831    const char *err = luaL_checkstring(L, 2);
832    int size = lua_strlen(L, 2);
833    sqlite3_result_error(ctx->ctx, err, size);
834    return 0;
830   lcontext *ctx = lsqlite_checkcontext(L, 1);
831   const char *err = luaL_checkstring(L, 2);
832   int size = lua_strlen(L, 2);
833   sqlite3_result_error(ctx->ctx, err, size);
834   return 0;
835835}
836836
837837static int lcontext_result_int(lua_State *L) {
838    lcontext *ctx = lsqlite_checkcontext(L, 1);
839    int i = luaL_checkint(L, 2);
840    sqlite3_result_int(ctx->ctx, i);
841    return 0;
838   lcontext *ctx = lsqlite_checkcontext(L, 1);
839   int i = luaL_checkint(L, 2);
840   sqlite3_result_int(ctx->ctx, i);
841   return 0;
842842}
843843
844844static int lcontext_result_null(lua_State *L) {
845    lcontext *ctx = lsqlite_checkcontext(L, 1);
846    sqlite3_result_null(ctx->ctx);
847    return 0;
845   lcontext *ctx = lsqlite_checkcontext(L, 1);
846   sqlite3_result_null(ctx->ctx);
847   return 0;
848848}
849849
850850static int lcontext_result_text(lua_State *L) {
851    lcontext *ctx = lsqlite_checkcontext(L, 1);
852    const char *text = luaL_checkstring(L, 2);
853    int size = lua_strlen(L, 2);
854    sqlite3_result_text(ctx->ctx, text, size, SQLITE_TRANSIENT);
855    return 0;
851   lcontext *ctx = lsqlite_checkcontext(L, 1);
852   const char *text = luaL_checkstring(L, 2);
853   int size = lua_strlen(L, 2);
854   sqlite3_result_text(ctx->ctx, text, size, SQLITE_TRANSIENT);
855   return 0;
856856}
857857
858858/*
r31373r31374
862862*/
863863
864864static int db_isopen(lua_State *L) {
865    sdb *db = lsqlite_getdb(L, 1);
866    lua_pushboolean(L, db->db != NULL ? 1 : 0);
867    return 1;
865   sdb *db = lsqlite_getdb(L, 1);
866   lua_pushboolean(L, db->db != NULL ? 1 : 0);
867   return 1;
868868}
869869
870870static int db_last_insert_rowid(lua_State *L) {
871    sdb *db = lsqlite_checkdb(L, 1);
872    /* conversion warning: int64 -> luaNumber */
873    sqlite_int64 rowid = sqlite3_last_insert_rowid(db->db);
874    lua_Number n = (lua_Number)rowid;
875    if (n == rowid)
876        lua_pushnumber(L, n);
877    else
878        lua_pushfstring(L, "%ll", rowid);
879    return 1;
871   sdb *db = lsqlite_checkdb(L, 1);
872   /* conversion warning: int64 -> luaNumber */
873   sqlite_int64 rowid = sqlite3_last_insert_rowid(db->db);
874   lua_Number n = (lua_Number)rowid;
875   if (n == rowid)
876      lua_pushnumber(L, n);
877   else
878      lua_pushfstring(L, "%ll", rowid);
879   return 1;
880880}
881881
882882static int db_changes(lua_State *L) {
883    sdb *db = lsqlite_checkdb(L, 1);
884    lua_pushnumber(L, sqlite3_changes(db->db));
885    return 1;
883   sdb *db = lsqlite_checkdb(L, 1);
884   lua_pushnumber(L, sqlite3_changes(db->db));
885   return 1;
886886}
887887
888888static int db_total_changes(lua_State *L) {
889    sdb *db = lsqlite_checkdb(L, 1);
890    lua_pushnumber(L, sqlite3_total_changes(db->db));
891    return 1;
889   sdb *db = lsqlite_checkdb(L, 1);
890   lua_pushnumber(L, sqlite3_total_changes(db->db));
891   return 1;
892892}
893893
894894static int db_errcode(lua_State *L) {
895    sdb *db = lsqlite_checkdb(L, 1);
896    lua_pushnumber(L, sqlite3_errcode(db->db));
897    return 1;
895   sdb *db = lsqlite_checkdb(L, 1);
896   lua_pushnumber(L, sqlite3_errcode(db->db));
897   return 1;
898898}
899899
900900static int db_errmsg(lua_State *L) {
901    sdb *db = lsqlite_checkdb(L, 1);
902    lua_pushstring(L, sqlite3_errmsg(db->db));
903    return 1;
901   sdb *db = lsqlite_checkdb(L, 1);
902   lua_pushstring(L, sqlite3_errmsg(db->db));
903   return 1;
904904}
905905
906906static int db_interrupt(lua_State *L) {
907    sdb *db = lsqlite_checkdb(L, 1);
908    sqlite3_interrupt(db->db);
909    return 0;
907   sdb *db = lsqlite_checkdb(L, 1);
908   sqlite3_interrupt(db->db);
909   return 0;
910910}
911911
912912/*
r31373r31374
914914*/
915915
916916static void db_push_value(lua_State *L, sqlite3_value *value) {
917    switch (sqlite3_value_type(value)) {
918        case SQLITE_TEXT:
919            lua_pushlstring(L, (const char*)sqlite3_value_text(value), sqlite3_value_bytes(value));
920            break;
917   switch (sqlite3_value_type(value)) {
918      case SQLITE_TEXT:
919         lua_pushlstring(L, (const char*)sqlite3_value_text(value), sqlite3_value_bytes(value));
920         break;
921921
922        case SQLITE_INTEGER:
923            {
924                sqlite_int64 i64 = sqlite3_value_int64(value);
925                lua_Number n = (lua_Number)i64;
926                if (n == i64)
927                    lua_pushnumber(L, n);
928                else
929                    lua_pushlstring(L, (const char*)sqlite3_value_text(value), sqlite3_value_bytes(value));
930            }
931            break;
922      case SQLITE_INTEGER:
923         {
924            sqlite_int64 i64 = sqlite3_value_int64(value);
925            lua_Number n = (lua_Number)i64;
926            if (n == i64)
927               lua_pushnumber(L, n);
928            else
929               lua_pushlstring(L, (const char*)sqlite3_value_text(value), sqlite3_value_bytes(value));
930         }
931         break;
932932
933        case SQLITE_FLOAT:
934            lua_pushnumber(L, sqlite3_value_double(value));
935            break;
933      case SQLITE_FLOAT:
934         lua_pushnumber(L, sqlite3_value_double(value));
935         break;
936936
937        case SQLITE_BLOB:
938            lua_pushlstring(L, (const char*)sqlite3_value_blob(value), sqlite3_value_bytes(value));
939            break;
937      case SQLITE_BLOB:
938         lua_pushlstring(L, (const char*)sqlite3_value_blob(value), sqlite3_value_bytes(value));
939         break;
940940
941        case SQLITE_NULL:
942            lua_pushnil(L);
943            break;
941      case SQLITE_NULL:
942         lua_pushnil(L);
943         break;
944944
945        default:
946            /* things done properly (SQLite + Lua SQLite)
947            ** this should never happen */
948            lua_pushnil(L);
949            break;
950    }
945      default:
946         /* things done properly (SQLite + Lua SQLite)
947         ** this should never happen */
948         lua_pushnil(L);
949         break;
950   }
951951}
952952
953953/*
r31373r31374
957957/* scalar function to be called
958958** callback params: context, values... */
959959static void db_sql_normal_function(sqlite3_context *context, int argc, sqlite3_value **argv) {
960    sdb_func *func = (sdb_func*)sqlite3_user_data(context);
961    lua_State *L = func->db->L;
962    int n;
963    lcontext *ctx;
960   sdb_func *func = (sdb_func*)sqlite3_user_data(context);
961   lua_State *L = func->db->L;
962   int n;
963   lcontext *ctx;
964964
965    int top = lua_gettop(L);
965   int top = lua_gettop(L);
966966
967    /* ensure there is enough space in the stack */
968    lua_checkstack(L, argc + 3);
967   /* ensure there is enough space in the stack */
968   lua_checkstack(L, argc + 3);
969969
970    lua_rawgeti(L, LUA_REGISTRYINDEX, func->fn_step);   /* function to call */
970   lua_rawgeti(L, LUA_REGISTRYINDEX, func->fn_step);   /* function to call */
971971
972    if (!func->aggregate) {
973        ctx = lsqlite_make_context(L); /* push context - used to set results */
974    }
975    else {
976        /* reuse context userdata value */
977        void *p = sqlite3_aggregate_context(context, 1);
978        /* i think it is OK to use assume that using a light user data
979        ** as an entry on LUA REGISTRY table will be unique */
980        lua_pushlightuserdata(L, p);
981        lua_rawget(L, LUA_REGISTRYINDEX);       /* context table */
972   if (!func->aggregate) {
973      ctx = lsqlite_make_context(L); /* push context - used to set results */
974   }
975   else {
976      /* reuse context userdata value */
977      void *p = sqlite3_aggregate_context(context, 1);
978      /* i think it is OK to use assume that using a light user data
979      ** as an entry on LUA REGISTRY table will be unique */
980      lua_pushlightuserdata(L, p);
981      lua_rawget(L, LUA_REGISTRYINDEX);       /* context table */
982982
983        if (lua_isnil(L, -1)) { /* not yet created? */
984            lua_pop(L, 1);
985            ctx = lsqlite_make_context(L);
986            lua_pushlightuserdata(L, p);
987            lua_pushvalue(L, -2);
988            lua_rawset(L, LUA_REGISTRYINDEX);
989        }
990        else
991            ctx = lsqlite_getcontext(L, -1);
992    }
983      if (lua_isnil(L, -1)) { /* not yet created? */
984         lua_pop(L, 1);
985         ctx = lsqlite_make_context(L);
986         lua_pushlightuserdata(L, p);
987         lua_pushvalue(L, -2);
988         lua_rawset(L, LUA_REGISTRYINDEX);
989      }
990      else
991         ctx = lsqlite_getcontext(L, -1);
992   }
993993
994    /* push params */
995    for (n = 0; n < argc; ++n) {
996        db_push_value(L, argv[n]);
997    }
994   /* push params */
995   for (n = 0; n < argc; ++n) {
996      db_push_value(L, argv[n]);
997   }
998998
999    /* set context */
1000    ctx->ctx = context;
999   /* set context */
1000   ctx->ctx = context;
10011001
1002    if (lua_pcall(L, argc + 1, 0, 0)) {
1003        const char *errmsg = lua_tostring(L, -1);
1004        int size = lua_strlen(L, -1);
1005        sqlite3_result_error(context, errmsg, size);
1006    }
1002   if (lua_pcall(L, argc + 1, 0, 0)) {
1003      const char *errmsg = lua_tostring(L, -1);
1004      int size = lua_strlen(L, -1);
1005      sqlite3_result_error(context, errmsg, size);
1006   }
10071007
1008    /* invalidate context */
1009    ctx->ctx = NULL;
1008   /* invalidate context */
1009   ctx->ctx = NULL;
10101010
1011    if (!func->aggregate) {
1012        luaL_unref(L, LUA_REGISTRYINDEX, ctx->ud);
1013    }
1011   if (!func->aggregate) {
1012      luaL_unref(L, LUA_REGISTRYINDEX, ctx->ud);
1013   }
10141014
1015    lua_settop(L, top);
1015   lua_settop(L, top);
10161016}
10171017
10181018static void db_sql_finalize_function(sqlite3_context *context) {
1019    sdb_func *func = (sdb_func*)sqlite3_user_data(context);
1020    lua_State *L = func->db->L;
1021    void *p = sqlite3_aggregate_context(context, 1); /* minimal mem usage */
1022    lcontext *ctx;
1023    int top = lua_gettop(L);
1019   sdb_func *func = (sdb_func*)sqlite3_user_data(context);
1020   lua_State *L = func->db->L;
1021   void *p = sqlite3_aggregate_context(context, 1); /* minimal mem usage */
1022   lcontext *ctx;
1023   int top = lua_gettop(L);
10241024
1025    lua_rawgeti(L, LUA_REGISTRYINDEX, func->fn_finalize);   /* function to call */
1025   lua_rawgeti(L, LUA_REGISTRYINDEX, func->fn_finalize);   /* function to call */
10261026
1027    /* i think it is OK to use assume that using a light user data
1028    ** as an entry on LUA REGISTRY table will be unique */
1029    lua_pushlightuserdata(L, p);
1030    lua_rawget(L, LUA_REGISTRYINDEX);       /* context table */
1027   /* i think it is OK to use assume that using a light user data
1028   ** as an entry on LUA REGISTRY table will be unique */
1029   lua_pushlightuserdata(L, p);
1030   lua_rawget(L, LUA_REGISTRYINDEX);       /* context table */
10311031
1032    if (lua_isnil(L, -1)) { /* not yet created? - shouldn't happen in finalize function */
1033        lua_pop(L, 1);
1034        ctx = lsqlite_make_context(L);
1035        lua_pushlightuserdata(L, p);
1036        lua_pushvalue(L, -2);
1037        lua_rawset(L, LUA_REGISTRYINDEX);
1038    }
1039    else
1040        ctx = lsqlite_getcontext(L, -1);
1032   if (lua_isnil(L, -1)) { /* not yet created? - shouldn't happen in finalize function */
1033      lua_pop(L, 1);
1034      ctx = lsqlite_make_context(L);
1035      lua_pushlightuserdata(L, p);
1036      lua_pushvalue(L, -2);
1037      lua_rawset(L, LUA_REGISTRYINDEX);
1038   }
1039   else
1040      ctx = lsqlite_getcontext(L, -1);
10411041
1042    /* set context */
1043    ctx->ctx = context;
1042   /* set context */
1043   ctx->ctx = context;
10441044
1045    if (lua_pcall(L, 1, 0, 0)) {
1046        sqlite3_result_error(context, lua_tostring(L, -1), -1);
1047    }
1045   if (lua_pcall(L, 1, 0, 0)) {
1046      sqlite3_result_error(context, lua_tostring(L, -1), -1);
1047   }
10481048
1049    /* invalidate context */
1050    ctx->ctx = NULL;
1049   /* invalidate context */
1050   ctx->ctx = NULL;
10511051
1052    /* cleanup context */
1053    luaL_unref(L, LUA_REGISTRYINDEX, ctx->ud);
1054    /* remove it from registry */
1055    lua_pushlightuserdata(L, p);
1056    lua_pushnil(L);
1057    lua_rawset(L, LUA_REGISTRYINDEX);
1052   /* cleanup context */
1053   luaL_unref(L, LUA_REGISTRYINDEX, ctx->ud);
1054   /* remove it from registry */
1055   lua_pushlightuserdata(L, p);
1056   lua_pushnil(L);
1057   lua_rawset(L, LUA_REGISTRYINDEX);
10581058
1059    lua_settop(L, top);
1059   lua_settop(L, top);
10601060}
10611061
10621062/*
r31373r31374
10721072** Params of finalize: context
10731073*/
10741074static int db_register_function(lua_State *L, int aggregate) {
1075    sdb *db = lsqlite_checkdb(L, 1);
1076    const char *name;
1077    int args;
1078    int result;
1079    sdb_func *func;
1075   sdb *db = lsqlite_checkdb(L, 1);
1076   const char *name;
1077   int args;
1078   int result;
1079   sdb_func *func;
10801080
1081    /* safety measure */
1082    if (aggregate) aggregate = 1;
1081   /* safety measure */
1082   if (aggregate) aggregate = 1;
10831083
1084    name = luaL_checkstring(L, 2);
1085    args = luaL_checkint(L, 3);
1086    luaL_checktype(L, 4, LUA_TFUNCTION);
1087    if (aggregate) luaL_checktype(L, 5, LUA_TFUNCTION);
1084   name = luaL_checkstring(L, 2);
1085   args = luaL_checkint(L, 3);
1086   luaL_checktype(L, 4, LUA_TFUNCTION);
1087   if (aggregate) luaL_checktype(L, 5, LUA_TFUNCTION);
10881088
1089    /* maybe an alternative way to allocate memory should be used/avoided */
1090    func = (sdb_func*)malloc(sizeof(sdb_func));
1091    if (func == NULL) {
1092        luaL_error(L, "out of memory");
1093    }
1089   /* maybe an alternative way to allocate memory should be used/avoided */
1090   func = (sdb_func*)malloc(sizeof(sdb_func));
1091   if (func == NULL) {
1092      luaL_error(L, "out of memory");
1093   }
10941094
1095    result = sqlite3_create_function(
1096        db->db, name, args, SQLITE_UTF8, func,
1097        aggregate ? NULL : db_sql_normal_function,
1098        aggregate ? db_sql_normal_function : NULL,
1099        aggregate ? db_sql_finalize_function : NULL
1100    );
1095   result = sqlite3_create_function(
1096      db->db, name, args, SQLITE_UTF8, func,
1097      aggregate ? NULL : db_sql_normal_function,
1098      aggregate ? db_sql_normal_function : NULL,
1099      aggregate ? db_sql_finalize_function : NULL
1100   );
11011101
1102    if (result == SQLITE_OK) {
1103        /* safety measures for userdata field to be present in the stack */
1104        lua_settop(L, 5 + aggregate);
1102   if (result == SQLITE_OK) {
1103      /* safety measures for userdata field to be present in the stack */
1104      lua_settop(L, 5 + aggregate);
11051105
1106        /* save registered function in db function list */
1107        func->db = db;
1108        func->aggregate = aggregate;
1109        func->next = db->func;
1110        db->func = func;
1106      /* save registered function in db function list */
1107      func->db = db;
1108      func->aggregate = aggregate;
1109      func->next = db->func;
1110      db->func = func;
11111111
1112        /* save the setp/normal function callback */
1113        lua_pushvalue(L, 4);
1114        func->fn_step = luaL_ref(L, LUA_REGISTRYINDEX);
1115        /* save user data */
1116        lua_pushvalue(L, 5+aggregate);
1117        func->udata = luaL_ref(L, LUA_REGISTRYINDEX);
1112      /* save the setp/normal function callback */
1113      lua_pushvalue(L, 4);
1114      func->fn_step = luaL_ref(L, LUA_REGISTRYINDEX);
1115      /* save user data */
1116      lua_pushvalue(L, 5+aggregate);
1117      func->udata = luaL_ref(L, LUA_REGISTRYINDEX);
11181118
1119        if (aggregate) {
1120            lua_pushvalue(L, 5);
1121            func->fn_finalize = luaL_ref(L, LUA_REGISTRYINDEX);
1122        }
1123        else
1124            func->fn_finalize = LUA_NOREF;
1125    }
1126    else {
1127        /* free allocated memory */
1128        free(func);
1129    }
1119      if (aggregate) {
1120         lua_pushvalue(L, 5);
1121         func->fn_finalize = luaL_ref(L, LUA_REGISTRYINDEX);
1122      }
1123      else
1124         func->fn_finalize = LUA_NOREF;
1125   }
1126   else {
1127      /* free allocated memory */
1128      free(func);
1129   }
11301130
1131    lua_pushboolean(L, result == SQLITE_OK ? 1 : 0);
1132    return 1;
1131   lua_pushboolean(L, result == SQLITE_OK ? 1 : 0);
1132   return 1;
11331133}
11341134
11351135static int db_create_function(lua_State *L) {
1136    return db_register_function(L, 0);
1136   return db_register_function(L, 0);
11371137}
11381138
11391139static int db_create_aggregate(lua_State *L) {
1140    return db_register_function(L, 1);
1140   return db_register_function(L, 1);
11411141}
11421142
11431143/* create_collation; contributed by Thomas Lauer
11441144*/
11451145
11461146typedef struct {
1147    lua_State *L;
1148    int ref;
1147   lua_State *L;
1148   int ref;
11491149} scc;
11501150
11511151static int collwrapper(scc *co,int l1,const void *p1,
1152                        int l2,const void *p2) {
1153    int res=0;
1154    lua_State *L=co->L;
1155    lua_rawgeti(L,LUA_REGISTRYINDEX,co->ref);
1156    lua_pushlstring(L,(const char*)p1,l1);
1157    lua_pushlstring(L,(const char*)p2,l2);
1158    if (lua_pcall(L,2,1,0)==0) res=lua_tonumber(L,-1);
1159    lua_pop(L,1);
1160    return res;
1152                  int l2,const void *p2) {
1153   int res=0;
1154   lua_State *L=co->L;
1155   lua_rawgeti(L,LUA_REGISTRYINDEX,co->ref);
1156   lua_pushlstring(L,(const char*)p1,l1);
1157   lua_pushlstring(L,(const char*)p2,l2);
1158   if (lua_pcall(L,2,1,0)==0) res=lua_tonumber(L,-1);
1159   lua_pop(L,1);
1160   return res;
11611161}
11621162
11631163static void collfree(scc *co) {
1164    if (co) {
1165        luaL_unref(co->L,LUA_REGISTRYINDEX,co->ref);
1166        free(co);
1167    }
1164   if (co) {
1165      luaL_unref(co->L,LUA_REGISTRYINDEX,co->ref);
1166      free(co);
1167   }
11681168}
11691169
11701170static int db_create_collation(lua_State *L) {
1171    sdb *db=lsqlite_checkdb(L,1);
1172    const char *collname=luaL_checkstring(L,2);
1173    scc *co=NULL;
1174    int (*collfunc)(scc *,int,const void *,int,const void *)=NULL;
1175    lua_settop(L,3); /* default args to nil, and exclude extras */
1176    if (lua_isfunction(L,3)) collfunc=collwrapper;
1177    else if (!lua_isnil(L,3))
1178        luaL_error(L,"create_collation: function or nil expected");
1179    if (collfunc != NULL) {
1180        co=(scc *)malloc(sizeof(scc)); /* userdata is a no-no as it
1171   sdb *db=lsqlite_checkdb(L,1);
1172   const char *collname=luaL_checkstring(L,2);
1173   scc *co=NULL;
1174   int (*collfunc)(scc *,int,const void *,int,const void *)=NULL;
1175   lua_settop(L,3); /* default args to nil, and exclude extras */
1176   if (lua_isfunction(L,3)) collfunc=collwrapper;
1177   else if (!lua_isnil(L,3))
1178      luaL_error(L,"create_collation: function or nil expected");
1179   if (collfunc != NULL) {
1180      co=(scc *)malloc(sizeof(scc)); /* userdata is a no-no as it
11811181                                          will be garbage-collected */
1182        if (co) {
1183            co->L=L;
1184            /* lua_settop(L,3) above means we don't need: lua_pushvalue(L,3); */
1185            co->ref=luaL_ref(L,LUA_REGISTRYINDEX);
1186        }
1187        else luaL_error(L,"create_collation: could not allocate callback");
1188    }
1189    sqlite3_create_collation_v2(db->db, collname, SQLITE_UTF8,
1190        (void *)co,
1191        (int(*)(void*,int,const void*,int,const void*))collfunc,
1192        (void(*)(void*))collfree);
1193    return 0;
1182      if (co) {
1183         co->L=L;
1184         /* lua_settop(L,3) above means we don't need: lua_pushvalue(L,3); */
1185         co->ref=luaL_ref(L,LUA_REGISTRYINDEX);
1186      }
1187      else luaL_error(L,"create_collation: could not allocate callback");
1188   }
1189   sqlite3_create_collation_v2(db->db, collname, SQLITE_UTF8,
1190      (void *)co,
1191      (int(*)(void*,int,const void*,int,const void*))collfunc,
1192      (void(*)(void*))collfree);
1193   return 0;
11941194}
11951195
11961196/*
r31373r31374
12011201** Params: userdata, sql
12021202*/
12031203static void db_trace_callback(void *user, const char *sql) {
1204    sdb *db = (sdb*)user;
1205    lua_State *L = db->L;
1206    int top = lua_gettop(L);
1204   sdb *db = (sdb*)user;
1205   lua_State *L = db->L;
1206   int top = lua_gettop(L);
12071207
1208    /* setup lua callback call */
1209    lua_rawgeti(L, LUA_REGISTRYINDEX, db->trace_cb);    /* get callback */
1210    lua_rawgeti(L, LUA_REGISTRYINDEX, db->trace_udata); /* get callback user data */
1211    lua_pushstring(L, sql); /* traced sql statement */
1208   /* setup lua callback call */
1209   lua_rawgeti(L, LUA_REGISTRYINDEX, db->trace_cb);    /* get callback */
1210   lua_rawgeti(L, LUA_REGISTRYINDEX, db->trace_udata); /* get callback user data */
1211   lua_pushstring(L, sql); /* traced sql statement */
12121212
1213    /* call lua function */
1214    lua_pcall(L, 2, 0, 0);
1215    /* ignore any error generated by this function */
1213   /* call lua function */
1214   lua_pcall(L, 2, 0, 0);
1215   /* ignore any error generated by this function */
12161216
1217    lua_settop(L, top);
1217   lua_settop(L, top);
12181218}
12191219
12201220static int db_trace(lua_State *L) {
1221    sdb *db = lsqlite_checkdb(L, 1);
1221   sdb *db = lsqlite_checkdb(L, 1);
12221222
1223    if (lua_gettop(L) < 2 || lua_isnil(L, 2)) {
1224        luaL_unref(L, LUA_REGISTRYINDEX, db->trace_cb);
1225        luaL_unref(L, LUA_REGISTRYINDEX, db->trace_udata);
1223   if (lua_gettop(L) < 2 || lua_isnil(L, 2)) {
1224      luaL_unref(L, LUA_REGISTRYINDEX, db->trace_cb);
1225      luaL_unref(L, LUA_REGISTRYINDEX, db->trace_udata);
12261226
1227        db->trace_cb =
1228        db->trace_udata = LUA_NOREF;
1227      db->trace_cb =
1228      db->trace_udata = LUA_NOREF;
12291229
1230        /* clear trace handler */
1231        sqlite3_trace(db->db, NULL, NULL);
1232    }
1233    else {
1234        luaL_checktype(L, 2, LUA_TFUNCTION);
1230      /* clear trace handler */
1231      sqlite3_trace(db->db, NULL, NULL);
1232   }
1233   else {
1234      luaL_checktype(L, 2, LUA_TFUNCTION);
12351235
1236        /* make sure we have an userdata field (even if nil) */
1237        lua_settop(L, 3);
1236      /* make sure we have an userdata field (even if nil) */
1237      lua_settop(L, 3);
12381238
1239        luaL_unref(L, LUA_REGISTRYINDEX, db->trace_cb);
1240        luaL_unref(L, LUA_REGISTRYINDEX, db->trace_udata);
1239      luaL_unref(L, LUA_REGISTRYINDEX, db->trace_cb);
1240      luaL_unref(L, LUA_REGISTRYINDEX, db->trace_udata);
12411241
1242        db->trace_udata = luaL_ref(L, LUA_REGISTRYINDEX);
1243        db->trace_cb = luaL_ref(L, LUA_REGISTRYINDEX);
1242      db->trace_udata = luaL_ref(L, LUA_REGISTRYINDEX);
1243      db->trace_cb = luaL_ref(L, LUA_REGISTRYINDEX);
12441244
1245        /* set trace handler */
1246        sqlite3_trace(db->db, db_trace_callback, db);
1247    }
1245      /* set trace handler */
1246      sqlite3_trace(db->db, db_trace_callback, db);
1247   }
12481248
1249    return 0;
1249   return 0;
12501250}
12511251
12521252#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK
r31373r31374
12561256** Params: database, callback function, userdata
12571257**
12581258** callback function:
1259** Params: userdata, {one of SQLITE_INSERT, SQLITE_DELETE, or SQLITE_UPDATE},
1259** Params: userdata, {one of SQLITE_INSERT, SQLITE_DELETE, or SQLITE_UPDATE},
12601260**          database name, table name (containing the affected row), rowid of the row
12611261*/
12621262static void db_update_hook_callback(void *user, int op, char const *dbname, char const *tblname, sqlite3_int64 rowid) {
1263    sdb *db = (sdb*)user;
1264    lua_State *L = db->L;
1265    int top = lua_gettop(L);
1266    lua_Number n;
1263   sdb *db = (sdb*)user;
1264   lua_State *L = db->L;
1265   int top = lua_gettop(L);
1266   lua_Number n;
12671267
1268    /* setup lua callback call */
1269    lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_cb);    /* get callback */
1270    lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_udata); /* get callback user data */
1271    lua_pushnumber(L, (lua_Number )op);
1272    lua_pushstring(L, dbname); /* update_hook database name */
1273    lua_pushstring(L, tblname); /* update_hook database name */
1274    n = (lua_Number)rowid;
1275    if (n == rowid)
1276        lua_pushnumber(L, n);
1277    else
1278        lua_pushfstring(L, "%ll", rowid);
1268   /* setup lua callback call */
1269   lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_cb);    /* get callback */
1270   lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_udata); /* get callback user data */
1271   lua_pushnumber(L, (lua_Number )op);
1272   lua_pushstring(L, dbname); /* update_hook database name */
1273   lua_pushstring(L, tblname); /* update_hook database name */
1274   n = (lua_Number)rowid;
1275   if (n == rowid)
1276      lua_pushnumber(L, n);
1277   else
1278      lua_pushfstring(L, "%ll", rowid);
12791279
1280    /* call lua function */
1281    lua_pcall(L, 5, 0, 0);
1282    /* ignore any error generated by this function */
1280   /* call lua function */
1281   lua_pcall(L, 5, 0, 0);
1282   /* ignore any error generated by this function */
12831283
1284    lua_settop(L, top);
1284   lua_settop(L, top);
12851285}
12861286
12871287static int db_update_hook(lua_State *L) {
1288    sdb *db = lsqlite_checkdb(L, 1);
1288   sdb *db = lsqlite_checkdb(L, 1);
12891289
1290    if (lua_gettop(L) < 2 || lua_isnil(L, 2)) {
1291        luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_cb);
1292        luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_udata);
1290   if (lua_gettop(L) < 2 || lua_isnil(L, 2)) {
1291      luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_cb);
1292      luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_udata);
12931293
1294        db->update_hook_cb =
1295        db->update_hook_udata = LUA_NOREF;
1294      db->update_hook_cb =
1295      db->update_hook_udata = LUA_NOREF;
12961296
1297        /* clear update_hook handler */
1298        sqlite3_update_hook(db->db, NULL, NULL);
1299    }
1300    else {
1301        luaL_checktype(L, 2, LUA_TFUNCTION);
1297      /* clear update_hook handler */
1298      sqlite3_update_hook(db->db, NULL, NULL);
1299   }
1300   else {
1301      luaL_checktype(L, 2, LUA_TFUNCTION);
13021302
1303        /* make sure we have an userdata field (even if nil) */
1304        lua_settop(L, 3);
1303      /* make sure we have an userdata field (even if nil) */
1304      lua_settop(L, 3);
13051305
1306        luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_cb);
1307        luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_udata);
1306      luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_cb);
1307      luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_udata);
13081308
1309        db->update_hook_udata = luaL_ref(L, LUA_REGISTRYINDEX);
1310        db->update_hook_cb = luaL_ref(L, LUA_REGISTRYINDEX);
1309      db->update_hook_udata = luaL_ref(L, LUA_REGISTRYINDEX);
1310      db->update_hook_cb = luaL_ref(L, LUA_REGISTRYINDEX);
13111311
1312        /* set update_hook handler */
1313        sqlite3_update_hook(db->db, db_update_hook_callback, db);
1314    }
1312      /* set update_hook handler */
1313      sqlite3_update_hook(db->db, db_update_hook_callback, db);
1314   }
13151315
1316    return 0;
1316   return 0;
13171317}
13181318
13191319/*
r31373r31374
13231323** callback function:
13241324** Params: userdata
13251325** Returned value: Return false or nil to continue the COMMIT operation normally.
1326**  return true (non false, non nil), then the COMMIT is converted into a ROLLBACK.
1326**  return true (non false, non nil), then the COMMIT is converted into a ROLLBACK.
13271327*/
13281328static int db_commit_hook_callback(void *user) {
1329    sdb *db = (sdb*)user;
1330    lua_State *L = db->L;
1331    int top = lua_gettop(L);
1332    int rollback = 0;
1329   sdb *db = (sdb*)user;
1330   lua_State *L = db->L;
1331   int top = lua_gettop(L);
1332   int rollback = 0;
13331333
1334    /* setup lua callback call */
1335    lua_rawgeti(L, LUA_REGISTRYINDEX, db->commit_hook_cb);    /* get callback */
1336    lua_rawgeti(L, LUA_REGISTRYINDEX, db->commit_hook_udata); /* get callback user data */
1334   /* setup lua callback call */
1335   lua_rawgeti(L, LUA_REGISTRYINDEX, db->commit_hook_cb);    /* get callback */
1336   lua_rawgeti(L, LUA_REGISTRYINDEX, db->commit_hook_udata); /* get callback user data */
13371337
1338    /* call lua function */
1339    if (!lua_pcall(L, 1, 1, 0))
1340        rollback = lua_toboolean(L, -1); /* use result if there was no error */
1338   /* call lua function */
1339   if (!lua_pcall(L, 1, 1, 0))
1340      rollback = lua_toboolean(L, -1); /* use result if there was no error */
13411341
1342    lua_settop(L, top);
1343    return rollback;
1342   lua_settop(L, top);
1343   return rollback;
13441344}
13451345
13461346static int db_commit_hook(lua_State *L) {
1347    sdb *db = lsqlite_checkdb(L, 1);
1347   sdb *db = lsqlite_checkdb(L, 1);
13481348
1349    if (lua_gettop(L) < 2 || lua_isnil(L, 2)) {
1350        luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_cb);
1351        luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_udata);
1349   if (lua_gettop(L) < 2 || lua_isnil(L, 2)) {
1350      luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_cb);
1351      luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_udata);
13521352
1353        db->commit_hook_cb =
1354        db->commit_hook_udata = LUA_NOREF;
1353      db->commit_hook_cb =
1354      db->commit_hook_udata = LUA_NOREF;
13551355
1356        /* clear commit_hook handler */
1357        sqlite3_commit_hook(db->db, NULL, NULL);
1358    }
1359    else {
1360        luaL_checktype(L, 2, LUA_TFUNCTION);
1356      /* clear commit_hook handler */
1357      sqlite3_commit_hook(db->db, NULL, NULL);
1358   }
1359   else {
1360      luaL_checktype(L, 2, LUA_TFUNCTION);
13611361
1362        /* make sure we have an userdata field (even if nil) */
1363        lua_settop(L, 3);
1362      /* make sure we have an userdata field (even if nil) */
1363      lua_settop(L, 3);
13641364
1365        luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_cb);
1366        luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_udata);
1365      luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_cb);
1366      luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_udata);
13671367
1368        db->commit_hook_udata = luaL_ref(L, LUA_REGISTRYINDEX);
1369        db->commit_hook_cb = luaL_ref(L, LUA_REGISTRYINDEX);
1368      db->commit_hook_udata = luaL_ref(L, LUA_REGISTRYINDEX);
1369      db->commit_hook_cb = luaL_ref(L, LUA_REGISTRYINDEX);
13701370
1371        /* set commit_hook handler */
1372        sqlite3_commit_hook(db->db, db_commit_hook_callback, db);
1373    }
1371      /* set commit_hook handler */
1372      sqlite3_commit_hook(db->db, db_commit_hook_callback, db);
1373   }
13741374
1375    return 0;
1375   return 0;
13761376}
13771377
13781378/*
r31373r31374
13831383** Params: userdata
13841384*/
13851385static void db_rollback_hook_callback(void *user) {
1386    sdb *db = (sdb*)user;
1387    lua_State *L = db->L;
1388    int top = lua_gettop(L);
1386   sdb *db = (sdb*)user;
1387   lua_State *L = db->L;
1388   int top = lua_gettop(L);
13891389
1390    /* setup lua callback call */
1391    lua_rawgeti(L, LUA_REGISTRYINDEX, db->rollback_hook_cb);    /* get callback */
1392    lua_rawgeti(L, LUA_REGISTRYINDEX, db->rollback_hook_udata); /* get callback user data */
1390   /* setup lua callback call */
1391   lua_rawgeti(L, LUA_REGISTRYINDEX, db->rollback_hook_cb);    /* get callback */
1392   lua_rawgeti(L, LUA_REGISTRYINDEX, db->rollback_hook_udata); /* get callback user data */
13931393
1394    /* call lua function */
1395    lua_pcall(L, 1, 0, 0);
1396    /* ignore any error generated by this function */
1394   /* call lua function */
1395   lua_pcall(L, 1, 0, 0);
1396   /* ignore any error generated by this function */
13971397
1398    lua_settop(L, top);
1398   lua_settop(L, top);
13991399}
14001400
14011401static int db_rollback_hook(lua_State *L) {
1402    sdb *db = lsqlite_checkdb(L, 1);
1402   sdb *db = lsqlite_checkdb(L, 1);
14031403
1404    if (lua_gettop(L) < 2 || lua_isnil(L, 2)) {
1405        luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_cb);
1406        luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_udata);
1404   if (lua_gettop(L) < 2 || lua_isnil(L, 2)) {
1405      luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_cb);
1406      luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_udata);
14071407
1408        db->rollback_hook_cb =
1409        db->rollback_hook_udata = LUA_NOREF;
1408      db->rollback_hook_cb =
1409      db->rollback_hook_udata = LUA_NOREF;
14101410
1411        /* clear rollback_hook handler */
1412        sqlite3_rollback_hook(db->db, NULL, NULL);
1413    }
1414    else {
1415        luaL_checktype(L, 2, LUA_TFUNCTION);
1411      /* clear rollback_hook handler */
1412      sqlite3_rollback_hook(db->db, NULL, NULL);
1413   }
1414   else {
1415      luaL_checktype(L, 2, LUA_TFUNCTION);
14161416
1417        /* make sure we have an userdata field (even if nil) */
1418        lua_settop(L, 3);
1417      /* make sure we have an userdata field (even if nil) */
1418      lua_settop(L, 3);
14191419
1420        luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_cb);
1421        luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_udata);
1420      luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_cb);
1421      luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_udata);
14221422
1423        db->rollback_hook_udata = luaL_ref(L, LUA_REGISTRYINDEX);
1424        db->rollback_hook_cb = luaL_ref(L, LUA_REGISTRYINDEX);
1423      db->rollback_hook_udata = luaL_ref(L, LUA_REGISTRYINDEX);
1424      db->rollback_hook_cb = luaL_ref(L, LUA_REGISTRYINDEX);
14251425
1426        /* set rollback_hook handler */
1427        sqlite3_rollback_hook(db->db, db_rollback_hook_callback, db);
1428    }
1426      /* set rollback_hook handler */
1427      sqlite3_rollback_hook(db->db, db_rollback_hook_callback, db);
1428   }
14291429
1430    return 0;
1430   return 0;
14311431}
14321432
14331433#endif /* #if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK */
r31373r31374
14431443** returns: 0 to return immediatly and return SQLITE_ABORT, non-zero to continue
14441444*/
14451445static int db_progress_callback(void *user) {
1446    int result = 1; /* abort by default */
1447    sdb *db = (sdb*)user;
1448    lua_State *L = db->L;
1449    int top = lua_gettop(L);
1446   int result = 1; /* abort by default */
1447   sdb *db = (sdb*)user;
1448   lua_State *L = db->L;
1449   int top = lua_gettop(L);
14501450
1451    lua_rawgeti(L, LUA_REGISTRYINDEX, db->progress_cb);
1452    lua_rawgeti(L, LUA_REGISTRYINDEX, db->progress_udata);
1451   lua_rawgeti(L, LUA_REGISTRYINDEX, db->progress_cb);
1452   lua_rawgeti(L, LUA_REGISTRYINDEX, db->progress_udata);
14531453
1454    /* call lua function */
1455    if (!lua_pcall(L, 1, 1, 0))
1456        result = lua_toboolean(L, -1);
1454   /* call lua function */
1455   if (!lua_pcall(L, 1, 1, 0))
1456      result = lua_toboolean(L, -1);
14571457
1458    lua_settop(L, top);
1459    return result;
1458   lua_settop(L, top);
1459   return result;
14601460}
14611461
14621462static int db_progress_handler(lua_State *L) {
1463    sdb *db = lsqlite_checkdb(L, 1);
1463   sdb *db = lsqlite_checkdb(L, 1);
14641464
1465    if (lua_gettop(L) < 2 || lua_isnil(L, 2)) {
1466        luaL_unref(L, LUA_REGISTRYINDEX, db->progress_cb);
1467        luaL_unref(L, LUA_REGISTRYINDEX, db->progress_udata);
1465   if (lua_gettop(L) < 2 || lua_isnil(L, 2)) {
1466      luaL_unref(L, LUA_REGISTRYINDEX, db->progress_cb);
1467      luaL_unref(L, LUA_REGISTRYINDEX, db->progress_udata);
14681468
1469        db->progress_cb =
1470        db->progress_udata = LUA_NOREF;
1469      db->progress_cb =
1470      db->progress_udata = LUA_NOREF;
14711471
1472        /* clear busy handler */
1473        sqlite3_progress_handler(db->db, 0, NULL, NULL);
1474    }
1475    else {
1476        int nop = luaL_checkint(L, 2);  /* number of opcodes */
1477        luaL_checktype(L, 3, LUA_TFUNCTION);
1472      /* clear busy handler */
1473      sqlite3_progress_handler(db->db, 0, NULL, NULL);
1474   }
1475   else {
1476      int nop = luaL_checkint(L, 2);  /* number of opcodes */
1477      luaL_checktype(L, 3, LUA_TFUNCTION);
14781478
1479        /* make sure we have an userdata field (even if nil) */
1480        lua_settop(L, 4);
1479      /* make sure we have an userdata field (even if nil) */
1480      lua_settop(L, 4);
14811481
1482        luaL_unref(L, LUA_REGISTRYINDEX, db->progress_cb);
1483        luaL_unref(L, LUA_REGISTRYINDEX, db->progress_udata);
1482      luaL_unref(L, LUA_REGISTRYINDEX, db->progress_cb);
1483      luaL_unref(L, LUA_REGISTRYINDEX, db->progress_udata);
14841484
1485        db->progress_udata = luaL_ref(L, LUA_REGISTRYINDEX);
1486        db->progress_cb = luaL_ref(L, LUA_REGISTRYINDEX);
1485      db->progress_udata = luaL_ref(L, LUA_REGISTRYINDEX);
1486      db->progress_cb = luaL_ref(L, LUA_REGISTRYINDEX);
14871487
1488        /* set progress callback */
1489        sqlite3_progress_handler(db->db, nop, db_progress_callback, db);
1490    }
1488      /* set progress callback */
1489      sqlite3_progress_handler(db->db, nop, db_progress_callback, db);
1490   }
14911491
1492    return 0;
1492   return 0;
14931493}
14941494
14951495#else /* #if !defined(SQLITE_OMIT_PROGRESS_CALLBACK) || !SQLITE_OMIT_PROGRESS_CALLBACK */
14961496
14971497static int db_progress_handler(lua_State *L) {
1498    lua_pushliteral(L, "progress callback support disabled at compile time");
1499    lua_error(L);
1500    return 0;
1498   lua_pushliteral(L, "progress callback support disabled at compile time");
1499   lua_error(L);
1500   return 0;
15011501}
15021502
15031503#endif /* #if !defined(SQLITE_OMIT_PROGRESS_CALLBACK) || !SQLITE_OMIT_PROGRESS_CALLBACK */
r31373r31374
15111511** returns: 0 to return immediatly and return SQLITE_BUSY, non-zero to try again
15121512*/
15131513static int db_busy_callback(void *user, int tries) {
1514    int retry = 0; /* abort by default */
1515    sdb *db = (sdb*)user;
1516    lua_State *L = db->L;
1517    int top = lua_gettop(L);
1514   int retry = 0; /* abort by default */
1515   sdb *db = (sdb*)user;
1516   lua_State *L = db->L;
1517   int top = lua_gettop(L);
15181518
1519    lua_rawgeti(L, LUA_REGISTRYINDEX, db->busy_cb);
1520    lua_rawgeti(L, LUA_REGISTRYINDEX, db->busy_udata);
1521    lua_pushnumber(L, tries);
1519   lua_rawgeti(L, LUA_REGISTRYINDEX, db->busy_cb);
1520   lua_rawgeti(L, LUA_REGISTRYINDEX, db->busy_udata);
1521   lua_pushnumber(L, tries);
15221522
1523    /* call lua function */
1524    if (!lua_pcall(L, 2, 1, 0))
1525        retry = lua_toboolean(L, -1);
1523   /* call lua function */
1524   if (!lua_pcall(L, 2, 1, 0))
1525      retry = lua_toboolean(L, -1);
15261526
1527    lua_settop(L, top);
1528    return retry;
1527   lua_settop(L, top);
1528   return retry;
15291529}
15301530
15311531static int db_busy_handler(lua_State *L) {
1532    sdb *db = lsqlite_checkdb(L, 1);
1532   sdb *db = lsqlite_checkdb(L, 1);
15331533
1534    if (lua_gettop(L) < 2 || lua_isnil(L, 2)) {
1535        luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb);
1536        luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata);
1534   if (lua_gettop(L) < 2 || lua_isnil(L, 2)) {
1535      luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb);
1536      luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata);
15371537
1538        db->busy_cb =
1539        db->busy_udata = LUA_NOREF;
1538      db->busy_cb =
1539      db->busy_udata = LUA_NOREF;
15401540
1541        /* clear busy handler */
1542        sqlite3_busy_handler(db->db, NULL, NULL);
1543    }
1544    else {
1545        luaL_checktype(L, 2, LUA_TFUNCTION);
1546        /* make sure we have an userdata field (even if nil) */
1547        lua_settop(L, 3);
1541      /* clear busy handler */
1542      sqlite3_busy_handler(db->db, NULL, NULL);
1543   }
1544   else {
1545      luaL_checktype(L, 2, LUA_TFUNCTION);
1546      /* make sure we have an userdata field (even if nil) */
1547      lua_settop(L, 3);
15481548
1549        luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb);
1550        luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata);
1549      luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb);
1550      luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata);
15511551
1552        db->busy_udata = luaL_ref(L, LUA_REGISTRYINDEX);
1553        db->busy_cb = luaL_ref(L, LUA_REGISTRYINDEX);
1552      db->busy_udata = luaL_ref(L, LUA_REGISTRYINDEX);
1553      db->busy_cb = luaL_ref(L, LUA_REGISTRYINDEX);
15541554
1555        /* set busy handler */
1556        sqlite3_busy_handler(db->db, db_busy_callback, db);
1557    }
1555      /* set busy handler */
1556      sqlite3_busy_handler(db->db, db_busy_callback, db);
1557   }
15581558
1559    return 0;
1559   return 0;
15601560}
15611561
15621562static int db_busy_timeout(lua_State *L) {
1563    sdb *db = lsqlite_checkdb(L, 1);
1564    int timeout = luaL_checkint(L, 2);
1565    sqlite3_busy_timeout(db->db, timeout);
1563   sdb *db = lsqlite_checkdb(L, 1);
1564   int timeout = luaL_checkint(L, 2);
1565   sqlite3_busy_timeout(db->db, timeout);
15661566
1567    /* if there was a timeout callback registered, it is now
1568    ** invalid/useless. free any references we may have */
1569    luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb);
1570    luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata);
1571    db->busy_cb =
1572    db->busy_udata = LUA_NOREF;
1567   /* if there was a timeout callback registered, it is now
1568   ** invalid/useless. free any references we may have */
1569   luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb);
1570   luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata);
1571   db->busy_cb =
1572   db->busy_udata = LUA_NOREF;
15731573
1574    return 0;
1574   return 0;
15751575}
15761576
15771577/*
r31373r31374
15831583** Returns: 0 to continue, other value will cause abort
15841584*/
15851585static int db_exec_callback(void* user, int columns, char **data, char **names) {
1586    int result = SQLITE_ABORT; /* abort by default */
1587    lua_State *L = (lua_State*)user;
1588    int n;
1586   int result = SQLITE_ABORT; /* abort by default */
1587   lua_State *L = (lua_State*)user;
1588   int n;
15891589
1590    int top = lua_gettop(L);
1590   int top = lua_gettop(L);
15911591
1592    lua_pushvalue(L, 3); /* function to call */
1593    lua_pushvalue(L, 4); /* user data */
1594    lua_pushnumber(L, columns); /* total number of rows in result */
1592   lua_pushvalue(L, 3); /* function to call */
1593   lua_pushvalue(L, 4); /* user data */
1594   lua_pushnumber(L, columns); /* total number of rows in result */
15951595
1596    /* column values */
1597    lua_pushvalue(L, 6);
1598    for (n = 0; n < columns;) {
1599        lua_pushstring(L, data[n++]);
1600        lua_rawseti(L, -2, n);
1601    }
1596   /* column values */
1597   lua_pushvalue(L, 6);
1598   for (n = 0; n < columns;) {
1599      lua_pushstring(L, data[n++]);
1600      lua_rawseti(L, -2, n);
1601   }
16021602
1603    /* columns names */
1604    lua_pushvalue(L, 5);
1605    if (lua_isnil(L, -1)) {
1606        lua_pop(L, 1);
1607        lua_newtable(L);
1608        lua_pushvalue(L, -1);
1609        lua_replace(L, 5);
1610        for (n = 0; n < columns;) {
1611            lua_pushstring(L, names[n++]);
1612            lua_rawseti(L, -2, n);
1613        }
1614    }
1603   /* columns names */
1604   lua_pushvalue(L, 5);
1605   if (lua_isnil(L, -1)) {
1606      lua_pop(L, 1);
1607      lua_newtable(L);
1608      lua_pushvalue(L, -1);
1609      lua_replace(L, 5);
1610      for (n = 0; n < columns;) {
1611         lua_pushstring(L, names[n++]);
1612         lua_rawseti(L, -2, n);
1613      }
1614   }
16151615
1616    /* call lua function */
1617    if (!lua_pcall(L, 4, 1, 0)) {
1618        if (lua_isnumber(L, -1))
1619            result = lua_tonumber(L, -1);
1620    }
1616   /* call lua function */
1617   if (!lua_pcall(L, 4, 1, 0)) {
1618      if (lua_isnumber(L, -1))
1619         result = lua_tonumber(L, -1);
1620   }
16211621
1622    lua_settop(L, top);
1623    return result;
1622   lua_settop(L, top);
1623   return result;
16241624}
16251625
16261626static int db_exec(lua_State *L) {
1627    sdb *db = lsqlite_checkdb(L, 1);
1628    const char *sql = luaL_checkstring(L, 2);
1629    int result;
1627   sdb *db = lsqlite_checkdb(L, 1);
1628   const char *sql = luaL_checkstring(L, 2);
1629   int result;
16301630
1631    if (!lua_isnoneornil(L, 3)) {
1632        /* stack:
1633        **  3: callback function
1634        **  4: userdata
1635        **  5: column names
1636        **  6: reusable column values
1637        */
1638        luaL_checktype(L, 3, LUA_TFUNCTION);
1639        lua_settop(L, 4);   /* 'trap' userdata - nil extra parameters */
1640        lua_pushnil(L);     /* column names not known at this point */
1641        lua_newtable(L);    /* column values table */
1631   if (!lua_isnoneornil(L, 3)) {
1632      /* stack:
1633      **  3: callback function
1634      **  4: userdata
1635      **  5: column names
1636      **  6: reusable column values
1637      */
1638      luaL_checktype(L, 3, LUA_TFUNCTION);
1639      lua_settop(L, 4);   /* 'trap' userdata - nil extra parameters */
1640      lua_pushnil(L);     /* column names not known at this point */
1641      lua_newtable(L);    /* column values table */
16421642
1643        result = sqlite3_exec(db->db, sql, db_exec_callback, L, NULL);
1644    }
1645    else {
1646        /* no callbacks */
1647        result = sqlite3_exec(db->db, sql, NULL, NULL, NULL);
1648    }
1643      result = sqlite3_exec(db->db, sql, db_exec_callback, L, NULL);
1644   }
1645   else {
1646      /* no callbacks */
1647      result = sqlite3_exec(db->db, sql, NULL, NULL, NULL);
1648   }
16491649
1650    lua_pushnumber(L, result);
1651    return 1;
1650   lua_pushnumber(L, result);
1651   return 1;
16521652}
16531653
16541654/*
r31373r31374
16561656** returns: code, compiled length or error message
16571657*/
16581658static int db_prepare(lua_State *L) {
1659    sdb *db = lsqlite_checkdb(L, 1);
1660    const char *sql = luaL_checkstring(L, 2);
1661    int sql_len = lua_strlen(L, 2);
1662    const char *sqltail;
1663    sdb_vm *svm;
1664    lua_settop(L,2); /* sql is on top of stack for call to newvm */
1665    svm = newvm(L, db);
1659   sdb *db = lsqlite_checkdb(L, 1);
1660   const char *sql = luaL_checkstring(L, 2);
1661   int sql_len = lua_strlen(L, 2);
1662   const char *sqltail;
1663   sdb_vm *svm;
1664   lua_settop(L,2); /* sql is on top of stack for call to newvm */
1665   svm = newvm(L, db);
16661666
1667    if (sqlite3_prepare(db->db, sql, sql_len, &svm->vm, &sqltail) != SQLITE_OK) {
1668        cleanupvm(L, svm);
1667   if (sqlite3_prepare(db->db, sql, sql_len, &svm->vm, &sqltail) != SQLITE_OK) {
1668      cleanupvm(L, svm);
16691669
1670        lua_pushnil(L);
1671        lua_pushnumber(L, sqlite3_errcode(db->db));
1672        return 2;
1673    }
1670      lua_pushnil(L);
1671      lua_pushnumber(L, sqlite3_errcode(db->db));
1672      return 2;
1673   }
16741674
1675    /* vm already in the stack */
1676    lua_pushstring(L, sqltail);
1677    return 2;
1675   /* vm already in the stack */
1676   lua_pushstring(L, sqltail);
1677   return 2;
16781678}
16791679
16801680static int db_do_next_row(lua_State *L, int packed) {
1681    int result;
1682    sdb_vm *svm = lsqlite_checkvm(L, 1);
1683    sqlite3_stmt *vm;
1684    int columns;
1685    int i;
1681   int result;
1682   sdb_vm *svm = lsqlite_checkvm(L, 1);
1683   sqlite3_stmt *vm;
1684   int columns;
1685   int i;
16861686
1687    result = stepvm(L, svm);
1688    vm = svm->vm; /* stepvm may change svm->vm if re-prepare is needed */
1689    svm->has_values = result == SQLITE_ROW ? 1 : 0;
1690    svm->columns = columns = sqlite3_data_count(vm);
1687   result = stepvm(L, svm);
1688   vm = svm->vm; /* stepvm may change svm->vm if re-prepare is needed */
1689   svm->has_values = result == SQLITE_ROW ? 1 : 0;
1690   svm->columns = columns = sqlite3_data_count(vm);
16911691
1692    if (result == SQLITE_ROW) {
1693        if (packed) {
1694            lua_newtable(L);
1695            if (packed == 1) {
1696                for (i = 0; i < columns;) {
1697                    vm_push_column(L, vm, i);
1698                    lua_rawseti(L, -2, ++i);
1699                }
1700            }
1701            else {
1702                for (i = 0; i < columns; ++i) {
1703                    lua_pushstring(L, sqlite3_column_name(vm, i));
1704                    vm_push_column(L, vm, i);
1705                    lua_rawset(L, -3);
1706                }
1707            }
1708            return 1;
1709        }
1710        else {
1711            lua_checkstack(L, columns);
1712            for (i = 0; i < columns; ++i)
1713                vm_push_column(L, vm, i);
1714            return svm->columns;
1715        }
1716    }
1692   if (result == SQLITE_ROW) {
1693      if (packed) {
1694         lua_newtable(L);
1695         if (packed == 1) {
1696            for (i = 0; i < columns;) {
1697               vm_push_column(L, vm, i);
1698               lua_rawseti(L, -2, ++i);
1699            }
1700         }
1701         else {
1702            for (i = 0; i < columns; ++i) {
1703               lua_pushstring(L, sqlite3_column_name(vm, i));
1704               vm_push_column(L, vm, i);
1705               lua_rawset(L, -3);
1706            }
1707         }
1708         return 1;
1709      }
1710      else {
1711         lua_checkstack(L, columns);
1712         for (i = 0; i < columns; ++i)
1713            vm_push_column(L, vm, i);
1714         return svm->columns;
1715      }
1716   }
17171717
1718    if (svm->temp) {
1719        /* finalize and check for errors */
1720        result = sqlite3_finalize(vm);
1721        svm->vm = NULL;
1722        cleanupvm(L, svm);
1723    }
1724    else if (result == SQLITE_DONE) {
1725        result = sqlite3_reset(vm);
1726    }
1718   if (svm->temp) {
1719      /* finalize and check for errors */
1720      result = sqlite3_finalize(vm);
1721      svm->vm = NULL;
1722      cleanupvm(L, svm);
1723   }
1724   else if (result == SQLITE_DONE) {
1725      result = sqlite3_reset(vm);
1726   }
17271727
1728    if (result != SQLITE_OK) {
1729        lua_pushstring(L, sqlite3_errmsg(svm->db->db));
1730        lua_error(L);
1731    }
1732    return 0;
1728   if (result != SQLITE_OK) {
1729      lua_pushstring(L, sqlite3_errmsg(svm->db->db));
1730      lua_error(L);
1731   }
1732   return 0;
17331733}
17341734
17351735static int db_next_row(lua_State *L) {
1736    return db_do_next_row(L, 0);
1736   return db_do_next_row(L, 0);
17371737}
17381738
17391739static int db_next_packed_row(lua_State *L) {
1740    return db_do_next_row(L, 1);
1740   return db_do_next_row(L, 1);
17411741}
17421742
17431743static int db_next_named_row(lua_State *L) {
1744    return db_do_next_row(L, 2);
1744   return db_do_next_row(L, 2);
17451745}
17461746
17471747static int dbvm_do_rows(lua_State *L, int(*f)(lua_State *)) {
1748    /* sdb_vm *svm =  */
1749    lsqlite_checkvm(L, 1);
1750    lua_pushvalue(L,1);
1751    lua_pushcfunction(L, f);
1752    lua_insert(L, -2);
1753    return 2;
1748   /* sdb_vm *svm =  */
1749   lsqlite_checkvm(L, 1);
1750   lua_pushvalue(L,1);
1751   lua_pushcfunction(L, f);
1752   lua_insert(L, -2);
1753   return 2;
17541754}
17551755
17561756static int dbvm_rows(lua_State *L) {
1757    return dbvm_do_rows(L, db_next_packed_row);
1757   return dbvm_do_rows(L, db_next_packed_row);
17581758}
17591759
17601760static int dbvm_nrows(lua_State *L) {
1761    return dbvm_do_rows(L, db_next_named_row);
1761   return dbvm_do_rows(L, db_next_named_row);
17621762}
17631763
17641764static int dbvm_urows(lua_State *L) {
1765    return dbvm_do_rows(L, db_next_row);
1765   return dbvm_do_rows(L, db_next_row);
17661766}
17671767
17681768static int db_do_rows(lua_State *L, int(*f)(lua_State *)) {
1769    sdb *db = lsqlite_checkdb(L, 1);
1770    const char *sql = luaL_checkstring(L, 2);
1771    sdb_vm *svm;
1772    lua_settop(L,2); /* sql is on top of stack for call to newvm */
1773    svm = newvm(L, db);
1774    svm->temp = 1;
1769   sdb *db = lsqlite_checkdb(L, 1);
1770   const char *sql = luaL_checkstring(L, 2);
1771   sdb_vm *svm;
1772   lua_settop(L,2); /* sql is on top of stack for call to newvm */
1773   svm = newvm(L, db);
1774   svm->temp = 1;
17751775
1776    if (sqlite3_prepare(db->db, sql, -1, &svm->vm, NULL) != SQLITE_OK) {
1777        cleanupvm(L, svm);
1776   if (sqlite3_prepare(db->db, sql, -1, &svm->vm, NULL) != SQLITE_OK) {
1777      cleanupvm(L, svm);
17781778
1779        lua_pushstring(L, sqlite3_errmsg(svm->db->db));
1780        lua_error(L);
1781    }
1779      lua_pushstring(L, sqlite3_errmsg(svm->db->db));
1780      lua_error(L);
1781   }
17821782
1783    lua_pushcfunction(L, f);
1784    lua_insert(L, -2);
1785    return 2;
1783   lua_pushcfunction(L, f);
1784   lua_insert(L, -2);
1785   return 2;
17861786}
17871787
17881788static int db_rows(lua_State *L) {
1789    return db_do_rows(L, db_next_packed_row);
1789   return db_do_rows(L, db_next_packed_row);
17901790}
17911791
17921792static int db_nrows(lua_State *L) {
1793    return db_do_rows(L, db_next_named_row);
1793   return db_do_rows(L, db_next_named_row);
17941794}
17951795
17961796/* unpacked version of db:rows */
17971797static int db_urows(lua_State *L) {
1798    return db_do_rows(L, db_next_row);
1798   return db_do_rows(L, db_next_row);
17991799}
18001800
18011801static int db_tostring(lua_State *L) {
1802    char buff[32];
1803    sdb *db = lsqlite_getdb(L, 1);
1804    if (db->db == NULL)
1805        strcpy(buff, "closed");
1806    else
1807        sprintf(buff, "%p", lua_touserdata(L, 1));
1808    lua_pushfstring(L, "sqlite database (%s)", buff);
1809    return 1;
1802   char buff[32];
1803   sdb *db = lsqlite_getdb(L, 1);
1804   if (db->db == NULL)
1805      strcpy(buff, "closed");
1806   else
1807      sprintf(buff, "%p", lua_touserdata(L, 1));
1808   lua_pushfstring(L, "sqlite database (%s)", buff);
1809   return 1;
18101810}
18111811
18121812static int db_close(lua_State *L) {
1813    sdb *db = lsqlite_checkdb(L, 1);
1814    lua_pushnumber(L, cleanupdb(L, db));
1815    return 1;
1813   sdb *db = lsqlite_checkdb(L, 1);
1814   lua_pushnumber(L, cleanupdb(L, db));
1815   return 1;
18161816}
18171817
18181818static int db_close_vm(lua_State *L) {
1819    sdb *db = lsqlite_checkdb(L, 1);
1820    /* cleanup temporary only tables? */
1821    int temp = lua_toboolean(L, 2);
1819   sdb *db = lsqlite_checkdb(L, 1);
1820   /* cleanup temporary only tables? */
1821   int temp = lua_toboolean(L, 2);
18221822
1823    /* free associated virtual machines */
1824    lua_pushlightuserdata(L, db);
1825    lua_rawget(L, LUA_REGISTRYINDEX);
1823   /* free associated virtual machines */
1824   lua_pushlightuserdata(L, db);
1825   lua_rawget(L, LUA_REGISTRYINDEX);
18261826
1827    /* close all used handles */
1828    lua_pushnil(L);
1829    while (lua_next(L, -2)) {
1830        sdb_vm *svm = (sdb_vm *)lua_touserdata(L, -2); /* key: vm; val: sql text */
1827   /* close all used handles */
1828   lua_pushnil(L);
1829   while (lua_next(L, -2)) {
1830      sdb_vm *svm = (sdb_vm *)lua_touserdata(L, -2); /* key: vm; val: sql text */
18311831
1832        if ((!temp || svm->temp) && svm->vm)
1833        {
1834            sqlite3_finalize(svm->vm);
1835            svm->vm = NULL;
1836        }
1832      if ((!temp || svm->temp) && svm->vm)
1833      {
1834         sqlite3_finalize(svm->vm);
1835         svm->vm = NULL;
1836      }
18371837
1838        /* leave key in the stack */
1839        lua_pop(L, 1);
1840    }
1841    return 0;
1838      /* leave key in the stack */
1839      lua_pop(L, 1);
1840   }
1841   return 0;
18421842}
18431843
18441844static int db_gc(lua_State *L) {
1845    sdb *db = lsqlite_getdb(L, 1);
1846    if (db->db != NULL)  /* ignore closed databases */
1847        cleanupdb(L, db);
1848    return 0;
1845   sdb *db = lsqlite_getdb(L, 1);
1846   if (db->db != NULL)  /* ignore closed databases */
1847      cleanupdb(L, db);
1848   return 0;
18491849}
18501850
18511851/*
r31373r31374
18551855*/
18561856
18571857static int lsqlite_version(lua_State *L) {
1858    lua_pushstring(L, sqlite3_libversion());
1859    return 1;
1858   lua_pushstring(L, sqlite3_libversion());
1859   return 1;
18601860}
18611861
18621862static int lsqlite_complete(lua_State *L) {
1863    const char *sql = luaL_checkstring(L, 1);
1864    lua_pushboolean(L, sqlite3_complete(sql));
1865    return 1;
1863   const char *sql = luaL_checkstring(L, 1);
1864   lua_pushboolean(L, sqlite3_complete(sql));
1865   return 1;
18661866}
18671867
18681868#ifndef WIN32
18691869static int lsqlite_temp_directory(lua_State *L) {
1870    const char *oldtemp = sqlite3_temp_directory;
1870   const char *oldtemp = sqlite3_temp_directory;
18711871
1872    if (!lua_isnone(L, 1)) {
1873        const char *temp = luaL_optstring(L, 1, NULL);
1874        if (sqlite3_temp_directory) {
1875            sqlite3_free((char*)sqlite3_temp_directory);
1876        }
1877        if (temp) {
1878            sqlite3_temp_directory = sqlite3_mprintf("%s", temp);
1879        }
1880        else {
1881            sqlite3_temp_directory = NULL;
1882        }
1883    }
1884    lua_pushstring(L, oldtemp);
1885    return 1;
1872   if (!lua_isnone(L, 1)) {
1873      const char *temp = luaL_optstring(L, 1, NULL);
1874      if (sqlite3_temp_directory) {
1875         sqlite3_free((char*)sqlite3_temp_directory);
1876      }
1877      if (temp) {
1878         sqlite3_temp_directory = sqlite3_mprintf("%s", temp);
1879      }
1880      else {
1881         sqlite3_temp_directory = NULL;
1882      }
1883   }
1884   lua_pushstring(L, oldtemp);
1885   return 1;
18861886}
18871887#endif
18881888
18891889static int lsqlite_do_open(lua_State *L, const char *filename) {
1890    sdb *db = newdb(L); /* create and leave in stack */
1890   sdb *db = newdb(L); /* create and leave in stack */
18911891
1892    if (sqlite3_open(filename, &db->db) == SQLITE_OK) {
1893        /* database handle already in the stack - return it */
1894        return 1;
1895    }
1892   if (sqlite3_open(filename, &db->db) == SQLITE_OK) {
1893      /* database handle already in the stack - return it */
1894      return 1;
1895   }
18961896
1897    /* failed to open database */
1898    lua_pushnil(L);                             /* push nil */
1899    lua_pushnumber(L, sqlite3_errcode(db->db));
1900    lua_pushstring(L, sqlite3_errmsg(db->db));  /* push error message */
1897   /* failed to open database */
1898   lua_pushnil(L);                             /* push nil */
1899   lua_pushnumber(L, sqlite3_errcode(db->db));
1900   lua_pushstring(L, sqlite3_errmsg(db->db));  /* push error message */
19011901
1902    /* clean things up */
1903    cleanupdb(L, db);
1902   /* clean things up */
1903   cleanupdb(L, db);
19041904
1905    /* return */
1906    return 3;
1905   /* return */
1906   return 3;
19071907}
19081908
19091909static int lsqlite_open(lua_State *L) {
1910    const char *filename = luaL_checkstring(L, 1);
1911    return lsqlite_do_open(L, filename);
1910   const char *filename = luaL_checkstring(L, 1);
1911   return lsqlite_do_open(L, filename);
19121912}
19131913
19141914static int lsqlite_open_memory(lua_State *L) {
1915    return lsqlite_do_open(L, ":memory:");
1915   return lsqlite_do_open(L, ":memory:");
19161916}
19171917
19181918static int lsqlite_newindex(lua_State *L) {
1919    lua_pushliteral(L, "attempt to change readonly table");
1920    lua_error(L);
1921    return 0;
1919   lua_pushliteral(L, "attempt to change readonly table");
1920   lua_error(L);
1921   return 0;
19221922}
19231923
19241924/*
r31373r31374
19311931#define LSC(s)  { #s, LSQLITE_ ## s },
19321932
19331933static const struct {
1934    const char* name;
1935    int value;
1934   const char* name;
1935   int value;
19361936} sqlite_constants[] = {
1937    /* error codes */
1938    SC(OK)          SC(ERROR)       SC(INTERNAL)    SC(PERM)
1939    SC(ABORT)       SC(BUSY)        SC(LOCKED)      SC(NOMEM)
1940    SC(READONLY)    SC(INTERRUPT)   SC(IOERR)       SC(CORRUPT)
1941    SC(NOTFOUND)    SC(FULL)        SC(CANTOPEN)    SC(PROTOCOL)
1942    SC(EMPTY)       SC(SCHEMA)      SC(TOOBIG)      SC(CONSTRAINT)
1943    SC(MISMATCH)    SC(MISUSE)      SC(NOLFS)
1944    SC(FORMAT)      SC(NOTADB)
1937   /* error codes */
1938   SC(OK)          SC(ERROR)       SC(INTERNAL)    SC(PERM)
1939   SC(ABORT)       SC(BUSY)        SC(LOCKED)      SC(NOMEM)
1940   SC(READONLY)    SC(INTERRUPT)   SC(IOERR)       SC(CORRUPT)
1941   SC(NOTFOUND)    SC(FULL)        SC(CANTOPEN)    SC(PROTOCOL)
1942   SC(EMPTY)       SC(SCHEMA)      SC(TOOBIG)      SC(CONSTRAINT)
1943   SC(MISMATCH)    SC(MISUSE)      SC(NOLFS)
1944   SC(FORMAT)      SC(NOTADB)
19451945
1946    /* sqlite_step specific return values */
1947    SC(RANGE)       SC(ROW)         SC(DONE)
1946   /* sqlite_step specific return values */
1947   SC(RANGE)       SC(ROW)         SC(DONE)
19481948
1949    /* column types */
1950    SC(INTEGER)     SC(FLOAT)       SC(TEXT)        SC(BLOB)
1951    SC(NULL)
1949   /* column types */
1950   SC(INTEGER)     SC(FLOAT)       SC(TEXT)        SC(BLOB)
1951   SC(NULL)
19521952
1953    /* Authorizer Action Codes */
1954    SC(CREATE_INDEX       )
1955    SC(CREATE_TABLE       )
1956    SC(CREATE_TEMP_INDEX  )
1957    SC(CREATE_TEMP_TABLE  )
1958    SC(CREATE_TEMP_TRIGGER)
1959    SC(CREATE_TEMP_VIEW   )
1960    SC(CREATE_TRIGGER     )
1961    SC(CREATE_VIEW        )
1962    SC(DELETE             )
1963    SC(DROP_INDEX         )
1964    SC(DROP_TABLE         )
1965    SC(DROP_TEMP_INDEX    )
1966    SC(DROP_TEMP_TABLE    )
1967    SC(DROP_TEMP_TRIGGER  )
1968    SC(DROP_TEMP_VIEW     )
1969    SC(DROP_TRIGGER       )
1970    SC(DROP_VIEW          )
1971    SC(INSERT             )
1972    SC(PRAGMA             )
1973    SC(READ               )
1974    SC(SELECT             )
1975    SC(TRANSACTION        )
1976    SC(UPDATE             )
1977    SC(ATTACH             )
1978    SC(DETACH             )
1979    SC(ALTER_TABLE        )
1980    SC(REINDEX            )
1981    SC(ANALYZE            )
1982    SC(CREATE_VTABLE      )
1983    SC(DROP_VTABLE        )
1984    SC(FUNCTION           )
1985    SC(SAVEPOINT          )
1953   /* Authorizer Action Codes */
1954   SC(CREATE_INDEX       )
1955   SC(CREATE_TABLE       )
1956   SC(CREATE_TEMP_INDEX  )
1957   SC(CREATE_TEMP_TABLE  )
1958   SC(CREATE_TEMP_TRIGGER)
1959   SC(CREATE_TEMP_VIEW   )
1960   SC(CREATE_TRIGGER     )
1961   SC(CREATE_VIEW        )
1962   SC(DELETE             )
1963   SC(DROP_INDEX         )
1964   SC(DROP_TABLE         )
1965   SC(DROP_TEMP_INDEX    )
1966   SC(DROP_TEMP_TABLE    )
1967   SC(DROP_TEMP_TRIGGER  )
1968   SC(DROP_TEMP_VIEW     )
1969   SC(DROP_TRIGGER       )
1970   SC(DROP_VIEW          )
1971   SC(INSERT             )
1972   SC(PRAGMA             )
1973   SC(READ               )
1974   SC(SELECT             )
1975   SC(TRANSACTION        )
1976   SC(UPDATE             )
1977   SC(ATTACH             )
1978   SC(DETACH             )
1979   SC(ALTER_TABLE        )
1980   SC(REINDEX            )
1981   SC(ANALYZE            )
1982   SC(CREATE_VTABLE      )
1983   SC(DROP_VTABLE        )
1984   SC(FUNCTION           )
1985   SC(SAVEPOINT          )
19861986
1987    /* terminator */
1988    { NULL, 0 }
1987   /* terminator */
1988   { NULL, 0 }
19891989};
19901990
19911991/* ======================================================= */
19921992
19931993static const luaL_Reg dblib[] = {
1994    {"isopen",              db_isopen               },
1995    {"last_insert_rowid",   db_last_insert_rowid    },
1996    {"changes",             db_changes              },
1997    {"total_changes",       db_total_changes        },
1998    {"errcode",             db_errcode              },
1999    {"error_code",          db_errcode              },
2000    {"errmsg",              db_errmsg               },
2001    {"error_message",       db_errmsg               },
2002    {"interrupt",           db_interrupt            },
1994   {"isopen",              db_isopen               },
1995   {"last_insert_rowid",   db_last_insert_rowid    },
1996   {"changes",             db_changes              },
1997   {"total_changes",       db_total_changes        },
1998   {"errcode",             db_errcode              },
1999   {"error_code",          db_errcode              },
2000   {"errmsg",              db_errmsg               },
2001   {"error_message",       db_errmsg               },
2002   {"interrupt",           db_interrupt            },
20032003
2004    {"create_function",     db_create_function      },
2005    {"create_aggregate",    db_create_aggregate     },
2006    {"create_collation",    db_create_collation     },
2004   {"create_function",     db_create_function      },
2005   {"create_aggregate",    db_create_aggregate     },
2006   {"create_collation",    db_create_collation     },
20072007
2008    {"trace",               db_trace                },
2009    {"progress_handler",    db_progress_handler     },
2010    {"busy_timeout",        db_busy_timeout         },
2011    {"busy_handler",        db_busy_handler         },
2008   {"trace",               db_trace                },
2009   {"progress_handler",    db_progress_handler     },
2010   {"busy_timeout",        db_busy_timeout         },
2011   {"busy_handler",        db_busy_handler         },
20122012#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK
2013    {"update_hook",         db_update_hook          },
2014    {"commit_hook",         db_commit_hook          },
2015    {"rollback_hook",       db_rollback_hook        },
2013   {"update_hook",         db_update_hook          },
2014   {"commit_hook",         db_commit_hook          },
2015   {"rollback_hook",       db_rollback_hook        },
20162016#endif
20172017
2018    {"prepare",             db_prepare              },
2019    {"rows",                db_rows                 },
2020    {"urows",               db_urows                },
2021    {"nrows",               db_nrows                },
2018   {"prepare",             db_prepare              },
2019   {"rows",                db_rows                 },
2020   {"urows",               db_urows                },
2021   {"nrows",               db_nrows                },
20222022
2023    {"exec",                db_exec                 },
2024    {"execute",             db_exec                 },
2025    {"close",               db_close                },
2026    {"close_vm",            db_close_vm             },
2023   {"exec",                db_exec                 },
2024   {"execute",             db_exec                 },
2025   {"close",               db_close                },
2026   {"close_vm",            db_close_vm             },
20272027
2028    {"__tostring",          db_tostring             },
2029    {"__gc",                db_gc                   },
2028   {"__tostring",          db_tostring             },
2029   {"__gc",                db_gc                   },
20302030
2031    {NULL, NULL}
2031   {NULL, NULL}
20322032};
20332033
20342034static const luaL_Reg vmlib[] = {
2035    {"isopen",              dbvm_isopen             },
2035   {"isopen",              dbvm_isopen             },
20362036
2037    {"step",                dbvm_step               },
2038    {"reset",               dbvm_reset              },
2039    {"finalize",            dbvm_finalize           },
2037   {"step",                dbvm_step               },
2038   {"reset",               dbvm_reset              },
2039   {"finalize",            dbvm_finalize           },
20402040
2041    {"columns",             dbvm_columns            },
2041   {"columns",             dbvm_columns            },
20422042
2043    {"bind",                dbvm_bind               },
2044    {"bind_values",         dbvm_bind_values        },
2045    {"bind_names",          dbvm_bind_names         },
2046    {"bind_blob",           dbvm_bind_blob          },
2047    {"bind_parameter_count",dbvm_bind_parameter_count},
2048    {"bind_parameter_name", dbvm_bind_parameter_name},
2043   {"bind",                dbvm_bind               },
2044   {"bind_values",         dbvm_bind_values        },
2045   {"bind_names",          dbvm_bind_names         },
2046   {"bind_blob",           dbvm_bind_blob          },
2047   {"bind_parameter_count",dbvm_bind_parameter_count},
2048   {"bind_parameter_name", dbvm_bind_parameter_name},
20492049
2050    {"get_value",           dbvm_get_value          },
2051    {"get_values",          dbvm_get_values         },
2052    {"get_name",            dbvm_get_name           },
2053    {"get_names",           dbvm_get_names          },
2054    {"get_type",            dbvm_get_type           },
2055    {"get_types",           dbvm_get_types          },
2056    {"get_uvalues",         dbvm_get_uvalues        },
2057    {"get_unames",          dbvm_get_unames         },
2058    {"get_utypes",          dbvm_get_utypes         },
2050   {"get_value",           dbvm_get_value          },
2051   {"get_values",          dbvm_get_values         },
2052   {"get_name",            dbvm_get_name           },
2053   {"get_names",           dbvm_get_names          },
2054   {"get_type",            dbvm_get_type           },
2055   {"get_types",           dbvm_get_types          },
2056   {"get_uvalues",         dbvm_get_uvalues        },
2057   {"get_unames",          dbvm_get_unames         },
2058   {"get_utypes",          dbvm_get_utypes         },
20592059
2060    {"get_named_values",    dbvm_get_named_values   },
2061    {"get_named_types",     dbvm_get_named_types    },
2060   {"get_named_values",    dbvm_get_named_values   },
2061   {"get_named_types",     dbvm_get_named_types    },
20622062
2063    {"rows",                dbvm_rows               },
2064    {"urows",               dbvm_urows              },
2065    {"nrows",               dbvm_nrows              },
2063   {"rows",                dbvm_rows               },
2064   {"urows",               dbvm_urows              },
2065   {"nrows",               dbvm_nrows              },
20662066
2067    /* compatibility names (added by request) */
2068    {"idata",               dbvm_get_values         },
2069    {"inames",              dbvm_get_names          },
2070    {"itypes",              dbvm_get_types          },
2071    {"data",                dbvm_get_named_values   },
2072    {"type",                dbvm_get_named_types    },
2067   /* compatibility names (added by request) */
2068   {"idata",               dbvm_get_values         },
2069   {"inames",              dbvm_get_names          },
2070   {"itypes",              dbvm_get_types          },
2071   {"data",                dbvm_get_named_values   },
2072   {"type",                dbvm_get_named_types    },
20732073
2074    {"__tostring",          dbvm_tostring           },
2075    {"__gc",                dbvm_gc                 },
2074   {"__tostring",          dbvm_tostring           },
2075   {"__gc",                dbvm_gc                 },
20762076
2077    { NULL, NULL }
2077   { NULL, NULL }
20782078};
20792079
20802080static const luaL_Reg ctxlib[] = {
2081    {"user_data",               lcontext_user_data              },
2081   {"user_data",               lcontext_user_data              },
20822082
2083    {"get_aggregate_data",      lcontext_get_aggregate_context  },
2084    {"set_aggregate_data",      lcontext_set_aggregate_context  },
2085    {"aggregate_count",         lcontext_aggregate_count        },
2083   {"get_aggregate_data",      lcontext_get_aggregate_context  },
2084   {"set_aggregate_data",      lcontext_set_aggregate_context  },
2085   {"aggregate_count",         lcontext_aggregate_count        },
20862086
2087    {"result",                  lcontext_result                 },
2088    {"result_null",             lcontext_result_null            },
2089    {"result_number",           lcontext_result_double          },
2090    {"result_double",           lcontext_result_double          },
2091    {"result_int",              lcontext_result_int             },
2092    {"result_text",             lcontext_result_text            },
2093    {"result_blob",             lcontext_result_blob            },
2094    {"result_error",            lcontext_result_error           },
2087   {"result",                  lcontext_result                 },
2088   {"result_null",             lcontext_result_null            },
2089   {"result_number",           lcontext_result_double          },
2090   {"result_double",           lcontext_result_double          },
2091   {"result_int",              lcontext_result_int             },
2092   {"result_text",             lcontext_result_text            },
2093   {"result_blob",             lcontext_result_blob            },
2094   {"result_error",            lcontext_result_error           },
20952095
2096    {"__tostring",              lcontext_tostring               },
2097    {NULL, NULL}
2096   {"__tostring",              lcontext_tostring               },
2097   {NULL, NULL}
20982098};
20992099
21002100static const luaL_Reg sqlitelib[] = {
2101    {"version",         lsqlite_version         },
2102    {"complete",        lsqlite_complete        },
2101   {"version",         lsqlite_version         },
2102   {"complete",        lsqlite_complete        },
21032103#ifndef WIN32
2104    {"temp_directory",  lsqlite_temp_directory  },
2104   {"temp_directory",  lsqlite_temp_directory  },
21052105#endif
2106    {"open",            lsqlite_open            },
2107    {"open_memory",     lsqlite_open_memory     },
2106   {"open",            lsqlite_open            },
2107   {"open_memory",     lsqlite_open_memory     },
21082108
2109    {"__newindex",      lsqlite_newindex        },
2110    {NULL, NULL}
2109   {"__newindex",      lsqlite_newindex        },
2110   {NULL, NULL}
21112111};
21122112
21132113static void create_meta(lua_State *L, const char *name, const luaL_Reg *lib) {
2114    luaL_newmetatable(L, name);
2115    lua_pushstring(L, "__index");
2116    lua_pushvalue(L, -2);               /* push metatable */
2117    lua_rawset(L, -3);                  /* metatable.__index = metatable */
2114   luaL_newmetatable(L, name);
2115   lua_pushstring(L, "__index");
2116   lua_pushvalue(L, -2);               /* push metatable */
2117   lua_rawset(L, -3);                  /* metatable.__index = metatable */
21182118
2119    /* register metatable functions */
2120    luaL_openlib(L, NULL, lib, 0);
2119   /* register metatable functions */
2120   luaL_openlib(L, NULL, lib, 0);
21212121
2122    /* remove metatable from stack */
2123    lua_pop(L, 1);
2122   /* remove metatable from stack */
2123   lua_pop(L, 1);
21242124}
21252125
21262126static int luaopen_sqlite3 ( lua_State * L )
r31373r31374
21302130}
21312131
21322132LUALIB_API int luaopen_lsqlite3(lua_State *L) {
2133    create_meta(L, sqlite_meta, dblib);
2134    create_meta(L, sqlite_vm_meta, vmlib);
2135    create_meta(L, sqlite_ctx_meta, ctxlib);
2133   create_meta(L, sqlite_meta, dblib);
2134   create_meta(L, sqlite_vm_meta, vmlib);
2135   create_meta(L, sqlite_ctx_meta, ctxlib);
21362136
2137    luaL_getmetatable(L, sqlite_ctx_meta);
2138    sqlite_ctx_meta_ref = luaL_ref(L, LUA_REGISTRYINDEX);
2139    /* register (local) sqlite metatable */
2140    //luaL_register(L, "sqlite3", sqlitelib);
2137   luaL_getmetatable(L, sqlite_ctx_meta);
2138   sqlite_ctx_meta_ref = luaL_ref(L, LUA_REGISTRYINDEX);
2139   /* register (local) sqlite metatable */
2140   //luaL_register(L, "sqlite3", sqlitelib);
21412141   luaL_requiref(L, "sqlite3", luaopen_sqlite3, 1);
2142    {
2143        int i = 0;
2144        /* add constants to global table */
2145        while (sqlite_constants[i].name) {
2146            lua_pushstring(L, sqlite_constants[i].name);
2147            lua_pushnumber(L, sqlite_constants[i].value);
2148            lua_rawset(L, -3);
2149            ++i;
2150        }
2151    }
2152    /* set sqlite's metatable to itself - set as readonly (__newindex) */
2153    lua_pushvalue(L, -1);
2154    lua_setmetatable(L, -2);
2142   {
2143      int i = 0;
2144      /* add constants to global table */
2145      while (sqlite_constants[i].name) {
2146         lua_pushstring(L, sqlite_constants[i].name);
2147         lua_pushnumber(L, sqlite_constants[i].value);
2148         lua_rawset(L, -3);
2149         ++i;
2150      }
2151   }
2152   /* set sqlite's metatable to itself - set as readonly (__newindex) */
2153   lua_pushvalue(L, -1);
2154   lua_setmetatable(L, -2);
21552155
2156    return 1;
2156   return 1;
21572157}
trunk/src/lib/lua/ldblib.c
r31373r31374
1818#include "lualib.h"
1919
2020
21#define HOOKKEY      "_HKEY"
21#define HOOKKEY     "_HKEY"
2222
2323
2424
2525static int db_getregistry (lua_State *L) {
26  lua_pushvalue(L, LUA_REGISTRYINDEX);
27  return 1;
26   lua_pushvalue(L, LUA_REGISTRYINDEX);
27   return 1;
2828}
2929
3030
3131static int db_getmetatable (lua_State *L) {
32  luaL_checkany(L, 1);
33  if (!lua_getmetatable(L, 1)) {
34    lua_pushnil(L);  /* no metatable */
35  }
36  return 1;
32   luaL_checkany(L, 1);
33   if (!lua_getmetatable(L, 1)) {
34   lua_pushnil(L);  /* no metatable */
35   }
36   return 1;
3737}
3838
3939
4040static int db_setmetatable (lua_State *L) {
41  int t = lua_type(L, 2);
42  luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
43                    "nil or table expected");
44  lua_settop(L, 2);
45  lua_setmetatable(L, 1);
46  return 1;  /* return 1st argument */
41   int t = lua_type(L, 2);
42   luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
43               "nil or table expected");
44   lua_settop(L, 2);
45   lua_setmetatable(L, 1);
46   return 1;  /* return 1st argument */
4747}
4848
4949
5050static int db_getuservalue (lua_State *L) {
51  if (lua_type(L, 1) != LUA_TUSERDATA)
52    lua_pushnil(L);
53  else
54    lua_getuservalue(L, 1);
55  return 1;
51   if (lua_type(L, 1) != LUA_TUSERDATA)
52   lua_pushnil(L);
53   else
54   lua_getuservalue(L, 1);
55   return 1;
5656}
5757
5858
5959static int db_setuservalue (lua_State *L) {
60  if (lua_type(L, 1) == LUA_TLIGHTUSERDATA)
61    luaL_argerror(L, 1, "full userdata expected, got light userdata");
62  luaL_checktype(L, 1, LUA_TUSERDATA);
63  if (!lua_isnoneornil(L, 2))
64    luaL_checktype(L, 2, LUA_TTABLE);
65  lua_settop(L, 2);
66  lua_setuservalue(L, 1);
67  return 1;
60   if (lua_type(L, 1) == LUA_TLIGHTUSERDATA)
61   luaL_argerror(L, 1, "full userdata expected, got light userdata");
62   luaL_checktype(L, 1, LUA_TUSERDATA);
63   if (!lua_isnoneornil(L, 2))
64   luaL_checktype(L, 2, LUA_TTABLE);
65   lua_settop(L, 2);
66   lua_setuservalue(L, 1);
67   return 1;
6868}
6969
7070
7171static void settabss (lua_State *L, const char *i, const char *v) {
72  lua_pushstring(L, v);
73  lua_setfield(L, -2, i);
72   lua_pushstring(L, v);
73   lua_setfield(L, -2, i);
7474}
7575
7676
7777static void settabsi (lua_State *L, const char *i, int v) {
78  lua_pushinteger(L, v);
79  lua_setfield(L, -2, i);
78   lua_pushinteger(L, v);
79   lua_setfield(L, -2, i);
8080}
8181
8282
8383static void settabsb (lua_State *L, const char *i, int v) {
84  lua_pushboolean(L, v);
85  lua_setfield(L, -2, i);
84   lua_pushboolean(L, v);
85   lua_setfield(L, -2, i);
8686}
8787
8888
8989static lua_State *getthread (lua_State *L, int *arg) {
90  if (lua_isthread(L, 1)) {
91    *arg = 1;
92    return lua_tothread(L, 1);
93  }
94  else {
95    *arg = 0;
96    return L;
97  }
90   if (lua_isthread(L, 1)) {
91   *arg = 1;
92   return lua_tothread(L, 1);
93   }
94   else {
95   *arg = 0;
96   return L;
97   }
9898}
9999
100100
101101static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) {
102  if (L == L1) {
103    lua_pushvalue(L, -2);
104    lua_remove(L, -3);
105  }
106  else
107    lua_xmove(L1, L, 1);
108  lua_setfield(L, -2, fname);
102   if (L == L1) {
103   lua_pushvalue(L, -2);
104   lua_remove(L, -3);
105   }
106   else
107   lua_xmove(L1, L, 1);
108   lua_setfield(L, -2, fname);
109109}
110110
111111
112112static int db_getinfo (lua_State *L) {
113  lua_Debug ar;
114  int arg;
115  lua_State *L1 = getthread(L, &arg);
116  const char *options = luaL_optstring(L, arg+2, "flnStu");
117  if (lua_isnumber(L, arg+1)) {
118    if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) {
119      lua_pushnil(L);  /* level out of range */
120      return 1;
121    }
122  }
123  else if (lua_isfunction(L, arg+1)) {
124    lua_pushfstring(L, ">%s", options);
125    options = lua_tostring(L, -1);
126    lua_pushvalue(L, arg+1);
127    lua_xmove(L, L1, 1);
128  }
129  else
130    return luaL_argerror(L, arg+1, "function or level expected");
131  if (!lua_getinfo(L1, options, &ar))
132    return luaL_argerror(L, arg+2, "invalid option");
133  lua_createtable(L, 0, 2);
134  if (strchr(options, 'S')) {
135    settabss(L, "source", ar.source);
136    settabss(L, "short_src", ar.short_src);
137    settabsi(L, "linedefined", ar.linedefined);
138    settabsi(L, "lastlinedefined", ar.lastlinedefined);
139    settabss(L, "what", ar.what);
140  }
141  if (strchr(options, 'l'))
142    settabsi(L, "currentline", ar.currentline);
143  if (strchr(options, 'u')) {
144    settabsi(L, "nups", ar.nups);
145    settabsi(L, "nparams", ar.nparams);
146    settabsb(L, "isvararg", ar.isvararg);
147  }
148  if (strchr(options, 'n')) {
149    settabss(L, "name", ar.name);
150    settabss(L, "namewhat", ar.namewhat);
151  }
152  if (strchr(options, 't'))
153    settabsb(L, "istailcall", ar.istailcall);
154  if (strchr(options, 'L'))
155    treatstackoption(L, L1, "activelines");
156  if (strchr(options, 'f'))
157    treatstackoption(L, L1, "func");
158  return 1;  /* return table */
113   lua_Debug ar;
114   int arg;
115   lua_State *L1 = getthread(L, &arg);
116   const char *options = luaL_optstring(L, arg+2, "flnStu");
117   if (lua_isnumber(L, arg+1)) {
118   if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) {
119      lua_pushnil(L);  /* level out of range */
120      return 1;
121   }
122   }
123   else if (lua_isfunction(L, arg+1)) {
124   lua_pushfstring(L, ">%s", options);
125   options = lua_tostring(L, -1);
126   lua_pushvalue(L, arg+1);
127   lua_xmove(L, L1, 1);
128   }
129   else
130   return luaL_argerror(L, arg+1, "function or level expected");
131   if (!lua_getinfo(L1, options, &ar))
132   return luaL_argerror(L, arg+2, "invalid option");
133   lua_createtable(L, 0, 2);
134   if (strchr(options, 'S')) {
135   settabss(L, "source", ar.source);
136   settabss(L, "short_src", ar.short_src);
137   settabsi(L, "linedefined", ar.linedefined);
138   settabsi(L, "lastlinedefined", ar.lastlinedefined);
139   settabss(L, "what", ar.what);
140   }
141   if (strchr(options, 'l'))
142   settabsi(L, "currentline", ar.currentline);
143   if (strchr(options, 'u')) {
144   settabsi(L, "nups", ar.nups);
145   settabsi(L, "nparams", ar.nparams);
146   settabsb(L, "isvararg", ar.isvararg);
147   }
148   if (strchr(options, 'n')) {
149   settabss(L, "name", ar.name);
150   settabss(L, "namewhat", ar.namewhat);
151   }
152   if (strchr(options, 't'))
153   settabsb(L, "istailcall", ar.istailcall);
154   if (strchr(options, 'L'))
155   treatstackoption(L, L1, "activelines");
156   if (strchr(options, 'f'))
157   treatstackoption(L, L1, "func");
158   return 1;  /* return table */
159159}
160160
161161
162162static int db_getlocal (lua_State *L) {
163  int arg;
164  lua_State *L1 = getthread(L, &arg);
165  lua_Debug ar;
166  const char *name;
167  int nvar = luaL_checkint(L, arg+2);  /* local-variable index */
168  if (lua_isfunction(L, arg + 1)) {  /* function argument? */
169    lua_pushvalue(L, arg + 1);  /* push function */
170    lua_pushstring(L, lua_getlocal(L, NULL, nvar));  /* push local name */
171    return 1;
172  }
173  else {  /* stack-level argument */
174    if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar))  /* out of range? */
175      return luaL_argerror(L, arg+1, "level out of range");
176    name = lua_getlocal(L1, &ar, nvar);
177    if (name) {
178      lua_xmove(L1, L, 1);  /* push local value */
179      lua_pushstring(L, name);  /* push name */
180      lua_pushvalue(L, -2);  /* re-order */
181      return 2;
182    }
183    else {
184      lua_pushnil(L);  /* no name (nor value) */
185      return 1;
186    }
187  }
163   int arg;
164   lua_State *L1 = getthread(L, &arg);
165   lua_Debug ar;
166   const char *name;
167   int nvar = luaL_checkint(L, arg+2);  /* local-variable index */
168   if (lua_isfunction(L, arg + 1)) {  /* function argument? */
169   lua_pushvalue(L, arg + 1);  /* push function */
170   lua_pushstring(L, lua_getlocal(L, NULL, nvar));  /* push local name */
171   return 1;
172   }
173   else {  /* stack-level argument */
174   if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar))  /* out of range? */
175      return luaL_argerror(L, arg+1, "level out of range");
176   name = lua_getlocal(L1, &ar, nvar);
177   if (name) {
178      lua_xmove(L1, L, 1);  /* push local value */
179      lua_pushstring(L, name);  /* push name */
180      lua_pushvalue(L, -2);  /* re-order */
181      return 2;
182   }
183   else {
184      lua_pushnil(L);  /* no name (nor value) */
185      return 1;
186   }
187   }
188188}
189189
190190
191191static int db_setlocal (lua_State *L) {
192  int arg;
193  lua_State *L1 = getthread(L, &arg);
194  lua_Debug ar;
195  if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar))  /* out of range? */
196    return luaL_argerror(L, arg+1, "level out of range");
197  luaL_checkany(L, arg+3);
198  lua_settop(L, arg+3);
199  lua_xmove(L, L1, 1);
200  lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2)));
201  return 1;
192   int arg;
193   lua_State *L1 = getthread(L, &arg);
194   lua_Debug ar;
195   if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar))  /* out of range? */
196   return luaL_argerror(L, arg+1, "level out of range");
197   luaL_checkany(L, arg+3);
198   lua_settop(L, arg+3);
199   lua_xmove(L, L1, 1);
200   lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2)));
201   return 1;
202202}
203203
204204
205205static int auxupvalue (lua_State *L, int get) {
206  const char *name;
207  int n = luaL_checkint(L, 2);
208  luaL_checktype(L, 1, LUA_TFUNCTION);
209  name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n);
210  if (name == NULL) return 0;
211  lua_pushstring(L, name);
212  lua_insert(L, -(get+1));
213  return get + 1;
206   const char *name;
207   int n = luaL_checkint(L, 2);
208   luaL_checktype(L, 1, LUA_TFUNCTION);
209   name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n);
210   if (name == NULL) return 0;
211   lua_pushstring(L, name);
212   lua_insert(L, -(get+1));
213   return get + 1;
214214}
215215
216216
217217static int db_getupvalue (lua_State *L) {
218  return auxupvalue(L, 1);
218   return auxupvalue(L, 1);
219219}
220220
221221
222222static int db_setupvalue (lua_State *L) {
223  luaL_checkany(L, 3);
224  return auxupvalue(L, 0);
223   luaL_checkany(L, 3);
224   return auxupvalue(L, 0);
225225}
226226
227227
228228static int checkupval (lua_State *L, int argf, int argnup) {
229  lua_Debug ar;
230  int nup = luaL_checkint(L, argnup);
231  luaL_checktype(L, argf, LUA_TFUNCTION);
232  lua_pushvalue(L, argf);
233  lua_getinfo(L, ">u", &ar);
234  luaL_argcheck(L, 1 <= nup && nup <= ar.nups, argnup, "invalid upvalue index");
235  return nup;
229   lua_Debug ar;
230   int nup = luaL_checkint(L, argnup);
231   luaL_checktype(L, argf, LUA_TFUNCTION);
232   lua_pushvalue(L, argf);
233   lua_getinfo(L, ">u", &ar);
234   luaL_argcheck(L, 1 <= nup && nup <= ar.nups, argnup, "invalid upvalue index");
235   return nup;
236236}
237237
238238
239239static int db_upvalueid (lua_State *L) {
240  int n = checkupval(L, 1, 2);
241  lua_pushlightuserdata(L, lua_upvalueid(L, 1, n));
242  return 1;
240   int n = checkupval(L, 1, 2);
241   lua_pushlightuserdata(L, lua_upvalueid(L, 1, n));
242   return 1;
243243}
244244
245245
246246static int db_upvaluejoin (lua_State *L) {
247  int n1 = checkupval(L, 1, 2);
248  int n2 = checkupval(L, 3, 4);
249  luaL_argcheck(L, !lua_iscfunction(L, 1), 1, "Lua function expected");
250  luaL_argcheck(L, !lua_iscfunction(L, 3), 3, "Lua function expected");
251  lua_upvaluejoin(L, 1, n1, 3, n2);
252  return 0;
247   int n1 = checkupval(L, 1, 2);
248   int n2 = checkupval(L, 3, 4);
249   luaL_argcheck(L, !lua_iscfunction(L, 1), 1, "Lua function expected");
250   luaL_argcheck(L, !lua_iscfunction(L, 3), 3, "Lua function expected");
251   lua_upvaluejoin(L, 1, n1, 3, n2);
252   return 0;
253253}
254254
255255
256#define gethooktable(L)   luaL_getsubtable(L, LUA_REGISTRYINDEX, HOOKKEY)
256#define gethooktable(L) luaL_getsubtable(L, LUA_REGISTRYINDEX, HOOKKEY)
257257
258258
259259static void hookf (lua_State *L, lua_Debug *ar) {
260  static const char *const hooknames[] =
261    {"call", "return", "line", "count", "tail call"};
262  gethooktable(L);
263  lua_pushthread(L);
264  lua_rawget(L, -2);
265  if (lua_isfunction(L, -1)) {
266    lua_pushstring(L, hooknames[(int)ar->event]);
267    if (ar->currentline >= 0)
268      lua_pushinteger(L, ar->currentline);
269    else lua_pushnil(L);
270    lua_assert(lua_getinfo(L, "lS", ar));
271    lua_call(L, 2, 0);
272  }
260   static const char *const hooknames[] =
261   {"call", "return", "line", "count", "tail call"};
262   gethooktable(L);
263   lua_pushthread(L);
264   lua_rawget(L, -2);
265   if (lua_isfunction(L, -1)) {
266   lua_pushstring(L, hooknames[(int)ar->event]);
267   if (ar->currentline >= 0)
268      lua_pushinteger(L, ar->currentline);
269   else lua_pushnil(L);
270   lua_assert(lua_getinfo(L, "lS", ar));
271   lua_call(L, 2, 0);
272   }
273273}
274274
275275
276276static int makemask (const char *smask, int count) {
277  int mask = 0;
278  if (strchr(smask, 'c')) mask |= LUA_MASKCALL;
279  if (strchr(smask, 'r')) mask |= LUA_MASKRET;
280  if (strchr(smask, 'l')) mask |= LUA_MASKLINE;
281  if (count > 0) mask |= LUA_MASKCOUNT;
282  return mask;
277   int mask = 0;
278   if (strchr(smask, 'c')) mask |= LUA_MASKCALL;
279   if (strchr(smask, 'r')) mask |= LUA_MASKRET;
280   if (strchr(smask, 'l')) mask |= LUA_MASKLINE;
281   if (count > 0) mask |= LUA_MASKCOUNT;
282   return mask;
283283}
284284
285285
286286static char *unmakemask (int mask, char *smask) {
287  int i = 0;
288  if (mask & LUA_MASKCALL) smask[i++] = 'c';
289  if (mask & LUA_MASKRET) smask[i++] = 'r';
290  if (mask & LUA_MASKLINE) smask[i++] = 'l';
291  smask[i] = '\0';
292  return smask;
287   int i = 0;
288   if (mask & LUA_MASKCALL) smask[i++] = 'c';
289   if (mask & LUA_MASKRET) smask[i++] = 'r';
290   if (mask & LUA_MASKLINE) smask[i++] = 'l';
291   smask[i] = '\0';
292   return smask;
293293}
294294
295295
296296static int db_sethook (lua_State *L) {
297  int arg, mask, count;
298  lua_Hook func;
299  lua_State *L1 = getthread(L, &arg);
300  if (lua_isnoneornil(L, arg+1)) {
301    lua_settop(L, arg+1);
302    func = NULL; mask = 0; count = 0;  /* turn off hooks */
303  }
304  else {
305    const char *smask = luaL_checkstring(L, arg+2);
306    luaL_checktype(L, arg+1, LUA_TFUNCTION);
307    count = luaL_optint(L, arg+3, 0);
308    func = hookf; mask = makemask(smask, count);
309  }
310  if (gethooktable(L) == 0) {  /* creating hook table? */
311    lua_pushstring(L, "k");
312    lua_setfield(L, -2, "__mode");  /** hooktable.__mode = "k" */
313    lua_pushvalue(L, -1);
314    lua_setmetatable(L, -2);  /* setmetatable(hooktable) = hooktable */
315  }
316  lua_pushthread(L1); lua_xmove(L1, L, 1);
317  lua_pushvalue(L, arg+1);
318  lua_rawset(L, -3);  /* set new hook */
319  lua_sethook(L1, func, mask, count);  /* set hooks */
320  return 0;
297   int arg, mask, count;
298   lua_Hook func;
299   lua_State *L1 = getthread(L, &arg);
300   if (lua_isnoneornil(L, arg+1)) {
301   lua_settop(L, arg+1);
302   func = NULL; mask = 0; count = 0;  /* turn off hooks */
303   }
304   else {
305   const char *smask = luaL_checkstring(L, arg+2);
306   luaL_checktype(L, arg+1, LUA_TFUNCTION);
307   count = luaL_optint(L, arg+3, 0);
308   func = hookf; mask = makemask(smask, count);
309   }
310   if (gethooktable(L) == 0) {  /* creating hook table? */
311   lua_pushstring(L, "k");
312   lua_setfield(L, -2, "__mode");  /** hooktable.__mode = "k" */
313   lua_pushvalue(L, -1);
314   lua_setmetatable(L, -2);  /* setmetatable(hooktable) = hooktable */
315   }
316   lua_pushthread(L1); lua_xmove(L1, L, 1);
317   lua_pushvalue(L, arg+1);
318   lua_rawset(L, -3);  /* set new hook */
319   lua_sethook(L1, func, mask, count);  /* set hooks */
320   return 0;
321321}
322322
323323
324324static int db_gethook (lua_State *L) {
325  int arg;
326  lua_State *L1 = getthread(L, &arg);
327  char buff[5];
328  int mask = lua_gethookmask(L1);
329  lua_Hook hook = lua_gethook(L1);
330  if (hook != NULL && hook != hookf)  /* external hook? */
331    lua_pushliteral(L, "external hook");
332  else {
333    gethooktable(L);
334    lua_pushthread(L1); lua_xmove(L1, L, 1);
335    lua_rawget(L, -2);   /* get hook */
336    lua_remove(L, -2);  /* remove hook table */
337  }
338  lua_pushstring(L, unmakemask(mask, buff));
339  lua_pushinteger(L, lua_gethookcount(L1));
340  return 3;
325   int arg;
326   lua_State *L1 = getthread(L, &arg);
327   char buff[5];
328   int mask = lua_gethookmask(L1);
329   lua_Hook hook = lua_gethook(L1);
330   if (hook != NULL && hook != hookf)  /* external hook? */
331   lua_pushliteral(L, "external hook");
332   else {
333   gethooktable(L);
334   lua_pushthread(L1); lua_xmove(L1, L, 1);
335   lua_rawget(L, -2);   /* get hook */
336   lua_remove(L, -2);  /* remove hook table */
337   }
338   lua_pushstring(L, unmakemask(mask, buff));
339   lua_pushinteger(L, lua_gethookcount(L1));
340   return 3;
341341}
342342
343343
344344static int db_debug (lua_State *L) {
345  for (;;) {
346    char buffer[250];
347    luai_writestringerror("%s", "lua_debug> ");
348    if (fgets(buffer, sizeof(buffer), stdin) == 0 ||
349        strcmp(buffer, "cont\n") == 0)
350      return 0;
351    if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") ||
352        lua_pcall(L, 0, 0, 0))
353      luai_writestringerror("%s\n", lua_tostring(L, -1));
354    lua_settop(L, 0);  /* remove eventual returns */
355  }
345   for (;;) {
346   char buffer[250];
347   luai_writestringerror("%s", "lua_debug> ");
348   if (fgets(buffer, sizeof(buffer), stdin) == 0 ||
349      strcmp(buffer, "cont\n") == 0)
350      return 0;
351   if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") ||
352      lua_pcall(L, 0, 0, 0))
353      luai_writestringerror("%s\n", lua_tostring(L, -1));
354   lua_settop(L, 0);  /* remove eventual returns */
355   }
356356}
357357
358358
359359static int db_traceback (lua_State *L) {
360  int arg;
361  lua_State *L1 = getthread(L, &arg);
362  const char *msg = lua_tostring(L, arg + 1);
363  if (msg == NULL && !lua_isnoneornil(L, arg + 1))  /* non-string 'msg'? */
364    lua_pushvalue(L, arg + 1);  /* return it untouched */
365  else {
366    int level = luaL_optint(L, arg + 2, (L == L1) ? 1 : 0);
367    luaL_traceback(L, L1, msg, level);
368  }
369  return 1;
360   int arg;
361   lua_State *L1 = getthread(L, &arg);
362   const char *msg = lua_tostring(L, arg + 1);
363   if (msg == NULL && !lua_isnoneornil(L, arg + 1))  /* non-string 'msg'? */
364   lua_pushvalue(L, arg + 1);  /* return it untouched */
365   else {
366   int level = luaL_optint(L, arg + 2, (L == L1) ? 1 : 0);
367   luaL_traceback(L, L1, msg, level);
368   }
369   return 1;
370370}
371371
372372
373373static const luaL_Reg dblib[] = {
374  {"debug", db_debug},
375  {"getuservalue", db_getuservalue},
376  {"gethook", db_gethook},
377  {"getinfo", db_getinfo},
378  {"getlocal", db_getlocal},
379  {"getregistry", db_getregistry},
380  {"getmetatable", db_getmetatable},
381  {"getupvalue", db_getupvalue},
382  {"upvaluejoin", db_upvaluejoin},
383  {"upvalueid", db_upvalueid},
384  {"setuservalue", db_setuservalue},
385  {"sethook", db_sethook},
386  {"setlocal", db_setlocal},
387  {"setmetatable", db_setmetatable},
388  {"setupvalue", db_setupvalue},
389  {"traceback", db_traceback},
390  {NULL, NULL}
374   {"debug", db_debug},
375   {"getuservalue", db_getuservalue},
376   {"gethook", db_gethook},
377   {"getinfo", db_getinfo},
378   {"getlocal", db_getlocal},
379   {"getregistry", db_getregistry},
380   {"getmetatable", db_getmetatable},
381   {"getupvalue", db_getupvalue},
382   {"upvaluejoin", db_upvaluejoin},
383   {"upvalueid", db_upvalueid},
384   {"setuservalue", db_setuservalue},
385   {"sethook", db_sethook},
386   {"setlocal", db_setlocal},
387   {"setmetatable", db_setmetatable},
388   {"setupvalue", db_setupvalue},
389   {"traceback", db_traceback},
390   {NULL, NULL}
391391};
392392
393393
394394LUAMOD_API int luaopen_debug (lua_State *L) {
395  luaL_newlib(L, dblib);
396  return 1;
395   luaL_newlib(L, dblib);
396   return 1;
397397}
398
trunk/src/lib/lua/lmem.c
r31373r31374
4040
4141
4242
43#define MINSIZEARRAY   4
43#define MINSIZEARRAY    4
4444
4545
4646void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems,
47                     int limit, const char *what) {
48  void *newblock;
49  int newsize;
50  if (*size >= limit/2) {  /* cannot double it? */
51    if (*size >= limit)  /* cannot grow even a little? */
52      luaG_runerror(L, "too many %s (limit is %d)", what, limit);
53    newsize = limit;  /* still have at least one free place */
54  }
55  else {
56    newsize = (*size)*2;
57    if (newsize < MINSIZEARRAY)
58      newsize = MINSIZEARRAY;  /* minimum size */
59  }
60  newblock = luaM_reallocv(L, block, *size, newsize, size_elems);
61  *size = newsize;  /* update only when everything else is OK */
62  return newblock;
47                  int limit, const char *what) {
48   void *newblock;
49   int newsize;
50   if (*size >= limit/2) {  /* cannot double it? */
51   if (*size >= limit)  /* cannot grow even a little? */
52      luaG_runerror(L, "too many %s (limit is %d)", what, limit);
53   newsize = limit;  /* still have at least one free place */
54   }
55   else {
56   newsize = (*size)*2;
57   if (newsize < MINSIZEARRAY)
58      newsize = MINSIZEARRAY;  /* minimum size */
59   }
60   newblock = luaM_reallocv(L, block, *size, newsize, size_elems);
61   *size = newsize;  /* update only when everything else is OK */
62   return newblock;
6363}
6464
6565
6666l_noret luaM_toobig (lua_State *L) {
67  luaG_runerror(L, "memory allocation error: block too big");
67   luaG_runerror(L, "memory allocation error: block too big");
6868}
6969
7070
r31373r31374
7373** generic allocation routine.
7474*/
7575void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
76  void *newblock;
77  global_State *g = G(L);
78  size_t realosize = (block) ? osize : 0;
79  lua_assert((realosize == 0) == (block == NULL));
76   void *newblock;
77   global_State *g = G(L);
78   size_t realosize = (block) ? osize : 0;
79   lua_assert((realosize == 0) == (block == NULL));
8080#if defined(HARDMEMTESTS)
81  if (nsize > realosize && g->gcrunning)
82    luaC_fullgc(L, 1);  /* force a GC whenever possible */
81   if (nsize > realosize && g->gcrunning)
82   luaC_fullgc(L, 1);  /* force a GC whenever possible */
8383#endif
84  newblock = (*g->frealloc)(g->ud, block, osize, nsize);
85  if (newblock == NULL && nsize > 0) {
86    api_check(L, nsize > realosize,
87                 "realloc cannot fail when shrinking a block");
88    if (g->gcrunning) {
89      luaC_fullgc(L, 1);  /* try to free some memory... */
90      newblock = (*g->frealloc)(g->ud, block, osize, nsize);  /* try again */
91    }
92    if (newblock == NULL)
93      luaD_throw(L, LUA_ERRMEM);
94  }
95  lua_assert((nsize == 0) == (newblock == NULL));
96  g->GCdebt = (g->GCdebt + nsize) - realosize;
97  return newblock;
84   newblock = (*g->frealloc)(g->ud, block, osize, nsize);
85   if (newblock == NULL && nsize > 0) {
86   api_check(L, nsize > realosize,
87               "realloc cannot fail when shrinking a block");
88   if (g->gcrunning) {
89      luaC_fullgc(L, 1);  /* try to free some memory... */
90      newblock = (*g->frealloc)(g->ud, block, osize, nsize);  /* try again */
91   }
92   if (newblock == NULL)
93      luaD_throw(L, LUA_ERRMEM);
94   }
95   lua_assert((nsize == 0) == (newblock == NULL));
96   g->GCdebt = (g->GCdebt + nsize) - realosize;
97   return newblock;
9898}
99
trunk/src/lib/lua/lstate.c
r31373r31374
2727
2828
2929#if !defined(LUAI_GCPAUSE)
30#define LUAI_GCPAUSE   200  /* 200% */
30#define LUAI_GCPAUSE    200  /* 200% */
3131#endif
3232
3333#if !defined(LUAI_GCMAJOR)
34#define LUAI_GCMAJOR   200  /* 200% */
34#define LUAI_GCMAJOR    200  /* 200% */
3535#endif
3636
3737#if !defined(LUAI_GCMUL)
38#define LUAI_GCMUL   200 /* GC runs 'twice the speed' of memory allocation */
38#define LUAI_GCMUL  200 /* GC runs 'twice the speed' of memory allocation */
3939#endif
4040
4141
42#define MEMERRMSG   "not enough memory"
42#define MEMERRMSG   "not enough memory"
4343
4444
4545/*
r31373r31374
4848*/
4949#if !defined(luai_makeseed)
5050#include <time.h>
51#define luai_makeseed()      cast(unsigned int, time(NULL))
51#define luai_makeseed()     cast(unsigned int, time(NULL))
5252#endif
5353
5454
r31373r31374
5858*/
5959typedef struct LX {
6060#if defined(LUAI_EXTRASPACE)
61  char buff[LUAI_EXTRASPACE];
61   char buff[LUAI_EXTRASPACE];
6262#endif
63  lua_State l;
63   lua_State l;
6464} LX;
6565
6666
r31373r31374
6868** Main thread combines a thread state and the global state
6969*/
7070typedef struct LG {
71  LX l;
72  global_State g;
71   LX l;
72   global_State g;
7373} LG;
7474
7575
7676
77#define fromstate(L)   (cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l)))
77#define fromstate(L)    (cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l)))
7878
7979
8080/*
r31373r31374
8383** randomness..
8484*/
8585#define addbuff(b,p,e) \
86  { size_t t = cast(size_t, e); \
87    memcpy(buff + p, &t, sizeof(t)); p += sizeof(t); }
86   { size_t t = cast(size_t, e); \
87   memcpy(buff + p, &t, sizeof(t)); p += sizeof(t); }
8888
8989static unsigned int makeseed (lua_State *L) {
90  char buff[4 * sizeof(size_t)];
91  unsigned int h = luai_makeseed();
92  int p = 0;
93  addbuff(buff, p, L);  /* heap variable */
94  addbuff(buff, p, &h);  /* local variable */
95  addbuff(buff, p, luaO_nilobject);  /* global variable */
96  addbuff(buff, p, &lua_newstate);  /* public function */
97  lua_assert(p == sizeof(buff));
98  return luaS_hash(buff, p, h);
90   char buff[4 * sizeof(size_t)];
91   unsigned int h = luai_makeseed();
92   int p = 0;
93   addbuff(buff, p, L);  /* heap variable */
94   addbuff(buff, p, &h);  /* local variable */
95   addbuff(buff, p, luaO_nilobject);  /* global variable */
96   addbuff(buff, p, &lua_newstate);  /* public function */
97   lua_assert(p == sizeof(buff));
98   return luaS_hash(buff, p, h);
9999}
100100
101101
r31373r31374
104104** invariant
105105*/
106106void luaE_setdebt (global_State *g, l_mem debt) {
107  g->totalbytes -= (debt - g->GCdebt);
108  g->GCdebt = debt;
107   g->totalbytes -= (debt - g->GCdebt);
108   g->GCdebt = debt;
109109}
110110
111111
112112CallInfo *luaE_extendCI (lua_State *L) {
113  CallInfo *ci = luaM_new(L, CallInfo);
114  lua_assert(L->ci->next == NULL);
115  L->ci->next = ci;
116  ci->previous = L->ci;
117  ci->next = NULL;
118  return ci;
113   CallInfo *ci = luaM_new(L, CallInfo);
114   lua_assert(L->ci->next == NULL);
115   L->ci->next = ci;
116   ci->previous = L->ci;
117   ci->next = NULL;
118   return ci;
119119}
120120
121121
122122void luaE_freeCI (lua_State *L) {
123  CallInfo *ci = L->ci;
124  CallInfo *next = ci->next;
125  ci->next = NULL;
126  while ((ci = next) != NULL) {
127    next = ci->next;
128    luaM_free(L, ci);
129  }
123   CallInfo *ci = L->ci;
124   CallInfo *next = ci->next;
125   ci->next = NULL;
126   while ((ci = next) != NULL) {
127   next = ci->next;
128   luaM_free(L, ci);
129   }
130130}
131131
132132
133133static void stack_init (lua_State *L1, lua_State *L) {
134  int i; CallInfo *ci;
135  /* initialize stack array */
136  L1->stack = luaM_newvector(L, BASIC_STACK_SIZE, TValue);
137  L1->stacksize = BASIC_STACK_SIZE;
138  for (i = 0; i < BASIC_STACK_SIZE; i++)
139    setnilvalue(L1->stack + i);  /* erase new stack */
140  L1->top = L1->stack;
141  L1->stack_last = L1->stack + L1->stacksize - EXTRA_STACK;
142  /* initialize first ci */
143  ci = &L1->base_ci;
144  ci->next = ci->previous = NULL;
145  ci->callstatus = 0;
146  ci->func = L1->top;
147  setnilvalue(L1->top++);  /* 'function' entry for this 'ci' */
148  ci->top = L1->top + LUA_MINSTACK;
149  L1->ci = ci;
134   int i; CallInfo *ci;
135   /* initialize stack array */
136   L1->stack = luaM_newvector(L, BASIC_STACK_SIZE, TValue);
137   L1->stacksize = BASIC_STACK_SIZE;
138   for (i = 0; i < BASIC_STACK_SIZE; i++)
139   setnilvalue(L1->stack + i);  /* erase new stack */
140   L1->top = L1->stack;
141   L1->stack_last = L1->stack + L1->stacksize - EXTRA_STACK;
142   /* initialize first ci */
143   ci = &L1->base_ci;
144   ci->next = ci->previous = NULL;
145   ci->callstatus = 0;
146   ci->func = L1->top;
147   setnilvalue(L1->top++);  /* 'function' entry for this 'ci' */
148   ci->top = L1->top + LUA_MINSTACK;
149   L1->ci = ci;
150150}
151151
152152
153153static void freestack (lua_State *L) {
154  if (L->stack == NULL)
155    return;  /* stack not completely built yet */
156  L->ci = &L->base_ci;  /* free the entire 'ci' list */
157  luaE_freeCI(L);
158  luaM_freearray(L, L->stack, L->stacksize);  /* free stack array */
154   if (L->stack == NULL)
155   return;  /* stack not completely built yet */
156   L->ci = &L->base_ci;  /* free the entire 'ci' list */
157   luaE_freeCI(L);
158   luaM_freearray(L, L->stack, L->stacksize);  /* free stack array */
159159}
160160
161161
r31373r31374
163163** Create registry table and its predefined values
164164*/
165165static void init_registry (lua_State *L, global_State *g) {
166  TValue mt;
167  /* create registry */
168  Table *registry = luaH_new(L);
169  sethvalue(L, &g->l_registry, registry);
170  luaH_resize(L, registry, LUA_RIDX_LAST, 0);
171  /* registry[LUA_RIDX_MAINTHREAD] = L */
172  setthvalue(L, &mt, L);
173  luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &mt);
174  /* registry[LUA_RIDX_GLOBALS] = table of globals */
175  sethvalue(L, &mt, luaH_new(L));
176  luaH_setint(L, registry, LUA_RIDX_GLOBALS, &mt);
166   TValue mt;
167   /* create registry */
168   Table *registry = luaH_new(L);
169   sethvalue(L, &g->l_registry, registry);
170   luaH_resize(L, registry, LUA_RIDX_LAST, 0);
171   /* registry[LUA_RIDX_MAINTHREAD] = L */
172   setthvalue(L, &mt, L);
173   luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &mt);
174   /* registry[LUA_RIDX_GLOBALS] = table of globals */
175   sethvalue(L, &mt, luaH_new(L));
176   luaH_setint(L, registry, LUA_RIDX_GLOBALS, &mt);
177177}
178178
179179
r31373r31374
181181** open parts of the state that may cause memory-allocation errors
182182*/
183183static void f_luaopen (lua_State *L, void *ud) {
184  global_State *g = G(L);
185  UNUSED(ud);
186  stack_init(L, L);  /* init stack */
187  init_registry(L, g);
188  luaS_resize(L, MINSTRTABSIZE);  /* initial size of string table */
189  luaT_init(L);
190  luaX_init(L);
191  /* pre-create memory-error message */
192  g->memerrmsg = luaS_newliteral(L, MEMERRMSG);
193  luaS_fix(g->memerrmsg);  /* it should never be collected */
194  g->gcrunning = 1;  /* allow gc */
195  g->version = lua_version(NULL);
196  luai_userstateopen(L);
184   global_State *g = G(L);
185   UNUSED(ud);
186   stack_init(L, L);  /* init stack */
187   init_registry(L, g);
188   luaS_resize(L, MINSTRTABSIZE);  /* initial size of string table */
189   luaT_init(L);
190   luaX_init(L);
191   /* pre-create memory-error message */
192   g->memerrmsg = luaS_newliteral(L, MEMERRMSG);
193   luaS_fix(g->memerrmsg);  /* it should never be collected */
194   g->gcrunning = 1;  /* allow gc */
195   g->version = lua_version(NULL);
196   luai_userstateopen(L);
197197}
198198
199199
r31373r31374
202202** any memory (to avoid errors)
203203*/
204204static void preinit_state (lua_State *L, global_State *g) {
205  G(L) = g;
206  L->stack = NULL;
207  L->ci = NULL;
208  L->stacksize = 0;
209  L->errorJmp = NULL;
210  L->nCcalls = 0;
211  L->hook = NULL;
212  L->hookmask = 0;
213  L->basehookcount = 0;
214  L->allowhook = 1;
215  resethookcount(L);
216  L->openupval = NULL;
217  L->nny = 1;
218  L->status = LUA_OK;
219  L->errfunc = 0;
205   G(L) = g;
206   L->stack = NULL;
207   L->ci = NULL;
208   L->stacksize = 0;
209   L->errorJmp = NULL;
210   L->nCcalls = 0;
211   L->hook = NULL;
212   L->hookmask = 0;
213   L->basehookcount = 0;
214   L->allowhook = 1;
215   resethookcount(L);
216   L->openupval = NULL;
217   L->nny = 1;
218   L->status = LUA_OK;
219   L->errfunc = 0;
220220}
221221
222222
223223static void close_state (lua_State *L) {
224  global_State *g = G(L);
225  luaF_close(L, L->stack);  /* close all upvalues for this thread */
226  luaC_freeallobjects(L);  /* collect all objects */
227  if (g->version)  /* closing a fully built state? */
228    luai_userstateclose(L);
229  luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size);
230  luaZ_freebuffer(L, &g->buff);
231  freestack(L);
232  lua_assert(gettotalbytes(g) == sizeof(LG));
233  (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0);  /* free main block */
224   global_State *g = G(L);
225   luaF_close(L, L->stack);  /* close all upvalues for this thread */
226   luaC_freeallobjects(L);  /* collect all objects */
227   if (g->version)  /* closing a fully built state? */
228   luai_userstateclose(L);
229   luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size);
230   luaZ_freebuffer(L, &g->buff);
231   freestack(L);
232   lua_assert(gettotalbytes(g) == sizeof(LG));
233   (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0);  /* free main block */
234234}
235235
236236
237237LUA_API lua_State *lua_newthread (lua_State *L) {
238  lua_State *L1;
239  lua_lock(L);
240  luaC_checkGC(L);
241  L1 = &luaC_newobj(L, LUA_TTHREAD, sizeof(LX), NULL, offsetof(LX, l))->th;
242  setthvalue(L, L->top, L1);
243  api_incr_top(L);
244  preinit_state(L1, G(L));
245  L1->hookmask = L->hookmask;
246  L1->basehookcount = L->basehookcount;
247  L1->hook = L->hook;
248  resethookcount(L1);
249  luai_userstatethread(L, L1);
250  stack_init(L1, L);  /* init stack */
251  lua_unlock(L);
252  return L1;
238   lua_State *L1;
239   lua_lock(L);
240   luaC_checkGC(L);
241   L1 = &luaC_newobj(L, LUA_TTHREAD, sizeof(LX), NULL, offsetof(LX, l))->th;
242   setthvalue(L, L->top, L1);
243   api_incr_top(L);
244   preinit_state(L1, G(L));
245   L1->hookmask = L->hookmask;
246   L1->basehookcount = L->basehookcount;
247   L1->hook = L->hook;
248   resethookcount(L1);
249   luai_userstatethread(L, L1);
250   stack_init(L1, L);  /* init stack */
251   lua_unlock(L);
252   return L1;
253253}
254254
255255
256256void luaE_freethread (lua_State *L, lua_State *L1) {
257  LX *l = fromstate(L1);
258  luaF_close(L1, L1->stack);  /* close all upvalues for this thread */
259  lua_assert(L1->openupval == NULL);
260  luai_userstatefree(L, L1);
261  freestack(L1);
262  luaM_free(L, l);
257   LX *l = fromstate(L1);
258   luaF_close(L1, L1->stack);  /* close all upvalues for this thread */
259   lua_assert(L1->openupval == NULL);
260   luai_userstatefree(L, L1);
261   freestack(L1);
262   luaM_free(L, l);
263263}
264264
265265
266266LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
267  int i;
268  lua_State *L;
269  global_State *g;
270  LG *l = cast(LG *, (*f)(ud, NULL, LUA_TTHREAD, sizeof(LG)));
271  if (l == NULL) return NULL;
272  L = &l->l.l;
273  g = &l->g;
274  L->next = NULL;
275  L->tt = LUA_TTHREAD;
276  g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT);
277  L->marked = luaC_white(g);
278  g->gckind = KGC_NORMAL;
279  preinit_state(L, g);
280  g->frealloc = f;
281  g->ud = ud;
282  g->mainthread = L;
283  g->seed = makeseed(L);
284  g->uvhead.u.l.prev = &g->uvhead;
285  g->uvhead.u.l.next = &g->uvhead;
286  g->gcrunning = 0;  /* no GC while building state */
287  g->GCestimate = 0;
288  g->strt.size = 0;
289  g->strt.nuse = 0;
290  g->strt.hash = NULL;
291  setnilvalue(&g->l_registry);
292  luaZ_initbuffer(L, &g->buff);
293  g->panic = NULL;
294  g->version = NULL;
295  g->gcstate = GCSpause;
296  g->allgc = NULL;
297  g->finobj = NULL;
298  g->tobefnz = NULL;
299  g->sweepgc = g->sweepfin = NULL;
300  g->gray = g->grayagain = NULL;
301  g->weak = g->ephemeron = g->allweak = NULL;
302  g->totalbytes = sizeof(LG);
303  g->GCdebt = 0;
304  g->gcpause = LUAI_GCPAUSE;
305  g->gcmajorinc = LUAI_GCMAJOR;
306  g->gcstepmul = LUAI_GCMUL;
307  for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL;
308  if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) {
309    /* memory allocation error: free partial state */
310    close_state(L);
311    L = NULL;
312  }
313  return L;
267   int i;
268   lua_State *L;
269   global_State *g;
270   LG *l = cast(LG *, (*f)(ud, NULL, LUA_TTHREAD, sizeof(LG)));
271   if (l == NULL) return NULL;
272   L = &l->l.l;
273   g = &l->g;
274   L->next = NULL;
275   L->tt = LUA_TTHREAD;
276   g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT);
277   L->marked = luaC_white(g);
278   g->gckind = KGC_NORMAL;
279   preinit_state(L, g);
280   g->frealloc = f;
281   g->ud = ud;
282   g->mainthread = L;
283   g->seed = makeseed(L);
284   g->uvhead.u.l.prev = &g->uvhead;
285   g->uvhead.u.l.next = &g->uvhead;
286   g->gcrunning = 0;  /* no GC while building state */
287   g->GCestimate = 0;
288   g->strt.size = 0;
289   g->strt.nuse = 0;
290   g->strt.hash = NULL;
291   setnilvalue(&g->l_registry);
292   luaZ_initbuffer(L, &g->buff);
293   g->panic = NULL;
294   g->version = NULL;
295   g->gcstate = GCSpause;
296   g->allgc = NULL;
297   g->finobj = NULL;
298   g->tobefnz = NULL;
299   g->sweepgc = g->sweepfin = NULL;
300   g->gray = g->grayagain = NULL;
301   g->weak = g->ephemeron = g->allweak = NULL;
302   g->totalbytes = sizeof(LG);
303   g->GCdebt = 0;
304   g->gcpause = LUAI_GCPAUSE;
305   g->gcmajorinc = LUAI_GCMAJOR;
306   g->gcstepmul = LUAI_GCMUL;
307   for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL;
308   if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) {
309   /* memory allocation error: free partial state */
310   close_state(L);
311   L = NULL;
312   }
313   return L;
314314}
315315
316316
317317LUA_API void lua_close (lua_State *L) {
318  L = G(L)->mainthread;  /* only the main thread can be closed */
319  lua_lock(L);
320  close_state(L);
318   L = G(L)->mainthread;  /* only the main thread can be closed */
319   lua_lock(L);
320   close_state(L);
321321}
322
323
trunk/src/lib/lua/lmathlib.c
r31373r31374
1818
1919
2020#undef PI
21#define PI   ((lua_Number)(3.1415926535897932384626433832795))
22#define RADIANS_PER_DEGREE   ((lua_Number)(PI/180.0))
21#define PI  ((lua_Number)(3.1415926535897932384626433832795))
22#define RADIANS_PER_DEGREE  ((lua_Number)(PI/180.0))
2323
2424
2525
2626static int math_abs (lua_State *L) {
27  lua_pushnumber(L, l_mathop(fabs)(luaL_checknumber(L, 1)));
28  return 1;
27   lua_pushnumber(L, l_mathop(fabs)(luaL_checknumber(L, 1)));
28   return 1;
2929}
3030
3131static int math_sin (lua_State *L) {
32  lua_pushnumber(L, l_mathop(sin)(luaL_checknumber(L, 1)));
33  return 1;
32   lua_pushnumber(L, l_mathop(sin)(luaL_checknumber(L, 1)));
33   return 1;
3434}
3535
3636static int math_sinh (lua_State *L) {
37  lua_pushnumber(L, l_mathop(sinh)(luaL_checknumber(L, 1)));
38  return 1;
37   lua_pushnumber(L, l_mathop(sinh)(luaL_checknumber(L, 1)));
38   return 1;
3939}
4040
4141static int math_cos (lua_State *L) {
42  lua_pushnumber(L, l_mathop(cos)(luaL_checknumber(L, 1)));
43  return 1;
42   lua_pushnumber(L, l_mathop(cos)(luaL_checknumber(L, 1)));
43   return 1;
4444}
4545
4646static int math_cosh (lua_State *L) {
47  lua_pushnumber(L, l_mathop(cosh)(luaL_checknumber(L, 1)));
48  return 1;
47   lua_pushnumber(L, l_mathop(cosh)(luaL_checknumber(L, 1)));
48   return 1;
4949}
5050
5151static int math_tan (lua_State *L) {
52  lua_pushnumber(L, l_mathop(tan)(luaL_checknumber(L, 1)));
53  return 1;
52   lua_pushnumber(L, l_mathop(tan)(luaL_checknumber(L, 1)));
53   return 1;
5454}
5555
5656static int math_tanh (lua_State *L) {
57  lua_pushnumber(L, l_mathop(tanh)(luaL_checknumber(L, 1)));
58  return 1;
57   lua_pushnumber(L, l_mathop(tanh)(luaL_checknumber(L, 1)));
58   return 1;
5959}
6060
6161static int math_asin (lua_State *L) {
62  lua_pushnumber(L, l_mathop(asin)(luaL_checknumber(L, 1)));
63  return 1;
62   lua_pushnumber(L, l_mathop(asin)(luaL_checknumber(L, 1)));
63   return 1;
6464}
6565
6666static int math_acos (lua_State *L) {
67  lua_pushnumber(L, l_mathop(acos)(luaL_checknumber(L, 1)));
68  return 1;
67   lua_pushnumber(L, l_mathop(acos)(luaL_checknumber(L, 1)));
68   return 1;
6969}
7070
7171static int math_atan (lua_State *L) {
72  lua_pushnumber(L, l_mathop(atan)(luaL_checknumber(L, 1)));
73  return 1;
72   lua_pushnumber(L, l_mathop(atan)(luaL_checknumber(L, 1)));
73   return 1;
7474}
7575
7676static int math_atan2 (lua_State *L) {
77  lua_pushnumber(L, l_mathop(atan2)(luaL_checknumber(L, 1),
78                                luaL_checknumber(L, 2)));
79  return 1;
77   lua_pushnumber(L, l_mathop(atan2)(luaL_checknumber(L, 1),
78                        luaL_checknumber(L, 2)));
79   return 1;
8080}
8181
8282static int math_ceil (lua_State *L) {
83  lua_pushnumber(L, l_mathop(ceil)(luaL_checknumber(L, 1)));
84  return 1;
83   lua_pushnumber(L, l_mathop(ceil)(luaL_checknumber(L, 1)));
84   return 1;
8585}
8686
8787static int math_floor (lua_State *L) {
88  lua_pushnumber(L, l_mathop(floor)(luaL_checknumber(L, 1)));
89  return 1;
88   lua_pushnumber(L, l_mathop(floor)(luaL_checknumber(L, 1)));
89   return 1;
9090}
9191
9292static int math_fmod (lua_State *L) {
93  lua_pushnumber(L, l_mathop(fmod)(luaL_checknumber(L, 1),
94                               luaL_checknumber(L, 2)));
95  return 1;
93   lua_pushnumber(L, l_mathop(fmod)(luaL_checknumber(L, 1),
94                        luaL_checknumber(L, 2)));
95   return 1;
9696}
9797
9898static int math_modf (lua_State *L) {
99  lua_Number ip;
100  lua_Number fp = l_mathop(modf)(luaL_checknumber(L, 1), &ip);
101  lua_pushnumber(L, ip);
102  lua_pushnumber(L, fp);
103  return 2;
99   lua_Number ip;
100   lua_Number fp = l_mathop(modf)(luaL_checknumber(L, 1), &ip);
101   lua_pushnumber(L, ip);
102   lua_pushnumber(L, fp);
103   return 2;
104104}
105105
106106static int math_sqrt (lua_State *L) {
107  lua_pushnumber(L, l_mathop(sqrt)(luaL_checknumber(L, 1)));
108  return 1;
107   lua_pushnumber(L, l_mathop(sqrt)(luaL_checknumber(L, 1)));
108   return 1;
109109}
110110
111111static int math_pow (lua_State *L) {
112  lua_Number x = luaL_checknumber(L, 1);
113  lua_Number y = luaL_checknumber(L, 2);
114  lua_pushnumber(L, l_mathop(pow)(x, y));
115  return 1;
112   lua_Number x = luaL_checknumber(L, 1);
113   lua_Number y = luaL_checknumber(L, 2);
114   lua_pushnumber(L, l_mathop(pow)(x, y));
115   return 1;
116116}
117117
118118static int math_log (lua_State *L) {
119  lua_Number x = luaL_checknumber(L, 1);
120  lua_Number res;
121  if (lua_isnoneornil(L, 2))
122    res = l_mathop(log)(x);
123  else {
124    lua_Number base = luaL_checknumber(L, 2);
125    if (base == (lua_Number)10.0) res = l_mathop(log10)(x);
126    else res = l_mathop(log)(x)/l_mathop(log)(base);
127  }
128  lua_pushnumber(L, res);
129  return 1;
119   lua_Number x = luaL_checknumber(L, 1);
120   lua_Number res;
121   if (lua_isnoneornil(L, 2))
122   res = l_mathop(log)(x);
123   else {
124   lua_Number base = luaL_checknumber(L, 2);
125   if (base == (lua_Number)10.0) res = l_mathop(log10)(x);
126   else res = l_mathop(log)(x)/l_mathop(log)(base);
127   }
128   lua_pushnumber(L, res);
129   return 1;
130130}
131131
132132#if defined(LUA_COMPAT_LOG10)
133133static int math_log10 (lua_State *L) {
134  lua_pushnumber(L, l_mathop(log10)(luaL_checknumber(L, 1)));
135  return 1;
134   lua_pushnumber(L, l_mathop(log10)(luaL_checknumber(L, 1)));
135   return 1;
136136}
137137#endif
138138
139139static int math_exp (lua_State *L) {
140  lua_pushnumber(L, l_mathop(exp)(luaL_checknumber(L, 1)));
141  return 1;
140   lua_pushnumber(L, l_mathop(exp)(luaL_checknumber(L, 1)));
141   return 1;
142142}
143143
144144static int math_deg (lua_State *L) {
145  lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE);
146  return 1;
145   lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE);
146   return 1;
147147}
148148
149149static int math_rad (lua_State *L) {
150  lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE);
151  return 1;
150   lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE);
151   return 1;
152152}
153153
154154static int math_frexp (lua_State *L) {
155  int e;
156  lua_pushnumber(L, l_mathop(frexp)(luaL_checknumber(L, 1), &e));
157  lua_pushinteger(L, e);
158  return 2;
155   int e;
156   lua_pushnumber(L, l_mathop(frexp)(luaL_checknumber(L, 1), &e));
157   lua_pushinteger(L, e);
158   return 2;
159159}
160160
161161static int math_ldexp (lua_State *L) {
162  lua_Number x = luaL_checknumber(L, 1);
163  int ep = luaL_checkint(L, 2);
164  lua_pushnumber(L, l_mathop(ldexp)(x, ep));
165  return 1;
162   lua_Number x = luaL_checknumber(L, 1);
163   int ep = luaL_checkint(L, 2);
164   lua_pushnumber(L, l_mathop(ldexp)(x, ep));
165   return 1;
166166}
167167
168168
169169
170170static int math_min (lua_State *L) {
171  int n = lua_gettop(L);  /* number of arguments */
172  lua_Number dmin = luaL_checknumber(L, 1);
173  int i;
174  for (i=2; i<=n; i++) {
175    lua_Number d = luaL_checknumber(L, i);
176    if (d < dmin)
177      dmin = d;
178  }
179  lua_pushnumber(L, dmin);
180  return 1;
171   int n = lua_gettop(L);  /* number of arguments */
172   lua_Number dmin = luaL_checknumber(L, 1);
173   int i;
174   for (i=2; i<=n; i++) {
175   lua_Number d = luaL_checknumber(L, i);
176   if (d < dmin)
177      dmin = d;
178   }
179   lua_pushnumber(L, dmin);
180   return 1;
181181}
182182
183183
184184static int math_max (lua_State *L) {
185  int n = lua_gettop(L);  /* number of arguments */
186  lua_Number dmax = luaL_checknumber(L, 1);
187  int i;
188  for (i=2; i<=n; i++) {
189    lua_Number d = luaL_checknumber(L, i);
190    if (d > dmax)
191      dmax = d;
192  }
193  lua_pushnumber(L, dmax);
194  return 1;
185   int n = lua_gettop(L);  /* number of arguments */
186   lua_Number dmax = luaL_checknumber(L, 1);
187   int i;
188   for (i=2; i<=n; i++) {
189   lua_Number d = luaL_checknumber(L, i);
190   if (d > dmax)
191      dmax = d;
192   }
193   lua_pushnumber(L, dmax);
194   return 1;
195195}
196196
197197
198198static int math_random (lua_State *L) {
199  /* the `%' avoids the (rare) case of r==1, and is needed also because on
200     some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */
201  lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX;
202  switch (lua_gettop(L)) {  /* check number of arguments */
203    case 0: {  /* no arguments */
204      lua_pushnumber(L, r);  /* Number between 0 and 1 */
205      break;
206    }
207    case 1: {  /* only upper limit */
208      lua_Number u = luaL_checknumber(L, 1);
209      luaL_argcheck(L, (lua_Number)1.0 <= u, 1, "interval is empty");
210      lua_pushnumber(L, l_mathop(floor)(r*u) + (lua_Number)(1.0));  /* [1, u] */
211      break;
212    }
213    case 2: {  /* lower and upper limits */
214      lua_Number l = luaL_checknumber(L, 1);
215      lua_Number u = luaL_checknumber(L, 2);
216      luaL_argcheck(L, l <= u, 2, "interval is empty");
217      lua_pushnumber(L, l_mathop(floor)(r*(u-l+1)) + l);  /* [l, u] */
218      break;
219    }
220    default: return luaL_error(L, "wrong number of arguments");
221  }
222  return 1;
199   /* the `%' avoids the (rare) case of r==1, and is needed also because on
200    some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */
201   lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX;
202   switch (lua_gettop(L)) {  /* check number of arguments */
203   case 0: {  /* no arguments */
204      lua_pushnumber(L, r);  /* Number between 0 and 1 */
205      break;
206   }
207   case 1: {  /* only upper limit */
208      lua_Number u = luaL_checknumber(L, 1);
209      luaL_argcheck(L, (lua_Number)1.0 <= u, 1, "interval is empty");
210      lua_pushnumber(L, l_mathop(floor)(r*u) + (lua_Number)(1.0));  /* [1, u] */
211      break;
212   }
213   case 2: {  /* lower and upper limits */
214      lua_Number l = luaL_checknumber(L, 1);
215      lua_Number u = luaL_checknumber(L, 2);
216      luaL_argcheck(L, l <= u, 2, "interval is empty");
217      lua_pushnumber(L, l_mathop(floor)(r*(u-l+1)) + l);  /* [l, u] */
218      break;
219   }
220   default: return luaL_error(L, "wrong number of arguments");
221   }
222   return 1;
223223}
224224
225225
226226static int math_randomseed (lua_State *L) {
227  srand(luaL_checkunsigned(L, 1));
228  (void)rand(); /* discard first value to avoid undesirable correlations */
229  return 0;
227   srand(luaL_checkunsigned(L, 1));
228   (void)rand(); /* discard first value to avoid undesirable correlations */
229   return 0;
230230}
231231
232232
233233static const luaL_Reg mathlib[] = {
234  {"abs",   math_abs},
235  {"acos",  math_acos},
236  {"asin",  math_asin},
237  {"atan2", math_atan2},
238  {"atan",  math_atan},
239  {"ceil",  math_ceil},
240  {"cosh",   math_cosh},
241  {"cos",   math_cos},
242  {"deg",   math_deg},
243  {"exp",   math_exp},
244  {"floor", math_floor},
245  {"fmod",   math_fmod},
246  {"frexp", math_frexp},
247  {"ldexp", math_ldexp},
234   {"abs",   math_abs},
235   {"acos",  math_acos},
236   {"asin",  math_asin},
237   {"atan2", math_atan2},
238   {"atan",  math_atan},
239   {"ceil",  math_ceil},
240   {"cosh",   math_cosh},
241   {"cos",   math_cos},
242   {"deg",   math_deg},
243   {"exp",   math_exp},
244   {"floor", math_floor},
245   {"fmod",   math_fmod},
246   {"frexp", math_frexp},
247   {"ldexp", math_ldexp},
248248#if defined(LUA_COMPAT_LOG10)
249  {"log10", math_log10},
249   {"log10", math_log10},
250250#endif
251  {"log",   math_log},
252  {"max",   math_max},
253  {"min",   math_min},
254  {"modf",   math_modf},
255  {"pow",   math_pow},
256  {"rad",   math_rad},
257  {"random",     math_random},
258  {"randomseed", math_randomseed},
259  {"sinh",   math_sinh},
260  {"sin",   math_sin},
261  {"sqrt",  math_sqrt},
262  {"tanh",   math_tanh},
263  {"tan",   math_tan},
264  {NULL, NULL}
251   {"log",   math_log},
252   {"max",   math_max},
253   {"min",   math_min},
254   {"modf",   math_modf},
255   {"pow",   math_pow},
256   {"rad",   math_rad},
257   {"random",     math_random},
258   {"randomseed", math_randomseed},
259   {"sinh",   math_sinh},
260   {"sin",   math_sin},
261   {"sqrt",  math_sqrt},
262   {"tanh",   math_tanh},
263   {"tan",   math_tan},
264   {NULL, NULL}
265265};
266266
267267
r31373r31374
269269** Open math library
270270*/
271271LUAMOD_API int luaopen_math (lua_State *L) {
272  luaL_newlib(L, mathlib);
273  lua_pushnumber(L, PI);
274  lua_setfield(L, -2, "pi");
275  lua_pushnumber(L, HUGE_VAL);
276  lua_setfield(L, -2, "huge");
277  return 1;
272   luaL_newlib(L, mathlib);
273   lua_pushnumber(L, PI);
274   lua_setfield(L, -2, "pi");
275   lua_pushnumber(L, HUGE_VAL);
276   lua_setfield(L, -2, "huge");
277   return 1;
278278}
279
trunk/src/lib/lua/ltm.c
r31373r31374
2222static const char udatatypename[] = "userdata";
2323
2424LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = {
25  "no value",
26  "nil", "boolean", udatatypename, "number",
27  "string", "table", "function", udatatypename, "thread",
28  "proto", "upval"  /* these last two cases are used for tests only */
25   "no value",
26   "nil", "boolean", udatatypename, "number",
27   "string", "table", "function", udatatypename, "thread",
28   "proto", "upval"  /* these last two cases are used for tests only */
2929};
3030
3131
3232void luaT_init (lua_State *L) {
33  static const char *const luaT_eventname[] = {  /* ORDER TM */
34    "__index", "__newindex",
35    "__gc", "__mode", "__len", "__eq",
36    "__add", "__sub", "__mul", "__div", "__mod",
37    "__pow", "__unm", "__lt", "__le",
38    "__concat", "__call"
39  };
40  int i;
41  for (i=0; i<TM_N; i++) {
42    G(L)->tmname[i] = luaS_new(L, luaT_eventname[i]);
43    luaS_fix(G(L)->tmname[i]);  /* never collect these names */
44  }
33   static const char *const luaT_eventname[] = {  /* ORDER TM */
34   "__index", "__newindex",
35   "__gc", "__mode", "__len", "__eq",
36   "__add", "__sub", "__mul", "__div", "__mod",
37   "__pow", "__unm", "__lt", "__le",
38   "__concat", "__call"
39   };
40   int i;
41   for (i=0; i<TM_N; i++) {
42   G(L)->tmname[i] = luaS_new(L, luaT_eventname[i]);
43   luaS_fix(G(L)->tmname[i]);  /* never collect these names */
44   }
4545}
4646
4747
r31373r31374
5050** tag methods
5151*/
5252const TValue *luaT_gettm (Table *events, TMS event, TString *ename) {
53  const TValue *tm = luaH_getstr(events, ename);
54  lua_assert(event <= TM_EQ);
55  if (ttisnil(tm)) {  /* no tag method? */
56    events->flags |= cast_byte(1u<<event);  /* cache this fact */
57    return NULL;
58  }
59  else return tm;
53   const TValue *tm = luaH_getstr(events, ename);
54   lua_assert(event <= TM_EQ);
55   if (ttisnil(tm)) {  /* no tag method? */
56   events->flags |= cast_byte(1u<<event);  /* cache this fact */
57   return NULL;
58   }
59   else return tm;
6060}
6161
6262
6363const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {
64  Table *mt;
65  switch (ttypenv(o)) {
66    case LUA_TTABLE:
67      mt = hvalue(o)->metatable;
68      break;
69    case LUA_TUSERDATA:
70      mt = uvalue(o)->metatable;
71      break;
72    default:
73      mt = G(L)->mt[ttypenv(o)];
74  }
75  return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject);
64   Table *mt;
65   switch (ttypenv(o)) {
66   case LUA_TTABLE:
67      mt = hvalue(o)->metatable;
68      break;
69   case LUA_TUSERDATA:
70      mt = uvalue(o)->metatable;
71      break;
72   default:
73      mt = G(L)->mt[ttypenv(o)];
74   }
75   return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject);
7676}
77
trunk/src/lib/lua/lvm.c
r31373r31374
2929
3030
3131/* limit for table tag-method chains (to avoid loops) */
32#define MAXTAGLOOP   100
32#define MAXTAGLOOP  100
3333
3434
3535const TValue *luaV_tonumber (const TValue *obj, TValue *n) {
36  lua_Number num;
37  if (ttisnumber(obj)) return obj;
38  if (ttisstring(obj) && luaO_str2d(svalue(obj), tsvalue(obj)->len, &num)) {
39    setnvalue(n, num);
40    return n;
41  }
42  else
43    return NULL;
36   lua_Number num;
37   if (ttisnumber(obj)) return obj;
38   if (ttisstring(obj) && luaO_str2d(svalue(obj), tsvalue(obj)->len, &num)) {
39   setnvalue(n, num);
40   return n;
41   }
42   else
43   return NULL;
4444}
4545
4646
4747int luaV_tostring (lua_State *L, StkId obj) {
48  if (!ttisnumber(obj))
49    return 0;
50  else {
51    char s[LUAI_MAXNUMBER2STR];
52    lua_Number n = nvalue(obj);
53    int l = lua_number2str(s, n);
54    setsvalue2s(L, obj, luaS_newlstr(L, s, l));
55    return 1;
56  }
48   if (!ttisnumber(obj))
49   return 0;
50   else {
51   char s[LUAI_MAXNUMBER2STR];
52   lua_Number n = nvalue(obj);
53   int l = lua_number2str(s, n);
54   setsvalue2s(L, obj, luaS_newlstr(L, s, l));
55   return 1;
56   }
5757}
5858
5959
6060static void traceexec (lua_State *L) {
61  CallInfo *ci = L->ci;
62  lu_byte mask = L->hookmask;
63  int counthook = ((mask & LUA_MASKCOUNT) && L->hookcount == 0);
64  if (counthook)
65    resethookcount(L);  /* reset count */
66  if (ci->callstatus & CIST_HOOKYIELD) {  /* called hook last time? */
67    ci->callstatus &= ~CIST_HOOKYIELD;  /* erase mark */
68    return;  /* do not call hook again (VM yielded, so it did not move) */
69  }
70  if (counthook)
71    luaD_hook(L, LUA_HOOKCOUNT, -1);  /* call count hook */
72  if (mask & LUA_MASKLINE) {
73    Proto *p = ci_func(ci)->p;
74    int npc = pcRel(ci->u.l.savedpc, p);
75    int newline = getfuncline(p, npc);
76    if (npc == 0 ||  /* call linehook when enter a new function, */
77        ci->u.l.savedpc <= L->oldpc ||  /* when jump back (loop), or when */
78        newline != getfuncline(p, pcRel(L->oldpc, p)))  /* enter a new line */
79      luaD_hook(L, LUA_HOOKLINE, newline);  /* call line hook */
80  }
81  L->oldpc = ci->u.l.savedpc;
82  if (L->status == LUA_YIELD) {  /* did hook yield? */
83    if (counthook)
84      L->hookcount = 1;  /* undo decrement to zero */
85    ci->u.l.savedpc--;  /* undo increment (resume will increment it again) */
86    ci->callstatus |= CIST_HOOKYIELD;  /* mark that it yielded */
87    ci->func = L->top - 1;  /* protect stack below results */
88    luaD_throw(L, LUA_YIELD);
89  }
61   CallInfo *ci = L->ci;
62   lu_byte mask = L->hookmask;
63   int counthook = ((mask & LUA_MASKCOUNT) && L->hookcount == 0);
64   if (counthook)
65   resethookcount(L);  /* reset count */
66   if (ci->callstatus & CIST_HOOKYIELD) {  /* called hook last time? */
67   ci->callstatus &= ~CIST_HOOKYIELD;  /* erase mark */
68   return;  /* do not call hook again (VM yielded, so it did not move) */
69   }
70   if (counthook)
71   luaD_hook(L, LUA_HOOKCOUNT, -1);  /* call count hook */
72   if (mask & LUA_MASKLINE) {
73   Proto *p = ci_func(ci)->p;
74   int npc = pcRel(ci->u.l.savedpc, p);
75   int newline = getfuncline(p, npc);
76   if (npc == 0 ||  /* call linehook when enter a new function, */
77      ci->u.l.savedpc <= L->oldpc ||  /* when jump back (loop), or when */
78      newline != getfuncline(p, pcRel(L->oldpc, p)))  /* enter a new line */
79      luaD_hook(L, LUA_HOOKLINE, newline);  /* call line hook */
80   }
81   L->oldpc = ci->u.l.savedpc;
82   if (L->status == LUA_YIELD) {  /* did hook yield? */
83   if (counthook)
84      L->hookcount = 1;  /* undo decrement to zero */
85   ci->u.l.savedpc--;  /* undo increment (resume will increment it again) */
86   ci->callstatus |= CIST_HOOKYIELD;  /* mark that it yielded */
87   ci->func = L->top - 1;  /* protect stack below results */
88   luaD_throw(L, LUA_YIELD);
89   }
9090}
9191
9292
9393static void callTM (lua_State *L, const TValue *f, const TValue *p1,
94                    const TValue *p2, TValue *p3, int hasres) {
95  ptrdiff_t result = savestack(L, p3);
96  setobj2s(L, L->top++, f);  /* push function */
97  setobj2s(L, L->top++, p1);  /* 1st argument */
98  setobj2s(L, L->top++, p2);  /* 2nd argument */
99  if (!hasres)  /* no result? 'p3' is third argument */
100    setobj2s(L, L->top++, p3);  /* 3rd argument */
101  /* metamethod may yield only when called from Lua code */
102  luaD_call(L, L->top - (4 - hasres), hasres, isLua(L->ci));
103  if (hasres) {  /* if has result, move it to its place */
104    p3 = restorestack(L, result);
105    setobjs2s(L, p3, --L->top);
106  }
94               const TValue *p2, TValue *p3, int hasres) {
95   ptrdiff_t result = savestack(L, p3);
96   setobj2s(L, L->top++, f);  /* push function */
97   setobj2s(L, L->top++, p1);  /* 1st argument */
98   setobj2s(L, L->top++, p2);  /* 2nd argument */
99   if (!hasres)  /* no result? 'p3' is third argument */
100   setobj2s(L, L->top++, p3);  /* 3rd argument */
101   /* metamethod may yield only when called from Lua code */
102   luaD_call(L, L->top - (4 - hasres), hasres, isLua(L->ci));
103   if (hasres) {  /* if has result, move it to its place */
104   p3 = restorestack(L, result);
105   setobjs2s(L, p3, --L->top);
106   }
107107}
108108
109109
110110void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) {
111  int loop;
112  for (loop = 0; loop < MAXTAGLOOP; loop++) {
113    const TValue *tm;
114    if (ttistable(t)) {  /* `t' is a table? */
115      Table *h = hvalue(t);
116      const TValue *res = luaH_get(h, key); /* do a primitive get */
117      if (!ttisnil(res) ||  /* result is not nil? */
118          (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */
119        setobj2s(L, val, res);
120        return;
121      }
122      /* else will try the tag method */
123    }
124    else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX)))
125      luaG_typeerror(L, t, "index");
126    if (ttisfunction(tm)) {
127      callTM(L, tm, t, key, val, 1);
128      return;
129    }
130    t = tm;  /* else repeat with 'tm' */
131  }
132  luaG_runerror(L, "loop in gettable");
111   int loop;
112   for (loop = 0; loop < MAXTAGLOOP; loop++) {
113   const TValue *tm;
114   if (ttistable(t)) {  /* `t' is a table? */
115      Table *h = hvalue(t);
116      const TValue *res = luaH_get(h, key); /* do a primitive get */
117      if (!ttisnil(res) ||  /* result is not nil? */
118         (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */
119      setobj2s(L, val, res);
120      return;
121      }
122      /* else will try the tag method */
123   }
124   else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX)))
125      luaG_typeerror(L, t, "index");
126   if (ttisfunction(tm)) {
127      callTM(L, tm, t, key, val, 1);
128      return;
129   }
130   t = tm;  /* else repeat with 'tm' */
131   }
132   luaG_runerror(L, "loop in gettable");
133133}
134134
135135
136136void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
137  int loop;
138  for (loop = 0; loop < MAXTAGLOOP; loop++) {
139    const TValue *tm;
140    if (ttistable(t)) {  /* `t' is a table? */
141      Table *h = hvalue(t);
142      TValue *oldval = cast(TValue *, luaH_get(h, key));
143      /* if previous value is not nil, there must be a previous entry
144         in the table; moreover, a metamethod has no relevance */
145      if (!ttisnil(oldval) ||
146         /* previous value is nil; must check the metamethod */
147         ((tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL &&
148         /* no metamethod; is there a previous entry in the table? */
149         (oldval != luaO_nilobject ||
150         /* no previous entry; must create one. (The next test is
151            always true; we only need the assignment.) */
152         (oldval = luaH_newkey(L, h, key), 1)))) {
153        /* no metamethod and (now) there is an entry with given key */
154        setobj2t(L, oldval, val);  /* assign new value to that entry */
155        invalidateTMcache(h);
156        luaC_barrierback(L, obj2gco(h), val);
157        return;
158      }
159      /* else will try the metamethod */
160    }
161    else  /* not a table; check metamethod */
162      if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX)))
163        luaG_typeerror(L, t, "index");
164    /* there is a metamethod */
165    if (ttisfunction(tm)) {
166      callTM(L, tm, t, key, val, 0);
167      return;
168    }
169    t = tm;  /* else repeat with 'tm' */
170  }
171  luaG_runerror(L, "loop in settable");
137   int loop;
138   for (loop = 0; loop < MAXTAGLOOP; loop++) {
139   const TValue *tm;
140   if (ttistable(t)) {  /* `t' is a table? */
141      Table *h = hvalue(t);
142      TValue *oldval = cast(TValue *, luaH_get(h, key));
143      /* if previous value is not nil, there must be a previous entry
144       in the table; moreover, a metamethod has no relevance */
145      if (!ttisnil(oldval) ||
146         /* previous value is nil; must check the metamethod */
147         ((tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL &&
148         /* no metamethod; is there a previous entry in the table? */
149         (oldval != luaO_nilobject ||
150         /* no previous entry; must create one. (The next test is
151         always true; we only need the assignment.) */
152         (oldval = luaH_newkey(L, h, key), 1)))) {
153      /* no metamethod and (now) there is an entry with given key */
154      setobj2t(L, oldval, val);  /* assign new value to that entry */
155      invalidateTMcache(h);
156      luaC_barrierback(L, obj2gco(h), val);
157      return;
158      }
159      /* else will try the metamethod */
160   }
161   else  /* not a table; check metamethod */
162      if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX)))
163      luaG_typeerror(L, t, "index");
164   /* there is a metamethod */
165   if (ttisfunction(tm)) {
166      callTM(L, tm, t, key, val, 0);
167      return;
168   }
169   t = tm;  /* else repeat with 'tm' */
170   }
171   luaG_runerror(L, "loop in settable");
172172}
173173
174174
175175static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2,
176                       StkId res, TMS event) {
177  const TValue *tm = luaT_gettmbyobj(L, p1, event);  /* try first operand */
178  if (ttisnil(tm))
179    tm = luaT_gettmbyobj(L, p2, event);  /* try second operand */
180  if (ttisnil(tm)) return 0;
181  callTM(L, tm, p1, p2, res, 1);
182  return 1;
176                  StkId res, TMS event) {
177   const TValue *tm = luaT_gettmbyobj(L, p1, event);  /* try first operand */
178   if (ttisnil(tm))
179   tm = luaT_gettmbyobj(L, p2, event);  /* try second operand */
180   if (ttisnil(tm)) return 0;
181   callTM(L, tm, p1, p2, res, 1);
182   return 1;
183183}
184184
185185
186186static const TValue *get_equalTM (lua_State *L, Table *mt1, Table *mt2,
187                                  TMS event) {
188  const TValue *tm1 = fasttm(L, mt1, event);
189  const TValue *tm2;
190  if (tm1 == NULL) return NULL;  /* no metamethod */
191  if (mt1 == mt2) return tm1;  /* same metatables => same metamethods */
192  tm2 = fasttm(L, mt2, event);
193  if (tm2 == NULL) return NULL;  /* no metamethod */
194  if (luaV_rawequalobj(tm1, tm2))  /* same metamethods? */
195    return tm1;
196  return NULL;
187                           TMS event) {
188   const TValue *tm1 = fasttm(L, mt1, event);
189   const TValue *tm2;
190   if (tm1 == NULL) return NULL;  /* no metamethod */
191   if (mt1 == mt2) return tm1;  /* same metatables => same metamethods */
192   tm2 = fasttm(L, mt2, event);
193   if (tm2 == NULL) return NULL;  /* no metamethod */
194   if (luaV_rawequalobj(tm1, tm2))  /* same metamethods? */
195   return tm1;
196   return NULL;
197197}
198198
199199
200200static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2,
201                         TMS event) {
202  if (!call_binTM(L, p1, p2, L->top, event))
203    return -1;  /* no metamethod */
204  else
205    return !l_isfalse(L->top);
201                     TMS event) {
202   if (!call_binTM(L, p1, p2, L->top, event))
203   return -1;  /* no metamethod */
204   else
205   return !l_isfalse(L->top);
206206}
207207
208208
209209static int l_strcmp (const TString *ls, const TString *rs) {
210  const char *l = getstr(ls);
211  size_t ll = ls->tsv.len;
212  const char *r = getstr(rs);
213  size_t lr = rs->tsv.len;
214  for (;;) {
215    int temp = strcoll(l, r);
216    if (temp != 0) return temp;
217    else {  /* strings are equal up to a `\0' */
218      size_t len = strlen(l);  /* index of first `\0' in both strings */
219      if (len == lr)  /* r is finished? */
220        return (len == ll) ? 0 : 1;
221      else if (len == ll)  /* l is finished? */
222        return -1;  /* l is smaller than r (because r is not finished) */
223      /* both strings longer than `len'; go on comparing (after the `\0') */
224      len++;
225      l += len; ll -= len; r += len; lr -= len;
226    }
227  }
210   const char *l = getstr(ls);
211   size_t ll = ls->tsv.len;
212   const char *r = getstr(rs);
213   size_t lr = rs->tsv.len;
214   for (;;) {
215   int temp = strcoll(l, r);
216   if (temp != 0) return temp;
217   else {  /* strings are equal up to a `\0' */
218      size_t len = strlen(l);  /* index of first `\0' in both strings */
219      if (len == lr)  /* r is finished? */
220      return (len == ll) ? 0 : 1;
221      else if (len == ll)  /* l is finished? */
222      return -1;  /* l is smaller than r (because r is not finished) */
223      /* both strings longer than `len'; go on comparing (after the `\0') */
224      len++;
225      l += len; ll -= len; r += len; lr -= len;
226   }
227   }
228228}
229229
230230
231231int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {
232  int res;
233  if (ttisnumber(l) && ttisnumber(r))
234    return luai_numlt(L, nvalue(l), nvalue(r));
235  else if (ttisstring(l) && ttisstring(r))
236    return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0;
237  else if ((res = call_orderTM(L, l, r, TM_LT)) < 0)
238    luaG_ordererror(L, l, r);
239  return res;
232   int res;
233   if (ttisnumber(l) && ttisnumber(r))
234   return luai_numlt(L, nvalue(l), nvalue(r));
235   else if (ttisstring(l) && ttisstring(r))
236   return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0;
237   else if ((res = call_orderTM(L, l, r, TM_LT)) < 0)
238   luaG_ordererror(L, l, r);
239   return res;
240240}
241241
242242
243243int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) {
244  int res;
245  if (ttisnumber(l) && ttisnumber(r))
246    return luai_numle(L, nvalue(l), nvalue(r));
247  else if (ttisstring(l) && ttisstring(r))
248    return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0;
249  else if ((res = call_orderTM(L, l, r, TM_LE)) >= 0)  /* first try `le' */
250    return res;
251  else if ((res = call_orderTM(L, r, l, TM_LT)) < 0)  /* else try `lt' */
252    luaG_ordererror(L, l, r);
253  return !res;
244   int res;
245   if (ttisnumber(l) && ttisnumber(r))
246   return luai_numle(L, nvalue(l), nvalue(r));
247   else if (ttisstring(l) && ttisstring(r))
248   return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0;
249   else if ((res = call_orderTM(L, l, r, TM_LE)) >= 0)  /* first try `le' */
250   return res;
251   else if ((res = call_orderTM(L, r, l, TM_LT)) < 0)  /* else try `lt' */
252   luaG_ordererror(L, l, r);
253   return !res;
254254}
255255
256256
r31373r31374
258258** equality of Lua values. L == NULL means raw equality (no metamethods)
259259*/
260260int luaV_equalobj_ (lua_State *L, const TValue *t1, const TValue *t2) {
261  const TValue *tm;
262  lua_assert(ttisequal(t1, t2));
263  switch (ttype(t1)) {
264    case LUA_TNIL: return 1;
265    case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));
266    case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2);  /* true must be 1 !! */
267    case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
268    case LUA_TLCF: return fvalue(t1) == fvalue(t2);
269    case LUA_TSHRSTR: return eqshrstr(rawtsvalue(t1), rawtsvalue(t2));
270    case LUA_TLNGSTR: return luaS_eqlngstr(rawtsvalue(t1), rawtsvalue(t2));
271    case LUA_TUSERDATA: {
272      if (uvalue(t1) == uvalue(t2)) return 1;
273      else if (L == NULL) return 0;
274      tm = get_equalTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, TM_EQ);
275      break;  /* will try TM */
276    }
277    case LUA_TTABLE: {
278      if (hvalue(t1) == hvalue(t2)) return 1;
279      else if (L == NULL) return 0;
280      tm = get_equalTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ);
281      break;  /* will try TM */
282    }
283    default:
284      lua_assert(iscollectable(t1));
285      return gcvalue(t1) == gcvalue(t2);
286  }
287  if (tm == NULL) return 0;  /* no TM? */
288  callTM(L, tm, t1, t2, L->top, 1);  /* call TM */
289  return !l_isfalse(L->top);
261   const TValue *tm;
262   lua_assert(ttisequal(t1, t2));
263   switch (ttype(t1)) {
264   case LUA_TNIL: return 1;
265   case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));
266   case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2);  /* true must be 1 !! */
267   case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
268   case LUA_TLCF: return fvalue(t1) == fvalue(t2);
269   case LUA_TSHRSTR: return eqshrstr(rawtsvalue(t1), rawtsvalue(t2));
270   case LUA_TLNGSTR: return luaS_eqlngstr(rawtsvalue(t1), rawtsvalue(t2));
271   case LUA_TUSERDATA: {
272      if (uvalue(t1) == uvalue(t2)) return 1;
273      else if (L == NULL) return 0;
274      tm = get_equalTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, TM_EQ);
275      break;  /* will try TM */
276   }
277   case LUA_TTABLE: {
278      if (hvalue(t1) == hvalue(t2)) return 1;
279      else if (L == NULL) return 0;
280      tm = get_equalTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ);
281      break;  /* will try TM */
282   }
283   default:
284      lua_assert(iscollectable(t1));
285      return gcvalue(t1) == gcvalue(t2);
286   }
287   if (tm == NULL) return 0;  /* no TM? */
288   callTM(L, tm, t1, t2, L->top, 1);  /* call TM */
289   return !l_isfalse(L->top);
290290}
291291
292292
293293void luaV_concat (lua_State *L, int total) {
294  lua_assert(total >= 2);
295  do {
296    StkId top = L->top;
297    int n = 2;  /* number of elements handled in this pass (at least 2) */
298    if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) {
299      if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT))
300        luaG_concaterror(L, top-2, top-1);
301    }
302    else if (tsvalue(top-1)->len == 0)  /* second operand is empty? */
303      (void)tostring(L, top - 2);  /* result is first operand */
304    else if (ttisstring(top-2) && tsvalue(top-2)->len == 0) {
305      setobjs2s(L, top - 2, top - 1);  /* result is second op. */
306    }
307    else {
308      /* at least two non-empty string values; get as many as possible */
309      size_t tl = tsvalue(top-1)->len;
310      char *buffer;
311      int i;
312      /* collect total length */
313      for (i = 1; i < total && tostring(L, top-i-1); i++) {
314        size_t l = tsvalue(top-i-1)->len;
315        if (l >= (MAX_SIZET/sizeof(char)) - tl)
316          luaG_runerror(L, "string length overflow");
317        tl += l;
318      }
319      buffer = luaZ_openspace(L, &G(L)->buff, tl);
320      tl = 0;
321      n = i;
322      do {  /* concat all strings */
323        size_t l = tsvalue(top-i)->len;
324        memcpy(buffer+tl, svalue(top-i), l * sizeof(char));
325        tl += l;
326      } while (--i > 0);
327      setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl));
328    }
329    total -= n-1;  /* got 'n' strings to create 1 new */
330    L->top -= n-1;  /* popped 'n' strings and pushed one */
331  } while (total > 1);  /* repeat until only 1 result left */
294   lua_assert(total >= 2);
295   do {
296   StkId top = L->top;
297   int n = 2;  /* number of elements handled in this pass (at least 2) */
298   if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) {
299      if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT))
300      luaG_concaterror(L, top-2, top-1);
301   }
302   else if (tsvalue(top-1)->len == 0)  /* second operand is empty? */
303      (void)tostring(L, top - 2);  /* result is first operand */
304   else if (ttisstring(top-2) && tsvalue(top-2)->len == 0) {
305      setobjs2s(L, top - 2, top - 1);  /* result is second op. */
306   }
307   else {
308      /* at least two non-empty string values; get as many as possible */
309      size_t tl = tsvalue(top-1)->len;
310      char *buffer;
311      int i;
312      /* collect total length */
313      for (i = 1; i < total && tostring(L, top-i-1); i++) {
314      size_t l = tsvalue(top-i-1)->len;
315      if (l >= (MAX_SIZET/sizeof(char)) - tl)
316         luaG_runerror(L, "string length overflow");
317      tl += l;
318      }
319      buffer = luaZ_openspace(L, &G(L)->buff, tl);
320      tl = 0;
321      n = i;
322      do {  /* concat all strings */
323      size_t l = tsvalue(top-i)->len;
324      memcpy(buffer+tl, svalue(top-i), l * sizeof(char));
325      tl += l;
326      } while (--i > 0);
327      setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl));
328   }
329   total -= n-1;  /* got 'n' strings to create 1 new */
330   L->top -= n-1;  /* popped 'n' strings and pushed one */
331   } while (total > 1);  /* repeat until only 1 result left */
332332}
333333
334334
335335void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) {
336  const TValue *tm;
337  switch (ttypenv(rb)) {
338    case LUA_TTABLE: {
339      Table *h = hvalue(rb);
340      tm = fasttm(L, h->metatable, TM_LEN);
341      if (tm) break;  /* metamethod? break switch to call it */
342      setnvalue(ra, cast_num(1.0*luaH_getn(h)));  /* else primitive len */
343      return;
344    }
345    case LUA_TSTRING: {
346      setnvalue(ra, cast_num(tsvalue(rb)->len));
347      return;
348    }
349    default: {  /* try metamethod */
350      tm = luaT_gettmbyobj(L, rb, TM_LEN);
351      if (ttisnil(tm))  /* no metamethod? */
352        luaG_typeerror(L, rb, "get length of");
353      break;
354    }
355  }
356  callTM(L, tm, rb, rb, ra, 1);
336   const TValue *tm;
337   switch (ttypenv(rb)) {
338   case LUA_TTABLE: {
339      Table *h = hvalue(rb);
340      tm = fasttm(L, h->metatable, TM_LEN);
341      if (tm) break;  /* metamethod? break switch to call it */
342      setnvalue(ra, cast_num(1.0*luaH_getn(h)));  /* else primitive len */
343      return;
344   }
345   case LUA_TSTRING: {
346      setnvalue(ra, cast_num(tsvalue(rb)->len));
347      return;
348   }
349   default: {  /* try metamethod */
350      tm = luaT_gettmbyobj(L, rb, TM_LEN);
351      if (ttisnil(tm))  /* no metamethod? */
352      luaG_typeerror(L, rb, "get length of");
353      break;
354   }
355   }
356   callTM(L, tm, rb, rb, ra, 1);
357357}
358358
359359
360360void luaV_arith (lua_State *L, StkId ra, const TValue *rb,
361                 const TValue *rc, TMS op) {
362  TValue tempb, tempc;
363  const TValue *b, *c;
364  if ((b = luaV_tonumber(rb, &tempb)) != NULL &&
365      (c = luaV_tonumber(rc, &tempc)) != NULL) {
366    lua_Number res = luaO_arith(op - TM_ADD + LUA_OPADD, nvalue(b), nvalue(c));
367    setnvalue(ra, res);
368  }
369  else if (!call_binTM(L, rb, rc, ra, op))
370    luaG_aritherror(L, rb, rc);
361               const TValue *rc, TMS op) {
362   TValue tempb, tempc;
363   const TValue *b, *c;
364   if ((b = luaV_tonumber(rb, &tempb)) != NULL &&
365      (c = luaV_tonumber(rc, &tempc)) != NULL) {
366   lua_Number res = luaO_arith(op - TM_ADD + LUA_OPADD, nvalue(b), nvalue(c));
367   setnvalue(ra, res);
368   }
369   else if (!call_binTM(L, rb, rc, ra, op))
370   luaG_aritherror(L, rb, rc);
371371}
372372
373373
r31373r31374
377377** new closure to be created.
378378*/
379379static Closure *getcached (Proto *p, UpVal **encup, StkId base) {
380  Closure *c = p->cache;
381  if (c != NULL) {  /* is there a cached closure? */
382    int nup = p->sizeupvalues;
383    Upvaldesc *uv = p->upvalues;
384    int i;
385    for (i = 0; i < nup; i++) {  /* check whether it has right upvalues */
386      TValue *v = uv[i].instack ? base + uv[i].idx : encup[uv[i].idx]->v;
387      if (c->l.upvals[i]->v != v)
388        return NULL;  /* wrong upvalue; cannot reuse closure */
389    }
390  }
391  return c;  /* return cached closure (or NULL if no cached closure) */
380   Closure *c = p->cache;
381   if (c != NULL) {  /* is there a cached closure? */
382   int nup = p->sizeupvalues;
383   Upvaldesc *uv = p->upvalues;
384   int i;
385   for (i = 0; i < nup; i++) {  /* check whether it has right upvalues */
386      TValue *v = uv[i].instack ? base + uv[i].idx : encup[uv[i].idx]->v;
387      if (c->l.upvals[i]->v != v)
388      return NULL;  /* wrong upvalue; cannot reuse closure */
389   }
390   }
391   return c;  /* return cached closure (or NULL if no cached closure) */
392392}
393393
394394
r31373r31374
399399** original value of that field.
400400*/
401401static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base,
402                         StkId ra) {
403  int nup = p->sizeupvalues;
404  Upvaldesc *uv = p->upvalues;
405  int i;
406  Closure *ncl = luaF_newLclosure(L, nup);
407  ncl->l.p = p;
408  setclLvalue(L, ra, ncl);  /* anchor new closure in stack */
409  for (i = 0; i < nup; i++) {  /* fill in its upvalues */
410    if (uv[i].instack)  /* upvalue refers to local variable? */
411      ncl->l.upvals[i] = luaF_findupval(L, base + uv[i].idx);
412    else  /* get upvalue from enclosing function */
413      ncl->l.upvals[i] = encup[uv[i].idx];
414  }
415  luaC_barrierproto(L, p, ncl);
416  p->cache = ncl;  /* save it on cache for reuse */
402                     StkId ra) {
403   int nup = p->sizeupvalues;
404   Upvaldesc *uv = p->upvalues;
405   int i;
406   Closure *ncl = luaF_newLclosure(L, nup);
407   ncl->l.p = p;
408   setclLvalue(L, ra, ncl);  /* anchor new closure in stack */
409   for (i = 0; i < nup; i++) {  /* fill in its upvalues */
410   if (uv[i].instack)  /* upvalue refers to local variable? */
411      ncl->l.upvals[i] = luaF_findupval(L, base + uv[i].idx);
412   else  /* get upvalue from enclosing function */
413      ncl->l.upvals[i] = encup[uv[i].idx];
414   }
415   luaC_barrierproto(L, p, ncl);
416   p->cache = ncl;  /* save it on cache for reuse */
417417}
418418
419419
r31373r31374
421421** finish execution of an opcode interrupted by an yield
422422*/
423423void luaV_finishOp (lua_State *L) {
424  CallInfo *ci = L->ci;
425  StkId base = ci->u.l.base;
426  Instruction inst = *(ci->u.l.savedpc - 1);  /* interrupted instruction */
427  OpCode op = GET_OPCODE(inst);
428  switch (op) {  /* finish its execution */
429    case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV:
430    case OP_MOD: case OP_POW: case OP_UNM: case OP_LEN:
431    case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: {
432      setobjs2s(L, base + GETARG_A(inst), --L->top);
433      break;
434    }
435    case OP_LE: case OP_LT: case OP_EQ: {
436      int res = !l_isfalse(L->top - 1);
437      L->top--;
438      /* metamethod should not be called when operand is K */
439      lua_assert(!ISK(GETARG_B(inst)));
440      if (op == OP_LE &&  /* "<=" using "<" instead? */
441          ttisnil(luaT_gettmbyobj(L, base + GETARG_B(inst), TM_LE)))
442        res = !res;  /* invert result */
443      lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP);
444      if (res != GETARG_A(inst))  /* condition failed? */
445        ci->u.l.savedpc++;  /* skip jump instruction */
446      break;
447    }
448    case OP_CONCAT: {
449      StkId top = L->top - 1;  /* top when 'call_binTM' was called */
450      int b = GETARG_B(inst);      /* first element to concatenate */
451      int total = cast_int(top - 1 - (base + b));  /* yet to concatenate */
452      setobj2s(L, top - 2, top);  /* put TM result in proper position */
453      if (total > 1) {  /* are there elements to concat? */
454        L->top = top - 1;  /* top is one after last element (at top-2) */
455        luaV_concat(L, total);  /* concat them (may yield again) */
456      }
457      /* move final result to final position */
458      setobj2s(L, ci->u.l.base + GETARG_A(inst), L->top - 1);
459      L->top = ci->top;  /* restore top */
460      break;
461    }
462    case OP_TFORCALL: {
463      lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_TFORLOOP);
464      L->top = ci->top;  /* correct top */
465      break;
466    }
467    case OP_CALL: {
468      if (GETARG_C(inst) - 1 >= 0)  /* nresults >= 0? */
469        L->top = ci->top;  /* adjust results */
470      break;
471    }
472    case OP_TAILCALL: case OP_SETTABUP: case OP_SETTABLE:
473      break;
474    default: lua_assert(0);
475  }
424   CallInfo *ci = L->ci;
425   StkId base = ci->u.l.base;
426   Instruction inst = *(ci->u.l.savedpc - 1);  /* interrupted instruction */
427   OpCode op = GET_OPCODE(inst);
428   switch (op) {  /* finish its execution */
429   case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV:
430   case OP_MOD: case OP_POW: case OP_UNM: case OP_LEN:
431   case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: {
432      setobjs2s(L, base + GETARG_A(inst), --L->top);
433      break;
434   }
435   case OP_LE: case OP_LT: case OP_EQ: {
436      int res = !l_isfalse(L->top - 1);
437      L->top--;
438      /* metamethod should not be called when operand is K */
439      lua_assert(!ISK(GETARG_B(inst)));
440      if (op == OP_LE &&  /* "<=" using "<" instead? */
441         ttisnil(luaT_gettmbyobj(L, base + GETARG_B(inst), TM_LE)))
442      res = !res;  /* invert result */
443      lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP);
444      if (res != GETARG_A(inst))  /* condition failed? */
445      ci->u.l.savedpc++;  /* skip jump instruction */
446      break;
447   }
448   case OP_CONCAT: {
449      StkId top = L->top - 1;  /* top when 'call_binTM' was called */
450      int b = GETARG_B(inst);      /* first element to concatenate */
451      int total = cast_int(top - 1 - (base + b));  /* yet to concatenate */
452      setobj2s(L, top - 2, top);  /* put TM result in proper position */
453      if (total > 1) {  /* are there elements to concat? */
454      L->top = top - 1;  /* top is one after last element (at top-2) */
455      luaV_concat(L, total);  /* concat them (may yield again) */
456      }
457      /* move final result to final position */
458      setobj2s(L, ci->u.l.base + GETARG_A(inst), L->top - 1);
459      L->top = ci->top;  /* restore top */
460      break;
461   }
462   case OP_TFORCALL: {
463      lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_TFORLOOP);
464      L->top = ci->top;  /* correct top */
465      break;
466   }
467   case OP_CALL: {
468      if (GETARG_C(inst) - 1 >= 0)  /* nresults >= 0? */
469      L->top = ci->top;  /* adjust results */
470      break;
471   }
472   case OP_TAILCALL: case OP_SETTABUP: case OP_SETTABLE:
473      break;
474   default: lua_assert(0);
475   }
476476}
477477
478478
r31373r31374
482482*/
483483
484484#if !defined luai_runtimecheck
485#define luai_runtimecheck(L, c)      /* void */
485#define luai_runtimecheck(L, c)     /* void */
486486#endif
487487
488488
489#define RA(i)   (base+GETARG_A(i))
489#define RA(i)   (base+GETARG_A(i))
490490/* to be used after possible stack reallocation */
491#define RB(i)   check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i))
492#define RC(i)   check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))
493#define RKB(i)   check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \
491#define RB(i)   check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i))
492#define RC(i)   check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))
493#define RKB(i)  check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \
494494   ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i))
495#define RKC(i)   check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \
495#define RKC(i)  check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \
496496   ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i))
497497#define KBx(i)  \
498  (k + (GETARG_Bx(i) != 0 ? GETARG_Bx(i) - 1 : GETARG_Ax(*ci->u.l.savedpc++)))
498   (k + (GETARG_Bx(i) != 0 ? GETARG_Bx(i) - 1 : GETARG_Ax(*ci->u.l.savedpc++)))
499499
500500
501501/* execute a jump instruction */
502502#define dojump(ci,i,e) \
503  { int a = GETARG_A(i); \
504    if (a > 0) luaF_close(L, ci->u.l.base + a - 1); \
505    ci->u.l.savedpc += GETARG_sBx(i) + e; }
503   { int a = GETARG_A(i); \
504   if (a > 0) luaF_close(L, ci->u.l.base + a - 1); \
505   ci->u.l.savedpc += GETARG_sBx(i) + e; }
506506
507507/* for test instructions, execute the jump instruction that follows it */
508#define donextjump(ci)   { i = *ci->u.l.savedpc; dojump(ci, i, 1); }
508#define donextjump(ci)  { i = *ci->u.l.savedpc; dojump(ci, i, 1); }
509509
510510
511#define Protect(x)   { {x;}; base = ci->u.l.base; }
511#define Protect(x)  { {x;}; base = ci->u.l.base; }
512512
513513#define checkGC(L,c)  \
514  Protect( luaC_condGC(L,{L->top = (c);  /* limit of live values */ \
515                          luaC_step(L); \
516                          L->top = ci->top;})  /* restore top */ \
517           luai_threadyield(L); )
514   Protect( luaC_condGC(L,{L->top = (c);  /* limit of live values */ \
515                     luaC_step(L); \
516                     L->top = ci->top;})  /* restore top */ \
517         luai_threadyield(L); )
518518
519519
520520#define arith_op(op,tm) { \
521        TValue *rb = RKB(i); \
522        TValue *rc = RKC(i); \
523        if (ttisnumber(rb) && ttisnumber(rc)) { \
524          lua_Number nb = nvalue(rb), nc = nvalue(rc); \
525          setnvalue(ra, op(L, nb, nc)); \
526        } \
527        else { Protect(luaV_arith(L, ra, rb, rc, tm)); } }
521      TValue *rb = RKB(i); \
522      TValue *rc = RKC(i); \
523      if (ttisnumber(rb) && ttisnumber(rc)) { \
524         lua_Number nb = nvalue(rb), nc = nvalue(rc); \
525         setnvalue(ra, op(L, nb, nc)); \
526      } \
527      else { Protect(luaV_arith(L, ra, rb, rc, tm)); } }
528528
529529
530#define vmdispatch(o)   switch(o)
531#define vmcase(l,b)   case l: {b}  break;
532#define vmcasenb(l,b)   case l: {b}      /* nb = no break */
530#define vmdispatch(o)   switch(o)
531#define vmcase(l,b) case l: {b}  break;
532#define vmcasenb(l,b)   case l: {b}     /* nb = no break */
533533
534534void luaV_execute (lua_State *L) {
535  CallInfo *ci = L->ci;
536  LClosure *cl;
537  TValue *k;
538  StkId base;
539 newframe:  /* reentry point when frame changes (call/return) */
540  lua_assert(ci == L->ci);
541  cl = clLvalue(ci->func);
542  k = cl->p->k;
543  base = ci->u.l.base;
544  /* main loop of interpreter */
545  for (;;) {
546    Instruction i = *(ci->u.l.savedpc++);
547    StkId ra;
548    if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) &&
549        (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {
550      Protect(traceexec(L));
551    }
552    /* WARNING: several calls may realloc the stack and invalidate `ra' */
553    ra = RA(i);
554    lua_assert(base == ci->u.l.base);
555    lua_assert(base <= L->top && L->top < L->stack + L->stacksize);
556    vmdispatch (GET_OPCODE(i)) {
557      vmcase(OP_MOVE,
558        setobjs2s(L, ra, RB(i));
559      )
560      vmcase(OP_LOADK,
561        TValue *rb = k + GETARG_Bx(i);
562        setobj2s(L, ra, rb);
563      )
564      vmcase(OP_LOADKX,
565        TValue *rb;
566        lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG);
567        rb = k + GETARG_Ax(*ci->u.l.savedpc++);
568        setobj2s(L, ra, rb);
569      )
570      vmcase(OP_LOADBOOL,
571        setbvalue(ra, GETARG_B(i));
572        if (GETARG_C(i)) ci->u.l.savedpc++;  /* skip next instruction (if C) */
573      )
574      vmcase(OP_LOADNIL,
575        int b = GETARG_B(i);
576        do {
577          setnilvalue(ra++);
578        } while (b--);
579      )
580      vmcase(OP_GETUPVAL,
581        int b = GETARG_B(i);
582        setobj2s(L, ra, cl->upvals[b]->v);
583      )
584      vmcase(OP_GETTABUP,
585        int b = GETARG_B(i);
586        Protect(luaV_gettable(L, cl->upvals[b]->v, RKC(i), ra));
587      )
588      vmcase(OP_GETTABLE,
589        Protect(luaV_gettable(L, RB(i), RKC(i), ra));
590      )
591      vmcase(OP_SETTABUP,
592        int a = GETARG_A(i);
593        Protect(luaV_settable(L, cl->upvals[a]->v, RKB(i), RKC(i)));
594      )
595      vmcase(OP_SETUPVAL,
596        UpVal *uv = cl->upvals[GETARG_B(i)];
597        setobj(L, uv->v, ra);
598        luaC_barrier(L, uv, ra);
599      )
600      vmcase(OP_SETTABLE,
601        Protect(luaV_settable(L, ra, RKB(i), RKC(i)));
602      )
603      vmcase(OP_NEWTABLE,
604        int b = GETARG_B(i);
605        int c = GETARG_C(i);
606        Table *t = luaH_new(L);
607        sethvalue(L, ra, t);
608        if (b != 0 || c != 0)
609          luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c));
610        checkGC(L, ra + 1);
611      )
612      vmcase(OP_SELF,
613        StkId rb = RB(i);
614        setobjs2s(L, ra+1, rb);
615        Protect(luaV_gettable(L, rb, RKC(i), ra));
616      )
617      vmcase(OP_ADD,
618        arith_op(luai_numadd, TM_ADD);
619      )
620      vmcase(OP_SUB,
621        arith_op(luai_numsub, TM_SUB);
622      )
623      vmcase(OP_MUL,
624        arith_op(luai_nummul, TM_MUL);
625      )
626      vmcase(OP_DIV,
627        arith_op(luai_numdiv, TM_DIV);
628      )
629      vmcase(OP_MOD,
630        arith_op(luai_nummod, TM_MOD);
631      )
632      vmcase(OP_POW,
633        arith_op(luai_numpow, TM_POW);
634      )
635      vmcase(OP_UNM,
636        TValue *rb = RB(i);
637        if (ttisnumber(rb)) {
638          lua_Number nb = nvalue(rb);
639          setnvalue(ra, luai_numunm(L, nb));
640        }
641        else {
642          Protect(luaV_arith(L, ra, rb, rb, TM_UNM));
643        }
644      )
645      vmcase(OP_NOT,
646        TValue *rb = RB(i);
647        int res = l_isfalse(rb);  /* next assignment may change this value */
648        setbvalue(ra, res);
649      )
650      vmcase(OP_LEN,
651        Protect(luaV_objlen(L, ra, RB(i)));
652      )
653      vmcase(OP_CONCAT,
654        int b = GETARG_B(i);
655        int c = GETARG_C(i);
656        StkId rb;
657        L->top = base + c + 1;  /* mark the end of concat operands */
658        Protect(luaV_concat(L, c - b + 1));
659        ra = RA(i);  /* 'luav_concat' may invoke TMs and move the stack */
660        rb = b + base;
661        setobjs2s(L, ra, rb);
662        checkGC(L, (ra >= rb ? ra + 1 : rb));
663        L->top = ci->top;  /* restore top */
664      )
665      vmcase(OP_JMP,
666        dojump(ci, i, 0);
667      )
668      vmcase(OP_EQ,
669        TValue *rb = RKB(i);
670        TValue *rc = RKC(i);
671        Protect(
672          if (cast_int(equalobj(L, rb, rc)) != GETARG_A(i))
673            ci->u.l.savedpc++;
674          else
675            donextjump(ci);
676        )
677      )
678      vmcase(OP_LT,
679        Protect(
680          if (luaV_lessthan(L, RKB(i), RKC(i)) != GETARG_A(i))
681            ci->u.l.savedpc++;
682          else
683            donextjump(ci);
684        )
685      )
686      vmcase(OP_LE,
687        Protect(
688          if (luaV_lessequal(L, RKB(i), RKC(i)) != GETARG_A(i))
689            ci->u.l.savedpc++;
690          else
691            donextjump(ci);
692        )
693      )
694      vmcase(OP_TEST,
695        if (GETARG_C(i) ? l_isfalse(ra) : !l_isfalse(ra))
696            ci->u.l.savedpc++;
697          else
698          donextjump(ci);
699      )
700      vmcase(OP_TESTSET,
701        TValue *rb = RB(i);
702        if (GETARG_C(i) ? l_isfalse(rb) : !l_isfalse(rb))
703          ci->u.l.savedpc++;
704        else {
705          setobjs2s(L, ra, rb);
706          donextjump(ci);
707        }
708      )
709      vmcase(OP_CALL,
710        int b = GETARG_B(i);
711        int nresults = GETARG_C(i) - 1;
712        if (b != 0) L->top = ra+b;  /* else previous instruction set top */
713        if (luaD_precall(L, ra, nresults)) {  /* C function? */
714          if (nresults >= 0) L->top = ci->top;  /* adjust results */
715          base = ci->u.l.base;
716        }
717        else {  /* Lua function */
718          ci = L->ci;
719          ci->callstatus |= CIST_REENTRY;
720          goto newframe;  /* restart luaV_execute over new Lua function */
721        }
722      )
723      vmcase(OP_TAILCALL,
724        int b = GETARG_B(i);
725        if (b != 0) L->top = ra+b;  /* else previous instruction set top */
726        lua_assert(GETARG_C(i) - 1 == LUA_MULTRET);
727        if (luaD_precall(L, ra, LUA_MULTRET))  /* C function? */
728          base = ci->u.l.base;
729        else {
730          /* tail call: put called frame (n) in place of caller one (o) */
731          CallInfo *nci = L->ci;  /* called frame */
732          CallInfo *oci = nci->previous;  /* caller frame */
733          StkId nfunc = nci->func;  /* called function */
734          StkId ofunc = oci->func;  /* caller function */
735          /* last stack slot filled by 'precall' */
736          StkId lim = nci->u.l.base + getproto(nfunc)->numparams;
737          int aux;
738          /* close all upvalues from previous call */
739          if (cl->p->sizep > 0) luaF_close(L, oci->u.l.base);
740          /* move new frame into old one */
741          for (aux = 0; nfunc + aux < lim; aux++)
742            setobjs2s(L, ofunc + aux, nfunc + aux);
743          oci->u.l.base = ofunc + (nci->u.l.base - nfunc);  /* correct base */
744          oci->top = L->top = ofunc + (L->top - nfunc);  /* correct top */
745          oci->u.l.savedpc = nci->u.l.savedpc;
746          oci->callstatus |= CIST_TAIL;  /* function was tail called */
747          ci = L->ci = oci;  /* remove new frame */
748          lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize);
749          goto newframe;  /* restart luaV_execute over new Lua function */
750        }
751      )
752      vmcasenb(OP_RETURN,
753        int b = GETARG_B(i);
754        if (b != 0) L->top = ra+b-1;
755        if (cl->p->sizep > 0) luaF_close(L, base);
756        b = luaD_poscall(L, ra);
757        if (!(ci->callstatus & CIST_REENTRY))  /* 'ci' still the called one */
758          return;  /* external invocation: return */
759        else {  /* invocation via reentry: continue execution */
760          ci = L->ci;
761          if (b) L->top = ci->top;
762          lua_assert(isLua(ci));
763          lua_assert(GET_OPCODE(*((ci)->u.l.savedpc - 1)) == OP_CALL);
764          goto newframe;  /* restart luaV_execute over new Lua function */
765        }
766      )
767      vmcase(OP_FORLOOP,
768        lua_Number step = nvalue(ra+2);
769        lua_Number idx = luai_numadd(L, nvalue(ra), step); /* increment index */
770        lua_Number limit = nvalue(ra+1);
771        if (luai_numlt(L, 0, step) ? luai_numle(L, idx, limit)
772                                   : luai_numle(L, limit, idx)) {
773          ci->u.l.savedpc += GETARG_sBx(i);  /* jump back */
774          setnvalue(ra, idx);  /* update internal index... */
775          setnvalue(ra+3, idx);  /* ...and external index */
776        }
777      )
778      vmcase(OP_FORPREP,
779        const TValue *init = ra;
780        const TValue *plimit = ra+1;
781        const TValue *pstep = ra+2;
782        if (!tonumber(init, ra))
783          luaG_runerror(L, LUA_QL("for") " initial value must be a number");
784        else if (!tonumber(plimit, ra+1))
785          luaG_runerror(L, LUA_QL("for") " limit must be a number");
786        else if (!tonumber(pstep, ra+2))
787          luaG_runerror(L, LUA_QL("for") " step must be a number");
788        setnvalue(ra, luai_numsub(L, nvalue(ra), nvalue(pstep)));
789        ci->u.l.savedpc += GETARG_sBx(i);
790      )
791      vmcasenb(OP_TFORCALL,
792        StkId cb = ra + 3;  /* call base */
793        setobjs2s(L, cb+2, ra+2);
794        setobjs2s(L, cb+1, ra+1);
795        setobjs2s(L, cb, ra);
796        L->top = cb + 3;  /* func. + 2 args (state and index) */
797        Protect(luaD_call(L, cb, GETARG_C(i), 1));
798        L->top = ci->top;
799        i = *(ci->u.l.savedpc++);  /* go to next instruction */
800        ra = RA(i);
801        lua_assert(GET_OPCODE(i) == OP_TFORLOOP);
802        goto l_tforloop;
803      )
804      vmcase(OP_TFORLOOP,
805        l_tforloop:
806        if (!ttisnil(ra + 1)) {  /* continue loop? */
807          setobjs2s(L, ra, ra + 1);  /* save control variable */
808           ci->u.l.savedpc += GETARG_sBx(i);  /* jump back */
809        }
810      )
811      vmcase(OP_SETLIST,
812        int n = GETARG_B(i);
813        int c = GETARG_C(i);
814        int last;
815        Table *h;
816        if (n == 0) n = cast_int(L->top - ra) - 1;
817        if (c == 0) {
818          lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG);
819          c = GETARG_Ax(*ci->u.l.savedpc++);
820        }
821        luai_runtimecheck(L, ttistable(ra));
822        h = hvalue(ra);
823        last = ((c-1)*LFIELDS_PER_FLUSH) + n;
824        if (last > h->sizearray)  /* needs more space? */
825          luaH_resizearray(L, h, last);  /* pre-allocate it at once */
826        for (; n > 0; n--) {
827          TValue *val = ra+n;
828          luaH_setint(L, h, last--, val);
829          luaC_barrierback(L, obj2gco(h), val);
830        }
831        L->top = ci->top;  /* correct top (in case of previous open call) */
832      )
833      vmcase(OP_CLOSURE,
834        Proto *p = cl->p->p[GETARG_Bx(i)];
835        Closure *ncl = getcached(p, cl->upvals, base);  /* cached closure */
836        if (ncl == NULL)  /* no match? */
837          pushclosure(L, p, cl->upvals, base, ra);  /* create a new one */
838        else
839          setclLvalue(L, ra, ncl);  /* push cashed closure */
840        checkGC(L, ra + 1);
841      )
842      vmcase(OP_VARARG,
843        int b = GETARG_B(i) - 1;
844        int j;
845        int n = cast_int(base - ci->func) - cl->p->numparams - 1;
846        if (b < 0) {  /* B == 0? */
847          b = n;  /* get all var. arguments */
848          Protect(luaD_checkstack(L, n));
849          ra = RA(i);  /* previous call may change the stack */
850          L->top = ra + n;
851        }
852        for (j = 0; j < b; j++) {
853          if (j < n) {
854            setobjs2s(L, ra + j, base - n + j);
855          }
856          else {
857            setnilvalue(ra + j);
858          }
859        }
860      )
861      vmcase(OP_EXTRAARG,
862        lua_assert(0);
863      )
864    }
865  }
535   CallInfo *ci = L->ci;
536   LClosure *cl;
537   TValue *k;
538   StkId base;
539   newframe:  /* reentry point when frame changes (call/return) */
540   lua_assert(ci == L->ci);
541   cl = clLvalue(ci->func);
542   k = cl->p->k;
543   base = ci->u.l.base;
544   /* main loop of interpreter */
545   for (;;) {
546   Instruction i = *(ci->u.l.savedpc++);
547   StkId ra;
548   if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) &&
549      (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {
550      Protect(traceexec(L));
551   }
552   /* WARNING: several calls may realloc the stack and invalidate `ra' */
553   ra = RA(i);
554   lua_assert(base == ci->u.l.base);
555   lua_assert(base <= L->top && L->top < L->stack + L->stacksize);
556   vmdispatch (GET_OPCODE(i)) {
557      vmcase(OP_MOVE,
558      setobjs2s(L, ra, RB(i));
559      )
560      vmcase(OP_LOADK,
561      TValue *rb = k + GETARG_Bx(i);
562      setobj2s(L, ra, rb);
563      )
564      vmcase(OP_LOADKX,
565      TValue *rb;
566      lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG);
567      rb = k + GETARG_Ax(*ci->u.l.savedpc++);
568      setobj2s(L, ra, rb);
569      )
570      vmcase(OP_LOADBOOL,
571      setbvalue(ra, GETARG_B(i));
572      if (GETARG_C(i)) ci->u.l.savedpc++;  /* skip next instruction (if C) */
573      )
574      vmcase(OP_LOADNIL,
575      int b = GETARG_B(i);
576      do {
577         setnilvalue(ra++);
578      } while (b--);
579      )
580      vmcase(OP_GETUPVAL,
581      int b = GETARG_B(i);
582      setobj2s(L, ra, cl->upvals[b]->v);
583      )
584      vmcase(OP_GETTABUP,
585      int b = GETARG_B(i);
586      Protect(luaV_gettable(L, cl->upvals[b]->v, RKC(i), ra));
587      )
588      vmcase(OP_GETTABLE,
589      Protect(luaV_gettable(L, RB(i), RKC(i), ra));
590      )
591      vmcase(OP_SETTABUP,
592      int a = GETARG_A(i);
593      Protect(luaV_settable(L, cl->upvals[a]->v, RKB(i), RKC(i)));
594      )
595      vmcase(OP_SETUPVAL,
596      UpVal *uv = cl->upvals[GETARG_B(i)];
597      setobj(L, uv->v, ra);
598      luaC_barrier(L, uv, ra);
599      )
600      vmcase(OP_SETTABLE,
601      Protect(luaV_settable(L, ra, RKB(i), RKC(i)));
602      )
603      vmcase(OP_NEWTABLE,
604      int b = GETARG_B(i);
605      int c = GETARG_C(i);
606      Table *t = luaH_new(L);
607      sethvalue(L, ra, t);
608      if (b != 0 || c != 0)
609         luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c));
610      checkGC(L, ra + 1);
611      )
612      vmcase(OP_SELF,
613      StkId rb = RB(i);
614      setobjs2s(L, ra+1, rb);
615      Protect(luaV_gettable(L, rb, RKC(i), ra));
616      )
617      vmcase(OP_ADD,
618      arith_op(luai_numadd, TM_ADD);
619      )
620      vmcase(OP_SUB,
621      arith_op(luai_numsub, TM_SUB);
622      )
623      vmcase(OP_MUL,
624      arith_op(luai_nummul, TM_MUL);
625      )
626      vmcase(OP_DIV,
627      arith_op(luai_numdiv, TM_DIV);
628      )
629      vmcase(OP_MOD,
630      arith_op(luai_nummod, TM_MOD);
631      )
632      vmcase(OP_POW,
633      arith_op(luai_numpow, TM_POW);
634      )
635      vmcase(OP_UNM,
636      TValue *rb = RB(i);
637      if (ttisnumber(rb)) {
638         lua_Number nb = nvalue(rb);
639         setnvalue(ra, luai_numunm(L, nb));
640      }
641      else {
642         Protect(luaV_arith(L, ra, rb, rb, TM_UNM));
643      }
644      )
645      vmcase(OP_NOT,
646      TValue *rb = RB(i);
647      int res = l_isfalse(rb);  /* next assignment may change this value */
648      setbvalue(ra, res);
649      )
650      vmcase(OP_LEN,
651      Protect(luaV_objlen(L, ra, RB(i)));
652      )
653      vmcase(OP_CONCAT,
654      int b = GETARG_B(i);
655      int c = GETARG_C(i);
656      StkId rb;
657      L->top = base + c + 1;  /* mark the end of concat operands */
658      Protect(luaV_concat(L, c - b + 1));
659      ra = RA(i);  /* 'luav_concat' may invoke TMs and move the stack */
660      rb = b + base;
661      setobjs2s(L, ra, rb);
662      checkGC(L, (ra >= rb ? ra + 1 : rb));
663      L->top = ci->top;  /* restore top */
664      )
665      vmcase(OP_JMP,
666      dojump(ci, i, 0);
667      )
668      vmcase(OP_EQ,
669      TValue *rb = RKB(i);
670      TValue *rc = RKC(i);
671      Protect(
672         if (cast_int(equalobj(L, rb, rc)) != GETARG_A(i))
673         ci->u.l.savedpc++;
674         else
675         donextjump(ci);
676      )
677      )
678      vmcase(OP_LT,
679      Protect(
680         if (luaV_lessthan(L, RKB(i), RKC(i)) != GETARG_A(i))
681         ci->u.l.savedpc++;
682         else
683         donextjump(ci);
684      )
685      )
686      vmcase(OP_LE,
687      Protect(
688         if (luaV_lessequal(L, RKB(i), RKC(i)) != GETARG_A(i))
689         ci->u.l.savedpc++;
690         else
691         donextjump(ci);
692      )
693      )
694      vmcase(OP_TEST,
695      if (GETARG_C(i) ? l_isfalse(ra) : !l_isfalse(ra))
696         ci->u.l.savedpc++;
697         else
698         donextjump(ci);
699      )
700      vmcase(OP_TESTSET,
701      TValue *rb = RB(i);
702      if (GETARG_C(i) ? l_isfalse(rb) : !l_isfalse(rb))
703         ci->u.l.savedpc++;
704      else {
705         setobjs2s(L, ra, rb);
706         donextjump(ci);
707      }
708      )
709      vmcase(OP_CALL,
710      int b = GETARG_B(i);
711      int nresults = GETARG_C(i) - 1;
712      if (b != 0) L->top = ra+b;  /* else previous instruction set top */
713      if (luaD_precall(L, ra, nresults)) {  /* C function? */
714         if (nresults >= 0) L->top = ci->top;  /* adjust results */
715         base = ci->u.l.base;
716      }
717      else {  /* Lua function */
718         ci = L->ci;
719         ci->callstatus |= CIST_REENTRY;
720         goto newframe;  /* restart luaV_execute over new Lua function */
721      }
722      )
723      vmcase(OP_TAILCALL,
724      int b = GETARG_B(i);
725      if (b != 0) L->top = ra+b;  /* else previous instruction set top */
726      lua_assert(GETARG_C(i) - 1 == LUA_MULTRET);
727      if (luaD_precall(L, ra, LUA_MULTRET))  /* C function? */
728         base = ci->u.l.base;
729      else {
730         /* tail call: put called frame (n) in place of caller one (o) */
731         CallInfo *nci = L->ci;  /* called frame */
732         CallInfo *oci = nci->previous;  /* caller frame */
733         StkId nfunc = nci->func;  /* called function */
734         StkId ofunc = oci->func;  /* caller function */
735         /* last stack slot filled by 'precall' */
736         StkId lim = nci->u.l.base + getproto(nfunc)->numparams;
737         int aux;
738         /* close all upvalues from previous call */
739         if (cl->p->sizep > 0) luaF_close(L, oci->u.l.base);
740         /* move new frame into old one */
741         for (aux = 0; nfunc + aux < lim; aux++)
742         setobjs2s(L, ofunc + aux, nfunc + aux);
743         oci->u.l.base = ofunc + (nci->u.l.base - nfunc);  /* correct base */
744         oci->top = L->top = ofunc + (L->top - nfunc);  /* correct top */
745         oci->u.l.savedpc = nci->u.l.savedpc;
746         oci->callstatus |= CIST_TAIL;  /* function was tail called */
747         ci = L->ci = oci;  /* remove new frame */
748         lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize);
749         goto newframe;  /* restart luaV_execute over new Lua function */
750      }
751      )
752      vmcasenb(OP_RETURN,
753      int b = GETARG_B(i);
754      if (b != 0) L->top = ra+b-1;
755      if (cl->p->sizep > 0) luaF_close(L, base);
756      b = luaD_poscall(L, ra);
757      if (!(ci->callstatus & CIST_REENTRY))  /* 'ci' still the called one */
758         return;  /* external invocation: return */
759      else {  /* invocation via reentry: continue execution */
760         ci = L->ci;
761         if (b) L->top = ci->top;
762         lua_assert(isLua(ci));
763         lua_assert(GET_OPCODE(*((ci)->u.l.savedpc - 1)) == OP_CALL);
764         goto newframe;  /* restart luaV_execute over new Lua function */
765      }
766      )
767      vmcase(OP_FORLOOP,
768      lua_Number step = nvalue(ra+2);
769      lua_Number idx = luai_numadd(L, nvalue(ra), step); /* increment index */
770      lua_Number limit = nvalue(ra+1);
771      if (luai_numlt(L, 0, step) ? luai_numle(L, idx, limit)
772                           : luai_numle(L, limit, idx)) {
773         ci->u.l.savedpc += GETARG_sBx(i);  /* jump back */
774         setnvalue(ra, idx);  /* update internal index... */
775         setnvalue(ra+3, idx);  /* ...and external index */
776      }
777      )
778      vmcase(OP_FORPREP,
779      const TValue *init = ra;
780      const TValue *plimit = ra+1;
781      const TValue *pstep = ra+2;
782      if (!tonumber(init, ra))
783         luaG_runerror(L, LUA_QL("for") " initial value must be a number");
784      else if (!tonumber(plimit, ra+1))
785         luaG_runerror(L, LUA_QL("for") " limit must be a number");
786      else if (!tonumber(pstep, ra+2))
787         luaG_runerror(L, LUA_QL("for") " step must be a number");
788      setnvalue(ra, luai_numsub(L, nvalue(ra), nvalue(pstep)));
789      ci->u.l.savedpc += GETARG_sBx(i);
790      )
791      vmcasenb(OP_TFORCALL,
792      StkId cb = ra + 3;  /* call base */
793      setobjs2s(L, cb+2, ra+2);
794      setobjs2s(L, cb+1, ra+1);
795      setobjs2s(L, cb, ra);
796      L->top = cb + 3;  /* func. + 2 args (state and index) */
797      Protect(luaD_call(L, cb, GETARG_C(i), 1));
798      L->top = ci->top;
799      i = *(ci->u.l.savedpc++);  /* go to next instruction */
800      ra = RA(i);
801      lua_assert(GET_OPCODE(i) == OP_TFORLOOP);
802      goto l_tforloop;
803      )
804      vmcase(OP_TFORLOOP,
805      l_tforloop:
806      if (!ttisnil(ra + 1)) {  /* continue loop? */
807         setobjs2s(L, ra, ra + 1);  /* save control variable */
808         ci->u.l.savedpc += GETARG_sBx(i);  /* jump back */
809      }
810      )
811      vmcase(OP_SETLIST,
812      int n = GETARG_B(i);
813      int c = GETARG_C(i);
814      int last;
815      Table *h;
816      if (n == 0) n = cast_int(L->top - ra) - 1;
817      if (c == 0) {
818         lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG);
819         c = GETARG_Ax(*ci->u.l.savedpc++);
820      }
821      luai_runtimecheck(L, ttistable(ra));
822      h = hvalue(ra);
823      last = ((c-1)*LFIELDS_PER_FLUSH) + n;
824      if (last > h->sizearray)  /* needs more space? */
825         luaH_resizearray(L, h, last);  /* pre-allocate it at once */
826      for (; n > 0; n--) {
827         TValue *val = ra+n;
828         luaH_setint(L, h, last--, val);
829         luaC_barrierback(L, obj2gco(h), val);
830      }
831      L->top = ci->top;  /* correct top (in case of previous open call) */
832      )
833      vmcase(OP_CLOSURE,
834      Proto *p = cl->p->p[GETARG_Bx(i)];
835      Closure *ncl = getcached(p, cl->upvals, base);  /* cached closure */
836      if (ncl == NULL)  /* no match? */
837         pushclosure(L, p, cl->upvals, base, ra);  /* create a new one */
838      else
839         setclLvalue(L, ra, ncl);  /* push cashed closure */
840      checkGC(L, ra + 1);
841      )
842      vmcase(OP_VARARG,
843      int b = GETARG_B(i) - 1;
844      int j;
845      int n = cast_int(base - ci->func) - cl->p->numparams - 1;
846      if (b < 0) {  /* B == 0? */
847         b = n;  /* get all var. arguments */
848         Protect(luaD_checkstack(L, n));
849         ra = RA(i);  /* previous call may change the stack */
850         L->top = ra + n;
851      }
852      for (j = 0; j < b; j++) {
853         if (j < n) {
854         setobjs2s(L, ra + j, base - n + j);
855         }
856         else {
857         setnilvalue(ra + j);
858         }
859      }
860      )
861      vmcase(OP_EXTRAARG,
862      lua_assert(0);
863      )
864   }
865   }
866866}
867
trunk/src/lib/lua/lctype.c
r31373r31374
99
1010#include "lctype.h"
1111
12#if !LUA_USE_CTYPE   /* { */
12#if !LUA_USE_CTYPE  /* { */
1313
1414#include <limits.h>
1515
1616LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = {
17  0x00,  /* EOZ */
18  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,   /* 0. */
19  0x00,  0x08,  0x08,  0x08,  0x08,  0x08,  0x00,  0x00,
20  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,   /* 1. */
21  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
22  0x0c,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,   /* 2. */
23  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,
24  0x16,  0x16,  0x16,  0x16,  0x16,  0x16,  0x16,  0x16,   /* 3. */
25  0x16,  0x16,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,
26  0x04,  0x15,  0x15,  0x15,  0x15,  0x15,  0x15,  0x05,   /* 4. */
27  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,
28  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,   /* 5. */
29  0x05,  0x05,  0x05,  0x04,  0x04,  0x04,  0x04,  0x05,
30  0x04,  0x15,  0x15,  0x15,  0x15,  0x15,  0x15,  0x05,   /* 6. */
31  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,
32  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,   /* 7. */
33  0x05,  0x05,  0x05,  0x04,  0x04,  0x04,  0x04,  0x00,
34  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,   /* 8. */
35  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
36  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,   /* 9. */
37  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
38  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,   /* a. */
39  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
40  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,   /* b. */
41  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
42  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,   /* c. */
43  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
44  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,   /* d. */
45  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
46  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,   /* e. */
47  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
48  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,   /* f. */
49  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
17   0x00,  /* EOZ */
18   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  /* 0. */
19   0x00,  0x08,  0x08,  0x08,  0x08,  0x08,  0x00,  0x00,
20   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  /* 1. */
21   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
22   0x0c,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,  /* 2. */
23   0x04,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,
24   0x16,  0x16,  0x16,  0x16,  0x16,  0x16,  0x16,  0x16,  /* 3. */
25   0x16,  0x16,  0x04,  0x04,  0x04,  0x04,  0x04,  0x04,
26   0x04,  0x15,  0x15,  0x15,  0x15,  0x15,  0x15,  0x05,  /* 4. */
27   0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,
28   0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  /* 5. */
29   0x05,  0x05,  0x05,  0x04,  0x04,  0x04,  0x04,  0x05,
30   0x04,  0x15,  0x15,  0x15,  0x15,  0x15,  0x15,  0x05,  /* 6. */
31   0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,
32   0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  0x05,  /* 7. */
33   0x05,  0x05,  0x05,  0x04,  0x04,  0x04,  0x04,  0x00,
34   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  /* 8. */
35   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
36   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  /* 9. */
37   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
38   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  /* a. */
39   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
40   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  /* b. */
41   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
42   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  /* c. */
43   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
44   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  /* d. */
45   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
46   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  /* e. */
47   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
48   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  /* f. */
49   0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
5050};
5151
52#endif         /* } */
52#endif          /* } */
trunk/src/lib/lua/ltable.c
r31373r31374
4040** max size of array part is 2^MAXBITS
4141*/
4242#if LUAI_BITSINT >= 32
43#define MAXBITS      30
43#define MAXBITS     30
4444#else
45#define MAXBITS      (LUAI_BITSINT-2)
45#define MAXBITS     (LUAI_BITSINT-2)
4646#endif
4747
48#define MAXASIZE   (1 << MAXBITS)
48#define MAXASIZE    (1 << MAXBITS)
4949
5050
51#define hashpow2(t,n)      (gnode(t, lmod((n), sizenode(t))))
51#define hashpow2(t,n)       (gnode(t, lmod((n), sizenode(t))))
5252
53#define hashstr(t,str)      hashpow2(t, (str)->tsv.hash)
54#define hashboolean(t,p)   hashpow2(t, p)
53#define hashstr(t,str)      hashpow2(t, (str)->tsv.hash)
54#define hashboolean(t,p)    hashpow2(t, p)
5555
5656
5757/*
5858** for some types, it is better to avoid modulus by power of 2, as
5959** they tend to have many 2 factors.
6060*/
61#define hashmod(t,n)   (gnode(t, ((n) % ((sizenode(t)-1)|1))))
61#define hashmod(t,n)    (gnode(t, ((n) % ((sizenode(t)-1)|1))))
6262
6363
64#define hashpointer(t,p)   hashmod(t, IntPoint(p))
64#define hashpointer(t,p)    hashmod(t, IntPoint(p))
6565
6666
67#define dummynode      (&dummynode_)
67#define dummynode       (&dummynode_)
6868
69#define isdummy(n)      ((n) == dummynode)
69#define isdummy(n)      ((n) == dummynode)
7070
7171static const Node dummynode_ = {
72  {NILCONSTANT},  /* value */
73  {{NILCONSTANT, NULL}}  /* key */
72   {NILCONSTANT},  /* value */
73   {{NILCONSTANT, NULL}}  /* key */
7474};
7575
7676
r31373r31374
7878** hash for lua_Numbers
7979*/
8080static Node *hashnum (const Table *t, lua_Number n) {
81  int i;
82  luai_hashnum(i, n);
83  if (i < 0) {
84    if (cast(unsigned int, i) == 0u - i)  /* use unsigned to avoid overflows */
85      i = 0;  /* handle INT_MIN */
86    i = -i;  /* must be a positive value */
87  }
88  return hashmod(t, i);
81   int i;
82   luai_hashnum(i, n);
83   if (i < 0) {
84   if (cast(unsigned int, i) == 0u - i)  /* use unsigned to avoid overflows */
85      i = 0;  /* handle INT_MIN */
86   i = -i;  /* must be a positive value */
87   }
88   return hashmod(t, i);
8989}
9090
9191
r31373r31374
9595** of its hash value)
9696*/
9797static Node *mainposition (const Table *t, const TValue *key) {
98  switch (ttype(key)) {
99    case LUA_TNUMBER:
100      return hashnum(t, nvalue(key));
101    case LUA_TLNGSTR: {
102      TString *s = rawtsvalue(key);
103      if (s->tsv.extra == 0) {  /* no hash? */
104        s->tsv.hash = luaS_hash(getstr(s), s->tsv.len, s->tsv.hash);
105        s->tsv.extra = 1;  /* now it has its hash */
106      }
107      return hashstr(t, rawtsvalue(key));
108    }
109    case LUA_TSHRSTR:
110      return hashstr(t, rawtsvalue(key));
111    case LUA_TBOOLEAN:
112      return hashboolean(t, bvalue(key));
113    case LUA_TLIGHTUSERDATA:
114      return hashpointer(t, pvalue(key));
115    case LUA_TLCF:
116      return hashpointer(t, fvalue(key));
117    default:
118      return hashpointer(t, gcvalue(key));
119  }
98   switch (ttype(key)) {
99   case LUA_TNUMBER:
100      return hashnum(t, nvalue(key));
101   case LUA_TLNGSTR: {
102      TString *s = rawtsvalue(key);
103      if (s->tsv.extra == 0) {  /* no hash? */
104      s->tsv.hash = luaS_hash(getstr(s), s->tsv.len, s->tsv.hash);
105      s->tsv.extra = 1;  /* now it has its hash */
106      }
107      return hashstr(t, rawtsvalue(key));
108   }
109   case LUA_TSHRSTR:
110      return hashstr(t, rawtsvalue(key));
111   case LUA_TBOOLEAN:
112      return hashboolean(t, bvalue(key));
113   case LUA_TLIGHTUSERDATA:
114      return hashpointer(t, pvalue(key));
115   case LUA_TLCF:
116      return hashpointer(t, fvalue(key));
117   default:
118      return hashpointer(t, gcvalue(key));
119   }
120120}
121121
122122
r31373r31374
125125** the array part of the table, -1 otherwise.
126126*/
127127static int arrayindex (const TValue *key) {
128  if (ttisnumber(key)) {
129    lua_Number n = nvalue(key);
130    int k;
131    lua_number2int(k, n);
132    if (luai_numeq(cast_num(k), n))
133      return k;
134  }
135  return -1;  /* `key' did not match some condition */
128   if (ttisnumber(key)) {
129   lua_Number n = nvalue(key);
130   int k;
131   lua_number2int(k, n);
132   if (luai_numeq(cast_num(k), n))
133      return k;
134   }
135   return -1;  /* `key' did not match some condition */
136136}
137137
138138
r31373r31374
142142** beginning of a traversal is signaled by -1.
143143*/
144144static int findindex (lua_State *L, Table *t, StkId key) {
145  int i;
146  if (ttisnil(key)) return -1;  /* first iteration */
147  i = arrayindex(key);
148  if (0 < i && i <= t->sizearray)  /* is `key' inside array part? */
149    return i-1;  /* yes; that's the index (corrected to C) */
150  else {
151    Node *n = mainposition(t, key);
152    for (;;) {  /* check whether `key' is somewhere in the chain */
153      /* key may be dead already, but it is ok to use it in `next' */
154      if (luaV_rawequalobj(gkey(n), key) ||
155            (ttisdeadkey(gkey(n)) && iscollectable(key) &&
156             deadvalue(gkey(n)) == gcvalue(key))) {
157        i = cast_int(n - gnode(t, 0));  /* key index in hash table */
158        /* hash elements are numbered after array ones */
159        return i + t->sizearray;
160      }
161      else n = gnext(n);
162      if (n == NULL)
163        luaG_runerror(L, "invalid key to " LUA_QL("next"));  /* key not found */
164    }
165  }
145   int i;
146   if (ttisnil(key)) return -1;  /* first iteration */
147   i = arrayindex(key);
148   if (0 < i && i <= t->sizearray)  /* is `key' inside array part? */
149   return i-1;  /* yes; that's the index (corrected to C) */
150   else {
151   Node *n = mainposition(t, key);
152   for (;;) {  /* check whether `key' is somewhere in the chain */
153      /* key may be dead already, but it is ok to use it in `next' */
154      if (luaV_rawequalobj(gkey(n), key) ||
155         (ttisdeadkey(gkey(n)) && iscollectable(key) &&
156            deadvalue(gkey(n)) == gcvalue(key))) {
157      i = cast_int(n - gnode(t, 0));  /* key index in hash table */
158      /* hash elements are numbered after array ones */
159      return i + t->sizearray;
160      }
161      else n = gnext(n);
162      if (n == NULL)
163      luaG_runerror(L, "invalid key to " LUA_QL("next"));  /* key not found */
164   }
165   }
166166}
167167
168168
169169int luaH_next (lua_State *L, Table *t, StkId key) {
170  int i = findindex(L, t, key);  /* find original element */
171  for (i++; i < t->sizearray; i++) {  /* try first array part */
172    if (!ttisnil(&t->array[i])) {  /* a non-nil value? */
173      setnvalue(key, cast_num(i+1));
174      setobj2s(L, key+1, &t->array[i]);
175      return 1;
176    }
177  }
178  for (i -= t->sizearray; i < sizenode(t); i++) {  /* then hash part */
179    if (!ttisnil(gval(gnode(t, i)))) {  /* a non-nil value? */
180      setobj2s(L, key, gkey(gnode(t, i)));
181      setobj2s(L, key+1, gval(gnode(t, i)));
182      return 1;
183    }
184  }
185  return 0;  /* no more elements */
170   int i = findindex(L, t, key);  /* find original element */
171   for (i++; i < t->sizearray; i++) {  /* try first array part */
172   if (!ttisnil(&t->array[i])) {  /* a non-nil value? */
173      setnvalue(key, cast_num(i+1));
174      setobj2s(L, key+1, &t->array[i]);
175      return 1;
176   }
177   }
178   for (i -= t->sizearray; i < sizenode(t); i++) {  /* then hash part */
179   if (!ttisnil(gval(gnode(t, i)))) {  /* a non-nil value? */
180      setobj2s(L, key, gkey(gnode(t, i)));
181      setobj2s(L, key+1, gval(gnode(t, i)));
182      return 1;
183   }
184   }
185   return 0;  /* no more elements */
186186}
187187
188188
r31373r31374
194194
195195
196196static int computesizes (int nums[], int *narray) {
197  int i;
198  int twotoi;  /* 2^i */
199  int a = 0;  /* number of elements smaller than 2^i */
200  int na = 0;  /* number of elements to go to array part */
201  int n = 0;  /* optimal size for array part */
202  for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) {
203    if (nums[i] > 0) {
204      a += nums[i];
205      if (a > twotoi/2) {  /* more than half elements present? */
206        n = twotoi;  /* optimal size (till now) */
207        na = a;  /* all elements smaller than n will go to array part */
208      }
209    }
210    if (a == *narray) break;  /* all elements already counted */
211  }
212  *narray = n;
213  lua_assert(*narray/2 <= na && na <= *narray);
214  return na;
197   int i;
198   int twotoi;  /* 2^i */
199   int a = 0;  /* number of elements smaller than 2^i */
200   int na = 0;  /* number of elements to go to array part */
201   int n = 0;  /* optimal size for array part */
202   for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) {
203   if (nums[i] > 0) {
204      a += nums[i];
205      if (a > twotoi/2) {  /* more than half elements present? */
206      n = twotoi;  /* optimal size (till now) */
207      na = a;  /* all elements smaller than n will go to array part */
208      }
209   }
210   if (a == *narray) break;  /* all elements already counted */
211   }
212   *narray = n;
213   lua_assert(*narray/2 <= na && na <= *narray);
214   return na;
215215}
216216
217217
218218static int countint (const TValue *key, int *nums) {
219  int k = arrayindex(key);
220  if (0 < k && k <= MAXASIZE) {  /* is `key' an appropriate array index? */
221    nums[luaO_ceillog2(k)]++;  /* count as such */
222    return 1;
223  }
224  else
225    return 0;
219   int k = arrayindex(key);
220   if (0 < k && k <= MAXASIZE) {  /* is `key' an appropriate array index? */
221   nums[luaO_ceillog2(k)]++;  /* count as such */
222   return 1;
223   }
224   else
225   return 0;
226226}
227227
228228
229229static int numusearray (const Table *t, int *nums) {
230  int lg;
231  int ttlg;  /* 2^lg */
232  int ause = 0;  /* summation of `nums' */
233  int i = 1;  /* count to traverse all array keys */
234  for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) {  /* for each slice */
235    int lc = 0;  /* counter */
236    int lim = ttlg;
237    if (lim > t->sizearray) {
238      lim = t->sizearray;  /* adjust upper limit */
239      if (i > lim)
240        break;  /* no more elements to count */
241    }
242    /* count elements in range (2^(lg-1), 2^lg] */
243    for (; i <= lim; i++) {
244      if (!ttisnil(&t->array[i-1]))
245        lc++;
246    }
247    nums[lg] += lc;
248    ause += lc;
249  }
250  return ause;
230   int lg;
231   int ttlg;  /* 2^lg */
232   int ause = 0;  /* summation of `nums' */
233   int i = 1;  /* count to traverse all array keys */
234   for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) {  /* for each slice */
235   int lc = 0;  /* counter */
236   int lim = ttlg;
237   if (lim > t->sizearray) {
238      lim = t->sizearray;  /* adjust upper limit */
239      if (i > lim)
240      break;  /* no more elements to count */
241   }
242   /* count elements in range (2^(lg-1), 2^lg] */
243   for (; i <= lim; i++) {
244      if (!ttisnil(&t->array[i-1]))
245      lc++;
246   }
247   nums[lg] += lc;
248   ause += lc;
249   }
250   return ause;
251251}
252252
253253
254254static int numusehash (const Table *t, int *nums, int *pnasize) {
255  int totaluse = 0;  /* total number of elements */
256  int ause = 0;  /* summation of `nums' */
257  int i = sizenode(t);
258  while (i--) {
259    Node *n = &t->node[i];
260    if (!ttisnil(gval(n))) {
261      ause += countint(gkey(n), nums);
262      totaluse++;
263    }
264  }
265  *pnasize += ause;
266  return totaluse;
255   int totaluse = 0;  /* total number of elements */
256   int ause = 0;  /* summation of `nums' */
257   int i = sizenode(t);
258   while (i--) {
259   Node *n = &t->node[i];
260   if (!ttisnil(gval(n))) {
261      ause += countint(gkey(n), nums);
262      totaluse++;
263   }
264   }
265   *pnasize += ause;
266   return totaluse;
267267}
268268
269269
270270static void setarrayvector (lua_State *L, Table *t, int size) {
271  int i;
272  luaM_reallocvector(L, t->array, t->sizearray, size, TValue);
273  for (i=t->sizearray; i<size; i++)
274     setnilvalue(&t->array[i]);
275  t->sizearray = size;
271   int i;
272   luaM_reallocvector(L, t->array, t->sizearray, size, TValue);
273   for (i=t->sizearray; i<size; i++)
274      setnilvalue(&t->array[i]);
275   t->sizearray = size;
276276}
277277
278278
279279static void setnodevector (lua_State *L, Table *t, int size) {
280  int lsize;
281  if (size == 0) {  /* no elements to hash part? */
282    t->node = cast(Node *, dummynode);  /* use common `dummynode' */
283    lsize = 0;
284  }
285  else {
286    int i;
287    lsize = luaO_ceillog2(size);
288    if (lsize > MAXBITS)
289      luaG_runerror(L, "table overflow");
290    size = twoto(lsize);
291    t->node = luaM_newvector(L, size, Node);
292    for (i=0; i<size; i++) {
293      Node *n = gnode(t, i);
294      gnext(n) = NULL;
295      setnilvalue(gkey(n));
296      setnilvalue(gval(n));
297    }
298  }
299  t->lsizenode = cast_byte(lsize);
300  t->lastfree = gnode(t, size);  /* all positions are free */
280   int lsize;
281   if (size == 0) {  /* no elements to hash part? */
282   t->node = cast(Node *, dummynode);  /* use common `dummynode' */
283   lsize = 0;
284   }
285   else {
286   int i;
287   lsize = luaO_ceillog2(size);
288   if (lsize > MAXBITS)
289      luaG_runerror(L, "table overflow");
290   size = twoto(lsize);
291   t->node = luaM_newvector(L, size, Node);
292   for (i=0; i<size; i++) {
293      Node *n = gnode(t, i);
294      gnext(n) = NULL;
295      setnilvalue(gkey(n));
296      setnilvalue(gval(n));
297   }
298   }
299   t->lsizenode = cast_byte(lsize);
300   t->lastfree = gnode(t, size);  /* all positions are free */
301301}
302302
303303
304304void luaH_resize (lua_State *L, Table *t, int nasize, int nhsize) {
305  int i;
306  int oldasize = t->sizearray;
307  int oldhsize = t->lsizenode;
308  Node *nold = t->node;  /* save old hash ... */
309  if (nasize > oldasize)  /* array part must grow? */
310    setarrayvector(L, t, nasize);
311  /* create new hash part with appropriate size */
312  setnodevector(L, t, nhsize);
313  if (nasize < oldasize) {  /* array part must shrink? */
314    t->sizearray = nasize;
315    /* re-insert elements from vanishing slice */
316    for (i=nasize; i<oldasize; i++) {
317      if (!ttisnil(&t->array[i]))
318        luaH_setint(L, t, i + 1, &t->array[i]);
319    }
320    /* shrink array */
321    luaM_reallocvector(L, t->array, oldasize, nasize, TValue);
322  }
323  /* re-insert elements from hash part */
324  for (i = twoto(oldhsize) - 1; i >= 0; i--) {
325    Node *old = nold+i;
326    if (!ttisnil(gval(old))) {
327      /* doesn't need barrier/invalidate cache, as entry was
328         already present in the table */
329      setobjt2t(L, luaH_set(L, t, gkey(old)), gval(old));
330    }
331  }
332  if (!isdummy(nold))
333    luaM_freearray(L, nold, cast(size_t, twoto(oldhsize))); /* free old array */
305   int i;
306   int oldasize = t->sizearray;
307   int oldhsize = t->lsizenode;
308   Node *nold = t->node;  /* save old hash ... */
309   if (nasize > oldasize)  /* array part must grow? */
310   setarrayvector(L, t, nasize);
311   /* create new hash part with appropriate size */
312   setnodevector(L, t, nhsize);
313   if (nasize < oldasize) {  /* array part must shrink? */
314   t->sizearray = nasize;
315   /* re-insert elements from vanishing slice */
316   for (i=nasize; i<oldasize; i++) {
317      if (!ttisnil(&t->array[i]))
318      luaH_setint(L, t, i + 1, &t->array[i]);
319   }
320   /* shrink array */
321   luaM_reallocvector(L, t->array, oldasize, nasize, TValue);
322   }
323   /* re-insert elements from hash part */
324   for (i = twoto(oldhsize) - 1; i >= 0; i--) {
325   Node *old = nold+i;
326   if (!ttisnil(gval(old))) {
327      /* doesn't need barrier/invalidate cache, as entry was
328       already present in the table */
329      setobjt2t(L, luaH_set(L, t, gkey(old)), gval(old));
330   }
331   }
332   if (!isdummy(nold))
333   luaM_freearray(L, nold, cast(size_t, twoto(oldhsize))); /* free old array */
334334}
335335
336336
337337void luaH_resizearray (lua_State *L, Table *t, int nasize) {
338  int nsize = isdummy(t->node) ? 0 : sizenode(t);
339  luaH_resize(L, t, nasize, nsize);
338   int nsize = isdummy(t->node) ? 0 : sizenode(t);
339   luaH_resize(L, t, nasize, nsize);
340340}
341341
342342
343343static void rehash (lua_State *L, Table *t, const TValue *ek) {
344  int nasize, na;
345  int nums[MAXBITS+1];  /* nums[i] = number of keys with 2^(i-1) < k <= 2^i */
346  int i;
347  int totaluse;
348  for (i=0; i<=MAXBITS; i++) nums[i] = 0;  /* reset counts */
349  nasize = numusearray(t, nums);  /* count keys in array part */
350  totaluse = nasize;  /* all those keys are integer keys */
351  totaluse += numusehash(t, nums, &nasize);  /* count keys in hash part */
352  /* count extra key */
353  nasize += countint(ek, nums);
354  totaluse++;
355  /* compute new size for array part */
356  na = computesizes(nums, &nasize);
357  /* resize the table to new computed sizes */
358  luaH_resize(L, t, nasize, totaluse - na);
344   int nasize, na;
345   int nums[MAXBITS+1];  /* nums[i] = number of keys with 2^(i-1) < k <= 2^i */
346   int i;
347   int totaluse;
348   for (i=0; i<=MAXBITS; i++) nums[i] = 0;  /* reset counts */
349   nasize = numusearray(t, nums);  /* count keys in array part */
350   totaluse = nasize;  /* all those keys are integer keys */
351   totaluse += numusehash(t, nums, &nasize);  /* count keys in hash part */
352   /* count extra key */
353   nasize += countint(ek, nums);
354   totaluse++;
355   /* compute new size for array part */
356   na = computesizes(nums, &nasize);
357   /* resize the table to new computed sizes */
358   luaH_resize(L, t, nasize, totaluse - na);
359359}
360360
361361
r31373r31374
366366
367367
368368Table *luaH_new (lua_State *L) {
369  Table *t = &luaC_newobj(L, LUA_TTABLE, sizeof(Table), NULL, 0)->h;
370  t->metatable = NULL;
371  t->flags = cast_byte(~0);
372  t->array = NULL;
373  t->sizearray = 0;
374  setnodevector(L, t, 0);
375  return t;
369   Table *t = &luaC_newobj(L, LUA_TTABLE, sizeof(Table), NULL, 0)->h;
370   t->metatable = NULL;
371   t->flags = cast_byte(~0);
372   t->array = NULL;
373   t->sizearray = 0;
374   setnodevector(L, t, 0);
375   return t;
376376}
377377
378378
379379void luaH_free (lua_State *L, Table *t) {
380  if (!isdummy(t->node))
381    luaM_freearray(L, t->node, cast(size_t, sizenode(t)));
382  luaM_freearray(L, t->array, t->sizearray);
383  luaM_free(L, t);
380   if (!isdummy(t->node))
381   luaM_freearray(L, t->node, cast(size_t, sizenode(t)));
382   luaM_freearray(L, t->array, t->sizearray);
383   luaM_free(L, t);
384384}
385385
386386
387387static Node *getfreepos (Table *t) {
388  while (t->lastfree > t->node) {
389    t->lastfree--;
390    if (ttisnil(gkey(t->lastfree)))
391      return t->lastfree;
392  }
393  return NULL;  /* could not find a free place */
388   while (t->lastfree > t->node) {
389   t->lastfree--;
390   if (ttisnil(gkey(t->lastfree)))
391      return t->lastfree;
392   }
393   return NULL;  /* could not find a free place */
394394}
395395
396396
r31373r31374
403403** position), new key goes to an empty position.
404404*/
405405TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) {
406  Node *mp;
407  if (ttisnil(key)) luaG_runerror(L, "table index is nil");
408  else if (ttisnumber(key) && luai_numisnan(L, nvalue(key)))
409    luaG_runerror(L, "table index is NaN");
410  mp = mainposition(t, key);
411  if (!ttisnil(gval(mp)) || isdummy(mp)) {  /* main position is taken? */
412    Node *othern;
413    Node *n = getfreepos(t);  /* get a free place */
414    if (n == NULL) {  /* cannot find a free place? */
415      rehash(L, t, key);  /* grow table */
416      /* whatever called 'newkey' take care of TM cache and GC barrier */
417      return luaH_set(L, t, key);  /* insert key into grown table */
418    }
419    lua_assert(!isdummy(n));
420    othern = mainposition(t, gkey(mp));
421    if (othern != mp) {  /* is colliding node out of its main position? */
422      /* yes; move colliding node into free position */
423      while (gnext(othern) != mp) othern = gnext(othern);  /* find previous */
424      gnext(othern) = n;  /* redo the chain with `n' in place of `mp' */
425      *n = *mp;  /* copy colliding node into free pos. (mp->next also goes) */
426      gnext(mp) = NULL;  /* now `mp' is free */
427      setnilvalue(gval(mp));
428    }
429    else {  /* colliding node is in its own main position */
430      /* new node will go into free position */
431      gnext(n) = gnext(mp);  /* chain new position */
432      gnext(mp) = n;
433      mp = n;
434    }
435  }
436  setobj2t(L, gkey(mp), key);
437  luaC_barrierback(L, obj2gco(t), key);
438  lua_assert(ttisnil(gval(mp)));
439  return gval(mp);
406   Node *mp;
407   if (ttisnil(key)) luaG_runerror(L, "table index is nil");
408   else if (ttisnumber(key) && luai_numisnan(L, nvalue(key)))
409   luaG_runerror(L, "table index is NaN");
410   mp = mainposition(t, key);
411   if (!ttisnil(gval(mp)) || isdummy(mp)) {  /* main position is taken? */
412   Node *othern;
413   Node *n = getfreepos(t);  /* get a free place */
414   if (n == NULL) {  /* cannot find a free place? */
415      rehash(L, t, key);  /* grow table */
416      /* whatever called 'newkey' take care of TM cache and GC barrier */
417      return luaH_set(L, t, key);  /* insert key into grown table */
418   }
419   lua_assert(!isdummy(n));
420   othern = mainposition(t, gkey(mp));
421   if (othern != mp) {  /* is colliding node out of its main position? */
422      /* yes; move colliding node into free position */
423      while (gnext(othern) != mp) othern = gnext(othern);  /* find previous */
424      gnext(othern) = n;  /* redo the chain with `n' in place of `mp' */
425      *n = *mp;  /* copy colliding node into free pos. (mp->next also goes) */
426      gnext(mp) = NULL;  /* now `mp' is free */
427      setnilvalue(gval(mp));
428   }
429   else {  /* colliding node is in its own main position */
430      /* new node will go into free position */
431      gnext(n) = gnext(mp);  /* chain new position */
432      gnext(mp) = n;
433      mp = n;
434   }
435   }
436   setobj2t(L, gkey(mp), key);
437   luaC_barrierback(L, obj2gco(t), key);
438   lua_assert(ttisnil(gval(mp)));
439   return gval(mp);
440440}
441441
442442
r31373r31374
444444** search function for integers
445445*/
446446const TValue *luaH_getint (Table *t, int key) {
447  /* (1 <= key && key <= t->sizearray) */
448  if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray))
449    return &t->array[key-1];
450  else {
451    lua_Number nk = cast_num(key);
452    Node *n = hashnum(t, nk);
453    do {  /* check whether `key' is somewhere in the chain */
454      if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk))
455        return gval(n);  /* that's it */
456      else n = gnext(n);
457    } while (n);
458    return luaO_nilobject;
459  }
447   /* (1 <= key && key <= t->sizearray) */
448   if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray))
449   return &t->array[key-1];
450   else {
451   lua_Number nk = cast_num(key);
452   Node *n = hashnum(t, nk);
453   do {  /* check whether `key' is somewhere in the chain */
454      if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk))
455      return gval(n);  /* that's it */
456      else n = gnext(n);
457   } while (n);
458   return luaO_nilobject;
459   }
460460}
461461
462462
r31373r31374
464464** search function for short strings
465465*/
466466const TValue *luaH_getstr (Table *t, TString *key) {
467  Node *n = hashstr(t, key);
468  lua_assert(key->tsv.tt == LUA_TSHRSTR);
469  do {  /* check whether `key' is somewhere in the chain */
470    if (ttisshrstring(gkey(n)) && eqshrstr(rawtsvalue(gkey(n)), key))
471      return gval(n);  /* that's it */
472    else n = gnext(n);
473  } while (n);
474  return luaO_nilobject;
467   Node *n = hashstr(t, key);
468   lua_assert(key->tsv.tt == LUA_TSHRSTR);
469   do {  /* check whether `key' is somewhere in the chain */
470   if (ttisshrstring(gkey(n)) && eqshrstr(rawtsvalue(gkey(n)), key))
471      return gval(n);  /* that's it */
472   else n = gnext(n);
473   } while (n);
474   return luaO_nilobject;
475475}
476476
477477
r31373r31374
479479** main search function
480480*/
481481const TValue *luaH_get (Table *t, const TValue *key) {
482  switch (ttype(key)) {
483    case LUA_TSHRSTR: return luaH_getstr(t, rawtsvalue(key));
484    case LUA_TNIL: return luaO_nilobject;
485    case LUA_TNUMBER: {
486      int k;
487      lua_Number n = nvalue(key);
488      lua_number2int(k, n);
489      if (luai_numeq(cast_num(k), n)) /* index is int? */
490        return luaH_getint(t, k);  /* use specialized version */
491      /* else go through */
492    }
493    default: {
494      Node *n = mainposition(t, key);
495      do {  /* check whether `key' is somewhere in the chain */
496        if (luaV_rawequalobj(gkey(n), key))
497          return gval(n);  /* that's it */
498        else n = gnext(n);
499      } while (n);
500      return luaO_nilobject;
501    }
502  }
482   switch (ttype(key)) {
483   case LUA_TSHRSTR: return luaH_getstr(t, rawtsvalue(key));
484   case LUA_TNIL: return luaO_nilobject;
485   case LUA_TNUMBER: {
486      int k;
487      lua_Number n = nvalue(key);
488      lua_number2int(k, n);
489      if (luai_numeq(cast_num(k), n)) /* index is int? */
490      return luaH_getint(t, k);  /* use specialized version */
491      /* else go through */
492   }
493   default: {
494      Node *n = mainposition(t, key);
495      do {  /* check whether `key' is somewhere in the chain */
496      if (luaV_rawequalobj(gkey(n), key))
497         return gval(n);  /* that's it */
498      else n = gnext(n);
499      } while (n);
500      return luaO_nilobject;
501   }
502   }
503503}
504504
505505
r31373r31374
508508** barrier and invalidate the TM cache.
509509*/
510510TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
511  const TValue *p = luaH_get(t, key);
512  if (p != luaO_nilobject)
513    return cast(TValue *, p);
514  else return luaH_newkey(L, t, key);
511   const TValue *p = luaH_get(t, key);
512   if (p != luaO_nilobject)
513   return cast(TValue *, p);
514   else return luaH_newkey(L, t, key);
515515}
516516
517517
518518void luaH_setint (lua_State *L, Table *t, int key, TValue *value) {
519  const TValue *p = luaH_getint(t, key);
520  TValue *cell;
521  if (p != luaO_nilobject)
522    cell = cast(TValue *, p);
523  else {
524    TValue k;
525    setnvalue(&k, cast_num(key));
526    cell = luaH_newkey(L, t, &k);
527  }
528  setobj2t(L, cell, value);
519   const TValue *p = luaH_getint(t, key);
520   TValue *cell;
521   if (p != luaO_nilobject)
522   cell = cast(TValue *, p);
523   else {
524   TValue k;
525   setnvalue(&k, cast_num(key));
526   cell = luaH_newkey(L, t, &k);
527   }
528   setobj2t(L, cell, value);
529529}
530530
531531
532532static int unbound_search (Table *t, unsigned int j) {
533  unsigned int i = j;  /* i is zero or a present index */
534  j++;
535  /* find `i' and `j' such that i is present and j is not */
536  while (!ttisnil(luaH_getint(t, j))) {
537    i = j;
538    j *= 2;
539    if (j > cast(unsigned int, MAX_INT)) {  /* overflow? */
540      /* table was built with bad purposes: resort to linear search */
541      i = 1;
542      while (!ttisnil(luaH_getint(t, i))) i++;
543      return i - 1;
544    }
545  }
546  /* now do a binary search between them */
547  while (j - i > 1) {
548    unsigned int m = (i+j)/2;
549    if (ttisnil(luaH_getint(t, m))) j = m;
550    else i = m;
551  }
552  return i;
533   unsigned int i = j;  /* i is zero or a present index */
534   j++;
535   /* find `i' and `j' such that i is present and j is not */
536   while (!ttisnil(luaH_getint(t, j))) {
537   i = j;
538   j *= 2;
539   if (j > cast(unsigned int, MAX_INT)) {  /* overflow? */
540      /* table was built with bad purposes: resort to linear search */
541      i = 1;
542      while (!ttisnil(luaH_getint(t, i))) i++;
543      return i - 1;
544   }
545   }
546   /* now do a binary search between them */
547   while (j - i > 1) {
548   unsigned int m = (i+j)/2;
549   if (ttisnil(luaH_getint(t, m))) j = m;
550   else i = m;
551   }
552   return i;
553553}
554554
555555
r31373r31374
558558** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil).
559559*/
560560int luaH_getn (Table *t) {
561  unsigned int j = t->sizearray;
562  if (j > 0 && ttisnil(&t->array[j - 1])) {
563    /* there is a boundary in the array part: (binary) search for it */
564    unsigned int i = 0;
565    while (j - i > 1) {
566      unsigned int m = (i+j)/2;
567      if (ttisnil(&t->array[m - 1])) j = m;
568      else i = m;
569    }
570    return i;
571  }
572  /* else must find a boundary in hash part */
573  else if (isdummy(t->node))  /* hash part is empty? */
574    return j;  /* that is easy... */
575  else return unbound_search(t, j);
561   unsigned int j = t->sizearray;
562   if (j > 0 && ttisnil(&t->array[j - 1])) {
563   /* there is a boundary in the array part: (binary) search for it */
564   unsigned int i = 0;
565   while (j - i > 1) {
566      unsigned int m = (i+j)/2;
567      if (ttisnil(&t->array[m - 1])) j = m;
568      else i = m;
569   }
570   return i;
571   }
572   /* else must find a boundary in hash part */
573   else if (isdummy(t->node))  /* hash part is empty? */
574   return j;  /* that is easy... */
575   else return unbound_search(t, j);
576576}
577577
578578
r31373r31374
580580#if defined(LUA_DEBUG)
581581
582582Node *luaH_mainposition (const Table *t, const TValue *key) {
583  return mainposition(t, key);
583   return mainposition(t, key);
584584}
585585
586586int luaH_isdummy (Node *n) { return isdummy(n); }
trunk/src/lib/lua/llex.c
r31373r31374
2929
3030
3131
32#define currIsNewline(ls)   (ls->current == '\n' || ls->current == '\r')
32#define currIsNewline(ls)   (ls->current == '\n' || ls->current == '\r')
3333
3434
3535/* ORDER RESERVED */
3636static const char *const luaX_tokens [] = {
37    "and", "break", "do", "else", "elseif",
38    "end", "false", "for", "function", "goto", "if",
39    "in", "local", "nil", "not", "or", "repeat",
40    "return", "then", "true", "until", "while",
41    "..", "...", "==", ">=", "<=", "~=", "::", "<eof>",
42    "<number>", "<name>", "<string>"
37   "and", "break", "do", "else", "elseif",
38   "end", "false", "for", "function", "goto", "if",
39   "in", "local", "nil", "not", "or", "repeat",
40   "return", "then", "true", "until", "while",
41   "..", "...", "==", ">=", "<=", "~=", "::", "<eof>",
42   "<number>", "<name>", "<string>"
4343};
4444
4545
r31373r31374
5050
5151
5252static void save (LexState *ls, int c) {
53  Mbuffer *b = ls->buff;
54  if (luaZ_bufflen(b) + 1 > luaZ_sizebuffer(b)) {
55    size_t newsize;
56    if (luaZ_sizebuffer(b) >= MAX_SIZET/2)
57      lexerror(ls, "lexical element too long", 0);
58    newsize = luaZ_sizebuffer(b) * 2;
59    luaZ_resizebuffer(ls->L, b, newsize);
60  }
61  b->buffer[luaZ_bufflen(b)++] = cast(char, c);
53   Mbuffer *b = ls->buff;
54   if (luaZ_bufflen(b) + 1 > luaZ_sizebuffer(b)) {
55   size_t newsize;
56   if (luaZ_sizebuffer(b) >= MAX_SIZET/2)
57      lexerror(ls, "lexical element too long", 0);
58   newsize = luaZ_sizebuffer(b) * 2;
59   luaZ_resizebuffer(ls->L, b, newsize);
60   }
61   b->buffer[luaZ_bufflen(b)++] = cast(char, c);
6262}
6363
6464
6565void luaX_init (lua_State *L) {
66  int i;
67  for (i=0; i<NUM_RESERVED; i++) {
68    TString *ts = luaS_new(L, luaX_tokens[i]);
69    luaS_fix(ts);  /* reserved words are never collected */
70    ts->tsv.extra = cast_byte(i+1);  /* reserved word */
71  }
66   int i;
67   for (i=0; i<NUM_RESERVED; i++) {
68   TString *ts = luaS_new(L, luaX_tokens[i]);
69   luaS_fix(ts);  /* reserved words are never collected */
70   ts->tsv.extra = cast_byte(i+1);  /* reserved word */
71   }
7272}
7373
7474
7575const char *luaX_token2str (LexState *ls, int token) {
76  if (token < FIRST_RESERVED) {  /* single-byte symbols? */
77    lua_assert(token == cast(unsigned char, token));
78    return (lisprint(token)) ? luaO_pushfstring(ls->L, LUA_QL("%c"), token) :
79                              luaO_pushfstring(ls->L, "char(%d)", token);
80  }
81  else {
82    const char *s = luaX_tokens[token - FIRST_RESERVED];
83    if (token < TK_EOS)  /* fixed format (symbols and reserved words)? */
84      return luaO_pushfstring(ls->L, LUA_QS, s);
85    else  /* names, strings, and numerals */
86      return s;
87  }
76   if (token < FIRST_RESERVED) {  /* single-byte symbols? */
77   lua_assert(token == cast(unsigned char, token));
78   return (lisprint(token)) ? luaO_pushfstring(ls->L, LUA_QL("%c"), token) :
79                        luaO_pushfstring(ls->L, "char(%d)", token);
80   }
81   else {
82   const char *s = luaX_tokens[token - FIRST_RESERVED];
83   if (token < TK_EOS)  /* fixed format (symbols and reserved words)? */
84      return luaO_pushfstring(ls->L, LUA_QS, s);
85   else  /* names, strings, and numerals */
86      return s;
87   }
8888}
8989
9090
9191static const char *txtToken (LexState *ls, int token) {
92  switch (token) {
93    case TK_NAME:
94    case TK_STRING:
95    case TK_NUMBER:
96      save(ls, '\0');
97      return luaO_pushfstring(ls->L, LUA_QS, luaZ_buffer(ls->buff));
98    default:
99      return luaX_token2str(ls, token);
100  }
92   switch (token) {
93   case TK_NAME:
94   case TK_STRING:
95   case TK_NUMBER:
96      save(ls, '\0');
97      return luaO_pushfstring(ls->L, LUA_QS, luaZ_buffer(ls->buff));
98   default:
99      return luaX_token2str(ls, token);
100   }
101101}
102102
103103
104104static l_noret lexerror (LexState *ls, const char *msg, int token) {
105  char buff[LUA_IDSIZE];
106  luaO_chunkid(buff, getstr(ls->source), LUA_IDSIZE);
107  msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg);
108  if (token)
109    luaO_pushfstring(ls->L, "%s near %s", msg, txtToken(ls, token));
110  luaD_throw(ls->L, LUA_ERRSYNTAX);
105   char buff[LUA_IDSIZE];
106   luaO_chunkid(buff, getstr(ls->source), LUA_IDSIZE);
107   msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg);
108   if (token)
109   luaO_pushfstring(ls->L, "%s near %s", msg, txtToken(ls, token));
110   luaD_throw(ls->L, LUA_ERRSYNTAX);
111111}
112112
113113
114114l_noret luaX_syntaxerror (LexState *ls, const char *msg) {
115  lexerror(ls, msg, ls->t.token);
115   lexerror(ls, msg, ls->t.token);
116116}
117117
118118
r31373r31374
122122** (by that time it should be anchored in function's prototype)
123123*/
124124TString *luaX_newstring (LexState *ls, const char *str, size_t l) {
125  lua_State *L = ls->L;
126  TValue *o;  /* entry for `str' */
127  TString *ts = luaS_newlstr(L, str, l);  /* create new string */
128  setsvalue2s(L, L->top++, ts);  /* temporarily anchor it in stack */
129  o = luaH_set(L, ls->fs->h, L->top - 1);
130  if (ttisnil(o)) {  /* not in use yet? (see 'addK') */
131    /* boolean value does not need GC barrier;
132       table has no metatable, so it does not need to invalidate cache */
133    setbvalue(o, 1);  /* t[string] = true */
134    luaC_checkGC(L);
135  }
136  else {  /* string already present */
137    ts = rawtsvalue(keyfromval(o));  /* re-use value previously stored */
138  }
139  L->top--;  /* remove string from stack */
140  return ts;
125   lua_State *L = ls->L;
126   TValue *o;  /* entry for `str' */
127   TString *ts = luaS_newlstr(L, str, l);  /* create new string */
128   setsvalue2s(L, L->top++, ts);  /* temporarily anchor it in stack */
129   o = luaH_set(L, ls->fs->h, L->top - 1);
130   if (ttisnil(o)) {  /* not in use yet? (see 'addK') */
131   /* boolean value does not need GC barrier;
132      table has no metatable, so it does not need to invalidate cache */
133   setbvalue(o, 1);  /* t[string] = true */
134   luaC_checkGC(L);
135   }
136   else {  /* string already present */
137   ts = rawtsvalue(keyfromval(o));  /* re-use value previously stored */
138   }
139   L->top--;  /* remove string from stack */
140   return ts;
141141}
142142
143143
r31373r31374
146146** \n, \r, \n\r, or \r\n)
147147*/
148148static void inclinenumber (LexState *ls) {
149  int old = ls->current;
150  lua_assert(currIsNewline(ls));
151  next(ls);  /* skip `\n' or `\r' */
152  if (currIsNewline(ls) && ls->current != old)
153    next(ls);  /* skip `\n\r' or `\r\n' */
154  if (++ls->linenumber >= MAX_INT)
155    luaX_syntaxerror(ls, "chunk has too many lines");
149   int old = ls->current;
150   lua_assert(currIsNewline(ls));
151   next(ls);  /* skip `\n' or `\r' */
152   if (currIsNewline(ls) && ls->current != old)
153   next(ls);  /* skip `\n\r' or `\r\n' */
154   if (++ls->linenumber >= MAX_INT)
155   luaX_syntaxerror(ls, "chunk has too many lines");
156156}
157157
158158
159159void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source,
160                    int firstchar) {
161  ls->decpoint = '.';
162  ls->L = L;
163  ls->current = firstchar;
164  ls->lookahead.token = TK_EOS;  /* no look-ahead token */
165  ls->z = z;
166  ls->fs = NULL;
167  ls->linenumber = 1;
168  ls->lastline = 1;
169  ls->source = source;
170  ls->envn = luaS_new(L, LUA_ENV);  /* create env name */
171  luaS_fix(ls->envn);  /* never collect this name */
172  luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER);  /* initialize buffer */
160               int firstchar) {
161   ls->decpoint = '.';
162   ls->L = L;
163   ls->current = firstchar;
164   ls->lookahead.token = TK_EOS;  /* no look-ahead token */
165   ls->z = z;
166   ls->fs = NULL;
167   ls->linenumber = 1;
168   ls->lastline = 1;
169   ls->source = source;
170   ls->envn = luaS_new(L, LUA_ENV);  /* create env name */
171   luaS_fix(ls->envn);  /* never collect this name */
172   luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER);  /* initialize buffer */
173173}
174174
175175
r31373r31374
183183
184184
185185static int check_next (LexState *ls, const char *set) {
186  if (ls->current == '\0' || !strchr(set, ls->current))
187    return 0;
188  save_and_next(ls);
189  return 1;
186   if (ls->current == '\0' || !strchr(set, ls->current))
187   return 0;
188   save_and_next(ls);
189   return 1;
190190}
191191
192192
r31373r31374
194194** change all characters 'from' in buffer to 'to'
195195*/
196196static void buffreplace (LexState *ls, char from, char to) {
197  size_t n = luaZ_bufflen(ls->buff);
198  char *p = luaZ_buffer(ls->buff);
199  while (n--)
200    if (p[n] == from) p[n] = to;
197   size_t n = luaZ_bufflen(ls->buff);
198   char *p = luaZ_buffer(ls->buff);
199   while (n--)
200   if (p[n] == from) p[n] = to;
201201}
202202
203203
204204#if !defined(getlocaledecpoint)
205#define getlocaledecpoint()   (localeconv()->decimal_point[0])
205#define getlocaledecpoint() (localeconv()->decimal_point[0])
206206#endif
207207
208208
209#define buff2d(b,e)   luaO_str2d(luaZ_buffer(b), luaZ_bufflen(b) - 1, e)
209#define buff2d(b,e) luaO_str2d(luaZ_buffer(b), luaZ_bufflen(b) - 1, e)
210210
211211/*
212212** in case of format error, try to change decimal point separator to
213213** the one defined in the current locale and check again
214214*/
215215static void trydecpoint (LexState *ls, SemInfo *seminfo) {
216  char old = ls->decpoint;
217  ls->decpoint = getlocaledecpoint();
218  buffreplace(ls, old, ls->decpoint);  /* try new decimal separator */
219  if (!buff2d(ls->buff, &seminfo->r)) {
220    /* format error with correct decimal point: no more options */
221    buffreplace(ls, ls->decpoint, '.');  /* undo change (for error message) */
222    lexerror(ls, "malformed number", TK_NUMBER);
223  }
216   char old = ls->decpoint;
217   ls->decpoint = getlocaledecpoint();
218   buffreplace(ls, old, ls->decpoint);  /* try new decimal separator */
219   if (!buff2d(ls->buff, &seminfo->r)) {
220   /* format error with correct decimal point: no more options */
221   buffreplace(ls, ls->decpoint, '.');  /* undo change (for error message) */
222   lexerror(ls, "malformed number", TK_NUMBER);
223   }
224224}
225225
226226
r31373r31374
230230** will reject ill-formed numerals.
231231*/
232232static void read_numeral (LexState *ls, SemInfo *seminfo) {
233  const char *expo = "Ee";
234  int first = ls->current;
235  lua_assert(lisdigit(ls->current));
236  save_and_next(ls);
237  if (first == '0' && check_next(ls, "Xx"))  /* hexadecimal? */
238    expo = "Pp";
239  for (;;) {
240    if (check_next(ls, expo))  /* exponent part? */
241      check_next(ls, "+-");  /* optional exponent sign */
242    if (lisxdigit(ls->current) || ls->current == '.')
243      save_and_next(ls);
244    else  break;
245  }
246  save(ls, '\0');
247  buffreplace(ls, '.', ls->decpoint);  /* follow locale for decimal point */
248  if (!buff2d(ls->buff, &seminfo->r))  /* format error? */
249    trydecpoint(ls, seminfo); /* try to update decimal point separator */
233   const char *expo = "Ee";
234   int first = ls->current;
235   lua_assert(lisdigit(ls->current));
236   save_and_next(ls);
237   if (first == '0' && check_next(ls, "Xx"))  /* hexadecimal? */
238   expo = "Pp";
239   for (;;) {
240   if (check_next(ls, expo))  /* exponent part? */
241      check_next(ls, "+-");  /* optional exponent sign */
242   if (lisxdigit(ls->current) || ls->current == '.')
243      save_and_next(ls);
244   else  break;
245   }
246   save(ls, '\0');
247   buffreplace(ls, '.', ls->decpoint);  /* follow locale for decimal point */
248   if (!buff2d(ls->buff, &seminfo->r))  /* format error? */
249   trydecpoint(ls, seminfo); /* try to update decimal point separator */
250250}
251251
252252
r31373r31374
255255** -1 if sequence is malformed
256256*/
257257static int skip_sep (LexState *ls) {
258  int count = 0;
259  int s = ls->current;
260  lua_assert(s == '[' || s == ']');
261  save_and_next(ls);
262  while (ls->current == '=') {
263    save_and_next(ls);
264    count++;
265  }
266  return (ls->current == s) ? count : (-count) - 1;
258   int count = 0;
259   int s = ls->current;
260   lua_assert(s == '[' || s == ']');
261   save_and_next(ls);
262   while (ls->current == '=') {
263   save_and_next(ls);
264   count++;
265   }
266   return (ls->current == s) ? count : (-count) - 1;
267267}
268268
269269
270270static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) {
271  save_and_next(ls);  /* skip 2nd `[' */
272  if (currIsNewline(ls))  /* string starts with a newline? */
273    inclinenumber(ls);  /* skip it */
274  for (;;) {
275    switch (ls->current) {
276      case EOZ:
277        lexerror(ls, (seminfo) ? "unfinished long string" :
278                                 "unfinished long comment", TK_EOS);
279        break;  /* to avoid warnings */
280      case ']': {
281        if (skip_sep(ls) == sep) {
282          save_and_next(ls);  /* skip 2nd `]' */
283          goto endloop;
284        }
285        break;
286      }
287      case '\n': case '\r': {
288        save(ls, '\n');
289        inclinenumber(ls);
290        if (!seminfo) luaZ_resetbuffer(ls->buff);  /* avoid wasting space */
291        break;
292      }
293      default: {
294        if (seminfo) save_and_next(ls);
295        else next(ls);
296      }
297    }
298  } endloop:
299  if (seminfo)
300    seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep),
301                                     luaZ_bufflen(ls->buff) - 2*(2 + sep));
271   save_and_next(ls);  /* skip 2nd `[' */
272   if (currIsNewline(ls))  /* string starts with a newline? */
273   inclinenumber(ls);  /* skip it */
274   for (;;) {
275   switch (ls->current) {
276      case EOZ:
277      lexerror(ls, (seminfo) ? "unfinished long string" :
278                           "unfinished long comment", TK_EOS);
279      break;  /* to avoid warnings */
280      case ']': {
281      if (skip_sep(ls) == sep) {
282         save_and_next(ls);  /* skip 2nd `]' */
283         goto endloop;
284      }
285      break;
286      }
287      case '\n': case '\r': {
288      save(ls, '\n');
289      inclinenumber(ls);
290      if (!seminfo) luaZ_resetbuffer(ls->buff);  /* avoid wasting space */
291      break;
292      }
293      default: {
294      if (seminfo) save_and_next(ls);
295      else next(ls);
296      }
297   }
298   } endloop:
299   if (seminfo)
300   seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep),
301                              luaZ_bufflen(ls->buff) - 2*(2 + sep));
302302}
303303
304304
305305static void escerror (LexState *ls, int *c, int n, const char *msg) {
306  int i;
307  luaZ_resetbuffer(ls->buff);  /* prepare error message */
308  save(ls, '\\');
309  for (i = 0; i < n && c[i] != EOZ; i++)
310    save(ls, c[i]);
311  lexerror(ls, msg, TK_STRING);
306   int i;
307   luaZ_resetbuffer(ls->buff);  /* prepare error message */
308   save(ls, '\\');
309   for (i = 0; i < n && c[i] != EOZ; i++)
310   save(ls, c[i]);
311   lexerror(ls, msg, TK_STRING);
312312}
313313
314314
315315static int readhexaesc (LexState *ls) {
316  int c[3], i;  /* keep input for error message */
317  int r = 0;  /* result accumulator */
318  c[0] = 'x';  /* for error message */
319  for (i = 1; i < 3; i++) {  /* read two hexadecimal digits */
320    c[i] = next(ls);
321    if (!lisxdigit(c[i]))
322      escerror(ls, c, i + 1, "hexadecimal digit expected");
323    r = (r << 4) + luaO_hexavalue(c[i]);
324  }
325  return r;
316   int c[3], i;  /* keep input for error message */
317   int r = 0;  /* result accumulator */
318   c[0] = 'x';  /* for error message */
319   for (i = 1; i < 3; i++) {  /* read two hexadecimal digits */
320   c[i] = next(ls);
321   if (!lisxdigit(c[i]))
322      escerror(ls, c, i + 1, "hexadecimal digit expected");
323   r = (r << 4) + luaO_hexavalue(c[i]);
324   }
325   return r;
326326}
327327
328328
329329static int readdecesc (LexState *ls) {
330  int c[3], i;
331  int r = 0;  /* result accumulator */
332  for (i = 0; i < 3 && lisdigit(ls->current); i++) {  /* read up to 3 digits */
333    c[i] = ls->current;
334    r = 10*r + c[i] - '0';
335    next(ls);
336  }
337  if (r > UCHAR_MAX)
338    escerror(ls, c, i, "decimal escape too large");
339  return r;
330   int c[3], i;
331   int r = 0;  /* result accumulator */
332   for (i = 0; i < 3 && lisdigit(ls->current); i++) {  /* read up to 3 digits */
333   c[i] = ls->current;
334   r = 10*r + c[i] - '0';
335   next(ls);
336   }
337   if (r > UCHAR_MAX)
338   escerror(ls, c, i, "decimal escape too large");
339   return r;
340340}
341341
342342
343343static void read_string (LexState *ls, int del, SemInfo *seminfo) {
344  save_and_next(ls);  /* keep delimiter (for error messages) */
345  while (ls->current != del) {
346    switch (ls->current) {
347      case EOZ:
348        lexerror(ls, "unfinished string", TK_EOS);
349        break;  /* to avoid warnings */
350      case '\n':
351      case '\r':
352        lexerror(ls, "unfinished string", TK_STRING);
353        break;  /* to avoid warnings */
354      case '\\': {  /* escape sequences */
355        int c;  /* final character to be saved */
356        next(ls);  /* do not save the `\' */
357        switch (ls->current) {
358          case 'a': c = '\a'; goto read_save;
359          case 'b': c = '\b'; goto read_save;
360          case 'f': c = '\f'; goto read_save;
361          case 'n': c = '\n'; goto read_save;
362          case 'r': c = '\r'; goto read_save;
363          case 't': c = '\t'; goto read_save;
364          case 'v': c = '\v'; goto read_save;
365          case 'x': c = readhexaesc(ls); goto read_save;
366          case '\n': case '\r':
367            inclinenumber(ls); c = '\n'; goto only_save;
368          case '\\': case '\"': case '\'':
369            c = ls->current; goto read_save;
370          case EOZ: goto no_save;  /* will raise an error next loop */
371          case 'z': {  /* zap following span of spaces */
372            next(ls);  /* skip the 'z' */
373            while (lisspace(ls->current)) {
374              if (currIsNewline(ls)) inclinenumber(ls);
375              else next(ls);
376            }
377            goto no_save;
378          }
379          default: {
380            if (!lisdigit(ls->current))
381              escerror(ls, &ls->current, 1, "invalid escape sequence");
382            /* digital escape \ddd */
383            c = readdecesc(ls);
384            goto only_save;
385          }
386        }
387       read_save: next(ls);  /* read next character */
388       only_save: save(ls, c);  /* save 'c' */
389       no_save: break;
390      }
391      default:
392        save_and_next(ls);
393    }
394  }
395  save_and_next(ls);  /* skip delimiter */
396  seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1,
397                                   luaZ_bufflen(ls->buff) - 2);
344   save_and_next(ls);  /* keep delimiter (for error messages) */
345   while (ls->current != del) {
346   switch (ls->current) {
347      case EOZ:
348      lexerror(ls, "unfinished string", TK_EOS);
349      break;  /* to avoid warnings */
350      case '\n':
351      case '\r':
352      lexerror(ls, "unfinished string", TK_STRING);
353      break;  /* to avoid warnings */
354      case '\\': {  /* escape sequences */
355      int c;  /* final character to be saved */
356      next(ls);  /* do not save the `\' */
357      switch (ls->current) {
358         case 'a': c = '\a'; goto read_save;
359         case 'b': c = '\b'; goto read_save;
360         case 'f': c = '\f'; goto read_save;
361         case 'n': c = '\n'; goto read_save;
362         case 'r': c = '\r'; goto read_save;
363         case 't': c = '\t'; goto read_save;
364         case 'v': c = '\v'; goto read_save;
365         case 'x': c = readhexaesc(ls); goto read_save;
366         case '\n': case '\r':
367         inclinenumber(ls); c = '\n'; goto only_save;
368         case '\\': case '\"': case '\'':
369         c = ls->current; goto read_save;
370         case EOZ: goto no_save;  /* will raise an error next loop */
371         case 'z': {  /* zap following span of spaces */
372         next(ls);  /* skip the 'z' */
373         while (lisspace(ls->current)) {
374            if (currIsNewline(ls)) inclinenumber(ls);
375            else next(ls);
376         }
377         goto no_save;
378         }
379         default: {
380         if (!lisdigit(ls->current))
381            escerror(ls, &ls->current, 1, "invalid escape sequence");
382         /* digital escape \ddd */
383         c = readdecesc(ls);
384         goto only_save;
385         }
386      }
387      read_save: next(ls);  /* read next character */
388      only_save: save(ls, c);  /* save 'c' */
389      no_save: break;
390      }
391      default:
392      save_and_next(ls);
393   }
394   }
395   save_and_next(ls);  /* skip delimiter */
396   seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1,
397                           luaZ_bufflen(ls->buff) - 2);
398398}
399399
400400
401401static int llex (LexState *ls, SemInfo *seminfo) {
402  luaZ_resetbuffer(ls->buff);
403  for (;;) {
404    switch (ls->current) {
405      case '\n': case '\r': {  /* line breaks */
406        inclinenumber(ls);
407        break;
408      }
409      case ' ': case '\f': case '\t': case '\v': {  /* spaces */
410        next(ls);
411        break;
412      }
413      case '-': {  /* '-' or '--' (comment) */
414        next(ls);
415        if (ls->current != '-') return '-';
416        /* else is a comment */
417        next(ls);
418        if (ls->current == '[') {  /* long comment? */
419          int sep = skip_sep(ls);
420          luaZ_resetbuffer(ls->buff);  /* `skip_sep' may dirty the buffer */
421          if (sep >= 0) {
422            read_long_string(ls, NULL, sep);  /* skip long comment */
423            luaZ_resetbuffer(ls->buff);  /* previous call may dirty the buff. */
424            break;
425          }
426        }
427        /* else short comment */
428        while (!currIsNewline(ls) && ls->current != EOZ)
429          next(ls);  /* skip until end of line (or end of file) */
430        break;
431      }
432      case '[': {  /* long string or simply '[' */
433        int sep = skip_sep(ls);
434        if (sep >= 0) {
435          read_long_string(ls, seminfo, sep);
436          return TK_STRING;
437        }
438        else if (sep == -1) return '[';
439        else lexerror(ls, "invalid long string delimiter", TK_STRING);
440      }
441      case '=': {
442        next(ls);
443        if (ls->current != '=') return '=';
444        else { next(ls); return TK_EQ; }
445      }
446      case '<': {
447        next(ls);
448        if (ls->current != '=') return '<';
449        else { next(ls); return TK_LE; }
450      }
451      case '>': {
452        next(ls);
453        if (ls->current != '=') return '>';
454        else { next(ls); return TK_GE; }
455      }
456      case '~': {
457        next(ls);
458        if (ls->current != '=') return '~';
459        else { next(ls); return TK_NE; }
460      }
461      case ':': {
462        next(ls);
463        if (ls->current != ':') return ':';
464        else { next(ls); return TK_DBCOLON; }
465      }
466      case '"': case '\'': {  /* short literal strings */
467        read_string(ls, ls->current, seminfo);
468        return TK_STRING;
469      }
470      case '.': {  /* '.', '..', '...', or number */
471        save_and_next(ls);
472        if (check_next(ls, ".")) {
473          if (check_next(ls, "."))
474            return TK_DOTS;   /* '...' */
475          else return TK_CONCAT;   /* '..' */
476        }
477        else if (!lisdigit(ls->current)) return '.';
478        /* else go through */
479      }
480      case '0': case '1': case '2': case '3': case '4':
481      case '5': case '6': case '7': case '8': case '9': {
482        read_numeral(ls, seminfo);
483        return TK_NUMBER;
484      }
485      case EOZ: {
486        return TK_EOS;
487      }
488      default: {
489        if (lislalpha(ls->current)) {  /* identifier or reserved word? */
490          TString *ts;
491          do {
492            save_and_next(ls);
493          } while (lislalnum(ls->current));
494          ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
495                                  luaZ_bufflen(ls->buff));
496          seminfo->ts = ts;
497          if (isreserved(ts))  /* reserved word? */
498            return ts->tsv.extra - 1 + FIRST_RESERVED;
499          else {
500            return TK_NAME;
501          }
502        }
503        else {  /* single-char tokens (+ - / ...) */
504          int c = ls->current;
505          next(ls);
506          return c;
507        }
508      }
509    }
510  }
402   luaZ_resetbuffer(ls->buff);
403   for (;;) {
404   switch (ls->current) {
405      case '\n': case '\r': {  /* line breaks */
406      inclinenumber(ls);
407      break;
408      }
409      case ' ': case '\f': case '\t': case '\v': {  /* spaces */
410      next(ls);
411      break;
412      }
413      case '-': {  /* '-' or '--' (comment) */
414      next(ls);
415      if (ls->current != '-') return '-';
416      /* else is a comment */
417      next(ls);
418      if (ls->current == '[') {  /* long comment? */
419         int sep = skip_sep(ls);
420         luaZ_resetbuffer(ls->buff);  /* `skip_sep' may dirty the buffer */
421         if (sep >= 0) {
422         read_long_string(ls, NULL, sep);  /* skip long comment */
423         luaZ_resetbuffer(ls->buff);  /* previous call may dirty the buff. */
424         break;
425         }
426      }
427      /* else short comment */
428      while (!currIsNewline(ls) && ls->current != EOZ)
429         next(ls);  /* skip until end of line (or end of file) */
430      break;
431      }
432      case '[': {  /* long string or simply '[' */
433      int sep = skip_sep(ls);
434      if (sep >= 0) {
435         read_long_string(ls, seminfo, sep);
436         return TK_STRING;
437      }
438      else if (sep == -1) return '[';
439      else lexerror(ls, "invalid long string delimiter", TK_STRING);
440      }
441      case '=': {
442      next(ls);
443      if (ls->current != '=') return '=';
444      else { next(ls); return TK_EQ; }
445      }
446      case '<': {
447      next(ls);
448      if (ls->current != '=') return '<';
449      else { next(ls); return TK_LE; }
450      }
451      case '>': {
452      next(ls);
453      if (ls->current != '=') return '>';
454      else { next(ls); return TK_GE; }
455      }
456      case '~': {
457      next(ls);
458      if (ls->current != '=') return '~';
459      else { next(ls); return TK_NE; }
460      }
461      case ':': {
462      next(ls);
463      if (ls->current != ':') return ':';
464      else { next(ls); return TK_DBCOLON; }
465      }
466      case '"': case '\'': {  /* short literal strings */
467      read_string(ls, ls->current, seminfo);
468      return TK_STRING;
469      }
470      case '.': {  /* '.', '..', '...', or number */
471      save_and_next(ls);
472      if (check_next(ls, ".")) {
473         if (check_next(ls, "."))
474         return TK_DOTS;   /* '...' */
475         else return TK_CONCAT;   /* '..' */
476      }
477      else if (!lisdigit(ls->current)) return '.';
478      /* else go through */
479      }
480      case '0': case '1': case '2': case '3': case '4':
481      case '5': case '6': case '7': case '8': case '9': {
482      read_numeral(ls, seminfo);
483      return TK_NUMBER;
484      }
485      case EOZ: {
486      return TK_EOS;
487      }
488      default: {
489      if (lislalpha(ls->current)) {  /* identifier or reserved word? */
490         TString *ts;
491         do {
492         save_and_next(ls);
493         } while (lislalnum(ls->current));
494         ts = luaX_newstring(ls, luaZ_buffer(ls->buff),
495                           luaZ_bufflen(ls->buff));
496         seminfo->ts = ts;
497         if (isreserved(ts))  /* reserved word? */
498         return ts->tsv.extra - 1 + FIRST_RESERVED;
499         else {
500         return TK_NAME;
501         }
502      }
503      else {  /* single-char tokens (+ - / ...) */
504         int c = ls->current;
505         next(ls);
506         return c;
507      }
508      }
509   }
510   }
511511}
512512
513513
514514void luaX_next (LexState *ls) {
515  ls->lastline = ls->linenumber;
516  if (ls->lookahead.token != TK_EOS) {  /* is there a look-ahead token? */
517    ls->t = ls->lookahead;  /* use this one */
518    ls->lookahead.token = TK_EOS;  /* and discharge it */
519  }
520  else
521    ls->t.token = llex(ls, &ls->t.seminfo);  /* read next token */
515   ls->lastline = ls->linenumber;
516   if (ls->lookahead.token != TK_EOS) {  /* is there a look-ahead token? */
517   ls->t = ls->lookahead;  /* use this one */
518   ls->lookahead.token = TK_EOS;  /* and discharge it */
519   }
520   else
521   ls->t.token = llex(ls, &ls->t.seminfo);  /* read next token */
522522}
523523
524524
525525int luaX_lookahead (LexState *ls) {
526  lua_assert(ls->lookahead.token == TK_EOS);
527  ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);
528  return ls->lookahead.token;
526   lua_assert(ls->lookahead.token == TK_EOS);
527   ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);
528   return ls->lookahead.token;
529529}
530
trunk/src/lib/lua/lgc.c
r31373r31374
2828** cost of sweeping one element (the size of a small object divided
2929** by some adjust for the sweep speed)
3030*/
31#define GCSWEEPCOST   ((sizeof(TString) + 4) / 4)
31#define GCSWEEPCOST ((sizeof(TString) + 4) / 4)
3232
3333/* maximum number of elements to sweep in each single step */
34#define GCSWEEPMAX   (cast_int((GCSTEPSIZE / GCSWEEPCOST) / 4))
34#define GCSWEEPMAX  (cast_int((GCSTEPSIZE / GCSWEEPCOST) / 4))
3535
3636/* maximum number of finalizers to call in each GC step */
37#define GCFINALIZENUM   4
37#define GCFINALIZENUM   4
3838
3939
4040/*
4141** macro to adjust 'stepmul': 'stepmul' is actually used like
4242** 'stepmul / STEPMULADJ' (value chosen by tests)
4343*/
44#define STEPMULADJ      200
44#define STEPMULADJ      200
4545
4646
4747/*
4848** macro to adjust 'pause': 'pause' is actually used like
4949** 'pause / PAUSEADJ' (value chosen by tests)
5050*/
51#define PAUSEADJ      100
51#define PAUSEADJ        100
5252
5353
5454/*
5555** 'makewhite' erases all color bits plus the old bit and then
5656** sets only the current white bit
5757*/
58#define maskcolors   (~(bit2mask(BLACKBIT, OLDBIT) | WHITEBITS))
59#define makewhite(g,x)   \
60 (gch(x)->marked = cast_byte((gch(x)->marked & maskcolors) | luaC_white(g)))
58#define maskcolors  (~(bit2mask(BLACKBIT, OLDBIT) | WHITEBITS))
59#define makewhite(g,x)  \
60   (gch(x)->marked = cast_byte((gch(x)->marked & maskcolors) | luaC_white(g)))
6161
62#define white2gray(x)   resetbits(gch(x)->marked, WHITEBITS)
63#define black2gray(x)   resetbit(gch(x)->marked, BLACKBIT)
62#define white2gray(x)   resetbits(gch(x)->marked, WHITEBITS)
63#define black2gray(x)   resetbit(gch(x)->marked, BLACKBIT)
6464
6565
66#define isfinalized(x)      testbit(gch(x)->marked, FINALIZEDBIT)
66#define isfinalized(x)      testbit(gch(x)->marked, FINALIZEDBIT)
6767
68#define checkdeadkey(n)   lua_assert(!ttisdeadkey(gkey(n)) || ttisnil(gval(n)))
68#define checkdeadkey(n) lua_assert(!ttisdeadkey(gkey(n)) || ttisnil(gval(n)))
6969
7070
7171#define checkconsistency(obj)  \
72  lua_longassert(!iscollectable(obj) || righttt(obj))
72   lua_longassert(!iscollectable(obj) || righttt(obj))
7373
7474
7575#define markvalue(g,o) { checkconsistency(o); \
76  if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); }
76   if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); }
7777
7878#define markobject(g,t) { if ((t) && iswhite(obj2gco(t))) \
7979      reallymarkobject(g, obj2gco(t)); }
r31373r31374
9191/*
9292** one after last element in a hash array
9393*/
94#define gnodelast(h)   gnode(h, cast(size_t, sizenode(h)))
94#define gnodelast(h)    gnode(h, cast(size_t, sizenode(h)))
9595
9696
9797/*
9898** link table 'h' into list pointed by 'p'
9999*/
100#define linktable(h,p)   ((h)->gclist = *(p), *(p) = obj2gco(h))
100#define linktable(h,p)  ((h)->gclist = *(p), *(p) = obj2gco(h))
101101
102102
103103/*
r31373r31374
105105** from the table)
106106*/
107107static void removeentry (Node *n) {
108  lua_assert(ttisnil(gval(n)));
109  if (valiswhite(gkey(n)))
110    setdeadvalue(gkey(n));  /* unused and unmarked key; remove it */
108   lua_assert(ttisnil(gval(n)));
109   if (valiswhite(gkey(n)))
110   setdeadvalue(gkey(n));  /* unused and unmarked key; remove it */
111111}
112112
113113
r31373r31374
119119** being finalized, keep them in keys, but not in values
120120*/
121121static int iscleared (global_State *g, const TValue *o) {
122  if (!iscollectable(o)) return 0;
123  else if (ttisstring(o)) {
124    markobject(g, rawtsvalue(o));  /* strings are `values', so are never weak */
125    return 0;
126  }
127  else return iswhite(gcvalue(o));
122   if (!iscollectable(o)) return 0;
123   else if (ttisstring(o)) {
124   markobject(g, rawtsvalue(o));  /* strings are `values', so are never weak */
125   return 0;
126   }
127   else return iswhite(gcvalue(o));
128128}
129129
130130
r31373r31374
133133** being pointed by a black object.
134134*/
135135void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) {
136  global_State *g = G(L);
137  lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o));
138  lua_assert(g->gcstate != GCSpause);
139  lua_assert(gch(o)->tt != LUA_TTABLE);
140  if (keepinvariantout(g))  /* must keep invariant? */
141    reallymarkobject(g, v);  /* restore invariant */
142  else {  /* sweep phase */
143    lua_assert(issweepphase(g));
144    makewhite(g, o);  /* mark main obj. as white to avoid other barriers */
145  }
136   global_State *g = G(L);
137   lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o));
138   lua_assert(g->gcstate != GCSpause);
139   lua_assert(gch(o)->tt != LUA_TTABLE);
140   if (keepinvariantout(g))  /* must keep invariant? */
141   reallymarkobject(g, v);  /* restore invariant */
142   else {  /* sweep phase */
143   lua_assert(issweepphase(g));
144   makewhite(g, o);  /* mark main obj. as white to avoid other barriers */
145   }
146146}
147147
148148
r31373r31374
153153** different types.)
154154*/
155155void luaC_barrierback_ (lua_State *L, GCObject *o) {
156  global_State *g = G(L);
157  lua_assert(isblack(o) && !isdead(g, o) && gch(o)->tt == LUA_TTABLE);
158  black2gray(o);  /* make object gray (again) */
159  gco2t(o)->gclist = g->grayagain;
160  g->grayagain = o;
156   global_State *g = G(L);
157   lua_assert(isblack(o) && !isdead(g, o) && gch(o)->tt == LUA_TTABLE);
158   black2gray(o);  /* make object gray (again) */
159   gco2t(o)->gclist = g->grayagain;
160   g->grayagain = o;
161161}
162162
163163
r31373r31374
170170** possible instances.
171171*/
172172LUAI_FUNC void luaC_barrierproto_ (lua_State *L, Proto *p, Closure *c) {
173  global_State *g = G(L);
174  lua_assert(isblack(obj2gco(p)));
175  if (p->cache == NULL) {  /* first time? */
176    luaC_objbarrier(L, p, c);
177  }
178  else {  /* use a backward barrier */
179    black2gray(obj2gco(p));  /* make prototype gray (again) */
180    p->gclist = g->grayagain;
181    g->grayagain = obj2gco(p);
182  }
173   global_State *g = G(L);
174   lua_assert(isblack(obj2gco(p)));
175   if (p->cache == NULL) {  /* first time? */
176   luaC_objbarrier(L, p, c);
177   }
178   else {  /* use a backward barrier */
179   black2gray(obj2gco(p));  /* make prototype gray (again) */
180   p->gclist = g->grayagain;
181   g->grayagain = obj2gco(p);
182   }
183183}
184184
185185
r31373r31374
188188** i.e., moved into the 'allgc' list
189189*/
190190void luaC_checkupvalcolor (global_State *g, UpVal *uv) {
191  GCObject *o = obj2gco(uv);
192  lua_assert(!isblack(o));  /* open upvalues are never black */
193  if (isgray(o)) {
194    if (keepinvariant(g)) {
195      resetoldbit(o);  /* see MOVE OLD rule */
196      gray2black(o);  /* it is being visited now */
197      markvalue(g, uv->v);
198    }
199    else {
200      lua_assert(issweepphase(g));
201      makewhite(g, o);
202    }
203  }
191   GCObject *o = obj2gco(uv);
192   lua_assert(!isblack(o));  /* open upvalues are never black */
193   if (isgray(o)) {
194   if (keepinvariant(g)) {
195      resetoldbit(o);  /* see MOVE OLD rule */
196      gray2black(o);  /* it is being visited now */
197      markvalue(g, uv->v);
198   }
199   else {
200      lua_assert(issweepphase(g));
201      makewhite(g, o);
202   }
203   }
204204}
205205
206206
r31373r31374
210210** object itself (used only by states).
211211*/
212212GCObject *luaC_newobj (lua_State *L, int tt, size_t sz, GCObject **list,
213                       int offset) {
214  global_State *g = G(L);
215  char *raw = cast(char *, luaM_newobject(L, novariant(tt), sz));
216  GCObject *o = obj2gco(raw + offset);
217  if (list == NULL)
218    list = &g->allgc;  /* standard list for collectable objects */
219  gch(o)->marked = luaC_white(g);
220  gch(o)->tt = tt;
221  gch(o)->next = *list;
222  *list = o;
223  return o;
213                  int offset) {
214   global_State *g = G(L);
215   char *raw = cast(char *, luaM_newobject(L, novariant(tt), sz));
216   GCObject *o = obj2gco(raw + offset);
217   if (list == NULL)
218   list = &g->allgc;  /* standard list for collectable objects */
219   gch(o)->marked = luaC_white(g);
220   gch(o)->tt = tt;
221   gch(o)->next = *list;
222   *list = o;
223   return o;
224224}
225225
226226/* }====================================================== */
r31373r31374
241241** upvalues are already linked in 'headuv' list.)
242242*/
243243static void reallymarkobject (global_State *g, GCObject *o) {
244  lu_mem size;
245  white2gray(o);
246  switch (gch(o)->tt) {
247    case LUA_TSHRSTR:
248    case LUA_TLNGSTR: {
249      size = sizestring(gco2ts(o));
250      break;  /* nothing else to mark; make it black */
251    }
252    case LUA_TUSERDATA: {
253      Table *mt = gco2u(o)->metatable;
254      markobject(g, mt);
255      markobject(g, gco2u(o)->env);
256      size = sizeudata(gco2u(o));
257      break;
258    }
259    case LUA_TUPVAL: {
260      UpVal *uv = gco2uv(o);
261      markvalue(g, uv->v);
262      if (uv->v != &uv->u.value)  /* open? */
263        return;  /* open upvalues remain gray */
264      size = sizeof(UpVal);
265      break;
266    }
267    case LUA_TLCL: {
268      gco2lcl(o)->gclist = g->gray;
269      g->gray = o;
270      return;
271    }
272    case LUA_TCCL: {
273      gco2ccl(o)->gclist = g->gray;
274      g->gray = o;
275      return;
276    }
277    case LUA_TTABLE: {
278      linktable(gco2t(o), &g->gray);
279      return;
280    }
281    case LUA_TTHREAD: {
282      gco2th(o)->gclist = g->gray;
283      g->gray = o;
284      return;
285    }
286    case LUA_TPROTO: {
287      gco2p(o)->gclist = g->gray;
288      g->gray = o;
289      return;
290    }
291    default: lua_assert(0); return;
292  }
293  gray2black(o);
294  g->GCmemtrav += size;
244   lu_mem size;
245   white2gray(o);
246   switch (gch(o)->tt) {
247   case LUA_TSHRSTR:
248   case LUA_TLNGSTR: {
249      size = sizestring(gco2ts(o));
250      break;  /* nothing else to mark; make it black */
251   }
252   case LUA_TUSERDATA: {
253      Table *mt = gco2u(o)->metatable;
254      markobject(g, mt);
255      markobject(g, gco2u(o)->env);
256      size = sizeudata(gco2u(o));
257      break;
258   }
259   case LUA_TUPVAL: {
260      UpVal *uv = gco2uv(o);
261      markvalue(g, uv->v);
262      if (uv->v != &uv->u.value)  /* open? */
263      return;  /* open upvalues remain gray */
264      size = sizeof(UpVal);
265      break;
266   }
267   case LUA_TLCL: {
268      gco2lcl(o)->gclist = g->gray;
269      g->gray = o;
270      return;
271   }
272   case LUA_TCCL: {
273      gco2ccl(o)->gclist = g->gray;
274      g->gray = o;
275      return;
276   }
277   case LUA_TTABLE: {
278      linktable(gco2t(o), &g->gray);
279      return;
280   }
281   case LUA_TTHREAD: {
282      gco2th(o)->gclist = g->gray;
283      g->gray = o;
284      return;
285   }
286   case LUA_TPROTO: {
287      gco2p(o)->gclist = g->gray;
288      g->gray = o;
289      return;
290   }
291   default: lua_assert(0); return;
292   }
293   gray2black(o);
294   g->GCmemtrav += size;
295295}
296296
297297
r31373r31374
299299** mark metamethods for basic types
300300*/
301301static void markmt (global_State *g) {
302  int i;
303  for (i=0; i < LUA_NUMTAGS; i++)
304    markobject(g, g->mt[i]);
302   int i;
303   for (i=0; i < LUA_NUMTAGS; i++)
304   markobject(g, g->mt[i]);
305305}
306306
307307
r31373r31374
309309** mark all objects in list of being-finalized
310310*/
311311static void markbeingfnz (global_State *g) {
312  GCObject *o;
313  for (o = g->tobefnz; o != NULL; o = gch(o)->next) {
314    makewhite(g, o);
315    reallymarkobject(g, o);
316  }
312   GCObject *o;
313   for (o = g->tobefnz; o != NULL; o = gch(o)->next) {
314   makewhite(g, o);
315   reallymarkobject(g, o);
316   }
317317}
318318
319319
r31373r31374
322322** 'lstate.h'.)
323323*/
324324static void remarkupvals (global_State *g) {
325  UpVal *uv;
326  for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) {
327    if (isgray(obj2gco(uv)))
328      markvalue(g, uv->v);
329  }
325   UpVal *uv;
326   for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) {
327   if (isgray(obj2gco(uv)))
328      markvalue(g, uv->v);
329   }
330330}
331331
332332
r31373r31374
335335** incremental (or full) collection
336336*/
337337static void restartcollection (global_State *g) {
338  g->gray = g->grayagain = NULL;
339  g->weak = g->allweak = g->ephemeron = NULL;
340  markobject(g, g->mainthread);
341  markvalue(g, &g->l_registry);
342  markmt(g);
343  markbeingfnz(g);  /* mark any finalizing object left from previous cycle */
338   g->gray = g->grayagain = NULL;
339   g->weak = g->allweak = g->ephemeron = NULL;
340   markobject(g, g->mainthread);
341   markvalue(g, &g->l_registry);
342   markmt(g);
343   markbeingfnz(g);  /* mark any finalizing object left from previous cycle */
344344}
345345
346346/* }====================================================== */
r31373r31374
353353*/
354354
355355static void traverseweakvalue (global_State *g, Table *h) {
356  Node *n, *limit = gnodelast(h);
357  /* if there is array part, assume it may have white values (do not
358     traverse it just to check) */
359  int hasclears = (h->sizearray > 0);
360  for (n = gnode(h, 0); n < limit; n++) {
361    checkdeadkey(n);
362    if (ttisnil(gval(n)))  /* entry is empty? */
363      removeentry(n);  /* remove it */
364    else {
365      lua_assert(!ttisnil(gkey(n)));
366      markvalue(g, gkey(n));  /* mark key */
367      if (!hasclears && iscleared(g, gval(n)))  /* is there a white value? */
368        hasclears = 1;  /* table will have to be cleared */
369    }
370  }
371  if (hasclears)
372    linktable(h, &g->weak);  /* has to be cleared later */
373  else  /* no white values */
374    linktable(h, &g->grayagain);  /* no need to clean */
356   Node *n, *limit = gnodelast(h);
357   /* if there is array part, assume it may have white values (do not
358    traverse it just to check) */
359   int hasclears = (h->sizearray > 0);
360   for (n = gnode(h, 0); n < limit; n++) {
361   checkdeadkey(n);
362   if (ttisnil(gval(n)))  /* entry is empty? */
363      removeentry(n);  /* remove it */
364   else {
365      lua_assert(!ttisnil(gkey(n)));
366      markvalue(g, gkey(n));  /* mark key */
367      if (!hasclears && iscleared(g, gval(n)))  /* is there a white value? */
368      hasclears = 1;  /* table will have to be cleared */
369   }
370   }
371   if (hasclears)
372   linktable(h, &g->weak);  /* has to be cleared later */
373   else  /* no white values */
374   linktable(h, &g->grayagain);  /* no need to clean */
375375}
376376
377377
378378static int traverseephemeron (global_State *g, Table *h) {
379  int marked = 0;  /* true if an object is marked in this traversal */
380  int hasclears = 0;  /* true if table has white keys */
381  int prop = 0;  /* true if table has entry "white-key -> white-value" */
382  Node *n, *limit = gnodelast(h);
383  int i;
384  /* traverse array part (numeric keys are 'strong') */
385  for (i = 0; i < h->sizearray; i++) {
386    if (valiswhite(&h->array[i])) {
387      marked = 1;
388      reallymarkobject(g, gcvalue(&h->array[i]));
389    }
390  }
391  /* traverse hash part */
392  for (n = gnode(h, 0); n < limit; n++) {
393    checkdeadkey(n);
394    if (ttisnil(gval(n)))  /* entry is empty? */
395      removeentry(n);  /* remove it */
396    else if (iscleared(g, gkey(n))) {  /* key is not marked (yet)? */
397      hasclears = 1;  /* table must be cleared */
398      if (valiswhite(gval(n)))  /* value not marked yet? */
399        prop = 1;  /* must propagate again */
400    }
401    else if (valiswhite(gval(n))) {  /* value not marked yet? */
402      marked = 1;
403      reallymarkobject(g, gcvalue(gval(n)));  /* mark it now */
404    }
405  }
406  if (prop)
407    linktable(h, &g->ephemeron);  /* have to propagate again */
408  else if (hasclears)  /* does table have white keys? */
409    linktable(h, &g->allweak);  /* may have to clean white keys */
410  else  /* no white keys */
411    linktable(h, &g->grayagain);  /* no need to clean */
412  return marked;
379   int marked = 0;  /* true if an object is marked in this traversal */
380   int hasclears = 0;  /* true if table has white keys */
381   int prop = 0;  /* true if table has entry "white-key -> white-value" */
382   Node *n, *limit = gnodelast(h);
383   int i;
384   /* traverse array part (numeric keys are 'strong') */
385   for (i = 0; i < h->sizearray; i++) {
386   if (valiswhite(&h->array[i])) {
387      marked = 1;
388      reallymarkobject(g, gcvalue(&h->array[i]));
389   }
390   }
391   /* traverse hash part */
392   for (n = gnode(h, 0); n < limit; n++) {
393   checkdeadkey(n);
394   if (ttisnil(gval(n)))  /* entry is empty? */
395      removeentry(n);  /* remove it */
396   else if (iscleared(g, gkey(n))) {  /* key is not marked (yet)? */
397      hasclears = 1;  /* table must be cleared */
398      if (valiswhite(gval(n)))  /* value not marked yet? */
399      prop = 1;  /* must propagate again */
400   }
401   else if (valiswhite(gval(n))) {  /* value not marked yet? */
402      marked = 1;
403      reallymarkobject(g, gcvalue(gval(n)));  /* mark it now */
404   }
405   }
406   if (prop)
407   linktable(h, &g->ephemeron);  /* have to propagate again */
408   else if (hasclears)  /* does table have white keys? */
409   linktable(h, &g->allweak);  /* may have to clean white keys */
410   else  /* no white keys */
411   linktable(h, &g->grayagain);  /* no need to clean */
412   return marked;
413413}
414414
415415
416416static void traversestrongtable (global_State *g, Table *h) {
417  Node *n, *limit = gnodelast(h);
418  int i;
419  for (i = 0; i < h->sizearray; i++)  /* traverse array part */
420    markvalue(g, &h->array[i]);
421  for (n = gnode(h, 0); n < limit; n++) {  /* traverse hash part */
422    checkdeadkey(n);
423    if (ttisnil(gval(n)))  /* entry is empty? */
424      removeentry(n);  /* remove it */
425    else {
426      lua_assert(!ttisnil(gkey(n)));
427      markvalue(g, gkey(n));  /* mark key */
428      markvalue(g, gval(n));  /* mark value */
429    }
430  }
417   Node *n, *limit = gnodelast(h);
418   int i;
419   for (i = 0; i < h->sizearray; i++)  /* traverse array part */
420   markvalue(g, &h->array[i]);
421   for (n = gnode(h, 0); n < limit; n++) {  /* traverse hash part */
422   checkdeadkey(n);
423   if (ttisnil(gval(n)))  /* entry is empty? */
424      removeentry(n);  /* remove it */
425   else {
426      lua_assert(!ttisnil(gkey(n)));
427      markvalue(g, gkey(n));  /* mark key */
428      markvalue(g, gval(n));  /* mark value */
429   }
430   }
431431}
432432
433433
434434static lu_mem traversetable (global_State *g, Table *h) {
435  const char *weakkey, *weakvalue;
436  const TValue *mode = gfasttm(g, h->metatable, TM_MODE);
437  markobject(g, h->metatable);
438  if (mode && ttisstring(mode) &&  /* is there a weak mode? */
439      ((weakkey = strchr(svalue(mode), 'k')),
440       (weakvalue = strchr(svalue(mode), 'v')),
441       (weakkey || weakvalue))) {  /* is really weak? */
442    black2gray(obj2gco(h));  /* keep table gray */
443    if (!weakkey)  /* strong keys? */
444      traverseweakvalue(g, h);
445    else if (!weakvalue)  /* strong values? */
446      traverseephemeron(g, h);
447    else  /* all weak */
448      linktable(h, &g->allweak);  /* nothing to traverse now */
449  }
450  else  /* not weak */
451    traversestrongtable(g, h);
452  return sizeof(Table) + sizeof(TValue) * h->sizearray +
453                         sizeof(Node) * cast(size_t, sizenode(h));
435   const char *weakkey, *weakvalue;
436   const TValue *mode = gfasttm(g, h->metatable, TM_MODE);
437   markobject(g, h->metatable);
438   if (mode && ttisstring(mode) &&  /* is there a weak mode? */
439      ((weakkey = strchr(svalue(mode), 'k')),
440      (weakvalue = strchr(svalue(mode), 'v')),
441      (weakkey || weakvalue))) {  /* is really weak? */
442   black2gray(obj2gco(h));  /* keep table gray */
443   if (!weakkey)  /* strong keys? */
444      traverseweakvalue(g, h);
445   else if (!weakvalue)  /* strong values? */
446      traverseephemeron(g, h);
447   else  /* all weak */
448      linktable(h, &g->allweak);  /* nothing to traverse now */
449   }
450   else  /* not weak */
451   traversestrongtable(g, h);
452   return sizeof(Table) + sizeof(TValue) * h->sizearray +
453                     sizeof(Node) * cast(size_t, sizenode(h));
454454}
455455
456456
457457static int traverseproto (global_State *g, Proto *f) {
458  int i;
459  if (f->cache && iswhite(obj2gco(f->cache)))
460    f->cache = NULL;  /* allow cache to be collected */
461  markobject(g, f->source);
462  for (i = 0; i < f->sizek; i++)  /* mark literals */
463    markvalue(g, &f->k[i]);
464  for (i = 0; i < f->sizeupvalues; i++)  /* mark upvalue names */
465    markobject(g, f->upvalues[i].name);
466  for (i = 0; i < f->sizep; i++)  /* mark nested protos */
467    markobject(g, f->p[i]);
468  for (i = 0; i < f->sizelocvars; i++)  /* mark local-variable names */
469    markobject(g, f->locvars[i].varname);
470  return sizeof(Proto) + sizeof(Instruction) * f->sizecode +
471                         sizeof(Proto *) * f->sizep +
472                         sizeof(TValue) * f->sizek +
473                         sizeof(int) * f->sizelineinfo +
474                         sizeof(LocVar) * f->sizelocvars +
475                         sizeof(Upvaldesc) * f->sizeupvalues;
458   int i;
459   if (f->cache && iswhite(obj2gco(f->cache)))
460   f->cache = NULL;  /* allow cache to be collected */
461   markobject(g, f->source);
462   for (i = 0; i < f->sizek; i++)  /* mark literals */
463   markvalue(g, &f->k[i]);
464   for (i = 0; i < f->sizeupvalues; i++)  /* mark upvalue names */
465   markobject(g, f->upvalues[i].name);
466   for (i = 0; i < f->sizep; i++)  /* mark nested protos */
467   markobject(g, f->p[i]);
468   for (i = 0; i < f->sizelocvars; i++)  /* mark local-variable names */
469   markobject(g, f->locvars[i].varname);
470   return sizeof(Proto) + sizeof(Instruction) * f->sizecode +
471                     sizeof(Proto *) * f->sizep +
472                     sizeof(TValue) * f->sizek +
473                     sizeof(int) * f->sizelineinfo +
474                     sizeof(LocVar) * f->sizelocvars +
475                     sizeof(Upvaldesc) * f->sizeupvalues;
476476}
477477
478478
479479static lu_mem traverseCclosure (global_State *g, CClosure *cl) {
480  int i;
481  for (i = 0; i < cl->nupvalues; i++)  /* mark its upvalues */
482    markvalue(g, &cl->upvalue[i]);
483  return sizeCclosure(cl->nupvalues);
480   int i;
481   for (i = 0; i < cl->nupvalues; i++)  /* mark its upvalues */
482   markvalue(g, &cl->upvalue[i]);
483   return sizeCclosure(cl->nupvalues);
484484}
485485
486486static lu_mem traverseLclosure (global_State *g, LClosure *cl) {
487  int i;
488  markobject(g, cl->p);  /* mark its prototype */
489  for (i = 0; i < cl->nupvalues; i++)  /* mark its upvalues */
490    markobject(g, cl->upvals[i]);
491  return sizeLclosure(cl->nupvalues);
487   int i;
488   markobject(g, cl->p);  /* mark its prototype */
489   for (i = 0; i < cl->nupvalues; i++)  /* mark its upvalues */
490   markobject(g, cl->upvals[i]);
491   return sizeLclosure(cl->nupvalues);
492492}
493493
494494
495495static lu_mem traversestack (global_State *g, lua_State *th) {
496  int n = 0;
497  StkId o = th->stack;
498  if (o == NULL)
499    return 1;  /* stack not completely built yet */
500  for (; o < th->top; o++)  /* mark live elements in the stack */
501    markvalue(g, o);
502  if (g->gcstate == GCSatomic) {  /* final traversal? */
503    StkId lim = th->stack + th->stacksize;  /* real end of stack */
504    for (; o < lim; o++)  /* clear not-marked stack slice */
505      setnilvalue(o);
506  }
507  else {  /* count call infos to compute size */
508    CallInfo *ci;
509    for (ci = &th->base_ci; ci != th->ci; ci = ci->next)
510      n++;
511  }
512  return sizeof(lua_State) + sizeof(TValue) * th->stacksize +
513         sizeof(CallInfo) * n;
496   int n = 0;
497   StkId o = th->stack;
498   if (o == NULL)
499   return 1;  /* stack not completely built yet */
500   for (; o < th->top; o++)  /* mark live elements in the stack */
501   markvalue(g, o);
502   if (g->gcstate == GCSatomic) {  /* final traversal? */
503   StkId lim = th->stack + th->stacksize;  /* real end of stack */
504   for (; o < lim; o++)  /* clear not-marked stack slice */
505      setnilvalue(o);
506   }
507   else {  /* count call infos to compute size */
508   CallInfo *ci;
509   for (ci = &th->base_ci; ci != th->ci; ci = ci->next)
510      n++;
511   }
512   return sizeof(lua_State) + sizeof(TValue) * th->stacksize +
513         sizeof(CallInfo) * n;
514514}
515515
516516
r31373r31374
519519** which are always gray).
520520*/
521521static void propagatemark (global_State *g) {
522  lu_mem size;
523  GCObject *o = g->gray;
524  lua_assert(isgray(o));
525  gray2black(o);
526  switch (gch(o)->tt) {
527    case LUA_TTABLE: {
528      Table *h = gco2t(o);
529      g->gray = h->gclist;  /* remove from 'gray' list */
530      size = traversetable(g, h);
531      break;
532    }
533    case LUA_TLCL: {
534      LClosure *cl = gco2lcl(o);
535      g->gray = cl->gclist;  /* remove from 'gray' list */
536      size = traverseLclosure(g, cl);
537      break;
538    }
539    case LUA_TCCL: {
540      CClosure *cl = gco2ccl(o);
541      g->gray = cl->gclist;  /* remove from 'gray' list */
542      size = traverseCclosure(g, cl);
543      break;
544    }
545    case LUA_TTHREAD: {
546      lua_State *th = gco2th(o);
547      g->gray = th->gclist;  /* remove from 'gray' list */
548      th->gclist = g->grayagain;
549      g->grayagain = o;  /* insert into 'grayagain' list */
550      black2gray(o);
551      size = traversestack(g, th);
552      break;
553    }
554    case LUA_TPROTO: {
555      Proto *p = gco2p(o);
556      g->gray = p->gclist;  /* remove from 'gray' list */
557      size = traverseproto(g, p);
558      break;
559    }
560    default: lua_assert(0); return;
561  }
562  g->GCmemtrav += size;
522   lu_mem size;
523   GCObject *o = g->gray;
524   lua_assert(isgray(o));
525   gray2black(o);
526   switch (gch(o)->tt) {
527   case LUA_TTABLE: {
528      Table *h = gco2t(o);
529      g->gray = h->gclist;  /* remove from 'gray' list */
530      size = traversetable(g, h);
531      break;
532   }
533   case LUA_TLCL: {
534      LClosure *cl = gco2lcl(o);
535      g->gray = cl->gclist;  /* remove from 'gray' list */
536      size = traverseLclosure(g, cl);
537      break;
538   }
539   case LUA_TCCL: {
540      CClosure *cl = gco2ccl(o);
541      g->gray = cl->gclist;  /* remove from 'gray' list */
542      size = traverseCclosure(g, cl);
543      break;
544   }
545   case LUA_TTHREAD: {
546      lua_State *th = gco2th(o);
547      g->gray = th->gclist;  /* remove from 'gray' list */
548      th->gclist = g->grayagain;
549      g->grayagain = o;  /* insert into 'grayagain' list */
550      black2gray(o);
551      size = traversestack(g, th);
552      break;
553   }
554   case LUA_TPROTO: {
555      Proto *p = gco2p(o);
556      g->gray = p->gclist;  /* remove from 'gray' list */
557      size = traverseproto(g, p);
558      break;
559   }
560   default: lua_assert(0); return;
561   }
562   g->GCmemtrav += size;
563563}
564564
565565
566566static void propagateall (global_State *g) {
567  while (g->gray) propagatemark(g);
567   while (g->gray) propagatemark(g);
568568}
569569
570570
571571static void propagatelist (global_State *g, GCObject *l) {
572  lua_assert(g->gray == NULL);  /* no grays left */
573  g->gray = l;
574  propagateall(g);  /* traverse all elements from 'l' */
572   lua_assert(g->gray == NULL);  /* no grays left */
573   g->gray = l;
574   propagateall(g);  /* traverse all elements from 'l' */
575575}
576576
577577/*
r31373r31374
580580** twice the same table (which is not wrong, but inefficient)
581581*/
582582static void retraversegrays (global_State *g) {
583  GCObject *weak = g->weak;  /* save original lists */
584  GCObject *grayagain = g->grayagain;
585  GCObject *ephemeron = g->ephemeron;
586  g->weak = g->grayagain = g->ephemeron = NULL;
587  propagateall(g);  /* traverse main gray list */
588  propagatelist(g, grayagain);
589  propagatelist(g, weak);
590  propagatelist(g, ephemeron);
583   GCObject *weak = g->weak;  /* save original lists */
584   GCObject *grayagain = g->grayagain;
585   GCObject *ephemeron = g->ephemeron;
586   g->weak = g->grayagain = g->ephemeron = NULL;
587   propagateall(g);  /* traverse main gray list */
588   propagatelist(g, grayagain);
589   propagatelist(g, weak);
590   propagatelist(g, ephemeron);
591591}
592592
593593
594594static void convergeephemerons (global_State *g) {
595  int changed;
596  do {
597    GCObject *w;
598    GCObject *next = g->ephemeron;  /* get ephemeron list */
599    g->ephemeron = NULL;  /* tables will return to this list when traversed */
600    changed = 0;
601    while ((w = next) != NULL) {
602      next = gco2t(w)->gclist;
603      if (traverseephemeron(g, gco2t(w))) {  /* traverse marked some value? */
604        propagateall(g);  /* propagate changes */
605        changed = 1;  /* will have to revisit all ephemeron tables */
606      }
607    }
608  } while (changed);
595   int changed;
596   do {
597   GCObject *w;
598   GCObject *next = g->ephemeron;  /* get ephemeron list */
599   g->ephemeron = NULL;  /* tables will return to this list when traversed */
600   changed = 0;
601   while ((w = next) != NULL) {
602      next = gco2t(w)->gclist;
603      if (traverseephemeron(g, gco2t(w))) {  /* traverse marked some value? */
604      propagateall(g);  /* propagate changes */
605      changed = 1;  /* will have to revisit all ephemeron tables */
606      }
607   }
608   } while (changed);
609609}
610610
611611/* }====================================================== */
r31373r31374
623623** to element 'f'
624624*/
625625static void clearkeys (global_State *g, GCObject *l, GCObject *f) {
626  for (; l != f; l = gco2t(l)->gclist) {
627    Table *h = gco2t(l);
628    Node *n, *limit = gnodelast(h);
629    for (n = gnode(h, 0); n < limit; n++) {
630      if (!ttisnil(gval(n)) && (iscleared(g, gkey(n)))) {
631        setnilvalue(gval(n));  /* remove value ... */
632        removeentry(n);  /* and remove entry from table */
633      }
634    }
635  }
626   for (; l != f; l = gco2t(l)->gclist) {
627   Table *h = gco2t(l);
628   Node *n, *limit = gnodelast(h);
629   for (n = gnode(h, 0); n < limit; n++) {
630      if (!ttisnil(gval(n)) && (iscleared(g, gkey(n)))) {
631      setnilvalue(gval(n));  /* remove value ... */
632      removeentry(n);  /* and remove entry from table */
633      }
634   }
635   }
636636}
637637
638638
r31373r31374
641641** to element 'f'
642642*/
643643static void clearvalues (global_State *g, GCObject *l, GCObject *f) {
644  for (; l != f; l = gco2t(l)->gclist) {
645    Table *h = gco2t(l);
646    Node *n, *limit = gnodelast(h);
647    int i;
648    for (i = 0; i < h->sizearray; i++) {
649      TValue *o = &h->array[i];
650      if (iscleared(g, o))  /* value was collected? */
651        setnilvalue(o);  /* remove value */
652    }
653    for (n = gnode(h, 0); n < limit; n++) {
654      if (!ttisnil(gval(n)) && iscleared(g, gval(n))) {
655        setnilvalue(gval(n));  /* remove value ... */
656        removeentry(n);  /* and remove entry from table */
657      }
658    }
659  }
644   for (; l != f; l = gco2t(l)->gclist) {
645   Table *h = gco2t(l);
646   Node *n, *limit = gnodelast(h);
647   int i;
648   for (i = 0; i < h->sizearray; i++) {
649      TValue *o = &h->array[i];
650      if (iscleared(g, o))  /* value was collected? */
651      setnilvalue(o);  /* remove value */
652   }
653   for (n = gnode(h, 0); n < limit; n++) {
654      if (!ttisnil(gval(n)) && iscleared(g, gval(n))) {
655      setnilvalue(gval(n));  /* remove value ... */
656      removeentry(n);  /* and remove entry from table */
657      }
658   }
659   }
660660}
661661
662662
663663static void freeobj (lua_State *L, GCObject *o) {
664  switch (gch(o)->tt) {
665    case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break;
666    case LUA_TLCL: {
667      luaM_freemem(L, o, sizeLclosure(gco2lcl(o)->nupvalues));
668      break;
669    }
670    case LUA_TCCL: {
671      luaM_freemem(L, o, sizeCclosure(gco2ccl(o)->nupvalues));
672      break;
673    }
674    case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break;
675    case LUA_TTABLE: luaH_free(L, gco2t(o)); break;
676    case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break;
677    case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break;
678    case LUA_TSHRSTR:
679      G(L)->strt.nuse--;
680      /* go through */
681    case LUA_TLNGSTR: {
682      luaM_freemem(L, o, sizestring(gco2ts(o)));
683      break;
684    }
685    default: lua_assert(0);
686  }
664   switch (gch(o)->tt) {
665   case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break;
666   case LUA_TLCL: {
667      luaM_freemem(L, o, sizeLclosure(gco2lcl(o)->nupvalues));
668      break;
669   }
670   case LUA_TCCL: {
671      luaM_freemem(L, o, sizeCclosure(gco2ccl(o)->nupvalues));
672      break;
673   }
674   case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break;
675   case LUA_TTABLE: luaH_free(L, gco2t(o)); break;
676   case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break;
677   case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break;
678   case LUA_TSHRSTR:
679      G(L)->strt.nuse--;
680      /* go through */
681   case LUA_TLNGSTR: {
682      luaM_freemem(L, o, sizestring(gco2ts(o)));
683      break;
684   }
685   default: lua_assert(0);
686   }
687687}
688688
689689
690#define sweepwholelist(L,p)   sweeplist(L,p,MAX_LUMEM)
690#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM)
691691static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count);
692692
693693
r31373r31374
696696** list of call-info structures.
697697*/
698698static void sweepthread (lua_State *L, lua_State *L1) {
699  if (L1->stack == NULL) return;  /* stack not completely built yet */
700  sweepwholelist(L, &L1->openupval);  /* sweep open upvalues */
701  luaE_freeCI(L1);  /* free extra CallInfo slots */
702  /* should not change the stack during an emergency gc cycle */
703  if (G(L)->gckind != KGC_EMERGENCY)
704    luaD_shrinkstack(L1);
699   if (L1->stack == NULL) return;  /* stack not completely built yet */
700   sweepwholelist(L, &L1->openupval);  /* sweep open upvalues */
701   luaE_freeCI(L1);  /* free extra CallInfo slots */
702   /* should not change the stack during an emergency gc cycle */
703   if (G(L)->gckind != KGC_EMERGENCY)
704   luaD_shrinkstack(L1);
705705}
706706
707707
r31373r31374
717717** When object is a thread, sweep its list of open upvalues too.
718718*/
719719static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) {
720  global_State *g = G(L);
721  int ow = otherwhite(g);
722  int toclear, toset;  /* bits to clear and to set in all live objects */
723  int tostop;  /* stop sweep when this is true */
724  if (isgenerational(g)) {  /* generational mode? */
725    toclear = ~0;  /* clear nothing */
726    toset = bitmask(OLDBIT);  /* set the old bit of all surviving objects */
727    tostop = bitmask(OLDBIT);  /* do not sweep old generation */
728  }
729  else {  /* normal mode */
730    toclear = maskcolors;  /* clear all color bits + old bit */
731    toset = luaC_white(g);  /* make object white */
732    tostop = 0;  /* do not stop */
733  }
734  while (*p != NULL && count-- > 0) {
735    GCObject *curr = *p;
736    int marked = gch(curr)->marked;
737    if (isdeadm(ow, marked)) {  /* is 'curr' dead? */
738      *p = gch(curr)->next;  /* remove 'curr' from list */
739      freeobj(L, curr);  /* erase 'curr' */
740    }
741    else {
742      if (testbits(marked, tostop))
743        return NULL;  /* stop sweeping this list */
744      if (gch(curr)->tt == LUA_TTHREAD)
745        sweepthread(L, gco2th(curr));  /* sweep thread's upvalues */
746      /* update marks */
747      gch(curr)->marked = cast_byte((marked & toclear) | toset);
748      p = &gch(curr)->next;  /* go to next element */
749    }
750  }
751  return (*p == NULL) ? NULL : p;
720   global_State *g = G(L);
721   int ow = otherwhite(g);
722   int toclear, toset;  /* bits to clear and to set in all live objects */
723   int tostop;  /* stop sweep when this is true */
724   if (isgenerational(g)) {  /* generational mode? */
725   toclear = ~0;  /* clear nothing */
726   toset = bitmask(OLDBIT);  /* set the old bit of all surviving objects */
727   tostop = bitmask(OLDBIT);  /* do not sweep old generation */
728   }
729   else {  /* normal mode */
730   toclear = maskcolors;  /* clear all color bits + old bit */
731   toset = luaC_white(g);  /* make object white */
732   tostop = 0;  /* do not stop */
733   }
734   while (*p != NULL && count-- > 0) {
735   GCObject *curr = *p;
736   int marked = gch(curr)->marked;
737   if (isdeadm(ow, marked)) {  /* is 'curr' dead? */
738      *p = gch(curr)->next;  /* remove 'curr' from list */
739      freeobj(L, curr);  /* erase 'curr' */
740   }
741   else {
742      if (testbits(marked, tostop))
743      return NULL;  /* stop sweeping this list */
744      if (gch(curr)->tt == LUA_TTHREAD)
745      sweepthread(L, gco2th(curr));  /* sweep thread's upvalues */
746      /* update marks */
747      gch(curr)->marked = cast_byte((marked & toclear) | toset);
748      p = &gch(curr)->next;  /* go to next element */
749   }
750   }
751   return (*p == NULL) ? NULL : p;
752752}
753753
754754
r31373r31374
756756** sweep a list until a live object (or end of list)
757757*/
758758static GCObject **sweeptolive (lua_State *L, GCObject **p, int *n) {
759  GCObject ** old = p;
760  int i = 0;
761  do {
762    i++;
763    p = sweeplist(L, p, 1);
764  } while (p == old);
765  if (n) *n += i;
766  return p;
759   GCObject ** old = p;
760   int i = 0;
761   do {
762   i++;
763   p = sweeplist(L, p, 1);
764   } while (p == old);
765   if (n) *n += i;
766   return p;
767767}
768768
769769/* }====================================================== */
r31373r31374
776776*/
777777
778778static void checkSizes (lua_State *L) {
779  global_State *g = G(L);
780  if (g->gckind != KGC_EMERGENCY) {  /* do not change sizes in emergency */
781    int hs = g->strt.size / 2;  /* half the size of the string table */
782    if (g->strt.nuse < cast(lu_int32, hs))  /* using less than that half? */
783      luaS_resize(L, hs);  /* halve its size */
784    luaZ_freebuffer(L, &g->buff);  /* free concatenation buffer */
785  }
779   global_State *g = G(L);
780   if (g->gckind != KGC_EMERGENCY) {  /* do not change sizes in emergency */
781   int hs = g->strt.size / 2;  /* half the size of the string table */
782   if (g->strt.nuse < cast(lu_int32, hs))  /* using less than that half? */
783      luaS_resize(L, hs);  /* halve its size */
784   luaZ_freebuffer(L, &g->buff);  /* free concatenation buffer */
785   }
786786}
787787
788788
789789static GCObject *udata2finalize (global_State *g) {
790  GCObject *o = g->tobefnz;  /* get first element */
791  lua_assert(isfinalized(o));
792  g->tobefnz = gch(o)->next;  /* remove it from 'tobefnz' list */
793  gch(o)->next = g->allgc;  /* return it to 'allgc' list */
794  g->allgc = o;
795  resetbit(gch(o)->marked, SEPARATED);  /* mark that it is not in 'tobefnz' */
796  lua_assert(!isold(o));  /* see MOVE OLD rule */
797  if (!keepinvariantout(g))  /* not keeping invariant? */
798    makewhite(g, o);  /* "sweep" object */
799  return o;
790   GCObject *o = g->tobefnz;  /* get first element */
791   lua_assert(isfinalized(o));
792   g->tobefnz = gch(o)->next;  /* remove it from 'tobefnz' list */
793   gch(o)->next = g->allgc;  /* return it to 'allgc' list */
794   g->allgc = o;
795   resetbit(gch(o)->marked, SEPARATED);  /* mark that it is not in 'tobefnz' */
796   lua_assert(!isold(o));  /* see MOVE OLD rule */
797   if (!keepinvariantout(g))  /* not keeping invariant? */
798   makewhite(g, o);  /* "sweep" object */
799   return o;
800800}
801801
802802
803803static void dothecall (lua_State *L, void *ud) {
804  UNUSED(ud);
805  luaD_call(L, L->top - 2, 0, 0);
804   UNUSED(ud);
805   luaD_call(L, L->top - 2, 0, 0);
806806}
807807
808808
809809static void GCTM (lua_State *L, int propagateerrors) {
810  global_State *g = G(L);
811  const TValue *tm;
812  TValue v;
813  setgcovalue(L, &v, udata2finalize(g));
814  tm = luaT_gettmbyobj(L, &v, TM_GC);
815  if (tm != NULL && ttisfunction(tm)) {  /* is there a finalizer? */
816    int status;
817    lu_byte oldah = L->allowhook;
818    int running  = g->gcrunning;
819    L->allowhook = 0;  /* stop debug hooks during GC metamethod */
820    g->gcrunning = 0;  /* avoid GC steps */
821    setobj2s(L, L->top, tm);  /* push finalizer... */
822    setobj2s(L, L->top + 1, &v);  /* ... and its argument */
823    L->top += 2;  /* and (next line) call the finalizer */
824    status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0);
825    L->allowhook = oldah;  /* restore hooks */
826    g->gcrunning = running;  /* restore state */
827    if (status != LUA_OK && propagateerrors) {  /* error while running __gc? */
828      if (status == LUA_ERRRUN) {  /* is there an error object? */
829        const char *msg = (ttisstring(L->top - 1))
830                            ? svalue(L->top - 1)
831                            : "no message";
832        luaO_pushfstring(L, "error in __gc metamethod (%s)", msg);
833        status = LUA_ERRGCMM;  /* error in __gc metamethod */
834      }
835      luaD_throw(L, status);  /* re-throw error */
836    }
837  }
810   global_State *g = G(L);
811   const TValue *tm;
812   TValue v;
813   setgcovalue(L, &v, udata2finalize(g));
814   tm = luaT_gettmbyobj(L, &v, TM_GC);
815   if (tm != NULL && ttisfunction(tm)) {  /* is there a finalizer? */
816   int status;
817   lu_byte oldah = L->allowhook;
818   int running  = g->gcrunning;
819   L->allowhook = 0;  /* stop debug hooks during GC metamethod */
820   g->gcrunning = 0;  /* avoid GC steps */
821   setobj2s(L, L->top, tm);  /* push finalizer... */
822   setobj2s(L, L->top + 1, &v);  /* ... and its argument */
823   L->top += 2;  /* and (next line) call the finalizer */
824   status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0);
825   L->allowhook = oldah;  /* restore hooks */
826   g->gcrunning = running;  /* restore state */
827   if (status != LUA_OK && propagateerrors) {  /* error while running __gc? */
828      if (status == LUA_ERRRUN) {  /* is there an error object? */
829      const char *msg = (ttisstring(L->top - 1))
830                     ? svalue(L->top - 1)
831                     : "no message";
832      luaO_pushfstring(L, "error in __gc metamethod (%s)", msg);
833      status = LUA_ERRGCMM;  /* error in __gc metamethod */
834      }
835      luaD_throw(L, status);  /* re-throw error */
836   }
837   }
838838}
839839
840840
r31373r31374
843843** finalization from list 'finobj' to list 'tobefnz' (to be finalized)
844844*/
845845static void separatetobefnz (lua_State *L, int all) {
846  global_State *g = G(L);
847  GCObject **p = &g->finobj;
848  GCObject *curr;
849  GCObject **lastnext = &g->tobefnz;
850  /* find last 'next' field in 'tobefnz' list (to add elements in its end) */
851  while (*lastnext != NULL)
852    lastnext = &gch(*lastnext)->next;
853  while ((curr = *p) != NULL) {  /* traverse all finalizable objects */
854    lua_assert(!isfinalized(curr));
855    lua_assert(testbit(gch(curr)->marked, SEPARATED));
856    if (!(iswhite(curr) || all))  /* not being collected? */
857      p = &gch(curr)->next;  /* don't bother with it */
858    else {
859      l_setbit(gch(curr)->marked, FINALIZEDBIT); /* won't be finalized again */
860      *p = gch(curr)->next;  /* remove 'curr' from 'finobj' list */
861      gch(curr)->next = *lastnext;  /* link at the end of 'tobefnz' list */
862      *lastnext = curr;
863      lastnext = &gch(curr)->next;
864    }
865  }
846   global_State *g = G(L);
847   GCObject **p = &g->finobj;
848   GCObject *curr;
849   GCObject **lastnext = &g->tobefnz;
850   /* find last 'next' field in 'tobefnz' list (to add elements in its end) */
851   while (*lastnext != NULL)
852   lastnext = &gch(*lastnext)->next;
853   while ((curr = *p) != NULL) {  /* traverse all finalizable objects */
854   lua_assert(!isfinalized(curr));
855   lua_assert(testbit(gch(curr)->marked, SEPARATED));
856   if (!(iswhite(curr) || all))  /* not being collected? */
857      p = &gch(curr)->next;  /* don't bother with it */
858   else {
859      l_setbit(gch(curr)->marked, FINALIZEDBIT); /* won't be finalized again */
860      *p = gch(curr)->next;  /* remove 'curr' from 'finobj' list */
861      gch(curr)->next = *lastnext;  /* link at the end of 'tobefnz' list */
862      *lastnext = curr;
863      lastnext = &gch(curr)->next;
864   }
865   }
866866}
867867
868868
r31373r31374
871871** search the list to find it) and link it in 'finobj' list.
872872*/
873873void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) {
874  global_State *g = G(L);
875  if (testbit(gch(o)->marked, SEPARATED) || /* obj. is already separated... */
876      isfinalized(o) ||                           /* ... or is finalized... */
877      gfasttm(g, mt, TM_GC) == NULL)                /* or has no finalizer? */
878    return;  /* nothing to be done */
879  else {  /* move 'o' to 'finobj' list */
880    GCObject **p;
881    GCheader *ho = gch(o);
882    if (g->sweepgc == &ho->next) {  /* avoid removing current sweep object */
883      lua_assert(issweepphase(g));
884      g->sweepgc = sweeptolive(L, g->sweepgc, NULL);
885    }
886    /* search for pointer pointing to 'o' */
887    for (p = &g->allgc; *p != o; p = &gch(*p)->next) { /* empty */ }
888    *p = ho->next;  /* remove 'o' from root list */
889    ho->next = g->finobj;  /* link it in list 'finobj' */
890    g->finobj = o;
891    l_setbit(ho->marked, SEPARATED);  /* mark it as such */
892    if (!keepinvariantout(g))  /* not keeping invariant? */
893      makewhite(g, o);  /* "sweep" object */
894    else
895      resetoldbit(o);  /* see MOVE OLD rule */
896  }
874   global_State *g = G(L);
875   if (testbit(gch(o)->marked, SEPARATED) || /* obj. is already separated... */
876      isfinalized(o) ||                           /* ... or is finalized... */
877      gfasttm(g, mt, TM_GC) == NULL)                /* or has no finalizer? */
878   return;  /* nothing to be done */
879   else {  /* move 'o' to 'finobj' list */
880   GCObject **p;
881   GCheader *ho = gch(o);
882   if (g->sweepgc == &ho->next) {  /* avoid removing current sweep object */
883      lua_assert(issweepphase(g));
884      g->sweepgc = sweeptolive(L, g->sweepgc, NULL);
885   }
886   /* search for pointer pointing to 'o' */
887   for (p = &g->allgc; *p != o; p = &gch(*p)->next) { /* empty */ }
888   *p = ho->next;  /* remove 'o' from root list */
889   ho->next = g->finobj;  /* link it in list 'finobj' */
890   g->finobj = o;
891   l_setbit(ho->marked, SEPARATED);  /* mark it as such */
892   if (!keepinvariantout(g))  /* not keeping invariant? */
893      makewhite(g, o);  /* "sweep" object */
894   else
895      resetoldbit(o);  /* see MOVE OLD rule */
896   }
897897}
898898
899899/* }====================================================== */
r31373r31374
911911** cycle will start when memory use hits threshold
912912*/
913913static void setpause (global_State *g, l_mem estimate) {
914  l_mem debt, threshold;
915  estimate = estimate / PAUSEADJ;  /* adjust 'estimate' */
916  threshold = (g->gcpause < MAX_LMEM / estimate)  /* overflow? */
917            ? estimate * g->gcpause  /* no overflow */
918            : MAX_LMEM;  /* overflow; truncate to maximum */
919  debt = -cast(l_mem, threshold - gettotalbytes(g));
920  luaE_setdebt(g, debt);
914   l_mem debt, threshold;
915   estimate = estimate / PAUSEADJ;  /* adjust 'estimate' */
916   threshold = (g->gcpause < MAX_LMEM / estimate)  /* overflow? */
917         ? estimate * g->gcpause  /* no overflow */
918         : MAX_LMEM;  /* overflow; truncate to maximum */
919   debt = -cast(l_mem, threshold - gettotalbytes(g));
920   luaE_setdebt(g, debt);
921921}
922922
923923
r31373r31374
934934** Returns how many objects it swept.
935935*/
936936static int entersweep (lua_State *L) {
937  global_State *g = G(L);
938  int n = 0;
939  g->gcstate = GCSsweepstring;
940  lua_assert(g->sweepgc == NULL && g->sweepfin == NULL);
941  /* prepare to sweep strings, finalizable objects, and regular objects */
942  g->sweepstrgc = 0;
943  g->sweepfin = sweeptolive(L, &g->finobj, &n);
944  g->sweepgc = sweeptolive(L, &g->allgc, &n);
945  return n;
937   global_State *g = G(L);
938   int n = 0;
939   g->gcstate = GCSsweepstring;
940   lua_assert(g->sweepgc == NULL && g->sweepfin == NULL);
941   /* prepare to sweep strings, finalizable objects, and regular objects */
942   g->sweepstrgc = 0;
943   g->sweepfin = sweeptolive(L, &g->finobj, &n);
944   g->sweepgc = sweeptolive(L, &g->allgc, &n);
945   return n;
946946}
947947
948948
r31373r31374
950950** change GC mode
951951*/
952952void luaC_changemode (lua_State *L, int mode) {
953  global_State *g = G(L);
954  if (mode == g->gckind) return;  /* nothing to change */
955  if (mode == KGC_GEN) {  /* change to generational mode */
956    /* make sure gray lists are consistent */
957    luaC_runtilstate(L, bitmask(GCSpropagate));
958    g->GCestimate = gettotalbytes(g);
959    g->gckind = KGC_GEN;
960  }
961  else {  /* change to incremental mode */
962    /* sweep all objects to turn them back to white
963       (as white has not changed, nothing extra will be collected) */
964    g->gckind = KGC_NORMAL;
965    entersweep(L);
966    luaC_runtilstate(L, ~sweepphases);
967  }
953   global_State *g = G(L);
954   if (mode == g->gckind) return;  /* nothing to change */
955   if (mode == KGC_GEN) {  /* change to generational mode */
956   /* make sure gray lists are consistent */
957   luaC_runtilstate(L, bitmask(GCSpropagate));
958   g->GCestimate = gettotalbytes(g);
959   g->gckind = KGC_GEN;
960   }
961   else {  /* change to incremental mode */
962   /* sweep all objects to turn them back to white
963      (as white has not changed, nothing extra will be collected) */
964   g->gckind = KGC_NORMAL;
965   entersweep(L);
966   luaC_runtilstate(L, ~sweepphases);
967   }
968968}
969969
970970
r31373r31374
972972** call all pending finalizers
973973*/
974974static void callallpendingfinalizers (lua_State *L, int propagateerrors) {
975  global_State *g = G(L);
976  while (g->tobefnz) {
977    resetoldbit(g->tobefnz);
978    GCTM(L, propagateerrors);
979  }
975   global_State *g = G(L);
976   while (g->tobefnz) {
977   resetoldbit(g->tobefnz);
978   GCTM(L, propagateerrors);
979   }
980980}
981981
982982
983983void luaC_freeallobjects (lua_State *L) {
984  global_State *g = G(L);
985  int i;
986  separatetobefnz(L, 1);  /* separate all objects with finalizers */
987  lua_assert(g->finobj == NULL);
988  callallpendingfinalizers(L, 0);
989  g->currentwhite = WHITEBITS; /* this "white" makes all objects look dead */
990  g->gckind = KGC_NORMAL;
991  sweepwholelist(L, &g->finobj);  /* finalizers can create objs. in 'finobj' */
992  sweepwholelist(L, &g->allgc);
993  for (i = 0; i < g->strt.size; i++)  /* free all string lists */
994    sweepwholelist(L, &g->strt.hash[i]);
995  lua_assert(g->strt.nuse == 0);
984   global_State *g = G(L);
985   int i;
986   separatetobefnz(L, 1);  /* separate all objects with finalizers */
987   lua_assert(g->finobj == NULL);
988   callallpendingfinalizers(L, 0);
989   g->currentwhite = WHITEBITS; /* this "white" makes all objects look dead */
990   g->gckind = KGC_NORMAL;
991   sweepwholelist(L, &g->finobj);  /* finalizers can create objs. in 'finobj' */
992   sweepwholelist(L, &g->allgc);
993   for (i = 0; i < g->strt.size; i++)  /* free all string lists */
994   sweepwholelist(L, &g->strt.hash[i]);
995   lua_assert(g->strt.nuse == 0);
996996}
997997
998998
999999static l_mem atomic (lua_State *L) {
1000  global_State *g = G(L);
1001  l_mem work = -cast(l_mem, g->GCmemtrav);  /* start counting work */
1002  GCObject *origweak, *origall;
1003  lua_assert(!iswhite(obj2gco(g->mainthread)));
1004  markobject(g, L);  /* mark running thread */
1005  /* registry and global metatables may be changed by API */
1006  markvalue(g, &g->l_registry);
1007  markmt(g);  /* mark basic metatables */
1008  /* remark occasional upvalues of (maybe) dead threads */
1009  remarkupvals(g);
1010  propagateall(g);  /* propagate changes */
1011  work += g->GCmemtrav;  /* stop counting (do not (re)count grays) */
1012  /* traverse objects caught by write barrier and by 'remarkupvals' */
1013  retraversegrays(g);
1014  work -= g->GCmemtrav;  /* restart counting */
1015  convergeephemerons(g);
1016  /* at this point, all strongly accessible objects are marked. */
1017  /* clear values from weak tables, before checking finalizers */
1018  clearvalues(g, g->weak, NULL);
1019  clearvalues(g, g->allweak, NULL);
1020  origweak = g->weak; origall = g->allweak;
1021  work += g->GCmemtrav;  /* stop counting (objects being finalized) */
1022  separatetobefnz(L, 0);  /* separate objects to be finalized */
1023  markbeingfnz(g);  /* mark objects that will be finalized */
1024  propagateall(g);  /* remark, to propagate `preserveness' */
1025  work -= g->GCmemtrav;  /* restart counting */
1026  convergeephemerons(g);
1027  /* at this point, all resurrected objects are marked. */
1028  /* remove dead objects from weak tables */
1029  clearkeys(g, g->ephemeron, NULL);  /* clear keys from all ephemeron tables */
1030  clearkeys(g, g->allweak, NULL);  /* clear keys from all allweak tables */
1031  /* clear values from resurrected weak tables */
1032  clearvalues(g, g->weak, origweak);
1033  clearvalues(g, g->allweak, origall);
1034  g->currentwhite = cast_byte(otherwhite(g));  /* flip current white */
1035  work += g->GCmemtrav;  /* complete counting */
1036  return work;  /* estimate of memory marked by 'atomic' */
1000   global_State *g = G(L);
1001   l_mem work = -cast(l_mem, g->GCmemtrav);  /* start counting work */
1002   GCObject *origweak, *origall;
1003   lua_assert(!iswhite(obj2gco(g->mainthread)));
1004   markobject(g, L);  /* mark running thread */
1005   /* registry and global metatables may be changed by API */
1006   markvalue(g, &g->l_registry);
1007   markmt(g);  /* mark basic metatables */
1008   /* remark occasional upvalues of (maybe) dead threads */
1009   remarkupvals(g);
1010   propagateall(g);  /* propagate changes */
1011   work += g->GCmemtrav;  /* stop counting (do not (re)count grays) */
1012   /* traverse objects caught by write barrier and by 'remarkupvals' */
1013   retraversegrays(g);
1014   work -= g->GCmemtrav;  /* restart counting */
1015   convergeephemerons(g);
1016   /* at this point, all strongly accessible objects are marked. */
1017   /* clear values from weak tables, before checking finalizers */
1018   clearvalues(g, g->weak, NULL);
1019   clearvalues(g, g->allweak, NULL);
1020   origweak = g->weak; origall = g->allweak;
1021   work += g->GCmemtrav;  /* stop counting (objects being finalized) */
1022   separatetobefnz(L, 0);  /* separate objects to be finalized */
1023   markbeingfnz(g);  /* mark objects that will be finalized */
1024   propagateall(g);  /* remark, to propagate `preserveness' */
1025   work -= g->GCmemtrav;  /* restart counting */
1026   convergeephemerons(g);
1027   /* at this point, all resurrected objects are marked. */
1028   /* remove dead objects from weak tables */
1029   clearkeys(g, g->ephemeron, NULL);  /* clear keys from all ephemeron tables */
1030   clearkeys(g, g->allweak, NULL);  /* clear keys from all allweak tables */
1031   /* clear values from resurrected weak tables */
1032   clearvalues(g, g->weak, origweak);
1033   clearvalues(g, g->allweak, origall);
1034   g->currentwhite = cast_byte(otherwhite(g));  /* flip current white */
1035   work += g->GCmemtrav;  /* complete counting */
1036   return work;  /* estimate of memory marked by 'atomic' */
10371037}
10381038
10391039
10401040static lu_mem singlestep (lua_State *L) {
1041  global_State *g = G(L);
1042  switch (g->gcstate) {
1043    case GCSpause: {
1044      /* start to count memory traversed */
1045      g->GCmemtrav = g->strt.size * sizeof(GCObject*);
1046      lua_assert(!isgenerational(g));
1047      restartcollection(g);
1048      g->gcstate = GCSpropagate;
1049      return g->GCmemtrav;
1050    }
1051    case GCSpropagate: {
1052      if (g->gray) {
1053        lu_mem oldtrav = g->GCmemtrav;
1054        propagatemark(g);
1055        return g->GCmemtrav - oldtrav;  /* memory traversed in this step */
1056      }
1057      else {  /* no more `gray' objects */
1058        lu_mem work;
1059        int sw;
1060        g->gcstate = GCSatomic;  /* finish mark phase */
1061        g->GCestimate = g->GCmemtrav;  /* save what was counted */;
1062        work = atomic(L);  /* add what was traversed by 'atomic' */
1063        g->GCestimate += work;  /* estimate of total memory traversed */
1064        sw = entersweep(L);
1065        return work + sw * GCSWEEPCOST;
1066      }
1067    }
1068    case GCSsweepstring: {
1069      int i;
1070      for (i = 0; i < GCSWEEPMAX && g->sweepstrgc + i < g->strt.size; i++)
1071        sweepwholelist(L, &g->strt.hash[g->sweepstrgc + i]);
1072      g->sweepstrgc += i;
1073      if (g->sweepstrgc >= g->strt.size)  /* no more strings to sweep? */
1074        g->gcstate = GCSsweepudata;
1075      return i * GCSWEEPCOST;
1076    }
1077    case GCSsweepudata: {
1078      if (g->sweepfin) {
1079        g->sweepfin = sweeplist(L, g->sweepfin, GCSWEEPMAX);
1080        return GCSWEEPMAX*GCSWEEPCOST;
1081      }
1082      else {
1083        g->gcstate = GCSsweep;
1084        return 0;
1085      }
1086    }
1087    case GCSsweep: {
1088      if (g->sweepgc) {
1089        g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX);
1090        return GCSWEEPMAX*GCSWEEPCOST;
1091      }
1092      else {
1093        /* sweep main thread */
1094        GCObject *mt = obj2gco(g->mainthread);
1095        sweeplist(L, &mt, 1);
1096        checkSizes(L);
1097        g->gcstate = GCSpause;  /* finish collection */
1098        return GCSWEEPCOST;
1099      }
1100    }
1101    default: lua_assert(0); return 0;
1102  }
1041   global_State *g = G(L);
1042   switch (g->gcstate) {
1043   case GCSpause: {
1044      /* start to count memory traversed */
1045      g->GCmemtrav = g->strt.size * sizeof(GCObject*);
1046      lua_assert(!isgenerational(g));
1047      restartcollection(g);
1048      g->gcstate = GCSpropagate;
1049      return g->GCmemtrav;
1050   }
1051   case GCSpropagate: {
1052      if (g->gray) {
1053      lu_mem oldtrav = g->GCmemtrav;
1054      propagatemark(g);
1055      return g->GCmemtrav - oldtrav;  /* memory traversed in this step */
1056      }
1057      else {  /* no more `gray' objects */
1058      lu_mem work;
1059      int sw;
1060      g->gcstate = GCSatomic;  /* finish mark phase */
1061      g->GCestimate = g->GCmemtrav;  /* save what was counted */;
1062      work = atomic(L);  /* add what was traversed by 'atomic' */
1063      g->GCestimate += work;  /* estimate of total memory traversed */
1064      sw = entersweep(L);
1065      return work + sw * GCSWEEPCOST;
1066      }
1067   }
1068   case GCSsweepstring: {
1069      int i;
1070      for (i = 0; i < GCSWEEPMAX && g->sweepstrgc + i < g->strt.size; i++)
1071      sweepwholelist(L, &g->strt.hash[g->sweepstrgc + i]);
1072      g->sweepstrgc += i;
1073      if (g->sweepstrgc >= g->strt.size)  /* no more strings to sweep? */
1074      g->gcstate = GCSsweepudata;
1075      return i * GCSWEEPCOST;
1076   }
1077   case GCSsweepudata: {
1078      if (g->sweepfin) {
1079      g->sweepfin = sweeplist(L, g->sweepfin, GCSWEEPMAX);
1080      return GCSWEEPMAX*GCSWEEPCOST;
1081      }
1082      else {
1083      g->gcstate = GCSsweep;
1084      return 0;
1085      }
1086   }
1087   case GCSsweep: {
1088      if (g->sweepgc) {
1089      g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX);
1090      return GCSWEEPMAX*GCSWEEPCOST;
1091      }
1092      else {
1093      /* sweep main thread */
1094      GCObject *mt = obj2gco(g->mainthread);
1095      sweeplist(L, &mt, 1);
1096      checkSizes(L);
1097      g->gcstate = GCSpause;  /* finish collection */
1098      return GCSWEEPCOST;
1099      }
1100   }
1101   default: lua_assert(0); return 0;
1102   }
11031103}
11041104
11051105
r31373r31374
11081108** by 'statemask'
11091109*/
11101110void luaC_runtilstate (lua_State *L, int statesmask) {
1111  global_State *g = G(L);
1112  while (!testbit(statesmask, g->gcstate))
1113    singlestep(L);
1111   global_State *g = G(L);
1112   while (!testbit(statesmask, g->gcstate))
1113   singlestep(L);
11141114}
11151115
11161116
11171117static void generationalcollection (lua_State *L) {
1118  global_State *g = G(L);
1119  lua_assert(g->gcstate == GCSpropagate);
1120  if (g->GCestimate == 0) {  /* signal for another major collection? */
1121    luaC_fullgc(L, 0);  /* perform a full regular collection */
1122    g->GCestimate = gettotalbytes(g);  /* update control */
1123  }
1124  else {
1125    lu_mem estimate = g->GCestimate;
1126    luaC_runtilstate(L, bitmask(GCSpause));  /* run complete (minor) cycle */
1127    g->gcstate = GCSpropagate;  /* skip restart */
1128    if (gettotalbytes(g) > (estimate / 100) * g->gcmajorinc)
1129      g->GCestimate = 0;  /* signal for a major collection */
1130    else
1131      g->GCestimate = estimate;  /* keep estimate from last major coll. */
1118   global_State *g = G(L);
1119   lua_assert(g->gcstate == GCSpropagate);
1120   if (g->GCestimate == 0) {  /* signal for another major collection? */
1121   luaC_fullgc(L, 0);  /* perform a full regular collection */
1122   g->GCestimate = gettotalbytes(g);  /* update control */
1123   }
1124   else {
1125   lu_mem estimate = g->GCestimate;
1126   luaC_runtilstate(L, bitmask(GCSpause));  /* run complete (minor) cycle */
1127   g->gcstate = GCSpropagate;  /* skip restart */
1128   if (gettotalbytes(g) > (estimate / 100) * g->gcmajorinc)
1129      g->GCestimate = 0;  /* signal for a major collection */
1130   else
1131      g->GCestimate = estimate;  /* keep estimate from last major coll. */
11321132
1133  }
1134  setpause(g, gettotalbytes(g));
1135  lua_assert(g->gcstate == GCSpropagate);
1133   }
1134   setpause(g, gettotalbytes(g));
1135   lua_assert(g->gcstate == GCSpropagate);
11361136}
11371137
11381138
11391139static void incstep (lua_State *L) {
1140  global_State *g = G(L);
1141  l_mem debt = g->GCdebt;
1142  int stepmul = g->gcstepmul;
1143  if (stepmul < 40) stepmul = 40;  /* avoid ridiculous low values (and 0) */
1144  /* convert debt from Kb to 'work units' (avoid zero debt and overflows) */
1145  debt = (debt / STEPMULADJ) + 1;
1146  debt = (debt < MAX_LMEM / stepmul) ? debt * stepmul : MAX_LMEM;
1147  do {  /* always perform at least one single step */
1148    lu_mem work = singlestep(L);  /* do some work */
1149    debt -= work;
1150  } while (debt > -GCSTEPSIZE && g->gcstate != GCSpause);
1151  if (g->gcstate == GCSpause)
1152    setpause(g, g->GCestimate);  /* pause until next cycle */
1153  else {
1154    debt = (debt / stepmul) * STEPMULADJ;  /* convert 'work units' to Kb */
1155    luaE_setdebt(g, debt);
1156  }
1140   global_State *g = G(L);
1141   l_mem debt = g->GCdebt;
1142   int stepmul = g->gcstepmul;
1143   if (stepmul < 40) stepmul = 40;  /* avoid ridiculous low values (and 0) */
1144   /* convert debt from Kb to 'work units' (avoid zero debt and overflows) */
1145   debt = (debt / STEPMULADJ) + 1;
1146   debt = (debt < MAX_LMEM / stepmul) ? debt * stepmul : MAX_LMEM;
1147   do {  /* always perform at least one single step */
1148   lu_mem work = singlestep(L);  /* do some work */
1149   debt -= work;
1150   } while (debt > -GCSTEPSIZE && g->gcstate != GCSpause);
1151   if (g->gcstate == GCSpause)
1152   setpause(g, g->GCestimate);  /* pause until next cycle */
1153   else {
1154   debt = (debt / stepmul) * STEPMULADJ;  /* convert 'work units' to Kb */
1155   luaE_setdebt(g, debt);
1156   }
11571157}
11581158
11591159
r31373r31374
11611161** performs a basic GC step
11621162*/
11631163void luaC_forcestep (lua_State *L) {
1164  global_State *g = G(L);
1165  int i;
1166  if (isgenerational(g)) generationalcollection(L);
1167  else incstep(L);
1168  /* run a few finalizers (or all of them at the end of a collect cycle) */
1169  for (i = 0; g->tobefnz && (i < GCFINALIZENUM || g->gcstate == GCSpause); i++)
1170    GCTM(L, 1);  /* call one finalizer */
1164   global_State *g = G(L);
1165   int i;
1166   if (isgenerational(g)) generationalcollection(L);
1167   else incstep(L);
1168   /* run a few finalizers (or all of them at the end of a collect cycle) */
1169   for (i = 0; g->tobefnz && (i < GCFINALIZENUM || g->gcstate == GCSpause); i++)
1170   GCTM(L, 1);  /* call one finalizer */
11711171}
11721172
11731173
r31373r31374
11751175** performs a basic GC step only if collector is running
11761176*/
11771177void luaC_step (lua_State *L) {
1178  global_State *g = G(L);
1179  if (g->gcrunning) luaC_forcestep(L);
1180  else luaE_setdebt(g, -GCSTEPSIZE);  /* avoid being called too often */
1178   global_State *g = G(L);
1179   if (g->gcrunning) luaC_forcestep(L);
1180   else luaE_setdebt(g, -GCSTEPSIZE);  /* avoid being called too often */
11811181}
11821182
11831183
r31373r31374
11871187** finalizers (which could change stack positions)
11881188*/
11891189void luaC_fullgc (lua_State *L, int isemergency) {
1190  global_State *g = G(L);
1191  int origkind = g->gckind;
1192  lua_assert(origkind != KGC_EMERGENCY);
1193  if (isemergency)  /* do not run finalizers during emergency GC */
1194    g->gckind = KGC_EMERGENCY;
1195  else {
1196    g->gckind = KGC_NORMAL;
1197    callallpendingfinalizers(L, 1);
1198  }
1199  if (keepinvariant(g)) {  /* may there be some black objects? */
1200    /* must sweep all objects to turn them back to white
1201       (as white has not changed, nothing will be collected) */
1202    entersweep(L);
1203  }
1204  /* finish any pending sweep phase to start a new cycle */
1205  luaC_runtilstate(L, bitmask(GCSpause));
1206  luaC_runtilstate(L, ~bitmask(GCSpause));  /* start new collection */
1207  luaC_runtilstate(L, bitmask(GCSpause));  /* run entire collection */
1208  if (origkind == KGC_GEN) {  /* generational mode? */
1209    /* generational mode must be kept in propagate phase */
1210    luaC_runtilstate(L, bitmask(GCSpropagate));
1211  }
1212  g->gckind = origkind;
1213  setpause(g, gettotalbytes(g));
1214  if (!isemergency)   /* do not run finalizers during emergency GC */
1215    callallpendingfinalizers(L, 1);
1190   global_State *g = G(L);
1191   int origkind = g->gckind;
1192   lua_assert(origkind != KGC_EMERGENCY);
1193   if (isemergency)  /* do not run finalizers during emergency GC */
1194   g->gckind = KGC_EMERGENCY;
1195   else {
1196   g->gckind = KGC_NORMAL;
1197   callallpendingfinalizers(L, 1);
1198   }
1199   if (keepinvariant(g)) {  /* may there be some black objects? */
1200   /* must sweep all objects to turn them back to white
1201      (as white has not changed, nothing will be collected) */
1202   entersweep(L);
1203   }
1204   /* finish any pending sweep phase to start a new cycle */
1205   luaC_runtilstate(L, bitmask(GCSpause));
1206   luaC_runtilstate(L, ~bitmask(GCSpause));  /* start new collection */
1207   luaC_runtilstate(L, bitmask(GCSpause));  /* run entire collection */
1208   if (origkind == KGC_GEN) {  /* generational mode? */
1209   /* generational mode must be kept in propagate phase */
1210   luaC_runtilstate(L, bitmask(GCSpropagate));
1211   }
1212   g->gckind = origkind;
1213   setpause(g, gettotalbytes(g));
1214   if (!isemergency)   /* do not run finalizers during emergency GC */
1215   callallpendingfinalizers(L, 1);
12161216}
12171217
12181218/* }====================================================== */
1219
1220
trunk/src/lib/lua/loadlib.c
r31373r31374
3535** variables that Lua check to set its paths.
3636*/
3737#if !defined(LUA_PATH)
38#define LUA_PATH   "LUA_PATH"
38#define LUA_PATH    "LUA_PATH"
3939#endif
4040
4141#if !defined(LUA_CPATH)
42#define LUA_CPATH   "LUA_CPATH"
42#define LUA_CPATH   "LUA_CPATH"
4343#endif
4444
45#define LUA_PATHSUFFIX      "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR
45#define LUA_PATHSUFFIX      "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR
4646
47#define LUA_PATHVERSION      LUA_PATH LUA_PATHSUFFIX
48#define LUA_CPATHVERSION   LUA_CPATH LUA_PATHSUFFIX
47#define LUA_PATHVERSION     LUA_PATH LUA_PATHSUFFIX
48#define LUA_CPATHVERSION    LUA_CPATH LUA_PATHSUFFIX
4949
5050/*
5151** LUA_PATH_SEP is the character that separates templates in a path.
r31373r31374
5757** luaopen_ function name.
5858*/
5959#if !defined (LUA_PATH_SEP)
60#define LUA_PATH_SEP      ";"
60#define LUA_PATH_SEP        ";"
6161#endif
6262#if !defined (LUA_PATH_MARK)
63#define LUA_PATH_MARK      "?"
63#define LUA_PATH_MARK       "?"
6464#endif
6565#if !defined (LUA_EXEC_DIR)
66#define LUA_EXEC_DIR      "!"
66#define LUA_EXEC_DIR        "!"
6767#endif
6868#if !defined (LUA_IGMARK)
69#define LUA_IGMARK      "-"
69#define LUA_IGMARK      "-"
7070#endif
7171
7272
r31373r31374
7777** when searching for a Lua loader.
7878*/
7979#if !defined(LUA_CSUBSEP)
80#define LUA_CSUBSEP      LUA_DIRSEP
80#define LUA_CSUBSEP     LUA_DIRSEP
8181#endif
8282
8383#if !defined(LUA_LSUBSEP)
84#define LUA_LSUBSEP      LUA_DIRSEP
84#define LUA_LSUBSEP     LUA_DIRSEP
8585#endif
8686
8787
8888/* prefix for open functions in C libraries */
89#define LUA_POF      "luaopen_"
89#define LUA_POF     "luaopen_"
9090
9191/* separator for open functions in C libraries */
92#define LUA_OFSEP   "_"
92#define LUA_OFSEP   "_"
9393
9494
9595/* table (in the registry) that keeps handles for all loaded C libraries */
96#define CLIBS      "_CLIBS"
96#define CLIBS       "_CLIBS"
9797
98#define LIB_FAIL   "open"
98#define LIB_FAIL    "open"
9999
100100
101101/* error codes for ll_loadfunc */
102#define ERRLIB      1
103#define ERRFUNC      2
102#define ERRLIB      1
103#define ERRFUNC     2
104104
105#define setprogdir(L)      ((void)0)
105#define setprogdir(L)       ((void)0)
106106
107107
108108/*
r31373r31374
127127#include <dlfcn.h>
128128
129129static void ll_unloadlib (void *lib) {
130  dlclose(lib);
130   dlclose(lib);
131131}
132132
133133
134134static void *ll_load (lua_State *L, const char *path, int seeglb) {
135  void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : RTLD_LOCAL));
136  if (lib == NULL) lua_pushstring(L, dlerror());
137  return lib;
135   void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : RTLD_LOCAL));
136   if (lib == NULL) lua_pushstring(L, dlerror());
137   return lib;
138138}
139139
140140
141141static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
142  lua_CFunction f = (lua_CFunction)dlsym(lib, sym);
143  if (f == NULL) lua_pushstring(L, dlerror());
144  return f;
142   lua_CFunction f = (lua_CFunction)dlsym(lib, sym);
143   if (f == NULL) lua_pushstring(L, dlerror());
144   return f;
145145}
146146
147147/* }====================================================== */
r31373r31374
161161** optional flags for LoadLibraryEx
162162*/
163163#if !defined(LUA_LLE_FLAGS)
164#define LUA_LLE_FLAGS   0
164#define LUA_LLE_FLAGS   0
165165#endif
166166
167167
168168static void setprogdir (lua_State *L) {
169  char buff[MAX_PATH + 1];
170  char *lb;
171  DWORD nsize = sizeof(buff)/sizeof(char);
172  DWORD n = GetModuleFileNameA(NULL, buff, nsize);
173  if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL)
174    luaL_error(L, "unable to get ModuleFileName");
175  else {
176    *lb = '\0';
177    luaL_gsub(L, lua_tostring(L, -1), LUA_EXEC_DIR, buff);
178    lua_remove(L, -2);  /* remove original string */
179  }
169   char buff[MAX_PATH + 1];
170   char *lb;
171   DWORD nsize = sizeof(buff)/sizeof(char);
172   DWORD n = GetModuleFileNameA(NULL, buff, nsize);
173   if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL)
174   luaL_error(L, "unable to get ModuleFileName");
175   else {
176   *lb = '\0';
177   luaL_gsub(L, lua_tostring(L, -1), LUA_EXEC_DIR, buff);
178   lua_remove(L, -2);  /* remove original string */
179   }
180180}
181181
182182
183183static void pusherror (lua_State *L) {
184  int error = GetLastError();
185  char buffer[128];
186  if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
187      NULL, error, 0, buffer, sizeof(buffer)/sizeof(char), NULL))
188    lua_pushstring(L, buffer);
189  else
190    lua_pushfstring(L, "system error %d\n", error);
184   int error = GetLastError();
185   char buffer[128];
186   if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
187      NULL, error, 0, buffer, sizeof(buffer)/sizeof(char), NULL))
188   lua_pushstring(L, buffer);
189   else
190   lua_pushfstring(L, "system error %d\n", error);
191191}
192192
193193static void ll_unloadlib (void *lib) {
194  FreeLibrary((HMODULE)lib);
194   FreeLibrary((HMODULE)lib);
195195}
196196
197197
198198static void *ll_load (lua_State *L, const char *path, int seeglb) {
199  HMODULE lib = LoadLibraryExA(path, NULL, LUA_LLE_FLAGS);
200  (void)(seeglb);  /* not used: symbols are 'global' by default */
201  if (lib == NULL) pusherror(L);
202  return lib;
199   HMODULE lib = LoadLibraryExA(path, NULL, LUA_LLE_FLAGS);
200   (void)(seeglb);  /* not used: symbols are 'global' by default */
201   if (lib == NULL) pusherror(L);
202   return lib;
203203}
204204
205205
206206static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
207  lua_CFunction f = (lua_CFunction)GetProcAddress((HMODULE)lib, sym);
208  if (f == NULL) pusherror(L);
209  return f;
207   lua_CFunction f = (lua_CFunction)GetProcAddress((HMODULE)lib, sym);
208   if (f == NULL) pusherror(L);
209   return f;
210210}
211211
212212/* }====================================================== */
r31373r31374
220220*/
221221
222222#undef LIB_FAIL
223#define LIB_FAIL   "absent"
223#define LIB_FAIL    "absent"
224224
225225
226#define DLMSG   "dynamic libraries not enabled; check your Lua installation"
226#define DLMSG   "dynamic libraries not enabled; check your Lua installation"
227227
228228
229229static void ll_unloadlib (void *lib) {
230  (void)(lib);  /* not used */
230   (void)(lib);  /* not used */
231231}
232232
233233
234234static void *ll_load (lua_State *L, const char *path, int seeglb) {
235  (void)(path); (void)(seeglb);  /* not used */
236  lua_pushliteral(L, DLMSG);
237  return NULL;
235   (void)(path); (void)(seeglb);  /* not used */
236   lua_pushliteral(L, DLMSG);
237   return NULL;
238238}
239239
240240
241241static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) {
242  (void)(lib); (void)(sym);  /* not used */
243  lua_pushliteral(L, DLMSG);
244  return NULL;
242   (void)(lib); (void)(sym);  /* not used */
243   lua_pushliteral(L, DLMSG);
244   return NULL;
245245}
246246
247247/* }====================================================== */
r31373r31374
249249
250250
251251static void *ll_checkclib (lua_State *L, const char *path) {
252  void *plib;
253  lua_getfield(L, LUA_REGISTRYINDEX, CLIBS);
254  lua_getfield(L, -1, path);
255  plib = lua_touserdata(L, -1);  /* plib = CLIBS[path] */
256  lua_pop(L, 2);  /* pop CLIBS table and 'plib' */
257  return plib;
252   void *plib;
253   lua_getfield(L, LUA_REGISTRYINDEX, CLIBS);
254   lua_getfield(L, -1, path);
255   plib = lua_touserdata(L, -1);  /* plib = CLIBS[path] */
256   lua_pop(L, 2);  /* pop CLIBS table and 'plib' */
257   return plib;
258258}
259259
260260
261261static void ll_addtoclib (lua_State *L, const char *path, void *plib) {
262  lua_getfield(L, LUA_REGISTRYINDEX, CLIBS);
263  lua_pushlightuserdata(L, plib);
264  lua_pushvalue(L, -1);
265  lua_setfield(L, -3, path);  /* CLIBS[path] = plib */
266  lua_rawseti(L, -2, luaL_len(L, -2) + 1);  /* CLIBS[#CLIBS + 1] = plib */
267  lua_pop(L, 1);  /* pop CLIBS table */
262   lua_getfield(L, LUA_REGISTRYINDEX, CLIBS);
263   lua_pushlightuserdata(L, plib);
264   lua_pushvalue(L, -1);
265   lua_setfield(L, -3, path);  /* CLIBS[path] = plib */
266   lua_rawseti(L, -2, luaL_len(L, -2) + 1);  /* CLIBS[#CLIBS + 1] = plib */
267   lua_pop(L, 1);  /* pop CLIBS table */
268268}
269269
270270
r31373r31374
273273** handles in list CLIBS
274274*/
275275static int gctm (lua_State *L) {
276  int n = luaL_len(L, 1);
277  for (; n >= 1; n--) {  /* for each handle, in reverse order */
278    lua_rawgeti(L, 1, n);  /* get handle CLIBS[n] */
279    ll_unloadlib(lua_touserdata(L, -1));
280    lua_pop(L, 1);  /* pop handle */
281  }
282  return 0;
276   int n = luaL_len(L, 1);
277   for (; n >= 1; n--) {  /* for each handle, in reverse order */
278   lua_rawgeti(L, 1, n);  /* get handle CLIBS[n] */
279   ll_unloadlib(lua_touserdata(L, -1));
280   lua_pop(L, 1);  /* pop handle */
281   }
282   return 0;
283283}
284284
285285
286286static int ll_loadfunc (lua_State *L, const char *path, const char *sym) {
287  void *reg = ll_checkclib(L, path);  /* check loaded C libraries */
288  if (reg == NULL) {  /* must load library? */
289    reg = ll_load(L, path, *sym == '*');
290    if (reg == NULL) return ERRLIB;  /* unable to load library */
291    ll_addtoclib(L, path, reg);
292  }
293  if (*sym == '*') {  /* loading only library (no function)? */
294    lua_pushboolean(L, 1);  /* return 'true' */
295    return 0;  /* no errors */
296  }
297  else {
298    lua_CFunction f = ll_sym(L, reg, sym);
299    if (f == NULL)
300      return ERRFUNC;  /* unable to find function */
301    lua_pushcfunction(L, f);  /* else create new function */
302    return 0;  /* no errors */
303  }
287   void *reg = ll_checkclib(L, path);  /* check loaded C libraries */
288   if (reg == NULL) {  /* must load library? */
289   reg = ll_load(L, path, *sym == '*');
290   if (reg == NULL) return ERRLIB;  /* unable to load library */
291   ll_addtoclib(L, path, reg);
292   }
293   if (*sym == '*') {  /* loading only library (no function)? */
294   lua_pushboolean(L, 1);  /* return 'true' */
295   return 0;  /* no errors */
296   }
297   else {
298   lua_CFunction f = ll_sym(L, reg, sym);
299   if (f == NULL)
300      return ERRFUNC;  /* unable to find function */
301   lua_pushcfunction(L, f);  /* else create new function */
302   return 0;  /* no errors */
303   }
304304}
305305
306306
307307static int ll_loadlib (lua_State *L) {
308  const char *path = luaL_checkstring(L, 1);
309  const char *init = luaL_checkstring(L, 2);
310  int stat = ll_loadfunc(L, path, init);
311  if (stat == 0)  /* no errors? */
312    return 1;  /* return the loaded function */
313  else {  /* error; error message is on stack top */
314    lua_pushnil(L);
315    lua_insert(L, -2);
316    lua_pushstring(L, (stat == ERRLIB) ?  LIB_FAIL : "init");
317    return 3;  /* return nil, error message, and where */
318  }
308   const char *path = luaL_checkstring(L, 1);
309   const char *init = luaL_checkstring(L, 2);
310   int stat = ll_loadfunc(L, path, init);
311   if (stat == 0)  /* no errors? */
312   return 1;  /* return the loaded function */
313   else {  /* error; error message is on stack top */
314   lua_pushnil(L);
315   lua_insert(L, -2);
316   lua_pushstring(L, (stat == ERRLIB) ?  LIB_FAIL : "init");
317   return 3;  /* return nil, error message, and where */
318   }
319319}
320320
321321
r31373r31374
328328
329329
330330static int readable (const char *filename) {
331  FILE *f = fopen(filename, "r");  /* try to open file */
332  if (f == NULL) return 0;  /* open failed */
333  fclose(f);
334  return 1;
331   FILE *f = fopen(filename, "r");  /* try to open file */
332   if (f == NULL) return 0;  /* open failed */
333   fclose(f);
334   return 1;
335335}
336336
337337
338338static const char *pushnexttemplate (lua_State *L, const char *path) {
339  const char *l;
340  while (*path == *LUA_PATH_SEP) path++;  /* skip separators */
341  if (*path == '\0') return NULL;  /* no more templates */
342  l = strchr(path, *LUA_PATH_SEP);  /* find next separator */
343  if (l == NULL) l = path + strlen(path);
344  lua_pushlstring(L, path, l - path);  /* template */
345  return l;
339   const char *l;
340   while (*path == *LUA_PATH_SEP) path++;  /* skip separators */
341   if (*path == '\0') return NULL;  /* no more templates */
342   l = strchr(path, *LUA_PATH_SEP);  /* find next separator */
343   if (l == NULL) l = path + strlen(path);
344   lua_pushlstring(L, path, l - path);  /* template */
345   return l;
346346}
347347
348348
349349static const char *searchpath (lua_State *L, const char *name,
350                                             const char *path,
351                                             const char *sep,
352                                             const char *dirsep) {
353  luaL_Buffer msg;  /* to build error message */
354  luaL_buffinit(L, &msg);
355  if (*sep != '\0')  /* non-empty separator? */
356    name = luaL_gsub(L, name, sep, dirsep);  /* replace it by 'dirsep' */
357  while ((path = pushnexttemplate(L, path)) != NULL) {
358    const char *filename = luaL_gsub(L, lua_tostring(L, -1),
359                                     LUA_PATH_MARK, name);
360    lua_remove(L, -2);  /* remove path template */
361    if (readable(filename))  /* does file exist and is readable? */
362      return filename;  /* return that file name */
363    lua_pushfstring(L, "\n\tno file " LUA_QS, filename);
364    lua_remove(L, -2);  /* remove file name */
365    luaL_addvalue(&msg);  /* concatenate error msg. entry */
366  }
367  luaL_pushresult(&msg);  /* create error message */
368  return NULL;  /* not found */
350                                    const char *path,
351                                    const char *sep,
352                                    const char *dirsep) {
353   luaL_Buffer msg;  /* to build error message */
354   luaL_buffinit(L, &msg);
355   if (*sep != '\0')  /* non-empty separator? */
356   name = luaL_gsub(L, name, sep, dirsep);  /* replace it by 'dirsep' */
357   while ((path = pushnexttemplate(L, path)) != NULL) {
358   const char *filename = luaL_gsub(L, lua_tostring(L, -1),
359                              LUA_PATH_MARK, name);
360   lua_remove(L, -2);  /* remove path template */
361   if (readable(filename))  /* does file exist and is readable? */
362      return filename;  /* return that file name */
363   lua_pushfstring(L, "\n\tno file " LUA_QS, filename);
364   lua_remove(L, -2);  /* remove file name */
365   luaL_addvalue(&msg);  /* concatenate error msg. entry */
366   }
367   luaL_pushresult(&msg);  /* create error message */
368   return NULL;  /* not found */
369369}
370370
371371
372372static int ll_searchpath (lua_State *L) {
373  const char *f = searchpath(L, luaL_checkstring(L, 1),
374                                luaL_checkstring(L, 2),
375                                luaL_optstring(L, 3, "."),
376                                luaL_optstring(L, 4, LUA_DIRSEP));
377  if (f != NULL) return 1;
378  else {  /* error message is on top of the stack */
379    lua_pushnil(L);
380    lua_insert(L, -2);
381    return 2;  /* return nil + error message */
382  }
373   const char *f = searchpath(L, luaL_checkstring(L, 1),
374                        luaL_checkstring(L, 2),
375                        luaL_optstring(L, 3, "."),
376                        luaL_optstring(L, 4, LUA_DIRSEP));
377   if (f != NULL) return 1;
378   else {  /* error message is on top of the stack */
379   lua_pushnil(L);
380   lua_insert(L, -2);
381   return 2;  /* return nil + error message */
382   }
383383}
384384
385385
386386static const char *findfile (lua_State *L, const char *name,
387                                           const char *pname,
388                                           const char *dirsep) {
389  const char *path;
390  lua_getfield(L, lua_upvalueindex(1), pname);
391  path = lua_tostring(L, -1);
392  if (path == NULL)
393    luaL_error(L, LUA_QL("package.%s") " must be a string", pname);
394  return searchpath(L, name, path, ".", dirsep);
387                                 const char *pname,
388                                 const char *dirsep) {
389   const char *path;
390   lua_getfield(L, lua_upvalueindex(1), pname);
391   path = lua_tostring(L, -1);
392   if (path == NULL)
393   luaL_error(L, LUA_QL("package.%s") " must be a string", pname);
394   return searchpath(L, name, path, ".", dirsep);
395395}
396396
397397
398398static int checkload (lua_State *L, int stat, const char *filename) {
399  if (stat) {  /* module loaded successfully? */
400    lua_pushstring(L, filename);  /* will be 2nd argument to module */
401    return 2;  /* return open function and file name */
402  }
403  else
404    return luaL_error(L, "error loading module " LUA_QS
405                         " from file " LUA_QS ":\n\t%s",
406                          lua_tostring(L, 1), filename, lua_tostring(L, -1));
399   if (stat) {  /* module loaded successfully? */
400   lua_pushstring(L, filename);  /* will be 2nd argument to module */
401   return 2;  /* return open function and file name */
402   }
403   else
404   return luaL_error(L, "error loading module " LUA_QS
405                     " from file " LUA_QS ":\n\t%s",
406                     lua_tostring(L, 1), filename, lua_tostring(L, -1));
407407}
408408
409409
410410static int searcher_Lua (lua_State *L) {
411  const char *filename;
412  const char *name = luaL_checkstring(L, 1);
413  filename = findfile(L, name, "path", LUA_LSUBSEP);
414  if (filename == NULL) return 1;  /* module not found in this path */
415  return checkload(L, (luaL_loadfile(L, filename) == LUA_OK), filename);
411   const char *filename;
412   const char *name = luaL_checkstring(L, 1);
413   filename = findfile(L, name, "path", LUA_LSUBSEP);
414   if (filename == NULL) return 1;  /* module not found in this path */
415   return checkload(L, (luaL_loadfile(L, filename) == LUA_OK), filename);
416416}
417417
418418
419419static int loadfunc (lua_State *L, const char *filename, const char *modname) {
420  const char *funcname;
421  const char *mark;
422  modname = luaL_gsub(L, modname, ".", LUA_OFSEP);
423  mark = strchr(modname, *LUA_IGMARK);
424  if (mark) {
425    int stat;
426    funcname = lua_pushlstring(L, modname, mark - modname);
427    funcname = lua_pushfstring(L, LUA_POF"%s", funcname);
428    stat = ll_loadfunc(L, filename, funcname);
429    if (stat != ERRFUNC) return stat;
430    modname = mark + 1;  /* else go ahead and try old-style name */
431  }
432  funcname = lua_pushfstring(L, LUA_POF"%s", modname);
433  return ll_loadfunc(L, filename, funcname);
420   const char *funcname;
421   const char *mark;
422   modname = luaL_gsub(L, modname, ".", LUA_OFSEP);
423   mark = strchr(modname, *LUA_IGMARK);
424   if (mark) {
425   int stat;
426   funcname = lua_pushlstring(L, modname, mark - modname);
427   funcname = lua_pushfstring(L, LUA_POF"%s", funcname);
428   stat = ll_loadfunc(L, filename, funcname);
429   if (stat != ERRFUNC) return stat;
430   modname = mark + 1;  /* else go ahead and try old-style name */
431   }
432   funcname = lua_pushfstring(L, LUA_POF"%s", modname);
433   return ll_loadfunc(L, filename, funcname);
434434}
435435
436436
437437static int searcher_C (lua_State *L) {
438  const char *name = luaL_checkstring(L, 1);
439  const char *filename = findfile(L, name, "cpath", LUA_CSUBSEP);
440  if (filename == NULL) return 1;  /* module not found in this path */
441  return checkload(L, (loadfunc(L, filename, name) == 0), filename);
438   const char *name = luaL_checkstring(L, 1);
439   const char *filename = findfile(L, name, "cpath", LUA_CSUBSEP);
440   if (filename == NULL) return 1;  /* module not found in this path */
441   return checkload(L, (loadfunc(L, filename, name) == 0), filename);
442442}
443443
444444
445445static int searcher_Croot (lua_State *L) {
446  const char *filename;
447  const char *name = luaL_checkstring(L, 1);
448  const char *p = strchr(name, '.');
449  int stat;
450  if (p == NULL) return 0;  /* is root */
451  lua_pushlstring(L, name, p - name);
452  filename = findfile(L, lua_tostring(L, -1), "cpath", LUA_CSUBSEP);
453  if (filename == NULL) return 1;  /* root not found */
454  if ((stat = loadfunc(L, filename, name)) != 0) {
455    if (stat != ERRFUNC)
456      return checkload(L, 0, filename);  /* real error */
457    else {  /* open function not found */
458      lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS,
459                         name, filename);
460      return 1;
461    }
462  }
463  lua_pushstring(L, filename);  /* will be 2nd argument to module */
464  return 2;
446   const char *filename;
447   const char *name = luaL_checkstring(L, 1);
448   const char *p = strchr(name, '.');
449   int stat;
450   if (p == NULL) return 0;  /* is root */
451   lua_pushlstring(L, name, p - name);
452   filename = findfile(L, lua_tostring(L, -1), "cpath", LUA_CSUBSEP);
453   if (filename == NULL) return 1;  /* root not found */
454   if ((stat = loadfunc(L, filename, name)) != 0) {
455   if (stat != ERRFUNC)
456      return checkload(L, 0, filename);  /* real error */
457   else {  /* open function not found */
458      lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS,
459                     name, filename);
460      return 1;
461   }
462   }
463   lua_pushstring(L, filename);  /* will be 2nd argument to module */
464   return 2;
465465}
466466
467467
468468static int searcher_preload (lua_State *L) {
469  const char *name = luaL_checkstring(L, 1);
470  lua_getfield(L, LUA_REGISTRYINDEX, "_PRELOAD");
471  lua_getfield(L, -1, name);
472  if (lua_isnil(L, -1))  /* not found? */
473    lua_pushfstring(L, "\n\tno field package.preload['%s']", name);
474  return 1;
469   const char *name = luaL_checkstring(L, 1);
470   lua_getfield(L, LUA_REGISTRYINDEX, "_PRELOAD");
471   lua_getfield(L, -1, name);
472   if (lua_isnil(L, -1))  /* not found? */
473   lua_pushfstring(L, "\n\tno field package.preload['%s']", name);
474   return 1;
475475}
476476
477477
478478static void findloader (lua_State *L, const char *name) {
479  int i;
480  luaL_Buffer msg;  /* to build error message */
481  luaL_buffinit(L, &msg);
482  lua_getfield(L, lua_upvalueindex(1), "searchers");  /* will be at index 3 */
483  if (!lua_istable(L, 3))
484    luaL_error(L, LUA_QL("package.searchers") " must be a table");
485  /*  iterate over available searchers to find a loader */
486  for (i = 1; ; i++) {
487    lua_rawgeti(L, 3, i);  /* get a searcher */
488    if (lua_isnil(L, -1)) {  /* no more searchers? */
489      lua_pop(L, 1);  /* remove nil */
490      luaL_pushresult(&msg);  /* create error message */
491      luaL_error(L, "module " LUA_QS " not found:%s",
492                    name, lua_tostring(L, -1));
493    }
494    lua_pushstring(L, name);
495    lua_call(L, 1, 2);  /* call it */
496    if (lua_isfunction(L, -2))  /* did it find a loader? */
497      return;  /* module loader found */
498    else if (lua_isstring(L, -2)) {  /* searcher returned error message? */
499      lua_pop(L, 1);  /* remove extra return */
500      luaL_addvalue(&msg);  /* concatenate error message */
501    }
502    else
503      lua_pop(L, 2);  /* remove both returns */
504  }
479   int i;
480   luaL_Buffer msg;  /* to build error message */
481   luaL_buffinit(L, &msg);
482   lua_getfield(L, lua_upvalueindex(1), "searchers");  /* will be at index 3 */
483   if (!lua_istable(L, 3))
484   luaL_error(L, LUA_QL("package.searchers") " must be a table");
485   /*  iterate over available searchers to find a loader */
486   for (i = 1; ; i++) {
487   lua_rawgeti(L, 3, i);  /* get a searcher */
488   if (lua_isnil(L, -1)) {  /* no more searchers? */
489      lua_pop(L, 1);  /* remove nil */
490      luaL_pushresult(&msg);  /* create error message */
491      luaL_error(L, "module " LUA_QS " not found:%s",
492               name, lua_tostring(L, -1));
493   }
494   lua_pushstring(L, name);
495   lua_call(L, 1, 2);  /* call it */
496   if (lua_isfunction(L, -2))  /* did it find a loader? */
497      return;  /* module loader found */
498   else if (lua_isstring(L, -2)) {  /* searcher returned error message? */
499      lua_pop(L, 1);  /* remove extra return */
500      luaL_addvalue(&msg);  /* concatenate error message */
501   }
502   else
503      lua_pop(L, 2);  /* remove both returns */
504   }
505505}
506506
507507
508508static int ll_require (lua_State *L) {
509  const char *name = luaL_checkstring(L, 1);
510  lua_settop(L, 1);  /* _LOADED table will be at index 2 */
511  lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
512  lua_getfield(L, 2, name);  /* _LOADED[name] */
513  if (lua_toboolean(L, -1))  /* is it there? */
514    return 1;  /* package is already loaded */
515  /* else must load package */
516  lua_pop(L, 1);  /* remove 'getfield' result */
517  findloader(L, name);
518  lua_pushstring(L, name);  /* pass name as argument to module loader */
519  lua_insert(L, -2);  /* name is 1st argument (before search data) */
520  lua_call(L, 2, 1);  /* run loader to load module */
521  if (!lua_isnil(L, -1))  /* non-nil return? */
522    lua_setfield(L, 2, name);  /* _LOADED[name] = returned value */
523  lua_getfield(L, 2, name);
524  if (lua_isnil(L, -1)) {   /* module did not set a value? */
525    lua_pushboolean(L, 1);  /* use true as result */
526    lua_pushvalue(L, -1);  /* extra copy to be returned */
527    lua_setfield(L, 2, name);  /* _LOADED[name] = true */
528  }
529  return 1;
509   const char *name = luaL_checkstring(L, 1);
510   lua_settop(L, 1);  /* _LOADED table will be at index 2 */
511   lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
512   lua_getfield(L, 2, name);  /* _LOADED[name] */
513   if (lua_toboolean(L, -1))  /* is it there? */
514   return 1;  /* package is already loaded */
515   /* else must load package */
516   lua_pop(L, 1);  /* remove 'getfield' result */
517   findloader(L, name);
518   lua_pushstring(L, name);  /* pass name as argument to module loader */
519   lua_insert(L, -2);  /* name is 1st argument (before search data) */
520   lua_call(L, 2, 1);  /* run loader to load module */
521   if (!lua_isnil(L, -1))  /* non-nil return? */
522   lua_setfield(L, 2, name);  /* _LOADED[name] = returned value */
523   lua_getfield(L, 2, name);
524   if (lua_isnil(L, -1)) {   /* module did not set a value? */
525   lua_pushboolean(L, 1);  /* use true as result */
526   lua_pushvalue(L, -1);  /* extra copy to be returned */
527   lua_setfield(L, 2, name);  /* _LOADED[name] = true */
528   }
529   return 1;
530530}
531531
532532/* }====================================================== */
r31373r31374
544544** changes the environment variable of calling function
545545*/
546546static void set_env (lua_State *L) {
547  lua_Debug ar;
548  if (lua_getstack(L, 1, &ar) == 0 ||
549      lua_getinfo(L, "f", &ar) == 0 ||  /* get calling function */
550      lua_iscfunction(L, -1))
551    luaL_error(L, LUA_QL("module") " not called from a Lua function");
552  lua_pushvalue(L, -2);  /* copy new environment table to top */
553  lua_setupvalue(L, -2, 1);
554  lua_pop(L, 1);  /* remove function */
547   lua_Debug ar;
548   if (lua_getstack(L, 1, &ar) == 0 ||
549      lua_getinfo(L, "f", &ar) == 0 ||  /* get calling function */
550      lua_iscfunction(L, -1))
551   luaL_error(L, LUA_QL("module") " not called from a Lua function");
552   lua_pushvalue(L, -2);  /* copy new environment table to top */
553   lua_setupvalue(L, -2, 1);
554   lua_pop(L, 1);  /* remove function */
555555}
556556
557557
558558static void dooptions (lua_State *L, int n) {
559  int i;
560  for (i = 2; i <= n; i++) {
561    if (lua_isfunction(L, i)) {  /* avoid 'calling' extra info. */
562      lua_pushvalue(L, i);  /* get option (a function) */
563      lua_pushvalue(L, -2);  /* module */
564      lua_call(L, 1, 0);
565    }
566  }
559   int i;
560   for (i = 2; i <= n; i++) {
561   if (lua_isfunction(L, i)) {  /* avoid 'calling' extra info. */
562      lua_pushvalue(L, i);  /* get option (a function) */
563      lua_pushvalue(L, -2);  /* module */
564      lua_call(L, 1, 0);
565   }
566   }
567567}
568568
569569
570570static void modinit (lua_State *L, const char *modname) {
571  const char *dot;
572  lua_pushvalue(L, -1);
573  lua_setfield(L, -2, "_M");  /* module._M = module */
574  lua_pushstring(L, modname);
575  lua_setfield(L, -2, "_NAME");
576  dot = strrchr(modname, '.');  /* look for last dot in module name */
577  if (dot == NULL) dot = modname;
578  else dot++;
579  /* set _PACKAGE as package name (full module name minus last part) */
580  lua_pushlstring(L, modname, dot - modname);
581  lua_setfield(L, -2, "_PACKAGE");
571   const char *dot;
572   lua_pushvalue(L, -1);
573   lua_setfield(L, -2, "_M");  /* module._M = module */
574   lua_pushstring(L, modname);
575   lua_setfield(L, -2, "_NAME");
576   dot = strrchr(modname, '.');  /* look for last dot in module name */
577   if (dot == NULL) dot = modname;
578   else dot++;
579   /* set _PACKAGE as package name (full module name minus last part) */
580   lua_pushlstring(L, modname, dot - modname);
581   lua_setfield(L, -2, "_PACKAGE");
582582}
583583
584584
585585static int ll_module (lua_State *L) {
586  const char *modname = luaL_checkstring(L, 1);
587  int lastarg = lua_gettop(L);  /* last parameter */
588  luaL_pushmodule(L, modname, 1);  /* get/create module table */
589  /* check whether table already has a _NAME field */
590  lua_getfield(L, -1, "_NAME");
591  if (!lua_isnil(L, -1))  /* is table an initialized module? */
592    lua_pop(L, 1);
593  else {  /* no; initialize it */
594    lua_pop(L, 1);
595    modinit(L, modname);
596  }
597  lua_pushvalue(L, -1);
598  set_env(L);
599  dooptions(L, lastarg);
600  return 1;
586   const char *modname = luaL_checkstring(L, 1);
587   int lastarg = lua_gettop(L);  /* last parameter */
588   luaL_pushmodule(L, modname, 1);  /* get/create module table */
589   /* check whether table already has a _NAME field */
590   lua_getfield(L, -1, "_NAME");
591   if (!lua_isnil(L, -1))  /* is table an initialized module? */
592   lua_pop(L, 1);
593   else {  /* no; initialize it */
594   lua_pop(L, 1);
595   modinit(L, modname);
596   }
597   lua_pushvalue(L, -1);
598   set_env(L);
599   dooptions(L, lastarg);
600   return 1;
601601}
602602
603603
604604static int ll_seeall (lua_State *L) {
605  luaL_checktype(L, 1, LUA_TTABLE);
606  if (!lua_getmetatable(L, 1)) {
607    lua_createtable(L, 0, 1); /* create new metatable */
608    lua_pushvalue(L, -1);
609    lua_setmetatable(L, 1);
610  }
611  lua_pushglobaltable(L);
612  lua_setfield(L, -2, "__index");  /* mt.__index = _G */
613  return 0;
605   luaL_checktype(L, 1, LUA_TTABLE);
606   if (!lua_getmetatable(L, 1)) {
607   lua_createtable(L, 0, 1); /* create new metatable */
608   lua_pushvalue(L, -1);
609   lua_setmetatable(L, 1);
610   }
611   lua_pushglobaltable(L);
612   lua_setfield(L, -2, "__index");  /* mt.__index = _G */
613   return 0;
614614}
615615
616616#endif
r31373r31374
619619
620620
621621/* auxiliary mark (for internal use) */
622#define AUXMARK      "\1"
622#define AUXMARK     "\1"
623623
624624
625625/*
626626** return registry.LUA_NOENV as a boolean
627627*/
628628static int noenv (lua_State *L) {
629  int b;
630  lua_getfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
631  b = lua_toboolean(L, -1);
632  lua_pop(L, 1);  /* remove value */
633  return b;
629   int b;
630   lua_getfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
631   b = lua_toboolean(L, -1);
632   lua_pop(L, 1);  /* remove value */
633   return b;
634634}
635635
636636
637637static void setpath (lua_State *L, const char *fieldname, const char *envname1,
638                                   const char *envname2, const char *def) {
639  const char *path = getenv(envname1);
640  if (path == NULL)  /* no environment variable? */
641    path = getenv(envname2);  /* try alternative name */
642  if (path == NULL || noenv(L))  /* no environment variable? */
643    lua_pushstring(L, def);  /* use default */
644  else {
645    /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
646    path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP,
647                              LUA_PATH_SEP AUXMARK LUA_PATH_SEP);
648    luaL_gsub(L, path, AUXMARK, def);
649    lua_remove(L, -2);
650  }
651  setprogdir(L);
652  lua_setfield(L, -2, fieldname);
638                           const char *envname2, const char *def) {
639   const char *path = getenv(envname1);
640   if (path == NULL)  /* no environment variable? */
641   path = getenv(envname2);  /* try alternative name */
642   if (path == NULL || noenv(L))  /* no environment variable? */
643   lua_pushstring(L, def);  /* use default */
644   else {
645   /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */
646   path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP,
647                        LUA_PATH_SEP AUXMARK LUA_PATH_SEP);
648   luaL_gsub(L, path, AUXMARK, def);
649   lua_remove(L, -2);
650   }
651   setprogdir(L);
652   lua_setfield(L, -2, fieldname);
653653}
654654
655655
656656static const luaL_Reg pk_funcs[] = {
657  {"loadlib", ll_loadlib},
658  {"searchpath", ll_searchpath},
657   {"loadlib", ll_loadlib},
658   {"searchpath", ll_searchpath},
659659#if defined(LUA_COMPAT_MODULE)
660  {"seeall", ll_seeall},
660   {"seeall", ll_seeall},
661661#endif
662  {NULL, NULL}
662   {NULL, NULL}
663663};
664664
665665
666666static const luaL_Reg ll_funcs[] = {
667667#if defined(LUA_COMPAT_MODULE)
668  {"module", ll_module},
668   {"module", ll_module},
669669#endif
670  {"require", ll_require},
671  {NULL, NULL}
670   {"require", ll_require},
671   {NULL, NULL}
672672};
673673
674674
675675static void createsearcherstable (lua_State *L) {
676  static const lua_CFunction searchers[] =
677    {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL};
678  int i;
679  /* create 'searchers' table */
680  lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0);
681  /* fill it with pre-defined searchers */
682  for (i=0; searchers[i] != NULL; i++) {
683    lua_pushvalue(L, -2);  /* set 'package' as upvalue for all searchers */
684    lua_pushcclosure(L, searchers[i], 1);
685    lua_rawseti(L, -2, i+1);
686  }
676   static const lua_CFunction searchers[] =
677   {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL};
678   int i;
679   /* create 'searchers' table */
680   lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0);
681   /* fill it with pre-defined searchers */
682   for (i=0; searchers[i] != NULL; i++) {
683   lua_pushvalue(L, -2);  /* set 'package' as upvalue for all searchers */
684   lua_pushcclosure(L, searchers[i], 1);
685   lua_rawseti(L, -2, i+1);
686   }
687687}
688688
689689
690690LUAMOD_API int luaopen_package (lua_State *L) {
691  /* create table CLIBS to keep track of loaded C libraries */
692  luaL_getsubtable(L, LUA_REGISTRYINDEX, CLIBS);
693  lua_createtable(L, 0, 1);  /* metatable for CLIBS */
694  lua_pushcfunction(L, gctm);
695  lua_setfield(L, -2, "__gc");  /* set finalizer for CLIBS table */
696  lua_setmetatable(L, -2);
697  /* create `package' table */
698  luaL_newlib(L, pk_funcs);
699  createsearcherstable(L);
691   /* create table CLIBS to keep track of loaded C libraries */
692   luaL_getsubtable(L, LUA_REGISTRYINDEX, CLIBS);
693   lua_createtable(L, 0, 1);  /* metatable for CLIBS */
694   lua_pushcfunction(L, gctm);
695   lua_setfield(L, -2, "__gc");  /* set finalizer for CLIBS table */
696   lua_setmetatable(L, -2);
697   /* create `package' table */
698   luaL_newlib(L, pk_funcs);
699   createsearcherstable(L);
700700#if defined(LUA_COMPAT_LOADERS)
701  lua_pushvalue(L, -1);  /* make a copy of 'searchers' table */
702  lua_setfield(L, -3, "loaders");  /* put it in field `loaders' */
701   lua_pushvalue(L, -1);  /* make a copy of 'searchers' table */
702   lua_setfield(L, -3, "loaders");  /* put it in field `loaders' */
703703#endif
704  lua_setfield(L, -2, "searchers");  /* put it in field 'searchers' */
705  /* set field 'path' */
706  setpath(L, "path", LUA_PATHVERSION, LUA_PATH, LUA_PATH_DEFAULT);
707  /* set field 'cpath' */
708  setpath(L, "cpath", LUA_CPATHVERSION, LUA_CPATH, LUA_CPATH_DEFAULT);
709  /* store config information */
710  lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n"
711                     LUA_EXEC_DIR "\n" LUA_IGMARK "\n");
712  lua_setfield(L, -2, "config");
713  /* set field `loaded' */
714  luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
715  lua_setfield(L, -2, "loaded");
716  /* set field `preload' */
717  luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
718  lua_setfield(L, -2, "preload");
719  lua_pushglobaltable(L);
720  lua_pushvalue(L, -2);  /* set 'package' as upvalue for next lib */
721  luaL_setfuncs(L, ll_funcs, 1);  /* open lib into global table */
722  lua_pop(L, 1);  /* pop global table */
723  return 1;  /* return 'package' table */
704   lua_setfield(L, -2, "searchers");  /* put it in field 'searchers' */
705   /* set field 'path' */
706   setpath(L, "path", LUA_PATHVERSION, LUA_PATH, LUA_PATH_DEFAULT);
707   /* set field 'cpath' */
708   setpath(L, "cpath", LUA_CPATHVERSION, LUA_CPATH, LUA_CPATH_DEFAULT);
709   /* store config information */
710   lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n"
711                  LUA_EXEC_DIR "\n" LUA_IGMARK "\n");
712   lua_setfield(L, -2, "config");
713   /* set field `loaded' */
714   luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
715   lua_setfield(L, -2, "loaded");
716   /* set field `preload' */
717   luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
718   lua_setfield(L, -2, "preload");
719   lua_pushglobaltable(L);
720   lua_pushvalue(L, -2);  /* set 'package' as upvalue for next lib */
721   luaL_setfuncs(L, ll_funcs, 1);  /* open lib into global table */
722   lua_pop(L, 1);  /* pop global table */
723   return 1;  /* return 'package' table */
724724}
725
trunk/src/lib/lua/lfunc.c
r31373r31374
2121
2222
2323Closure *luaF_newCclosure (lua_State *L, int n) {
24  Closure *c = &luaC_newobj(L, LUA_TCCL, sizeCclosure(n), NULL, 0)->cl;
25  c->c.nupvalues = cast_byte(n);
26  return c;
24   Closure *c = &luaC_newobj(L, LUA_TCCL, sizeCclosure(n), NULL, 0)->cl;
25   c->c.nupvalues = cast_byte(n);
26   return c;
2727}
2828
2929
3030Closure *luaF_newLclosure (lua_State *L, int n) {
31  Closure *c = &luaC_newobj(L, LUA_TLCL, sizeLclosure(n), NULL, 0)->cl;
32  c->l.p = NULL;
33  c->l.nupvalues = cast_byte(n);
34  while (n--) c->l.upvals[n] = NULL;
35  return c;
31   Closure *c = &luaC_newobj(L, LUA_TLCL, sizeLclosure(n), NULL, 0)->cl;
32   c->l.p = NULL;
33   c->l.nupvalues = cast_byte(n);
34   while (n--) c->l.upvals[n] = NULL;
35   return c;
3636}
3737
3838
3939UpVal *luaF_newupval (lua_State *L) {
40  UpVal *uv = &luaC_newobj(L, LUA_TUPVAL, sizeof(UpVal), NULL, 0)->uv;
41  uv->v = &uv->u.value;
42  setnilvalue(uv->v);
43  return uv;
40   UpVal *uv = &luaC_newobj(L, LUA_TUPVAL, sizeof(UpVal), NULL, 0)->uv;
41   uv->v = &uv->u.value;
42   setnilvalue(uv->v);
43   return uv;
4444}
4545
4646
4747UpVal *luaF_findupval (lua_State *L, StkId level) {
48  global_State *g = G(L);
49  GCObject **pp = &L->openupval;
50  UpVal *p;
51  UpVal *uv;
52  while (*pp != NULL && (p = gco2uv(*pp))->v >= level) {
53    GCObject *o = obj2gco(p);
54    lua_assert(p->v != &p->u.value);
55    lua_assert(!isold(o) || isold(obj2gco(L)));
56    if (p->v == level) {  /* found a corresponding upvalue? */
57      if (isdead(g, o))  /* is it dead? */
58        changewhite(o);  /* resurrect it */
59      return p;
60    }
61    pp = &p->next;
62  }
63  /* not found: create a new one */
64  uv = &luaC_newobj(L, LUA_TUPVAL, sizeof(UpVal), pp, 0)->uv;
65  uv->v = level;  /* current value lives in the stack */
66  uv->u.l.prev = &g->uvhead;  /* double link it in `uvhead' list */
67  uv->u.l.next = g->uvhead.u.l.next;
68  uv->u.l.next->u.l.prev = uv;
69  g->uvhead.u.l.next = uv;
70  lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);
71  return uv;
48   global_State *g = G(L);
49   GCObject **pp = &L->openupval;
50   UpVal *p;
51   UpVal *uv;
52   while (*pp != NULL && (p = gco2uv(*pp))->v >= level) {
53   GCObject *o = obj2gco(p);
54   lua_assert(p->v != &p->u.value);
55   lua_assert(!isold(o) || isold(obj2gco(L)));
56   if (p->v == level) {  /* found a corresponding upvalue? */
57      if (isdead(g, o))  /* is it dead? */
58      changewhite(o);  /* resurrect it */
59      return p;
60   }
61   pp = &p->next;
62   }
63   /* not found: create a new one */
64   uv = &luaC_newobj(L, LUA_TUPVAL, sizeof(UpVal), pp, 0)->uv;
65   uv->v = level;  /* current value lives in the stack */
66   uv->u.l.prev = &g->uvhead;  /* double link it in `uvhead' list */
67   uv->u.l.next = g->uvhead.u.l.next;
68   uv->u.l.next->u.l.prev = uv;
69   g->uvhead.u.l.next = uv;
70   lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);
71   return uv;
7272}
7373
7474
7575static void unlinkupval (UpVal *uv) {
76  lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);
77  uv->u.l.next->u.l.prev = uv->u.l.prev;  /* remove from `uvhead' list */
78  uv->u.l.prev->u.l.next = uv->u.l.next;
76   lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv);
77   uv->u.l.next->u.l.prev = uv->u.l.prev;  /* remove from `uvhead' list */
78   uv->u.l.prev->u.l.next = uv->u.l.next;
7979}
8080
8181
8282void luaF_freeupval (lua_State *L, UpVal *uv) {
83  if (uv->v != &uv->u.value)  /* is it open? */
84    unlinkupval(uv);  /* remove from open list */
85  luaM_free(L, uv);  /* free upvalue */
83   if (uv->v != &uv->u.value)  /* is it open? */
84   unlinkupval(uv);  /* remove from open list */
85   luaM_free(L, uv);  /* free upvalue */
8686}
8787
8888
8989void luaF_close (lua_State *L, StkId level) {
90  UpVal *uv;
91  global_State *g = G(L);
92  while (L->openupval != NULL && (uv = gco2uv(L->openupval))->v >= level) {
93    GCObject *o = obj2gco(uv);
94    lua_assert(!isblack(o) && uv->v != &uv->u.value);
95    L->openupval = uv->next;  /* remove from `open' list */
96    if (isdead(g, o))
97      luaF_freeupval(L, uv);  /* free upvalue */
98    else {
99      unlinkupval(uv);  /* remove upvalue from 'uvhead' list */
100      setobj(L, &uv->u.value, uv->v);  /* move value to upvalue slot */
101      uv->v = &uv->u.value;  /* now current value lives here */
102      gch(o)->next = g->allgc;  /* link upvalue into 'allgc' list */
103      g->allgc = o;
104      luaC_checkupvalcolor(g, uv);
105    }
106  }
90   UpVal *uv;
91   global_State *g = G(L);
92   while (L->openupval != NULL && (uv = gco2uv(L->openupval))->v >= level) {
93   GCObject *o = obj2gco(uv);
94   lua_assert(!isblack(o) && uv->v != &uv->u.value);
95   L->openupval = uv->next;  /* remove from `open' list */
96   if (isdead(g, o))
97      luaF_freeupval(L, uv);  /* free upvalue */
98   else {
99      unlinkupval(uv);  /* remove upvalue from 'uvhead' list */
100      setobj(L, &uv->u.value, uv->v);  /* move value to upvalue slot */
101      uv->v = &uv->u.value;  /* now current value lives here */
102      gch(o)->next = g->allgc;  /* link upvalue into 'allgc' list */
103      g->allgc = o;
104      luaC_checkupvalcolor(g, uv);
105   }
106   }
107107}
108108
109109
110110Proto *luaF_newproto (lua_State *L) {
111  Proto *f = &luaC_newobj(L, LUA_TPROTO, sizeof(Proto), NULL, 0)->p;
112  f->k = NULL;
113  f->sizek = 0;
114  f->p = NULL;
115  f->sizep = 0;
116  f->code = NULL;
117  f->cache = NULL;
118  f->sizecode = 0;
119  f->lineinfo = NULL;
120  f->sizelineinfo = 0;
121  f->upvalues = NULL;
122  f->sizeupvalues = 0;
123  f->numparams = 0;
124  f->is_vararg = 0;
125  f->maxstacksize = 0;
126  f->locvars = NULL;
127  f->sizelocvars = 0;
128  f->linedefined = 0;
129  f->lastlinedefined = 0;
130  f->source = NULL;
131  return f;
111   Proto *f = &luaC_newobj(L, LUA_TPROTO, sizeof(Proto), NULL, 0)->p;
112   f->k = NULL;
113   f->sizek = 0;
114   f->p = NULL;
115   f->sizep = 0;
116   f->code = NULL;
117   f->cache = NULL;
118   f->sizecode = 0;
119   f->lineinfo = NULL;
120   f->sizelineinfo = 0;
121   f->upvalues = NULL;
122   f->sizeupvalues = 0;
123   f->numparams = 0;
124   f->is_vararg = 0;
125   f->maxstacksize = 0;
126   f->locvars = NULL;
127   f->sizelocvars = 0;
128   f->linedefined = 0;
129   f->lastlinedefined = 0;
130   f->source = NULL;
131   return f;
132132}
133133
134134
135135void luaF_freeproto (lua_State *L, Proto *f) {
136  luaM_freearray(L, f->code, f->sizecode);
137  luaM_freearray(L, f->p, f->sizep);
138  luaM_freearray(L, f->k, f->sizek);
139  luaM_freearray(L, f->lineinfo, f->sizelineinfo);
140  luaM_freearray(L, f->locvars, f->sizelocvars);
141  luaM_freearray(L, f->upvalues, f->sizeupvalues);
142  luaM_free(L, f);
136   luaM_freearray(L, f->code, f->sizecode);
137   luaM_freearray(L, f->p, f->sizep);
138   luaM_freearray(L, f->k, f->sizek);
139   luaM_freearray(L, f->lineinfo, f->sizelineinfo);
140   luaM_freearray(L, f->locvars, f->sizelocvars);
141   luaM_freearray(L, f->upvalues, f->sizeupvalues);
142   luaM_free(L, f);
143143}
144144
145145
r31373r31374
148148** Returns NULL if not found.
149149*/
150150const char *luaF_getlocalname (const Proto *f, int local_number, int pc) {
151  int i;
152  for (i = 0; i<f->sizelocvars && f->locvars[i].startpc <= pc; i++) {
153    if (pc < f->locvars[i].endpc) {  /* is variable active? */
154      local_number--;
155      if (local_number == 0)
156        return getstr(f->locvars[i].varname);
157    }
158  }
159  return NULL;  /* not found */
151   int i;
152   for (i = 0; i<f->sizelocvars && f->locvars[i].startpc <= pc; i++) {
153   if (pc < f->locvars[i].endpc) {  /* is variable active? */
154      local_number--;
155      if (local_number == 0)
156      return getstr(f->locvars[i].varname);
157   }
158   }
159   return NULL;  /* not found */
160160}
161
trunk/src/lib/lua/lparser.c
r31373r31374
2929
3030/* maximum number of local variables per function (must be smaller
3131   than 250, due to the bytecode format) */
32#define MAXVARS      200
32#define MAXVARS     200
3333
3434
35#define hasmultret(k)      ((k) == VCALL || (k) == VVARARG)
35#define hasmultret(k)       ((k) == VCALL || (k) == VVARARG)
3636
3737
3838
r31373r31374
4040** nodes for block list (list of active blocks)
4141*/
4242typedef struct BlockCnt {
43  struct BlockCnt *previous;  /* chain */
44  short firstlabel;  /* index of first label in this block */
45  short firstgoto;  /* index of first pending goto in this block */
46  lu_byte nactvar;  /* # active locals outside the block */
47  lu_byte upval;  /* true if some variable in the block is an upvalue */
48  lu_byte isloop;  /* true if `block' is a loop */
43   struct BlockCnt *previous;  /* chain */
44   short firstlabel;  /* index of first label in this block */
45   short firstgoto;  /* index of first pending goto in this block */
46   lu_byte nactvar;  /* # active locals outside the block */
47   lu_byte upval;  /* true if some variable in the block is an upvalue */
48   lu_byte isloop;  /* true if `block' is a loop */
4949} BlockCnt;
5050
5151
r31373r31374
5858
5959
6060static void anchor_token (LexState *ls) {
61  /* last token from outer function must be EOS */
62  lua_assert(ls->fs != NULL || ls->t.token == TK_EOS);
63  if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) {
64    TString *ts = ls->t.seminfo.ts;
65    luaX_newstring(ls, getstr(ts), ts->tsv.len);
66  }
61   /* last token from outer function must be EOS */
62   lua_assert(ls->fs != NULL || ls->t.token == TK_EOS);
63   if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) {
64   TString *ts = ls->t.seminfo.ts;
65   luaX_newstring(ls, getstr(ts), ts->tsv.len);
66   }
6767}
6868
6969
7070/* semantic error */
7171static l_noret semerror (LexState *ls, const char *msg) {
72  ls->t.token = 0;  /* remove 'near to' from final message */
73  luaX_syntaxerror(ls, msg);
72   ls->t.token = 0;  /* remove 'near to' from final message */
73   luaX_syntaxerror(ls, msg);
7474}
7575
7676
7777static l_noret error_expected (LexState *ls, int token) {
78  luaX_syntaxerror(ls,
79      luaO_pushfstring(ls->L, "%s expected", luaX_token2str(ls, token)));
78   luaX_syntaxerror(ls,
79      luaO_pushfstring(ls->L, "%s expected", luaX_token2str(ls, token)));
8080}
8181
8282
8383static l_noret errorlimit (FuncState *fs, int limit, const char *what) {
84  lua_State *L = fs->ls->L;
85  const char *msg;
86  int line = fs->f->linedefined;
87  const char *where = (line == 0)
88                      ? "main function"
89                      : luaO_pushfstring(L, "function at line %d", line);
90  msg = luaO_pushfstring(L, "too many %s (limit is %d) in %s",
91                             what, limit, where);
92  luaX_syntaxerror(fs->ls, msg);
84   lua_State *L = fs->ls->L;
85   const char *msg;
86   int line = fs->f->linedefined;
87   const char *where = (line == 0)
88                  ? "main function"
89                  : luaO_pushfstring(L, "function at line %d", line);
90   msg = luaO_pushfstring(L, "too many %s (limit is %d) in %s",
91                        what, limit, where);
92   luaX_syntaxerror(fs->ls, msg);
9393}
9494
9595
9696static void checklimit (FuncState *fs, int v, int l, const char *what) {
97  if (v > l) errorlimit(fs, l, what);
97   if (v > l) errorlimit(fs, l, what);
9898}
9999
100100
101101static int testnext (LexState *ls, int c) {
102  if (ls->t.token == c) {
103    luaX_next(ls);
104    return 1;
105  }
106  else return 0;
102   if (ls->t.token == c) {
103   luaX_next(ls);
104   return 1;
105   }
106   else return 0;
107107}
108108
109109
110110static void check (LexState *ls, int c) {
111  if (ls->t.token != c)
112    error_expected(ls, c);
111   if (ls->t.token != c)
112   error_expected(ls, c);
113113}
114114
115115
116116static void checknext (LexState *ls, int c) {
117  check(ls, c);
118  luaX_next(ls);
117   check(ls, c);
118   luaX_next(ls);
119119}
120120
121121
122#define check_condition(ls,c,msg)   { if (!(c)) luaX_syntaxerror(ls, msg); }
122#define check_condition(ls,c,msg)   { if (!(c)) luaX_syntaxerror(ls, msg); }
123123
124124
125125
126126static void check_match (LexState *ls, int what, int who, int where) {
127  if (!testnext(ls, what)) {
128    if (where == ls->linenumber)
129      error_expected(ls, what);
130    else {
131      luaX_syntaxerror(ls, luaO_pushfstring(ls->L,
132             "%s expected (to close %s at line %d)",
133              luaX_token2str(ls, what), luaX_token2str(ls, who), where));
134    }
135  }
127   if (!testnext(ls, what)) {
128   if (where == ls->linenumber)
129      error_expected(ls, what);
130   else {
131      luaX_syntaxerror(ls, luaO_pushfstring(ls->L,
132            "%s expected (to close %s at line %d)",
133            luaX_token2str(ls, what), luaX_token2str(ls, who), where));
134   }
135   }
136136}
137137
138138
139139static TString *str_checkname (LexState *ls) {
140  TString *ts;
141  check(ls, TK_NAME);
142  ts = ls->t.seminfo.ts;
143  luaX_next(ls);
144  return ts;
140   TString *ts;
141   check(ls, TK_NAME);
142   ts = ls->t.seminfo.ts;
143   luaX_next(ls);
144   return ts;
145145}
146146
147147
148148static void init_exp (expdesc *e, expkind k, int i) {
149  e->f = e->t = NO_JUMP;
150  e->k = k;
151  e->u.info = i;
149   e->f = e->t = NO_JUMP;
150   e->k = k;
151   e->u.info = i;
152152}
153153
154154
155155static void codestring (LexState *ls, expdesc *e, TString *s) {
156  init_exp(e, VK, luaK_stringK(ls->fs, s));
156   init_exp(e, VK, luaK_stringK(ls->fs, s));
157157}
158158
159159
160160static void checkname (LexState *ls, expdesc *e) {
161  codestring(ls, e, str_checkname(ls));
161   codestring(ls, e, str_checkname(ls));
162162}
163163
164164
165165static int registerlocalvar (LexState *ls, TString *varname) {
166  FuncState *fs = ls->fs;
167  Proto *f = fs->f;
168  int oldsize = f->sizelocvars;
169  luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars,
170                  LocVar, SHRT_MAX, "local variables");
171  while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL;
172  f->locvars[fs->nlocvars].varname = varname;
173  luaC_objbarrier(ls->L, f, varname);
174  return fs->nlocvars++;
166   FuncState *fs = ls->fs;
167   Proto *f = fs->f;
168   int oldsize = f->sizelocvars;
169   luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars,
170               LocVar, SHRT_MAX, "local variables");
171   while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL;
172   f->locvars[fs->nlocvars].varname = varname;
173   luaC_objbarrier(ls->L, f, varname);
174   return fs->nlocvars++;
175175}
176176
177177
178178static void new_localvar (LexState *ls, TString *name) {
179  FuncState *fs = ls->fs;
180  Dyndata *dyd = ls->dyd;
181  int reg = registerlocalvar(ls, name);
182  checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal,
183                  MAXVARS, "local variables");
184  luaM_growvector(ls->L, dyd->actvar.arr, dyd->actvar.n + 1,
185                  dyd->actvar.size, Vardesc, MAX_INT, "local variables");
186  dyd->actvar.arr[dyd->actvar.n++].idx = cast(short, reg);
179   FuncState *fs = ls->fs;
180   Dyndata *dyd = ls->dyd;
181   int reg = registerlocalvar(ls, name);
182   checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal,
183               MAXVARS, "local variables");
184   luaM_growvector(ls->L, dyd->actvar.arr, dyd->actvar.n + 1,
185               dyd->actvar.size, Vardesc, MAX_INT, "local variables");
186   dyd->actvar.arr[dyd->actvar.n++].idx = cast(short, reg);
187187}
188188
189189
190190static void new_localvarliteral_ (LexState *ls, const char *name, size_t sz) {
191  new_localvar(ls, luaX_newstring(ls, name, sz));
191   new_localvar(ls, luaX_newstring(ls, name, sz));
192192}
193193
194194#define new_localvarliteral(ls,v) \
r31373r31374
196196
197197
198198static LocVar *getlocvar (FuncState *fs, int i) {
199  int idx = fs->ls->dyd->actvar.arr[fs->firstlocal + i].idx;
200  lua_assert(idx < fs->nlocvars);
201  return &fs->f->locvars[idx];
199   int idx = fs->ls->dyd->actvar.arr[fs->firstlocal + i].idx;
200   lua_assert(idx < fs->nlocvars);
201   return &fs->f->locvars[idx];
202202}
203203
204204
205205static void adjustlocalvars (LexState *ls, int nvars) {
206  FuncState *fs = ls->fs;
207  fs->nactvar = cast_byte(fs->nactvar + nvars);
208  for (; nvars; nvars--) {
209    getlocvar(fs, fs->nactvar - nvars)->startpc = fs->pc;
210  }
206   FuncState *fs = ls->fs;
207   fs->nactvar = cast_byte(fs->nactvar + nvars);
208   for (; nvars; nvars--) {
209   getlocvar(fs, fs->nactvar - nvars)->startpc = fs->pc;
210   }
211211}
212212
213213
214214static void removevars (FuncState *fs, int tolevel) {
215  fs->ls->dyd->actvar.n -= (fs->nactvar - tolevel);
216  while (fs->nactvar > tolevel)
217    getlocvar(fs, --fs->nactvar)->endpc = fs->pc;
215   fs->ls->dyd->actvar.n -= (fs->nactvar - tolevel);
216   while (fs->nactvar > tolevel)
217   getlocvar(fs, --fs->nactvar)->endpc = fs->pc;
218218}
219219
220220
221221static int searchupvalue (FuncState *fs, TString *name) {
222  int i;
223  Upvaldesc *up = fs->f->upvalues;
224  for (i = 0; i < fs->nups; i++) {
225    if (luaS_eqstr(up[i].name, name)) return i;
226  }
227  return -1;  /* not found */
222   int i;
223   Upvaldesc *up = fs->f->upvalues;
224   for (i = 0; i < fs->nups; i++) {
225   if (luaS_eqstr(up[i].name, name)) return i;
226   }
227   return -1;  /* not found */
228228}
229229
230230
231231static int newupvalue (FuncState *fs, TString *name, expdesc *v) {
232  Proto *f = fs->f;
233  int oldsize = f->sizeupvalues;
234  checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues");
235  luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues,
236                  Upvaldesc, MAXUPVAL, "upvalues");
237  while (oldsize < f->sizeupvalues) f->upvalues[oldsize++].name = NULL;
238  f->upvalues[fs->nups].instack = (v->k == VLOCAL);
239  f->upvalues[fs->nups].idx = cast_byte(v->u.info);
240  f->upvalues[fs->nups].name = name;
241  luaC_objbarrier(fs->ls->L, f, name);
242  return fs->nups++;
232   Proto *f = fs->f;
233   int oldsize = f->sizeupvalues;
234   checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues");
235   luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues,
236               Upvaldesc, MAXUPVAL, "upvalues");
237   while (oldsize < f->sizeupvalues) f->upvalues[oldsize++].name = NULL;
238   f->upvalues[fs->nups].instack = (v->k == VLOCAL);
239   f->upvalues[fs->nups].idx = cast_byte(v->u.info);
240   f->upvalues[fs->nups].name = name;
241   luaC_objbarrier(fs->ls->L, f, name);
242   return fs->nups++;
243243}
244244
245245
246246static int searchvar (FuncState *fs, TString *n) {
247  int i;
248  for (i = cast_int(fs->nactvar) - 1; i >= 0; i--) {
249    if (luaS_eqstr(n, getlocvar(fs, i)->varname))
250      return i;
251  }
252  return -1;  /* not found */
247   int i;
248   for (i = cast_int(fs->nactvar) - 1; i >= 0; i--) {
249   if (luaS_eqstr(n, getlocvar(fs, i)->varname))
250      return i;
251   }
252   return -1;  /* not found */
253253}
254254
255255
r31373r31374
258258  (to emit close instructions later).
259259*/
260260static void markupval (FuncState *fs, int level) {
261  BlockCnt *bl = fs->bl;
262  while (bl->nactvar > level) bl = bl->previous;
263  bl->upval = 1;
261   BlockCnt *bl = fs->bl;
262   while (bl->nactvar > level) bl = bl->previous;
263   bl->upval = 1;
264264}
265265
266266
r31373r31374
269269  upvalue into all intermediate functions.
270270*/
271271static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) {
272  if (fs == NULL)  /* no more levels? */
273    return VVOID;  /* default is global */
274  else {
275    int v = searchvar(fs, n);  /* look up locals at current level */
276    if (v >= 0) {  /* found? */
277      init_exp(var, VLOCAL, v);  /* variable is local */
278      if (!base)
279        markupval(fs, v);  /* local will be used as an upval */
280      return VLOCAL;
281    }
282    else {  /* not found as local at current level; try upvalues */
283      int idx = searchupvalue(fs, n);  /* try existing upvalues */
284      if (idx < 0) {  /* not found? */
285        if (singlevaraux(fs->prev, n, var, 0) == VVOID) /* try upper levels */
286          return VVOID;  /* not found; is a global */
287        /* else was LOCAL or UPVAL */
288        idx  = newupvalue(fs, n, var);  /* will be a new upvalue */
289      }
290      init_exp(var, VUPVAL, idx);
291      return VUPVAL;
292    }
293  }
272   if (fs == NULL)  /* no more levels? */
273   return VVOID;  /* default is global */
274   else {
275   int v = searchvar(fs, n);  /* look up locals at current level */
276   if (v >= 0) {  /* found? */
277      init_exp(var, VLOCAL, v);  /* variable is local */
278      if (!base)
279      markupval(fs, v);  /* local will be used as an upval */
280      return VLOCAL;
281   }
282   else {  /* not found as local at current level; try upvalues */
283      int idx = searchupvalue(fs, n);  /* try existing upvalues */
284      if (idx < 0) {  /* not found? */
285      if (singlevaraux(fs->prev, n, var, 0) == VVOID) /* try upper levels */
286         return VVOID;  /* not found; is a global */
287      /* else was LOCAL or UPVAL */
288      idx  = newupvalue(fs, n, var);  /* will be a new upvalue */
289      }
290      init_exp(var, VUPVAL, idx);
291      return VUPVAL;
292   }
293   }
294294}
295295
296296
297297static void singlevar (LexState *ls, expdesc *var) {
298  TString *varname = str_checkname(ls);
299  FuncState *fs = ls->fs;
300  if (singlevaraux(fs, varname, var, 1) == VVOID) {  /* global name? */
301    expdesc key;
302    singlevaraux(fs, ls->envn, var, 1);  /* get environment variable */
303    lua_assert(var->k == VLOCAL || var->k == VUPVAL);
304    codestring(ls, &key, varname);  /* key is variable name */
305    luaK_indexed(fs, var, &key);  /* env[varname] */
306  }
298   TString *varname = str_checkname(ls);
299   FuncState *fs = ls->fs;
300   if (singlevaraux(fs, varname, var, 1) == VVOID) {  /* global name? */
301   expdesc key;
302   singlevaraux(fs, ls->envn, var, 1);  /* get environment variable */
303   lua_assert(var->k == VLOCAL || var->k == VUPVAL);
304   codestring(ls, &key, varname);  /* key is variable name */
305   luaK_indexed(fs, var, &key);  /* env[varname] */
306   }
307307}
308308
309309
310310static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) {
311  FuncState *fs = ls->fs;
312  int extra = nvars - nexps;
313  if (hasmultret(e->k)) {
314    extra++;  /* includes call itself */
315    if (extra < 0) extra = 0;
316    luaK_setreturns(fs, e, extra);  /* last exp. provides the difference */
317    if (extra > 1) luaK_reserveregs(fs, extra-1);
318  }
319  else {
320    if (e->k != VVOID) luaK_exp2nextreg(fs, e);  /* close last expression */
321    if (extra > 0) {
322      int reg = fs->freereg;
323      luaK_reserveregs(fs, extra);
324      luaK_nil(fs, reg, extra);
325    }
326  }
311   FuncState *fs = ls->fs;
312   int extra = nvars - nexps;
313   if (hasmultret(e->k)) {
314   extra++;  /* includes call itself */
315   if (extra < 0) extra = 0;
316   luaK_setreturns(fs, e, extra);  /* last exp. provides the difference */
317   if (extra > 1) luaK_reserveregs(fs, extra-1);
318   }
319   else {
320   if (e->k != VVOID) luaK_exp2nextreg(fs, e);  /* close last expression */
321   if (extra > 0) {
322      int reg = fs->freereg;
323      luaK_reserveregs(fs, extra);
324      luaK_nil(fs, reg, extra);
325   }
326   }
327327}
328328
329329
330330static void enterlevel (LexState *ls) {
331  lua_State *L = ls->L;
332  ++L->nCcalls;
333  checklimit(ls->fs, L->nCcalls, LUAI_MAXCCALLS, "C levels");
331   lua_State *L = ls->L;
332   ++L->nCcalls;
333   checklimit(ls->fs, L->nCcalls, LUAI_MAXCCALLS, "C levels");
334334}
335335
336336
337#define leavelevel(ls)   ((ls)->L->nCcalls--)
337#define leavelevel(ls)  ((ls)->L->nCcalls--)
338338
339339
340340static void closegoto (LexState *ls, int g, Labeldesc *label) {
341  int i;
342  FuncState *fs = ls->fs;
343  Labellist *gl = &ls->dyd->gt;
344  Labeldesc *gt = &gl->arr[g];
345  lua_assert(luaS_eqstr(gt->name, label->name));
346  if (gt->nactvar < label->nactvar) {
347    TString *vname = getlocvar(fs, gt->nactvar)->varname;
348    const char *msg = luaO_pushfstring(ls->L,
349      "<goto %s> at line %d jumps into the scope of local " LUA_QS,
350      getstr(gt->name), gt->line, getstr(vname));
351    semerror(ls, msg);
352  }
353  luaK_patchlist(fs, gt->pc, label->pc);
354  /* remove goto from pending list */
355  for (i = g; i < gl->n - 1; i++)
356    gl->arr[i] = gl->arr[i + 1];
357  gl->n--;
341   int i;
342   FuncState *fs = ls->fs;
343   Labellist *gl = &ls->dyd->gt;
344   Labeldesc *gt = &gl->arr[g];
345   lua_assert(luaS_eqstr(gt->name, label->name));
346   if (gt->nactvar < label->nactvar) {
347   TString *vname = getlocvar(fs, gt->nactvar)->varname;
348   const char *msg = luaO_pushfstring(ls->L,
349      "<goto %s> at line %d jumps into the scope of local " LUA_QS,
350      getstr(gt->name), gt->line, getstr(vname));
351   semerror(ls, msg);
352   }
353   luaK_patchlist(fs, gt->pc, label->pc);
354   /* remove goto from pending list */
355   for (i = g; i < gl->n - 1; i++)
356   gl->arr[i] = gl->arr[i + 1];
357   gl->n--;
358358}
359359
360360
r31373r31374
362362** try to close a goto with existing labels; this solves backward jumps
363363*/
364364static int findlabel (LexState *ls, int g) {
365  int i;
366  BlockCnt *bl = ls->fs->bl;
367  Dyndata *dyd = ls->dyd;
368  Labeldesc *gt = &dyd->gt.arr[g];
369  /* check labels in current block for a match */
370  for (i = bl->firstlabel; i < dyd->label.n; i++) {
371    Labeldesc *lb = &dyd->label.arr[i];
372    if (luaS_eqstr(lb->name, gt->name)) {  /* correct label? */
373      if (gt->nactvar > lb->nactvar &&
374          (bl->upval || dyd->label.n > bl->firstlabel))
375        luaK_patchclose(ls->fs, gt->pc, lb->nactvar);
376      closegoto(ls, g, lb);  /* close it */
377      return 1;
378    }
379  }
380  return 0;  /* label not found; cannot close goto */
365   int i;
366   BlockCnt *bl = ls->fs->bl;
367   Dyndata *dyd = ls->dyd;
368   Labeldesc *gt = &dyd->gt.arr[g];
369   /* check labels in current block for a match */
370   for (i = bl->firstlabel; i < dyd->label.n; i++) {
371   Labeldesc *lb = &dyd->label.arr[i];
372   if (luaS_eqstr(lb->name, gt->name)) {  /* correct label? */
373      if (gt->nactvar > lb->nactvar &&
374         (bl->upval || dyd->label.n > bl->firstlabel))
375      luaK_patchclose(ls->fs, gt->pc, lb->nactvar);
376      closegoto(ls, g, lb);  /* close it */
377      return 1;
378   }
379   }
380   return 0;  /* label not found; cannot close goto */
381381}
382382
383383
384384static int newlabelentry (LexState *ls, Labellist *l, TString *name,
385                          int line, int pc) {
386  int n = l->n;
387  luaM_growvector(ls->L, l->arr, n, l->size,
388                  Labeldesc, SHRT_MAX, "labels/gotos");
389  l->arr[n].name = name;
390  l->arr[n].line = line;
391  l->arr[n].nactvar = ls->fs->nactvar;
392  l->arr[n].pc = pc;
393  l->n++;
394  return n;
385                     int line, int pc) {
386   int n = l->n;
387   luaM_growvector(ls->L, l->arr, n, l->size,
388               Labeldesc, SHRT_MAX, "labels/gotos");
389   l->arr[n].name = name;
390   l->arr[n].line = line;
391   l->arr[n].nactvar = ls->fs->nactvar;
392   l->arr[n].pc = pc;
393   l->n++;
394   return n;
395395}
396396
397397
r31373r31374
400400** block; solves forward jumps
401401*/
402402static void findgotos (LexState *ls, Labeldesc *lb) {
403  Labellist *gl = &ls->dyd->gt;
404  int i = ls->fs->bl->firstgoto;
405  while (i < gl->n) {
406    if (luaS_eqstr(gl->arr[i].name, lb->name))
407      closegoto(ls, i, lb);
408    else
409      i++;
410  }
403   Labellist *gl = &ls->dyd->gt;
404   int i = ls->fs->bl->firstgoto;
405   while (i < gl->n) {
406   if (luaS_eqstr(gl->arr[i].name, lb->name))
407      closegoto(ls, i, lb);
408   else
409      i++;
410   }
411411}
412412
413413
r31373r31374
418418** upvalue), close those variables being exited.
419419*/
420420static void movegotosout (FuncState *fs, BlockCnt *bl) {
421  int i = bl->firstgoto;
422  Labellist *gl = &fs->ls->dyd->gt;
423  /* correct pending gotos to current block and try to close it
424     with visible labels */
425  while (i < gl->n) {
426    Labeldesc *gt = &gl->arr[i];
427    if (gt->nactvar > bl->nactvar) {
428      if (bl->upval)
429        luaK_patchclose(fs, gt->pc, bl->nactvar);
430      gt->nactvar = bl->nactvar;
431    }
432    if (!findlabel(fs->ls, i))
433      i++;  /* move to next one */
434  }
421   int i = bl->firstgoto;
422   Labellist *gl = &fs->ls->dyd->gt;
423   /* correct pending gotos to current block and try to close it
424    with visible labels */
425   while (i < gl->n) {
426   Labeldesc *gt = &gl->arr[i];
427   if (gt->nactvar > bl->nactvar) {
428      if (bl->upval)
429      luaK_patchclose(fs, gt->pc, bl->nactvar);
430      gt->nactvar = bl->nactvar;
431   }
432   if (!findlabel(fs->ls, i))
433      i++;  /* move to next one */
434   }
435435}
436436
437437
438438static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop) {
439  bl->isloop = isloop;
440  bl->nactvar = fs->nactvar;
441  bl->firstlabel = fs->ls->dyd->label.n;
442  bl->firstgoto = fs->ls->dyd->gt.n;
443  bl->upval = 0;
444  bl->previous = fs->bl;
445  fs->bl = bl;
446  lua_assert(fs->freereg == fs->nactvar);
439   bl->isloop = isloop;
440   bl->nactvar = fs->nactvar;
441   bl->firstlabel = fs->ls->dyd->label.n;
442   bl->firstgoto = fs->ls->dyd->gt.n;
443   bl->upval = 0;
444   bl->previous = fs->bl;
445   fs->bl = bl;
446   lua_assert(fs->freereg == fs->nactvar);
447447}
448448
449449
r31373r31374
451451** create a label named "break" to resolve break statements
452452*/
453453static void breaklabel (LexState *ls) {
454  TString *n = luaS_new(ls->L, "break");
455  int l = newlabelentry(ls, &ls->dyd->label, n, 0, ls->fs->pc);
456  findgotos(ls, &ls->dyd->label.arr[l]);
454   TString *n = luaS_new(ls->L, "break");
455   int l = newlabelentry(ls, &ls->dyd->label, n, 0, ls->fs->pc);
456   findgotos(ls, &ls->dyd->label.arr[l]);
457457}
458458
459459/*
r31373r31374
461461** message when label name is a reserved word (which can only be 'break')
462462*/
463463static l_noret undefgoto (LexState *ls, Labeldesc *gt) {
464  const char *msg = isreserved(gt->name)
465                    ? "<%s> at line %d not inside a loop"
466                    : "no visible label " LUA_QS " for <goto> at line %d";
467  msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line);
468  semerror(ls, msg);
464   const char *msg = isreserved(gt->name)
465               ? "<%s> at line %d not inside a loop"
466               : "no visible label " LUA_QS " for <goto> at line %d";
467   msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line);
468   semerror(ls, msg);
469469}
470470
471471
472472static void leaveblock (FuncState *fs) {
473  BlockCnt *bl = fs->bl;
474  LexState *ls = fs->ls;
475  if (bl->previous && bl->upval) {
476    /* create a 'jump to here' to close upvalues */
477    int j = luaK_jump(fs);
478    luaK_patchclose(fs, j, bl->nactvar);
479    luaK_patchtohere(fs, j);
480  }
481  if (bl->isloop)
482    breaklabel(ls);  /* close pending breaks */
483  fs->bl = bl->previous;
484  removevars(fs, bl->nactvar);
485  lua_assert(bl->nactvar == fs->nactvar);
486  fs->freereg = fs->nactvar;  /* free registers */
487  ls->dyd->label.n = bl->firstlabel;  /* remove local labels */
488  if (bl->previous)  /* inner block? */
489    movegotosout(fs, bl);  /* update pending gotos to outer block */
490  else if (bl->firstgoto < ls->dyd->gt.n)  /* pending gotos in outer block? */
491    undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]);  /* error */
473   BlockCnt *bl = fs->bl;
474   LexState *ls = fs->ls;
475   if (bl->previous && bl->upval) {
476   /* create a 'jump to here' to close upvalues */
477   int j = luaK_jump(fs);
478   luaK_patchclose(fs, j, bl->nactvar);
479   luaK_patchtohere(fs, j);
480   }
481   if (bl->isloop)
482   breaklabel(ls);  /* close pending breaks */
483   fs->bl = bl->previous;
484   removevars(fs, bl->nactvar);
485   lua_assert(bl->nactvar == fs->nactvar);
486   fs->freereg = fs->nactvar;  /* free registers */
487   ls->dyd->label.n = bl->firstlabel;  /* remove local labels */
488   if (bl->previous)  /* inner block? */
489   movegotosout(fs, bl);  /* update pending gotos to outer block */
490   else if (bl->firstgoto < ls->dyd->gt.n)  /* pending gotos in outer block? */
491   undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]);  /* error */
492492}
493493
494494
r31373r31374
496496** adds a new prototype into list of prototypes
497497*/
498498static Proto *addprototype (LexState *ls) {
499  Proto *clp;
500  lua_State *L = ls->L;
501  FuncState *fs = ls->fs;
502  Proto *f = fs->f;  /* prototype of current function */
503  if (fs->np >= f->sizep) {
504    int oldsize = f->sizep;
505    luaM_growvector(L, f->p, fs->np, f->sizep, Proto *, MAXARG_Bx, "functions");
506    while (oldsize < f->sizep) f->p[oldsize++] = NULL;
507  }
508  f->p[fs->np++] = clp = luaF_newproto(L);
509  luaC_objbarrier(L, f, clp);
510  return clp;
499   Proto *clp;
500   lua_State *L = ls->L;
501   FuncState *fs = ls->fs;
502   Proto *f = fs->f;  /* prototype of current function */
503   if (fs->np >= f->sizep) {
504   int oldsize = f->sizep;
505   luaM_growvector(L, f->p, fs->np, f->sizep, Proto *, MAXARG_Bx, "functions");
506   while (oldsize < f->sizep) f->p[oldsize++] = NULL;
507   }
508   f->p[fs->np++] = clp = luaF_newproto(L);
509   luaC_objbarrier(L, f, clp);
510   return clp;
511511}
512512
513513
r31373r31374
518518** are in use at that time.
519519*/
520520static void codeclosure (LexState *ls, expdesc *v) {
521  FuncState *fs = ls->fs->prev;
522  init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np - 1));
523  luaK_exp2nextreg(fs, v);  /* fix it at the last register */
521   FuncState *fs = ls->fs->prev;
522   init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np - 1));
523   luaK_exp2nextreg(fs, v);  /* fix it at the last register */
524524}
525525
526526
527527static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) {
528  lua_State *L = ls->L;
529  Proto *f;
530  fs->prev = ls->fs;  /* linked list of funcstates */
531  fs->ls = ls;
532  ls->fs = fs;
533  fs->pc = 0;
534  fs->lasttarget = 0;
535  fs->jpc = NO_JUMP;
536  fs->freereg = 0;
537  fs->nk = 0;
538  fs->np = 0;
539  fs->nups = 0;
540  fs->nlocvars = 0;
541  fs->nactvar = 0;
542  fs->firstlocal = ls->dyd->actvar.n;
543  fs->bl = NULL;
544  f = fs->f;
545  f->source = ls->source;
546  f->maxstacksize = 2;  /* registers 0/1 are always valid */
547  fs->h = luaH_new(L);
548  /* anchor table of constants (to avoid being collected) */
549  sethvalue2s(L, L->top, fs->h);
550  incr_top(L);
551  enterblock(fs, bl, 0);
528   lua_State *L = ls->L;
529   Proto *f;
530   fs->prev = ls->fs;  /* linked list of funcstates */
531   fs->ls = ls;
532   ls->fs = fs;
533   fs->pc = 0;
534   fs->lasttarget = 0;
535   fs->jpc = NO_JUMP;
536   fs->freereg = 0;
537   fs->nk = 0;
538   fs->np = 0;
539   fs->nups = 0;
540   fs->nlocvars = 0;
541   fs->nactvar = 0;
542   fs->firstlocal = ls->dyd->actvar.n;
543   fs->bl = NULL;
544   f = fs->f;
545   f->source = ls->source;
546   f->maxstacksize = 2;  /* registers 0/1 are always valid */
547   fs->h = luaH_new(L);
548   /* anchor table of constants (to avoid being collected) */
549   sethvalue2s(L, L->top, fs->h);
550   incr_top(L);
551   enterblock(fs, bl, 0);
552552}
553553
554554
555555static void close_func (LexState *ls) {
556  lua_State *L = ls->L;
557  FuncState *fs = ls->fs;
558  Proto *f = fs->f;
559  luaK_ret(fs, 0, 0);  /* final return */
560  leaveblock(fs);
561  luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction);
562  f->sizecode = fs->pc;
563  luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int);
564  f->sizelineinfo = fs->pc;
565  luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue);
566  f->sizek = fs->nk;
567  luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *);
568  f->sizep = fs->np;
569  luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar);
570  f->sizelocvars = fs->nlocvars;
571  luaM_reallocvector(L, f->upvalues, f->sizeupvalues, fs->nups, Upvaldesc);
572  f->sizeupvalues = fs->nups;
573  lua_assert(fs->bl == NULL);
574  ls->fs = fs->prev;
575  /* last token read was anchored in defunct function; must re-anchor it */
576  anchor_token(ls);
577  L->top--;  /* pop table of constants */
578  luaC_checkGC(L);
556   lua_State *L = ls->L;
557   FuncState *fs = ls->fs;
558   Proto *f = fs->f;
559   luaK_ret(fs, 0, 0);  /* final return */
560   leaveblock(fs);
561   luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction);
562   f->sizecode = fs->pc;
563   luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int);
564   f->sizelineinfo = fs->pc;
565   luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue);
566   f->sizek = fs->nk;
567   luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *);
568   f->sizep = fs->np;
569   luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar);
570   f->sizelocvars = fs->nlocvars;
571   luaM_reallocvector(L, f->upvalues, f->sizeupvalues, fs->nups, Upvaldesc);
572   f->sizeupvalues = fs->nups;
573   lua_assert(fs->bl == NULL);
574   ls->fs = fs->prev;
575   /* last token read was anchored in defunct function; must re-anchor it */
576   anchor_token(ls);
577   L->top--;  /* pop table of constants */
578   luaC_checkGC(L);
579579}
580580
581581
r31373r31374
591591** so it handled in separate.
592592*/
593593static int block_follow (LexState *ls, int withuntil) {
594  switch (ls->t.token) {
595    case TK_ELSE: case TK_ELSEIF:
596    case TK_END: case TK_EOS:
597      return 1;
598    case TK_UNTIL: return withuntil;
599    default: return 0;
600  }
594   switch (ls->t.token) {
595   case TK_ELSE: case TK_ELSEIF:
596   case TK_END: case TK_EOS:
597      return 1;
598   case TK_UNTIL: return withuntil;
599   default: return 0;
600   }
601601}
602602
603603
604604static void statlist (LexState *ls) {
605  /* statlist -> { stat [`;'] } */
606  while (!block_follow(ls, 1)) {
607    if (ls->t.token == TK_RETURN) {
608      statement(ls);
609      return;  /* 'return' must be last statement */
610    }
611    statement(ls);
612  }
605   /* statlist -> { stat [`;'] } */
606   while (!block_follow(ls, 1)) {
607   if (ls->t.token == TK_RETURN) {
608      statement(ls);
609      return;  /* 'return' must be last statement */
610   }
611   statement(ls);
612   }
613613}
614614
615615
616616static void fieldsel (LexState *ls, expdesc *v) {
617  /* fieldsel -> ['.' | ':'] NAME */
618  FuncState *fs = ls->fs;
619  expdesc key;
620  luaK_exp2anyregup(fs, v);
621  luaX_next(ls);  /* skip the dot or colon */
622  checkname(ls, &key);
623  luaK_indexed(fs, v, &key);
617   /* fieldsel -> ['.' | ':'] NAME */
618   FuncState *fs = ls->fs;
619   expdesc key;
620   luaK_exp2anyregup(fs, v);
621   luaX_next(ls);  /* skip the dot or colon */
622   checkname(ls, &key);
623   luaK_indexed(fs, v, &key);
624624}
625625
626626
627627static void yindex (LexState *ls, expdesc *v) {
628  /* index -> '[' expr ']' */
629  luaX_next(ls);  /* skip the '[' */
630  expr(ls, v);
631  luaK_exp2val(ls->fs, v);
632  checknext(ls, ']');
628   /* index -> '[' expr ']' */
629   luaX_next(ls);  /* skip the '[' */
630   expr(ls, v);
631   luaK_exp2val(ls->fs, v);
632   checknext(ls, ']');
633633}
634634
635635
r31373r31374
641641
642642
643643struct ConsControl {
644  expdesc v;  /* last list item read */
645  expdesc *t;  /* table descriptor */
646  int nh;  /* total number of `record' elements */
647  int na;  /* total number of array elements */
648  int tostore;  /* number of array elements pending to be stored */
644   expdesc v;  /* last list item read */
645   expdesc *t;  /* table descriptor */
646   int nh;  /* total number of `record' elements */
647   int na;  /* total number of array elements */
648   int tostore;  /* number of array elements pending to be stored */
649649};
650650
651651
652652static void recfield (LexState *ls, struct ConsControl *cc) {
653  /* recfield -> (NAME | `['exp1`]') = exp1 */
654  FuncState *fs = ls->fs;
655  int reg = ls->fs->freereg;
656  expdesc key, val;
657  int rkkey;
658  if (ls->t.token == TK_NAME) {
659    checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
660    checkname(ls, &key);
661  }
662  else  /* ls->t.token == '[' */
663    yindex(ls, &key);
664  cc->nh++;
665  checknext(ls, '=');
666  rkkey = luaK_exp2RK(fs, &key);
667  expr(ls, &val);
668  luaK_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, luaK_exp2RK(fs, &val));
669  fs->freereg = reg;  /* free registers */
653   /* recfield -> (NAME | `['exp1`]') = exp1 */
654   FuncState *fs = ls->fs;
655   int reg = ls->fs->freereg;
656   expdesc key, val;
657   int rkkey;
658   if (ls->t.token == TK_NAME) {
659   checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
660   checkname(ls, &key);
661   }
662   else  /* ls->t.token == '[' */
663   yindex(ls, &key);
664   cc->nh++;
665   checknext(ls, '=');
666   rkkey = luaK_exp2RK(fs, &key);
667   expr(ls, &val);
668   luaK_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, luaK_exp2RK(fs, &val));
669   fs->freereg = reg;  /* free registers */
670670}
671671
672672
673673static void closelistfield (FuncState *fs, struct ConsControl *cc) {
674  if (cc->v.k == VVOID) return;  /* there is no list item */
675  luaK_exp2nextreg(fs, &cc->v);
676  cc->v.k = VVOID;
677  if (cc->tostore == LFIELDS_PER_FLUSH) {
678    luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore);  /* flush */
679    cc->tostore = 0;  /* no more items pending */
680  }
674   if (cc->v.k == VVOID) return;  /* there is no list item */
675   luaK_exp2nextreg(fs, &cc->v);
676   cc->v.k = VVOID;
677   if (cc->tostore == LFIELDS_PER_FLUSH) {
678   luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore);  /* flush */
679   cc->tostore = 0;  /* no more items pending */
680   }
681681}
682682
683683
684684static void lastlistfield (FuncState *fs, struct ConsControl *cc) {
685  if (cc->tostore == 0) return;
686  if (hasmultret(cc->v.k)) {
687    luaK_setmultret(fs, &cc->v);
688    luaK_setlist(fs, cc->t->u.info, cc->na, LUA_MULTRET);
689    cc->na--;  /* do not count last expression (unknown number of elements) */
690  }
691  else {
692    if (cc->v.k != VVOID)
693      luaK_exp2nextreg(fs, &cc->v);
694    luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore);
695  }
685   if (cc->tostore == 0) return;
686   if (hasmultret(cc->v.k)) {
687   luaK_setmultret(fs, &cc->v);
688   luaK_setlist(fs, cc->t->u.info, cc->na, LUA_MULTRET);
689   cc->na--;  /* do not count last expression (unknown number of elements) */
690   }
691   else {
692   if (cc->v.k != VVOID)
693      luaK_exp2nextreg(fs, &cc->v);
694   luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore);
695   }
696696}
697697
698698
699699static void listfield (LexState *ls, struct ConsControl *cc) {
700  /* listfield -> exp */
701  expr(ls, &cc->v);
702  checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor");
703  cc->na++;
704  cc->tostore++;
700   /* listfield -> exp */
701   expr(ls, &cc->v);
702   checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor");
703   cc->na++;
704   cc->tostore++;
705705}
706706
707707
708708static void field (LexState *ls, struct ConsControl *cc) {
709  /* field -> listfield | recfield */
710  switch(ls->t.token) {
711    case TK_NAME: {  /* may be 'listfield' or 'recfield' */
712      if (luaX_lookahead(ls) != '=')  /* expression? */
713        listfield(ls, cc);
714      else
715        recfield(ls, cc);
716      break;
717    }
718    case '[': {
719      recfield(ls, cc);
720      break;
721    }
722    default: {
723      listfield(ls, cc);
724      break;
725    }
726  }
709   /* field -> listfield | recfield */
710   switch(ls->t.token) {
711   case TK_NAME: {  /* may be 'listfield' or 'recfield' */
712      if (luaX_lookahead(ls) != '=')  /* expression? */
713      listfield(ls, cc);
714      else
715      recfield(ls, cc);
716      break;
717   }
718   case '[': {
719      recfield(ls, cc);
720      break;
721   }
722   default: {
723      listfield(ls, cc);
724      break;
725   }
726   }
727727}
728728
729729
730730static void constructor (LexState *ls, expdesc *t) {
731  /* constructor -> '{' [ field { sep field } [sep] ] '}'
732     sep -> ',' | ';' */
733  FuncState *fs = ls->fs;
734  int line = ls->linenumber;
735  int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0);
736  struct ConsControl cc;
737  cc.na = cc.nh = cc.tostore = 0;
738  cc.t = t;
739  init_exp(t, VRELOCABLE, pc);
740  init_exp(&cc.v, VVOID, 0);  /* no value (yet) */
741  luaK_exp2nextreg(ls->fs, t);  /* fix it at stack top */
742  checknext(ls, '{');
743  do {
744    lua_assert(cc.v.k == VVOID || cc.tostore > 0);
745    if (ls->t.token == '}') break;
746    closelistfield(fs, &cc);
747    field(ls, &cc);
748  } while (testnext(ls, ',') || testnext(ls, ';'));
749  check_match(ls, '}', '{', line);
750  lastlistfield(fs, &cc);
751  SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */
752  SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh));  /* set initial table size */
731   /* constructor -> '{' [ field { sep field } [sep] ] '}'
732    sep -> ',' | ';' */
733   FuncState *fs = ls->fs;
734   int line = ls->linenumber;
735   int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0);
736   struct ConsControl cc;
737   cc.na = cc.nh = cc.tostore = 0;
738   cc.t = t;
739   init_exp(t, VRELOCABLE, pc);
740   init_exp(&cc.v, VVOID, 0);  /* no value (yet) */
741   luaK_exp2nextreg(ls->fs, t);  /* fix it at stack top */
742   checknext(ls, '{');
743   do {
744   lua_assert(cc.v.k == VVOID || cc.tostore > 0);
745   if (ls->t.token == '}') break;
746   closelistfield(fs, &cc);
747   field(ls, &cc);
748   } while (testnext(ls, ',') || testnext(ls, ';'));
749   check_match(ls, '}', '{', line);
750   lastlistfield(fs, &cc);
751   SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */
752   SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh));  /* set initial table size */
753753}
754754
755755/* }====================================================================== */
r31373r31374
757757
758758
759759static void parlist (LexState *ls) {
760  /* parlist -> [ param { `,' param } ] */
761  FuncState *fs = ls->fs;
762  Proto *f = fs->f;
763  int nparams = 0;
764  f->is_vararg = 0;
765  if (ls->t.token != ')') {  /* is `parlist' not empty? */
766    do {
767      switch (ls->t.token) {
768        case TK_NAME: {  /* param -> NAME */
769          new_localvar(ls, str_checkname(ls));
770          nparams++;
771          break;
772        }
773        case TK_DOTS: {  /* param -> `...' */
774          luaX_next(ls);
775          f->is_vararg = 1;
776          break;
777        }
778        default: luaX_syntaxerror(ls, "<name> or " LUA_QL("...") " expected");
779      }
780    } while (!f->is_vararg && testnext(ls, ','));
781  }
782  adjustlocalvars(ls, nparams);
783  f->numparams = cast_byte(fs->nactvar);
784  luaK_reserveregs(fs, fs->nactvar);  /* reserve register for parameters */
760   /* parlist -> [ param { `,' param } ] */
761   FuncState *fs = ls->fs;
762   Proto *f = fs->f;
763   int nparams = 0;
764   f->is_vararg = 0;
765   if (ls->t.token != ')') {  /* is `parlist' not empty? */
766   do {
767      switch (ls->t.token) {
768      case TK_NAME: {  /* param -> NAME */
769         new_localvar(ls, str_checkname(ls));
770         nparams++;
771         break;
772      }
773      case TK_DOTS: {  /* param -> `...' */
774         luaX_next(ls);
775         f->is_vararg = 1;
776         break;
777      }
778      default: luaX_syntaxerror(ls, "<name> or " LUA_QL("...") " expected");
779      }
780   } while (!f->is_vararg && testnext(ls, ','));
781   }
782   adjustlocalvars(ls, nparams);
783   f->numparams = cast_byte(fs->nactvar);
784   luaK_reserveregs(fs, fs->nactvar);  /* reserve register for parameters */
785785}
786786
787787
788788static void body (LexState *ls, expdesc *e, int ismethod, int line) {
789  /* body ->  `(' parlist `)' block END */
790  FuncState new_fs;
791  BlockCnt bl;
792  new_fs.f = addprototype(ls);
793  new_fs.f->linedefined = line;
794  open_func(ls, &new_fs, &bl);
795  checknext(ls, '(');
796  if (ismethod) {
797    new_localvarliteral(ls, "self");  /* create 'self' parameter */
798    adjustlocalvars(ls, 1);
799  }
800  parlist(ls);
801  checknext(ls, ')');
802  statlist(ls);
803  new_fs.f->lastlinedefined = ls->linenumber;
804  check_match(ls, TK_END, TK_FUNCTION, line);
805  codeclosure(ls, e);
806  close_func(ls);
789   /* body ->  `(' parlist `)' block END */
790   FuncState new_fs;
791   BlockCnt bl;
792   new_fs.f = addprototype(ls);
793   new_fs.f->linedefined = line;
794   open_func(ls, &new_fs, &bl);
795   checknext(ls, '(');
796   if (ismethod) {
797   new_localvarliteral(ls, "self");  /* create 'self' parameter */
798   adjustlocalvars(ls, 1);
799   }
800   parlist(ls);
801   checknext(ls, ')');
802   statlist(ls);
803   new_fs.f->lastlinedefined = ls->linenumber;
804   check_match(ls, TK_END, TK_FUNCTION, line);
805   codeclosure(ls, e);
806   close_func(ls);
807807}
808808
809809
810810static int explist (LexState *ls, expdesc *v) {
811  /* explist -> expr { `,' expr } */
812  int n = 1;  /* at least one expression */
813  expr(ls, v);
814  while (testnext(ls, ',')) {
815    luaK_exp2nextreg(ls->fs, v);
816    expr(ls, v);
817    n++;
818  }
819  return n;
811   /* explist -> expr { `,' expr } */
812   int n = 1;  /* at least one expression */
813   expr(ls, v);
814   while (testnext(ls, ',')) {
815   luaK_exp2nextreg(ls->fs, v);
816   expr(ls, v);
817   n++;
818   }
819   return n;
820820}
821821
822822
823823static void funcargs (LexState *ls, expdesc *f, int line) {
824  FuncState *fs = ls->fs;
825  expdesc args;
826  int base, nparams;
827  switch (ls->t.token) {
828    case '(': {  /* funcargs -> `(' [ explist ] `)' */
829      luaX_next(ls);
830      if (ls->t.token == ')')  /* arg list is empty? */
831        args.k = VVOID;
832      else {
833        explist(ls, &args);
834        luaK_setmultret(fs, &args);
835      }
836      check_match(ls, ')', '(', line);
837      break;
838    }
839    case '{': {  /* funcargs -> constructor */
840      constructor(ls, &args);
841      break;
842    }
843    case TK_STRING: {  /* funcargs -> STRING */
844      codestring(ls, &args, ls->t.seminfo.ts);
845      luaX_next(ls);  /* must use `seminfo' before `next' */
846      break;
847    }
848    default: {
849      luaX_syntaxerror(ls, "function arguments expected");
850    }
851  }
852  lua_assert(f->k == VNONRELOC);
853  base = f->u.info;  /* base register for call */
854  if (hasmultret(args.k))
855    nparams = LUA_MULTRET;  /* open call */
856  else {
857    if (args.k != VVOID)
858      luaK_exp2nextreg(fs, &args);  /* close last argument */
859    nparams = fs->freereg - (base+1);
860  }
861  init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2));
862  luaK_fixline(fs, line);
863  fs->freereg = base+1;  /* call remove function and arguments and leaves
824   FuncState *fs = ls->fs;
825   expdesc args;
826   int base, nparams;
827   switch (ls->t.token) {
828   case '(': {  /* funcargs -> `(' [ explist ] `)' */
829      luaX_next(ls);
830      if (ls->t.token == ')')  /* arg list is empty? */
831      args.k = VVOID;
832      else {
833      explist(ls, &args);
834      luaK_setmultret(fs, &args);
835      }
836      check_match(ls, ')', '(', line);
837      break;
838   }
839   case '{': {  /* funcargs -> constructor */
840      constructor(ls, &args);
841      break;
842   }
843   case TK_STRING: {  /* funcargs -> STRING */
844      codestring(ls, &args, ls->t.seminfo.ts);
845      luaX_next(ls);  /* must use `seminfo' before `next' */
846      break;
847   }
848   default: {
849      luaX_syntaxerror(ls, "function arguments expected");
850   }
851   }
852   lua_assert(f->k == VNONRELOC);
853   base = f->u.info;  /* base register for call */
854   if (hasmultret(args.k))
855   nparams = LUA_MULTRET;  /* open call */
856   else {
857   if (args.k != VVOID)
858      luaK_exp2nextreg(fs, &args);  /* close last argument */
859   nparams = fs->freereg - (base+1);
860   }
861   init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2));
862   luaK_fixline(fs, line);
863   fs->freereg = base+1;  /* call remove function and arguments and leaves
864864                            (unless changed) one result */
865865}
866866
r31373r31374
875875
876876
877877static void primaryexp (LexState *ls, expdesc *v) {
878  /* primaryexp -> NAME | '(' expr ')' */
879  switch (ls->t.token) {
880    case '(': {
881      int line = ls->linenumber;
882      luaX_next(ls);
883      expr(ls, v);
884      check_match(ls, ')', '(', line);
885      luaK_dischargevars(ls->fs, v);
886      return;
887    }
888    case TK_NAME: {
889      singlevar(ls, v);
890      return;
891    }
892    default: {
893      luaX_syntaxerror(ls, "unexpected symbol");
894    }
895  }
878   /* primaryexp -> NAME | '(' expr ')' */
879   switch (ls->t.token) {
880   case '(': {
881      int line = ls->linenumber;
882      luaX_next(ls);
883      expr(ls, v);
884      check_match(ls, ')', '(', line);
885      luaK_dischargevars(ls->fs, v);
886      return;
887   }
888   case TK_NAME: {
889      singlevar(ls, v);
890      return;
891   }
892   default: {
893      luaX_syntaxerror(ls, "unexpected symbol");
894   }
895   }
896896}
897897
898898
899899static void suffixedexp (LexState *ls, expdesc *v) {
900  /* suffixedexp ->
901       primaryexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } */
902  FuncState *fs = ls->fs;
903  int line = ls->linenumber;
904  primaryexp(ls, v);
905  for (;;) {
906    switch (ls->t.token) {
907      case '.': {  /* fieldsel */
908        fieldsel(ls, v);
909        break;
910      }
911      case '[': {  /* `[' exp1 `]' */
912        expdesc key;
913        luaK_exp2anyregup(fs, v);
914        yindex(ls, &key);
915        luaK_indexed(fs, v, &key);
916        break;
917      }
918      case ':': {  /* `:' NAME funcargs */
919        expdesc key;
920        luaX_next(ls);
921        checkname(ls, &key);
922        luaK_self(fs, v, &key);
923        funcargs(ls, v, line);
924        break;
925      }
926      case '(': case TK_STRING: case '{': {  /* funcargs */
927        luaK_exp2nextreg(fs, v);
928        funcargs(ls, v, line);
929        break;
930      }
931      default: return;
932    }
933  }
900   /* suffixedexp ->
901      primaryexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } */
902   FuncState *fs = ls->fs;
903   int line = ls->linenumber;
904   primaryexp(ls, v);
905   for (;;) {
906   switch (ls->t.token) {
907      case '.': {  /* fieldsel */
908      fieldsel(ls, v);
909      break;
910      }
911      case '[': {  /* `[' exp1 `]' */
912      expdesc key;
913      luaK_exp2anyregup(fs, v);
914      yindex(ls, &key);
915      luaK_indexed(fs, v, &key);
916      break;
917      }
918      case ':': {  /* `:' NAME funcargs */
919      expdesc key;
920      luaX_next(ls);
921      checkname(ls, &key);
922      luaK_self(fs, v, &key);
923      funcargs(ls, v, line);
924      break;
925      }
926      case '(': case TK_STRING: case '{': {  /* funcargs */
927      luaK_exp2nextreg(fs, v);
928      funcargs(ls, v, line);
929      break;
930      }
931      default: return;
932   }
933   }
934934}
935935
936936
937937static void simpleexp (LexState *ls, expdesc *v) {
938  /* simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ... |
939                  constructor | FUNCTION body | suffixedexp */
940  switch (ls->t.token) {
941    case TK_NUMBER: {
942      init_exp(v, VKNUM, 0);
943      v->u.nval = ls->t.seminfo.r;
944      break;
945    }
946    case TK_STRING: {
947      codestring(ls, v, ls->t.seminfo.ts);
948      break;
949    }
950    case TK_NIL: {
951      init_exp(v, VNIL, 0);
952      break;
953    }
954    case TK_TRUE: {
955      init_exp(v, VTRUE, 0);
956      break;
957    }
958    case TK_FALSE: {
959      init_exp(v, VFALSE, 0);
960      break;
961    }
962    case TK_DOTS: {  /* vararg */
963      FuncState *fs = ls->fs;
964      check_condition(ls, fs->f->is_vararg,
965                      "cannot use " LUA_QL("...") " outside a vararg function");
966      init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0));
967      break;
968    }
969    case '{': {  /* constructor */
970      constructor(ls, v);
971      return;
972    }
973    case TK_FUNCTION: {
974      luaX_next(ls);
975      body(ls, v, 0, ls->linenumber);
976      return;
977    }
978    default: {
979      suffixedexp(ls, v);
980      return;
981    }
982  }
983  luaX_next(ls);
938   /* simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ... |
939                 constructor | FUNCTION body | suffixedexp */
940   switch (ls->t.token) {
941   case TK_NUMBER: {
942      init_exp(v, VKNUM, 0);
943      v->u.nval = ls->t.seminfo.r;
944      break;
945   }
946   case TK_STRING: {
947      codestring(ls, v, ls->t.seminfo.ts);
948      break;
949   }
950   case TK_NIL: {
951      init_exp(v, VNIL, 0);
952      break;
953   }
954   case TK_TRUE: {
955      init_exp(v, VTRUE, 0);
956      break;
957   }
958   case TK_FALSE: {
959      init_exp(v, VFALSE, 0);
960      break;
961   }
962   case TK_DOTS: {  /* vararg */
963      FuncState *fs = ls->fs;
964      check_condition(ls, fs->f->is_vararg,
965                  "cannot use " LUA_QL("...") " outside a vararg function");
966      init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0));
967      break;
968   }
969   case '{': {  /* constructor */
970      constructor(ls, v);
971      return;
972   }
973   case TK_FUNCTION: {
974      luaX_next(ls);
975      body(ls, v, 0, ls->linenumber);
976      return;
977   }
978   default: {
979      suffixedexp(ls, v);
980      return;
981   }
982   }
983   luaX_next(ls);
984984}
985985
986986
987987static UnOpr getunopr (int op) {
988  switch (op) {
989    case TK_NOT: return OPR_NOT;
990    case '-': return OPR_MINUS;
991    case '#': return OPR_LEN;
992    default: return OPR_NOUNOPR;
993  }
988   switch (op) {
989   case TK_NOT: return OPR_NOT;
990   case '-': return OPR_MINUS;
991   case '#': return OPR_LEN;
992   default: return OPR_NOUNOPR;
993   }
994994}
995995
996996
997997static BinOpr getbinopr (int op) {
998  switch (op) {
999    case '+': return OPR_ADD;
1000    case '-': return OPR_SUB;
1001    case '*': return OPR_MUL;
1002    case '/': return OPR_DIV;
1003    case '%': return OPR_MOD;
1004    case '^': return OPR_POW;
1005    case TK_CONCAT: return OPR_CONCAT;
1006    case TK_NE: return OPR_NE;
1007    case TK_EQ: return OPR_EQ;
1008    case '<': return OPR_LT;
1009    case TK_LE: return OPR_LE;
1010    case '>': return OPR_GT;
1011    case TK_GE: return OPR_GE;
1012    case TK_AND: return OPR_AND;
1013    case TK_OR: return OPR_OR;
1014    default: return OPR_NOBINOPR;
1015  }
998   switch (op) {
999   case '+': return OPR_ADD;
1000   case '-': return OPR_SUB;
1001   case '*': return OPR_MUL;
1002   case '/': return OPR_DIV;
1003   case '%': return OPR_MOD;
1004   case '^': return OPR_POW;
1005   case TK_CONCAT: return OPR_CONCAT;
1006   case TK_NE: return OPR_NE;
1007   case TK_EQ: return OPR_EQ;
1008   case '<': return OPR_LT;
1009   case TK_LE: return OPR_LE;
1010   case '>': return OPR_GT;
1011   case TK_GE: return OPR_GE;
1012   case TK_AND: return OPR_AND;
1013   case TK_OR: return OPR_OR;
1014   default: return OPR_NOBINOPR;
1015   }
10161016}
10171017
10181018
10191019static const struct {
1020  lu_byte left;  /* left priority for each binary operator */
1021  lu_byte right; /* right priority */
1020   lu_byte left;  /* left priority for each binary operator */
1021   lu_byte right; /* right priority */
10221022} priority[] = {  /* ORDER OPR */
1023   {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7},  /* `+' `-' `*' `/' `%' */
1024   {10, 9}, {5, 4},                 /* ^, .. (right associative) */
1025   {3, 3}, {3, 3}, {3, 3},          /* ==, <, <= */
1026   {3, 3}, {3, 3}, {3, 3},          /* ~=, >, >= */
1027   {2, 2}, {1, 1}                   /* and, or */
1023   {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7},  /* `+' `-' `*' `/' `%' */
1024   {10, 9}, {5, 4},                 /* ^, .. (right associative) */
1025   {3, 3}, {3, 3}, {3, 3},          /* ==, <, <= */
1026   {3, 3}, {3, 3}, {3, 3},          /* ~=, >, >= */
1027   {2, 2}, {1, 1}                   /* and, or */
10281028};
10291029
1030#define UNARY_PRIORITY   8  /* priority for unary operators */
1030#define UNARY_PRIORITY  8  /* priority for unary operators */
10311031
10321032
10331033/*
r31373r31374
10351035** where `binop' is any binary operator with a priority higher than `limit'
10361036*/
10371037static BinOpr subexpr (LexState *ls, expdesc *v, int limit) {
1038  BinOpr op;
1039  UnOpr uop;
1040  enterlevel(ls);
1041  uop = getunopr(ls->t.token);
1042  if (uop != OPR_NOUNOPR) {
1043    int line = ls->linenumber;
1044    luaX_next(ls);
1045    subexpr(ls, v, UNARY_PRIORITY);
1046    luaK_prefix(ls->fs, uop, v, line);
1047  }
1048  else simpleexp(ls, v);
1049  /* expand while operators have priorities higher than `limit' */
1050  op = getbinopr(ls->t.token);
1051  while (op != OPR_NOBINOPR && priority[op].left > limit) {
1052    expdesc v2;
1053    BinOpr nextop;
1054    int line = ls->linenumber;
1055    luaX_next(ls);
1056    luaK_infix(ls->fs, op, v);
1057    /* read sub-expression with higher priority */
1058    nextop = subexpr(ls, &v2, priority[op].right);
1059    luaK_posfix(ls->fs, op, v, &v2, line);
1060    op = nextop;
1061  }
1062  leavelevel(ls);
1063  return op;  /* return first untreated operator */
1038   BinOpr op;
1039   UnOpr uop;
1040   enterlevel(ls);
1041   uop = getunopr(ls->t.token);
1042   if (uop != OPR_NOUNOPR) {
1043   int line = ls->linenumber;
1044   luaX_next(ls);
1045   subexpr(ls, v, UNARY_PRIORITY);
1046   luaK_prefix(ls->fs, uop, v, line);
1047   }
1048   else simpleexp(ls, v);
1049   /* expand while operators have priorities higher than `limit' */
1050   op = getbinopr(ls->t.token);
1051   while (op != OPR_NOBINOPR && priority[op].left > limit) {
1052   expdesc v2;
1053   BinOpr nextop;
1054   int line = ls->linenumber;
1055   luaX_next(ls);
1056   luaK_infix(ls->fs, op, v);
1057   /* read sub-expression with higher priority */
1058   nextop = subexpr(ls, &v2, priority[op].right);
1059   luaK_posfix(ls->fs, op, v, &v2, line);
1060   op = nextop;
1061   }
1062   leavelevel(ls);
1063   return op;  /* return first untreated operator */
10641064}
10651065
10661066
10671067static void expr (LexState *ls, expdesc *v) {
1068  subexpr(ls, v, 0);
1068   subexpr(ls, v, 0);
10691069}
10701070
10711071/* }==================================================================== */
r31373r31374
10801080
10811081
10821082static void block (LexState *ls) {
1083  /* block -> statlist */
1084  FuncState *fs = ls->fs;
1085  BlockCnt bl;
1086  enterblock(fs, &bl, 0);
1087  statlist(ls);
1088  leaveblock(fs);
1083   /* block -> statlist */
1084   FuncState *fs = ls->fs;
1085   BlockCnt bl;
1086   enterblock(fs, &bl, 0);
1087   statlist(ls);
1088   leaveblock(fs);
10891089}
10901090
10911091
r31373r31374
10941094** assignment
10951095*/
10961096struct LHS_assign {
1097  struct LHS_assign *prev;
1098  expdesc v;  /* variable (global, local, upvalue, or indexed) */
1097   struct LHS_assign *prev;
1098   expdesc v;  /* variable (global, local, upvalue, or indexed) */
10991099};
11001100
11011101
r31373r31374
11061106** use this safe copy in the previous assignment.
11071107*/
11081108static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) {
1109  FuncState *fs = ls->fs;
1110  int extra = fs->freereg;  /* eventual position to save local variable */
1111  int conflict = 0;
1112  for (; lh; lh = lh->prev) {  /* check all previous assignments */
1113    if (lh->v.k == VINDEXED) {  /* assigning to a table? */
1114      /* table is the upvalue/local being assigned now? */
1115      if (lh->v.u.ind.vt == v->k && lh->v.u.ind.t == v->u.info) {
1116        conflict = 1;
1117        lh->v.u.ind.vt = VLOCAL;
1118        lh->v.u.ind.t = extra;  /* previous assignment will use safe copy */
1119      }
1120      /* index is the local being assigned? (index cannot be upvalue) */
1121      if (v->k == VLOCAL && lh->v.u.ind.idx == v->u.info) {
1122        conflict = 1;
1123        lh->v.u.ind.idx = extra;  /* previous assignment will use safe copy */
1124      }
1125    }
1126  }
1127  if (conflict) {
1128    /* copy upvalue/local value to a temporary (in position 'extra') */
1129    OpCode op = (v->k == VLOCAL) ? OP_MOVE : OP_GETUPVAL;
1130    luaK_codeABC(fs, op, extra, v->u.info, 0);
1131    luaK_reserveregs(fs, 1);
1132  }
1109   FuncState *fs = ls->fs;
1110   int extra = fs->freereg;  /* eventual position to save local variable */
1111   int conflict = 0;
1112   for (; lh; lh = lh->prev) {  /* check all previous assignments */
1113   if (lh->v.k == VINDEXED) {  /* assigning to a table? */
1114      /* table is the upvalue/local being assigned now? */
1115      if (lh->v.u.ind.vt == v->k && lh->v.u.ind.t == v->u.info) {
1116      conflict = 1;
1117      lh->v.u.ind.vt = VLOCAL;
1118      lh->v.u.ind.t = extra;  /* previous assignment will use safe copy */
1119      }
1120      /* index is the local being assigned? (index cannot be upvalue) */
1121      if (v->k == VLOCAL && lh->v.u.ind.idx == v->u.info) {
1122      conflict = 1;
1123      lh->v.u.ind.idx = extra;  /* previous assignment will use safe copy */
1124      }
1125   }
1126   }
1127   if (conflict) {
1128   /* copy upvalue/local value to a temporary (in position 'extra') */
1129   OpCode op = (v->k == VLOCAL) ? OP_MOVE : OP_GETUPVAL;
1130   luaK_codeABC(fs, op, extra, v->u.info, 0);
1131   luaK_reserveregs(fs, 1);
1132   }
11331133}
11341134
11351135
11361136static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
1137  expdesc e;
1138  check_condition(ls, vkisvar(lh->v.k), "syntax error");
1139  if (testnext(ls, ',')) {  /* assignment -> ',' suffixedexp assignment */
1140    struct LHS_assign nv;
1141    nv.prev = lh;
1142    suffixedexp(ls, &nv.v);
1143    if (nv.v.k != VINDEXED)
1144      check_conflict(ls, lh, &nv.v);
1145    checklimit(ls->fs, nvars + ls->L->nCcalls, LUAI_MAXCCALLS,
1146                    "C levels");
1147    assignment(ls, &nv, nvars+1);
1148  }
1149  else {  /* assignment -> `=' explist */
1150    int nexps;
1151    checknext(ls, '=');
1152    nexps = explist(ls, &e);
1153    if (nexps != nvars) {
1154      adjust_assign(ls, nvars, nexps, &e);
1155      if (nexps > nvars)
1156        ls->fs->freereg -= nexps - nvars;  /* remove extra values */
1157    }
1158    else {
1159      luaK_setoneret(ls->fs, &e);  /* close last expression */
1160      luaK_storevar(ls->fs, &lh->v, &e);
1161      return;  /* avoid default */
1162    }
1163  }
1164  init_exp(&e, VNONRELOC, ls->fs->freereg-1);  /* default assignment */
1165  luaK_storevar(ls->fs, &lh->v, &e);
1137   expdesc e;
1138   check_condition(ls, vkisvar(lh->v.k), "syntax error");
1139   if (testnext(ls, ',')) {  /* assignment -> ',' suffixedexp assignment */
1140   struct LHS_assign nv;
1141   nv.prev = lh;
1142   suffixedexp(ls, &nv.v);
1143   if (nv.v.k != VINDEXED)
1144      check_conflict(ls, lh, &nv.v);
1145   checklimit(ls->fs, nvars + ls->L->nCcalls, LUAI_MAXCCALLS,
1146               "C levels");
1147   assignment(ls, &nv, nvars+1);
1148   }
1149   else {  /* assignment -> `=' explist */
1150   int nexps;
1151   checknext(ls, '=');
1152   nexps = explist(ls, &e);
1153   if (nexps != nvars) {
1154      adjust_assign(ls, nvars, nexps, &e);
1155      if (nexps > nvars)
1156      ls->fs->freereg -= nexps - nvars;  /* remove extra values */
1157   }
1158   else {
1159      luaK_setoneret(ls->fs, &e);  /* close last expression */
1160      luaK_storevar(ls->fs, &lh->v, &e);
1161      return;  /* avoid default */
1162   }
1163   }
1164   init_exp(&e, VNONRELOC, ls->fs->freereg-1);  /* default assignment */
1165   luaK_storevar(ls->fs, &lh->v, &e);
11661166}
11671167
11681168
11691169static int cond (LexState *ls) {
1170  /* cond -> exp */
1171  expdesc v;
1172  expr(ls, &v);  /* read condition */
1173  if (v.k == VNIL) v.k = VFALSE;  /* `falses' are all equal here */
1174  luaK_goiftrue(ls->fs, &v);
1175  return v.f;
1170   /* cond -> exp */
1171   expdesc v;
1172   expr(ls, &v);  /* read condition */
1173   if (v.k == VNIL) v.k = VFALSE;  /* `falses' are all equal here */
1174   luaK_goiftrue(ls->fs, &v);
1175   return v.f;
11761176}
11771177
11781178
11791179static void gotostat (LexState *ls, int pc) {
1180  int line = ls->linenumber;
1181  TString *label;
1182  int g;
1183  if (testnext(ls, TK_GOTO))
1184    label = str_checkname(ls);
1185  else {
1186    luaX_next(ls);  /* skip break */
1187    label = luaS_new(ls->L, "break");
1188  }
1189  g = newlabelentry(ls, &ls->dyd->gt, label, line, pc);
1190  findlabel(ls, g);  /* close it if label already defined */
1180   int line = ls->linenumber;
1181   TString *label;
1182   int g;
1183   if (testnext(ls, TK_GOTO))
1184   label = str_checkname(ls);
1185   else {
1186   luaX_next(ls);  /* skip break */
1187   label = luaS_new(ls->L, "break");
1188   }
1189   g = newlabelentry(ls, &ls->dyd->gt, label, line, pc);
1190   findlabel(ls, g);  /* close it if label already defined */
11911191}
11921192
11931193
11941194/* check for repeated labels on the same block */
11951195static void checkrepeated (FuncState *fs, Labellist *ll, TString *label) {
1196  int i;
1197  for (i = fs->bl->firstlabel; i < ll->n; i++) {
1198    if (luaS_eqstr(label, ll->arr[i].name)) {
1199      const char *msg = luaO_pushfstring(fs->ls->L,
1200                          "label " LUA_QS " already defined on line %d",
1201                          getstr(label), ll->arr[i].line);
1202      semerror(fs->ls, msg);
1203    }
1204  }
1196   int i;
1197   for (i = fs->bl->firstlabel; i < ll->n; i++) {
1198   if (luaS_eqstr(label, ll->arr[i].name)) {
1199      const char *msg = luaO_pushfstring(fs->ls->L,
1200                     "label " LUA_QS " already defined on line %d",
1201                     getstr(label), ll->arr[i].line);
1202      semerror(fs->ls, msg);
1203   }
1204   }
12051205}
12061206
12071207
12081208/* skip no-op statements */
12091209static void skipnoopstat (LexState *ls) {
1210  while (ls->t.token == ';' || ls->t.token == TK_DBCOLON)
1211    statement(ls);
1210   while (ls->t.token == ';' || ls->t.token == TK_DBCOLON)
1211   statement(ls);
12121212}
12131213
12141214
12151215static void labelstat (LexState *ls, TString *label, int line) {
1216  /* label -> '::' NAME '::' */
1217  FuncState *fs = ls->fs;
1218  Labellist *ll = &ls->dyd->label;
1219  int l;  /* index of new label being created */
1220  checkrepeated(fs, ll, label);  /* check for repeated labels */
1221  checknext(ls, TK_DBCOLON);  /* skip double colon */
1222  /* create new entry for this label */
1223  l = newlabelentry(ls, ll, label, line, fs->pc);
1224  skipnoopstat(ls);  /* skip other no-op statements */
1225  if (block_follow(ls, 0)) {  /* label is last no-op statement in the block? */
1226    /* assume that locals are already out of scope */
1227    ll->arr[l].nactvar = fs->bl->nactvar;
1228  }
1229  findgotos(ls, &ll->arr[l]);
1216   /* label -> '::' NAME '::' */
1217   FuncState *fs = ls->fs;
1218   Labellist *ll = &ls->dyd->label;
1219   int l;  /* index of new label being created */
1220   checkrepeated(fs, ll, label);  /* check for repeated labels */
1221   checknext(ls, TK_DBCOLON);  /* skip double colon */
1222   /* create new entry for this label */
1223   l = newlabelentry(ls, ll, label, line, fs->pc);
1224   skipnoopstat(ls);  /* skip other no-op statements */
1225   if (block_follow(ls, 0)) {  /* label is last no-op statement in the block? */
1226   /* assume that locals are already out of scope */
1227   ll->arr[l].nactvar = fs->bl->nactvar;
1228   }
1229   findgotos(ls, &ll->arr[l]);
12301230}
12311231
12321232
12331233static void whilestat (LexState *ls, int line) {
1234  /* whilestat -> WHILE cond DO block END */
1235  FuncState *fs = ls->fs;
1236  int whileinit;
1237  int condexit;
1238  BlockCnt bl;
1239  luaX_next(ls);  /* skip WHILE */
1240  whileinit = luaK_getlabel(fs);
1241  condexit = cond(ls);
1242  enterblock(fs, &bl, 1);
1243  checknext(ls, TK_DO);
1244  block(ls);
1245  luaK_jumpto(fs, whileinit);
1246  check_match(ls, TK_END, TK_WHILE, line);
1247  leaveblock(fs);
1248  luaK_patchtohere(fs, condexit);  /* false conditions finish the loop */
1234   /* whilestat -> WHILE cond DO block END */
1235   FuncState *fs = ls->fs;
1236   int whileinit;
1237   int condexit;
1238   BlockCnt bl;
1239   luaX_next(ls);  /* skip WHILE */
1240   whileinit = luaK_getlabel(fs);
1241   condexit = cond(ls);
1242   enterblock(fs, &bl, 1);
1243   checknext(ls, TK_DO);
1244   block(ls);
1245   luaK_jumpto(fs, whileinit);
1246   check_match(ls, TK_END, TK_WHILE, line);
1247   leaveblock(fs);
1248   luaK_patchtohere(fs, condexit);  /* false conditions finish the loop */
12491249}
12501250
12511251
12521252static void repeatstat (LexState *ls, int line) {
1253  /* repeatstat -> REPEAT block UNTIL cond */
1254  int condexit;
1255  FuncState *fs = ls->fs;
1256  int repeat_init = luaK_getlabel(fs);
1257  BlockCnt bl1, bl2;
1258  enterblock(fs, &bl1, 1);  /* loop block */
1259  enterblock(fs, &bl2, 0);  /* scope block */
1260  luaX_next(ls);  /* skip REPEAT */
1261  statlist(ls);
1262  check_match(ls, TK_UNTIL, TK_REPEAT, line);
1263  condexit = cond(ls);  /* read condition (inside scope block) */
1264  if (bl2.upval)  /* upvalues? */
1265    luaK_patchclose(fs, condexit, bl2.nactvar);
1266  leaveblock(fs);  /* finish scope */
1267  luaK_patchlist(fs, condexit, repeat_init);  /* close the loop */
1268  leaveblock(fs);  /* finish loop */
1253   /* repeatstat -> REPEAT block UNTIL cond */
1254   int condexit;
1255   FuncState *fs = ls->fs;
1256   int repeat_init = luaK_getlabel(fs);
1257   BlockCnt bl1, bl2;
1258   enterblock(fs, &bl1, 1);  /* loop block */
1259   enterblock(fs, &bl2, 0);  /* scope block */
1260   luaX_next(ls);  /* skip REPEAT */
1261   statlist(ls);
1262   check_match(ls, TK_UNTIL, TK_REPEAT, line);
1263   condexit = cond(ls);  /* read condition (inside scope block) */
1264   if (bl2.upval)  /* upvalues? */
1265   luaK_patchclose(fs, condexit, bl2.nactvar);
1266   leaveblock(fs);  /* finish scope */
1267   luaK_patchlist(fs, condexit, repeat_init);  /* close the loop */
1268   leaveblock(fs);  /* finish loop */
12691269}
12701270
12711271
12721272static int exp1 (LexState *ls) {
1273  expdesc e;
1274  int reg;
1275  expr(ls, &e);
1276  luaK_exp2nextreg(ls->fs, &e);
1277  lua_assert(e.k == VNONRELOC);
1278  reg = e.u.info;
1279  return reg;
1273   expdesc e;
1274   int reg;
1275   expr(ls, &e);
1276   luaK_exp2nextreg(ls->fs, &e);
1277   lua_assert(e.k == VNONRELOC);
1278   reg = e.u.info;
1279   return reg;
12801280}
12811281
12821282
12831283static void forbody (LexState *ls, int base, int line, int nvars, int isnum) {
1284  /* forbody -> DO block */
1285  BlockCnt bl;
1286  FuncState *fs = ls->fs;
1287  int prep, endfor;
1288  adjustlocalvars(ls, 3);  /* control variables */
1289  checknext(ls, TK_DO);
1290  prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs);
1291  enterblock(fs, &bl, 0);  /* scope for declared variables */
1292  adjustlocalvars(ls, nvars);
1293  luaK_reserveregs(fs, nvars);
1294  block(ls);
1295  leaveblock(fs);  /* end of scope for declared variables */
1296  luaK_patchtohere(fs, prep);
1297  if (isnum)  /* numeric for? */
1298    endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP);
1299  else {  /* generic for */
1300    luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars);
1301    luaK_fixline(fs, line);
1302    endfor = luaK_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP);
1303  }
1304  luaK_patchlist(fs, endfor, prep + 1);
1305  luaK_fixline(fs, line);
1284   /* forbody -> DO block */
1285   BlockCnt bl;
1286   FuncState *fs = ls->fs;
1287   int prep, endfor;
1288   adjustlocalvars(ls, 3);  /* control variables */
1289   checknext(ls, TK_DO);
1290   prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs);
1291   enterblock(fs, &bl, 0);  /* scope for declared variables */
1292   adjustlocalvars(ls, nvars);
1293   luaK_reserveregs(fs, nvars);
1294   block(ls);
1295   leaveblock(fs);  /* end of scope for declared variables */
1296   luaK_patchtohere(fs, prep);
1297   if (isnum)  /* numeric for? */
1298   endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP);
1299   else {  /* generic for */
1300   luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars);
1301   luaK_fixline(fs, line);
1302   endfor = luaK_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP);
1303   }
1304   luaK_patchlist(fs, endfor, prep + 1);
1305   luaK_fixline(fs, line);
13061306}
13071307
13081308
13091309static void fornum (LexState *ls, TString *varname, int line) {
1310  /* fornum -> NAME = exp1,exp1[,exp1] forbody */
1311  FuncState *fs = ls->fs;
1312  int base = fs->freereg;
1313  new_localvarliteral(ls, "(for index)");
1314  new_localvarliteral(ls, "(for limit)");
1315  new_localvarliteral(ls, "(for step)");
1316  new_localvar(ls, varname);
1317  checknext(ls, '=');
1318  exp1(ls);  /* initial value */
1319  checknext(ls, ',');
1320  exp1(ls);  /* limit */
1321  if (testnext(ls, ','))
1322    exp1(ls);  /* optional step */
1323  else {  /* default step = 1 */
1324    luaK_codek(fs, fs->freereg, luaK_numberK(fs, 1));
1325    luaK_reserveregs(fs, 1);
1326  }
1327  forbody(ls, base, line, 1, 1);
1310   /* fornum -> NAME = exp1,exp1[,exp1] forbody */
1311   FuncState *fs = ls->fs;
1312   int base = fs->freereg;
1313   new_localvarliteral(ls, "(for index)");
1314   new_localvarliteral(ls, "(for limit)");
1315   new_localvarliteral(ls, "(for step)");
1316   new_localvar(ls, varname);
1317   checknext(ls, '=');
1318   exp1(ls);  /* initial value */
1319   checknext(ls, ',');
1320   exp1(ls);  /* limit */
1321   if (testnext(ls, ','))
1322   exp1(ls);  /* optional step */
1323   else {  /* default step = 1 */
1324   luaK_codek(fs, fs->freereg, luaK_numberK(fs, 1));
1325   luaK_reserveregs(fs, 1);
1326   }
1327   forbody(ls, base, line, 1, 1);
13281328}
13291329
13301330
13311331static void forlist (LexState *ls, TString *indexname) {
1332  /* forlist -> NAME {,NAME} IN explist forbody */
1333  FuncState *fs = ls->fs;
1334  expdesc e;
1335  int nvars = 4;  /* gen, state, control, plus at least one declared var */
1336  int line;
1337  int base = fs->freereg;
1338  /* create control variables */
1339  new_localvarliteral(ls, "(for generator)");
1340  new_localvarliteral(ls, "(for state)");
1341  new_localvarliteral(ls, "(for control)");
1342  /* create declared variables */
1343  new_localvar(ls, indexname);
1344  while (testnext(ls, ',')) {
1345    new_localvar(ls, str_checkname(ls));
1346    nvars++;
1347  }
1348  checknext(ls, TK_IN);
1349  line = ls->linenumber;
1350  adjust_assign(ls, 3, explist(ls, &e), &e);
1351  luaK_checkstack(fs, 3);  /* extra space to call generator */
1352  forbody(ls, base, line, nvars - 3, 0);
1332   /* forlist -> NAME {,NAME} IN explist forbody */
1333   FuncState *fs = ls->fs;
1334   expdesc e;
1335   int nvars = 4;  /* gen, state, control, plus at least one declared var */
1336   int line;
1337   int base = fs->freereg;
1338   /* create control variables */
1339   new_localvarliteral(ls, "(for generator)");
1340   new_localvarliteral(ls, "(for state)");
1341   new_localvarliteral(ls, "(for control)");
1342   /* create declared variables */
1343   new_localvar(ls, indexname);
1344   while (testnext(ls, ',')) {
1345   new_localvar(ls, str_checkname(ls));
1346   nvars++;
1347   }
1348   checknext(ls, TK_IN);
1349   line = ls->linenumber;
1350   adjust_assign(ls, 3, explist(ls, &e), &e);
1351   luaK_checkstack(fs, 3);  /* extra space to call generator */
1352   forbody(ls, base, line, nvars - 3, 0);
13531353}
13541354
13551355
13561356static void forstat (LexState *ls, int line) {
1357  /* forstat -> FOR (fornum | forlist) END */
1358  FuncState *fs = ls->fs;
1359  TString *varname;
1360  BlockCnt bl;
1361  enterblock(fs, &bl, 1);  /* scope for loop and control variables */
1362  luaX_next(ls);  /* skip `for' */
1363  varname = str_checkname(ls);  /* first variable name */
1364  switch (ls->t.token) {
1365    case '=': fornum(ls, varname, line); break;
1366    case ',': case TK_IN: forlist(ls, varname); break;
1367    default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected");
1368  }
1369  check_match(ls, TK_END, TK_FOR, line);
1370  leaveblock(fs);  /* loop scope (`break' jumps to this point) */
1357   /* forstat -> FOR (fornum | forlist) END */
1358   FuncState *fs = ls->fs;
1359   TString *varname;
1360   BlockCnt bl;
1361   enterblock(fs, &bl, 1);  /* scope for loop and control variables */
1362   luaX_next(ls);  /* skip `for' */
1363   varname = str_checkname(ls);  /* first variable name */
1364   switch (ls->t.token) {
1365   case '=': fornum(ls, varname, line); break;
1366   case ',': case TK_IN: forlist(ls, varname); break;
1367   default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected");
1368   }
1369   check_match(ls, TK_END, TK_FOR, line);
1370   leaveblock(fs);  /* loop scope (`break' jumps to this point) */
13711371}
13721372
13731373
13741374static void test_then_block (LexState *ls, int *escapelist) {
1375  /* test_then_block -> [IF | ELSEIF] cond THEN block */
1376  BlockCnt bl;
1377  FuncState *fs = ls->fs;
1378  expdesc v;
1379  int jf;  /* instruction to skip 'then' code (if condition is false) */
1380  luaX_next(ls);  /* skip IF or ELSEIF */
1381  expr(ls, &v);  /* read condition */
1382  checknext(ls, TK_THEN);
1383  if (ls->t.token == TK_GOTO || ls->t.token == TK_BREAK) {
1384    luaK_goiffalse(ls->fs, &v);  /* will jump to label if condition is true */
1385    enterblock(fs, &bl, 0);  /* must enter block before 'goto' */
1386    gotostat(ls, v.t);  /* handle goto/break */
1387    skipnoopstat(ls);  /* skip other no-op statements */
1388    if (block_follow(ls, 0)) {  /* 'goto' is the entire block? */
1389      leaveblock(fs);
1390      return;  /* and that is it */
1391    }
1392    else  /* must skip over 'then' part if condition is false */
1393      jf = luaK_jump(fs);
1394  }
1395  else {  /* regular case (not goto/break) */
1396    luaK_goiftrue(ls->fs, &v);  /* skip over block if condition is false */
1397    enterblock(fs, &bl, 0);
1398    jf = v.f;
1399  }
1400  statlist(ls);  /* `then' part */
1401  leaveblock(fs);
1402  if (ls->t.token == TK_ELSE ||
1403      ls->t.token == TK_ELSEIF)  /* followed by 'else'/'elseif'? */
1404    luaK_concat(fs, escapelist, luaK_jump(fs));  /* must jump over it */
1405  luaK_patchtohere(fs, jf);
1375   /* test_then_block -> [IF | ELSEIF] cond THEN block */
1376   BlockCnt bl;
1377   FuncState *fs = ls->fs;
1378   expdesc v;
1379   int jf;  /* instruction to skip 'then' code (if condition is false) */
1380   luaX_next(ls);  /* skip IF or ELSEIF */
1381   expr(ls, &v);  /* read condition */
1382   checknext(ls, TK_THEN);
1383   if (ls->t.token == TK_GOTO || ls->t.token == TK_BREAK) {
1384   luaK_goiffalse(ls->fs, &v);  /* will jump to label if condition is true */
1385   enterblock(fs, &bl, 0);  /* must enter block before 'goto' */
1386   gotostat(ls, v.t);  /* handle goto/break */
1387   skipnoopstat(ls);  /* skip other no-op statements */
1388   if (block_follow(ls, 0)) {  /* 'goto' is the entire block? */
1389      leaveblock(fs);
1390      return;  /* and that is it */
1391   }
1392   else  /* must skip over 'then' part if condition is false */
1393      jf = luaK_jump(fs);
1394   }
1395   else {  /* regular case (not goto/break) */
1396   luaK_goiftrue(ls->fs, &v);  /* skip over block if condition is false */
1397   enterblock(fs, &bl, 0);
1398   jf = v.f;
1399   }
1400   statlist(ls);  /* `then' part */
1401   leaveblock(fs);
1402   if (ls->t.token == TK_ELSE ||
1403      ls->t.token == TK_ELSEIF)  /* followed by 'else'/'elseif'? */
1404   luaK_concat(fs, escapelist, luaK_jump(fs));  /* must jump over it */
1405   luaK_patchtohere(fs, jf);
14061406}
14071407
14081408
14091409static void ifstat (LexState *ls, int line) {
1410  /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */
1411  FuncState *fs = ls->fs;
1412  int escapelist = NO_JUMP;  /* exit list for finished parts */
1413  test_then_block(ls, &escapelist);  /* IF cond THEN block */
1414  while (ls->t.token == TK_ELSEIF)
1415    test_then_block(ls, &escapelist);  /* ELSEIF cond THEN block */
1416  if (testnext(ls, TK_ELSE))
1417    block(ls);  /* `else' part */
1418  check_match(ls, TK_END, TK_IF, line);
1419  luaK_patchtohere(fs, escapelist);  /* patch escape list to 'if' end */
1410   /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */
1411   FuncState *fs = ls->fs;
1412   int escapelist = NO_JUMP;  /* exit list for finished parts */
1413   test_then_block(ls, &escapelist);  /* IF cond THEN block */
1414   while (ls->t.token == TK_ELSEIF)
1415   test_then_block(ls, &escapelist);  /* ELSEIF cond THEN block */
1416   if (testnext(ls, TK_ELSE))
1417   block(ls);  /* `else' part */
1418   check_match(ls, TK_END, TK_IF, line);
1419   luaK_patchtohere(fs, escapelist);  /* patch escape list to 'if' end */
14201420}
14211421
14221422
14231423static void localfunc (LexState *ls) {
1424  expdesc b;
1425  FuncState *fs = ls->fs;
1426  new_localvar(ls, str_checkname(ls));  /* new local variable */
1427  adjustlocalvars(ls, 1);  /* enter its scope */
1428  body(ls, &b, 0, ls->linenumber);  /* function created in next register */
1429  /* debug information will only see the variable after this point! */
1430  getlocvar(fs, b.u.info)->startpc = fs->pc;
1424   expdesc b;
1425   FuncState *fs = ls->fs;
1426   new_localvar(ls, str_checkname(ls));  /* new local variable */
1427   adjustlocalvars(ls, 1);  /* enter its scope */
1428   body(ls, &b, 0, ls->linenumber);  /* function created in next register */
1429   /* debug information will only see the variable after this point! */
1430   getlocvar(fs, b.u.info)->startpc = fs->pc;
14311431}
14321432
14331433
14341434static void localstat (LexState *ls) {
1435  /* stat -> LOCAL NAME {`,' NAME} [`=' explist] */
1436  int nvars = 0;
1437  int nexps;
1438  expdesc e;
1439  do {
1440    new_localvar(ls, str_checkname(ls));
1441    nvars++;
1442  } while (testnext(ls, ','));
1443  if (testnext(ls, '='))
1444    nexps = explist(ls, &e);
1445  else {
1446    e.k = VVOID;
1447    nexps = 0;
1448  }
1449  adjust_assign(ls, nvars, nexps, &e);
1450  adjustlocalvars(ls, nvars);
1435   /* stat -> LOCAL NAME {`,' NAME} [`=' explist] */
1436   int nvars = 0;
1437   int nexps;
1438   expdesc e;
1439   do {
1440   new_localvar(ls, str_checkname(ls));
1441   nvars++;
1442   } while (testnext(ls, ','));
1443   if (testnext(ls, '='))
1444   nexps = explist(ls, &e);
1445   else {
1446   e.k = VVOID;
1447   nexps = 0;
1448   }
1449   adjust_assign(ls, nvars, nexps, &e);
1450   adjustlocalvars(ls, nvars);
14511451}
14521452
14531453
14541454static int funcname (LexState *ls, expdesc *v) {
1455  /* funcname -> NAME {fieldsel} [`:' NAME] */
1456  int ismethod = 0;
1457  singlevar(ls, v);
1458  while (ls->t.token == '.')
1459    fieldsel(ls, v);
1460  if (ls->t.token == ':') {
1461    ismethod = 1;
1462    fieldsel(ls, v);
1463  }
1464  return ismethod;
1455   /* funcname -> NAME {fieldsel} [`:' NAME] */
1456   int ismethod = 0;
1457   singlevar(ls, v);
1458   while (ls->t.token == '.')
1459   fieldsel(ls, v);
1460   if (ls->t.token == ':') {
1461   ismethod = 1;
1462   fieldsel(ls, v);
1463   }
1464   return ismethod;
14651465}
14661466
14671467
14681468static void funcstat (LexState *ls, int line) {
1469  /* funcstat -> FUNCTION funcname body */
1470  int ismethod;
1471  expdesc v, b;
1472  luaX_next(ls);  /* skip FUNCTION */
1473  ismethod = funcname(ls, &v);
1474  body(ls, &b, ismethod, line);
1475  luaK_storevar(ls->fs, &v, &b);
1476  luaK_fixline(ls->fs, line);  /* definition `happens' in the first line */
1469   /* funcstat -> FUNCTION funcname body */
1470   int ismethod;
1471   expdesc v, b;
1472   luaX_next(ls);  /* skip FUNCTION */
1473   ismethod = funcname(ls, &v);
1474   body(ls, &b, ismethod, line);
1475   luaK_storevar(ls->fs, &v, &b);
1476   luaK_fixline(ls->fs, line);  /* definition `happens' in the first line */
14771477}
14781478
14791479
14801480static void exprstat (LexState *ls) {
1481  /* stat -> func | assignment */
1482  FuncState *fs = ls->fs;
1483  struct LHS_assign v;
1484  suffixedexp(ls, &v.v);
1485  if (ls->t.token == '=' || ls->t.token == ',') { /* stat -> assignment ? */
1486    v.prev = NULL;
1487    assignment(ls, &v, 1);
1488  }
1489  else {  /* stat -> func */
1490    check_condition(ls, v.v.k == VCALL, "syntax error");
1491    SETARG_C(getcode(fs, &v.v), 1);  /* call statement uses no results */
1492  }
1481   /* stat -> func | assignment */
1482   FuncState *fs = ls->fs;
1483   struct LHS_assign v;
1484   suffixedexp(ls, &v.v);
1485   if (ls->t.token == '=' || ls->t.token == ',') { /* stat -> assignment ? */
1486   v.prev = NULL;
1487   assignment(ls, &v, 1);
1488   }
1489   else {  /* stat -> func */
1490   check_condition(ls, v.v.k == VCALL, "syntax error");
1491   SETARG_C(getcode(fs, &v.v), 1);  /* call statement uses no results */
1492   }
14931493}
14941494
14951495
14961496static void retstat (LexState *ls) {
1497  /* stat -> RETURN [explist] [';'] */
1498  FuncState *fs = ls->fs;
1499  expdesc e;
1500  int first, nret;  /* registers with returned values */
1501  if (block_follow(ls, 1) || ls->t.token == ';')
1502    first = nret = 0;  /* return no values */
1503  else {
1504    nret = explist(ls, &e);  /* optional return values */
1505    if (hasmultret(e.k)) {
1506      luaK_setmultret(fs, &e);
1507      if (e.k == VCALL && nret == 1) {  /* tail call? */
1508        SET_OPCODE(getcode(fs,&e), OP_TAILCALL);
1509        lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar);
1510      }
1511      first = fs->nactvar;
1512      nret = LUA_MULTRET;  /* return all values */
1513    }
1514    else {
1515      if (nret == 1)  /* only one single value? */
1516        first = luaK_exp2anyreg(fs, &e);
1517      else {
1518        luaK_exp2nextreg(fs, &e);  /* values must go to the `stack' */
1519        first = fs->nactvar;  /* return all `active' values */
1520        lua_assert(nret == fs->freereg - first);
1521      }
1522    }
1523  }
1524  luaK_ret(fs, first, nret);
1525  testnext(ls, ';');  /* skip optional semicolon */
1497   /* stat -> RETURN [explist] [';'] */
1498   FuncState *fs = ls->fs;
1499   expdesc e;
1500   int first, nret;  /* registers with returned values */
1501   if (block_follow(ls, 1) || ls->t.token == ';')
1502   first = nret = 0;  /* return no values */
1503   else {
1504   nret = explist(ls, &e);  /* optional return values */
1505   if (hasmultret(e.k)) {
1506      luaK_setmultret(fs, &e);
1507      if (e.k == VCALL && nret == 1) {  /* tail call? */
1508      SET_OPCODE(getcode(fs,&e), OP_TAILCALL);
1509      lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar);
1510      }
1511      first = fs->nactvar;
1512      nret = LUA_MULTRET;  /* return all values */
1513   }
1514   else {
1515      if (nret == 1)  /* only one single value? */
1516      first = luaK_exp2anyreg(fs, &e);
1517      else {
1518      luaK_exp2nextreg(fs, &e);  /* values must go to the `stack' */
1519      first = fs->nactvar;  /* return all `active' values */
1520      lua_assert(nret == fs->freereg - first);
1521      }
1522   }
1523   }
1524   luaK_ret(fs, first, nret);
1525   testnext(ls, ';');  /* skip optional semicolon */
15261526}
15271527
15281528
15291529static void statement (LexState *ls) {
1530  int line = ls->linenumber;  /* may be needed for error messages */
1531  enterlevel(ls);
1532  switch (ls->t.token) {
1533    case ';': {  /* stat -> ';' (empty statement) */
1534      luaX_next(ls);  /* skip ';' */
1535      break;
1536    }
1537    case TK_IF: {  /* stat -> ifstat */
1538      ifstat(ls, line);
1539      break;
1540    }
1541    case TK_WHILE: {  /* stat -> whilestat */
1542      whilestat(ls, line);
1543      break;
1544    }
1545    case TK_DO: {  /* stat -> DO block END */
1546      luaX_next(ls);  /* skip DO */
1547      block(ls);
1548      check_match(ls, TK_END, TK_DO, line);
1549      break;
1550    }
1551    case TK_FOR: {  /* stat -> forstat */
1552      forstat(ls, line);
1553      break;
1554    }
1555    case TK_REPEAT: {  /* stat -> repeatstat */
1556      repeatstat(ls, line);
1557      break;
1558    }
1559    case TK_FUNCTION: {  /* stat -> funcstat */
1560      funcstat(ls, line);
1561      break;
1562    }
1563    case TK_LOCAL: {  /* stat -> localstat */
1564      luaX_next(ls);  /* skip LOCAL */
1565      if (testnext(ls, TK_FUNCTION))  /* local function? */
1566        localfunc(ls);
1567      else
1568        localstat(ls);
1569      break;
1570    }
1571    case TK_DBCOLON: {  /* stat -> label */
1572      luaX_next(ls);  /* skip double colon */
1573      labelstat(ls, str_checkname(ls), line);
1574      break;
1575    }
1576    case TK_RETURN: {  /* stat -> retstat */
1577      luaX_next(ls);  /* skip RETURN */
1578      retstat(ls);
1579      break;
1580    }
1581    case TK_BREAK:   /* stat -> breakstat */
1582    case TK_GOTO: {  /* stat -> 'goto' NAME */
1583      gotostat(ls, luaK_jump(ls->fs));
1584      break;
1585    }
1586    default: {  /* stat -> func | assignment */
1587      exprstat(ls);
1588      break;
1589    }
1590  }
1591  lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg &&
1592             ls->fs->freereg >= ls->fs->nactvar);
1593  ls->fs->freereg = ls->fs->nactvar;  /* free registers */
1594  leavelevel(ls);
1530   int line = ls->linenumber;  /* may be needed for error messages */
1531   enterlevel(ls);
1532   switch (ls->t.token) {
1533   case ';': {  /* stat -> ';' (empty statement) */
1534      luaX_next(ls);  /* skip ';' */
1535      break;
1536   }
1537   case TK_IF: {  /* stat -> ifstat */
1538      ifstat(ls, line);
1539      break;
1540   }
1541   case TK_WHILE: {  /* stat -> whilestat */
1542      whilestat(ls, line);
1543      break;
1544   }
1545   case TK_DO: {  /* stat -> DO block END */
1546      luaX_next(ls);  /* skip DO */
1547      block(ls);
1548      check_match(ls, TK_END, TK_DO, line);
1549      break;
1550   }
1551   case TK_FOR: {  /* stat -> forstat */
1552      forstat(ls, line);
1553      break;
1554   }
1555   case TK_REPEAT: {  /* stat -> repeatstat */
1556      repeatstat(ls, line);
1557      break;
1558   }
1559   case TK_FUNCTION: {  /* stat -> funcstat */
1560      funcstat(ls, line);
1561      break;
1562   }
1563   case TK_LOCAL: {  /* stat -> localstat */
1564      luaX_next(ls);  /* skip LOCAL */
1565      if (testnext(ls, TK_FUNCTION))  /* local function? */
1566      localfunc(ls);
1567      else
1568      localstat(ls);
1569      break;
1570   }
1571   case TK_DBCOLON: {  /* stat -> label */
1572      luaX_next(ls);  /* skip double colon */
1573      labelstat(ls, str_checkname(ls), line);
1574      break;
1575   }
1576   case TK_RETURN: {  /* stat -> retstat */
1577      luaX_next(ls);  /* skip RETURN */
1578      retstat(ls);
1579      break;
1580   }
1581   case TK_BREAK:   /* stat -> breakstat */
1582   case TK_GOTO: {  /* stat -> 'goto' NAME */
1583      gotostat(ls, luaK_jump(ls->fs));
1584      break;
1585   }
1586   default: {  /* stat -> func | assignment */
1587      exprstat(ls);
1588      break;
1589   }
1590   }
1591   lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg &&
1592            ls->fs->freereg >= ls->fs->nactvar);
1593   ls->fs->freereg = ls->fs->nactvar;  /* free registers */
1594   leavelevel(ls);
15951595}
15961596
15971597/* }====================================================================== */
r31373r31374
16021602** upvalue named LUA_ENV
16031603*/
16041604static void mainfunc (LexState *ls, FuncState *fs) {
1605  BlockCnt bl;
1606  expdesc v;
1607  open_func(ls, fs, &bl);
1608  fs->f->is_vararg = 1;  /* main function is always vararg */
1609  init_exp(&v, VLOCAL, 0);  /* create and... */
1610  newupvalue(fs, ls->envn, &v);  /* ...set environment upvalue */
1611  luaX_next(ls);  /* read first token */
1612  statlist(ls);  /* parse main body */
1613  check(ls, TK_EOS);
1614  close_func(ls);
1605   BlockCnt bl;
1606   expdesc v;
1607   open_func(ls, fs, &bl);
1608   fs->f->is_vararg = 1;  /* main function is always vararg */
1609   init_exp(&v, VLOCAL, 0);  /* create and... */
1610   newupvalue(fs, ls->envn, &v);  /* ...set environment upvalue */
1611   luaX_next(ls);  /* read first token */
1612   statlist(ls);  /* parse main body */
1613   check(ls, TK_EOS);
1614   close_func(ls);
16151615}
16161616
16171617
16181618Closure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
1619                      Dyndata *dyd, const char *name, int firstchar) {
1620  LexState lexstate;
1621  FuncState funcstate;
1622  Closure *cl = luaF_newLclosure(L, 1);  /* create main closure */
1623  /* anchor closure (to avoid being collected) */
1624  setclLvalue(L, L->top, cl);
1625  incr_top(L);
1626  funcstate.f = cl->l.p = luaF_newproto(L);
1627  funcstate.f->source = luaS_new(L, name);  /* create and anchor TString */
1628  lexstate.buff = buff;
1629  lexstate.dyd = dyd;
1630  dyd->actvar.n = dyd->gt.n = dyd->label.n = 0;
1631  luaX_setinput(L, &lexstate, z, funcstate.f->source, firstchar);
1632  mainfunc(&lexstate, &funcstate);
1633  lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs);
1634  /* all scopes should be correctly finished */
1635  lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0);
1636  return cl;  /* it's on the stack too */
1619                  Dyndata *dyd, const char *name, int firstchar) {
1620   LexState lexstate;
1621   FuncState funcstate;
1622   Closure *cl = luaF_newLclosure(L, 1);  /* create main closure */
1623   /* anchor closure (to avoid being collected) */
1624   setclLvalue(L, L->top, cl);
1625   incr_top(L);
1626   funcstate.f = cl->l.p = luaF_newproto(L);
1627   funcstate.f->source = luaS_new(L, name);  /* create and anchor TString */
1628   lexstate.buff = buff;
1629   lexstate.dyd = dyd;
1630   dyd->actvar.n = dyd->gt.n = dyd->label.n = 0;
1631   luaX_setinput(L, &lexstate, z, funcstate.f->source, firstchar);
1632   mainfunc(&lexstate, &funcstate);
1633   lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs);
1634   /* all scopes should be correctly finished */
1635   lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0);
1636   return cl;  /* it's on the stack too */
16371637}
1638
trunk/src/lib/lua/lopcodes.c
r31373r31374
1515/* ORDER OP */
1616
1717LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = {
18  "MOVE",
19  "LOADK",
20  "LOADKX",
21  "LOADBOOL",
22  "LOADNIL",
23  "GETUPVAL",
24  "GETTABUP",
25  "GETTABLE",
26  "SETTABUP",
27  "SETUPVAL",
28  "SETTABLE",
29  "NEWTABLE",
30  "SELF",
31  "ADD",
32  "SUB",
33  "MUL",
34  "DIV",
35  "MOD",
36  "POW",
37  "UNM",
38  "NOT",
39  "LEN",
40  "CONCAT",
41  "JMP",
42  "EQ",
43  "LT",
44  "LE",
45  "TEST",
46  "TESTSET",
47  "CALL",
48  "TAILCALL",
49  "RETURN",
50  "FORLOOP",
51  "FORPREP",
52  "TFORCALL",
53  "TFORLOOP",
54  "SETLIST",
55  "CLOSURE",
56  "VARARG",
57  "EXTRAARG",
58  NULL
18   "MOVE",
19   "LOADK",
20   "LOADKX",
21   "LOADBOOL",
22   "LOADNIL",
23   "GETUPVAL",
24   "GETTABUP",
25   "GETTABLE",
26   "SETTABUP",
27   "SETUPVAL",
28   "SETTABLE",
29   "NEWTABLE",
30   "SELF",
31   "ADD",
32   "SUB",
33   "MUL",
34   "DIV",
35   "MOD",
36   "POW",
37   "UNM",
38   "NOT",
39   "LEN",
40   "CONCAT",
41   "JMP",
42   "EQ",
43   "LT",
44   "LE",
45   "TEST",
46   "TESTSET",
47   "CALL",
48   "TAILCALL",
49   "RETURN",
50   "FORLOOP",
51   "FORPREP",
52   "TFORCALL",
53   "TFORLOOP",
54   "SETLIST",
55   "CLOSURE",
56   "VARARG",
57   "EXTRAARG",
58   NULL
5959};
6060
6161
6262#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m))
6363
6464LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
65/*       T  A    B       C     mode         opcode   */
66  opmode(0, 1, OpArgR, OpArgN, iABC)      /* OP_MOVE */
67 ,opmode(0, 1, OpArgK, OpArgN, iABx)      /* OP_LOADK */
68 ,opmode(0, 1, OpArgN, OpArgN, iABx)      /* OP_LOADKX */
69 ,opmode(0, 1, OpArgU, OpArgU, iABC)      /* OP_LOADBOOL */
70 ,opmode(0, 1, OpArgU, OpArgN, iABC)      /* OP_LOADNIL */
71 ,opmode(0, 1, OpArgU, OpArgN, iABC)      /* OP_GETUPVAL */
72 ,opmode(0, 1, OpArgU, OpArgK, iABC)      /* OP_GETTABUP */
73 ,opmode(0, 1, OpArgR, OpArgK, iABC)      /* OP_GETTABLE */
74 ,opmode(0, 0, OpArgK, OpArgK, iABC)      /* OP_SETTABUP */
75 ,opmode(0, 0, OpArgU, OpArgN, iABC)      /* OP_SETUPVAL */
76 ,opmode(0, 0, OpArgK, OpArgK, iABC)      /* OP_SETTABLE */
77 ,opmode(0, 1, OpArgU, OpArgU, iABC)      /* OP_NEWTABLE */
78 ,opmode(0, 1, OpArgR, OpArgK, iABC)      /* OP_SELF */
79 ,opmode(0, 1, OpArgK, OpArgK, iABC)      /* OP_ADD */
80 ,opmode(0, 1, OpArgK, OpArgK, iABC)      /* OP_SUB */
81 ,opmode(0, 1, OpArgK, OpArgK, iABC)      /* OP_MUL */
82 ,opmode(0, 1, OpArgK, OpArgK, iABC)      /* OP_DIV */
83 ,opmode(0, 1, OpArgK, OpArgK, iABC)      /* OP_MOD */
84 ,opmode(0, 1, OpArgK, OpArgK, iABC)      /* OP_POW */
85 ,opmode(0, 1, OpArgR, OpArgN, iABC)      /* OP_UNM */
86 ,opmode(0, 1, OpArgR, OpArgN, iABC)      /* OP_NOT */
87 ,opmode(0, 1, OpArgR, OpArgN, iABC)      /* OP_LEN */
88 ,opmode(0, 1, OpArgR, OpArgR, iABC)      /* OP_CONCAT */
89 ,opmode(0, 0, OpArgR, OpArgN, iAsBx)      /* OP_JMP */
90 ,opmode(1, 0, OpArgK, OpArgK, iABC)      /* OP_EQ */
91 ,opmode(1, 0, OpArgK, OpArgK, iABC)      /* OP_LT */
92 ,opmode(1, 0, OpArgK, OpArgK, iABC)      /* OP_LE */
93 ,opmode(1, 0, OpArgN, OpArgU, iABC)      /* OP_TEST */
94 ,opmode(1, 1, OpArgR, OpArgU, iABC)      /* OP_TESTSET */
95 ,opmode(0, 1, OpArgU, OpArgU, iABC)      /* OP_CALL */
96 ,opmode(0, 1, OpArgU, OpArgU, iABC)      /* OP_TAILCALL */
97 ,opmode(0, 0, OpArgU, OpArgN, iABC)      /* OP_RETURN */
98 ,opmode(0, 1, OpArgR, OpArgN, iAsBx)      /* OP_FORLOOP */
99 ,opmode(0, 1, OpArgR, OpArgN, iAsBx)      /* OP_FORPREP */
100 ,opmode(0, 0, OpArgN, OpArgU, iABC)      /* OP_TFORCALL */
101 ,opmode(0, 1, OpArgR, OpArgN, iAsBx)      /* OP_TFORLOOP */
102 ,opmode(0, 0, OpArgU, OpArgU, iABC)      /* OP_SETLIST */
103 ,opmode(0, 1, OpArgU, OpArgN, iABx)      /* OP_CLOSURE */
104 ,opmode(0, 1, OpArgU, OpArgN, iABC)      /* OP_VARARG */
105 ,opmode(0, 0, OpArgU, OpArgU, iAx)      /* OP_EXTRAARG */
65/*       T  A    B       C     mode        opcode   */
66   opmode(0, 1, OpArgR, OpArgN, iABC)      /* OP_MOVE */
67   ,opmode(0, 1, OpArgK, OpArgN, iABx)     /* OP_LOADK */
68   ,opmode(0, 1, OpArgN, OpArgN, iABx)     /* OP_LOADKX */
69   ,opmode(0, 1, OpArgU, OpArgU, iABC)     /* OP_LOADBOOL */
70   ,opmode(0, 1, OpArgU, OpArgN, iABC)     /* OP_LOADNIL */
71   ,opmode(0, 1, OpArgU, OpArgN, iABC)     /* OP_GETUPVAL */
72   ,opmode(0, 1, OpArgU, OpArgK, iABC)     /* OP_GETTABUP */
73   ,opmode(0, 1, OpArgR, OpArgK, iABC)     /* OP_GETTABLE */
74   ,opmode(0, 0, OpArgK, OpArgK, iABC)     /* OP_SETTABUP */
75   ,opmode(0, 0, OpArgU, OpArgN, iABC)     /* OP_SETUPVAL */
76   ,opmode(0, 0, OpArgK, OpArgK, iABC)     /* OP_SETTABLE */
77   ,opmode(0, 1, OpArgU, OpArgU, iABC)     /* OP_NEWTABLE */
78   ,opmode(0, 1, OpArgR, OpArgK, iABC)     /* OP_SELF */
79   ,opmode(0, 1, OpArgK, OpArgK, iABC)     /* OP_ADD */
80   ,opmode(0, 1, OpArgK, OpArgK, iABC)     /* OP_SUB */
81   ,opmode(0, 1, OpArgK, OpArgK, iABC)     /* OP_MUL */
82   ,opmode(0, 1, OpArgK, OpArgK, iABC)     /* OP_DIV */
83   ,opmode(0, 1, OpArgK, OpArgK, iABC)     /* OP_MOD */
84   ,opmode(0, 1, OpArgK, OpArgK, iABC)     /* OP_POW */
85   ,opmode(0, 1, OpArgR, OpArgN, iABC)     /* OP_UNM */
86   ,opmode(0, 1, OpArgR, OpArgN, iABC)     /* OP_NOT */
87   ,opmode(0, 1, OpArgR, OpArgN, iABC)     /* OP_LEN */
88   ,opmode(0, 1, OpArgR, OpArgR, iABC)     /* OP_CONCAT */
89   ,opmode(0, 0, OpArgR, OpArgN, iAsBx)        /* OP_JMP */
90   ,opmode(1, 0, OpArgK, OpArgK, iABC)     /* OP_EQ */
91   ,opmode(1, 0, OpArgK, OpArgK, iABC)     /* OP_LT */
92   ,opmode(1, 0, OpArgK, OpArgK, iABC)     /* OP_LE */
93   ,opmode(1, 0, OpArgN, OpArgU, iABC)     /* OP_TEST */
94   ,opmode(1, 1, OpArgR, OpArgU, iABC)     /* OP_TESTSET */
95   ,opmode(0, 1, OpArgU, OpArgU, iABC)     /* OP_CALL */
96   ,opmode(0, 1, OpArgU, OpArgU, iABC)     /* OP_TAILCALL */
97   ,opmode(0, 0, OpArgU, OpArgN, iABC)     /* OP_RETURN */
98   ,opmode(0, 1, OpArgR, OpArgN, iAsBx)        /* OP_FORLOOP */
99   ,opmode(0, 1, OpArgR, OpArgN, iAsBx)        /* OP_FORPREP */
100   ,opmode(0, 0, OpArgN, OpArgU, iABC)     /* OP_TFORCALL */
101   ,opmode(0, 1, OpArgR, OpArgN, iAsBx)        /* OP_TFORLOOP */
102   ,opmode(0, 0, OpArgU, OpArgU, iABC)     /* OP_SETLIST */
103   ,opmode(0, 1, OpArgU, OpArgN, iABx)     /* OP_CLOSURE */
104   ,opmode(0, 1, OpArgU, OpArgN, iABC)     /* OP_VARARG */
105   ,opmode(0, 0, OpArgU, OpArgU, iAx)      /* OP_EXTRAARG */
106106};
107
trunk/src/lib/lua/lbaselib.c
r31373r31374
2121
2222
2323static int luaB_print (lua_State *L) {
24  int n = lua_gettop(L);  /* number of arguments */
25  int i;
26  lua_getglobal(L, "tostring");
27  for (i=1; i<=n; i++) {
28    const char *s;
29    size_t l;
30    lua_pushvalue(L, -1);  /* function to be called */
31    lua_pushvalue(L, i);   /* value to print */
32    lua_call(L, 1, 1);
33    s = lua_tolstring(L, -1, &l);  /* get result */
34    if (s == NULL)
35      return luaL_error(L,
36         LUA_QL("tostring") " must return a string to " LUA_QL("print"));
37    if (i>1) luai_writestring("\t", 1);
38    luai_writestring(s, l);
39    lua_pop(L, 1);  /* pop result */
40  }
41  luai_writeline();
42  return 0;
24   int n = lua_gettop(L);  /* number of arguments */
25   int i;
26   lua_getglobal(L, "tostring");
27   for (i=1; i<=n; i++) {
28   const char *s;
29   size_t l;
30   lua_pushvalue(L, -1);  /* function to be called */
31   lua_pushvalue(L, i);   /* value to print */
32   lua_call(L, 1, 1);
33   s = lua_tolstring(L, -1, &l);  /* get result */
34   if (s == NULL)
35      return luaL_error(L,
36         LUA_QL("tostring") " must return a string to " LUA_QL("print"));
37   if (i>1) luai_writestring("\t", 1);
38   luai_writestring(s, l);
39   lua_pop(L, 1);  /* pop result */
40   }
41   luai_writeline();
42   return 0;
4343}
4444
4545
46#define SPACECHARS   " \f\n\r\t\v"
46#define SPACECHARS  " \f\n\r\t\v"
4747
4848static int luaB_tonumber (lua_State *L) {
49  if (lua_isnoneornil(L, 2)) {  /* standard conversion */
50    int isnum;
51    lua_Number n = lua_tonumberx(L, 1, &isnum);
52    if (isnum) {
53      lua_pushnumber(L, n);
54      return 1;
55    }  /* else not a number; must be something */
56    luaL_checkany(L, 1);
57  }
58  else {
59    size_t l;
60    const char *s = luaL_checklstring(L, 1, &l);
61    const char *e = s + l;  /* end point for 's' */
62    int base = luaL_checkint(L, 2);
63    int neg = 0;
64    luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range");
65    s += strspn(s, SPACECHARS);  /* skip initial spaces */
66    if (*s == '-') { s++; neg = 1; }  /* handle signal */
67    else if (*s == '+') s++;
68    if (isalnum((unsigned char)*s)) {
69      lua_Number n = 0;
70      do {
71        int digit = (isdigit((unsigned char)*s)) ? *s - '0'
72                       : toupper((unsigned char)*s) - 'A' + 10;
73        if (digit >= base) break;  /* invalid numeral; force a fail */
74        n = n * (lua_Number)base + (lua_Number)digit;
75        s++;
76      } while (isalnum((unsigned char)*s));
77      s += strspn(s, SPACECHARS);  /* skip trailing spaces */
78      if (s == e) {  /* no invalid trailing characters? */
79        lua_pushnumber(L, (neg) ? -n : n);
80        return 1;
81      }  /* else not a number */
82    }  /* else not a number */
83  }
84  lua_pushnil(L);  /* not a number */
85  return 1;
49   if (lua_isnoneornil(L, 2)) {  /* standard conversion */
50   int isnum;
51   lua_Number n = lua_tonumberx(L, 1, &isnum);
52   if (isnum) {
53      lua_pushnumber(L, n);
54      return 1;
55   }  /* else not a number; must be something */
56   luaL_checkany(L, 1);
57   }
58   else {
59   size_t l;
60   const char *s = luaL_checklstring(L, 1, &l);
61   const char *e = s + l;  /* end point for 's' */
62   int base = luaL_checkint(L, 2);
63   int neg = 0;
64   luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range");
65   s += strspn(s, SPACECHARS);  /* skip initial spaces */
66   if (*s == '-') { s++; neg = 1; }  /* handle signal */
67   else if (*s == '+') s++;
68   if (isalnum((unsigned char)*s)) {
69      lua_Number n = 0;
70      do {
71      int digit = (isdigit((unsigned char)*s)) ? *s - '0'
72                  : toupper((unsigned char)*s) - 'A' + 10;
73      if (digit >= base) break;  /* invalid numeral; force a fail */
74      n = n * (lua_Number)base + (lua_Number)digit;
75      s++;
76      } while (isalnum((unsigned char)*s));
77      s += strspn(s, SPACECHARS);  /* skip trailing spaces */
78      if (s == e) {  /* no invalid trailing characters? */
79      lua_pushnumber(L, (neg) ? -n : n);
80      return 1;
81      }  /* else not a number */
82   }  /* else not a number */
83   }
84   lua_pushnil(L);  /* not a number */
85   return 1;
8686}
8787
8888
8989static int luaB_error (lua_State *L) {
90  int level = luaL_optint(L, 2, 1);
91  lua_settop(L, 1);
92  if (lua_isstring(L, 1) && level > 0) {  /* add extra information? */
93    luaL_where(L, level);
94    lua_pushvalue(L, 1);
95    lua_concat(L, 2);
96  }
97  return lua_error(L);
90   int level = luaL_optint(L, 2, 1);
91   lua_settop(L, 1);
92   if (lua_isstring(L, 1) && level > 0) {  /* add extra information? */
93   luaL_where(L, level);
94   lua_pushvalue(L, 1);
95   lua_concat(L, 2);
96   }
97   return lua_error(L);
9898}
9999
100100
101101static int luaB_getmetatable (lua_State *L) {
102  luaL_checkany(L, 1);
103  if (!lua_getmetatable(L, 1)) {
104    lua_pushnil(L);
105    return 1;  /* no metatable */
106  }
107  luaL_getmetafield(L, 1, "__metatable");
108  return 1;  /* returns either __metatable field (if present) or metatable */
102   luaL_checkany(L, 1);
103   if (!lua_getmetatable(L, 1)) {
104   lua_pushnil(L);
105   return 1;  /* no metatable */
106   }
107   luaL_getmetafield(L, 1, "__metatable");
108   return 1;  /* returns either __metatable field (if present) or metatable */
109109}
110110
111111
112112static int luaB_setmetatable (lua_State *L) {
113  int t = lua_type(L, 2);
114  luaL_checktype(L, 1, LUA_TTABLE);
115  luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
116                    "nil or table expected");
117  if (luaL_getmetafield(L, 1, "__metatable"))
118    return luaL_error(L, "cannot change a protected metatable");
119  lua_settop(L, 2);
120  lua_setmetatable(L, 1);
121  return 1;
113   int t = lua_type(L, 2);
114   luaL_checktype(L, 1, LUA_TTABLE);
115   luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
116               "nil or table expected");
117   if (luaL_getmetafield(L, 1, "__metatable"))
118   return luaL_error(L, "cannot change a protected metatable");
119   lua_settop(L, 2);
120   lua_setmetatable(L, 1);
121   return 1;
122122}
123123
124124
125125static int luaB_rawequal (lua_State *L) {
126  luaL_checkany(L, 1);
127  luaL_checkany(L, 2);
128  lua_pushboolean(L, lua_rawequal(L, 1, 2));
129  return 1;
126   luaL_checkany(L, 1);
127   luaL_checkany(L, 2);
128   lua_pushboolean(L, lua_rawequal(L, 1, 2));
129   return 1;
130130}
131131
132132
133133static int luaB_rawlen (lua_State *L) {
134  int t = lua_type(L, 1);
135  luaL_argcheck(L, t == LUA_TTABLE || t == LUA_TSTRING, 1,
136                   "table or string expected");
137  lua_pushinteger(L, lua_rawlen(L, 1));
138  return 1;
134   int t = lua_type(L, 1);
135   luaL_argcheck(L, t == LUA_TTABLE || t == LUA_TSTRING, 1,
136               "table or string expected");
137   lua_pushinteger(L, lua_rawlen(L, 1));
138   return 1;
139139}
140140
141141
142142static int luaB_rawget (lua_State *L) {
143  luaL_checktype(L, 1, LUA_TTABLE);
144  luaL_checkany(L, 2);
145  lua_settop(L, 2);
146  lua_rawget(L, 1);
147  return 1;
143   luaL_checktype(L, 1, LUA_TTABLE);
144   luaL_checkany(L, 2);
145   lua_settop(L, 2);
146   lua_rawget(L, 1);
147   return 1;
148148}
149149
150150static int luaB_rawset (lua_State *L) {
151  luaL_checktype(L, 1, LUA_TTABLE);
152  luaL_checkany(L, 2);
153  luaL_checkany(L, 3);
154  lua_settop(L, 3);
155  lua_rawset(L, 1);
156  return 1;
151   luaL_checktype(L, 1, LUA_TTABLE);
152   luaL_checkany(L, 2);
153   luaL_checkany(L, 3);
154   lua_settop(L, 3);
155   lua_rawset(L, 1);
156   return 1;
157157}
158158
159159
160160static int luaB_collectgarbage (lua_State *L) {
161  static const char *const opts[] = {"stop", "restart", "collect",
162    "count", "step", "setpause", "setstepmul",
163    "setmajorinc", "isrunning", "generational", "incremental", NULL};
164  static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,
165    LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL,
166    LUA_GCSETMAJORINC, LUA_GCISRUNNING, LUA_GCGEN, LUA_GCINC};
167  int o = optsnum[luaL_checkoption(L, 1, "collect", opts)];
168  int ex = luaL_optint(L, 2, 0);
169  int res = lua_gc(L, o, ex);
170  switch (o) {
171    case LUA_GCCOUNT: {
172      int b = lua_gc(L, LUA_GCCOUNTB, 0);
173      lua_pushnumber(L, res + ((lua_Number)b/1024));
174      lua_pushinteger(L, b);
175      return 2;
176    }
177    case LUA_GCSTEP: case LUA_GCISRUNNING: {
178      lua_pushboolean(L, res);
179      return 1;
180    }
181    default: {
182      lua_pushinteger(L, res);
183      return 1;
184    }
185  }
161   static const char *const opts[] = {"stop", "restart", "collect",
162   "count", "step", "setpause", "setstepmul",
163   "setmajorinc", "isrunning", "generational", "incremental", NULL};
164   static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT,
165   LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL,
166   LUA_GCSETMAJORINC, LUA_GCISRUNNING, LUA_GCGEN, LUA_GCINC};
167   int o = optsnum[luaL_checkoption(L, 1, "collect", opts)];
168   int ex = luaL_optint(L, 2, 0);
169   int res = lua_gc(L, o, ex);
170   switch (o) {
171   case LUA_GCCOUNT: {
172      int b = lua_gc(L, LUA_GCCOUNTB, 0);
173      lua_pushnumber(L, res + ((lua_Number)b/1024));
174      lua_pushinteger(L, b);
175      return 2;
176   }
177   case LUA_GCSTEP: case LUA_GCISRUNNING: {
178      lua_pushboolean(L, res);
179      return 1;
180   }
181   default: {
182      lua_pushinteger(L, res);
183      return 1;
184   }
185   }
186186}
187187
188188
189189static int luaB_type (lua_State *L) {
190  luaL_checkany(L, 1);
191  lua_pushstring(L, luaL_typename(L, 1));
192  return 1;
190   luaL_checkany(L, 1);
191   lua_pushstring(L, luaL_typename(L, 1));
192   return 1;
193193}
194194
195195
196196static int pairsmeta (lua_State *L, const char *method, int iszero,
197                      lua_CFunction iter) {
198  if (!luaL_getmetafield(L, 1, method)) {  /* no metamethod? */
199    luaL_checktype(L, 1, LUA_TTABLE);  /* argument must be a table */
200    lua_pushcfunction(L, iter);  /* will return generator, */
201    lua_pushvalue(L, 1);  /* state, */
202    if (iszero) lua_pushinteger(L, 0);  /* and initial value */
203    else lua_pushnil(L);
204  }
205  else {
206    lua_pushvalue(L, 1);  /* argument 'self' to metamethod */
207    lua_call(L, 1, 3);  /* get 3 values from metamethod */
208  }
209  return 3;
197                  lua_CFunction iter) {
198   if (!luaL_getmetafield(L, 1, method)) {  /* no metamethod? */
199   luaL_checktype(L, 1, LUA_TTABLE);  /* argument must be a table */
200   lua_pushcfunction(L, iter);  /* will return generator, */
201   lua_pushvalue(L, 1);  /* state, */
202   if (iszero) lua_pushinteger(L, 0);  /* and initial value */
203   else lua_pushnil(L);
204   }
205   else {
206   lua_pushvalue(L, 1);  /* argument 'self' to metamethod */
207   lua_call(L, 1, 3);  /* get 3 values from metamethod */
208   }
209   return 3;
210210}
211211
212212
213213static int luaB_next (lua_State *L) {
214  luaL_checktype(L, 1, LUA_TTABLE);
215  lua_settop(L, 2);  /* create a 2nd argument if there isn't one */
216  if (lua_next(L, 1))
217    return 2;
218  else {
219    lua_pushnil(L);
220    return 1;
221  }
214   luaL_checktype(L, 1, LUA_TTABLE);
215   lua_settop(L, 2);  /* create a 2nd argument if there isn't one */
216   if (lua_next(L, 1))
217   return 2;
218   else {
219   lua_pushnil(L);
220   return 1;
221   }
222222}
223223
224224
225225static int luaB_pairs (lua_State *L) {
226  return pairsmeta(L, "__pairs", 0, luaB_next);
226   return pairsmeta(L, "__pairs", 0, luaB_next);
227227}
228228
229229
230230static int ipairsaux (lua_State *L) {
231  int i = luaL_checkint(L, 2);
232  luaL_checktype(L, 1, LUA_TTABLE);
233  i++;  /* next value */
234  lua_pushinteger(L, i);
235  lua_rawgeti(L, 1, i);
236  return (lua_isnil(L, -1)) ? 1 : 2;
231   int i = luaL_checkint(L, 2);
232   luaL_checktype(L, 1, LUA_TTABLE);
233   i++;  /* next value */
234   lua_pushinteger(L, i);
235   lua_rawgeti(L, 1, i);
236   return (lua_isnil(L, -1)) ? 1 : 2;
237237}
238238
239239
240240static int luaB_ipairs (lua_State *L) {
241  return pairsmeta(L, "__ipairs", 1, ipairsaux);
241   return pairsmeta(L, "__ipairs", 1, ipairsaux);
242242}
243243
244244
245245static int load_aux (lua_State *L, int status, int envidx) {
246  if (status == LUA_OK) {
247    if (envidx != 0) {  /* 'env' parameter? */
248      lua_pushvalue(L, envidx);  /* environment for loaded function */
249      if (!lua_setupvalue(L, -2, 1))  /* set it as 1st upvalue */
250        lua_pop(L, 1);  /* remove 'env' if not used by previous call */
251    }
252    return 1;
253  }
254  else {  /* error (message is on top of the stack) */
255    lua_pushnil(L);
256    lua_insert(L, -2);  /* put before error message */
257    return 2;  /* return nil plus error message */
258  }
246   if (status == LUA_OK) {
247   if (envidx != 0) {  /* 'env' parameter? */
248      lua_pushvalue(L, envidx);  /* environment for loaded function */
249      if (!lua_setupvalue(L, -2, 1))  /* set it as 1st upvalue */
250      lua_pop(L, 1);  /* remove 'env' if not used by previous call */
251   }
252   return 1;
253   }
254   else {  /* error (message is on top of the stack) */
255   lua_pushnil(L);
256   lua_insert(L, -2);  /* put before error message */
257   return 2;  /* return nil plus error message */
258   }
259259}
260260
261261
262262static int luaB_loadfile (lua_State *L) {
263  const char *fname = luaL_optstring(L, 1, NULL);
264  const char *mode = luaL_optstring(L, 2, NULL);
265  int env = (!lua_isnone(L, 3) ? 3 : 0);  /* 'env' index or 0 if no 'env' */
266  int status = luaL_loadfilex(L, fname, mode);
267  return load_aux(L, status, env);
263   const char *fname = luaL_optstring(L, 1, NULL);
264   const char *mode = luaL_optstring(L, 2, NULL);
265   int env = (!lua_isnone(L, 3) ? 3 : 0);  /* 'env' index or 0 if no 'env' */
266   int status = luaL_loadfilex(L, fname, mode);
267   return load_aux(L, status, env);
268268}
269269
270270
r31373r31374
280280** string to avoid it being collected while parsed. 'load' has four
281281** optional arguments (chunk, source name, mode, and environment).
282282*/
283#define RESERVEDSLOT   5
283#define RESERVEDSLOT    5
284284
285285
286286/*
r31373r31374
290290** reserved slot inside the stack.
291291*/
292292static const char *generic_reader (lua_State *L, void *ud, size_t *size) {
293  (void)(ud);  /* not used */
294  luaL_checkstack(L, 2, "too many nested functions");
295  lua_pushvalue(L, 1);  /* get function */
296  lua_call(L, 0, 1);  /* call it */
297  if (lua_isnil(L, -1)) {
298    lua_pop(L, 1);  /* pop result */
299    *size = 0;
300    return NULL;
301  }
302  else if (!lua_isstring(L, -1))
303    luaL_error(L, "reader function must return a string");
304  lua_replace(L, RESERVEDSLOT);  /* save string in reserved slot */
305  return lua_tolstring(L, RESERVEDSLOT, size);
293   (void)(ud);  /* not used */
294   luaL_checkstack(L, 2, "too many nested functions");
295   lua_pushvalue(L, 1);  /* get function */
296   lua_call(L, 0, 1);  /* call it */
297   if (lua_isnil(L, -1)) {
298   lua_pop(L, 1);  /* pop result */
299   *size = 0;
300   return NULL;
301   }
302   else if (!lua_isstring(L, -1))
303   luaL_error(L, "reader function must return a string");
304   lua_replace(L, RESERVEDSLOT);  /* save string in reserved slot */
305   return lua_tolstring(L, RESERVEDSLOT, size);
306306}
307307
308308
309309static int luaB_load (lua_State *L) {
310  int status;
311  size_t l;
312  const char *s = lua_tolstring(L, 1, &l);
313  const char *mode = luaL_optstring(L, 3, "bt");
314  int env = (!lua_isnone(L, 4) ? 4 : 0);  /* 'env' index or 0 if no 'env' */
315  if (s != NULL) {  /* loading a string? */
316    const char *chunkname = luaL_optstring(L, 2, s);
317    status = luaL_loadbufferx(L, s, l, chunkname, mode);
318  }
319  else {  /* loading from a reader function */
320    const char *chunkname = luaL_optstring(L, 2, "=(load)");
321    luaL_checktype(L, 1, LUA_TFUNCTION);
322    lua_settop(L, RESERVEDSLOT);  /* create reserved slot */
323    status = lua_load(L, generic_reader, NULL, chunkname, mode);
324  }
325  return load_aux(L, status, env);
310   int status;
311   size_t l;
312   const char *s = lua_tolstring(L, 1, &l);
313   const char *mode = luaL_optstring(L, 3, "bt");
314   int env = (!lua_isnone(L, 4) ? 4 : 0);  /* 'env' index or 0 if no 'env' */
315   if (s != NULL) {  /* loading a string? */
316   const char *chunkname = luaL_optstring(L, 2, s);
317   status = luaL_loadbufferx(L, s, l, chunkname, mode);
318   }
319   else {  /* loading from a reader function */
320   const char *chunkname = luaL_optstring(L, 2, "=(load)");
321   luaL_checktype(L, 1, LUA_TFUNCTION);
322   lua_settop(L, RESERVEDSLOT);  /* create reserved slot */
323   status = lua_load(L, generic_reader, NULL, chunkname, mode);
324   }
325   return load_aux(L, status, env);
326326}
327327
328328/* }====================================================== */
329329
330330
331331static int dofilecont (lua_State *L) {
332  return lua_gettop(L) - 1;
332   return lua_gettop(L) - 1;
333333}
334334
335335
336336static int luaB_dofile (lua_State *L) {
337  const char *fname = luaL_optstring(L, 1, NULL);
338  lua_settop(L, 1);
339  if (luaL_loadfile(L, fname) != LUA_OK)
340    return lua_error(L);
341  lua_callk(L, 0, LUA_MULTRET, 0, dofilecont);
342  return dofilecont(L);
337   const char *fname = luaL_optstring(L, 1, NULL);
338   lua_settop(L, 1);
339   if (luaL_loadfile(L, fname) != LUA_OK)
340   return lua_error(L);
341   lua_callk(L, 0, LUA_MULTRET, 0, dofilecont);
342   return dofilecont(L);
343343}
344344
345345
346346static int luaB_assert (lua_State *L) {
347  if (!lua_toboolean(L, 1))
348    return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!"));
349  return lua_gettop(L);
347   if (!lua_toboolean(L, 1))
348   return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!"));
349   return lua_gettop(L);
350350}
351351
352352
353353static int luaB_select (lua_State *L) {
354  int n = lua_gettop(L);
355  if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {
356    lua_pushinteger(L, n-1);
357    return 1;
358  }
359  else {
360    int i = luaL_checkint(L, 1);
361    if (i < 0) i = n + i;
362    else if (i > n) i = n;
363    luaL_argcheck(L, 1 <= i, 1, "index out of range");
364    return n - i;
365  }
354   int n = lua_gettop(L);
355   if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') {
356   lua_pushinteger(L, n-1);
357   return 1;
358   }
359   else {
360   int i = luaL_checkint(L, 1);
361   if (i < 0) i = n + i;
362   else if (i > n) i = n;
363   luaL_argcheck(L, 1 <= i, 1, "index out of range");
364   return n - i;
365   }
366366}
367367
368368
369369static int finishpcall (lua_State *L, int status) {
370  if (!lua_checkstack(L, 1)) {  /* no space for extra boolean? */
371    lua_settop(L, 0);  /* create space for return values */
372    lua_pushboolean(L, 0);
373    lua_pushstring(L, "stack overflow");
374    return 2;  /* return false, msg */
375  }
376  lua_pushboolean(L, status);  /* first result (status) */
377  lua_replace(L, 1);  /* put first result in first slot */
378  return lua_gettop(L);
370   if (!lua_checkstack(L, 1)) {  /* no space for extra boolean? */
371   lua_settop(L, 0);  /* create space for return values */
372   lua_pushboolean(L, 0);
373   lua_pushstring(L, "stack overflow");
374   return 2;  /* return false, msg */
375   }
376   lua_pushboolean(L, status);  /* first result (status) */
377   lua_replace(L, 1);  /* put first result in first slot */
378   return lua_gettop(L);
379379}
380380
381381
382382static int pcallcont (lua_State *L) {
383  int status = lua_getctx(L, NULL);
384  return finishpcall(L, (status == LUA_YIELD));
383   int status = lua_getctx(L, NULL);
384   return finishpcall(L, (status == LUA_YIELD));
385385}
386386
387387
388388static int luaB_pcall (lua_State *L) {
389  int status;
390  luaL_checkany(L, 1);
391  lua_pushnil(L);
392  lua_insert(L, 1);  /* create space for status result */
393  status = lua_pcallk(L, lua_gettop(L) - 2, LUA_MULTRET, 0, 0, pcallcont);
394  return finishpcall(L, (status == LUA_OK));
389   int status;
390   luaL_checkany(L, 1);
391   lua_pushnil(L);
392   lua_insert(L, 1);  /* create space for status result */
393   status = lua_pcallk(L, lua_gettop(L) - 2, LUA_MULTRET, 0, 0, pcallcont);
394   return finishpcall(L, (status == LUA_OK));
395395}
396396
397397
398398static int luaB_xpcall (lua_State *L) {
399  int status;
400  int n = lua_gettop(L);
401  luaL_argcheck(L, n >= 2, 2, "value expected");
402  lua_pushvalue(L, 1);  /* exchange function... */
403  lua_copy(L, 2, 1);  /* ...and error handler */
404  lua_replace(L, 2);
405  status = lua_pcallk(L, n - 2, LUA_MULTRET, 1, 0, pcallcont);
406  return finishpcall(L, (status == LUA_OK));
399   int status;
400   int n = lua_gettop(L);
401   luaL_argcheck(L, n >= 2, 2, "value expected");
402   lua_pushvalue(L, 1);  /* exchange function... */
403   lua_copy(L, 2, 1);  /* ...and error handler */
404   lua_replace(L, 2);
405   status = lua_pcallk(L, n - 2, LUA_MULTRET, 1, 0, pcallcont);
406   return finishpcall(L, (status == LUA_OK));
407407}
408408
409409
410410static int luaB_tostring (lua_State *L) {
411  luaL_checkany(L, 1);
412  luaL_tolstring(L, 1, NULL);
413  return 1;
411   luaL_checkany(L, 1);
412   luaL_tolstring(L, 1, NULL);
413   return 1;
414414}
415415
416416
417417static const luaL_Reg base_funcs[] = {
418  {"assert", luaB_assert},
419  {"collectgarbage", luaB_collectgarbage},
420  {"dofile", luaB_dofile},
421  {"error", luaB_error},
422  {"getmetatable", luaB_getmetatable},
423  {"ipairs", luaB_ipairs},
424  {"loadfile", luaB_loadfile},
425  {"load", luaB_load},
418   {"assert", luaB_assert},
419   {"collectgarbage", luaB_collectgarbage},
420   {"dofile", luaB_dofile},
421   {"error", luaB_error},
422   {"getmetatable", luaB_getmetatable},
423   {"ipairs", luaB_ipairs},
424   {"loadfile", luaB_loadfile},
425   {"load", luaB_load},
426426#if defined(LUA_COMPAT_LOADSTRING)
427  {"loadstring", luaB_load},
427   {"loadstring", luaB_load},
428428#endif
429  {"next", luaB_next},
430  {"pairs", luaB_pairs},
431  {"pcall", luaB_pcall},
432  {"print", luaB_print},
433  {"rawequal", luaB_rawequal},
434  {"rawlen", luaB_rawlen},
435  {"rawget", luaB_rawget},
436  {"rawset", luaB_rawset},
437  {"select", luaB_select},
438  {"setmetatable", luaB_setmetatable},
439  {"tonumber", luaB_tonumber},
440  {"tostring", luaB_tostring},
441  {"type", luaB_type},
442  {"xpcall", luaB_xpcall},
443  {NULL, NULL}
429   {"next", luaB_next},
430   {"pairs", luaB_pairs},
431   {"pcall", luaB_pcall},
432   {"print", luaB_print},
433   {"rawequal", luaB_rawequal},
434   {"rawlen", luaB_rawlen},
435   {"rawget", luaB_rawget},
436   {"rawset", luaB_rawset},
437   {"select", luaB_select},
438   {"setmetatable", luaB_setmetatable},
439   {"tonumber", luaB_tonumber},
440   {"tostring", luaB_tostring},
441   {"type", luaB_type},
442   {"xpcall", luaB_xpcall},
443   {NULL, NULL}
444444};
445445
446446
447447LUAMOD_API int luaopen_base (lua_State *L) {
448  /* set global _G */
449  lua_pushglobaltable(L);
450  lua_pushglobaltable(L);
451  lua_setfield(L, -2, "_G");
452  /* open lib into global table */
453  luaL_setfuncs(L, base_funcs, 0);
454  lua_pushliteral(L, LUA_VERSION);
455  lua_setfield(L, -2, "_VERSION");  /* set global _VERSION */
456  return 1;
448   /* set global _G */
449   lua_pushglobaltable(L);
450   lua_pushglobaltable(L);
451   lua_setfield(L, -2, "_G");
452   /* open lib into global table */
453   luaL_setfuncs(L, base_funcs, 0);
454   lua_pushliteral(L, LUA_VERSION);
455   lua_setfield(L, -2, "_VERSION");  /* set global _VERSION */
456   return 1;
457457}
458
trunk/src/lib/lua/lzio.c
r31373r31374
1919
2020
2121int luaZ_fill (ZIO *z) {
22  size_t size;
23  lua_State *L = z->L;
24  const char *buff;
25  lua_unlock(L);
26  buff = z->reader(L, z->data, &size);
27  lua_lock(L);
28  if (buff == NULL || size == 0)
29    return EOZ;
30  z->n = size - 1;  /* discount char being returned */
31  z->p = buff;
32  return cast_uchar(*(z->p++));
22   size_t size;
23   lua_State *L = z->L;
24   const char *buff;
25   lua_unlock(L);
26   buff = z->reader(L, z->data, &size);
27   lua_lock(L);
28   if (buff == NULL || size == 0)
29   return EOZ;
30   z->n = size - 1;  /* discount char being returned */
31   z->p = buff;
32   return cast_uchar(*(z->p++));
3333}
3434
3535
3636void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) {
37  z->L = L;
38  z->reader = reader;
39  z->data = data;
40  z->n = 0;
41  z->p = NULL;
37   z->L = L;
38   z->reader = reader;
39   z->data = data;
40   z->n = 0;
41   z->p = NULL;
4242}
4343
4444
4545/* --------------------------------------------------------------- read --- */
4646size_t luaZ_read (ZIO *z, void *b, size_t n) {
47  while (n) {
48    size_t m;
49    if (z->n == 0) {  /* no bytes in buffer? */
50      if (luaZ_fill(z) == EOZ)  /* try to read more */
51        return n;  /* no more input; return number of missing bytes */
52      else {
53        z->n++;  /* luaZ_fill consumed first byte; put it back */
54        z->p--;
55      }
56    }
57    m = (n <= z->n) ? n : z->n;  /* min. between n and z->n */
58    memcpy(b, z->p, m);
59    z->n -= m;
60    z->p += m;
61    b = (char *)b + m;
62    n -= m;
63  }
64  return 0;
47   while (n) {
48   size_t m;
49   if (z->n == 0) {  /* no bytes in buffer? */
50      if (luaZ_fill(z) == EOZ)  /* try to read more */
51      return n;  /* no more input; return number of missing bytes */
52      else {
53      z->n++;  /* luaZ_fill consumed first byte; put it back */
54      z->p--;
55      }
56   }
57   m = (n <= z->n) ? n : z->n;  /* min. between n and z->n */
58   memcpy(b, z->p, m);
59   z->n -= m;
60   z->p += m;
61   b = (char *)b + m;
62   n -= m;
63   }
64   return 0;
6565}
6666
6767/* ------------------------------------------------------------------------ */
6868char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) {
69  if (n > buff->buffsize) {
70    if (n < LUA_MINBUFFER) n = LUA_MINBUFFER;
71    luaZ_resizebuffer(L, buff, n);
72  }
73  return buff->buffer;
69   if (n > buff->buffsize) {
70   if (n < LUA_MINBUFFER) n = LUA_MINBUFFER;
71   luaZ_resizebuffer(L, buff, n);
72   }
73   return buff->buffer;
7474}
75
76
trunk/src/lib/lua/linit.c
r31373r31374
2727** program
2828*/
2929static const luaL_Reg loadedlibs[] = {
30  {"_G", luaopen_base},
31  {LUA_LOADLIBNAME, luaopen_package},
32  {LUA_COLIBNAME, luaopen_coroutine},
33  {LUA_TABLIBNAME, luaopen_table},
34  {LUA_IOLIBNAME, luaopen_io},
35  {LUA_OSLIBNAME, luaopen_os},
36  {LUA_STRLIBNAME, luaopen_string},
37  {LUA_BITLIBNAME, luaopen_bit32},
38  {LUA_MATHLIBNAME, luaopen_math},
39  {LUA_DBLIBNAME, luaopen_debug},
40  {NULL, NULL}
30   {"_G", luaopen_base},
31   {LUA_LOADLIBNAME, luaopen_package},
32   {LUA_COLIBNAME, luaopen_coroutine},
33   {LUA_TABLIBNAME, luaopen_table},
34   {LUA_IOLIBNAME, luaopen_io},
35   {LUA_OSLIBNAME, luaopen_os},
36   {LUA_STRLIBNAME, luaopen_string},
37   {LUA_BITLIBNAME, luaopen_bit32},
38   {LUA_MATHLIBNAME, luaopen_math},
39   {LUA_DBLIBNAME, luaopen_debug},
40   {NULL, NULL}
4141};
4242
4343
r31373r31374
4545** these libs are preloaded and must be required before used
4646*/
4747static const luaL_Reg preloadedlibs[] = {
48  {NULL, NULL}
48   {NULL, NULL}
4949};
5050
5151
5252LUALIB_API void luaL_openlibs (lua_State *L) {
53  const luaL_Reg *lib;
54  /* call open functions from 'loadedlibs' and set results to global table */
55  for (lib = loadedlibs; lib->func; lib++) {
56    luaL_requiref(L, lib->name, lib->func, 1);
57    lua_pop(L, 1);  /* remove lib */
58  }
59  /* add open functions from 'preloadedlibs' into 'package.preload' table */
60  luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
61  for (lib = preloadedlibs; lib->func; lib++) {
62    lua_pushcfunction(L, lib->func);
63    lua_setfield(L, -2, lib->name);
64  }
65  lua_pop(L, 1);  /* remove _PRELOAD table */
53   const luaL_Reg *lib;
54   /* call open functions from 'loadedlibs' and set results to global table */
55   for (lib = loadedlibs; lib->func; lib++) {
56   luaL_requiref(L, lib->name, lib->func, 1);
57   lua_pop(L, 1);  /* remove lib */
58   }
59   /* add open functions from 'preloadedlibs' into 'package.preload' table */
60   luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
61   for (lib = preloadedlibs; lib->func; lib++) {
62   lua_pushcfunction(L, lib->func);
63   lua_setfield(L, -2, lib->name);
64   }
65   lua_pop(L, 1);  /* remove _PRELOAD table */
6666}
67
trunk/src/lib/lua/lua.c
r31373r31374
1919
2020
2121#if !defined(LUA_PROMPT)
22#define LUA_PROMPT      "> "
23#define LUA_PROMPT2      ">> "
22#define LUA_PROMPT      "> "
23#define LUA_PROMPT2     ">> "
2424#endif
2525
2626#if !defined(LUA_PROGNAME)
27#define LUA_PROGNAME      "lua"
27#define LUA_PROGNAME        "lua"
2828#endif
2929
3030#if !defined(LUA_MAXINPUT)
31#define LUA_MAXINPUT      512
31#define LUA_MAXINPUT        512
3232#endif
3333
3434#if !defined(LUA_INIT)
35#define LUA_INIT      "LUA_INIT"
35#define LUA_INIT        "LUA_INIT"
3636#endif
3737
3838#define LUA_INITVERSION  \
r31373r31374
4545*/
4646#if defined(LUA_USE_ISATTY)
4747#include <unistd.h>
48#define lua_stdin_is_tty()   isatty(0)
48#define lua_stdin_is_tty()  isatty(0)
4949#elif defined(LUA_WIN)
5050#include <io.h>
5151#include <stdio.h>
52#define lua_stdin_is_tty()   _isatty(_fileno(stdin))
52#define lua_stdin_is_tty()  _isatty(_fileno(stdin))
5353#else
54#define lua_stdin_is_tty()   1  /* assume stdin is a tty */
54#define lua_stdin_is_tty()  1  /* assume stdin is a tty */
5555#endif
5656
5757
r31373r31374
6666#include <stdio.h>
6767#include <readline/readline.h>
6868#include <readline/history.h>
69#define lua_readline(L,b,p)   ((void)L, ((b)=readline(p)) != NULL)
69#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
7070#define lua_saveline(L,idx) \
71        if (lua_rawlen(L,idx) > 0)  /* non-empty line? */ \
72          add_history(lua_tostring(L, idx));  /* add it to history */
73#define lua_freeline(L,b)   ((void)L, free(b))
71      if (lua_rawlen(L,idx) > 0)  /* non-empty line? */ \
72         add_history(lua_tostring(L, idx));  /* add it to history */
73#define lua_freeline(L,b)   ((void)L, free(b))
7474
7575#elif !defined(lua_readline)
7676
7777#define lua_readline(L,b,p) \
78        ((void)L, fputs(p, stdout), fflush(stdout),  /* show prompt */ \
79        fgets(b, LUA_MAXINPUT, stdin) != NULL)  /* get line */
80#define lua_saveline(L,idx)   { (void)L; (void)idx; }
81#define lua_freeline(L,b)   { (void)L; (void)b; }
78      ((void)L, fputs(p, stdout), fflush(stdout),  /* show prompt */ \
79      fgets(b, LUA_MAXINPUT, stdin) != NULL)  /* get line */
80#define lua_saveline(L,idx) { (void)L; (void)idx; }
81#define lua_freeline(L,b)   { (void)L; (void)b; }
8282
8383#endif
8484
r31373r31374
9292
9393
9494static void lstop (lua_State *L, lua_Debug *ar) {
95  (void)ar;  /* unused arg. */
96  lua_sethook(L, NULL, 0, 0);
97  luaL_error(L, "interrupted!");
95   (void)ar;  /* unused arg. */
96   lua_sethook(L, NULL, 0, 0);
97   luaL_error(L, "interrupted!");
9898}
9999
100100
101101static void laction (int i) {
102  signal(i, SIG_DFL); /* if another SIGINT happens before lstop,
102   signal(i, SIG_DFL); /* if another SIGINT happens before lstop,
103103                              terminate process (default action) */
104  lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
104   lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
105105}
106106
107107
108108static void print_usage (const char *badoption) {
109  luai_writestringerror("%s: ", progname);
110  if (badoption[1] == 'e' || badoption[1] == 'l')
111    luai_writestringerror("'%s' needs argument\n", badoption);
112  else
113    luai_writestringerror("unrecognized option '%s'\n", badoption);
114  luai_writestringerror(
115  "usage: %s [options] [script [args]]\n"
116  "Available options are:\n"
117  "  -e stat  execute string " LUA_QL("stat") "\n"
118  "  -i       enter interactive mode after executing " LUA_QL("script") "\n"
119  "  -l name  require library " LUA_QL("name") "\n"
120  "  -v       show version information\n"
121  "  -E       ignore environment variables\n"
122  "  --       stop handling options\n"
123  "  -        stop handling options and execute stdin\n"
124  ,
125  progname);
109   luai_writestringerror("%s: ", progname);
110   if (badoption[1] == 'e' || badoption[1] == 'l')
111   luai_writestringerror("'%s' needs argument\n", badoption);
112   else
113   luai_writestringerror("unrecognized option '%s'\n", badoption);
114   luai_writestringerror(
115   "usage: %s [options] [script [args]]\n"
116   "Available options are:\n"
117   "  -e stat  execute string " LUA_QL("stat") "\n"
118   "  -i       enter interactive mode after executing " LUA_QL("script") "\n"
119   "  -l name  require library " LUA_QL("name") "\n"
120   "  -v       show version information\n"
121   "  -E       ignore environment variables\n"
122   "  --       stop handling options\n"
123   "  -        stop handling options and execute stdin\n"
124   ,
125   progname);
126126}
127127
128128
129129static void l_message (const char *pname, const char *msg) {
130  if (pname) luai_writestringerror("%s: ", pname);
131  luai_writestringerror("%s\n", msg);
130   if (pname) luai_writestringerror("%s: ", pname);
131   luai_writestringerror("%s\n", msg);
132132}
133133
134134
135135static int report (lua_State *L, int status) {
136  if (status != LUA_OK && !lua_isnil(L, -1)) {
137    const char *msg = lua_tostring(L, -1);
138    if (msg == NULL) msg = "(error object is not a string)";
139    l_message(progname, msg);
140    lua_pop(L, 1);
141    /* force a complete garbage collection in case of errors */
142    lua_gc(L, LUA_GCCOLLECT, 0);
143  }
144  return status;
136   if (status != LUA_OK && !lua_isnil(L, -1)) {
137   const char *msg = lua_tostring(L, -1);
138   if (msg == NULL) msg = "(error object is not a string)";
139   l_message(progname, msg);
140   lua_pop(L, 1);
141   /* force a complete garbage collection in case of errors */
142   lua_gc(L, LUA_GCCOLLECT, 0);
143   }
144   return status;
145145}
146146
147147
148148/* the next function is called unprotected, so it must avoid errors */
149149static void finalreport (lua_State *L, int status) {
150  if (status != LUA_OK) {
151    const char *msg = (lua_type(L, -1) == LUA_TSTRING) ? lua_tostring(L, -1)
152                                                       : NULL;
153    if (msg == NULL) msg = "(error object is not a string)";
154    l_message(progname, msg);
155    lua_pop(L, 1);
156  }
150   if (status != LUA_OK) {
151   const char *msg = (lua_type(L, -1) == LUA_TSTRING) ? lua_tostring(L, -1)
152                                          : NULL;
153   if (msg == NULL) msg = "(error object is not a string)";
154   l_message(progname, msg);
155   lua_pop(L, 1);
156   }
157157}
158158
159159
160160static int traceback (lua_State *L) {
161  const char *msg = lua_tostring(L, 1);
162  if (msg)
163    luaL_traceback(L, L, msg, 1);
164  else if (!lua_isnoneornil(L, 1)) {  /* is there an error object? */
165    if (!luaL_callmeta(L, 1, "__tostring"))  /* try its 'tostring' metamethod */
166      lua_pushliteral(L, "(no error message)");
167  }
168  return 1;
161   const char *msg = lua_tostring(L, 1);
162   if (msg)
163   luaL_traceback(L, L, msg, 1);
164   else if (!lua_isnoneornil(L, 1)) {  /* is there an error object? */
165   if (!luaL_callmeta(L, 1, "__tostring"))  /* try its 'tostring' metamethod */
166      lua_pushliteral(L, "(no error message)");
167   }
168   return 1;
169169}
170170
171171
172172static int docall (lua_State *L, int narg, int nres) {
173  int status;
174  int base = lua_gettop(L) - narg;  /* function index */
175  lua_pushcfunction(L, traceback);  /* push traceback function */
176  lua_insert(L, base);  /* put it under chunk and args */
177  globalL = L;  /* to be available to 'laction' */
178  signal(SIGINT, laction);
179  status = lua_pcall(L, narg, nres, base);
180  signal(SIGINT, SIG_DFL);
181  lua_remove(L, base);  /* remove traceback function */
182  return status;
173   int status;
174   int base = lua_gettop(L) - narg;  /* function index */
175   lua_pushcfunction(L, traceback);  /* push traceback function */
176   lua_insert(L, base);  /* put it under chunk and args */
177   globalL = L;  /* to be available to 'laction' */
178   signal(SIGINT, laction);
179   status = lua_pcall(L, narg, nres, base);
180   signal(SIGINT, SIG_DFL);
181   lua_remove(L, base);  /* remove traceback function */
182   return status;
183183}
184184
185185
186186static void print_version (void) {
187  luai_writestring(LUA_COPYRIGHT, strlen(LUA_COPYRIGHT));
188  luai_writeline();
187   luai_writestring(LUA_COPYRIGHT, strlen(LUA_COPYRIGHT));
188   luai_writeline();
189189}
190190
191191
192192static int getargs (lua_State *L, char **argv, int n) {
193  int narg;
194  int i;
195  int argc = 0;
196  while (argv[argc]) argc++;  /* count total number of arguments */
197  narg = argc - (n + 1);  /* number of arguments to the script */
198  luaL_checkstack(L, narg + 3, "too many arguments to script");
199  for (i=n+1; i < argc; i++)
200    lua_pushstring(L, argv[i]);
201  lua_createtable(L, narg, n + 1);
202  for (i=0; i < argc; i++) {
203    lua_pushstring(L, argv[i]);
204    lua_rawseti(L, -2, i - n);
205  }
206  return narg;
193   int narg;
194   int i;
195   int argc = 0;
196   while (argv[argc]) argc++;  /* count total number of arguments */
197   narg = argc - (n + 1);  /* number of arguments to the script */
198   luaL_checkstack(L, narg + 3, "too many arguments to script");
199   for (i=n+1; i < argc; i++)
200   lua_pushstring(L, argv[i]);
201   lua_createtable(L, narg, n + 1);
202   for (i=0; i < argc; i++) {
203   lua_pushstring(L, argv[i]);
204   lua_rawseti(L, -2, i - n);
205   }
206   return narg;
207207}
208208
209209
210210static int dofile (lua_State *L, const char *name) {
211  int status = luaL_loadfile(L, name);
212  if (status == LUA_OK) status = docall(L, 0, 0);
213  return report(L, status);
211   int status = luaL_loadfile(L, name);
212   if (status == LUA_OK) status = docall(L, 0, 0);
213   return report(L, status);
214214}
215215
216216
217217static int dostring (lua_State *L, const char *s, const char *name) {
218  int status = luaL_loadbuffer(L, s, strlen(s), name);
219  if (status == LUA_OK) status = docall(L, 0, 0);
220  return report(L, status);
218   int status = luaL_loadbuffer(L, s, strlen(s), name);
219   if (status == LUA_OK) status = docall(L, 0, 0);
220   return report(L, status);
221221}
222222
223223
224224static int dolibrary (lua_State *L, const char *name) {
225  int status;
226  lua_getglobal(L, "require");
227  lua_pushstring(L, name);
228  status = docall(L, 1, 1);  /* call 'require(name)' */
229  if (status == LUA_OK)
230    lua_setglobal(L, name);  /* global[name] = require return */
231  return report(L, status);
225   int status;
226   lua_getglobal(L, "require");
227   lua_pushstring(L, name);
228   status = docall(L, 1, 1);  /* call 'require(name)' */
229   if (status == LUA_OK)
230   lua_setglobal(L, name);  /* global[name] = require return */
231   return report(L, status);
232232}
233233
234234
235235static const char *get_prompt (lua_State *L, int firstline) {
236  const char *p;
237  lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2");
238  p = lua_tostring(L, -1);
239  if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2);
240  return p;
236   const char *p;
237   lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2");
238   p = lua_tostring(L, -1);
239   if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2);
240   return p;
241241}
242242
243243/* mark in error messages for incomplete statements */
244#define EOFMARK      "<eof>"
245#define marklen      (sizeof(EOFMARK)/sizeof(char) - 1)
244#define EOFMARK     "<eof>"
245#define marklen     (sizeof(EOFMARK)/sizeof(char) - 1)
246246
247247static int incomplete (lua_State *L, int status) {
248  if (status == LUA_ERRSYNTAX) {
249    size_t lmsg;
250    const char *msg = lua_tolstring(L, -1, &lmsg);
251    if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0) {
252      lua_pop(L, 1);
253      return 1;
254    }
255  }
256  return 0;  /* else... */
248   if (status == LUA_ERRSYNTAX) {
249   size_t lmsg;
250   const char *msg = lua_tolstring(L, -1, &lmsg);
251   if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0) {
252      lua_pop(L, 1);
253      return 1;
254   }
255   }
256   return 0;  /* else... */
257257}
258258
259259
260260static int pushline (lua_State *L, int firstline) {
261  char buffer[LUA_MAXINPUT];
262  char *b = buffer;
263  size_t l;
264  const char *prmt = get_prompt(L, firstline);
265  int readstatus = lua_readline(L, b, prmt);
266  lua_pop(L, 1);  /* remove result from 'get_prompt' */
267  if (readstatus == 0)
268    return 0;  /* no input */
269  l = strlen(b);
270  if (l > 0 && b[l-1] == '\n')  /* line ends with newline? */
271    b[l-1] = '\0';  /* remove it */
272  if (firstline && b[0] == '=')  /* first line starts with `=' ? */
273    lua_pushfstring(L, "return %s", b+1);  /* change it to `return' */
274  else
275    lua_pushstring(L, b);
276  lua_freeline(L, b);
277  return 1;
261   char buffer[LUA_MAXINPUT];
262   char *b = buffer;
263   size_t l;
264   const char *prmt = get_prompt(L, firstline);
265   int readstatus = lua_readline(L, b, prmt);
266   lua_pop(L, 1);  /* remove result from 'get_prompt' */
267   if (readstatus == 0)
268   return 0;  /* no input */
269   l = strlen(b);
270   if (l > 0 && b[l-1] == '\n')  /* line ends with newline? */
271   b[l-1] = '\0';  /* remove it */
272   if (firstline && b[0] == '=')  /* first line starts with `=' ? */
273   lua_pushfstring(L, "return %s", b+1);  /* change it to `return' */
274   else
275   lua_pushstring(L, b);
276   lua_freeline(L, b);
277   return 1;
278278}
279279
280280
281281static int loadline (lua_State *L) {
282  int status;
283  lua_settop(L, 0);
284  if (!pushline(L, 1))
285    return -1;  /* no input */
286  for (;;) {  /* repeat until gets a complete line */
287    size_t l;
288    const char *line = lua_tolstring(L, 1, &l);
289    status = luaL_loadbuffer(L, line, l, "=stdin");
290    if (!incomplete(L, status)) break;  /* cannot try to add lines? */
291    if (!pushline(L, 0))  /* no more input? */
292      return -1;
293    lua_pushliteral(L, "\n");  /* add a new line... */
294    lua_insert(L, -2);  /* ...between the two lines */
295    lua_concat(L, 3);  /* join them */
296  }
297  lua_saveline(L, 1);
298  lua_remove(L, 1);  /* remove line */
299  return status;
282   int status;
283   lua_settop(L, 0);
284   if (!pushline(L, 1))
285   return -1;  /* no input */
286   for (;;) {  /* repeat until gets a complete line */
287   size_t l;
288   const char *line = lua_tolstring(L, 1, &l);
289   status = luaL_loadbuffer(L, line, l, "=stdin");
290   if (!incomplete(L, status)) break;  /* cannot try to add lines? */
291   if (!pushline(L, 0))  /* no more input? */
292      return -1;
293   lua_pushliteral(L, "\n");  /* add a new line... */
294   lua_insert(L, -2);  /* ...between the two lines */
295   lua_concat(L, 3);  /* join them */
296   }
297   lua_saveline(L, 1);
298   lua_remove(L, 1);  /* remove line */
299   return status;
300300}
301301
302302
303303static void dotty (lua_State *L) {
304  int status;
305  const char *oldprogname = progname;
306  progname = NULL;
307  while ((status = loadline(L)) != -1) {
308    if (status == LUA_OK) status = docall(L, 0, LUA_MULTRET);
309    report(L, status);
310    if (status == LUA_OK && lua_gettop(L) > 0) {  /* any result to print? */
311      luaL_checkstack(L, LUA_MINSTACK, "too many results to print");
312      lua_getglobal(L, "print");
313      lua_insert(L, 1);
314      if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != LUA_OK)
315        l_message(progname, lua_pushfstring(L,
316                               "error calling " LUA_QL("print") " (%s)",
317                               lua_tostring(L, -1)));
318    }
319  }
320  lua_settop(L, 0);  /* clear stack */
321  luai_writeline();
322  progname = oldprogname;
304   int status;
305   const char *oldprogname = progname;
306   progname = NULL;
307   while ((status = loadline(L)) != -1) {
308   if (status == LUA_OK) status = docall(L, 0, LUA_MULTRET);
309   report(L, status);
310   if (status == LUA_OK && lua_gettop(L) > 0) {  /* any result to print? */
311      luaL_checkstack(L, LUA_MINSTACK, "too many results to print");
312      lua_getglobal(L, "print");
313      lua_insert(L, 1);
314      if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != LUA_OK)
315      l_message(progname, lua_pushfstring(L,
316                        "error calling " LUA_QL("print") " (%s)",
317                        lua_tostring(L, -1)));
318   }
319   }
320   lua_settop(L, 0);  /* clear stack */
321   luai_writeline();
322   progname = oldprogname;
323323}
324324
325325
326326static int handle_script (lua_State *L, char **argv, int n) {
327  int status;
328  const char *fname;
329  int narg = getargs(L, argv, n);  /* collect arguments */
330  lua_setglobal(L, "arg");
331  fname = argv[n];
332  if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0)
333    fname = NULL;  /* stdin */
334  status = luaL_loadfile(L, fname);
335  lua_insert(L, -(narg+1));
336  if (status == LUA_OK)
337    status = docall(L, narg, LUA_MULTRET);
338  else
339    lua_pop(L, narg);
340  return report(L, status);
327   int status;
328   const char *fname;
329   int narg = getargs(L, argv, n);  /* collect arguments */
330   lua_setglobal(L, "arg");
331   fname = argv[n];
332   if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0)
333   fname = NULL;  /* stdin */
334   status = luaL_loadfile(L, fname);
335   lua_insert(L, -(narg+1));
336   if (status == LUA_OK)
337   status = docall(L, narg, LUA_MULTRET);
338   else
339   lua_pop(L, narg);
340   return report(L, status);
341341}
342342
343343
344344/* check that argument has no extra characters at the end */
345#define noextrachars(x)      {if ((x)[2] != '\0') return -1;}
345#define noextrachars(x)     {if ((x)[2] != '\0') return -1;}
346346
347347
348348/* indices of various argument indicators in array args */
349#define has_i      0   /* -i */
350#define has_v      1   /* -v */
351#define has_e      2   /* -e */
352#define has_E      3   /* -E */
349#define has_i       0   /* -i */
350#define has_v       1   /* -v */
351#define has_e       2   /* -e */
352#define has_E       3   /* -E */
353353
354#define num_has      4   /* number of 'has_*' */
354#define num_has     4   /* number of 'has_*' */
355355
356356
357357static int collectargs (char **argv, int *args) {
358  int i;
359  for (i = 1; argv[i] != NULL; i++) {
360    if (argv[i][0] != '-')  /* not an option? */
361        return i;
362    switch (argv[i][1]) {  /* option */
363      case '-':
364        noextrachars(argv[i]);
365        return (argv[i+1] != NULL ? i+1 : 0);
366      case '\0':
367        return i;
368      case 'E':
369        args[has_E] = 1;
370        break;
371      case 'i':
372        noextrachars(argv[i]);
373        args[has_i] = 1;  /* go through */
374      case 'v':
375        noextrachars(argv[i]);
376        args[has_v] = 1;
377        break;
378      case 'e':
379        args[has_e] = 1;  /* go through */
380      case 'l':  /* both options need an argument */
381        if (argv[i][2] == '\0') {  /* no concatenated argument? */
382          i++;  /* try next 'argv' */
383          if (argv[i] == NULL || argv[i][0] == '-')
384            return -(i - 1);  /* no next argument or it is another option */
385        }
386        break;
387      default:  /* invalid option; return its index... */
388        return -i;  /* ...as a negative value */
389    }
390  }
391  return 0;
358   int i;
359   for (i = 1; argv[i] != NULL; i++) {
360   if (argv[i][0] != '-')  /* not an option? */
361      return i;
362   switch (argv[i][1]) {  /* option */
363      case '-':
364      noextrachars(argv[i]);
365      return (argv[i+1] != NULL ? i+1 : 0);
366      case '\0':
367      return i;
368      case 'E':
369      args[has_E] = 1;
370      break;
371      case 'i':
372      noextrachars(argv[i]);
373      args[has_i] = 1;  /* go through */
374      case 'v':
375      noextrachars(argv[i]);
376      args[has_v] = 1;
377      break;
378      case 'e':
379      args[has_e] = 1;  /* go through */
380      case 'l':  /* both options need an argument */
381      if (argv[i][2] == '\0') {  /* no concatenated argument? */
382         i++;  /* try next 'argv' */
383         if (argv[i] == NULL || argv[i][0] == '-')
384         return -(i - 1);  /* no next argument or it is another option */
385      }
386      break;
387      default:  /* invalid option; return its index... */
388      return -i;  /* ...as a negative value */
389   }
390   }
391   return 0;
392392}
393393
394394
395395static int runargs (lua_State *L, char **argv, int n) {
396  int i;
397  for (i = 1; i < n; i++) {
398    lua_assert(argv[i][0] == '-');
399    switch (argv[i][1]) {  /* option */
400      case 'e': {
401        const char *chunk = argv[i] + 2;
402        if (*chunk == '\0') chunk = argv[++i];
403        lua_assert(chunk != NULL);
404        if (dostring(L, chunk, "=(command line)") != LUA_OK)
405          return 0;
406        break;
407      }
408      case 'l': {
409        const char *filename = argv[i] + 2;
410        if (*filename == '\0') filename = argv[++i];
411        lua_assert(filename != NULL);
412        if (dolibrary(L, filename) != LUA_OK)
413          return 0;  /* stop if file fails */
414        break;
415      }
416      default: break;
417    }
418  }
419  return 1;
396   int i;
397   for (i = 1; i < n; i++) {
398   lua_assert(argv[i][0] == '-');
399   switch (argv[i][1]) {  /* option */
400      case 'e': {
401      const char *chunk = argv[i] + 2;
402      if (*chunk == '\0') chunk = argv[++i];
403      lua_assert(chunk != NULL);
404      if (dostring(L, chunk, "=(command line)") != LUA_OK)
405         return 0;
406      break;
407      }
408      case 'l': {
409      const char *filename = argv[i] + 2;
410      if (*filename == '\0') filename = argv[++i];
411      lua_assert(filename != NULL);
412      if (dolibrary(L, filename) != LUA_OK)
413         return 0;  /* stop if file fails */
414      break;
415      }
416      default: break;
417   }
418   }
419   return 1;
420420}
421421
422422
423423static int handle_luainit (lua_State *L) {
424  const char *name = "=" LUA_INITVERSION;
425  const char *init = getenv(name + 1);
426  if (init == NULL) {
427    name = "=" LUA_INIT;
428    init = getenv(name + 1);  /* try alternative name */
429  }
430  if (init == NULL) return LUA_OK;
431  else if (init[0] == '@')
432    return dofile(L, init+1);
433  else
434    return dostring(L, init, name);
424   const char *name = "=" LUA_INITVERSION;
425   const char *init = getenv(name + 1);
426   if (init == NULL) {
427   name = "=" LUA_INIT;
428   init = getenv(name + 1);  /* try alternative name */
429   }
430   if (init == NULL) return LUA_OK;
431   else if (init[0] == '@')
432   return dofile(L, init+1);
433   else
434   return dostring(L, init, name);
435435}
436436
437437
438438static int pmain (lua_State *L) {
439  int argc = (int)lua_tointeger(L, 1);
440  char **argv = (char **)lua_touserdata(L, 2);
441  int script;
442  int args[num_has];
443  args[has_i] = args[has_v] = args[has_e] = args[has_E] = 0;
444  if (argv[0] && argv[0][0]) progname = argv[0];
445  script = collectargs(argv, args);
446  if (script < 0) {  /* invalid arg? */
447    print_usage(argv[-script]);
448    return 0;
449  }
450  if (args[has_v]) print_version();
451  if (args[has_E]) {  /* option '-E'? */
452    lua_pushboolean(L, 1);  /* signal for libraries to ignore env. vars. */
453    lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
454  }
455  /* open standard libraries */
456  luaL_checkversion(L);
457  lua_gc(L, LUA_GCSTOP, 0);  /* stop collector during initialization */
458  luaL_openlibs(L);  /* open libraries */
459  lua_gc(L, LUA_GCRESTART, 0);
460  if (!args[has_E] && handle_luainit(L) != LUA_OK)
461    return 0;  /* error running LUA_INIT */
462  /* execute arguments -e and -l */
463  if (!runargs(L, argv, (script > 0) ? script : argc)) return 0;
464  /* execute main script (if there is one) */
465  if (script && handle_script(L, argv, script) != LUA_OK) return 0;
466  if (args[has_i])  /* -i option? */
467    dotty(L);
468  else if (script == 0 && !args[has_e] && !args[has_v]) {  /* no arguments? */
469    if (lua_stdin_is_tty()) {
470      print_version();
471      dotty(L);
472    }
473    else dofile(L, NULL);  /* executes stdin as a file */
474  }
475  lua_pushboolean(L, 1);  /* signal no errors */
476  return 1;
439   int argc = (int)lua_tointeger(L, 1);
440   char **argv = (char **)lua_touserdata(L, 2);
441   int script;
442   int args[num_has];
443   args[has_i] = args[has_v] = args[has_e] = args[has_E] = 0;
444   if (argv[0] && argv[0][0]) progname = argv[0];
445   script = collectargs(argv, args);
446   if (script < 0) {  /* invalid arg? */
447   print_usage(argv[-script]);
448   return 0;
449   }
450   if (args[has_v]) print_version();
451   if (args[has_E]) {  /* option '-E'? */
452   lua_pushboolean(L, 1);  /* signal for libraries to ignore env. vars. */
453   lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
454   }
455   /* open standard libraries */
456   luaL_checkversion(L);
457   lua_gc(L, LUA_GCSTOP, 0);  /* stop collector during initialization */
458   luaL_openlibs(L);  /* open libraries */
459   lua_gc(L, LUA_GCRESTART, 0);
460   if (!args[has_E] && handle_luainit(L) != LUA_OK)
461   return 0;  /* error running LUA_INIT */
462   /* execute arguments -e and -l */
463   if (!runargs(L, argv, (script > 0) ? script : argc)) return 0;
464   /* execute main script (if there is one) */
465   if (script && handle_script(L, argv, script) != LUA_OK) return 0;
466   if (args[has_i])  /* -i option? */
467   dotty(L);
468   else if (script == 0 && !args[has_e] && !args[has_v]) {  /* no arguments? */
469   if (lua_stdin_is_tty()) {
470      print_version();
471      dotty(L);
472   }
473   else dofile(L, NULL);  /* executes stdin as a file */
474   }
475   lua_pushboolean(L, 1);  /* signal no errors */
476   return 1;
477477}
478478
479479
480480int main (int argc, char **argv) {
481  int status, result;
482  lua_State *L = luaL_newstate();  /* create state */
483  if (L == NULL) {
484    l_message(argv[0], "cannot create state: not enough memory");
485    return EXIT_FAILURE;
486  }
487  /* call 'pmain' in protected mode */
488  lua_pushcfunction(L, &pmain);
489  lua_pushinteger(L, argc);  /* 1st argument */
490  lua_pushlightuserdata(L, argv); /* 2nd argument */
491  status = lua_pcall(L, 2, 1, 0);
492  result = lua_toboolean(L, -1);  /* get result */
493  finalreport(L, status);
494  lua_close(L);
495  return (result && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
481   int status, result;
482   lua_State *L = luaL_newstate();  /* create state */
483   if (L == NULL) {
484   l_message(argv[0], "cannot create state: not enough memory");
485   return EXIT_FAILURE;
486   }
487   /* call 'pmain' in protected mode */
488   lua_pushcfunction(L, &pmain);
489   lua_pushinteger(L, argc);  /* 1st argument */
490   lua_pushlightuserdata(L, argv); /* 2nd argument */
491   status = lua_pcall(L, 2, 1, 0);
492   result = lua_toboolean(L, -1);  /* get result */
493   finalreport(L, status);
494   lua_close(L);
495   return (result && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE;
496496}
497
trunk/src/lib/lua/lstring.c
r31373r31374
2323** compute its hash
2424*/
2525#if !defined(LUAI_HASHLIMIT)
26#define LUAI_HASHLIMIT      5
26#define LUAI_HASHLIMIT      5
2727#endif
2828
2929
r31373r31374
3131** equality for long strings
3232*/
3333int luaS_eqlngstr (TString *a, TString *b) {
34  size_t len = a->tsv.len;
35  lua_assert(a->tsv.tt == LUA_TLNGSTR && b->tsv.tt == LUA_TLNGSTR);
36  return (a == b) ||  /* same instance or... */
37    ((len == b->tsv.len) &&  /* equal length and ... */
38     (memcmp(getstr(a), getstr(b), len) == 0));  /* equal contents */
34   size_t len = a->tsv.len;
35   lua_assert(a->tsv.tt == LUA_TLNGSTR && b->tsv.tt == LUA_TLNGSTR);
36   return (a == b) ||  /* same instance or... */
37   ((len == b->tsv.len) &&  /* equal length and ... */
38      (memcmp(getstr(a), getstr(b), len) == 0));  /* equal contents */
3939}
4040
4141
r31373r31374
4343** equality for strings
4444*/
4545int luaS_eqstr (TString *a, TString *b) {
46  return (a->tsv.tt == b->tsv.tt) &&
47         (a->tsv.tt == LUA_TSHRSTR ? eqshrstr(a, b) : luaS_eqlngstr(a, b));
46   return (a->tsv.tt == b->tsv.tt) &&
47         (a->tsv.tt == LUA_TSHRSTR ? eqshrstr(a, b) : luaS_eqlngstr(a, b));
4848}
4949
5050
5151unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) {
52  unsigned int h = seed ^ cast(unsigned int, l);
53  size_t l1;
54  size_t step = (l >> LUAI_HASHLIMIT) + 1;
55  for (l1 = l; l1 >= step; l1 -= step)
56    h = h ^ ((h<<5) + (h>>2) + cast_byte(str[l1 - 1]));
57  return h;
52   unsigned int h = seed ^ cast(unsigned int, l);
53   size_t l1;
54   size_t step = (l >> LUAI_HASHLIMIT) + 1;
55   for (l1 = l; l1 >= step; l1 -= step)
56   h = h ^ ((h<<5) + (h>>2) + cast_byte(str[l1 - 1]));
57   return h;
5858}
5959
6060
r31373r31374
6262** resizes the string table
6363*/
6464void luaS_resize (lua_State *L, int newsize) {
65  int i;
66  stringtable *tb = &G(L)->strt;
67  /* cannot resize while GC is traversing strings */
68  luaC_runtilstate(L, ~bitmask(GCSsweepstring));
69  if (newsize > tb->size) {
70    luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *);
71    for (i = tb->size; i < newsize; i++) tb->hash[i] = NULL;
72  }
73  /* rehash */
74  for (i=0; i<tb->size; i++) {
75    GCObject *p = tb->hash[i];
76    tb->hash[i] = NULL;
77    while (p) {  /* for each node in the list */
78      GCObject *next = gch(p)->next;  /* save next */
79      unsigned int h = lmod(gco2ts(p)->hash, newsize);  /* new position */
80      gch(p)->next = tb->hash[h];  /* chain it */
81      tb->hash[h] = p;
82      resetoldbit(p);  /* see MOVE OLD rule */
83      p = next;
84    }
85  }
86  if (newsize < tb->size) {
87    /* shrinking slice must be empty */
88    lua_assert(tb->hash[newsize] == NULL && tb->hash[tb->size - 1] == NULL);
89    luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *);
90  }
91  tb->size = newsize;
65   int i;
66   stringtable *tb = &G(L)->strt;
67   /* cannot resize while GC is traversing strings */
68   luaC_runtilstate(L, ~bitmask(GCSsweepstring));
69   if (newsize > tb->size) {
70   luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *);
71   for (i = tb->size; i < newsize; i++) tb->hash[i] = NULL;
72   }
73   /* rehash */
74   for (i=0; i<tb->size; i++) {
75   GCObject *p = tb->hash[i];
76   tb->hash[i] = NULL;
77   while (p) {  /* for each node in the list */
78      GCObject *next = gch(p)->next;  /* save next */
79      unsigned int h = lmod(gco2ts(p)->hash, newsize);  /* new position */
80      gch(p)->next = tb->hash[h];  /* chain it */
81      tb->hash[h] = p;
82      resetoldbit(p);  /* see MOVE OLD rule */
83      p = next;
84   }
85   }
86   if (newsize < tb->size) {
87   /* shrinking slice must be empty */
88   lua_assert(tb->hash[newsize] == NULL && tb->hash[tb->size - 1] == NULL);
89   luaM_reallocvector(L, tb->hash, tb->size, newsize, GCObject *);
90   }
91   tb->size = newsize;
9292}
9393
9494
r31373r31374
9696** creates a new string object
9797*/
9898static TString *createstrobj (lua_State *L, const char *str, size_t l,
99                              int tag, unsigned int h, GCObject **list) {
100  TString *ts;
101  size_t totalsize;  /* total size of TString object */
102  totalsize = sizeof(TString) + ((l + 1) * sizeof(char));
103  ts = &luaC_newobj(L, tag, totalsize, list, 0)->ts;
104  ts->tsv.len = l;
105  ts->tsv.hash = h;
106  ts->tsv.extra = 0;
107  memcpy(ts+1, str, l*sizeof(char));
108  ((char *)(ts+1))[l] = '\0';  /* ending 0 */
109  return ts;
99                        int tag, unsigned int h, GCObject **list) {
100   TString *ts;
101   size_t totalsize;  /* total size of TString object */
102   totalsize = sizeof(TString) + ((l + 1) * sizeof(char));
103   ts = &luaC_newobj(L, tag, totalsize, list, 0)->ts;
104   ts->tsv.len = l;
105   ts->tsv.hash = h;
106   ts->tsv.extra = 0;
107   memcpy(ts+1, str, l*sizeof(char));
108   ((char *)(ts+1))[l] = '\0';  /* ending 0 */
109   return ts;
110110}
111111
112112
r31373r31374
114114** creates a new short string, inserting it into string table
115115*/
116116static TString *newshrstr (lua_State *L, const char *str, size_t l,
117                                       unsigned int h) {
118  GCObject **list;  /* (pointer to) list where it will be inserted */
119  stringtable *tb = &G(L)->strt;
120  TString *s;
121  if (tb->nuse >= cast(lu_int32, tb->size) && tb->size <= MAX_INT/2)
122    luaS_resize(L, tb->size*2);  /* too crowded */
123  list = &tb->hash[lmod(h, tb->size)];
124  s = createstrobj(L, str, l, LUA_TSHRSTR, h, list);
125  tb->nuse++;
126  return s;
117                              unsigned int h) {
118   GCObject **list;  /* (pointer to) list where it will be inserted */
119   stringtable *tb = &G(L)->strt;
120   TString *s;
121   if (tb->nuse >= cast(lu_int32, tb->size) && tb->size <= MAX_INT/2)
122   luaS_resize(L, tb->size*2);  /* too crowded */
123   list = &tb->hash[lmod(h, tb->size)];
124   s = createstrobj(L, str, l, LUA_TSHRSTR, h, list);
125   tb->nuse++;
126   return s;
127127}
128128
129129
r31373r31374
131131** checks whether short string exists and reuses it or creates a new one
132132*/
133133static TString *internshrstr (lua_State *L, const char *str, size_t l) {
134  GCObject *o;
135  global_State *g = G(L);
136  unsigned int h = luaS_hash(str, l, g->seed);
137  for (o = g->strt.hash[lmod(h, g->strt.size)];
138       o != NULL;
139       o = gch(o)->next) {
140    TString *ts = rawgco2ts(o);
141    if (h == ts->tsv.hash &&
142        l == ts->tsv.len &&
143        (memcmp(str, getstr(ts), l * sizeof(char)) == 0)) {
144      if (isdead(G(L), o))  /* string is dead (but was not collected yet)? */
145        changewhite(o);  /* resurrect it */
146      return ts;
147    }
148  }
149  return newshrstr(L, str, l, h);  /* not found; create a new string */
134   GCObject *o;
135   global_State *g = G(L);
136   unsigned int h = luaS_hash(str, l, g->seed);
137   for (o = g->strt.hash[lmod(h, g->strt.size)];
138      o != NULL;
139      o = gch(o)->next) {
140   TString *ts = rawgco2ts(o);
141   if (h == ts->tsv.hash &&
142      l == ts->tsv.len &&
143      (memcmp(str, getstr(ts), l * sizeof(char)) == 0)) {
144      if (isdead(G(L), o))  /* string is dead (but was not collected yet)? */
145      changewhite(o);  /* resurrect it */
146      return ts;
147   }
148   }
149   return newshrstr(L, str, l, h);  /* not found; create a new string */
150150}
151151
152152
r31373r31374
154154** new string (with explicit length)
155155*/
156156TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
157  if (l <= LUAI_MAXSHORTLEN)  /* short string? */
158    return internshrstr(L, str, l);
159  else {
160    if (l + 1 > (MAX_SIZET - sizeof(TString))/sizeof(char))
161      luaM_toobig(L);
162    return createstrobj(L, str, l, LUA_TLNGSTR, G(L)->seed, NULL);
163  }
157   if (l <= LUAI_MAXSHORTLEN)  /* short string? */
158   return internshrstr(L, str, l);
159   else {
160   if (l + 1 > (MAX_SIZET - sizeof(TString))/sizeof(char))
161      luaM_toobig(L);
162   return createstrobj(L, str, l, LUA_TLNGSTR, G(L)->seed, NULL);
163   }
164164}
165165
166166
r31373r31374
168168** new zero-terminated string
169169*/
170170TString *luaS_new (lua_State *L, const char *str) {
171  return luaS_newlstr(L, str, strlen(str));
171   return luaS_newlstr(L, str, strlen(str));
172172}
173173
174174
175175Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
176  Udata *u;
177  if (s > MAX_SIZET - sizeof(Udata))
178    luaM_toobig(L);
179  u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s, NULL, 0)->u;
180  u->uv.len = s;
181  u->uv.metatable = NULL;
182  u->uv.env = e;
183  return u;
176   Udata *u;
177   if (s > MAX_SIZET - sizeof(Udata))
178   luaM_toobig(L);
179   u = &luaC_newobj(L, LUA_TUSERDATA, sizeof(Udata) + s, NULL, 0)->u;
180   u->uv.len = s;
181   u->uv.metatable = NULL;
182   u->uv.env = e;
183   return u;
184184}
185
trunk/src/lib/lua/lobject.c
r31373r31374
3434** eeeee != 0 and (xxx) otherwise.
3535*/
3636int luaO_int2fb (unsigned int x) {
37  int e = 0;  /* exponent */
38  if (x < 8) return x;
39  while (x >= 0x10) {
40    x = (x+1) >> 1;
41    e++;
42  }
43  return ((e+1) << 3) | (cast_int(x) - 8);
37   int e = 0;  /* exponent */
38   if (x < 8) return x;
39   while (x >= 0x10) {
40   x = (x+1) >> 1;
41   e++;
42   }
43   return ((e+1) << 3) | (cast_int(x) - 8);
4444}
4545
4646
4747/* converts back */
4848int luaO_fb2int (int x) {
49  int e = (x >> 3) & 0x1f;
50  if (e == 0) return x;
51  else return ((x & 7) + 8) << (e - 1);
49   int e = (x >> 3) & 0x1f;
50   if (e == 0) return x;
51   else return ((x & 7) + 8) << (e - 1);
5252}
5353
5454
5555int luaO_ceillog2 (unsigned int x) {
56  static const lu_byte log_2[256] = {
57    0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
58    6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
59    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
60    7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
61    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
62    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
63    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
64    8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
65  };
66  int l = 0;
67  x--;
68  while (x >= 256) { l += 8; x >>= 8; }
69  return l + log_2[x];
56   static const lu_byte log_2[256] = {
57   0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
58   6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
59   7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
60   7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
61   8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
62   8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
63   8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
64   8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
65   };
66   int l = 0;
67   x--;
68   while (x >= 256) { l += 8; x >>= 8; }
69   return l + log_2[x];
7070}
7171
7272
7373lua_Number luaO_arith (int op, lua_Number v1, lua_Number v2) {
74  switch (op) {
75    case LUA_OPADD: return luai_numadd(NULL, v1, v2);
76    case LUA_OPSUB: return luai_numsub(NULL, v1, v2);
77    case LUA_OPMUL: return luai_nummul(NULL, v1, v2);
78    case LUA_OPDIV: return luai_numdiv(NULL, v1, v2);
79    case LUA_OPMOD: return luai_nummod(NULL, v1, v2);
80    case LUA_OPPOW: return luai_numpow(NULL, v1, v2);
81    case LUA_OPUNM: return luai_numunm(NULL, v1);
82    default: lua_assert(0); return 0;
83  }
74   switch (op) {
75   case LUA_OPADD: return luai_numadd(NULL, v1, v2);
76   case LUA_OPSUB: return luai_numsub(NULL, v1, v2);
77   case LUA_OPMUL: return luai_nummul(NULL, v1, v2);
78   case LUA_OPDIV: return luai_numdiv(NULL, v1, v2);
79   case LUA_OPMOD: return luai_nummod(NULL, v1, v2);
80   case LUA_OPPOW: return luai_numpow(NULL, v1, v2);
81   case LUA_OPUNM: return luai_numunm(NULL, v1);
82   default: lua_assert(0); return 0;
83   }
8484}
8585
8686
8787int luaO_hexavalue (int c) {
88  if (lisdigit(c)) return c - '0';
89  else return ltolower(c) - 'a' + 10;
88   if (lisdigit(c)) return c - '0';
89   else return ltolower(c) - 'a' + 10;
9090}
9191
9292
r31373r31374
9696
9797
9898static int isneg (const char **s) {
99  if (**s == '-') { (*s)++; return 1; }
100  else if (**s == '+') (*s)++;
101  return 0;
99   if (**s == '-') { (*s)++; return 1; }
100   else if (**s == '+') (*s)++;
101   return 0;
102102}
103103
104104
105105static lua_Number readhexa (const char **s, lua_Number r, int *count) {
106  for (; lisxdigit(cast_uchar(**s)); (*s)++) {  /* read integer part */
107    r = (r * cast_num(16.0)) + cast_num(1.0*luaO_hexavalue(cast_uchar(**s)));
108    (*count)++;
109  }
110  return r;
106   for (; lisxdigit(cast_uchar(**s)); (*s)++) {  /* read integer part */
107   r = (r * cast_num(16.0)) + cast_num(1.0*luaO_hexavalue(cast_uchar(**s)));
108   (*count)++;
109   }
110   return r;
111111}
112112
113113
r31373r31374
116116** C99 specification for 'strtod'
117117*/
118118static lua_Number lua_strx2number (const char *s, char **endptr) {
119  lua_Number r = 0.0;
120  int e = 0, i = 0;
121  int neg = 0;  /* 1 if number is negative */
122  *endptr = cast(char *, s);  /* nothing is valid yet */
123  while (lisspace(cast_uchar(*s))) s++;  /* skip initial spaces */
124  neg = isneg(&s);  /* check signal */
125  if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')))  /* check '0x' */
126    return 0.0;  /* invalid format (no '0x') */
127  s += 2;  /* skip '0x' */
128  r = readhexa(&s, r, &i);  /* read integer part */
129  if (*s == '.') {
130    s++;  /* skip dot */
131    r = readhexa(&s, r, &e);  /* read fractional part */
132  }
133  if (i == 0 && e == 0)
134    return 0.0;  /* invalid format (no digit) */
135  e *= -4;  /* each fractional digit divides value by 2^-4 */
136  *endptr = cast(char *, s);  /* valid up to here */
137  if (*s == 'p' || *s == 'P') {  /* exponent part? */
138    int exp1 = 0;
139    int neg1;
140    s++;  /* skip 'p' */
141    neg1 = isneg(&s);  /* signal */
142    if (!lisdigit(cast_uchar(*s)))
143      goto ret;  /* must have at least one digit */
144    while (lisdigit(cast_uchar(*s)))  /* read exponent */
145      exp1 = exp1 * 10 + *(s++) - '0';
146    if (neg1) exp1 = -exp1;
147    e += exp1;
148  }
149  *endptr = cast(char *, s);  /* valid up to here */
150 ret:
151  if (neg) r = -r;
152  return l_mathop(ldexp)(r, e);
119   lua_Number r = 0.0;
120   int e = 0, i = 0;
121   int neg = 0;  /* 1 if number is negative */
122   *endptr = cast(char *, s);  /* nothing is valid yet */
123   while (lisspace(cast_uchar(*s))) s++;  /* skip initial spaces */
124   neg = isneg(&s);  /* check signal */
125   if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X')))  /* check '0x' */
126   return 0.0;  /* invalid format (no '0x') */
127   s += 2;  /* skip '0x' */
128   r = readhexa(&s, r, &i);  /* read integer part */
129   if (*s == '.') {
130   s++;  /* skip dot */
131   r = readhexa(&s, r, &e);  /* read fractional part */
132   }
133   if (i == 0 && e == 0)
134   return 0.0;  /* invalid format (no digit) */
135   e *= -4;  /* each fractional digit divides value by 2^-4 */
136   *endptr = cast(char *, s);  /* valid up to here */
137   if (*s == 'p' || *s == 'P') {  /* exponent part? */
138   int exp1 = 0;
139   int neg1;
140   s++;  /* skip 'p' */
141   neg1 = isneg(&s);  /* signal */
142   if (!lisdigit(cast_uchar(*s)))
143      goto ret;  /* must have at least one digit */
144   while (lisdigit(cast_uchar(*s)))  /* read exponent */
145      exp1 = exp1 * 10 + *(s++) - '0';
146   if (neg1) exp1 = -exp1;
147   e += exp1;
148   }
149   *endptr = cast(char *, s);  /* valid up to here */
150   ret:
151   if (neg) r = -r;
152   return l_mathop(ldexp)(r, e);
153153}
154154
155155#endif
156156
157157
158158int luaO_str2d (const char *s, size_t len, lua_Number *result) {
159  char *endptr;
160  if (strpbrk(s, "nN"))  /* reject 'inf' and 'nan' */
161    return 0;
162  else if (strpbrk(s, "xX"))  /* hexa? */
163    *result = lua_strx2number(s, &endptr);
164  else
165    *result = lua_str2number(s, &endptr);
166  if (endptr == s) return 0;  /* nothing recognized */
167  while (lisspace(cast_uchar(*endptr))) endptr++;
168  return (endptr == s + len);  /* OK if no trailing characters */
159   char *endptr;
160   if (strpbrk(s, "nN"))  /* reject 'inf' and 'nan' */
161   return 0;
162   else if (strpbrk(s, "xX"))  /* hexa? */
163   *result = lua_strx2number(s, &endptr);
164   else
165   *result = lua_str2number(s, &endptr);
166   if (endptr == s) return 0;  /* nothing recognized */
167   while (lisspace(cast_uchar(*endptr))) endptr++;
168   return (endptr == s + len);  /* OK if no trailing characters */
169169}
170170
171171
172172
173173static void pushstr (lua_State *L, const char *str, size_t l) {
174  setsvalue2s(L, L->top++, luaS_newlstr(L, str, l));
174   setsvalue2s(L, L->top++, luaS_newlstr(L, str, l));
175175}
176176
177177
178178/* this function handles only `%d', `%c', %f, %p, and `%s' formats */
179179const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
180  int n = 0;
181  for (;;) {
182    const char *e = strchr(fmt, '%');
183    if (e == NULL) break;
184    luaD_checkstack(L, 2);  /* fmt + item */
185    pushstr(L, fmt, e - fmt);
186    switch (*(e+1)) {
187      case 's': {
188        const char *s = va_arg(argp, char *);
189        if (s == NULL) s = "(null)";
190        pushstr(L, s, strlen(s));
191        break;
192      }
193      case 'c': {
194        char buff;
195        buff = cast(char, va_arg(argp, int));
196        pushstr(L, &buff, 1);
197        break;
198      }
199      case 'd': {
200        setnvalue(L->top++, cast_num(va_arg(argp, int)));
201        break;
202      }
203      case 'f': {
204        setnvalue(L->top++, cast_num(va_arg(argp, l_uacNumber)));
205        break;
206      }
207      case 'p': {
208        char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */
209        int l = sprintf(buff, "%p", va_arg(argp, void *));
210        pushstr(L, buff, l);
211        break;
212      }
213      case '%': {
214        pushstr(L, "%", 1);
215        break;
216      }
217      default: {
218        luaG_runerror(L,
219            "invalid option " LUA_QL("%%%c") " to " LUA_QL("lua_pushfstring"),
220            *(e + 1));
221      }
222    }
223    n += 2;
224    fmt = e+2;
225  }
226  luaD_checkstack(L, 1);
227  pushstr(L, fmt, strlen(fmt));
228  if (n > 0) luaV_concat(L, n + 1);
229  return svalue(L->top - 1);
180   int n = 0;
181   for (;;) {
182   const char *e = strchr(fmt, '%');
183   if (e == NULL) break;
184   luaD_checkstack(L, 2);  /* fmt + item */
185   pushstr(L, fmt, e - fmt);
186   switch (*(e+1)) {
187      case 's': {
188      const char *s = va_arg(argp, char *);
189      if (s == NULL) s = "(null)";
190      pushstr(L, s, strlen(s));
191      break;
192      }
193      case 'c': {
194      char buff;
195      buff = cast(char, va_arg(argp, int));
196      pushstr(L, &buff, 1);
197      break;
198      }
199      case 'd': {
200      setnvalue(L->top++, cast_num(va_arg(argp, int)));
201      break;
202      }
203      case 'f': {
204      setnvalue(L->top++, cast_num(va_arg(argp, l_uacNumber)));
205      break;
206      }
207      case 'p': {
208      char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */
209      int l = sprintf(buff, "%p", va_arg(argp, void *));
210      pushstr(L, buff, l);
211      break;
212      }
213      case '%': {
214      pushstr(L, "%", 1);
215      break;
216      }
217      default: {
218      luaG_runerror(L,
219         "invalid option " LUA_QL("%%%c") " to " LUA_QL("lua_pushfstring"),
220         *(e + 1));
221      }
222   }
223   n += 2;
224   fmt = e+2;
225   }
226   luaD_checkstack(L, 1);
227   pushstr(L, fmt, strlen(fmt));
228   if (n > 0) luaV_concat(L, n + 1);
229   return svalue(L->top - 1);
230230}
231231
232232
233233const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) {
234  const char *msg;
235  va_list argp;
236  va_start(argp, fmt);
237  msg = luaO_pushvfstring(L, fmt, argp);
238  va_end(argp);
239  return msg;
234   const char *msg;
235   va_list argp;
236   va_start(argp, fmt);
237   msg = luaO_pushvfstring(L, fmt, argp);
238   va_end(argp);
239   return msg;
240240}
241241
242242
243243/* number of chars of a literal string without the ending \0 */
244#define LL(x)   (sizeof(x)/sizeof(char) - 1)
244#define LL(x)   (sizeof(x)/sizeof(char) - 1)
245245
246#define RETS   "..."
247#define PRE   "[string \""
248#define POS   "\"]"
246#define RETS    "..."
247#define PRE "[string \""
248#define POS "\"]"
249249
250#define addstr(a,b,l)   ( memcpy(a,b,(l) * sizeof(char)), a += (l) )
250#define addstr(a,b,l)   ( memcpy(a,b,(l) * sizeof(char)), a += (l) )
251251
252252void luaO_chunkid (char *out, const char *source, size_t bufflen) {
253  size_t l = strlen(source);
254  if (*source == '=') {  /* 'literal' source */
255    if (l <= bufflen)  /* small enough? */
256      memcpy(out, source + 1, l * sizeof(char));
257    else {  /* truncate it */
258      addstr(out, source + 1, bufflen - 1);
259      *out = '\0';
260    }
261  }
262  else if (*source == '@') {  /* file name */
263    if (l <= bufflen)  /* small enough? */
264      memcpy(out, source + 1, l * sizeof(char));
265    else {  /* add '...' before rest of name */
266      addstr(out, RETS, LL(RETS));
267      bufflen -= LL(RETS);
268      memcpy(out, source + 1 + l - bufflen, bufflen * sizeof(char));
269    }
270  }
271  else {  /* string; format as [string "source"] */
272    const char *nl = strchr(source, '\n');  /* find first new line (if any) */
273    addstr(out, PRE, LL(PRE));  /* add prefix */
274    bufflen -= LL(PRE RETS POS) + 1;  /* save space for prefix+suffix+'\0' */
275    if (l < bufflen && nl == NULL) {  /* small one-line source? */
276      addstr(out, source, l);  /* keep it */
277    }
278    else {
279      if (nl != NULL) l = nl - source;  /* stop at first newline */
280      if (l > bufflen) l = bufflen;
281      addstr(out, source, l);
282      addstr(out, RETS, LL(RETS));
283    }
284    memcpy(out, POS, (LL(POS) + 1) * sizeof(char));
285  }
253   size_t l = strlen(source);
254   if (*source == '=') {  /* 'literal' source */
255   if (l <= bufflen)  /* small enough? */
256      memcpy(out, source + 1, l * sizeof(char));
257   else {  /* truncate it */
258      addstr(out, source + 1, bufflen - 1);
259      *out = '\0';
260   }
261   }
262   else if (*source == '@') {  /* file name */
263   if (l <= bufflen)  /* small enough? */
264      memcpy(out, source + 1, l * sizeof(char));
265   else {  /* add '...' before rest of name */
266      addstr(out, RETS, LL(RETS));
267      bufflen -= LL(RETS);
268      memcpy(out, source + 1 + l - bufflen, bufflen * sizeof(char));
269   }
270   }
271   else {  /* string; format as [string "source"] */
272   const char *nl = strchr(source, '\n');  /* find first new line (if any) */
273   addstr(out, PRE, LL(PRE));  /* add prefix */
274   bufflen -= LL(PRE RETS POS) + 1;  /* save space for prefix+suffix+'\0' */
275   if (l < bufflen && nl == NULL) {  /* small one-line source? */
276      addstr(out, source, l);  /* keep it */
277   }
278   else {
279      if (nl != NULL) l = nl - source;  /* stop at first newline */
280      if (l > bufflen) l = bufflen;
281      addstr(out, source, l);
282      addstr(out, RETS, LL(RETS));
283   }
284   memcpy(out, POS, (LL(POS) + 1) * sizeof(char));
285   }
286286}
287
trunk/src/lib/lua/lapi.c
r31373r31374
3030
3131
3232const char lua_ident[] =
33  "$LuaVersion: " LUA_COPYRIGHT " $"
34  "$LuaAuthors: " LUA_AUTHORS " $";
33   "$LuaVersion: " LUA_COPYRIGHT " $"
34   "$LuaAuthors: " LUA_AUTHORS " $";
3535
3636
3737/* value at a non-valid index */
38#define NONVALIDVALUE      cast(TValue *, luaO_nilobject)
38#define NONVALIDVALUE       cast(TValue *, luaO_nilobject)
3939
4040/* corresponding test */
41#define isvalid(o)   ((o) != luaO_nilobject)
41#define isvalid(o)  ((o) != luaO_nilobject)
4242
4343/* test for pseudo index */
44#define ispseudo(i)      ((i) <= LUA_REGISTRYINDEX)
44#define ispseudo(i)     ((i) <= LUA_REGISTRYINDEX)
4545
4646/* test for valid but not pseudo index */
47#define isstackindex(i, o)   (isvalid(o) && !ispseudo(i))
47#define isstackindex(i, o)  (isvalid(o) && !ispseudo(i))
4848
4949#define api_checkvalidindex(L, o)  api_check(L, isvalid(o), "invalid index")
5050
r31373r31374
5353
5454
5555static TValue *index2addr (lua_State *L, int idx) {
56  CallInfo *ci = L->ci;
57  if (idx > 0) {
58    TValue *o = ci->func + idx;
59    api_check(L, idx <= ci->top - (ci->func + 1), "unacceptable index");
60    if (o >= L->top) return NONVALIDVALUE;
61    else return o;
62  }
63  else if (!ispseudo(idx)) {  /* negative index */
64    api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index");
65    return L->top + idx;
66  }
67  else if (idx == LUA_REGISTRYINDEX)
68    return &G(L)->l_registry;
69  else {  /* upvalues */
70    idx = LUA_REGISTRYINDEX - idx;
71    api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large");
72    if (ttislcf(ci->func))  /* light C function? */
73      return NONVALIDVALUE;  /* it has no upvalues */
74    else {
75      CClosure *func = clCvalue(ci->func);
76      return (idx <= func->nupvalues) ? &func->upvalue[idx-1] : NONVALIDVALUE;
77    }
78  }
56   CallInfo *ci = L->ci;
57   if (idx > 0) {
58   TValue *o = ci->func + idx;
59   api_check(L, idx <= ci->top - (ci->func + 1), "unacceptable index");
60   if (o >= L->top) return NONVALIDVALUE;
61   else return o;
62   }
63   else if (!ispseudo(idx)) {  /* negative index */
64   api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index");
65   return L->top + idx;
66   }
67   else if (idx == LUA_REGISTRYINDEX)
68   return &G(L)->l_registry;
69   else {  /* upvalues */
70   idx = LUA_REGISTRYINDEX - idx;
71   api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large");
72   if (ttislcf(ci->func))  /* light C function? */
73      return NONVALIDVALUE;  /* it has no upvalues */
74   else {
75      CClosure *func = clCvalue(ci->func);
76      return (idx <= func->nupvalues) ? &func->upvalue[idx-1] : NONVALIDVALUE;
77   }
78   }
7979}
8080
8181
r31373r31374
8484** capturing memory errors
8585*/
8686static void growstack (lua_State *L, void *ud) {
87  int size = *(int *)ud;
88  luaD_growstack(L, size);
87   int size = *(int *)ud;
88   luaD_growstack(L, size);
8989}
9090
9191
9292LUA_API int lua_checkstack (lua_State *L, int size) {
93  int res;
94  CallInfo *ci = L->ci;
95  lua_lock(L);
96  if (L->stack_last - L->top > size)  /* stack large enough? */
97    res = 1;  /* yes; check is OK */
98  else {  /* no; need to grow stack */
99    int inuse = cast_int(L->top - L->stack) + EXTRA_STACK;
100    if (inuse > LUAI_MAXSTACK - size)  /* can grow without overflow? */
101      res = 0;  /* no */
102    else  /* try to grow stack */
103      res = (luaD_rawrunprotected(L, &growstack, &size) == LUA_OK);
104  }
105  if (res && ci->top < L->top + size)
106    ci->top = L->top + size;  /* adjust frame top */
107  lua_unlock(L);
108  return res;
93   int res;
94   CallInfo *ci = L->ci;
95   lua_lock(L);
96   if (L->stack_last - L->top > size)  /* stack large enough? */
97   res = 1;  /* yes; check is OK */
98   else {  /* no; need to grow stack */
99   int inuse = cast_int(L->top - L->stack) + EXTRA_STACK;
100   if (inuse > LUAI_MAXSTACK - size)  /* can grow without overflow? */
101      res = 0;  /* no */
102   else  /* try to grow stack */
103      res = (luaD_rawrunprotected(L, &growstack, &size) == LUA_OK);
104   }
105   if (res && ci->top < L->top + size)
106   ci->top = L->top + size;  /* adjust frame top */
107   lua_unlock(L);
108   return res;
109109}
110110
111111
112112LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
113  int i;
114  if (from == to) return;
115  lua_lock(to);
116  api_checknelems(from, n);
117  api_check(from, G(from) == G(to), "moving among independent states");
118  api_check(from, to->ci->top - to->top >= n, "not enough elements to move");
119  from->top -= n;
120  for (i = 0; i < n; i++) {
121    setobj2s(to, to->top++, from->top + i);
122  }
123  lua_unlock(to);
113   int i;
114   if (from == to) return;
115   lua_lock(to);
116   api_checknelems(from, n);
117   api_check(from, G(from) == G(to), "moving among independent states");
118   api_check(from, to->ci->top - to->top >= n, "not enough elements to move");
119   from->top -= n;
120   for (i = 0; i < n; i++) {
121   setobj2s(to, to->top++, from->top + i);
122   }
123   lua_unlock(to);
124124}
125125
126126
127127LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
128  lua_CFunction old;
129  lua_lock(L);
130  old = G(L)->panic;
131  G(L)->panic = panicf;
132  lua_unlock(L);
133  return old;
128   lua_CFunction old;
129   lua_lock(L);
130   old = G(L)->panic;
131   G(L)->panic = panicf;
132   lua_unlock(L);
133   return old;
134134}
135135
136136
137137LUA_API const lua_Number *lua_version (lua_State *L) {
138  static const lua_Number version = LUA_VERSION_NUM;
139  if (L == NULL) return &version;
140  else return G(L)->version;
138   static const lua_Number version = LUA_VERSION_NUM;
139   if (L == NULL) return &version;
140   else return G(L)->version;
141141}
142142
143143
r31373r31374
151151** convert an acceptable stack index into an absolute index
152152*/
153153LUA_API int lua_absindex (lua_State *L, int idx) {
154  return (idx > 0 || ispseudo(idx))
155         ? idx
156         : cast_int(L->top - L->ci->func + idx);
154   return (idx > 0 || ispseudo(idx))
155         ? idx
156         : cast_int(L->top - L->ci->func + idx);
157157}
158158
159159
160160LUA_API int lua_gettop (lua_State *L) {
161  return cast_int(L->top - (L->ci->func + 1));
161   return cast_int(L->top - (L->ci->func + 1));
162162}
163163
164164
165165LUA_API void lua_settop (lua_State *L, int idx) {
166  StkId func = L->ci->func;
167  lua_lock(L);
168  if (idx >= 0) {
169    api_check(L, idx <= L->stack_last - (func + 1), "new top too large");
170    while (L->top < (func + 1) + idx)
171      setnilvalue(L->top++);
172    L->top = (func + 1) + idx;
173  }
174  else {
175    api_check(L, -(idx+1) <= (L->top - (func + 1)), "invalid new top");
176    L->top += idx+1;  /* `subtract' index (index is negative) */
177  }
178  lua_unlock(L);
166   StkId func = L->ci->func;
167   lua_lock(L);
168   if (idx >= 0) {
169   api_check(L, idx <= L->stack_last - (func + 1), "new top too large");
170   while (L->top < (func + 1) + idx)
171      setnilvalue(L->top++);
172   L->top = (func + 1) + idx;
173   }
174   else {
175   api_check(L, -(idx+1) <= (L->top - (func + 1)), "invalid new top");
176   L->top += idx+1;  /* `subtract' index (index is negative) */
177   }
178   lua_unlock(L);
179179}
180180
181181
182182LUA_API void lua_remove (lua_State *L, int idx) {
183  StkId p;
184  lua_lock(L);
185  p = index2addr(L, idx);
186  api_checkstackindex(L, idx, p);
187  while (++p < L->top) setobjs2s(L, p-1, p);
188  L->top--;
189  lua_unlock(L);
183   StkId p;
184   lua_lock(L);
185   p = index2addr(L, idx);
186   api_checkstackindex(L, idx, p);
187   while (++p < L->top) setobjs2s(L, p-1, p);
188   L->top--;
189   lua_unlock(L);
190190}
191191
192192
193193LUA_API void lua_insert (lua_State *L, int idx) {
194  StkId p;
195  StkId q;
196  lua_lock(L);
197  p = index2addr(L, idx);
198  api_checkstackindex(L, idx, p);
199  for (q = L->top; q > p; q--)  /* use L->top as a temporary */
200    setobjs2s(L, q, q - 1);
201  setobjs2s(L, p, L->top);
202  lua_unlock(L);
194   StkId p;
195   StkId q;
196   lua_lock(L);
197   p = index2addr(L, idx);
198   api_checkstackindex(L, idx, p);
199   for (q = L->top; q > p; q--)  /* use L->top as a temporary */
200   setobjs2s(L, q, q - 1);
201   setobjs2s(L, p, L->top);
202   lua_unlock(L);
203203}
204204
205205
206206static void moveto (lua_State *L, TValue *fr, int idx) {
207  TValue *to = index2addr(L, idx);
208  api_checkvalidindex(L, to);
209  setobj(L, to, fr);
210  if (idx < LUA_REGISTRYINDEX)  /* function upvalue? */
211    luaC_barrier(L, clCvalue(L->ci->func), fr);
212  /* LUA_REGISTRYINDEX does not need gc barrier
213     (collector revisits it before finishing collection) */
207   TValue *to = index2addr(L, idx);
208   api_checkvalidindex(L, to);
209   setobj(L, to, fr);
210   if (idx < LUA_REGISTRYINDEX)  /* function upvalue? */
211   luaC_barrier(L, clCvalue(L->ci->func), fr);
212   /* LUA_REGISTRYINDEX does not need gc barrier
213    (collector revisits it before finishing collection) */
214214}
215215
216216
217217LUA_API void lua_replace (lua_State *L, int idx) {
218  lua_lock(L);
219  api_checknelems(L, 1);
220  moveto(L, L->top - 1, idx);
221  L->top--;
222  lua_unlock(L);
218   lua_lock(L);
219   api_checknelems(L, 1);
220   moveto(L, L->top - 1, idx);
221   L->top--;
222   lua_unlock(L);
223223}
224224
225225
226226LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) {
227  TValue *fr;
228  lua_lock(L);
229  fr = index2addr(L, fromidx);
230  moveto(L, fr, toidx);
231  lua_unlock(L);
227   TValue *fr;
228   lua_lock(L);
229   fr = index2addr(L, fromidx);
230   moveto(L, fr, toidx);
231   lua_unlock(L);
232232}
233233
234234
235235LUA_API void lua_pushvalue (lua_State *L, int idx) {
236  lua_lock(L);
237  setobj2s(L, L->top, index2addr(L, idx));
238  api_incr_top(L);
239  lua_unlock(L);
236   lua_lock(L);
237   setobj2s(L, L->top, index2addr(L, idx));
238   api_incr_top(L);
239   lua_unlock(L);
240240}
241241
242242
r31373r31374
247247
248248
249249LUA_API int lua_type (lua_State *L, int idx) {
250  StkId o = index2addr(L, idx);
251  return (isvalid(o) ? ttypenv(o) : LUA_TNONE);
250   StkId o = index2addr(L, idx);
251   return (isvalid(o) ? ttypenv(o) : LUA_TNONE);
252252}
253253
254254
255255LUA_API const char *lua_typename (lua_State *L, int t) {
256  UNUSED(L);
257  return ttypename(t);
256   UNUSED(L);
257   return ttypename(t);
258258}
259259
260260
261261LUA_API int lua_iscfunction (lua_State *L, int idx) {
262  StkId o = index2addr(L, idx);
263  return (ttislcf(o) || (ttisCclosure(o)));
262   StkId o = index2addr(L, idx);
263   return (ttislcf(o) || (ttisCclosure(o)));
264264}
265265
266266
267267LUA_API int lua_isnumber (lua_State *L, int idx) {
268  TValue n;
269  const TValue *o = index2addr(L, idx);
270  return tonumber(o, &n);
268   TValue n;
269   const TValue *o = index2addr(L, idx);
270   return tonumber(o, &n);
271271}
272272
273273
274274LUA_API int lua_isstring (lua_State *L, int idx) {
275  int t = lua_type(L, idx);
276  return (t == LUA_TSTRING || t == LUA_TNUMBER);
275   int t = lua_type(L, idx);
276   return (t == LUA_TSTRING || t == LUA_TNUMBER);
277277}
278278
279279
280280LUA_API int lua_isuserdata (lua_State *L, int idx) {
281  const TValue *o = index2addr(L, idx);
282  return (ttisuserdata(o) || ttislightuserdata(o));
281   const TValue *o = index2addr(L, idx);
282   return (ttisuserdata(o) || ttislightuserdata(o));
283283}
284284
285285
286286LUA_API int lua_rawequal (lua_State *L, int index1, int index2) {
287  StkId o1 = index2addr(L, index1);
288  StkId o2 = index2addr(L, index2);
289  return (isvalid(o1) && isvalid(o2)) ? luaV_rawequalobj(o1, o2) : 0;
287   StkId o1 = index2addr(L, index1);
288   StkId o2 = index2addr(L, index2);
289   return (isvalid(o1) && isvalid(o2)) ? luaV_rawequalobj(o1, o2) : 0;
290290}
291291
292292
293293LUA_API void lua_arith (lua_State *L, int op) {
294  StkId o1;  /* 1st operand */
295  StkId o2;  /* 2nd operand */
296  lua_lock(L);
297  if (op != LUA_OPUNM) /* all other operations expect two operands */
298    api_checknelems(L, 2);
299  else {  /* for unary minus, add fake 2nd operand */
300    api_checknelems(L, 1);
301    setobjs2s(L, L->top, L->top - 1);
302    L->top++;
303  }
304  o1 = L->top - 2;
305  o2 = L->top - 1;
306  if (ttisnumber(o1) && ttisnumber(o2)) {
307    setnvalue(o1, luaO_arith(op, nvalue(o1), nvalue(o2)));
308  }
309  else
310    luaV_arith(L, o1, o1, o2, cast(TMS, op - LUA_OPADD + TM_ADD));
311  L->top--;
312  lua_unlock(L);
294   StkId o1;  /* 1st operand */
295   StkId o2;  /* 2nd operand */
296   lua_lock(L);
297   if (op != LUA_OPUNM) /* all other operations expect two operands */
298   api_checknelems(L, 2);
299   else {  /* for unary minus, add fake 2nd operand */
300   api_checknelems(L, 1);
301   setobjs2s(L, L->top, L->top - 1);
302   L->top++;
303   }
304   o1 = L->top - 2;
305   o2 = L->top - 1;
306   if (ttisnumber(o1) && ttisnumber(o2)) {
307   setnvalue(o1, luaO_arith(op, nvalue(o1), nvalue(o2)));
308   }
309   else
310   luaV_arith(L, o1, o1, o2, cast(TMS, op - LUA_OPADD + TM_ADD));
311   L->top--;
312   lua_unlock(L);
313313}
314314
315315
316316LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) {
317  StkId o1, o2;
318  int i = 0;
319  lua_lock(L);  /* may call tag method */
320  o1 = index2addr(L, index1);
321  o2 = index2addr(L, index2);
322  if (isvalid(o1) && isvalid(o2)) {
323    switch (op) {
324      case LUA_OPEQ: i = equalobj(L, o1, o2); break;
325      case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break;
326      case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break;
327      default: api_check(L, 0, "invalid option");
328    }
329  }
330  lua_unlock(L);
331  return i;
317   StkId o1, o2;
318   int i = 0;
319   lua_lock(L);  /* may call tag method */
320   o1 = index2addr(L, index1);
321   o2 = index2addr(L, index2);
322   if (isvalid(o1) && isvalid(o2)) {
323   switch (op) {
324      case LUA_OPEQ: i = equalobj(L, o1, o2); break;
325      case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break;
326      case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break;
327      default: api_check(L, 0, "invalid option");
328   }
329   }
330   lua_unlock(L);
331   return i;
332332}
333333
334334
335335LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *isnum) {
336  TValue n;
337  const TValue *o = index2addr(L, idx);
338  if (tonumber(o, &n)) {
339    if (isnum) *isnum = 1;
340    return nvalue(o);
341  }
342  else {
343    if (isnum) *isnum = 0;
344    return 0;
345  }
336   TValue n;
337   const TValue *o = index2addr(L, idx);
338   if (tonumber(o, &n)) {
339   if (isnum) *isnum = 1;
340   return nvalue(o);
341   }
342   else {
343   if (isnum) *isnum = 0;
344   return 0;
345   }
346346}
347347
348348
349349LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *isnum) {
350  TValue n;
351  const TValue *o = index2addr(L, idx);
352  if (tonumber(o, &n)) {
353    lua_Integer res;
354    lua_Number num = nvalue(o);
355    lua_number2integer(res, num);
356    if (isnum) *isnum = 1;
357    return res;
358  }
359  else {
360    if (isnum) *isnum = 0;
361    return 0;
362  }
350   TValue n;
351   const TValue *o = index2addr(L, idx);
352   if (tonumber(o, &n)) {
353   lua_Integer res;
354   lua_Number num = nvalue(o);
355   lua_number2integer(res, num);
356   if (isnum) *isnum = 1;
357   return res;
358   }
359   else {
360   if (isnum) *isnum = 0;
361   return 0;
362   }
363363}
364364
365365
366366LUA_API lua_Unsigned lua_tounsignedx (lua_State *L, int idx, int *isnum) {
367  TValue n;
368  const TValue *o = index2addr(L, idx);
369  if (tonumber(o, &n)) {
370    lua_Unsigned res;
371    lua_Number num = nvalue(o);
372    lua_number2unsigned(res, num);
373    if (isnum) *isnum = 1;
374    return res;
375  }
376  else {
377    if (isnum) *isnum = 0;
378    return 0;
379  }
367   TValue n;
368   const TValue *o = index2addr(L, idx);
369   if (tonumber(o, &n)) {
370   lua_Unsigned res;
371   lua_Number num = nvalue(o);
372   lua_number2unsigned(res, num);
373   if (isnum) *isnum = 1;
374   return res;
375   }
376   else {
377   if (isnum) *isnum = 0;
378   return 0;
379   }
380380}
381381
382382
383383LUA_API int lua_toboolean (lua_State *L, int idx) {
384  const TValue *o = index2addr(L, idx);
385  return !l_isfalse(o);
384   const TValue *o = index2addr(L, idx);
385   return !l_isfalse(o);
386386}
387387
388388
389389LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
390  StkId o = index2addr(L, idx);
391  if (!ttisstring(o)) {
392    lua_lock(L);  /* `luaV_tostring' may create a new string */
393    if (!luaV_tostring(L, o)) {  /* conversion failed? */
394      if (len != NULL) *len = 0;
395      lua_unlock(L);
396      return NULL;
397    }
398    luaC_checkGC(L);
399    o = index2addr(L, idx);  /* previous call may reallocate the stack */
400    lua_unlock(L);
401  }
402  if (len != NULL) *len = tsvalue(o)->len;
403  return svalue(o);
390   StkId o = index2addr(L, idx);
391   if (!ttisstring(o)) {
392   lua_lock(L);  /* `luaV_tostring' may create a new string */
393   if (!luaV_tostring(L, o)) {  /* conversion failed? */
394      if (len != NULL) *len = 0;
395      lua_unlock(L);
396      return NULL;
397   }
398   luaC_checkGC(L);
399   o = index2addr(L, idx);  /* previous call may reallocate the stack */
400   lua_unlock(L);
401   }
402   if (len != NULL) *len = tsvalue(o)->len;
403   return svalue(o);
404404}
405405
406406
407407LUA_API size_t lua_rawlen (lua_State *L, int idx) {
408  StkId o = index2addr(L, idx);
409  switch (ttypenv(o)) {
410    case LUA_TSTRING: return tsvalue(o)->len;
411    case LUA_TUSERDATA: return uvalue(o)->len;
412    case LUA_TTABLE: return luaH_getn(hvalue(o));
413    default: return 0;
414  }
408   StkId o = index2addr(L, idx);
409   switch (ttypenv(o)) {
410   case LUA_TSTRING: return tsvalue(o)->len;
411   case LUA_TUSERDATA: return uvalue(o)->len;
412   case LUA_TTABLE: return luaH_getn(hvalue(o));
413   default: return 0;
414   }
415415}
416416
417417
418418LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {
419  StkId o = index2addr(L, idx);
420  if (ttislcf(o)) return fvalue(o);
421  else if (ttisCclosure(o))
422    return clCvalue(o)->f;
423  else return NULL;  /* not a C function */
419   StkId o = index2addr(L, idx);
420   if (ttislcf(o)) return fvalue(o);
421   else if (ttisCclosure(o))
422   return clCvalue(o)->f;
423   else return NULL;  /* not a C function */
424424}
425425
426426
427427LUA_API void *lua_touserdata (lua_State *L, int idx) {
428  StkId o = index2addr(L, idx);
429  switch (ttypenv(o)) {
430    case LUA_TUSERDATA: return (rawuvalue(o) + 1);
431    case LUA_TLIGHTUSERDATA: return pvalue(o);
432    default: return NULL;
433  }
428   StkId o = index2addr(L, idx);
429   switch (ttypenv(o)) {
430   case LUA_TUSERDATA: return (rawuvalue(o) + 1);
431   case LUA_TLIGHTUSERDATA: return pvalue(o);
432   default: return NULL;
433   }
434434}
435435
436436
437437LUA_API lua_State *lua_tothread (lua_State *L, int idx) {
438  StkId o = index2addr(L, idx);
439  return (!ttisthread(o)) ? NULL : thvalue(o);
438   StkId o = index2addr(L, idx);
439   return (!ttisthread(o)) ? NULL : thvalue(o);
440440}
441441
442442
443443LUA_API const void *lua_topointer (lua_State *L, int idx) {
444  StkId o = index2addr(L, idx);
445  switch (ttype(o)) {
446    case LUA_TTABLE: return hvalue(o);
447    case LUA_TLCL: return clLvalue(o);
448    case LUA_TCCL: return clCvalue(o);
449    case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o)));
450    case LUA_TTHREAD: return thvalue(o);
451    case LUA_TUSERDATA:
452    case LUA_TLIGHTUSERDATA:
453      return lua_touserdata(L, idx);
454    default: return NULL;
455  }
444   StkId o = index2addr(L, idx);
445   switch (ttype(o)) {
446   case LUA_TTABLE: return hvalue(o);
447   case LUA_TLCL: return clLvalue(o);
448   case LUA_TCCL: return clCvalue(o);
449   case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o)));
450   case LUA_TTHREAD: return thvalue(o);
451   case LUA_TUSERDATA:
452   case LUA_TLIGHTUSERDATA:
453      return lua_touserdata(L, idx);
454   default: return NULL;
455   }
456456}
457457
458458
r31373r31374
463463
464464
465465LUA_API void lua_pushnil (lua_State *L) {
466  lua_lock(L);
467  setnilvalue(L->top);
468  api_incr_top(L);
469  lua_unlock(L);
466   lua_lock(L);
467   setnilvalue(L->top);
468   api_incr_top(L);
469   lua_unlock(L);
470470}
471471
472472
473473LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
474  lua_lock(L);
475  setnvalue(L->top, n);
476  luai_checknum(L, L->top,
477    luaG_runerror(L, "C API - attempt to push a signaling NaN"));
478  api_incr_top(L);
479  lua_unlock(L);
474   lua_lock(L);
475   setnvalue(L->top, n);
476   luai_checknum(L, L->top,
477   luaG_runerror(L, "C API - attempt to push a signaling NaN"));
478   api_incr_top(L);
479   lua_unlock(L);
480480}
481481
482482
483483LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) {
484  lua_lock(L);
485  setnvalue(L->top, cast_num(n));
486  api_incr_top(L);
487  lua_unlock(L);
484   lua_lock(L);
485   setnvalue(L->top, cast_num(n));
486   api_incr_top(L);
487   lua_unlock(L);
488488}
489489
490490
491491LUA_API void lua_pushunsigned (lua_State *L, lua_Unsigned u) {
492  lua_Number n;
493  lua_lock(L);
494  n = lua_unsigned2number(u);
495  setnvalue(L->top, n);
496  api_incr_top(L);
497  lua_unlock(L);
492   lua_Number n;
493   lua_lock(L);
494   n = lua_unsigned2number(u);
495   setnvalue(L->top, n);
496   api_incr_top(L);
497   lua_unlock(L);
498498}
499499
500500
501501LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) {
502  TString *ts;
503  lua_lock(L);
504  luaC_checkGC(L);
505  ts = luaS_newlstr(L, s, len);
506  setsvalue2s(L, L->top, ts);
507  api_incr_top(L);
508  lua_unlock(L);
509  return getstr(ts);
502   TString *ts;
503   lua_lock(L);
504   luaC_checkGC(L);
505   ts = luaS_newlstr(L, s, len);
506   setsvalue2s(L, L->top, ts);
507   api_incr_top(L);
508   lua_unlock(L);
509   return getstr(ts);
510510}
511511
512512
513513LUA_API const char *lua_pushstring (lua_State *L, const char *s) {
514  if (s == NULL) {
515    lua_pushnil(L);
516    return NULL;
517  }
518  else {
519    TString *ts;
520    lua_lock(L);
521    luaC_checkGC(L);
522    ts = luaS_new(L, s);
523    setsvalue2s(L, L->top, ts);
524    api_incr_top(L);
525    lua_unlock(L);
526    return getstr(ts);
527  }
514   if (s == NULL) {
515   lua_pushnil(L);
516   return NULL;
517   }
518   else {
519   TString *ts;
520   lua_lock(L);
521   luaC_checkGC(L);
522   ts = luaS_new(L, s);
523   setsvalue2s(L, L->top, ts);
524   api_incr_top(L);
525   lua_unlock(L);
526   return getstr(ts);
527   }
528528}
529529
530530
531531LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt,
532                                      va_list argp) {
533  const char *ret;
534  lua_lock(L);
535  luaC_checkGC(L);
536  ret = luaO_pushvfstring(L, fmt, argp);
537  lua_unlock(L);
538  return ret;
532                              va_list argp) {
533   const char *ret;
534   lua_lock(L);
535   luaC_checkGC(L);
536   ret = luaO_pushvfstring(L, fmt, argp);
537   lua_unlock(L);
538   return ret;
539539}
540540
541541
542542LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) {
543  const char *ret;
544  va_list argp;
545  lua_lock(L);
546  luaC_checkGC(L);
547  va_start(argp, fmt);
548  ret = luaO_pushvfstring(L, fmt, argp);
549  va_end(argp);
550  lua_unlock(L);
551  return ret;
543   const char *ret;
544   va_list argp;
545   lua_lock(L);
546   luaC_checkGC(L);
547   va_start(argp, fmt);
548   ret = luaO_pushvfstring(L, fmt, argp);
549   va_end(argp);
550   lua_unlock(L);
551   return ret;
552552}
553553
554554
555555LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
556  lua_lock(L);
557  if (n == 0) {
558    setfvalue(L->top, fn);
559  }
560  else {
561    Closure *cl;
562    api_checknelems(L, n);
563    api_check(L, n <= MAXUPVAL, "upvalue index too large");
564    luaC_checkGC(L);
565    cl = luaF_newCclosure(L, n);
566    cl->c.f = fn;
567    L->top -= n;
568    while (n--)
569      setobj2n(L, &cl->c.upvalue[n], L->top + n);
570    setclCvalue(L, L->top, cl);
571  }
572  api_incr_top(L);
573  lua_unlock(L);
556   lua_lock(L);
557   if (n == 0) {
558   setfvalue(L->top, fn);
559   }
560   else {
561   Closure *cl;
562   api_checknelems(L, n);
563   api_check(L, n <= MAXUPVAL, "upvalue index too large");
564   luaC_checkGC(L);
565   cl = luaF_newCclosure(L, n);
566   cl->c.f = fn;
567   L->top -= n;
568   while (n--)
569      setobj2n(L, &cl->c.upvalue[n], L->top + n);
570   setclCvalue(L, L->top, cl);
571   }
572   api_incr_top(L);
573   lua_unlock(L);
574574}
575575
576576
577577LUA_API void lua_pushboolean (lua_State *L, int b) {
578  lua_lock(L);
579  setbvalue(L->top, (b != 0));  /* ensure that true is 1 */
580  api_incr_top(L);
581  lua_unlock(L);
578   lua_lock(L);
579   setbvalue(L->top, (b != 0));  /* ensure that true is 1 */
580   api_incr_top(L);
581   lua_unlock(L);
582582}
583583
584584
585585LUA_API void lua_pushlightuserdata (lua_State *L, void *p) {
586  lua_lock(L);
587  setpvalue(L->top, p);
588  api_incr_top(L);
589  lua_unlock(L);
586   lua_lock(L);
587   setpvalue(L->top, p);
588   api_incr_top(L);
589   lua_unlock(L);
590590}
591591
592592
593593LUA_API int lua_pushthread (lua_State *L) {
594  lua_lock(L);
595  setthvalue(L, L->top, L);
596  api_incr_top(L);
597  lua_unlock(L);
598  return (G(L)->mainthread == L);
594   lua_lock(L);
595   setthvalue(L, L->top, L);
596   api_incr_top(L);
597   lua_unlock(L);
598   return (G(L)->mainthread == L);
599599}
600600
601601
r31373r31374
606606
607607
608608LUA_API void lua_getglobal (lua_State *L, const char *var) {
609  Table *reg = hvalue(&G(L)->l_registry);
610  const TValue *gt;  /* global table */
611  lua_lock(L);
612  gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
613  setsvalue2s(L, L->top++, luaS_new(L, var));
614  luaV_gettable(L, gt, L->top - 1, L->top - 1);
615  lua_unlock(L);
609   Table *reg = hvalue(&G(L)->l_registry);
610   const TValue *gt;  /* global table */
611   lua_lock(L);
612   gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
613   setsvalue2s(L, L->top++, luaS_new(L, var));
614   luaV_gettable(L, gt, L->top - 1, L->top - 1);
615   lua_unlock(L);
616616}
617617
618618
619619LUA_API void lua_gettable (lua_State *L, int idx) {
620  StkId t;
621  lua_lock(L);
622  t = index2addr(L, idx);
623  luaV_gettable(L, t, L->top - 1, L->top - 1);
624  lua_unlock(L);
620   StkId t;
621   lua_lock(L);
622   t = index2addr(L, idx);
623   luaV_gettable(L, t, L->top - 1, L->top - 1);
624   lua_unlock(L);
625625}
626626
627627
628628LUA_API void lua_getfield (lua_State *L, int idx, const char *k) {
629  StkId t;
630  lua_lock(L);
631  t = index2addr(L, idx);
632  setsvalue2s(L, L->top, luaS_new(L, k));
633  api_incr_top(L);
634  luaV_gettable(L, t, L->top - 1, L->top - 1);
635  lua_unlock(L);
629   StkId t;
630   lua_lock(L);
631   t = index2addr(L, idx);
632   setsvalue2s(L, L->top, luaS_new(L, k));
633   api_incr_top(L);
634   luaV_gettable(L, t, L->top - 1, L->top - 1);
635   lua_unlock(L);
636636}
637637
638638
639639LUA_API void lua_rawget (lua_State *L, int idx) {
640  StkId t;
641  lua_lock(L);
642  t = index2addr(L, idx);
643  api_check(L, ttistable(t), "table expected");
644  setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1));
645  lua_unlock(L);
640   StkId t;
641   lua_lock(L);
642   t = index2addr(L, idx);
643   api_check(L, ttistable(t), "table expected");
644   setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1));
645   lua_unlock(L);
646646}
647647
648648
649649LUA_API void lua_rawgeti (lua_State *L, int idx, int n) {
650  StkId t;
651  lua_lock(L);
652  t = index2addr(L, idx);
653  api_check(L, ttistable(t), "table expected");
654  setobj2s(L, L->top, luaH_getint(hvalue(t), n));
655  api_incr_top(L);
656  lua_unlock(L);
650   StkId t;
651   lua_lock(L);
652   t = index2addr(L, idx);
653   api_check(L, ttistable(t), "table expected");
654   setobj2s(L, L->top, luaH_getint(hvalue(t), n));
655   api_incr_top(L);
656   lua_unlock(L);
657657}
658658
659659
660660LUA_API void lua_rawgetp (lua_State *L, int idx, const void *p) {
661  StkId t;
662  TValue k;
663  lua_lock(L);
664  t = index2addr(L, idx);
665  api_check(L, ttistable(t), "table expected");
666  setpvalue(&k, cast(void *, p));
667  setobj2s(L, L->top, luaH_get(hvalue(t), &k));
668  api_incr_top(L);
669  lua_unlock(L);
661   StkId t;
662   TValue k;
663   lua_lock(L);
664   t = index2addr(L, idx);
665   api_check(L, ttistable(t), "table expected");
666   setpvalue(&k, cast(void *, p));
667   setobj2s(L, L->top, luaH_get(hvalue(t), &k));
668   api_incr_top(L);
669   lua_unlock(L);
670670}
671671
672672
673673LUA_API void lua_createtable (lua_State *L, int narray, int nrec) {
674  Table *t;
675  lua_lock(L);
676  luaC_checkGC(L);
677  t = luaH_new(L);
678  sethvalue(L, L->top, t);
679  api_incr_top(L);
680  if (narray > 0 || nrec > 0)
681    luaH_resize(L, t, narray, nrec);
682  lua_unlock(L);
674   Table *t;
675   lua_lock(L);
676   luaC_checkGC(L);
677   t = luaH_new(L);
678   sethvalue(L, L->top, t);
679   api_incr_top(L);
680   if (narray > 0 || nrec > 0)
681   luaH_resize(L, t, narray, nrec);
682   lua_unlock(L);
683683}
684684
685685
686686LUA_API int lua_getmetatable (lua_State *L, int objindex) {
687  const TValue *obj;
688  Table *mt = NULL;
689  int res;
690  lua_lock(L);
691  obj = index2addr(L, objindex);
692  switch (ttypenv(obj)) {
693    case LUA_TTABLE:
694      mt = hvalue(obj)->metatable;
695      break;
696    case LUA_TUSERDATA:
697      mt = uvalue(obj)->metatable;
698      break;
699    default:
700      mt = G(L)->mt[ttypenv(obj)];
701      break;
702  }
703  if (mt == NULL)
704    res = 0;
705  else {
706    sethvalue(L, L->top, mt);
707    api_incr_top(L);
708    res = 1;
709  }
710  lua_unlock(L);
711  return res;
687   const TValue *obj;
688   Table *mt = NULL;
689   int res;
690   lua_lock(L);
691   obj = index2addr(L, objindex);
692   switch (ttypenv(obj)) {
693   case LUA_TTABLE:
694      mt = hvalue(obj)->metatable;
695      break;
696   case LUA_TUSERDATA:
697      mt = uvalue(obj)->metatable;
698      break;
699   default:
700      mt = G(L)->mt[ttypenv(obj)];
701      break;
702   }
703   if (mt == NULL)
704   res = 0;
705   else {
706   sethvalue(L, L->top, mt);
707   api_incr_top(L);
708   res = 1;
709   }
710   lua_unlock(L);
711   return res;
712712}
713713
714714
715715LUA_API void lua_getuservalue (lua_State *L, int idx) {
716  StkId o;
717  lua_lock(L);
718  o = index2addr(L, idx);
719  api_check(L, ttisuserdata(o), "userdata expected");
720  if (uvalue(o)->env) {
721    sethvalue(L, L->top, uvalue(o)->env);
722  } else
723    setnilvalue(L->top);
724  api_incr_top(L);
725  lua_unlock(L);
716   StkId o;
717   lua_lock(L);
718   o = index2addr(L, idx);
719   api_check(L, ttisuserdata(o), "userdata expected");
720   if (uvalue(o)->env) {
721   sethvalue(L, L->top, uvalue(o)->env);
722   } else
723   setnilvalue(L->top);
724   api_incr_top(L);
725   lua_unlock(L);
726726}
727727
728728
r31373r31374
732732
733733
734734LUA_API void lua_setglobal (lua_State *L, const char *var) {
735  Table *reg = hvalue(&G(L)->l_registry);
736  const TValue *gt;  /* global table */
737  lua_lock(L);
738  api_checknelems(L, 1);
739  gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
740  setsvalue2s(L, L->top++, luaS_new(L, var));
741  luaV_settable(L, gt, L->top - 1, L->top - 2);
742  L->top -= 2;  /* pop value and key */
743  lua_unlock(L);
735   Table *reg = hvalue(&G(L)->l_registry);
736   const TValue *gt;  /* global table */
737   lua_lock(L);
738   api_checknelems(L, 1);
739   gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
740   setsvalue2s(L, L->top++, luaS_new(L, var));
741   luaV_settable(L, gt, L->top - 1, L->top - 2);
742   L->top -= 2;  /* pop value and key */
743   lua_unlock(L);
744744}
745745
746746
747747LUA_API void lua_settable (lua_State *L, int idx) {
748  StkId t;
749  lua_lock(L);
750  api_checknelems(L, 2);
751  t = index2addr(L, idx);
752  luaV_settable(L, t, L->top - 2, L->top - 1);
753  L->top -= 2;  /* pop index and value */
754  lua_unlock(L);
748   StkId t;
749   lua_lock(L);
750   api_checknelems(L, 2);
751   t = index2addr(L, idx);
752   luaV_settable(L, t, L->top - 2, L->top - 1);
753   L->top -= 2;  /* pop index and value */
754   lua_unlock(L);
755755}
756756
757757
758758LUA_API void lua_setfield (lua_State *L, int idx, const char *k) {
759  StkId t;
760  lua_lock(L);
761  api_checknelems(L, 1);
762  t = index2addr(L, idx);
763  setsvalue2s(L, L->top++, luaS_new(L, k));
764  luaV_settable(L, t, L->top - 1, L->top - 2);
765  L->top -= 2;  /* pop value and key */
766  lua_unlock(L);
759   StkId t;
760   lua_lock(L);
761   api_checknelems(L, 1);
762   t = index2addr(L, idx);
763   setsvalue2s(L, L->top++, luaS_new(L, k));
764   luaV_settable(L, t, L->top - 1, L->top - 2);
765   L->top -= 2;  /* pop value and key */
766   lua_unlock(L);
767767}
768768
769769
770770LUA_API void lua_rawset (lua_State *L, int idx) {
771  StkId t;
772  lua_lock(L);
773  api_checknelems(L, 2);
774  t = index2addr(L, idx);
775  api_check(L, ttistable(t), "table expected");
776  setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1);
777  invalidateTMcache(hvalue(t));
778  luaC_barrierback(L, gcvalue(t), L->top-1);
779  L->top -= 2;
780  lua_unlock(L);
771   StkId t;
772   lua_lock(L);
773   api_checknelems(L, 2);
774   t = index2addr(L, idx);
775   api_check(L, ttistable(t), "table expected");
776   setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1);
777   invalidateTMcache(hvalue(t));
778   luaC_barrierback(L, gcvalue(t), L->top-1);
779   L->top -= 2;
780   lua_unlock(L);
781781}
782782
783783
784784LUA_API void lua_rawseti (lua_State *L, int idx, int n) {
785  StkId t;
786  lua_lock(L);
787  api_checknelems(L, 1);
788  t = index2addr(L, idx);
789  api_check(L, ttistable(t), "table expected");
790  luaH_setint(L, hvalue(t), n, L->top - 1);
791  luaC_barrierback(L, gcvalue(t), L->top-1);
792  L->top--;
793  lua_unlock(L);
785   StkId t;
786   lua_lock(L);
787   api_checknelems(L, 1);
788   t = index2addr(L, idx);
789   api_check(L, ttistable(t), "table expected");
790   luaH_setint(L, hvalue(t), n, L->top - 1);
791   luaC_barrierback(L, gcvalue(t), L->top-1);
792   L->top--;
793   lua_unlock(L);
794794}
795795
796796
797797LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) {
798  StkId t;
799  TValue k;
800  lua_lock(L);
801  api_checknelems(L, 1);
802  t = index2addr(L, idx);
803  api_check(L, ttistable(t), "table expected");
804  setpvalue(&k, cast(void *, p));
805  setobj2t(L, luaH_set(L, hvalue(t), &k), L->top - 1);
806  luaC_barrierback(L, gcvalue(t), L->top - 1);
807  L->top--;
808  lua_unlock(L);
798   StkId t;
799   TValue k;
800   lua_lock(L);
801   api_checknelems(L, 1);
802   t = index2addr(L, idx);
803   api_check(L, ttistable(t), "table expected");
804   setpvalue(&k, cast(void *, p));
805   setobj2t(L, luaH_set(L, hvalue(t), &k), L->top - 1);
806   luaC_barrierback(L, gcvalue(t), L->top - 1);
807   L->top--;
808   lua_unlock(L);
809809}
810810
811811
812812LUA_API int lua_setmetatable (lua_State *L, int objindex) {
813  TValue *obj;
814  Table *mt;
815  lua_lock(L);
816  api_checknelems(L, 1);
817  obj = index2addr(L, objindex);
818  if (ttisnil(L->top - 1))
819    mt = NULL;
820  else {
821    api_check(L, ttistable(L->top - 1), "table expected");
822    mt = hvalue(L->top - 1);
823  }
824  switch (ttypenv(obj)) {
825    case LUA_TTABLE: {
826      hvalue(obj)->metatable = mt;
827      if (mt) {
828        luaC_objbarrierback(L, gcvalue(obj), mt);
829        luaC_checkfinalizer(L, gcvalue(obj), mt);
830      }
831      break;
832    }
833    case LUA_TUSERDATA: {
834      uvalue(obj)->metatable = mt;
835      if (mt) {
836        luaC_objbarrier(L, rawuvalue(obj), mt);
837        luaC_checkfinalizer(L, gcvalue(obj), mt);
838      }
839      break;
840    }
841    default: {
842      G(L)->mt[ttypenv(obj)] = mt;
843      break;
844    }
845  }
846  L->top--;
847  lua_unlock(L);
848  return 1;
813   TValue *obj;
814   Table *mt;
815   lua_lock(L);
816   api_checknelems(L, 1);
817   obj = index2addr(L, objindex);
818   if (ttisnil(L->top - 1))
819   mt = NULL;
820   else {
821   api_check(L, ttistable(L->top - 1), "table expected");
822   mt = hvalue(L->top - 1);
823   }
824   switch (ttypenv(obj)) {
825   case LUA_TTABLE: {
826      hvalue(obj)->metatable = mt;
827      if (mt) {
828      luaC_objbarrierback(L, gcvalue(obj), mt);
829      luaC_checkfinalizer(L, gcvalue(obj), mt);
830      }
831      break;
832   }
833   case LUA_TUSERDATA: {
834      uvalue(obj)->metatable = mt;
835      if (mt) {
836      luaC_objbarrier(L, rawuvalue(obj), mt);
837      luaC_checkfinalizer(L, gcvalue(obj), mt);
838      }
839      break;
840   }
841   default: {
842      G(L)->mt[ttypenv(obj)] = mt;
843      break;
844   }
845   }
846   L->top--;
847   lua_unlock(L);
848   return 1;
849849}
850850
851851
852852LUA_API void lua_setuservalue (lua_State *L, int idx) {
853  StkId o;
854  lua_lock(L);
855  api_checknelems(L, 1);
856  o = index2addr(L, idx);
857  api_check(L, ttisuserdata(o), "userdata expected");
858  if (ttisnil(L->top - 1))
859    uvalue(o)->env = NULL;
860  else {
861    api_check(L, ttistable(L->top - 1), "table expected");
862    uvalue(o)->env = hvalue(L->top - 1);
863    luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1));
864  }
865  L->top--;
866  lua_unlock(L);
853   StkId o;
854   lua_lock(L);
855   api_checknelems(L, 1);
856   o = index2addr(L, idx);
857   api_check(L, ttisuserdata(o), "userdata expected");
858   if (ttisnil(L->top - 1))
859   uvalue(o)->env = NULL;
860   else {
861   api_check(L, ttistable(L->top - 1), "table expected");
862   uvalue(o)->env = hvalue(L->top - 1);
863   luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1));
864   }
865   L->top--;
866   lua_unlock(L);
867867}
868868
869869
r31373r31374
873873
874874
875875#define checkresults(L,na,nr) \
876     api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \
876      api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \
877877   "results from function overflow current stack size")
878878
879879
880880LUA_API int lua_getctx (lua_State *L, int *ctx) {
881  if (L->ci->callstatus & CIST_YIELDED) {
882    if (ctx) *ctx = L->ci->u.c.ctx;
883    return L->ci->u.c.status;
884  }
885  else return LUA_OK;
881   if (L->ci->callstatus & CIST_YIELDED) {
882   if (ctx) *ctx = L->ci->u.c.ctx;
883   return L->ci->u.c.status;
884   }
885   else return LUA_OK;
886886}
887887
888888
889889LUA_API void lua_callk (lua_State *L, int nargs, int nresults, int ctx,
890                        lua_CFunction k) {
891  StkId func;
892  lua_lock(L);
893  api_check(L, k == NULL || !isLua(L->ci),
894    "cannot use continuations inside hooks");
895  api_checknelems(L, nargs+1);
896  api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread");
897  checkresults(L, nargs, nresults);
898  func = L->top - (nargs+1);
899  if (k != NULL && L->nny == 0) {  /* need to prepare continuation? */
900    L->ci->u.c.k = k;  /* save continuation */
901    L->ci->u.c.ctx = ctx;  /* save context */
902    luaD_call(L, func, nresults, 1);  /* do the call */
903  }
904  else  /* no continuation or no yieldable */
905    luaD_call(L, func, nresults, 0);  /* just do the call */
906  adjustresults(L, nresults);
907  lua_unlock(L);
890                  lua_CFunction k) {
891   StkId func;
892   lua_lock(L);
893   api_check(L, k == NULL || !isLua(L->ci),
894   "cannot use continuations inside hooks");
895   api_checknelems(L, nargs+1);
896   api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread");
897   checkresults(L, nargs, nresults);
898   func = L->top - (nargs+1);
899   if (k != NULL && L->nny == 0) {  /* need to prepare continuation? */
900   L->ci->u.c.k = k;  /* save continuation */
901   L->ci->u.c.ctx = ctx;  /* save context */
902   luaD_call(L, func, nresults, 1);  /* do the call */
903   }
904   else  /* no continuation or no yieldable */
905   luaD_call(L, func, nresults, 0);  /* just do the call */
906   adjustresults(L, nresults);
907   lua_unlock(L);
908908}
909909
910910
r31373r31374
913913** Execute a protected call.
914914*/
915915struct CallS {  /* data to `f_call' */
916  StkId func;
917  int nresults;
916   StkId func;
917   int nresults;
918918};
919919
920920
921921static void f_call (lua_State *L, void *ud) {
922  struct CallS *c = cast(struct CallS *, ud);
923  luaD_call(L, c->func, c->nresults, 0);
922   struct CallS *c = cast(struct CallS *, ud);
923   luaD_call(L, c->func, c->nresults, 0);
924924}
925925
926926
927927
928928LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
929                        int ctx, lua_CFunction k) {
930  struct CallS c;
931  int status;
932  ptrdiff_t func;
933  lua_lock(L);
934  api_check(L, k == NULL || !isLua(L->ci),
935    "cannot use continuations inside hooks");
936  api_checknelems(L, nargs+1);
937  api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread");
938  checkresults(L, nargs, nresults);
939  if (errfunc == 0)
940    func = 0;
941  else {
942    StkId o = index2addr(L, errfunc);
943    api_checkstackindex(L, errfunc, o);
944    func = savestack(L, o);
945  }
946  c.func = L->top - (nargs+1);  /* function to be called */
947  if (k == NULL || L->nny > 0) {  /* no continuation or no yieldable? */
948    c.nresults = nresults;  /* do a 'conventional' protected call */
949    status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func);
950  }
951  else {  /* prepare continuation (call is already protected by 'resume') */
952    CallInfo *ci = L->ci;
953    ci->u.c.k = k;  /* save continuation */
954    ci->u.c.ctx = ctx;  /* save context */
955    /* save information for error recovery */
956    ci->extra = savestack(L, c.func);
957    ci->u.c.old_allowhook = L->allowhook;
958    ci->u.c.old_errfunc = L->errfunc;
959    L->errfunc = func;
960    /* mark that function may do error recovery */
961    ci->callstatus |= CIST_YPCALL;
962    luaD_call(L, c.func, nresults, 1);  /* do the call */
963    ci->callstatus &= ~CIST_YPCALL;
964    L->errfunc = ci->u.c.old_errfunc;
965    status = LUA_OK;  /* if it is here, there were no errors */
966  }
967  adjustresults(L, nresults);
968  lua_unlock(L);
969  return status;
929                  int ctx, lua_CFunction k) {
930   struct CallS c;
931   int status;
932   ptrdiff_t func;
933   lua_lock(L);
934   api_check(L, k == NULL || !isLua(L->ci),
935   "cannot use continuations inside hooks");
936   api_checknelems(L, nargs+1);
937   api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread");
938   checkresults(L, nargs, nresults);
939   if (errfunc == 0)
940   func = 0;
941   else {
942   StkId o = index2addr(L, errfunc);
943   api_checkstackindex(L, errfunc, o);
944   func = savestack(L, o);
945   }
946   c.func = L->top - (nargs+1);  /* function to be called */
947   if (k == NULL || L->nny > 0) {  /* no continuation or no yieldable? */
948   c.nresults = nresults;  /* do a 'conventional' protected call */
949   status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func);
950   }
951   else {  /* prepare continuation (call is already protected by 'resume') */
952   CallInfo *ci = L->ci;
953   ci->u.c.k = k;  /* save continuation */
954   ci->u.c.ctx = ctx;  /* save context */
955   /* save information for error recovery */
956   ci->extra = savestack(L, c.func);
957   ci->u.c.old_allowhook = L->allowhook;
958   ci->u.c.old_errfunc = L->errfunc;
959   L->errfunc = func;
960   /* mark that function may do error recovery */
961   ci->callstatus |= CIST_YPCALL;
962   luaD_call(L, c.func, nresults, 1);  /* do the call */
963   ci->callstatus &= ~CIST_YPCALL;
964   L->errfunc = ci->u.c.old_errfunc;
965   status = LUA_OK;  /* if it is here, there were no errors */
966   }
967   adjustresults(L, nresults);
968   lua_unlock(L);
969   return status;
970970}
971971
972972
973973LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
974                      const char *chunkname, const char *mode) {
975  ZIO z;
976  int status;
977  lua_lock(L);
978  if (!chunkname) chunkname = "?";
979  luaZ_init(L, &z, reader, data);
980  status = luaD_protectedparser(L, &z, chunkname, mode);
981  if (status == LUA_OK) {  /* no errors? */
982    LClosure *f = clLvalue(L->top - 1);  /* get newly created function */
983    if (f->nupvalues == 1) {  /* does it have one upvalue? */
984      /* get global table from registry */
985      Table *reg = hvalue(&G(L)->l_registry);
986      const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
987      /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */
988      setobj(L, f->upvals[0]->v, gt);
989      luaC_barrier(L, f->upvals[0], gt);
990    }
991  }
992  lua_unlock(L);
993  return status;
974                  const char *chunkname, const char *mode) {
975   ZIO z;
976   int status;
977   lua_lock(L);
978   if (!chunkname) chunkname = "?";
979   luaZ_init(L, &z, reader, data);
980   status = luaD_protectedparser(L, &z, chunkname, mode);
981   if (status == LUA_OK) {  /* no errors? */
982   LClosure *f = clLvalue(L->top - 1);  /* get newly created function */
983   if (f->nupvalues == 1) {  /* does it have one upvalue? */
984      /* get global table from registry */
985      Table *reg = hvalue(&G(L)->l_registry);
986      const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
987      /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */
988      setobj(L, f->upvals[0]->v, gt);
989      luaC_barrier(L, f->upvals[0], gt);
990   }
991   }
992   lua_unlock(L);
993   return status;
994994}
995995
996996
997997LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) {
998  int status;
999  TValue *o;
1000  lua_lock(L);
1001  api_checknelems(L, 1);
1002  o = L->top - 1;
1003  if (isLfunction(o))
1004    status = luaU_dump(L, getproto(o), writer, data, 0);
1005  else
1006    status = 1;
1007  lua_unlock(L);
1008  return status;
998   int status;
999   TValue *o;
1000   lua_lock(L);
1001   api_checknelems(L, 1);
1002   o = L->top - 1;
1003   if (isLfunction(o))
1004   status = luaU_dump(L, getproto(o), writer, data, 0);
1005   else
1006   status = 1;
1007   lua_unlock(L);
1008   return status;
10091009}
10101010
10111011
10121012LUA_API int lua_status (lua_State *L) {
1013  return L->status;
1013   return L->status;
10141014}
10151015
10161016
r31373r31374
10191019*/
10201020
10211021LUA_API int lua_gc (lua_State *L, int what, int data) {
1022  int res = 0;
1023  global_State *g;
1024  lua_lock(L);
1025  g = G(L);
1026  switch (what) {
1027    case LUA_GCSTOP: {
1028      g->gcrunning = 0;
1029      break;
1030    }
1031    case LUA_GCRESTART: {
1032      luaE_setdebt(g, 0);
1033      g->gcrunning = 1;
1034      break;
1035    }
1036    case LUA_GCCOLLECT: {
1037      luaC_fullgc(L, 0);
1038      break;
1039    }
1040    case LUA_GCCOUNT: {
1041      /* GC values are expressed in Kbytes: #bytes/2^10 */
1042      res = cast_int(gettotalbytes(g) >> 10);
1043      break;
1044    }
1045    case LUA_GCCOUNTB: {
1046      res = cast_int(gettotalbytes(g) & 0x3ff);
1047      break;
1048    }
1049    case LUA_GCSTEP: {
1050      if (g->gckind == KGC_GEN) {  /* generational mode? */
1051        res = (g->GCestimate == 0);  /* true if it will do major collection */
1052        luaC_forcestep(L);  /* do a single step */
1053      }
1054      else {
1055       lu_mem debt = cast(lu_mem, data) * 1024 - GCSTEPSIZE;
1056       if (g->gcrunning)
1057         debt += g->GCdebt;  /* include current debt */
1058       luaE_setdebt(g, debt);
1059       luaC_forcestep(L);
1060       if (g->gcstate == GCSpause)  /* end of cycle? */
1061         res = 1;  /* signal it */
1062      }
1063      break;
1064    }
1065    case LUA_GCSETPAUSE: {
1066      res = g->gcpause;
1067      g->gcpause = data;
1068      break;
1069    }
1070    case LUA_GCSETMAJORINC: {
1071      res = g->gcmajorinc;
1072      g->gcmajorinc = data;
1073      break;
1074    }
1075    case LUA_GCSETSTEPMUL: {
1076      res = g->gcstepmul;
1077      g->gcstepmul = data;
1078      break;
1079    }
1080    case LUA_GCISRUNNING: {
1081      res = g->gcrunning;
1082      break;
1083    }
1084    case LUA_GCGEN: {  /* change collector to generational mode */
1085      luaC_changemode(L, KGC_GEN);
1086      break;
1087    }
1088    case LUA_GCINC: {  /* change collector to incremental mode */
1089      luaC_changemode(L, KGC_NORMAL);
1090      break;
1091    }
1092    default: res = -1;  /* invalid option */
1093  }
1094  lua_unlock(L);
1095  return res;
1022   int res = 0;
1023   global_State *g;
1024   lua_lock(L);
1025   g = G(L);
1026   switch (what) {
1027   case LUA_GCSTOP: {
1028      g->gcrunning = 0;
1029      break;
1030   }
1031   case LUA_GCRESTART: {
1032      luaE_setdebt(g, 0);
1033      g->gcrunning = 1;
1034      break;
1035   }
1036   case LUA_GCCOLLECT: {
1037      luaC_fullgc(L, 0);
1038      break;
1039   }
1040   case LUA_GCCOUNT: {
1041      /* GC values are expressed in Kbytes: #bytes/2^10 */
1042      res = cast_int(gettotalbytes(g) >> 10);
1043      break;
1044   }
1045   case LUA_GCCOUNTB: {
1046      res = cast_int(gettotalbytes(g) & 0x3ff);
1047      break;
1048   }
1049   case LUA_GCSTEP: {
1050      if (g->gckind == KGC_GEN) {  /* generational mode? */
1051      res = (g->GCestimate == 0);  /* true if it will do major collection */
1052      luaC_forcestep(L);  /* do a single step */
1053      }
1054      else {
1055      lu_mem debt = cast(lu_mem, data) * 1024 - GCSTEPSIZE;
1056      if (g->gcrunning)
1057         debt += g->GCdebt;  /* include current debt */
1058      luaE_setdebt(g, debt);
1059      luaC_forcestep(L);
1060      if (g->gcstate == GCSpause)  /* end of cycle? */
1061         res = 1;  /* signal it */
1062      }
1063      break;
1064   }
1065   case LUA_GCSETPAUSE: {
1066      res = g->gcpause;
1067      g->gcpause = data;
1068      break;
1069   }
1070   case LUA_GCSETMAJORINC: {
1071      res = g->gcmajorinc;
1072      g->gcmajorinc = data;
1073      break;
1074   }
1075   case LUA_GCSETSTEPMUL: {
1076      res = g->gcstepmul;
1077      g->gcstepmul = data;
1078      break;
1079   }
1080   case LUA_GCISRUNNING: {
1081      res = g->gcrunning;
1082      break;
1083   }
1084   case LUA_GCGEN: {  /* change collector to generational mode */
1085      luaC_changemode(L, KGC_GEN);
1086      break;
1087   }
1088   case LUA_GCINC: {  /* change collector to incremental mode */
1089      luaC_changemode(L, KGC_NORMAL);
1090      break;
1091   }
1092   default: res = -1;  /* invalid option */
1093   }
1094   lua_unlock(L);
1095   return res;
10961096}
10971097
10981098
r31373r31374
11031103
11041104
11051105LUA_API int lua_error (lua_State *L) {
1106  lua_lock(L);
1107  api_checknelems(L, 1);
1108  luaG_errormsg(L);
1109  /* code unreachable; will unlock when control actually leaves the kernel */
1110  return 0;  /* to avoid warnings */
1106   lua_lock(L);
1107   api_checknelems(L, 1);
1108   luaG_errormsg(L);
1109   /* code unreachable; will unlock when control actually leaves the kernel */
1110   return 0;  /* to avoid warnings */
11111111}
11121112
11131113
11141114LUA_API int lua_next (lua_State *L, int idx) {
1115  StkId t;
1116  int more;
1117  lua_lock(L);
1118  t = index2addr(L, idx);
1119  api_check(L, ttistable(t), "table expected");
1120  more = luaH_next(L, hvalue(t), L->top - 1);
1121  if (more) {
1122    api_incr_top(L);
1123  }
1124  else  /* no more elements */
1125    L->top -= 1;  /* remove key */
1126  lua_unlock(L);
1127  return more;
1115   StkId t;
1116   int more;
1117   lua_lock(L);
1118   t = index2addr(L, idx);
1119   api_check(L, ttistable(t), "table expected");
1120   more = luaH_next(L, hvalue(t), L->top - 1);
1121   if (more) {
1122   api_incr_top(L);
1123   }
1124   else  /* no more elements */
1125   L->top -= 1;  /* remove key */
1126   lua_unlock(L);
1127   return more;
11281128}
11291129
11301130
11311131LUA_API void lua_concat (lua_State *L, int n) {
1132  lua_lock(L);
1133  api_checknelems(L, n);
1134  if (n >= 2) {
1135    luaC_checkGC(L);
1136    luaV_concat(L, n);
1137  }
1138  else if (n == 0) {  /* push empty string */
1139    setsvalue2s(L, L->top, luaS_newlstr(L, "", 0));
1140    api_incr_top(L);
1141  }
1142  /* else n == 1; nothing to do */
1143  lua_unlock(L);
1132   lua_lock(L);
1133   api_checknelems(L, n);
1134   if (n >= 2) {
1135   luaC_checkGC(L);
1136   luaV_concat(L, n);
1137   }
1138   else if (n == 0) {  /* push empty string */
1139   setsvalue2s(L, L->top, luaS_newlstr(L, "", 0));
1140   api_incr_top(L);
1141   }
1142   /* else n == 1; nothing to do */
1143   lua_unlock(L);
11441144}
11451145
11461146
11471147LUA_API void lua_len (lua_State *L, int idx) {
1148  StkId t;
1149  lua_lock(L);
1150  t = index2addr(L, idx);
1151  luaV_objlen(L, L->top, t);
1152  api_incr_top(L);
1153  lua_unlock(L);
1148   StkId t;
1149   lua_lock(L);
1150   t = index2addr(L, idx);
1151   luaV_objlen(L, L->top, t);
1152   api_incr_top(L);
1153   lua_unlock(L);
11541154}
11551155
11561156
11571157LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) {
1158  lua_Alloc f;
1159  lua_lock(L);
1160  if (ud) *ud = G(L)->ud;
1161  f = G(L)->frealloc;
1162  lua_unlock(L);
1163  return f;
1158   lua_Alloc f;
1159   lua_lock(L);
1160   if (ud) *ud = G(L)->ud;
1161   f = G(L)->frealloc;
1162   lua_unlock(L);
1163   return f;
11641164}
11651165
11661166
11671167LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) {
1168  lua_lock(L);
1169  G(L)->ud = ud;
1170  G(L)->frealloc = f;
1171  lua_unlock(L);
1168   lua_lock(L);
1169   G(L)->ud = ud;
1170   G(L)->frealloc = f;
1171   lua_unlock(L);
11721172}
11731173
11741174
11751175LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
1176  Udata *u;
1177  lua_lock(L);
1178  luaC_checkGC(L);
1179  u = luaS_newudata(L, size, NULL);
1180  setuvalue(L, L->top, u);
1181  api_incr_top(L);
1182  lua_unlock(L);
1183  return u + 1;
1176   Udata *u;
1177   lua_lock(L);
1178   luaC_checkGC(L);
1179   u = luaS_newudata(L, size, NULL);
1180   setuvalue(L, L->top, u);
1181   api_incr_top(L);
1182   lua_unlock(L);
1183   return u + 1;
11841184}
11851185
11861186
11871187
11881188static const char *aux_upvalue (StkId fi, int n, TValue **val,
1189                                GCObject **owner) {
1190  switch (ttype(fi)) {
1191    case LUA_TCCL: {  /* C closure */
1192      CClosure *f = clCvalue(fi);
1193      if (!(1 <= n && n <= f->nupvalues)) return NULL;
1194      *val = &f->upvalue[n-1];
1195      if (owner) *owner = obj2gco(f);
1196      return "";
1197    }
1198    case LUA_TLCL: {  /* Lua closure */
1199      LClosure *f = clLvalue(fi);
1200      TString *name;
1201      Proto *p = f->p;
1202      if (!(1 <= n && n <= p->sizeupvalues)) return NULL;
1203      *val = f->upvals[n-1]->v;
1204      if (owner) *owner = obj2gco(f->upvals[n - 1]);
1205      name = p->upvalues[n-1].name;
1206      return (name == NULL) ? "" : getstr(name);
1207    }
1208    default: return NULL;  /* not a closure */
1209  }
1189                        GCObject **owner) {
1190   switch (ttype(fi)) {
1191   case LUA_TCCL: {  /* C closure */
1192      CClosure *f = clCvalue(fi);
1193      if (!(1 <= n && n <= f->nupvalues)) return NULL;
1194      *val = &f->upvalue[n-1];
1195      if (owner) *owner = obj2gco(f);
1196      return "";
1197   }
1198   case LUA_TLCL: {  /* Lua closure */
1199      LClosure *f = clLvalue(fi);
1200      TString *name;
1201      Proto *p = f->p;
1202      if (!(1 <= n && n <= p->sizeupvalues)) return NULL;
1203      *val = f->upvals[n-1]->v;
1204      if (owner) *owner = obj2gco(f->upvals[n - 1]);
1205      name = p->upvalues[n-1].name;
1206      return (name == NULL) ? "" : getstr(name);
1207   }
1208   default: return NULL;  /* not a closure */
1209   }
12101210}
12111211
12121212
12131213LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) {
1214  const char *name;
1215  TValue *val = NULL;  /* to avoid warnings */
1216  lua_lock(L);
1217  name = aux_upvalue(index2addr(L, funcindex), n, &val, NULL);
1218  if (name) {
1219    setobj2s(L, L->top, val);
1220    api_incr_top(L);
1221  }
1222  lua_unlock(L);
1223  return name;
1214   const char *name;
1215   TValue *val = NULL;  /* to avoid warnings */
1216   lua_lock(L);
1217   name = aux_upvalue(index2addr(L, funcindex), n, &val, NULL);
1218   if (name) {
1219   setobj2s(L, L->top, val);
1220   api_incr_top(L);
1221   }
1222   lua_unlock(L);
1223   return name;
12241224}
12251225
12261226
12271227LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {
1228  const char *name;
1229  TValue *val = NULL;  /* to avoid warnings */
1230  GCObject *owner = NULL;  /* to avoid warnings */
1231  StkId fi;
1232  lua_lock(L);
1233  fi = index2addr(L, funcindex);
1234  api_checknelems(L, 1);
1235  name = aux_upvalue(fi, n, &val, &owner);
1236  if (name) {
1237    L->top--;
1238    setobj(L, val, L->top);
1239    luaC_barrier(L, owner, L->top);
1240  }
1241  lua_unlock(L);
1242  return name;
1228   const char *name;
1229   TValue *val = NULL;  /* to avoid warnings */
1230   GCObject *owner = NULL;  /* to avoid warnings */
1231   StkId fi;
1232   lua_lock(L);
1233   fi = index2addr(L, funcindex);
1234   api_checknelems(L, 1);
1235   name = aux_upvalue(fi, n, &val, &owner);
1236   if (name) {
1237   L->top--;
1238   setobj(L, val, L->top);
1239   luaC_barrier(L, owner, L->top);
1240   }
1241   lua_unlock(L);
1242   return name;
12431243}
12441244
12451245
12461246static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) {
1247  LClosure *f;
1248  StkId fi = index2addr(L, fidx);
1249  api_check(L, ttisLclosure(fi), "Lua function expected");
1250  f = clLvalue(fi);
1251  api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index");
1252  if (pf) *pf = f;
1253  return &f->upvals[n - 1];  /* get its upvalue pointer */
1247   LClosure *f;
1248   StkId fi = index2addr(L, fidx);
1249   api_check(L, ttisLclosure(fi), "Lua function expected");
1250   f = clLvalue(fi);
1251   api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index");
1252   if (pf) *pf = f;
1253   return &f->upvals[n - 1];  /* get its upvalue pointer */
12541254}
12551255
12561256
12571257LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) {
1258  StkId fi = index2addr(L, fidx);
1259  switch (ttype(fi)) {
1260    case LUA_TLCL: {  /* lua closure */
1261      return *getupvalref(L, fidx, n, NULL);
1262    }
1263    case LUA_TCCL: {  /* C closure */
1264      CClosure *f = clCvalue(fi);
1265      api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index");
1266      return &f->upvalue[n - 1];
1267    }
1268    default: {
1269      api_check(L, 0, "closure expected");
1270      return NULL;
1271    }
1272  }
1258   StkId fi = index2addr(L, fidx);
1259   switch (ttype(fi)) {
1260   case LUA_TLCL: {  /* lua closure */
1261      return *getupvalref(L, fidx, n, NULL);
1262   }
1263   case LUA_TCCL: {  /* C closure */
1264      CClosure *f = clCvalue(fi);
1265      api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index");
1266      return &f->upvalue[n - 1];
1267   }
1268   default: {
1269      api_check(L, 0, "closure expected");
1270      return NULL;
1271   }
1272   }
12731273}
12741274
12751275
12761276LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1,
1277                                            int fidx2, int n2) {
1278  LClosure *f1;
1279  UpVal **up1 = getupvalref(L, fidx1, n1, &f1);
1280  UpVal **up2 = getupvalref(L, fidx2, n2, NULL);
1281  *up1 = *up2;
1282  luaC_objbarrier(L, f1, *up2);
1277                                 int fidx2, int n2) {
1278   LClosure *f1;
1279   UpVal **up1 = getupvalref(L, fidx1, n1, &f1);
1280   UpVal **up2 = getupvalref(L, fidx2, n2, NULL);
1281   *up1 = *up2;
1282   luaC_objbarrier(L, f1, *up2);
12831283}
1284
trunk/src/lib/lua/lcode.c
r31373r31374
2626#include "lvm.h"
2727
2828
29#define hasjumps(e)   ((e)->t != (e)->f)
29#define hasjumps(e) ((e)->t != (e)->f)
3030
3131
3232static int isnumeral(expdesc *e) {
33  return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP);
33   return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP);
3434}
3535
3636
3737void luaK_nil (FuncState *fs, int from, int n) {
38  Instruction *previous;
39  int l = from + n - 1;  /* last register to set nil */
40  if (fs->pc > fs->lasttarget) {  /* no jumps to current position? */
41    previous = &fs->f->code[fs->pc-1];
42    if (GET_OPCODE(*previous) == OP_LOADNIL) {
43      int pfrom = GETARG_A(*previous);
44      int pl = pfrom + GETARG_B(*previous);
45      if ((pfrom <= from && from <= pl + 1) ||
46          (from <= pfrom && pfrom <= l + 1)) {  /* can connect both? */
47        if (pfrom < from) from = pfrom;  /* from = min(from, pfrom) */
48        if (pl > l) l = pl;  /* l = max(l, pl) */
49        SETARG_A(*previous, from);
50        SETARG_B(*previous, l - from);
51        return;
52      }
53    }  /* else go through */
54  }
55  luaK_codeABC(fs, OP_LOADNIL, from, n - 1, 0);  /* else no optimization */
38   Instruction *previous;
39   int l = from + n - 1;  /* last register to set nil */
40   if (fs->pc > fs->lasttarget) {  /* no jumps to current position? */
41   previous = &fs->f->code[fs->pc-1];
42   if (GET_OPCODE(*previous) == OP_LOADNIL) {
43      int pfrom = GETARG_A(*previous);
44      int pl = pfrom + GETARG_B(*previous);
45      if ((pfrom <= from && from <= pl + 1) ||
46         (from <= pfrom && pfrom <= l + 1)) {  /* can connect both? */
47      if (pfrom < from) from = pfrom;  /* from = min(from, pfrom) */
48      if (pl > l) l = pl;  /* l = max(l, pl) */
49      SETARG_A(*previous, from);
50      SETARG_B(*previous, l - from);
51      return;
52      }
53   }  /* else go through */
54   }
55   luaK_codeABC(fs, OP_LOADNIL, from, n - 1, 0);  /* else no optimization */
5656}
5757
5858
5959int luaK_jump (FuncState *fs) {
60  int jpc = fs->jpc;  /* save list of jumps to here */
61  int j;
62  fs->jpc = NO_JUMP;
63  j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP);
64  luaK_concat(fs, &j, jpc);  /* keep them on hold */
65  return j;
60   int jpc = fs->jpc;  /* save list of jumps to here */
61   int j;
62   fs->jpc = NO_JUMP;
63   j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP);
64   luaK_concat(fs, &j, jpc);  /* keep them on hold */
65   return j;
6666}
6767
6868
6969void luaK_ret (FuncState *fs, int first, int nret) {
70  luaK_codeABC(fs, OP_RETURN, first, nret+1, 0);
70   luaK_codeABC(fs, OP_RETURN, first, nret+1, 0);
7171}
7272
7373
7474static int condjump (FuncState *fs, OpCode op, int A, int B, int C) {
75  luaK_codeABC(fs, op, A, B, C);
76  return luaK_jump(fs);
75   luaK_codeABC(fs, op, A, B, C);
76   return luaK_jump(fs);
7777}
7878
7979
8080static void fixjump (FuncState *fs, int pc, int dest) {
81  Instruction *jmp = &fs->f->code[pc];
82  int offset = dest-(pc+1);
83  lua_assert(dest != NO_JUMP);
84  if (abs(offset) > MAXARG_sBx)
85    luaX_syntaxerror(fs->ls, "control structure too long");
86  SETARG_sBx(*jmp, offset);
81   Instruction *jmp = &fs->f->code[pc];
82   int offset = dest-(pc+1);
83   lua_assert(dest != NO_JUMP);
84   if (abs(offset) > MAXARG_sBx)
85   luaX_syntaxerror(fs->ls, "control structure too long");
86   SETARG_sBx(*jmp, offset);
8787}
8888
8989
r31373r31374
9292** optimizations with consecutive instructions not in the same basic block).
9393*/
9494int luaK_getlabel (FuncState *fs) {
95  fs->lasttarget = fs->pc;
96  return fs->pc;
95   fs->lasttarget = fs->pc;
96   return fs->pc;
9797}
9898
9999
100100static int getjump (FuncState *fs, int pc) {
101  int offset = GETARG_sBx(fs->f->code[pc]);
102  if (offset == NO_JUMP)  /* point to itself represents end of list */
103    return NO_JUMP;  /* end of list */
104  else
105    return (pc+1)+offset;  /* turn offset into absolute position */
101   int offset = GETARG_sBx(fs->f->code[pc]);
102   if (offset == NO_JUMP)  /* point to itself represents end of list */
103   return NO_JUMP;  /* end of list */
104   else
105   return (pc+1)+offset;  /* turn offset into absolute position */
106106}
107107
108108
109109static Instruction *getjumpcontrol (FuncState *fs, int pc) {
110  Instruction *pi = &fs->f->code[pc];
111  if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1))))
112    return pi-1;
113  else
114    return pi;
110   Instruction *pi = &fs->f->code[pc];
111   if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1))))
112   return pi-1;
113   else
114   return pi;
115115}
116116
117117
r31373r31374
120120** (or produce an inverted value)
121121*/
122122static int need_value (FuncState *fs, int list) {
123  for (; list != NO_JUMP; list = getjump(fs, list)) {
124    Instruction i = *getjumpcontrol(fs, list);
125    if (GET_OPCODE(i) != OP_TESTSET) return 1;
126  }
127  return 0;  /* not found */
123   for (; list != NO_JUMP; list = getjump(fs, list)) {
124   Instruction i = *getjumpcontrol(fs, list);
125   if (GET_OPCODE(i) != OP_TESTSET) return 1;
126   }
127   return 0;  /* not found */
128128}
129129
130130
131131static int patchtestreg (FuncState *fs, int node, int reg) {
132  Instruction *i = getjumpcontrol(fs, node);
133  if (GET_OPCODE(*i) != OP_TESTSET)
134    return 0;  /* cannot patch other instructions */
135  if (reg != NO_REG && reg != GETARG_B(*i))
136    SETARG_A(*i, reg);
137  else  /* no register to put value or register already has the value */
138    *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i));
132   Instruction *i = getjumpcontrol(fs, node);
133   if (GET_OPCODE(*i) != OP_TESTSET)
134   return 0;  /* cannot patch other instructions */
135   if (reg != NO_REG && reg != GETARG_B(*i))
136   SETARG_A(*i, reg);
137   else  /* no register to put value or register already has the value */
138   *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i));
139139
140  return 1;
140   return 1;
141141}
142142
143143
144144static void removevalues (FuncState *fs, int list) {
145  for (; list != NO_JUMP; list = getjump(fs, list))
146      patchtestreg(fs, list, NO_REG);
145   for (; list != NO_JUMP; list = getjump(fs, list))
146      patchtestreg(fs, list, NO_REG);
147147}
148148
149149
150150static void patchlistaux (FuncState *fs, int list, int vtarget, int reg,
151                          int dtarget) {
152  while (list != NO_JUMP) {
153    int next = getjump(fs, list);
154    if (patchtestreg(fs, list, reg))
155      fixjump(fs, list, vtarget);
156    else
157      fixjump(fs, list, dtarget);  /* jump to default target */
158    list = next;
159  }
151                     int dtarget) {
152   while (list != NO_JUMP) {
153   int next = getjump(fs, list);
154   if (patchtestreg(fs, list, reg))
155      fixjump(fs, list, vtarget);
156   else
157      fixjump(fs, list, dtarget);  /* jump to default target */
158   list = next;
159   }
160160}
161161
162162
163163static void dischargejpc (FuncState *fs) {
164  patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc);
165  fs->jpc = NO_JUMP;
164   patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc);
165   fs->jpc = NO_JUMP;
166166}
167167
168168
169169void luaK_patchlist (FuncState *fs, int list, int target) {
170  if (target == fs->pc)
171    luaK_patchtohere(fs, list);
172  else {
173    lua_assert(target < fs->pc);
174    patchlistaux(fs, list, target, NO_REG, target);
175  }
170   if (target == fs->pc)
171   luaK_patchtohere(fs, list);
172   else {
173   lua_assert(target < fs->pc);
174   patchlistaux(fs, list, target, NO_REG, target);
175   }
176176}
177177
178178
179179LUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level) {
180  level++;  /* argument is +1 to reserve 0 as non-op */
181  while (list != NO_JUMP) {
182    int next = getjump(fs, list);
183    lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP &&
184                (GETARG_A(fs->f->code[list]) == 0 ||
185                 GETARG_A(fs->f->code[list]) >= level));
186    SETARG_A(fs->f->code[list], level);
187    list = next;
188  }
180   level++;  /* argument is +1 to reserve 0 as non-op */
181   while (list != NO_JUMP) {
182   int next = getjump(fs, list);
183   lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP &&
184            (GETARG_A(fs->f->code[list]) == 0 ||
185               GETARG_A(fs->f->code[list]) >= level));
186   SETARG_A(fs->f->code[list], level);
187   list = next;
188   }
189189}
190190
191191
192192void luaK_patchtohere (FuncState *fs, int list) {
193  luaK_getlabel(fs);
194  luaK_concat(fs, &fs->jpc, list);
193   luaK_getlabel(fs);
194   luaK_concat(fs, &fs->jpc, list);
195195}
196196
197197
198198void luaK_concat (FuncState *fs, int *l1, int l2) {
199  if (l2 == NO_JUMP) return;
200  else if (*l1 == NO_JUMP)
201    *l1 = l2;
202  else {
203    int list = *l1;
204    int next;
205    while ((next = getjump(fs, list)) != NO_JUMP)  /* find last element */
206      list = next;
207    fixjump(fs, list, l2);
208  }
199   if (l2 == NO_JUMP) return;
200   else if (*l1 == NO_JUMP)
201   *l1 = l2;
202   else {
203   int list = *l1;
204   int next;
205   while ((next = getjump(fs, list)) != NO_JUMP)  /* find last element */
206      list = next;
207   fixjump(fs, list, l2);
208   }
209209}
210210
211211
212212static int luaK_code (FuncState *fs, Instruction i) {
213  Proto *f = fs->f;
214  dischargejpc(fs);  /* `pc' will change */
215  /* put new instruction in code array */
216  luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction,
217                  MAX_INT, "opcodes");
218  f->code[fs->pc] = i;
219  /* save corresponding line information */
220  luaM_growvector(fs->ls->L, f->lineinfo, fs->pc, f->sizelineinfo, int,
221                  MAX_INT, "opcodes");
222  f->lineinfo[fs->pc] = fs->ls->lastline;
223  return fs->pc++;
213   Proto *f = fs->f;
214   dischargejpc(fs);  /* `pc' will change */
215   /* put new instruction in code array */
216   luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction,
217               MAX_INT, "opcodes");
218   f->code[fs->pc] = i;
219   /* save corresponding line information */
220   luaM_growvector(fs->ls->L, f->lineinfo, fs->pc, f->sizelineinfo, int,
221               MAX_INT, "opcodes");
222   f->lineinfo[fs->pc] = fs->ls->lastline;
223   return fs->pc++;
224224}
225225
226226
227227int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) {
228  lua_assert(getOpMode(o) == iABC);
229  lua_assert(getBMode(o) != OpArgN || b == 0);
230  lua_assert(getCMode(o) != OpArgN || c == 0);
231  lua_assert(a <= MAXARG_A && b <= MAXARG_B && c <= MAXARG_C);
232  return luaK_code(fs, CREATE_ABC(o, a, b, c));
228   lua_assert(getOpMode(o) == iABC);
229   lua_assert(getBMode(o) != OpArgN || b == 0);
230   lua_assert(getCMode(o) != OpArgN || c == 0);
231   lua_assert(a <= MAXARG_A && b <= MAXARG_B && c <= MAXARG_C);
232   return luaK_code(fs, CREATE_ABC(o, a, b, c));
233233}
234234
235235
236236int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {
237  lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx);
238  lua_assert(getCMode(o) == OpArgN);
239  lua_assert(a <= MAXARG_A && bc <= MAXARG_Bx);
240  return luaK_code(fs, CREATE_ABx(o, a, bc));
237   lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx);
238   lua_assert(getCMode(o) == OpArgN);
239   lua_assert(a <= MAXARG_A && bc <= MAXARG_Bx);
240   return luaK_code(fs, CREATE_ABx(o, a, bc));
241241}
242242
243243
244244static int codeextraarg (FuncState *fs, int a) {
245  lua_assert(a <= MAXARG_Ax);
246  return luaK_code(fs, CREATE_Ax(OP_EXTRAARG, a));
245   lua_assert(a <= MAXARG_Ax);
246   return luaK_code(fs, CREATE_Ax(OP_EXTRAARG, a));
247247}
248248
249249
250250int luaK_codek (FuncState *fs, int reg, int k) {
251  if (k <= MAXARG_Bx)
252    return luaK_codeABx(fs, OP_LOADK, reg, k);
253  else {
254    int p = luaK_codeABx(fs, OP_LOADKX, reg, 0);
255    codeextraarg(fs, k);
256    return p;
257  }
251   if (k <= MAXARG_Bx)
252   return luaK_codeABx(fs, OP_LOADK, reg, k);
253   else {
254   int p = luaK_codeABx(fs, OP_LOADKX, reg, 0);
255   codeextraarg(fs, k);
256   return p;
257   }
258258}
259259
260260
261261void luaK_checkstack (FuncState *fs, int n) {
262  int newstack = fs->freereg + n;
263  if (newstack > fs->f->maxstacksize) {
264    if (newstack >= MAXSTACK)
265      luaX_syntaxerror(fs->ls, "function or expression too complex");
266    fs->f->maxstacksize = cast_byte(newstack);
267  }
262   int newstack = fs->freereg + n;
263   if (newstack > fs->f->maxstacksize) {
264   if (newstack >= MAXSTACK)
265      luaX_syntaxerror(fs->ls, "function or expression too complex");
266   fs->f->maxstacksize = cast_byte(newstack);
267   }
268268}
269269
270270
271271void luaK_reserveregs (FuncState *fs, int n) {
272  luaK_checkstack(fs, n);
273  fs->freereg += n;
272   luaK_checkstack(fs, n);
273   fs->freereg += n;
274274}
275275
276276
277277static void freereg (FuncState *fs, int reg) {
278  if (!ISK(reg) && reg >= fs->nactvar) {
279    fs->freereg--;
280    lua_assert(reg == fs->freereg);
281  }
278   if (!ISK(reg) && reg >= fs->nactvar) {
279   fs->freereg--;
280   lua_assert(reg == fs->freereg);
281   }
282282}
283283
284284
285285static void freeexp (FuncState *fs, expdesc *e) {
286  if (e->k == VNONRELOC)
287    freereg(fs, e->u.info);
286   if (e->k == VNONRELOC)
287   freereg(fs, e->u.info);
288288}
289289
290290
291291static int addk (FuncState *fs, TValue *key, TValue *v) {
292  lua_State *L = fs->ls->L;
293  TValue *idx = luaH_set(L, fs->h, key);
294  Proto *f = fs->f;
295  int k, oldsize;
296  if (ttisnumber(idx)) {
297    lua_Number n = nvalue(idx);
298    lua_number2int(k, n);
299    if (luaV_rawequalobj(&f->k[k], v))
300      return k;
301    /* else may be a collision (e.g., between 0.0 and "\0\0\0\0\0\0\0\0");
302       go through and create a new entry for this value */
303  }
304  /* constant not found; create a new entry */
305  oldsize = f->sizek;
306  k = fs->nk;
307  /* numerical value does not need GC barrier;
308     table has no metatable, so it does not need to invalidate cache */
309  setnvalue(idx, cast_num(k));
310  luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants");
311  while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
312  setobj(L, &f->k[k], v);
313  fs->nk++;
314  luaC_barrier(L, f, v);
315  return k;
292   lua_State *L = fs->ls->L;
293   TValue *idx = luaH_set(L, fs->h, key);
294   Proto *f = fs->f;
295   int k, oldsize;
296   if (ttisnumber(idx)) {
297   lua_Number n = nvalue(idx);
298   lua_number2int(k, n);
299   if (luaV_rawequalobj(&f->k[k], v))
300      return k;
301   /* else may be a collision (e.g., between 0.0 and "\0\0\0\0\0\0\0\0");
302      go through and create a new entry for this value */
303   }
304   /* constant not found; create a new entry */
305   oldsize = f->sizek;
306   k = fs->nk;
307   /* numerical value does not need GC barrier;
308    table has no metatable, so it does not need to invalidate cache */
309   setnvalue(idx, cast_num(k));
310   luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants");
311   while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
312   setobj(L, &f->k[k], v);
313   fs->nk++;
314   luaC_barrier(L, f, v);
315   return k;
316316}
317317
318318
319319int luaK_stringK (FuncState *fs, TString *s) {
320  TValue o;
321  setsvalue(fs->ls->L, &o, s);
322  return addk(fs, &o, &o);
320   TValue o;
321   setsvalue(fs->ls->L, &o, s);
322   return addk(fs, &o, &o);
323323}
324324
325325
326326int luaK_numberK (FuncState *fs, lua_Number r) {
327  int n;
328  lua_State *L = fs->ls->L;
329  TValue o;
330  setnvalue(&o, r);
331  if (r == 0 || luai_numisnan(NULL, r)) {  /* handle -0 and NaN */
332    /* use raw representation as key to avoid numeric problems */
333    setsvalue(L, L->top++, luaS_newlstr(L, (char *)&r, sizeof(r)));
334    n = addk(fs, L->top - 1, &o);
335    L->top--;
336  }
337  else
338    n = addk(fs, &o, &o);  /* regular case */
339  return n;
327   int n;
328   lua_State *L = fs->ls->L;
329   TValue o;
330   setnvalue(&o, r);
331   if (r == 0 || luai_numisnan(NULL, r)) {  /* handle -0 and NaN */
332   /* use raw representation as key to avoid numeric problems */
333   setsvalue(L, L->top++, luaS_newlstr(L, (char *)&r, sizeof(r)));
334   n = addk(fs, L->top - 1, &o);
335   L->top--;
336   }
337   else
338   n = addk(fs, &o, &o);  /* regular case */
339   return n;
340340}
341341
342342
343343static int boolK (FuncState *fs, int b) {
344  TValue o;
345  setbvalue(&o, b);
346  return addk(fs, &o, &o);
344   TValue o;
345   setbvalue(&o, b);
346   return addk(fs, &o, &o);
347347}
348348
349349
350350static int nilK (FuncState *fs) {
351  TValue k, v;
352  setnilvalue(&v);
353  /* cannot use nil as key; instead use table itself to represent nil */
354  sethvalue(fs->ls->L, &k, fs->h);
355  return addk(fs, &k, &v);
351   TValue k, v;
352   setnilvalue(&v);
353   /* cannot use nil as key; instead use table itself to represent nil */
354   sethvalue(fs->ls->L, &k, fs->h);
355   return addk(fs, &k, &v);
356356}
357357
358358
359359void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) {
360  if (e->k == VCALL) {  /* expression is an open function call? */
361    SETARG_C(getcode(fs, e), nresults+1);
362  }
363  else if (e->k == VVARARG) {
364    SETARG_B(getcode(fs, e), nresults+1);
365    SETARG_A(getcode(fs, e), fs->freereg);
366    luaK_reserveregs(fs, 1);
367  }
360   if (e->k == VCALL) {  /* expression is an open function call? */
361   SETARG_C(getcode(fs, e), nresults+1);
362   }
363   else if (e->k == VVARARG) {
364   SETARG_B(getcode(fs, e), nresults+1);
365   SETARG_A(getcode(fs, e), fs->freereg);
366   luaK_reserveregs(fs, 1);
367   }
368368}
369369
370370
371371void luaK_setoneret (FuncState *fs, expdesc *e) {
372  if (e->k == VCALL) {  /* expression is an open function call? */
373    e->k = VNONRELOC;
374    e->u.info = GETARG_A(getcode(fs, e));
375  }
376  else if (e->k == VVARARG) {
377    SETARG_B(getcode(fs, e), 2);
378    e->k = VRELOCABLE;  /* can relocate its simple result */
379  }
372   if (e->k == VCALL) {  /* expression is an open function call? */
373   e->k = VNONRELOC;
374   e->u.info = GETARG_A(getcode(fs, e));
375   }
376   else if (e->k == VVARARG) {
377   SETARG_B(getcode(fs, e), 2);
378   e->k = VRELOCABLE;  /* can relocate its simple result */
379   }
380380}
381381
382382
383383void luaK_dischargevars (FuncState *fs, expdesc *e) {
384  switch (e->k) {
385    case VLOCAL: {
386      e->k = VNONRELOC;
387      break;
388    }
389    case VUPVAL: {
390      e->u.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.info, 0);
391      e->k = VRELOCABLE;
392      break;
393    }
394    case VINDEXED: {
395      OpCode op = OP_GETTABUP;  /* assume 't' is in an upvalue */
396      freereg(fs, e->u.ind.idx);
397      if (e->u.ind.vt == VLOCAL) {  /* 't' is in a register? */
398        freereg(fs, e->u.ind.t);
399        op = OP_GETTABLE;
400      }
401      e->u.info = luaK_codeABC(fs, op, 0, e->u.ind.t, e->u.ind.idx);
402      e->k = VRELOCABLE;
403      break;
404    }
405    case VVARARG:
406    case VCALL: {
407      luaK_setoneret(fs, e);
408      break;
409    }
410    default: break;  /* there is one value available (somewhere) */
411  }
384   switch (e->k) {
385   case VLOCAL: {
386      e->k = VNONRELOC;
387      break;
388   }
389   case VUPVAL: {
390      e->u.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.info, 0);
391      e->k = VRELOCABLE;
392      break;
393   }
394   case VINDEXED: {
395      OpCode op = OP_GETTABUP;  /* assume 't' is in an upvalue */
396      freereg(fs, e->u.ind.idx);
397      if (e->u.ind.vt == VLOCAL) {  /* 't' is in a register? */
398      freereg(fs, e->u.ind.t);
399      op = OP_GETTABLE;
400      }
401      e->u.info = luaK_codeABC(fs, op, 0, e->u.ind.t, e->u.ind.idx);
402      e->k = VRELOCABLE;
403      break;
404   }
405   case VVARARG:
406   case VCALL: {
407      luaK_setoneret(fs, e);
408      break;
409   }
410   default: break;  /* there is one value available (somewhere) */
411   }
412412}
413413
414414
415415static int code_label (FuncState *fs, int A, int b, int jump) {
416  luaK_getlabel(fs);  /* those instructions may be jump targets */
417  return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump);
416   luaK_getlabel(fs);  /* those instructions may be jump targets */
417   return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump);
418418}
419419
420420
421421static void discharge2reg (FuncState *fs, expdesc *e, int reg) {
422  luaK_dischargevars(fs, e);
423  switch (e->k) {
424    case VNIL: {
425      luaK_nil(fs, reg, 1);
426      break;
427    }
428    case VFALSE: case VTRUE: {
429      luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0);
430      break;
431    }
432    case VK: {
433      luaK_codek(fs, reg, e->u.info);
434      break;
435    }
436    case VKNUM: {
437      luaK_codek(fs, reg, luaK_numberK(fs, e->u.nval));
438      break;
439    }
440    case VRELOCABLE: {
441      Instruction *pc = &getcode(fs, e);
442      SETARG_A(*pc, reg);
443      break;
444    }
445    case VNONRELOC: {
446      if (reg != e->u.info)
447        luaK_codeABC(fs, OP_MOVE, reg, e->u.info, 0);
448      break;
449    }
450    default: {
451      lua_assert(e->k == VVOID || e->k == VJMP);
452      return;  /* nothing to do... */
453    }
454  }
455  e->u.info = reg;
456  e->k = VNONRELOC;
422   luaK_dischargevars(fs, e);
423   switch (e->k) {
424   case VNIL: {
425      luaK_nil(fs, reg, 1);
426      break;
427   }
428   case VFALSE: case VTRUE: {
429      luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0);
430      break;
431   }
432   case VK: {
433      luaK_codek(fs, reg, e->u.info);
434      break;
435   }
436   case VKNUM: {
437      luaK_codek(fs, reg, luaK_numberK(fs, e->u.nval));
438      break;
439   }
440   case VRELOCABLE: {
441      Instruction *pc = &getcode(fs, e);
442      SETARG_A(*pc, reg);
443      break;
444   }
445   case VNONRELOC: {
446      if (reg != e->u.info)
447      luaK_codeABC(fs, OP_MOVE, reg, e->u.info, 0);
448      break;
449   }
450   default: {
451      lua_assert(e->k == VVOID || e->k == VJMP);
452      return;  /* nothing to do... */
453   }
454   }
455   e->u.info = reg;
456   e->k = VNONRELOC;
457457}
458458
459459
460460static void discharge2anyreg (FuncState *fs, expdesc *e) {
461  if (e->k != VNONRELOC) {
462    luaK_reserveregs(fs, 1);
463    discharge2reg(fs, e, fs->freereg-1);
464  }
461   if (e->k != VNONRELOC) {
462   luaK_reserveregs(fs, 1);
463   discharge2reg(fs, e, fs->freereg-1);
464   }
465465}
466466
467467
468468static void exp2reg (FuncState *fs, expdesc *e, int reg) {
469  discharge2reg(fs, e, reg);
470  if (e->k == VJMP)
471    luaK_concat(fs, &e->t, e->u.info);  /* put this jump in `t' list */
472  if (hasjumps(e)) {
473    int final;  /* position after whole expression */
474    int p_f = NO_JUMP;  /* position of an eventual LOAD false */
475    int p_t = NO_JUMP;  /* position of an eventual LOAD true */
476    if (need_value(fs, e->t) || need_value(fs, e->f)) {
477      int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs);
478      p_f = code_label(fs, reg, 0, 1);
479      p_t = code_label(fs, reg, 1, 0);
480      luaK_patchtohere(fs, fj);
481    }
482    final = luaK_getlabel(fs);
483    patchlistaux(fs, e->f, final, reg, p_f);
484    patchlistaux(fs, e->t, final, reg, p_t);
485  }
486  e->f = e->t = NO_JUMP;
487  e->u.info = reg;
488  e->k = VNONRELOC;
469   discharge2reg(fs, e, reg);
470   if (e->k == VJMP)
471   luaK_concat(fs, &e->t, e->u.info);  /* put this jump in `t' list */
472   if (hasjumps(e)) {
473   int final;  /* position after whole expression */
474   int p_f = NO_JUMP;  /* position of an eventual LOAD false */
475   int p_t = NO_JUMP;  /* position of an eventual LOAD true */
476   if (need_value(fs, e->t) || need_value(fs, e->f)) {
477      int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs);
478      p_f = code_label(fs, reg, 0, 1);
479      p_t = code_label(fs, reg, 1, 0);
480      luaK_patchtohere(fs, fj);
481   }
482   final = luaK_getlabel(fs);
483   patchlistaux(fs, e->f, final, reg, p_f);
484   patchlistaux(fs, e->t, final, reg, p_t);
485   }
486   e->f = e->t = NO_JUMP;
487   e->u.info = reg;
488   e->k = VNONRELOC;
489489}
490490
491491
492492void luaK_exp2nextreg (FuncState *fs, expdesc *e) {
493  luaK_dischargevars(fs, e);
494  freeexp(fs, e);
495  luaK_reserveregs(fs, 1);
496  exp2reg(fs, e, fs->freereg - 1);
493   luaK_dischargevars(fs, e);
494   freeexp(fs, e);
495   luaK_reserveregs(fs, 1);
496   exp2reg(fs, e, fs->freereg - 1);
497497}
498498
499499
500500int luaK_exp2anyreg (FuncState *fs, expdesc *e) {
501  luaK_dischargevars(fs, e);
502  if (e->k == VNONRELOC) {
503    if (!hasjumps(e)) return e->u.info;  /* exp is already in a register */
504    if (e->u.info >= fs->nactvar) {  /* reg. is not a local? */
505      exp2reg(fs, e, e->u.info);  /* put value on it */
506      return e->u.info;
507    }
508  }
509  luaK_exp2nextreg(fs, e);  /* default */
510  return e->u.info;
501   luaK_dischargevars(fs, e);
502   if (e->k == VNONRELOC) {
503   if (!hasjumps(e)) return e->u.info;  /* exp is already in a register */
504   if (e->u.info >= fs->nactvar) {  /* reg. is not a local? */
505      exp2reg(fs, e, e->u.info);  /* put value on it */
506      return e->u.info;
507   }
508   }
509   luaK_exp2nextreg(fs, e);  /* default */
510   return e->u.info;
511511}
512512
513513
514514void luaK_exp2anyregup (FuncState *fs, expdesc *e) {
515  if (e->k != VUPVAL || hasjumps(e))
516    luaK_exp2anyreg(fs, e);
515   if (e->k != VUPVAL || hasjumps(e))
516   luaK_exp2anyreg(fs, e);
517517}
518518
519519
520520void luaK_exp2val (FuncState *fs, expdesc *e) {
521  if (hasjumps(e))
522    luaK_exp2anyreg(fs, e);
523  else
524    luaK_dischargevars(fs, e);
521   if (hasjumps(e))
522   luaK_exp2anyreg(fs, e);
523   else
524   luaK_dischargevars(fs, e);
525525}
526526
527527
528528int luaK_exp2RK (FuncState *fs, expdesc *e) {
529  luaK_exp2val(fs, e);
530  switch (e->k) {
531    case VTRUE:
532    case VFALSE:
533    case VNIL: {
534      if (fs->nk <= MAXINDEXRK) {  /* constant fits in RK operand? */
535        e->u.info = (e->k == VNIL) ? nilK(fs) : boolK(fs, (e->k == VTRUE));
536        e->k = VK;
537        return RKASK(e->u.info);
538      }
539      else break;
540    }
541    case VKNUM: {
542      e->u.info = luaK_numberK(fs, e->u.nval);
543      e->k = VK;
544      /* go through */
545    }
546    case VK: {
547      if (e->u.info <= MAXINDEXRK)  /* constant fits in argC? */
548        return RKASK(e->u.info);
549      else break;
550    }
551    default: break;
552  }
553  /* not a constant in the right range: put it in a register */
554  return luaK_exp2anyreg(fs, e);
529   luaK_exp2val(fs, e);
530   switch (e->k) {
531   case VTRUE:
532   case VFALSE:
533   case VNIL: {
534      if (fs->nk <= MAXINDEXRK) {  /* constant fits in RK operand? */
535      e->u.info = (e->k == VNIL) ? nilK(fs) : boolK(fs, (e->k == VTRUE));
536      e->k = VK;
537      return RKASK(e->u.info);
538      }
539      else break;
540   }
541   case VKNUM: {
542      e->u.info = luaK_numberK(fs, e->u.nval);
543      e->k = VK;
544      /* go through */
545   }
546   case VK: {
547      if (e->u.info <= MAXINDEXRK)  /* constant fits in argC? */
548      return RKASK(e->u.info);
549      else break;
550   }
551   default: break;
552   }
553   /* not a constant in the right range: put it in a register */
554   return luaK_exp2anyreg(fs, e);
555555}
556556
557557
558558void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) {
559  switch (var->k) {
560    case VLOCAL: {
561      freeexp(fs, ex);
562      exp2reg(fs, ex, var->u.info);
563      return;
564    }
565    case VUPVAL: {
566      int e = luaK_exp2anyreg(fs, ex);
567      luaK_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0);
568      break;
569    }
570    case VINDEXED: {
571      OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE : OP_SETTABUP;
572      int e = luaK_exp2RK(fs, ex);
573      luaK_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e);
574      break;
575    }
576    default: {
577      lua_assert(0);  /* invalid var kind to store */
578      break;
579    }
580  }
581  freeexp(fs, ex);
559   switch (var->k) {
560   case VLOCAL: {
561      freeexp(fs, ex);
562      exp2reg(fs, ex, var->u.info);
563      return;
564   }
565   case VUPVAL: {
566      int e = luaK_exp2anyreg(fs, ex);
567      luaK_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0);
568      break;
569   }
570   case VINDEXED: {
571      OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE : OP_SETTABUP;
572      int e = luaK_exp2RK(fs, ex);
573      luaK_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e);
574      break;
575   }
576   default: {
577      lua_assert(0);  /* invalid var kind to store */
578      break;
579   }
580   }
581   freeexp(fs, ex);
582582}
583583
584584
585585void luaK_self (FuncState *fs, expdesc *e, expdesc *key) {
586  int ereg;
587  luaK_exp2anyreg(fs, e);
588  ereg = e->u.info;  /* register where 'e' was placed */
589  freeexp(fs, e);
590  e->u.info = fs->freereg;  /* base register for op_self */
591  e->k = VNONRELOC;
592  luaK_reserveregs(fs, 2);  /* function and 'self' produced by op_self */
593  luaK_codeABC(fs, OP_SELF, e->u.info, ereg, luaK_exp2RK(fs, key));
594  freeexp(fs, key);
586   int ereg;
587   luaK_exp2anyreg(fs, e);
588   ereg = e->u.info;  /* register where 'e' was placed */
589   freeexp(fs, e);
590   e->u.info = fs->freereg;  /* base register for op_self */
591   e->k = VNONRELOC;
592   luaK_reserveregs(fs, 2);  /* function and 'self' produced by op_self */
593   luaK_codeABC(fs, OP_SELF, e->u.info, ereg, luaK_exp2RK(fs, key));
594   freeexp(fs, key);
595595}
596596
597597
598598static void invertjump (FuncState *fs, expdesc *e) {
599  Instruction *pc = getjumpcontrol(fs, e->u.info);
600  lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET &&
601                                           GET_OPCODE(*pc) != OP_TEST);
602  SETARG_A(*pc, !(GETARG_A(*pc)));
599   Instruction *pc = getjumpcontrol(fs, e->u.info);
600   lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET &&
601                                 GET_OPCODE(*pc) != OP_TEST);
602   SETARG_A(*pc, !(GETARG_A(*pc)));
603603}
604604
605605
606606static int jumponcond (FuncState *fs, expdesc *e, int cond) {
607  if (e->k == VRELOCABLE) {
608    Instruction ie = getcode(fs, e);
609    if (GET_OPCODE(ie) == OP_NOT) {
610      fs->pc--;  /* remove previous OP_NOT */
611      return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond);
612    }
613    /* else go through */
614  }
615  discharge2anyreg(fs, e);
616  freeexp(fs, e);
617  return condjump(fs, OP_TESTSET, NO_REG, e->u.info, cond);
607   if (e->k == VRELOCABLE) {
608   Instruction ie = getcode(fs, e);
609   if (GET_OPCODE(ie) == OP_NOT) {
610      fs->pc--;  /* remove previous OP_NOT */
611      return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond);
612   }
613   /* else go through */
614   }
615   discharge2anyreg(fs, e);
616   freeexp(fs, e);
617   return condjump(fs, OP_TESTSET, NO_REG, e->u.info, cond);
618618}
619619
620620
621621void luaK_goiftrue (FuncState *fs, expdesc *e) {
622  int pc;  /* pc of last jump */
623  luaK_dischargevars(fs, e);
624  switch (e->k) {
625    case VJMP: {
626      invertjump(fs, e);
627      pc = e->u.info;
628      break;
629    }
630    case VK: case VKNUM: case VTRUE: {
631      pc = NO_JUMP;  /* always true; do nothing */
632      break;
633    }
634    default: {
635      pc = jumponcond(fs, e, 0);
636      break;
637    }
638  }
639  luaK_concat(fs, &e->f, pc);  /* insert last jump in `f' list */
640  luaK_patchtohere(fs, e->t);
641  e->t = NO_JUMP;
622   int pc;  /* pc of last jump */
623   luaK_dischargevars(fs, e);
624   switch (e->k) {
625   case VJMP: {
626      invertjump(fs, e);
627      pc = e->u.info;
628      break;
629   }
630   case VK: case VKNUM: case VTRUE: {
631      pc = NO_JUMP;  /* always true; do nothing */
632      break;
633   }
634   default: {
635      pc = jumponcond(fs, e, 0);
636      break;
637   }
638   }
639   luaK_concat(fs, &e->f, pc);  /* insert last jump in `f' list */
640   luaK_patchtohere(fs, e->t);
641   e->t = NO_JUMP;
642642}
643643
644644
645645void luaK_goiffalse (FuncState *fs, expdesc *e) {
646  int pc;  /* pc of last jump */
647  luaK_dischargevars(fs, e);
648  switch (e->k) {
649    case VJMP: {
650      pc = e->u.info;
651      break;
652    }
653    case VNIL: case VFALSE: {
654      pc = NO_JUMP;  /* always false; do nothing */
655      break;
656    }
657    default: {
658      pc = jumponcond(fs, e, 1);
659      break;
660    }
661  }
662  luaK_concat(fs, &e->t, pc);  /* insert last jump in `t' list */
663  luaK_patchtohere(fs, e->f);
664  e->f = NO_JUMP;
646   int pc;  /* pc of last jump */
647   luaK_dischargevars(fs, e);
648   switch (e->k) {
649   case VJMP: {
650      pc = e->u.info;
651      break;
652   }
653   case VNIL: case VFALSE: {
654      pc = NO_JUMP;  /* always false; do nothing */
655      break;
656   }
657   default: {
658      pc = jumponcond(fs, e, 1);
659      break;
660   }
661   }
662   luaK_concat(fs, &e->t, pc);  /* insert last jump in `t' list */
663   luaK_patchtohere(fs, e->f);
664   e->f = NO_JUMP;
665665}
666666
667667
668668static void codenot (FuncState *fs, expdesc *e) {
669  luaK_dischargevars(fs, e);
670  switch (e->k) {
671    case VNIL: case VFALSE: {
672      e->k = VTRUE;
673      break;
674    }
675    case VK: case VKNUM: case VTRUE: {
676      e->k = VFALSE;
677      break;
678    }
679    case VJMP: {
680      invertjump(fs, e);
681      break;
682    }
683    case VRELOCABLE:
684    case VNONRELOC: {
685      discharge2anyreg(fs, e);
686      freeexp(fs, e);
687      e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0);
688      e->k = VRELOCABLE;
689      break;
690    }
691    default: {
692      lua_assert(0);  /* cannot happen */
693      break;
694    }
695  }
696  /* interchange true and false lists */
697  { int temp = e->f; e->f = e->t; e->t = temp; }
698  removevalues(fs, e->f);
699  removevalues(fs, e->t);
669   luaK_dischargevars(fs, e);
670   switch (e->k) {
671   case VNIL: case VFALSE: {
672      e->k = VTRUE;
673      break;
674   }
675   case VK: case VKNUM: case VTRUE: {
676      e->k = VFALSE;
677      break;
678   }
679   case VJMP: {
680      invertjump(fs, e);
681      break;
682   }
683   case VRELOCABLE:
684   case VNONRELOC: {
685      discharge2anyreg(fs, e);
686      freeexp(fs, e);
687      e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0);
688      e->k = VRELOCABLE;
689      break;
690   }
691   default: {
692      lua_assert(0);  /* cannot happen */
693      break;
694   }
695   }
696   /* interchange true and false lists */
697   { int temp = e->f; e->f = e->t; e->t = temp; }
698   removevalues(fs, e->f);
699   removevalues(fs, e->t);
700700}
701701
702702
703703void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) {
704  lua_assert(!hasjumps(t));
705  t->u.ind.t = t->u.info;
706  t->u.ind.idx = luaK_exp2RK(fs, k);
707  t->u.ind.vt = (t->k == VUPVAL) ? VUPVAL
708                                 : check_exp(vkisinreg(t->k), VLOCAL);
709  t->k = VINDEXED;
704   lua_assert(!hasjumps(t));
705   t->u.ind.t = t->u.info;
706   t->u.ind.idx = luaK_exp2RK(fs, k);
707   t->u.ind.vt = (t->k == VUPVAL) ? VUPVAL
708                           : check_exp(vkisinreg(t->k), VLOCAL);
709   t->k = VINDEXED;
710710}
711711
712712
713713static int constfolding (OpCode op, expdesc *e1, expdesc *e2) {
714  lua_Number r;
715  if (!isnumeral(e1) || !isnumeral(e2)) return 0;
716  if ((op == OP_DIV || op == OP_MOD) && e2->u.nval == 0)
717    return 0;  /* do not attempt to divide by 0 */
718  r = luaO_arith(op - OP_ADD + LUA_OPADD, e1->u.nval, e2->u.nval);
719  e1->u.nval = r;
720  return 1;
714   lua_Number r;
715   if (!isnumeral(e1) || !isnumeral(e2)) return 0;
716   if ((op == OP_DIV || op == OP_MOD) && e2->u.nval == 0)
717   return 0;  /* do not attempt to divide by 0 */
718   r = luaO_arith(op - OP_ADD + LUA_OPADD, e1->u.nval, e2->u.nval);
719   e1->u.nval = r;
720   return 1;
721721}
722722
723723
724724static void codearith (FuncState *fs, OpCode op,
725                       expdesc *e1, expdesc *e2, int line) {
726  if (constfolding(op, e1, e2))
727    return;
728  else {
729    int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0;
730    int o1 = luaK_exp2RK(fs, e1);
731    if (o1 > o2) {
732      freeexp(fs, e1);
733      freeexp(fs, e2);
734    }
735    else {
736      freeexp(fs, e2);
737      freeexp(fs, e1);
738    }
739    e1->u.info = luaK_codeABC(fs, op, 0, o1, o2);
740    e1->k = VRELOCABLE;
741    luaK_fixline(fs, line);
742  }
725                  expdesc *e1, expdesc *e2, int line) {
726   if (constfolding(op, e1, e2))
727   return;
728   else {
729   int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0;
730   int o1 = luaK_exp2RK(fs, e1);
731   if (o1 > o2) {
732      freeexp(fs, e1);
733      freeexp(fs, e2);
734   }
735   else {
736      freeexp(fs, e2);
737      freeexp(fs, e1);
738   }
739   e1->u.info = luaK_codeABC(fs, op, 0, o1, o2);
740   e1->k = VRELOCABLE;
741   luaK_fixline(fs, line);
742   }
743743}
744744
745745
746746static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1,
747                                                          expdesc *e2) {
748  int o1 = luaK_exp2RK(fs, e1);
749  int o2 = luaK_exp2RK(fs, e2);
750  freeexp(fs, e2);
751  freeexp(fs, e1);
752  if (cond == 0 && op != OP_EQ) {
753    int temp;  /* exchange args to replace by `<' or `<=' */
754    temp = o1; o1 = o2; o2 = temp;  /* o1 <==> o2 */
755    cond = 1;
756  }
757  e1->u.info = condjump(fs, op, cond, o1, o2);
758  e1->k = VJMP;
747                                             expdesc *e2) {
748   int o1 = luaK_exp2RK(fs, e1);
749   int o2 = luaK_exp2RK(fs, e2);
750   freeexp(fs, e2);
751   freeexp(fs, e1);
752   if (cond == 0 && op != OP_EQ) {
753   int temp;  /* exchange args to replace by `<' or `<=' */
754   temp = o1; o1 = o2; o2 = temp;  /* o1 <==> o2 */
755   cond = 1;
756   }
757   e1->u.info = condjump(fs, op, cond, o1, o2);
758   e1->k = VJMP;
759759}
760760
761761
762762void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) {
763  expdesc e2;
764  e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
765  switch (op) {
766    case OPR_MINUS: {
767      if (isnumeral(e))  /* minus constant? */
768        e->u.nval = luai_numunm(NULL, e->u.nval);  /* fold it */
769      else {
770        luaK_exp2anyreg(fs, e);
771        codearith(fs, OP_UNM, e, &e2, line);
772      }
773      break;
774    }
775    case OPR_NOT: codenot(fs, e); break;
776    case OPR_LEN: {
777      luaK_exp2anyreg(fs, e);  /* cannot operate on constants */
778      codearith(fs, OP_LEN, e, &e2, line);
779      break;
780    }
781    default: lua_assert(0);
782  }
763   expdesc e2;
764   e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0;
765   switch (op) {
766   case OPR_MINUS: {
767      if (isnumeral(e))  /* minus constant? */
768      e->u.nval = luai_numunm(NULL, e->u.nval);  /* fold it */
769      else {
770      luaK_exp2anyreg(fs, e);
771      codearith(fs, OP_UNM, e, &e2, line);
772      }
773      break;
774   }
775   case OPR_NOT: codenot(fs, e); break;
776   case OPR_LEN: {
777      luaK_exp2anyreg(fs, e);  /* cannot operate on constants */
778      codearith(fs, OP_LEN, e, &e2, line);
779      break;
780   }
781   default: lua_assert(0);
782   }
783783}
784784
785785
786786void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) {
787  switch (op) {
788    case OPR_AND: {
789      luaK_goiftrue(fs, v);
790      break;
791    }
792    case OPR_OR: {
793      luaK_goiffalse(fs, v);
794      break;
795    }
796    case OPR_CONCAT: {
797      luaK_exp2nextreg(fs, v);  /* operand must be on the `stack' */
798      break;
799    }
800    case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:
801    case OPR_MOD: case OPR_POW: {
802      if (!isnumeral(v)) luaK_exp2RK(fs, v);
803      break;
804    }
805    default: {
806      luaK_exp2RK(fs, v);
807      break;
808    }
809  }
787   switch (op) {
788   case OPR_AND: {
789      luaK_goiftrue(fs, v);
790      break;
791   }
792   case OPR_OR: {
793      luaK_goiffalse(fs, v);
794      break;
795   }
796   case OPR_CONCAT: {
797      luaK_exp2nextreg(fs, v);  /* operand must be on the `stack' */
798      break;
799   }
800   case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:
801   case OPR_MOD: case OPR_POW: {
802      if (!isnumeral(v)) luaK_exp2RK(fs, v);
803      break;
804   }
805   default: {
806      luaK_exp2RK(fs, v);
807      break;
808   }
809   }
810810}
811811
812812
813813void luaK_posfix (FuncState *fs, BinOpr op,
814                  expdesc *e1, expdesc *e2, int line) {
815  switch (op) {
816    case OPR_AND: {
817      lua_assert(e1->t == NO_JUMP);  /* list must be closed */
818      luaK_dischargevars(fs, e2);
819      luaK_concat(fs, &e2->f, e1->f);
820      *e1 = *e2;
821      break;
822    }
823    case OPR_OR: {
824      lua_assert(e1->f == NO_JUMP);  /* list must be closed */
825      luaK_dischargevars(fs, e2);
826      luaK_concat(fs, &e2->t, e1->t);
827      *e1 = *e2;
828      break;
829    }
830    case OPR_CONCAT: {
831      luaK_exp2val(fs, e2);
832      if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) {
833        lua_assert(e1->u.info == GETARG_B(getcode(fs, e2))-1);
834        freeexp(fs, e1);
835        SETARG_B(getcode(fs, e2), e1->u.info);
836        e1->k = VRELOCABLE; e1->u.info = e2->u.info;
837      }
838      else {
839        luaK_exp2nextreg(fs, e2);  /* operand must be on the 'stack' */
840        codearith(fs, OP_CONCAT, e1, e2, line);
841      }
842      break;
843    }
844    case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:
845    case OPR_MOD: case OPR_POW: {
846      codearith(fs, cast(OpCode, op - OPR_ADD + OP_ADD), e1, e2, line);
847      break;
848    }
849    case OPR_EQ: case OPR_LT: case OPR_LE: {
850      codecomp(fs, cast(OpCode, op - OPR_EQ + OP_EQ), 1, e1, e2);
851      break;
852    }
853    case OPR_NE: case OPR_GT: case OPR_GE: {
854      codecomp(fs, cast(OpCode, op - OPR_NE + OP_EQ), 0, e1, e2);
855      break;
856    }
857    default: lua_assert(0);
858  }
814               expdesc *e1, expdesc *e2, int line) {
815   switch (op) {
816   case OPR_AND: {
817      lua_assert(e1->t == NO_JUMP);  /* list must be closed */
818      luaK_dischargevars(fs, e2);
819      luaK_concat(fs, &e2->f, e1->f);
820      *e1 = *e2;
821      break;
822   }
823   case OPR_OR: {
824      lua_assert(e1->f == NO_JUMP);  /* list must be closed */
825      luaK_dischargevars(fs, e2);
826      luaK_concat(fs, &e2->t, e1->t);
827      *e1 = *e2;
828      break;
829   }
830   case OPR_CONCAT: {
831      luaK_exp2val(fs, e2);
832      if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) {
833      lua_assert(e1->u.info == GETARG_B(getcode(fs, e2))-1);
834      freeexp(fs, e1);
835      SETARG_B(getcode(fs, e2), e1->u.info);
836      e1->k = VRELOCABLE; e1->u.info = e2->u.info;
837      }
838      else {
839      luaK_exp2nextreg(fs, e2);  /* operand must be on the 'stack' */
840      codearith(fs, OP_CONCAT, e1, e2, line);
841      }
842      break;
843   }
844   case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV:
845   case OPR_MOD: case OPR_POW: {
846      codearith(fs, cast(OpCode, op - OPR_ADD + OP_ADD), e1, e2, line);
847      break;
848   }
849   case OPR_EQ: case OPR_LT: case OPR_LE: {
850      codecomp(fs, cast(OpCode, op - OPR_EQ + OP_EQ), 1, e1, e2);
851      break;
852   }
853   case OPR_NE: case OPR_GT: case OPR_GE: {
854      codecomp(fs, cast(OpCode, op - OPR_NE + OP_EQ), 0, e1, e2);
855      break;
856   }
857   default: lua_assert(0);
858   }
859859}
860860
861861
862862void luaK_fixline (FuncState *fs, int line) {
863  fs->f->lineinfo[fs->pc - 1] = line;
863   fs->f->lineinfo[fs->pc - 1] = line;
864864}
865865
866866
867867void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) {
868  int c =  (nelems - 1)/LFIELDS_PER_FLUSH + 1;
869  int b = (tostore == LUA_MULTRET) ? 0 : tostore;
870  lua_assert(tostore != 0);
871  if (c <= MAXARG_C)
872    luaK_codeABC(fs, OP_SETLIST, base, b, c);
873  else if (c <= MAXARG_Ax) {
874    luaK_codeABC(fs, OP_SETLIST, base, b, 0);
875    codeextraarg(fs, c);
876  }
877  else
878    luaX_syntaxerror(fs->ls, "constructor too long");
879  fs->freereg = base + 1;  /* free registers with list values */
868   int c =  (nelems - 1)/LFIELDS_PER_FLUSH + 1;
869   int b = (tostore == LUA_MULTRET) ? 0 : tostore;
870   lua_assert(tostore != 0);
871   if (c <= MAXARG_C)
872   luaK_codeABC(fs, OP_SETLIST, base, b, c);
873   else if (c <= MAXARG_Ax) {
874   luaK_codeABC(fs, OP_SETLIST, base, b, 0);
875   codeextraarg(fs, c);
876   }
877   else
878   luaX_syntaxerror(fs->ls, "constructor too long");
879   fs->freereg = base + 1;  /* free registers with list values */
880880}
881
trunk/src/lib/sqlite3/shell.c
r31373r31374
102102
103103/* Return the current wall-clock time */
104104static sqlite3_int64 timeOfDay(void){
105  static sqlite3_vfs *clockVfs = 0;
106  sqlite3_int64 t;
107  if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0);
108  if( clockVfs->iVersion>=1 && clockVfs->xCurrentTimeInt64!=0 ){
109    clockVfs->xCurrentTimeInt64(clockVfs, &t);
110  }else{
111    double r;
112    clockVfs->xCurrentTime(clockVfs, &r);
113    t = (sqlite3_int64)(r*86400000.0);
114  }
115  return t;
105   static sqlite3_vfs *clockVfs = 0;
106   sqlite3_int64 t;
107   if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0);
108   if( clockVfs->iVersion>=1 && clockVfs->xCurrentTimeInt64!=0 ){
109   clockVfs->xCurrentTimeInt64(clockVfs, &t);
110   }else{
111   double r;
112   clockVfs->xCurrentTime(clockVfs, &r);
113   t = (sqlite3_int64)(r*86400000.0);
114   }
115   return t;
116116}
117117
118118#if !defined(_WIN32) && !defined(WIN32) && !defined(_WRS_KERNEL) \
119 && !defined(__minux)
119   && !defined(__minux)
120120#include <sys/time.h>
121121#include <sys/resource.h>
122122
r31373r31374
128128** Begin timing an operation
129129*/
130130static void beginTimer(void){
131  if( enableTimer ){
132    getrusage(RUSAGE_SELF, &sBegin);
133    iBegin = timeOfDay();
134  }
131   if( enableTimer ){
132   getrusage(RUSAGE_SELF, &sBegin);
133   iBegin = timeOfDay();
134   }
135135}
136136
137137/* Return the difference of two time_structs in seconds */
138138static double timeDiff(struct timeval *pStart, struct timeval *pEnd){
139  return (pEnd->tv_usec - pStart->tv_usec)*0.000001 +
140         (double)(pEnd->tv_sec - pStart->tv_sec);
139   return (pEnd->tv_usec - pStart->tv_usec)*0.000001 +
140         (double)(pEnd->tv_sec - pStart->tv_sec);
141141}
142142
143143/*
144144** Print the timing results.
145145*/
146146static void endTimer(void){
147  if( enableTimer ){
148    struct rusage sEnd;
149    sqlite3_int64 iEnd = timeOfDay();
150    getrusage(RUSAGE_SELF, &sEnd);
151    printf("Run Time: real %.3f user %f sys %f\n",
152       (iEnd - iBegin)*0.001,
153       timeDiff(&sBegin.ru_utime, &sEnd.ru_utime),
154       timeDiff(&sBegin.ru_stime, &sEnd.ru_stime));
155  }
147   if( enableTimer ){
148   struct rusage sEnd;
149   sqlite3_int64 iEnd = timeOfDay();
150   getrusage(RUSAGE_SELF, &sEnd);
151   printf("Run Time: real %.3f user %f sys %f\n",
152      (iEnd - iBegin)*0.001,
153      timeDiff(&sBegin.ru_utime, &sEnd.ru_utime),
154      timeDiff(&sBegin.ru_stime, &sEnd.ru_stime));
155   }
156156}
157157
158158#define BEGIN_TIMER beginTimer()
r31373r31374
176176** support found (or found previously).
177177*/
178178static int hasTimer(void){
179  if( getProcessTimesAddr ){
180    return 1;
181  } else {
182    /* GetProcessTimes() isn't supported in WIN95 and some other Windows versions.
183    ** See if the version we are running on has it, and if it does, save off
184    ** a pointer to it and the current process handle.
185    */
186    hProcess = GetCurrentProcess();
187    if( hProcess ){
188      HINSTANCE hinstLib = LoadLibrary(TEXT("Kernel32.dll"));
189      if( NULL != hinstLib ){
190        getProcessTimesAddr = (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes");
191        if( NULL != getProcessTimesAddr ){
192          return 1;
193        }
194        FreeLibrary(hinstLib);
195      }
196    }
197  }
198  return 0;
179   if( getProcessTimesAddr ){
180   return 1;
181   } else {
182   /* GetProcessTimes() isn't supported in WIN95 and some other Windows versions.
183   ** See if the version we are running on has it, and if it does, save off
184   ** a pointer to it and the current process handle.
185   */
186   hProcess = GetCurrentProcess();
187   if( hProcess ){
188      HINSTANCE hinstLib = LoadLibrary(TEXT("Kernel32.dll"));
189      if( NULL != hinstLib ){
190      getProcessTimesAddr = (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes");
191      if( NULL != getProcessTimesAddr ){
192         return 1;
193      }
194      FreeLibrary(hinstLib);
195      }
196   }
197   }
198   return 0;
199199}
200200
201201/*
202202** Begin timing an operation
203203*/
204204static void beginTimer(void){
205  if( enableTimer && getProcessTimesAddr ){
206    FILETIME ftCreation, ftExit;
207    getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelBegin, &ftUserBegin);
208    ftWallBegin = timeOfDay();
209  }
205   if( enableTimer && getProcessTimesAddr ){
206   FILETIME ftCreation, ftExit;
207   getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelBegin, &ftUserBegin);
208   ftWallBegin = timeOfDay();
209   }
210210}
211211
212212/* Return the difference of two FILETIME structs in seconds */
213213static double timeDiff(FILETIME *pStart, FILETIME *pEnd){
214  sqlite_int64 i64Start = *((sqlite_int64 *) pStart);
215  sqlite_int64 i64End = *((sqlite_int64 *) pEnd);
216  return (double) ((i64End - i64Start) / 10000000.0);
214   sqlite_int64 i64Start = *((sqlite_int64 *) pStart);
215   sqlite_int64 i64End = *((sqlite_int64 *) pEnd);
216   return (double) ((i64End - i64Start) / 10000000.0);
217217}
218218
219219/*
220220** Print the timing results.
221221*/
222222static void endTimer(void){
223  if( enableTimer && getProcessTimesAddr){
224    FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd;
225    sqlite3_int64 ftWallEnd = timeOfDay();
226    getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelEnd, &ftUserEnd);
227    printf("Run Time: real %.3f user %f sys %f\n",
228       (ftWallEnd - ftWallBegin)*0.001,
229       timeDiff(&ftUserBegin, &ftUserEnd),
230       timeDiff(&ftKernelBegin, &ftKernelEnd));
231  }
223   if( enableTimer && getProcessTimesAddr){
224   FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd;
225   sqlite3_int64 ftWallEnd = timeOfDay();
226   getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelEnd, &ftUserEnd);
227   printf("Run Time: real %.3f user %f sys %f\n",
228      (ftWallEnd - ftWallBegin)*0.001,
229      timeDiff(&ftUserBegin, &ftUserEnd),
230      timeDiff(&ftKernelBegin, &ftKernelEnd));
231   }
232232}
233233
234234#define BEGIN_TIMER beginTimer()
r31373r31374
236236#define HAS_TIMER hasTimer()
237237
238238#else
239#define BEGIN_TIMER
239#define BEGIN_TIMER
240240#define END_TIMER
241241#define HAS_TIMER 0
242242#endif
r31373r31374
298298*/
299299#ifdef SQLITE_ENABLE_IOTRACE
300300static void iotracePrintf(const char *zFormat, ...){
301  va_list ap;
302  char *z;
303  if( iotrace==0 ) return;
304  va_start(ap, zFormat);
305  z = sqlite3_vmprintf(zFormat, ap);
306  va_end(ap);
307  fprintf(iotrace, "%s", z);
308  sqlite3_free(z);
301   va_list ap;
302   char *z;
303   if( iotrace==0 ) return;
304   va_start(ap, zFormat);
305   z = sqlite3_vmprintf(zFormat, ap);
306   va_end(ap);
307   fprintf(iotrace, "%s", z);
308   sqlite3_free(z);
309309}
310310#endif
311311
r31373r31374
314314** Determines if a string is a number of not.
315315*/
316316static int isNumber(const char *z, int *realnum){
317  if( *z=='-' || *z=='+' ) z++;
318  if( !IsDigit(*z) ){
319    return 0;
320  }
321  z++;
322  if( realnum ) *realnum = 0;
323  while( IsDigit(*z) ){ z++; }
324  if( *z=='.' ){
325    z++;
326    if( !IsDigit(*z) ) return 0;
327    while( IsDigit(*z) ){ z++; }
328    if( realnum ) *realnum = 1;
329  }
330  if( *z=='e' || *z=='E' ){
331    z++;
332    if( *z=='+' || *z=='-' ) z++;
333    if( !IsDigit(*z) ) return 0;
334    while( IsDigit(*z) ){ z++; }
335    if( realnum ) *realnum = 1;
336  }
337  return *z==0;
317   if( *z=='-' || *z=='+' ) z++;
318   if( !IsDigit(*z) ){
319   return 0;
320   }
321   z++;
322   if( realnum ) *realnum = 0;
323   while( IsDigit(*z) ){ z++; }
324   if( *z=='.' ){
325   z++;
326   if( !IsDigit(*z) ) return 0;
327   while( IsDigit(*z) ){ z++; }
328   if( realnum ) *realnum = 1;
329   }
330   if( *z=='e' || *z=='E' ){
331   z++;
332   if( *z=='+' || *z=='-' ) z++;
333   if( !IsDigit(*z) ) return 0;
334   while( IsDigit(*z) ){ z++; }
335   if( realnum ) *realnum = 1;
336   }
337   return *z==0;
338338}
339339
340340/*
341** A global char* and an SQL function to access its current value
342** from within an SQL statement. This program used to use the
341** A global char* and an SQL function to access its current value
342** from within an SQL statement. This program used to use the
343343** sqlite_exec_printf() API to substitue a string into an SQL statement.
344344** The correct way to do this with sqlite3 is to use the bind API, but
345345** since the shell is built around the callback paradigm it would be a lot
r31373r31374
347347*/
348348static const char *zShellStatic = 0;
349349static void shellstaticFunc(
350  sqlite3_context *context,
351  int argc,
352  sqlite3_value **argv
350   sqlite3_context *context,
351   int argc,
352   sqlite3_value **argv
353353){
354  assert( 0==argc );
355  assert( zShellStatic );
356  UNUSED_PARAMETER(argc);
357  UNUSED_PARAMETER(argv);
358  sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC);
354   assert( 0==argc );
355   assert( zShellStatic );
356   UNUSED_PARAMETER(argc);
357   UNUSED_PARAMETER(argv);
358   sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC);
359359}
360360
361361
r31373r31374
369369** a previous call to this routine that may be reused.
370370*/
371371static char *local_getline(char *zLine, FILE *in){
372  int nLine = zLine==0 ? 0 : 100;
373  int n = 0;
372   int nLine = zLine==0 ? 0 : 100;
373   int n = 0;
374374
375  while( 1 ){
376    if( n+100>nLine ){
377      nLine = nLine*2 + 100;
378      zLine = (char*)realloc(zLine, nLine);
379      if( zLine==0 ) return 0;
380    }
381    if( fgets(&zLine[n], nLine - n, in)==0 ){
382      if( n==0 ){
383        free(zLine);
384        return 0;
385      }
386      zLine[n] = 0;
387      break;
388    }
389    while( zLine[n] ) n++;
390    if( n>0 && zLine[n-1]=='\n' ){
391      n--;
392      if( n>0 && zLine[n-1]=='\r' ) n--;
393      zLine[n] = 0;
394      break;
395    }
396  }
397  return zLine;
375   while( 1 ){
376   if( n+100>nLine ){
377      nLine = nLine*2 + 100;
378      zLine = (char*)realloc(zLine, nLine);
379      if( zLine==0 ) return 0;
380   }
381   if( fgets(&zLine[n], nLine - n, in)==0 ){
382      if( n==0 ){
383      free(zLine);
384      return 0;
385      }
386      zLine[n] = 0;
387      break;
388   }
389   while( zLine[n] ) n++;
390   if( n>0 && zLine[n-1]=='\n' ){
391      n--;
392      if( n>0 && zLine[n-1]=='\r' ) n--;
393      zLine[n] = 0;
394      break;
395   }
396   }
397   return zLine;
398398}
399399
400400/*
r31373r31374
412412** zPrior argument for reuse.
413413*/
414414static char *one_input_line(FILE *in, char *zPrior, int isContinuation){
415  char *zPrompt;
416  char *zResult;
417  if( in!=0 ){
418    zResult = local_getline(zPrior, in);
419  }else{
420    zPrompt = isContinuation ? continuePrompt : mainPrompt;
415   char *zPrompt;
416   char *zResult;
417   if( in!=0 ){
418   zResult = local_getline(zPrior, in);
419   }else{
420   zPrompt = isContinuation ? continuePrompt : mainPrompt;
421421#if defined(HAVE_READLINE)
422    free(zPrior);
423    zResult = readline(zPrompt);
424    if( zResult && *zResult ) add_history(zResult);
422   free(zPrior);
423   zResult = readline(zPrompt);
424   if( zResult && *zResult ) add_history(zResult);
425425#else
426    printf("%s", zPrompt);
427    fflush(stdout);
428    zResult = local_getline(zPrior, stdin);
426   printf("%s", zPrompt);
427   fflush(stdout);
428   zResult = local_getline(zPrior, stdin);
429429#endif
430  }
431  return zResult;
430   }
431   return zResult;
432432}
433433
434434struct previous_mode_data {
435  int valid;        /* Is there legit data in here? */
436  int mode;
437  int showHeader;
438  int colWidth[100];
435   int valid;        /* Is there legit data in here? */
436   int mode;
437   int showHeader;
438   int colWidth[100];
439439};
440440
441441/*
r31373r31374
444444** state and mode information.
445445*/
446446struct callback_data {
447  sqlite3 *db;           /* The database */
448  int echoOn;            /* True to echo input commands */
449  int autoEQP;           /* Run EXPLAIN QUERY PLAN prior to seach SQL statement */
450  int statsOn;           /* True to display memory stats before each finalize */
451  int cnt;               /* Number of records displayed so far */
452  FILE *out;             /* Write results here */
453  FILE *traceOut;        /* Output for sqlite3_trace() */
454  int nErr;              /* Number of errors seen */
455  int mode;              /* An output mode setting */
456  int writableSchema;    /* True if PRAGMA writable_schema=ON */
457  int showHeader;        /* True to show column names in List or Column mode */
458  char *zDestTable;      /* Name of destination table when MODE_Insert */
459  char separator[20];    /* Separator character for MODE_List */
460  int colWidth[100];     /* Requested width of each column when in column mode*/
461  int actualWidth[100];  /* Actual width of each column */
462  char nullvalue[20];    /* The text to print when a NULL comes back from
447   sqlite3 *db;           /* The database */
448   int echoOn;            /* True to echo input commands */
449   int autoEQP;           /* Run EXPLAIN QUERY PLAN prior to seach SQL statement */
450   int statsOn;           /* True to display memory stats before each finalize */
451   int cnt;               /* Number of records displayed so far */
452   FILE *out;             /* Write results here */
453   FILE *traceOut;        /* Output for sqlite3_trace() */
454   int nErr;              /* Number of errors seen */
455   int mode;              /* An output mode setting */
456   int writableSchema;    /* True if PRAGMA writable_schema=ON */
457   int showHeader;        /* True to show column names in List or Column mode */
458   char *zDestTable;      /* Name of destination table when MODE_Insert */
459   char separator[20];    /* Separator character for MODE_List */
460   int colWidth[100];     /* Requested width of each column when in column mode*/
461   int actualWidth[100];  /* Actual width of each column */
462   char nullvalue[20];    /* The text to print when a NULL comes back from
463463                         ** the database */
464  struct previous_mode_data explainPrev;
465                         /* Holds the mode information just before
466                         ** .explain ON */
467  char outfile[FILENAME_MAX]; /* Filename for *out */
468  const char *zDbFilename;    /* name of the database file */
469  char *zFreeOnClose;         /* Filename to free when closing */
470  const char *zVfs;           /* Name of VFS to use */
471  sqlite3_stmt *pStmt;   /* Current statement if any. */
472  FILE *pLog;            /* Write log output here */
473  int *aiIndent;         /* Array of indents used in MODE_Explain */
474  int nIndent;           /* Size of array aiIndent[] */
475  int iIndent;           /* Index of current op in aiIndent[] */
464   struct previous_mode_data explainPrev;
465                     /* Holds the mode information just before
466                     ** .explain ON */
467   char outfile[FILENAME_MAX]; /* Filename for *out */
468   const char *zDbFilename;    /* name of the database file */
469   char *zFreeOnClose;         /* Filename to free when closing */
470   const char *zVfs;           /* Name of VFS to use */
471   sqlite3_stmt *pStmt;   /* Current statement if any. */
472   FILE *pLog;            /* Write log output here */
473   int *aiIndent;         /* Array of indents used in MODE_Explain */
474   int nIndent;           /* Size of array aiIndent[] */
475   int iIndent;           /* Index of current op in aiIndent[] */
476476};
477477
478478/*
r31373r31374
489489#define MODE_Explain  8  /* Like MODE_Column, but do not truncate data */
490490
491491static const char *modeDescr[] = {
492  "line",
493  "column",
494  "list",
495  "semi",
496  "html",
497  "insert",
498  "tcl",
499  "csv",
500  "explain",
492   "line",
493   "column",
494   "list",
495   "semi",
496   "html",
497   "insert",
498   "tcl",
499   "csv",
500   "explain",
501501};
502502
503503/*
r31373r31374
510510** lower 30 bits of a 32-bit signed integer.
511511*/
512512static int strlen30(const char *z){
513  const char *z2 = z;
514  while( *z2 ){ z2++; }
515  return 0x3fffffff & (int)(z2 - z);
513   const char *z2 = z;
514   while( *z2 ){ z2++; }
515   return 0x3fffffff & (int)(z2 - z);
516516}
517517
518518/*
519519** A callback for the sqlite3_log() interface.
520520*/
521521static void shellLog(void *pArg, int iErrCode, const char *zMsg){
522  struct callback_data *p = (struct callback_data*)pArg;
523  if( p->pLog==0 ) return;
524  fprintf(p->pLog, "(%d) %s\n", iErrCode, zMsg);
525  fflush(p->pLog);
522   struct callback_data *p = (struct callback_data*)pArg;
523   if( p->pLog==0 ) return;
524   fprintf(p->pLog, "(%d) %s\n", iErrCode, zMsg);
525   fflush(p->pLog);
526526}
527527
528528/*
529529** Output the given string as a hex-encoded blob (eg. X'1234' )
530530*/
531531static void output_hex_blob(FILE *out, const void *pBlob, int nBlob){
532  int i;
533  char *zBlob = (char *)pBlob;
534  fprintf(out,"X'");
535  for(i=0; i<nBlob; i++){ fprintf(out,"%02x",zBlob[i]&0xff); }
536  fprintf(out,"'");
532   int i;
533   char *zBlob = (char *)pBlob;
534   fprintf(out,"X'");
535   for(i=0; i<nBlob; i++){ fprintf(out,"%02x",zBlob[i]&0xff); }
536   fprintf(out,"'");
537537}
538538
539539/*
540540** Output the given string as a quoted string using SQL quoting conventions.
541541*/
542542static void output_quoted_string(FILE *out, const char *z){
543  int i;
544  int nSingle = 0;
545  for(i=0; z[i]; i++){
546    if( z[i]=='\'' ) nSingle++;
547  }
548  if( nSingle==0 ){
549    fprintf(out,"'%s'",z);
550  }else{
551    fprintf(out,"'");
552    while( *z ){
553      for(i=0; z[i] && z[i]!='\''; i++){}
554      if( i==0 ){
555        fprintf(out,"''");
556        z++;
557      }else if( z[i]=='\'' ){
558        fprintf(out,"%.*s''",i,z);
559        z += i+1;
560      }else{
561        fprintf(out,"%s",z);
562        break;
563      }
564    }
565    fprintf(out,"'");
566  }
543   int i;
544   int nSingle = 0;
545   for(i=0; z[i]; i++){
546   if( z[i]=='\'' ) nSingle++;
547   }
548   if( nSingle==0 ){
549   fprintf(out,"'%s'",z);
550   }else{
551   fprintf(out,"'");
552   while( *z ){
553      for(i=0; z[i] && z[i]!='\''; i++){}
554      if( i==0 ){
555      fprintf(out,"''");
556      z++;
557      }else if( z[i]=='\'' ){
558      fprintf(out,"%.*s''",i,z);
559      z += i+1;
560      }else{
561      fprintf(out,"%s",z);
562      break;
563      }
564   }
565   fprintf(out,"'");
566   }
567567}
568568
569569/*
570570** Output the given string as a quoted according to C or TCL quoting rules.
571571*/
572572static void output_c_string(FILE *out, const char *z){
573  unsigned int c;
574  fputc('"', out);
575  while( (c = *(z++))!=0 ){
576    if( c=='\\' ){
577      fputc(c, out);
578      fputc(c, out);
579    }else if( c=='"' ){
580      fputc('\\', out);
581      fputc('"', out);
582    }else if( c=='\t' ){
583      fputc('\\', out);
584      fputc('t', out);
585    }else if( c=='\n' ){
586      fputc('\\', out);
587      fputc('n', out);
588    }else if( c=='\r' ){
589      fputc('\\', out);
590      fputc('r', out);
591    }else if( !isprint(c&0xff) ){
592      fprintf(out, "\\%03o", c&0xff);
593    }else{
594      fputc(c, out);
595    }
596  }
597  fputc('"', out);
573   unsigned int c;
574   fputc('"', out);
575   while( (c = *(z++))!=0 ){
576   if( c=='\\' ){
577      fputc(c, out);
578      fputc(c, out);
579   }else if( c=='"' ){
580      fputc('\\', out);
581      fputc('"', out);
582   }else if( c=='\t' ){
583      fputc('\\', out);
584      fputc('t', out);
585   }else if( c=='\n' ){
586      fputc('\\', out);
587      fputc('n', out);
588   }else if( c=='\r' ){
589      fputc('\\', out);
590      fputc('r', out);
591   }else if( !isprint(c&0xff) ){
592      fprintf(out, "\\%03o", c&0xff);
593   }else{
594      fputc(c, out);
595   }
596   }
597   fputc('"', out);
598598}
599599
600600/*
r31373r31374
602602** HTML escaped.
603603*/
604604static void output_html_string(FILE *out, const char *z){
605  int i;
606  if( z==0 ) z = "";
607  while( *z ){
608    for(i=0;   z[i]
609            && z[i]!='<'
610            && z[i]!='&'
611            && z[i]!='>'
612            && z[i]!='\"'
613            && z[i]!='\'';
614        i++){}
615    if( i>0 ){
616      fprintf(out,"%.*s",i,z);
617    }
618    if( z[i]=='<' ){
619      fprintf(out,"&lt;");
620    }else if( z[i]=='&' ){
621      fprintf(out,"&amp;");
622    }else if( z[i]=='>' ){
623      fprintf(out,"&gt;");
624    }else if( z[i]=='\"' ){
625      fprintf(out,"&quot;");
626    }else if( z[i]=='\'' ){
627      fprintf(out,"&#39;");
628    }else{
629      break;
630    }
631    z += i + 1;
632  }
605   int i;
606   if( z==0 ) z = "";
607   while( *z ){
608   for(i=0;   z[i]
609         && z[i]!='<'
610         && z[i]!='&'
611         && z[i]!='>'
612         && z[i]!='\"'
613         && z[i]!='\'';
614      i++){}
615   if( i>0 ){
616      fprintf(out,"%.*s",i,z);
617   }
618   if( z[i]=='<' ){
619      fprintf(out,"&lt;");
620   }else if( z[i]=='&' ){
621      fprintf(out,"&amp;");
622   }else if( z[i]=='>' ){
623      fprintf(out,"&gt;");
624   }else if( z[i]=='\"' ){
625      fprintf(out,"&quot;");
626   }else if( z[i]=='\'' ){
627      fprintf(out,"&#39;");
628   }else{
629      break;
630   }
631   z += i + 1;
632   }
633633}
634634
635635/*
r31373r31374
637637** array, then the string must be quoted for CSV.
638638*/
639639static const char needCsvQuote[] = {
640  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
641  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
642  1, 0, 1, 0, 0, 0, 0, 1,   0, 0, 0, 0, 0, 0, 0, 0,
643  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,
644  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,
645  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,
646  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,
647  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 1,
648  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
649  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
650  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
651  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
652  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
653  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
654  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
655  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
640   1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
641   1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
642   1, 0, 1, 0, 0, 0, 0, 1,   0, 0, 0, 0, 0, 0, 0, 0,
643   0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,
644   0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,
645   0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,
646   0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,
647   0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 1,
648   1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
649   1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
650   1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
651   1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
652   1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
653   1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
654   1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
655   1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
656656};
657657
658658/*
r31373r31374
661661** the null value.  Strings are quoted if necessary.
662662*/
663663static void output_csv(struct callback_data *p, const char *z, int bSep){
664  FILE *out = p->out;
665  if( z==0 ){
666    fprintf(out,"%s",p->nullvalue);
667  }else{
668    int i;
669    int nSep = strlen30(p->separator);
670    for(i=0; z[i]; i++){
671      if( needCsvQuote[((unsigned char*)z)[i]]
672         || (z[i]==p->separator[0] &&
673             (nSep==1 || memcmp(z, p->separator, nSep)==0)) ){
674        i = 0;
675        break;
676      }
677    }
678    if( i==0 ){
679      putc('"', out);
680      for(i=0; z[i]; i++){
681        if( z[i]=='"' ) putc('"', out);
682        putc(z[i], out);
683      }
684      putc('"', out);
685    }else{
686      fprintf(out, "%s", z);
687    }
688  }
689  if( bSep ){
690    fprintf(p->out, "%s", p->separator);
691  }
664   FILE *out = p->out;
665   if( z==0 ){
666   fprintf(out,"%s",p->nullvalue);
667   }else{
668   int i;
669   int nSep = strlen30(p->separator);
670   for(i=0; z[i]; i++){
671      if( needCsvQuote[((unsigned char*)z)[i]]
672         || (z[i]==p->separator[0] &&
673            (nSep==1 || memcmp(z, p->separator, nSep)==0)) ){
674      i = 0;
675      break;
676      }
677   }
678   if( i==0 ){
679      putc('"', out);
680      for(i=0; z[i]; i++){
681      if( z[i]=='"' ) putc('"', out);
682      putc(z[i], out);
683      }
684      putc('"', out);
685   }else{
686      fprintf(out, "%s", z);
687   }
688   }
689   if( bSep ){
690   fprintf(p->out, "%s", p->separator);
691   }
692692}
693693
694694#ifdef SIGINT
r31373r31374
696696** This routine runs when the user presses Ctrl-C
697697*/
698698static void interrupt_handler(int NotUsed){
699  UNUSED_PARAMETER(NotUsed);
700  seenInterrupt = 1;
701  if( db ) sqlite3_interrupt(db);
699   UNUSED_PARAMETER(NotUsed);
700   seenInterrupt = 1;
701   if( db ) sqlite3_interrupt(db);
702702}
703703#endif
704704
r31373r31374
707707** invokes for each row of a query result.
708708*/
709709static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int *aiType){
710  int i;
711  struct callback_data *p = (struct callback_data*)pArg;
710   int i;
711   struct callback_data *p = (struct callback_data*)pArg;
712712
713  switch( p->mode ){
714    case MODE_Line: {
715      int w = 5;
716      if( azArg==0 ) break;
717      for(i=0; i<nArg; i++){
718        int len = strlen30(azCol[i] ? azCol[i] : "");
719        if( len>w ) w = len;
720      }
721      if( p->cnt++>0 ) fprintf(p->out,"\n");
722      for(i=0; i<nArg; i++){
723        fprintf(p->out,"%*s = %s\n", w, azCol[i],
724                azArg[i] ? azArg[i] : p->nullvalue);
725      }
726      break;
727    }
728    case MODE_Explain:
729    case MODE_Column: {
730      if( p->cnt++==0 ){
731        for(i=0; i<nArg; i++){
732          int w, n;
733          if( i<ArraySize(p->colWidth) ){
734            w = p->colWidth[i];
735          }else{
736            w = 0;
737          }
738          if( w==0 ){
739            w = strlen30(azCol[i] ? azCol[i] : "");
740            if( w<10 ) w = 10;
741            n = strlen30(azArg && azArg[i] ? azArg[i] : p->nullvalue);
742            if( w<n ) w = n;
743          }
744          if( i<ArraySize(p->actualWidth) ){
745            p->actualWidth[i] = w;
746          }
747          if( p->showHeader ){
748            if( w<0 ){
749              fprintf(p->out,"%*.*s%s",-w,-w,azCol[i], i==nArg-1 ? "\n": "  ");
750            }else{
751              fprintf(p->out,"%-*.*s%s",w,w,azCol[i], i==nArg-1 ? "\n": "  ");
752            }
753          }
754        }
755        if( p->showHeader ){
756          for(i=0; i<nArg; i++){
757            int w;
758            if( i<ArraySize(p->actualWidth) ){
759               w = p->actualWidth[i];
760               if( w<0 ) w = -w;
761            }else{
762               w = 10;
763            }
764            fprintf(p->out,"%-*.*s%s",w,w,"-----------------------------------"
765                   "----------------------------------------------------------",
766                    i==nArg-1 ? "\n": "  ");
767          }
768        }
769      }
770      if( azArg==0 ) break;
771      for(i=0; i<nArg; i++){
772        int w;
773        if( i<ArraySize(p->actualWidth) ){
774           w = p->actualWidth[i];
775        }else{
776           w = 10;
777        }
778        if( p->mode==MODE_Explain && azArg[i] && strlen30(azArg[i])>w ){
779          w = strlen30(azArg[i]);
780        }
781        if( i==1 && p->aiIndent && p->pStmt ){
782          if( p->iIndent<p->nIndent ){
783            fprintf(p->out, "%*.s", p->aiIndent[p->iIndent], "");
784          }
785          p->iIndent++;
786        }
787        if( w<0 ){
788          fprintf(p->out,"%*.*s%s",-w,-w,
789              azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": "  ");
790        }else{
791          fprintf(p->out,"%-*.*s%s",w,w,
792              azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": "  ");
793        }
794      }
795      break;
796    }
797    case MODE_Semi:
798    case MODE_List: {
799      if( p->cnt++==0 && p->showHeader ){
800        for(i=0; i<nArg; i++){
801          fprintf(p->out,"%s%s",azCol[i], i==nArg-1 ? "\n" : p->separator);
802        }
803      }
804      if( azArg==0 ) break;
805      for(i=0; i<nArg; i++){
806        char *z = azArg[i];
807        if( z==0 ) z = p->nullvalue;
808        fprintf(p->out, "%s", z);
809        if( i<nArg-1 ){
810          fprintf(p->out, "%s", p->separator);
811        }else if( p->mode==MODE_Semi ){
812          fprintf(p->out, ";\n");
813        }else{
814          fprintf(p->out, "\n");
815        }
816      }
817      break;
818    }
819    case MODE_Html: {
820      if( p->cnt++==0 && p->showHeader ){
821        fprintf(p->out,"<TR>");
822        for(i=0; i<nArg; i++){
823          fprintf(p->out,"<TH>");
824          output_html_string(p->out, azCol[i]);
825          fprintf(p->out,"</TH>\n");
826        }
827        fprintf(p->out,"</TR>\n");
828      }
829      if( azArg==0 ) break;
830      fprintf(p->out,"<TR>");
831      for(i=0; i<nArg; i++){
832        fprintf(p->out,"<TD>");
833        output_html_string(p->out, azArg[i] ? azArg[i] : p->nullvalue);
834        fprintf(p->out,"</TD>\n");
835      }
836      fprintf(p->out,"</TR>\n");
837      break;
838    }
839    case MODE_Tcl: {
840      if( p->cnt++==0 && p->showHeader ){
841        for(i=0; i<nArg; i++){
842          output_c_string(p->out,azCol[i] ? azCol[i] : "");
843          if(i<nArg-1) fprintf(p->out, "%s", p->separator);
844        }
845        fprintf(p->out,"\n");
846      }
847      if( azArg==0 ) break;
848      for(i=0; i<nArg; i++){
849        output_c_string(p->out, azArg[i] ? azArg[i] : p->nullvalue);
850        if(i<nArg-1) fprintf(p->out, "%s", p->separator);
851      }
852      fprintf(p->out,"\n");
853      break;
854    }
855    case MODE_Csv: {
856      if( p->cnt++==0 && p->showHeader ){
857        for(i=0; i<nArg; i++){
858          output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1);
859        }
860        fprintf(p->out,"\n");
861      }
862      if( azArg==0 ) break;
863      for(i=0; i<nArg; i++){
864        output_csv(p, azArg[i], i<nArg-1);
865      }
866      fprintf(p->out,"\n");
867      break;
868    }
869    case MODE_Insert: {
870      p->cnt++;
871      if( azArg==0 ) break;
872      fprintf(p->out,"INSERT INTO %s VALUES(",p->zDestTable);
873      for(i=0; i<nArg; i++){
874        const char *zSep = i>0 ? ",": "";
875        if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){
876          fprintf(p->out,"%sNULL",zSep);
877        }else if( aiType && aiType[i]==SQLITE_TEXT ){
878          if( zSep[0] ) fprintf(p->out,"%s",zSep);
879          output_quoted_string(p->out, azArg[i]);
880        }else if( aiType && (aiType[i]==SQLITE_INTEGER || aiType[i]==SQLITE_FLOAT) ){
881          fprintf(p->out,"%s%s",zSep, azArg[i]);
882        }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
883          const void *pBlob = sqlite3_column_blob(p->pStmt, i);
884          int nBlob = sqlite3_column_bytes(p->pStmt, i);
885          if( zSep[0] ) fprintf(p->out,"%s",zSep);
886          output_hex_blob(p->out, pBlob, nBlob);
887        }else if( isNumber(azArg[i], 0) ){
888          fprintf(p->out,"%s%s",zSep, azArg[i]);
889        }else{
890          if( zSep[0] ) fprintf(p->out,"%s",zSep);
891          output_quoted_string(p->out, azArg[i]);
892        }
893      }
894      fprintf(p->out,");\n");
895      break;
896    }
897  }
898  return 0;
713   switch( p->mode ){
714   case MODE_Line: {
715      int w = 5;
716      if( azArg==0 ) break;
717      for(i=0; i<nArg; i++){
718      int len = strlen30(azCol[i] ? azCol[i] : "");
719      if( len>w ) w = len;
720      }
721      if( p->cnt++>0 ) fprintf(p->out,"\n");
722      for(i=0; i<nArg; i++){
723      fprintf(p->out,"%*s = %s\n", w, azCol[i],
724            azArg[i] ? azArg[i] : p->nullvalue);
725      }
726      break;
727   }
728   case MODE_Explain:
729   case MODE_Column: {
730      if( p->cnt++==0 ){
731      for(i=0; i<nArg; i++){
732         int w, n;
733         if( i<ArraySize(p->colWidth) ){
734         w = p->colWidth[i];
735         }else{
736         w = 0;
737         }
738         if( w==0 ){
739         w = strlen30(azCol[i] ? azCol[i] : "");
740         if( w<10 ) w = 10;
741         n = strlen30(azArg && azArg[i] ? azArg[i] : p->nullvalue);
742         if( w<n ) w = n;
743         }
744         if( i<ArraySize(p->actualWidth) ){
745         p->actualWidth[i] = w;
746         }
747         if( p->showHeader ){
748         if( w<0 ){
749            fprintf(p->out,"%*.*s%s",-w,-w,azCol[i], i==nArg-1 ? "\n": "  ");
750         }else{
751            fprintf(p->out,"%-*.*s%s",w,w,azCol[i], i==nArg-1 ? "\n": "  ");
752         }
753         }
754      }
755      if( p->showHeader ){
756         for(i=0; i<nArg; i++){
757         int w;
758         if( i<ArraySize(p->actualWidth) ){
759            w = p->actualWidth[i];
760            if( w<0 ) w = -w;
761         }else{
762            w = 10;
763         }
764         fprintf(p->out,"%-*.*s%s",w,w,"-----------------------------------"
765               "----------------------------------------------------------",
766               i==nArg-1 ? "\n": "  ");
767         }
768      }
769      }
770      if( azArg==0 ) break;
771      for(i=0; i<nArg; i++){
772      int w;
773      if( i<ArraySize(p->actualWidth) ){
774         w = p->actualWidth[i];
775      }else{
776         w = 10;
777      }
778      if( p->mode==MODE_Explain && azArg[i] && strlen30(azArg[i])>w ){
779         w = strlen30(azArg[i]);
780      }
781      if( i==1 && p->aiIndent && p->pStmt ){
782         if( p->iIndent<p->nIndent ){
783         fprintf(p->out, "%*.s", p->aiIndent[p->iIndent], "");
784         }
785         p->iIndent++;
786      }
787      if( w<0 ){
788         fprintf(p->out,"%*.*s%s",-w,-w,
789            azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": "  ");
790      }else{
791         fprintf(p->out,"%-*.*s%s",w,w,
792            azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": "  ");
793      }
794      }
795      break;
796   }
797   case MODE_Semi:
798   case MODE_List: {
799      if( p->cnt++==0 && p->showHeader ){
800      for(i=0; i<nArg; i++){
801         fprintf(p->out,"%s%s",azCol[i], i==nArg-1 ? "\n" : p->separator);
802      }
803      }
804      if( azArg==0 ) break;
805      for(i=0; i<nArg; i++){
806      char *z = azArg[i];
807      if( z==0 ) z = p->nullvalue;
808      fprintf(p->out, "%s", z);
809      if( i<nArg-1 ){
810         fprintf(p->out, "%s", p->separator);
811      }else if( p->mode==MODE_Semi ){
812         fprintf(p->out, ";\n");
813      }else{
814         fprintf(p->out, "\n");
815      }
816      }
817      break;
818   }
819   case MODE_Html: {
820      if( p->cnt++==0 && p->showHeader ){
821      fprintf(p->out,"<TR>");
822      for(i=0; i<nArg; i++){
823         fprintf(p->out,"<TH>");
824         output_html_string(p->out, azCol[i]);
825         fprintf(p->out,"</TH>\n");
826      }
827      fprintf(p->out,"</TR>\n");
828      }
829      if( azArg==0 ) break;
830      fprintf(p->out,"<TR>");
831      for(i=0; i<nArg; i++){
832      fprintf(p->out,"<TD>");
833      output_html_string(p->out, azArg[i] ? azArg[i] : p->nullvalue);
834      fprintf(p->out,"</TD>\n");
835      }
836      fprintf(p->out,"</TR>\n");
837      break;
838   }
839   case MODE_Tcl: {
840      if( p->cnt++==0 && p->showHeader ){
841      for(i=0; i<nArg; i++){
842         output_c_string(p->out,azCol[i] ? azCol[i] : "");
843         if(i<nArg-1) fprintf(p->out, "%s", p->separator);
844      }
845      fprintf(p->out,"\n");
846      }
847      if( azArg==0 ) break;
848      for(i=0; i<nArg; i++){
849      output_c_string(p->out, azArg[i] ? azArg[i] : p->nullvalue);
850      if(i<nArg-1) fprintf(p->out, "%s", p->separator);
851      }
852      fprintf(p->out,"\n");
853      break;
854   }
855   case MODE_Csv: {
856      if( p->cnt++==0 && p->showHeader ){
857      for(i=0; i<nArg; i++){
858         output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1);
859      }
860      fprintf(p->out,"\n");
861      }
862      if( azArg==0 ) break;
863      for(i=0; i<nArg; i++){
864      output_csv(p, azArg[i], i<nArg-1);
865      }
866      fprintf(p->out,"\n");
867      break;
868   }
869   case MODE_Insert: {
870      p->cnt++;
871      if( azArg==0 ) break;
872      fprintf(p->out,"INSERT INTO %s VALUES(",p->zDestTable);
873      for(i=0; i<nArg; i++){
874      const char *zSep = i>0 ? ",": "";
875      if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){
876         fprintf(p->out,"%sNULL",zSep);
877      }else if( aiType && aiType[i]==SQLITE_TEXT ){
878         if( zSep[0] ) fprintf(p->out,"%s",zSep);
879         output_quoted_string(p->out, azArg[i]);
880      }else if( aiType && (aiType[i]==SQLITE_INTEGER || aiType[i]==SQLITE_FLOAT) ){
881         fprintf(p->out,"%s%s",zSep, azArg[i]);
882      }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
883         const void *pBlob = sqlite3_column_blob(p->pStmt, i);
884         int nBlob = sqlite3_column_bytes(p->pStmt, i);
885         if( zSep[0] ) fprintf(p->out,"%s",zSep);
886         output_hex_blob(p->out, pBlob, nBlob);
887      }else if( isNumber(azArg[i], 0) ){
888         fprintf(p->out,"%s%s",zSep, azArg[i]);
889      }else{
890         if( zSep[0] ) fprintf(p->out,"%s",zSep);
891         output_quoted_string(p->out, azArg[i]);
892      }
893      }
894      fprintf(p->out,");\n");
895      break;
896   }
897   }
898   return 0;
899899}
900900
901901/*
r31373r31374
903903** invokes for each row of a query result.
904904*/
905905static int callback(void *pArg, int nArg, char **azArg, char **azCol){
906  /* since we don't have type info, call the shell_callback with a NULL value */
907  return shell_callback(pArg, nArg, azArg, azCol, NULL);
906   /* since we don't have type info, call the shell_callback with a NULL value */
907   return shell_callback(pArg, nArg, azArg, azCol, NULL);
908908}
909909
910910/*
r31373r31374
913913** table name.
914914*/
915915static void set_table_name(struct callback_data *p, const char *zName){
916  int i, n;
917  int needQuote;
918  char *z;
916   int i, n;
917   int needQuote;
918   char *z;
919919
920  if( p->zDestTable ){
921    free(p->zDestTable);
922    p->zDestTable = 0;
923  }
924  if( zName==0 ) return;
925  needQuote = !isalpha((unsigned char)*zName) && *zName!='_';
926  for(i=n=0; zName[i]; i++, n++){
927    if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ){
928      needQuote = 1;
929      if( zName[i]=='\'' ) n++;
930    }
931  }
932  if( needQuote ) n += 2;
933  z = p->zDestTable = (char*)malloc( n+1 );
934  if( z==0 ){
935    fprintf(stderr,"Error: out of memory\n");
936    exit(1);
937  }
938  n = 0;
939  if( needQuote ) z[n++] = '\'';
940  for(i=0; zName[i]; i++){
941    z[n++] = zName[i];
942    if( zName[i]=='\'' ) z[n++] = '\'';
943  }
944  if( needQuote ) z[n++] = '\'';
945  z[n] = 0;
920   if( p->zDestTable ){
921   free(p->zDestTable);
922   p->zDestTable = 0;
923   }
924   if( zName==0 ) return;
925   needQuote = !isalpha((unsigned char)*zName) && *zName!='_';
926   for(i=n=0; zName[i]; i++, n++){
927   if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ){
928      needQuote = 1;
929      if( zName[i]=='\'' ) n++;
930   }
931   }
932   if( needQuote ) n += 2;
933   z = p->zDestTable = (char*)malloc( n+1 );
934   if( z==0 ){
935   fprintf(stderr,"Error: out of memory\n");
936   exit(1);
937   }
938   n = 0;
939   if( needQuote ) z[n++] = '\'';
940   for(i=0; zName[i]; i++){
941   z[n++] = zName[i];
942   if( zName[i]=='\'' ) z[n++] = '\'';
943   }
944   if( needQuote ) z[n++] = '\'';
945   z[n] = 0;
946946}
947947
948948/* zIn is either a pointer to a NULL-terminated string in memory obtained
r31373r31374
950950** added to zIn, and the result returned in memory obtained from malloc().
951951** zIn, if it was not NULL, is freed.
952952**
953** If the third argument, quote, is not '\0', then it is used as a
953** If the third argument, quote, is not '\0', then it is used as a
954954** quote character for zAppend.
955955*/
956956static char *appendText(char *zIn, char const *zAppend, char quote){
957  int len;
958  int i;
959  int nAppend = strlen30(zAppend);
960  int nIn = (zIn?strlen30(zIn):0);
957   int len;
958   int i;
959   int nAppend = strlen30(zAppend);
960   int nIn = (zIn?strlen30(zIn):0);
961961
962  len = nAppend+nIn+1;
963  if( quote ){
964    len += 2;
965    for(i=0; i<nAppend; i++){
966      if( zAppend[i]==quote ) len++;
967    }
968  }
962   len = nAppend+nIn+1;
963   if( quote ){
964   len += 2;
965   for(i=0; i<nAppend; i++){
966      if( zAppend[i]==quote ) len++;
967   }
968   }
969969
970  zIn = (char *)realloc(zIn, len);
971  if( !zIn ){
972    return 0;
973  }
970   zIn = (char *)realloc(zIn, len);
971   if( !zIn ){
972   return 0;
973   }
974974
975  if( quote ){
976    char *zCsr = &zIn[nIn];
977    *zCsr++ = quote;
978    for(i=0; i<nAppend; i++){
979      *zCsr++ = zAppend[i];
980      if( zAppend[i]==quote ) *zCsr++ = quote;
981    }
982    *zCsr++ = quote;
983    *zCsr++ = '\0';
984    assert( (zCsr-zIn)==len );
985  }else{
986    memcpy(&zIn[nIn], zAppend, nAppend);
987    zIn[len-1] = '\0';
988  }
975   if( quote ){
976   char *zCsr = &zIn[nIn];
977   *zCsr++ = quote;
978   for(i=0; i<nAppend; i++){
979      *zCsr++ = zAppend[i];
980      if( zAppend[i]==quote ) *zCsr++ = quote;
981   }
982   *zCsr++ = quote;
983   *zCsr++ = '\0';
984   assert( (zCsr-zIn)==len );
985   }else{
986   memcpy(&zIn[nIn], zAppend, nAppend);
987   zIn[len-1] = '\0';
988   }
989989
990  return zIn;
990   return zIn;
991991}
992992
993993
r31373r31374
997997** semicolon terminator to the end of that line.
998998**
999999** If the number of columns is 1 and that column contains text "--"
1000** then write the semicolon on a separate line.  That way, if a
1000** then write the semicolon on a separate line.  That way, if a
10011001** "--" comment occurs at the end of the statement, the comment
10021002** won't consume the semicolon terminator.
10031003*/
10041004static int run_table_dump_query(
1005  struct callback_data *p, /* Query context */
1006  const char *zSelect,     /* SELECT statement to extract content */
1007  const char *zFirstRow    /* Print before first row, if not NULL */
1005   struct callback_data *p, /* Query context */
1006   const char *zSelect,     /* SELECT statement to extract content */
1007   const char *zFirstRow    /* Print before first row, if not NULL */
10081008){
1009  sqlite3_stmt *pSelect;
1010  int rc;
1011  int nResult;
1012  int i;
1013  const char *z;
1014  rc = sqlite3_prepare_v2(p->db, zSelect, -1, &pSelect, 0);
1015  if( rc!=SQLITE_OK || !pSelect ){
1016    fprintf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db));
1017    if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++;
1018    return rc;
1019  }
1020  rc = sqlite3_step(pSelect);
1021  nResult = sqlite3_column_count(pSelect);
1022  while( rc==SQLITE_ROW ){
1023    if( zFirstRow ){
1024      fprintf(p->out, "%s", zFirstRow);
1025      zFirstRow = 0;
1026    }
1027    z = (const char*)sqlite3_column_text(pSelect, 0);
1028    fprintf(p->out, "%s", z);
1029    for(i=1; i<nResult; i++){
1030      fprintf(p->out, ",%s", sqlite3_column_text(pSelect, i));
1031    }
1032    if( z==0 ) z = "";
1033    while( z[0] && (z[0]!='-' || z[1]!='-') ) z++;
1034    if( z[0] ){
1035      fprintf(p->out, "\n;\n");
1036    }else{
1037      fprintf(p->out, ";\n");
1038    }   
1039    rc = sqlite3_step(pSelect);
1040  }
1041  rc = sqlite3_finalize(pSelect);
1042  if( rc!=SQLITE_OK ){
1043    fprintf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db));
1044    if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++;
1045  }
1046  return rc;
1009   sqlite3_stmt *pSelect;
1010   int rc;
1011   int nResult;
1012   int i;
1013   const char *z;
1014   rc = sqlite3_prepare_v2(p->db, zSelect, -1, &pSelect, 0);
1015   if( rc!=SQLITE_OK || !pSelect ){
1016   fprintf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db));
1017   if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++;
1018   return rc;
1019   }
1020   rc = sqlite3_step(pSelect);
1021   nResult = sqlite3_column_count(pSelect);
1022   while( rc==SQLITE_ROW ){
1023   if( zFirstRow ){
1024      fprintf(p->out, "%s", zFirstRow);
1025      zFirstRow = 0;
1026   }
1027   z = (const char*)sqlite3_column_text(pSelect, 0);
1028   fprintf(p->out, "%s", z);
1029   for(i=1; i<nResult; i++){
1030      fprintf(p->out, ",%s", sqlite3_column_text(pSelect, i));
1031   }
1032   if( z==0 ) z = "";
1033   while( z[0] && (z[0]!='-' || z[1]!='-') ) z++;
1034   if( z[0] ){
1035      fprintf(p->out, "\n;\n");
1036   }else{
1037      fprintf(p->out, ";\n");
1038   }
1039   rc = sqlite3_step(pSelect);
1040   }
1041   rc = sqlite3_finalize(pSelect);
1042   if( rc!=SQLITE_OK ){
1043   fprintf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db));
1044   if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++;
1045   }
1046   return rc;
10471047}
10481048
10491049/*
10501050** Allocate space and save off current error string.
10511051*/
10521052static char *save_err_msg(
1053  sqlite3 *db            /* Database to query */
1053   sqlite3 *db            /* Database to query */
10541054){
1055  int nErrMsg = 1+strlen30(sqlite3_errmsg(db));
1056  char *zErrMsg = (char*)sqlite3_malloc(nErrMsg);
1057  if( zErrMsg ){
1058    memcpy(zErrMsg, sqlite3_errmsg(db), nErrMsg);
1059  }
1060  return zErrMsg;
1055   int nErrMsg = 1+strlen30(sqlite3_errmsg(db));
1056   char *zErrMsg = (char*)sqlite3_malloc(nErrMsg);
1057   if( zErrMsg ){
1058   memcpy(zErrMsg, sqlite3_errmsg(db), nErrMsg);
1059   }
1060   return zErrMsg;
10611061}
10621062
10631063/*
10641064** Display memory stats.
10651065*/
10661066static int display_stats(
1067  sqlite3 *db,                /* Database to query */
1068  struct callback_data *pArg, /* Pointer to struct callback_data */
1069  int bReset                  /* True to reset the stats */
1067   sqlite3 *db,                /* Database to query */
1068   struct callback_data *pArg, /* Pointer to struct callback_data */
1069   int bReset                  /* True to reset the stats */
10701070){
1071  int iCur;
1072  int iHiwtr;
1071   int iCur;
1072   int iHiwtr;
10731073
1074  if( pArg && pArg->out ){
1075   
1076    iHiwtr = iCur = -1;
1077    sqlite3_status(SQLITE_STATUS_MEMORY_USED, &iCur, &iHiwtr, bReset);
1078    fprintf(pArg->out, "Memory Used:                         %d (max %d) bytes\n", iCur, iHiwtr);
1079    iHiwtr = iCur = -1;
1080    sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &iCur, &iHiwtr, bReset);
1081    fprintf(pArg->out, "Number of Outstanding Allocations:   %d (max %d)\n", iCur, iHiwtr);
1074   if( pArg && pArg->out ){
1075   iHiwtr = iCur = -1;
1076   sqlite3_status(SQLITE_STATUS_MEMORY_USED, &iCur, &iHiwtr, bReset);
1077   fprintf(pArg->out, "Memory Used:                         %d (max %d) bytes\n", iCur, iHiwtr);
1078   iHiwtr = iCur = -1;
1079   sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &iCur, &iHiwtr, bReset);
1080   fprintf(pArg->out, "Number of Outstanding Allocations:   %d (max %d)\n", iCur, iHiwtr);
10821081/*
10831082** Not currently used by the CLI.
10841083**    iHiwtr = iCur = -1;
10851084**    sqlite3_status(SQLITE_STATUS_PAGECACHE_USED, &iCur, &iHiwtr, bReset);
10861085**    fprintf(pArg->out, "Number of Pcache Pages Used:         %d (max %d) pages\n", iCur, iHiwtr);
10871086*/
1088    iHiwtr = iCur = -1;
1089    sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &iCur, &iHiwtr, bReset);
1090    fprintf(pArg->out, "Number of Pcache Overflow Bytes:     %d (max %d) bytes\n", iCur, iHiwtr);
1087   iHiwtr = iCur = -1;
1088   sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &iCur, &iHiwtr, bReset);
1089   fprintf(pArg->out, "Number of Pcache Overflow Bytes:     %d (max %d) bytes\n", iCur, iHiwtr);
10911090/*
10921091** Not currently used by the CLI.
10931092**    iHiwtr = iCur = -1;
10941093**    sqlite3_status(SQLITE_STATUS_SCRATCH_USED, &iCur, &iHiwtr, bReset);
10951094**    fprintf(pArg->out, "Number of Scratch Allocations Used:  %d (max %d)\n", iCur, iHiwtr);
10961095*/
1097    iHiwtr = iCur = -1;
1098    sqlite3_status(SQLITE_STATUS_SCRATCH_OVERFLOW, &iCur, &iHiwtr, bReset);
1099    fprintf(pArg->out, "Number of Scratch Overflow Bytes:    %d (max %d) bytes\n", iCur, iHiwtr);
1100    iHiwtr = iCur = -1;
1101    sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &iCur, &iHiwtr, bReset);
1102    fprintf(pArg->out, "Largest Allocation:                  %d bytes\n", iHiwtr);
1103    iHiwtr = iCur = -1;
1104    sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, &iCur, &iHiwtr, bReset);
1105    fprintf(pArg->out, "Largest Pcache Allocation:           %d bytes\n", iHiwtr);
1106    iHiwtr = iCur = -1;
1107    sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHiwtr, bReset);
1108    fprintf(pArg->out, "Largest Scratch Allocation:          %d bytes\n", iHiwtr);
1096   iHiwtr = iCur = -1;
1097   sqlite3_status(SQLITE_STATUS_SCRATCH_OVERFLOW, &iCur, &iHiwtr, bReset);
1098   fprintf(pArg->out, "Number of Scratch Overflow Bytes:    %d (max %d) bytes\n", iCur, iHiwtr);
1099   iHiwtr = iCur = -1;
1100   sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &iCur, &iHiwtr, bReset);
1101   fprintf(pArg->out, "Largest Allocation:                  %d bytes\n", iHiwtr);
1102   iHiwtr = iCur = -1;
1103   sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, &iCur, &iHiwtr, bReset);
1104   fprintf(pArg->out, "Largest Pcache Allocation:           %d bytes\n", iHiwtr);
1105   iHiwtr = iCur = -1;
1106   sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHiwtr, bReset);
1107   fprintf(pArg->out, "Largest Scratch Allocation:          %d bytes\n", iHiwtr);
11091108#ifdef YYTRACKMAXSTACKDEPTH
1110    iHiwtr = iCur = -1;
1111    sqlite3_status(SQLITE_STATUS_PARSER_STACK, &iCur, &iHiwtr, bReset);
1112    fprintf(pArg->out, "Deepest Parser Stack:                %d (max %d)\n", iCur, iHiwtr);
1109   iHiwtr = iCur = -1;
1110   sqlite3_status(SQLITE_STATUS_PARSER_STACK, &iCur, &iHiwtr, bReset);
1111   fprintf(pArg->out, "Deepest Parser Stack:                %d (max %d)\n", iCur, iHiwtr);
11131112#endif
1114  }
1113   }
11151114
1116  if( pArg && pArg->out && db ){
1117    iHiwtr = iCur = -1;
1118    sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED, &iCur, &iHiwtr, bReset);
1119    fprintf(pArg->out, "Lookaside Slots Used:                %d (max %d)\n", iCur, iHiwtr);
1120    sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &iCur, &iHiwtr, bReset);
1121    fprintf(pArg->out, "Successful lookaside attempts:       %d\n", iHiwtr);
1122    sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &iCur, &iHiwtr, bReset);
1123    fprintf(pArg->out, "Lookaside failures due to size:      %d\n", iHiwtr);
1124    sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &iCur, &iHiwtr, bReset);
1125    fprintf(pArg->out, "Lookaside failures due to OOM:       %d\n", iHiwtr);
1126    iHiwtr = iCur = -1;
1127    sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset);
1128    fprintf(pArg->out, "Pager Heap Usage:                    %d bytes\n", iCur);    iHiwtr = iCur = -1;
1129    sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1);
1130    fprintf(pArg->out, "Page cache hits:                     %d\n", iCur);
1131    iHiwtr = iCur = -1;
1132    sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1);
1133    fprintf(pArg->out, "Page cache misses:                   %d\n", iCur);
1134    iHiwtr = iCur = -1;
1135    sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1);
1136    fprintf(pArg->out, "Page cache writes:                   %d\n", iCur);
1137    iHiwtr = iCur = -1;
1138    sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset);
1139    fprintf(pArg->out, "Schema Heap Usage:                   %d bytes\n", iCur);
1140    iHiwtr = iCur = -1;
1141    sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset);
1142    fprintf(pArg->out, "Statement Heap/Lookaside Usage:      %d bytes\n", iCur);
1143  }
1115   if( pArg && pArg->out && db ){
1116   iHiwtr = iCur = -1;
1117   sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED, &iCur, &iHiwtr, bReset);
1118   fprintf(pArg->out, "Lookaside Slots Used:                %d (max %d)\n", iCur, iHiwtr);
1119   sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &iCur, &iHiwtr, bReset);
1120   fprintf(pArg->out, "Successful lookaside attempts:       %d\n", iHiwtr);
1121   sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &iCur, &iHiwtr, bReset);
1122   fprintf(pArg->out, "Lookaside failures due to size:      %d\n", iHiwtr);
1123   sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &iCur, &iHiwtr, bReset);
1124   fprintf(pArg->out, "Lookaside failures due to OOM:       %d\n", iHiwtr);
1125   iHiwtr = iCur = -1;
1126   sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset);
1127   fprintf(pArg->out, "Pager Heap Usage:                    %d bytes\n", iCur);    iHiwtr = iCur = -1;
1128   sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1);
1129   fprintf(pArg->out, "Page cache hits:                     %d\n", iCur);
1130   iHiwtr = iCur = -1;
1131   sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1);
1132   fprintf(pArg->out, "Page cache misses:                   %d\n", iCur);
1133   iHiwtr = iCur = -1;
1134   sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1);
1135   fprintf(pArg->out, "Page cache writes:                   %d\n", iCur);
1136   iHiwtr = iCur = -1;
1137   sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset);
1138   fprintf(pArg->out, "Schema Heap Usage:                   %d bytes\n", iCur);
1139   iHiwtr = iCur = -1;
1140   sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset);
1141   fprintf(pArg->out, "Statement Heap/Lookaside Usage:      %d bytes\n", iCur);
1142   }
11441143
1145  if( pArg && pArg->out && db && pArg->pStmt ){
1146    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, bReset);
1147    fprintf(pArg->out, "Fullscan Steps:                      %d\n", iCur);
1148    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
1149    fprintf(pArg->out, "Sort Operations:                     %d\n", iCur);
1150    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
1151    fprintf(pArg->out, "Autoindex Inserts:                   %d\n", iCur);
1152    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1153    fprintf(pArg->out, "Virtual Machine Steps:               %d\n", iCur);
1154  }
1144   if( pArg && pArg->out && db && pArg->pStmt ){
1145   iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, bReset);
1146   fprintf(pArg->out, "Fullscan Steps:                      %d\n", iCur);
1147   iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
1148   fprintf(pArg->out, "Sort Operations:                     %d\n", iCur);
1149   iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
1150   fprintf(pArg->out, "Autoindex Inserts:                   %d\n", iCur);
1151   iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
1152   fprintf(pArg->out, "Virtual Machine Steps:               %d\n", iCur);
1153   }
11551154
1156  return 0;
1155   return 0;
11571156}
11581157
11591158/*
r31373r31374
11631162** Otherwise, return zero.
11641163*/
11651164static int str_in_array(const char *zStr, const char **azArray){
1166  int i;
1167  for(i=0; azArray[i]; i++){
1168    if( 0==strcmp(zStr, azArray[i]) ) return 1;
1169  }
1170  return 0;
1165   int i;
1166   for(i=0; azArray[i]; i++){
1167   if( 0==strcmp(zStr, azArray[i]) ) return 1;
1168   }
1169   return 0;
11711170}
11721171
11731172/*
11741173** If compiled statement pSql appears to be an EXPLAIN statement, allocate
11751174** and populate the callback_data.aiIndent[] array with the number of
1176** spaces each opcode should be indented before it is output.
1175** spaces each opcode should be indented before it is output.
11771176**
11781177** The indenting rules are:
11791178**
r31373r31374
11891188**       and "Goto" by 2 spaces.
11901189*/
11911190static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){
1192  const char *zSql;               /* The text of the SQL statement */
1193  const char *z;                  /* Used to check if this is an EXPLAIN */
1194  int *abYield = 0;               /* True if op is an OP_Yield */
1195  int nAlloc = 0;                 /* Allocated size of p->aiIndent[], abYield */
1196  int iOp;                        /* Index of operation in p->aiIndent[] */
1191   const char *zSql;               /* The text of the SQL statement */
1192   const char *z;                  /* Used to check if this is an EXPLAIN */
1193   int *abYield = 0;               /* True if op is an OP_Yield */
1194   int nAlloc = 0;                 /* Allocated size of p->aiIndent[], abYield */
1195   int iOp;                        /* Index of operation in p->aiIndent[] */
11971196
1198  const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", 0 };
1199  const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", "Rewind", 0 };
1200  const char *azGoto[] = { "Goto", 0 };
1197   const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", 0 };
1198   const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", "Rewind", 0 };
1199   const char *azGoto[] = { "Goto", 0 };
12011200
1202  /* Try to figure out if this is really an EXPLAIN statement. If this
1203  ** cannot be verified, return early.  */
1204  zSql = sqlite3_sql(pSql);
1205  if( zSql==0 ) return;
1206  for(z=zSql; *z==' ' || *z=='\t' || *z=='\n' || *z=='\f' || *z=='\r'; z++);
1207  if( sqlite3_strnicmp(z, "explain", 7) ) return;
1201   /* Try to figure out if this is really an EXPLAIN statement. If this
1202   ** cannot be verified, return early.  */
1203   zSql = sqlite3_sql(pSql);
1204   if( zSql==0 ) return;
1205   for(z=zSql; *z==' ' || *z=='\t' || *z=='\n' || *z=='\f' || *z=='\r'; z++);
1206   if( sqlite3_strnicmp(z, "explain", 7) ) return;
12081207
1209  for(iOp=0; SQLITE_ROW==sqlite3_step(pSql); iOp++){
1210    int i;
1211    int iAddr = sqlite3_column_int(pSql, 0);
1212    const char *zOp = (const char*)sqlite3_column_text(pSql, 1);
1208   for(iOp=0; SQLITE_ROW==sqlite3_step(pSql); iOp++){
1209   int i;
1210   int iAddr = sqlite3_column_int(pSql, 0);
1211   const char *zOp = (const char*)sqlite3_column_text(pSql, 1);
12131212
1214    /* Set p2 to the P2 field of the current opcode. Then, assuming that
1215    ** p2 is an instruction address, set variable p2op to the index of that
1216    ** instruction in the aiIndent[] array. p2 and p2op may be different if
1217    ** the current instruction is part of a sub-program generated by an
1218    ** SQL trigger or foreign key.  */
1219    int p2 = sqlite3_column_int(pSql, 3);
1220    int p2op = (p2 + (iOp-iAddr));
1213   /* Set p2 to the P2 field of the current opcode. Then, assuming that
1214   ** p2 is an instruction address, set variable p2op to the index of that
1215   ** instruction in the aiIndent[] array. p2 and p2op may be different if
1216   ** the current instruction is part of a sub-program generated by an
1217   ** SQL trigger or foreign key.  */
1218   int p2 = sqlite3_column_int(pSql, 3);
1219   int p2op = (p2 + (iOp-iAddr));
12211220
1222    /* Grow the p->aiIndent array as required */
1223    if( iOp>=nAlloc ){
1224      nAlloc += 100;
1225      p->aiIndent = (int*)sqlite3_realloc(p->aiIndent, nAlloc*sizeof(int));
1226      abYield = (int*)sqlite3_realloc(abYield, nAlloc*sizeof(int));
1227    }
1228    abYield[iOp] = str_in_array(zOp, azYield);
1229    p->aiIndent[iOp] = 0;
1230    p->nIndent = iOp+1;
1221   /* Grow the p->aiIndent array as required */
1222   if( iOp>=nAlloc ){
1223      nAlloc += 100;
1224      p->aiIndent = (int*)sqlite3_realloc(p->aiIndent, nAlloc*sizeof(int));
1225      abYield = (int*)sqlite3_realloc(abYield, nAlloc*sizeof(int));
1226   }
1227   abYield[iOp] = str_in_array(zOp, azYield);
1228   p->aiIndent[iOp] = 0;
1229   p->nIndent = iOp+1;
12311230
1232    if( str_in_array(zOp, azNext) ){
1233      for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
1234    }
1235    if( str_in_array(zOp, azGoto) && p2op<p->nIndent
1236     && (abYield[p2op] || sqlite3_column_int(pSql, 2))
1237    ){
1238      for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2;
1239    }
1240  }
1231   if( str_in_array(zOp, azNext) ){
1232      for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
1233   }
1234   if( str_in_array(zOp, azGoto) && p2op<p->nIndent
1235      && (abYield[p2op] || sqlite3_column_int(pSql, 2))
1236   ){
1237      for(i=p2op+1; i<iOp; i++) p->aiIndent[i] += 2;
1238   }
1239   }
12411240
1242  p->iIndent = 0;
1243  sqlite3_free(abYield);
1244  sqlite3_reset(pSql);
1241   p->iIndent = 0;
1242   sqlite3_free(abYield);
1243   sqlite3_reset(pSql);
12451244}
12461245
12471246/*
12481247** Free the array allocated by explain_data_prepare().
12491248*/
12501249static void explain_data_delete(struct callback_data *p){
1251  sqlite3_free(p->aiIndent);
1252  p->aiIndent = 0;
1253  p->nIndent = 0;
1254  p->iIndent = 0;
1250   sqlite3_free(p->aiIndent);
1251   p->aiIndent = 0;
1252   p->nIndent = 0;
1253   p->iIndent = 0;
12551254}
12561255
12571256/*
1258** Execute a statement or set of statements.  Print
1259** any result rows/columns depending on the current mode
1257** Execute a statement or set of statements.  Print
1258** any result rows/columns depending on the current mode
12601259** set via the supplied callback.
12611260**
1262** This is very similar to SQLite's built-in sqlite3_exec()
1263** function except it takes a slightly different callback
1261** This is very similar to SQLite's built-in sqlite3_exec()
1262** function except it takes a slightly different callback
12641263** and callback data argument.
12651264*/
12661265static int shell_exec(
1267  sqlite3 *db,                                /* An open database */
1268  const char *zSql,                           /* SQL to be evaluated */
1269  int (*xCallback)(void*,int,char**,char**,int*),   /* Callback function */
1270                                              /* (not the same as sqlite3_exec) */
1271  struct callback_data *pArg,                 /* Pointer to struct callback_data */
1272  char **pzErrMsg                             /* Error msg written here */
1266   sqlite3 *db,                                /* An open database */
1267   const char *zSql,                           /* SQL to be evaluated */
1268   int (*xCallback)(void*,int,char**,char**,int*),   /* Callback function */
1269                                    /* (not the same as sqlite3_exec) */
1270   struct callback_data *pArg,                 /* Pointer to struct callback_data */
1271   char **pzErrMsg                             /* Error msg written here */
12731272){
1274  sqlite3_stmt *pStmt = NULL;     /* Statement to execute. */
1275  int rc = SQLITE_OK;             /* Return Code */
1276  int rc2;
1277  const char *zLeftover;          /* Tail of unprocessed SQL */
1273   sqlite3_stmt *pStmt = NULL;     /* Statement to execute. */
1274   int rc = SQLITE_OK;             /* Return Code */
1275   int rc2;
1276   const char *zLeftover;          /* Tail of unprocessed SQL */
12781277
1279  if( pzErrMsg ){
1280    *pzErrMsg = NULL;
1281  }
1278   if( pzErrMsg ){
1279   *pzErrMsg = NULL;
1280   }
12821281
1283  while( zSql[0] && (SQLITE_OK == rc) ){
1284    rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
1285    if( SQLITE_OK != rc ){
1286      if( pzErrMsg ){
1287        *pzErrMsg = save_err_msg(db);
1288      }
1289    }else{
1290      if( !pStmt ){
1291        /* this happens for a comment or white-space */
1292        zSql = zLeftover;
1293        while( IsSpace(zSql[0]) ) zSql++;
1294        continue;
1295      }
1282   while( zSql[0] && (SQLITE_OK == rc) ){
1283   rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
1284   if( SQLITE_OK != rc ){
1285      if( pzErrMsg ){
1286      *pzErrMsg = save_err_msg(db);
1287      }
1288   }else{
1289      if( !pStmt ){
1290      /* this happens for a comment or white-space */
1291      zSql = zLeftover;
1292      while( IsSpace(zSql[0]) ) zSql++;
1293      continue;
1294      }
12961295
1297      /* save off the prepared statment handle and reset row count */
1298      if( pArg ){
1299        pArg->pStmt = pStmt;
1300        pArg->cnt = 0;
1301      }
1296      /* save off the prepared statment handle and reset row count */
1297      if( pArg ){
1298      pArg->pStmt = pStmt;
1299      pArg->cnt = 0;
1300      }
13021301
1303      /* echo the sql statement if echo on */
1304      if( pArg && pArg->echoOn ){
1305        const char *zStmtSql = sqlite3_sql(pStmt);
1306        fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql);
1307      }
1302      /* echo the sql statement if echo on */
1303      if( pArg && pArg->echoOn ){
1304      const char *zStmtSql = sqlite3_sql(pStmt);
1305      fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql);
1306      }
13081307
1309      /* Show the EXPLAIN QUERY PLAN if .eqp is on */
1310      if( pArg && pArg->autoEQP ){
1311        sqlite3_stmt *pExplain;
1312        char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", sqlite3_sql(pStmt));
1313        rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
1314        if( rc==SQLITE_OK ){
1315          while( sqlite3_step(pExplain)==SQLITE_ROW ){
1316            fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0));
1317            fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1));
1318            fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2));
1319            fprintf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3));
1320          }
1321        }
1322        sqlite3_finalize(pExplain);
1323        sqlite3_free(zEQP);
1324      }
1308      /* Show the EXPLAIN QUERY PLAN if .eqp is on */
1309      if( pArg && pArg->autoEQP ){
1310      sqlite3_stmt *pExplain;
1311      char *zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", sqlite3_sql(pStmt));
1312      rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
1313      if( rc==SQLITE_OK ){
1314         while( sqlite3_step(pExplain)==SQLITE_ROW ){
1315         fprintf(pArg->out,"--EQP-- %d,", sqlite3_column_int(pExplain, 0));
1316         fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1));
1317         fprintf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2));
1318         fprintf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3));
1319         }
1320      }
1321      sqlite3_finalize(pExplain);
1322      sqlite3_free(zEQP);
1323      }
13251324
1326      /* Output TESTCTRL_EXPLAIN text of requested */
1327      if( pArg && pArg->mode==MODE_Explain ){
1328        const char *zExplain = 0;
1329        sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
1330        if( zExplain && zExplain[0] ){
1331          fprintf(pArg->out, "%s", zExplain);
1332        }
1333      }
1325      /* Output TESTCTRL_EXPLAIN text of requested */
1326      if( pArg && pArg->mode==MODE_Explain ){
1327      const char *zExplain = 0;
1328      sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain);
1329      if( zExplain && zExplain[0] ){
1330         fprintf(pArg->out, "%s", zExplain);
1331      }
1332      }
13341333
1335      /* If the shell is currently in ".explain" mode, gather the extra
1336      ** data required to add indents to the output.*/
1337      if( pArg && pArg->mode==MODE_Explain ){
1338        explain_data_prepare(pArg, pStmt);
1339      }
1334      /* If the shell is currently in ".explain" mode, gather the extra
1335      ** data required to add indents to the output.*/
1336      if( pArg && pArg->mode==MODE_Explain ){
1337      explain_data_prepare(pArg, pStmt);
1338      }
13401339
1341      /* perform the first step.  this will tell us if we
1342      ** have a result set or not and how wide it is.
1343      */
1344      rc = sqlite3_step(pStmt);
1345      /* if we have a result set... */
1346      if( SQLITE_ROW == rc ){
1347        /* if we have a callback... */
1348        if( xCallback ){
1349          /* allocate space for col name ptr, value ptr, and type */
1350          int nCol = sqlite3_column_count(pStmt);
1351          void *pData = sqlite3_malloc(3*nCol*sizeof(const char*) + 1);
1352          if( !pData ){
1353            rc = SQLITE_NOMEM;
1354          }else{
1355            char **azCols = (char **)pData;      /* Names of result columns */
1356            char **azVals = &azCols[nCol];       /* Results */
1357            int *aiTypes = (int *)&azVals[nCol]; /* Result types */
1358            int i, x;
1359            assert(sizeof(int) <= sizeof(char *));
1360            /* save off ptrs to column names */
1361            for(i=0; i<nCol; i++){
1362              azCols[i] = (char *)sqlite3_column_name(pStmt, i);
1363            }
1364            do{
1365              /* extract the data and data types */
1366              for(i=0; i<nCol; i++){
1367                aiTypes[i] = x = sqlite3_column_type(pStmt, i);
1368                if( x==SQLITE_BLOB && pArg && pArg->mode==MODE_Insert ){
1369                  azVals[i] = "";
1370                }else{
1371                  azVals[i] = (char*)sqlite3_column_text(pStmt, i);
1372                }
1373                if( !azVals[i] && (aiTypes[i]!=SQLITE_NULL) ){
1374                  rc = SQLITE_NOMEM;
1375                  break; /* from for */
1376                }
1377              } /* end for */
1340      /* perform the first step.  this will tell us if we
1341      ** have a result set or not and how wide it is.
1342      */
1343      rc = sqlite3_step(pStmt);
1344      /* if we have a result set... */
1345      if( SQLITE_ROW == rc ){
1346      /* if we have a callback... */
1347      if( xCallback ){
1348         /* allocate space for col name ptr, value ptr, and type */
1349         int nCol = sqlite3_column_count(pStmt);
1350         void *pData = sqlite3_malloc(3*nCol*sizeof(const char*) + 1);
1351         if( !pData ){
1352         rc = SQLITE_NOMEM;
1353         }else{
1354         char **azCols = (char **)pData;      /* Names of result columns */
1355         char **azVals = &azCols[nCol];       /* Results */
1356         int *aiTypes = (int *)&azVals[nCol]; /* Result types */
1357         int i, x;
1358         assert(sizeof(int) <= sizeof(char *));
1359         /* save off ptrs to column names */
1360         for(i=0; i<nCol; i++){
1361            azCols[i] = (char *)sqlite3_column_name(pStmt, i);
1362         }
1363         do{
1364            /* extract the data and data types */
1365            for(i=0; i<nCol; i++){
1366            aiTypes[i] = x = sqlite3_column_type(pStmt, i);
1367            if( x==SQLITE_BLOB && pArg && pArg->mode==MODE_Insert ){
1368               azVals[i] = "";
1369            }else{
1370               azVals[i] = (char*)sqlite3_column_text(pStmt, i);
1371            }
1372            if( !azVals[i] && (aiTypes[i]!=SQLITE_NULL) ){
1373               rc = SQLITE_NOMEM;
1374               break; /* from for */
1375            }
1376            } /* end for */
13781377
1379              /* if data and types extracted successfully... */
1380              if( SQLITE_ROW == rc ){
1381                /* call the supplied callback with the result row data */
1382                if( xCallback(pArg, nCol, azVals, azCols, aiTypes) ){
1383                  rc = SQLITE_ABORT;
1384                }else{
1385                  rc = sqlite3_step(pStmt);
1386                }
1387              }
1388            } while( SQLITE_ROW == rc );
1389            sqlite3_free(pData);
1390          }
1391        }else{
1392          do{
1393            rc = sqlite3_step(pStmt);
1394          } while( rc == SQLITE_ROW );
1395        }
1396      }
1378            /* if data and types extracted successfully... */
1379            if( SQLITE_ROW == rc ){
1380            /* call the supplied callback with the result row data */
1381            if( xCallback(pArg, nCol, azVals, azCols, aiTypes) ){
1382               rc = SQLITE_ABORT;
1383            }else{
1384               rc = sqlite3_step(pStmt);
1385            }
1386            }
1387         } while( SQLITE_ROW == rc );
1388         sqlite3_free(pData);
1389         }
1390      }else{
1391         do{
1392         rc = sqlite3_step(pStmt);
1393         } while( rc == SQLITE_ROW );
1394      }
1395      }
13971396
1398      explain_data_delete(pArg);
1397      explain_data_delete(pArg);
13991398
1400      /* print usage stats if stats on */
1401      if( pArg && pArg->statsOn ){
1402        display_stats(db, pArg, 0);
1403      }
1399      /* print usage stats if stats on */
1400      if( pArg && pArg->statsOn ){
1401      display_stats(db, pArg, 0);
1402      }
14041403
1405      /* Finalize the statement just executed. If this fails, save a
1406      ** copy of the error message. Otherwise, set zSql to point to the
1407      ** next statement to execute. */
1408      rc2 = sqlite3_finalize(pStmt);
1409      if( rc!=SQLITE_NOMEM ) rc = rc2;
1410      if( rc==SQLITE_OK ){
1411        zSql = zLeftover;
1412        while( IsSpace(zSql[0]) ) zSql++;
1413      }else if( pzErrMsg ){
1414        *pzErrMsg = save_err_msg(db);
1415      }
1404      /* Finalize the statement just executed. If this fails, save a
1405      ** copy of the error message. Otherwise, set zSql to point to the
1406      ** next statement to execute. */
1407      rc2 = sqlite3_finalize(pStmt);
1408      if( rc!=SQLITE_NOMEM ) rc = rc2;
1409      if( rc==SQLITE_OK ){
1410      zSql = zLeftover;
1411      while( IsSpace(zSql[0]) ) zSql++;
1412      }else if( pzErrMsg ){
1413      *pzErrMsg = save_err_msg(db);
1414      }
14161415
1417      /* clear saved stmt handle */
1418      if( pArg ){
1419        pArg->pStmt = NULL;
1420      }
1421    }
1422  } /* end while */
1416      /* clear saved stmt handle */
1417      if( pArg ){
1418      pArg->pStmt = NULL;
1419      }
1420   }
1421   } /* end while */
14231422
1424  return rc;
1423   return rc;
14251424}
14261425
14271426
r31373r31374
14321431** This routine should print text sufficient to recreate the table.
14331432*/
14341433static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){
1435  int rc;
1436  const char *zTable;
1437  const char *zType;
1438  const char *zSql;
1439  const char *zPrepStmt = 0;
1440  struct callback_data *p = (struct callback_data *)pArg;
1434   int rc;
1435   const char *zTable;
1436   const char *zType;
1437   const char *zSql;
1438   const char *zPrepStmt = 0;
1439   struct callback_data *p = (struct callback_data *)pArg;
14411440
1442  UNUSED_PARAMETER(azCol);
1443  if( nArg!=3 ) return 1;
1444  zTable = azArg[0];
1445  zType = azArg[1];
1446  zSql = azArg[2];
1447 
1448  if( strcmp(zTable, "sqlite_sequence")==0 ){
1449    zPrepStmt = "DELETE FROM sqlite_sequence;\n";
1450  }else if( sqlite3_strglob("sqlite_stat?", zTable)==0 ){
1451    fprintf(p->out, "ANALYZE sqlite_master;\n");
1452  }else if( strncmp(zTable, "sqlite_", 7)==0 ){
1453    return 0;
1454  }else if( strncmp(zSql, "CREATE VIRTUAL TABLE", 20)==0 ){
1455    char *zIns;
1456    if( !p->writableSchema ){
1457      fprintf(p->out, "PRAGMA writable_schema=ON;\n");
1458      p->writableSchema = 1;
1459    }
1460    zIns = sqlite3_mprintf(
1461       "INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"
1462       "VALUES('table','%q','%q',0,'%q');",
1463       zTable, zTable, zSql);
1464    fprintf(p->out, "%s\n", zIns);
1465    sqlite3_free(zIns);
1466    return 0;
1467  }else{
1468    fprintf(p->out, "%s;\n", zSql);
1469  }
1441   UNUSED_PARAMETER(azCol);
1442   if( nArg!=3 ) return 1;
1443   zTable = azArg[0];
1444   zType = azArg[1];
1445   zSql = azArg[2];
14701446
1471  if( strcmp(zType, "table")==0 ){
1472    sqlite3_stmt *pTableInfo = 0;
1473    char *zSelect = 0;
1474    char *zTableInfo = 0;
1475    char *zTmp = 0;
1476    int nRow = 0;
1477   
1478    zTableInfo = appendText(zTableInfo, "PRAGMA table_info(", 0);
1479    zTableInfo = appendText(zTableInfo, zTable, '"');
1480    zTableInfo = appendText(zTableInfo, ");", 0);
1447   if( strcmp(zTable, "sqlite_sequence")==0 ){
1448   zPrepStmt = "DELETE FROM sqlite_sequence;\n";
1449   }else if( sqlite3_strglob("sqlite_stat?", zTable)==0 ){
1450   fprintf(p->out, "ANALYZE sqlite_master;\n");
1451   }else if( strncmp(zTable, "sqlite_", 7)==0 ){
1452   return 0;
1453   }else if( strncmp(zSql, "CREATE VIRTUAL TABLE", 20)==0 ){
1454   char *zIns;
1455   if( !p->writableSchema ){
1456      fprintf(p->out, "PRAGMA writable_schema=ON;\n");
1457      p->writableSchema = 1;
1458   }
1459   zIns = sqlite3_mprintf(
1460      "INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"
1461      "VALUES('table','%q','%q',0,'%q');",
1462      zTable, zTable, zSql);
1463   fprintf(p->out, "%s\n", zIns);
1464   sqlite3_free(zIns);
1465   return 0;
1466   }else{
1467   fprintf(p->out, "%s;\n", zSql);
1468   }
14811469
1482    rc = sqlite3_prepare_v2(p->db, zTableInfo, -1, &pTableInfo, 0);
1483    free(zTableInfo);
1484    if( rc!=SQLITE_OK || !pTableInfo ){
1485      return 1;
1486    }
1470   if( strcmp(zType, "table")==0 ){
1471   sqlite3_stmt *pTableInfo = 0;
1472   char *zSelect = 0;
1473   char *zTableInfo = 0;
1474   char *zTmp = 0;
1475   int nRow = 0;
14871476
1488    zSelect = appendText(zSelect, "SELECT 'INSERT INTO ' || ", 0);
1489    /* Always quote the table name, even if it appears to be pure ascii,
1490    ** in case it is a keyword. Ex:  INSERT INTO "table" ... */
1491    zTmp = appendText(zTmp, zTable, '"');
1492    if( zTmp ){
1493      zSelect = appendText(zSelect, zTmp, '\'');
1494      free(zTmp);
1495    }
1496    zSelect = appendText(zSelect, " || ' VALUES(' || ", 0);
1497    rc = sqlite3_step(pTableInfo);
1498    while( rc==SQLITE_ROW ){
1499      const char *zText = (const char *)sqlite3_column_text(pTableInfo, 1);
1500      zSelect = appendText(zSelect, "quote(", 0);
1501      zSelect = appendText(zSelect, zText, '"');
1502      rc = sqlite3_step(pTableInfo);
1503      if( rc==SQLITE_ROW ){
1504        zSelect = appendText(zSelect, "), ", 0);
1505      }else{
1506        zSelect = appendText(zSelect, ") ", 0);
1507      }
1508      nRow++;
1509    }
1510    rc = sqlite3_finalize(pTableInfo);
1511    if( rc!=SQLITE_OK || nRow==0 ){
1512      free(zSelect);
1513      return 1;
1514    }
1515    zSelect = appendText(zSelect, "|| ')' FROM  ", 0);
1516    zSelect = appendText(zSelect, zTable, '"');
1477   zTableInfo = appendText(zTableInfo, "PRAGMA table_info(", 0);
1478   zTableInfo = appendText(zTableInfo, zTable, '"');
1479   zTableInfo = appendText(zTableInfo, ");", 0);
15171480
1518    rc = run_table_dump_query(p, zSelect, zPrepStmt);
1519    if( rc==SQLITE_CORRUPT ){
1520      zSelect = appendText(zSelect, " ORDER BY rowid DESC", 0);
1521      run_table_dump_query(p, zSelect, 0);
1522    }
1523    free(zSelect);
1524  }
1525  return 0;
1481   rc = sqlite3_prepare_v2(p->db, zTableInfo, -1, &pTableInfo, 0);
1482   free(zTableInfo);
1483   if( rc!=SQLITE_OK || !pTableInfo ){
1484      return 1;
1485   }
1486
1487   zSelect = appendText(zSelect, "SELECT 'INSERT INTO ' || ", 0);
1488   /* Always quote the table name, even if it appears to be pure ascii,
1489   ** in case it is a keyword. Ex:  INSERT INTO "table" ... */
1490   zTmp = appendText(zTmp, zTable, '"');
1491   if( zTmp ){
1492      zSelect = appendText(zSelect, zTmp, '\'');
1493      free(zTmp);
1494   }
1495   zSelect = appendText(zSelect, " || ' VALUES(' || ", 0);
1496   rc = sqlite3_step(pTableInfo);
1497   while( rc==SQLITE_ROW ){
1498      const char *zText = (const char *)sqlite3_column_text(pTableInfo, 1);
1499      zSelect = appendText(zSelect, "quote(", 0);
1500      zSelect = appendText(zSelect, zText, '"');
1501      rc = sqlite3_step(pTableInfo);
1502      if( rc==SQLITE_ROW ){
1503      zSelect = appendText(zSelect, "), ", 0);
1504      }else{
1505      zSelect = appendText(zSelect, ") ", 0);
1506      }
1507      nRow++;
1508   }
1509   rc = sqlite3_finalize(pTableInfo);
1510   if( rc!=SQLITE_OK || nRow==0 ){
1511      free(zSelect);
1512      return 1;
1513   }
1514   zSelect = appendText(zSelect, "|| ')' FROM  ", 0);
1515   zSelect = appendText(zSelect, zTable, '"');
1516
1517   rc = run_table_dump_query(p, zSelect, zPrepStmt);
1518   if( rc==SQLITE_CORRUPT ){
1519      zSelect = appendText(zSelect, " ORDER BY rowid DESC", 0);
1520      run_table_dump_query(p, zSelect, 0);
1521   }
1522   free(zSelect);
1523   }
1524   return 0;
15261525}
15271526
15281527/*
r31373r31374
15331532** "ORDER BY rowid DESC" to the end.
15341533*/
15351534static int run_schema_dump_query(
1536  struct callback_data *p,
1537  const char *zQuery
1535   struct callback_data *p,
1536   const char *zQuery
15381537){
1539  int rc;
1540  char *zErr = 0;
1541  rc = sqlite3_exec(p->db, zQuery, dump_callback, p, &zErr);
1542  if( rc==SQLITE_CORRUPT ){
1543    char *zQ2;
1544    int len = strlen30(zQuery);
1545    fprintf(p->out, "/****** CORRUPTION ERROR *******/\n");
1546    if( zErr ){
1547      fprintf(p->out, "/****** %s ******/\n", zErr);
1548      sqlite3_free(zErr);
1549      zErr = 0;
1550    }
1551    zQ2 = (char *)malloc( len+100 );
1552    if( zQ2==0 ) return rc;
1553    sqlite3_snprintf(len+100, zQ2, "%s ORDER BY rowid DESC", zQuery);
1554    rc = sqlite3_exec(p->db, zQ2, dump_callback, p, &zErr);
1555    if( rc ){
1556      fprintf(p->out, "/****** ERROR: %s ******/\n", zErr);
1557    }else{
1558      rc = SQLITE_CORRUPT;
1559    }
1560    sqlite3_free(zErr);
1561    free(zQ2);
1562  }
1563  return rc;
1538   int rc;
1539   char *zErr = 0;
1540   rc = sqlite3_exec(p->db, zQuery, dump_callback, p, &zErr);
1541   if( rc==SQLITE_CORRUPT ){
1542   char *zQ2;
1543   int len = strlen30(zQuery);
1544   fprintf(p->out, "/****** CORRUPTION ERROR *******/\n");
1545   if( zErr ){
1546      fprintf(p->out, "/****** %s ******/\n", zErr);
1547      sqlite3_free(zErr);
1548      zErr = 0;
1549   }
1550   zQ2 = (char *)malloc( len+100 );
1551   if( zQ2==0 ) return rc;
1552   sqlite3_snprintf(len+100, zQ2, "%s ORDER BY rowid DESC", zQuery);
1553   rc = sqlite3_exec(p->db, zQ2, dump_callback, p, &zErr);
1554   if( rc ){
1555      fprintf(p->out, "/****** ERROR: %s ******/\n", zErr);
1556   }else{
1557      rc = SQLITE_CORRUPT;
1558   }
1559   sqlite3_free(zErr);
1560   free(zQ2);
1561   }
1562   return rc;
15641563}
15651564
15661565/*
15671566** Text of a help message
15681567*/
15691568static char zHelp[] =
1570  ".backup ?DB? FILE      Backup DB (default \"main\") to FILE\n"
1571  ".bail ON|OFF           Stop after hitting an error.  Default OFF\n"
1572  ".clone NEWDB           Clone data into NEWDB from the existing database\n"
1573  ".databases             List names and files of attached databases\n"
1574  ".dump ?TABLE? ...      Dump the database in an SQL text format\n"
1575  "                         If TABLE specified, only dump tables matching\n"
1576  "                         LIKE pattern TABLE.\n"
1577  ".echo ON|OFF           Turn command echo on or off\n"
1578  ".exit                  Exit this program\n"
1579  ".explain ?ON|OFF?      Turn output mode suitable for EXPLAIN on or off.\n"
1580  "                         With no args, it turns EXPLAIN on.\n"
1581  ".header(s) ON|OFF      Turn display of headers on or off\n"
1582  ".help                  Show this message\n"
1583  ".import FILE TABLE     Import data from FILE into TABLE\n"
1584  ".indices ?TABLE?       Show names of all indices\n"
1585  "                         If TABLE specified, only show indices for tables\n"
1586  "                         matching LIKE pattern TABLE.\n"
1569   ".backup ?DB? FILE      Backup DB (default \"main\") to FILE\n"
1570   ".bail ON|OFF           Stop after hitting an error.  Default OFF\n"
1571   ".clone NEWDB           Clone data into NEWDB from the existing database\n"
1572   ".databases             List names and files of attached databases\n"
1573   ".dump ?TABLE? ...      Dump the database in an SQL text format\n"
1574   "                         If TABLE specified, only dump tables matching\n"
1575   "                         LIKE pattern TABLE.\n"
1576   ".echo ON|OFF           Turn command echo on or off\n"
1577   ".exit                  Exit this program\n"
1578   ".explain ?ON|OFF?      Turn output mode suitable for EXPLAIN on or off.\n"
1579   "                         With no args, it turns EXPLAIN on.\n"
1580   ".header(s) ON|OFF      Turn display of headers on or off\n"
1581   ".help                  Show this message\n"
1582   ".import FILE TABLE     Import data from FILE into TABLE\n"
1583   ".indices ?TABLE?       Show names of all indices\n"
1584   "                         If TABLE specified, only show indices for tables\n"
1585   "                         matching LIKE pattern TABLE.\n"
15871586#ifdef SQLITE_ENABLE_IOTRACE
1588  ".iotrace FILE          Enable I/O diagnostic logging to FILE\n"
1587   ".iotrace FILE          Enable I/O diagnostic logging to FILE\n"
15891588#endif
15901589#ifndef SQLITE_OMIT_LOAD_EXTENSION
1591  ".load FILE ?ENTRY?     Load an extension library\n"
1590   ".load FILE ?ENTRY?     Load an extension library\n"
15921591#endif
1593  ".log FILE|off          Turn logging on or off.  FILE can be stderr/stdout\n"
1594  ".mode MODE ?TABLE?     Set output mode where MODE is one of:\n"
1595  "                         csv      Comma-separated values\n"
1596  "                         column   Left-aligned columns.  (See .width)\n"
1597  "                         html     HTML <table> code\n"
1598  "                         insert   SQL insert statements for TABLE\n"
1599  "                         line     One value per line\n"
1600  "                         list     Values delimited by .separator string\n"
1601  "                         tabs     Tab-separated values\n"
1602  "                         tcl      TCL list elements\n"
1603  ".nullvalue STRING      Use STRING in place of NULL values\n"
1604  ".open ?FILENAME?       Close existing database and reopen FILENAME\n"
1605  ".output FILENAME       Send output to FILENAME\n"
1606  ".output stdout         Send output to the screen\n"
1607  ".print STRING...       Print literal STRING\n"
1608  ".prompt MAIN CONTINUE  Replace the standard prompts\n"
1609  ".quit                  Exit this program\n"
1610  ".read FILENAME         Execute SQL in FILENAME\n"
1611  ".restore ?DB? FILE     Restore content of DB (default \"main\") from FILE\n"
1612  ".save FILE             Write in-memory database into FILE\n"
1613  ".schema ?TABLE?        Show the CREATE statements\n"
1614  "                         If TABLE specified, only show tables matching\n"
1615  "                         LIKE pattern TABLE.\n"
1616  ".separator STRING      Change separator used by output mode and .import\n"
1617  ".show                  Show the current values for various settings\n"
1618  ".stats ON|OFF          Turn stats on or off\n"
1619  ".tables ?TABLE?        List names of tables\n"
1620  "                         If TABLE specified, only list tables matching\n"
1621  "                         LIKE pattern TABLE.\n"
1622  ".timeout MS            Try opening locked tables for MS milliseconds\n"
1623  ".trace FILE|off        Output each SQL statement as it is run\n"
1624  ".vfsname ?AUX?         Print the name of the VFS stack\n"
1625  ".width NUM1 NUM2 ...   Set column widths for \"column\" mode\n"
1592   ".log FILE|off          Turn logging on or off.  FILE can be stderr/stdout\n"
1593   ".mode MODE ?TABLE?     Set output mode where MODE is one of:\n"
1594   "                         csv      Comma-separated values\n"
1595   "                         column   Left-aligned columns.  (See .width)\n"
1596   "                         html     HTML <table> code\n"
1597   "                         insert   SQL insert statements for TABLE\n"
1598   "                         line     One value per line\n"
1599   "                         list     Values delimited by .separator string\n"
1600   "                         tabs     Tab-separated values\n"
1601   "                         tcl      TCL list elements\n"
1602   ".nullvalue STRING      Use STRING in place of NULL values\n"
1603   ".open ?FILENAME?       Close existing database and reopen FILENAME\n"
1604   ".output FILENAME       Send output to FILENAME\n"
1605   ".output stdout         Send output to the screen\n"
1606   ".print STRING...       Print literal STRING\n"
1607   ".prompt MAIN CONTINUE  Replace the standard prompts\n"
1608   ".quit                  Exit this program\n"
1609   ".read FILENAME         Execute SQL in FILENAME\n"
1610   ".restore ?DB? FILE     Restore content of DB (default \"main\") from FILE\n"
1611   ".save FILE             Write in-memory database into FILE\n"
1612   ".schema ?TABLE?        Show the CREATE statements\n"
1613   "                         If TABLE specified, only show tables matching\n"
1614   "                         LIKE pattern TABLE.\n"
1615   ".separator STRING      Change separator used by output mode and .import\n"
1616   ".show                  Show the current values for various settings\n"
1617   ".stats ON|OFF          Turn stats on or off\n"
1618   ".tables ?TABLE?        List names of tables\n"
1619   "                         If TABLE specified, only list tables matching\n"
1620   "                         LIKE pattern TABLE.\n"
1621   ".timeout MS            Try opening locked tables for MS milliseconds\n"
1622   ".trace FILE|off        Output each SQL statement as it is run\n"
1623   ".vfsname ?AUX?         Print the name of the VFS stack\n"
1624   ".width NUM1 NUM2 ...   Set column widths for \"column\" mode\n"
16261625;
16271626
16281627static char zTimerHelp[] =
1629  ".timer ON|OFF          Turn the CPU timer measurement on or off\n"
1628   ".timer ON|OFF          Turn the CPU timer measurement on or off\n"
16301629;
16311630
16321631/* Forward reference */
r31373r31374
16371636** the database fails to open, print an error message and exit.
16381637*/
16391638static void open_db(struct callback_data *p, int keepAlive){
1640  if( p->db==0 ){
1641    sqlite3_initialize();
1642    sqlite3_open(p->zDbFilename, &p->db);
1643    db = p->db;
1644    if( db && sqlite3_errcode(db)==SQLITE_OK ){
1645      sqlite3_create_function(db, "shellstatic", 0, SQLITE_UTF8, 0,
1646          shellstaticFunc, 0, 0);
1647    }
1648    if( db==0 || SQLITE_OK!=sqlite3_errcode(db) ){
1649      fprintf(stderr,"Error: unable to open database \"%s\": %s\n",
1650          p->zDbFilename, sqlite3_errmsg(db));
1651      if( keepAlive ) return;
1652      exit(1);
1653    }
1639   if( p->db==0 ){
1640   sqlite3_initialize();
1641   sqlite3_open(p->zDbFilename, &p->db);
1642   db = p->db;
1643   if( db && sqlite3_errcode(db)==SQLITE_OK ){
1644      sqlite3_create_function(db, "shellstatic", 0, SQLITE_UTF8, 0,
1645         shellstaticFunc, 0, 0);
1646   }
1647   if( db==0 || SQLITE_OK!=sqlite3_errcode(db) ){
1648      fprintf(stderr,"Error: unable to open database \"%s\": %s\n",
1649         p->zDbFilename, sqlite3_errmsg(db));
1650      if( keepAlive ) return;
1651      exit(1);
1652   }
16541653#ifndef SQLITE_OMIT_LOAD_EXTENSION
1655    sqlite3_enable_load_extension(p->db, 1);
1654   sqlite3_enable_load_extension(p->db, 1);
16561655#endif
1657  }
1656   }
16581657}
16591658
16601659/*
r31373r31374
16681667**    \\    -> backslash
16691668*/
16701669static void resolve_backslashes(char *z){
1671  int i, j;
1672  char c;
1673  for(i=j=0; (c = z[i])!=0; i++, j++){
1674    if( c=='\\' ){
1675      c = z[++i];
1676      if( c=='n' ){
1677        c = '\n';
1678      }else if( c=='t' ){
1679        c = '\t';
1680      }else if( c=='r' ){
1681        c = '\r';
1682      }else if( c=='\\' ){
1683        c = '\\';
1684      }else if( c>='0' && c<='7' ){
1685        c -= '0';
1686        if( z[i+1]>='0' && z[i+1]<='7' ){
1687          i++;
1688          c = (c<<3) + z[i] - '0';
1689          if( z[i+1]>='0' && z[i+1]<='7' ){
1690            i++;
1691            c = (c<<3) + z[i] - '0';
1692          }
1693        }
1694      }
1695    }
1696    z[j] = c;
1697  }
1698  z[j] = 0;
1670   int i, j;
1671   char c;
1672   for(i=j=0; (c = z[i])!=0; i++, j++){
1673   if( c=='\\' ){
1674      c = z[++i];
1675      if( c=='n' ){
1676      c = '\n';
1677      }else if( c=='t' ){
1678      c = '\t';
1679      }else if( c=='r' ){
1680      c = '\r';
1681      }else if( c=='\\' ){
1682      c = '\\';
1683      }else if( c>='0' && c<='7' ){
1684      c -= '0';
1685      if( z[i+1]>='0' && z[i+1]<='7' ){
1686         i++;
1687         c = (c<<3) + z[i] - '0';
1688         if( z[i+1]>='0' && z[i+1]<='7' ){
1689         i++;
1690         c = (c<<3) + z[i] - '0';
1691         }
1692      }
1693      }
1694   }
1695   z[j] = c;
1696   }
1697   z[j] = 0;
16991698}
17001699
17011700/*
r31373r31374
17031702** is not a hex digit.
17041703*/
17051704static int hexDigitValue(char c){
1706  if( c>='0' && c<='9' ) return c - '0';
1707  if( c>='a' && c<='f' ) return c - 'a' + 10;
1708  if( c>='A' && c<='F' ) return c - 'A' + 10;
1709  return -1;
1705   if( c>='0' && c<='9' ) return c - '0';
1706   if( c>='a' && c<='f' ) return c - 'a' + 10;
1707   if( c>='A' && c<='F' ) return c - 'A' + 10;
1708   return -1;
17101709}
17111710
17121711/*
17131712** Interpret zArg as an integer value, possibly with suffixes.
17141713*/
17151714static sqlite3_int64 integerValue(const char *zArg){
1716  sqlite3_int64 v = 0;
1717  static const struct { char *zSuffix; int iMult; } aMult[] = {
1718    { "KiB", 1024 },
1719    { "MiB", 1024*1024 },
1720    { "GiB", 1024*1024*1024 },
1721    { "KB",  1000 },
1722    { "MB",  1000000 },
1723    { "GB",  1000000000 },
1724    { "K",   1000 },
1725    { "M",   1000000 },
1726    { "G",   1000000000 },
1727  };
1728  int i;
1729  int isNeg = 0;
1730  if( zArg[0]=='-' ){
1731    isNeg = 1;
1732    zArg++;
1733  }else if( zArg[0]=='+' ){
1734    zArg++;
1735  }
1736  if( zArg[0]=='0' && zArg[1]=='x' ){
1737    int x;
1738    zArg += 2;
1739    while( (x = hexDigitValue(zArg[0]))>=0 ){
1740      v = (v<<4) + x;
1741      zArg++;
1742    }
1743  }else{
1744    while( IsDigit(zArg[0]) ){
1745      v = v*10 + zArg[0] - '0';
1746      zArg++;
1747    }
1748  }
1749  for(i=0; i<ArraySize(aMult); i++){
1750    if( sqlite3_stricmp(aMult[i].zSuffix, zArg)==0 ){
1751      v *= aMult[i].iMult;
1752      break;
1753    }
1754  }
1755  return isNeg? -v : v;
1715   sqlite3_int64 v = 0;
1716   static const struct { char *zSuffix; int iMult; } aMult[] = {
1717   { "KiB", 1024 },
1718   { "MiB", 1024*1024 },
1719   { "GiB", 1024*1024*1024 },
1720   { "KB",  1000 },
1721   { "MB",  1000000 },
1722   { "GB",  1000000000 },
1723   { "K",   1000 },
1724   { "M",   1000000 },
1725   { "G",   1000000000 },
1726   };
1727   int i;
1728   int isNeg = 0;
1729   if( zArg[0]=='-' ){
1730   isNeg = 1;
1731   zArg++;
1732   }else if( zArg[0]=='+' ){
1733   zArg++;
1734   }
1735   if( zArg[0]=='0' && zArg[1]=='x' ){
1736   int x;
1737   zArg += 2;
1738   while( (x = hexDigitValue(zArg[0]))>=0 ){
1739      v = (v<<4) + x;
1740      zArg++;
1741   }
1742   }else{
1743   while( IsDigit(zArg[0]) ){
1744      v = v*10 + zArg[0] - '0';
1745      zArg++;
1746   }
1747   }
1748   for(i=0; i<ArraySize(aMult); i++){
1749   if( sqlite3_stricmp(aMult[i].zSuffix, zArg)==0 ){
1750      v *= aMult[i].iMult;
1751      break;
1752   }
1753   }
1754   return isNeg? -v : v;
17561755}
17571756
17581757/*
r31373r31374
17601759** for TRUE and FALSE.  Return the integer value if appropriate.
17611760*/
17621761static int booleanValue(char *zArg){
1763  int i;
1764  if( zArg[0]=='0' && zArg[1]=='x' ){
1765    for(i=2; hexDigitValue(zArg[i])>=0; i++){}
1766  }else{
1767    for(i=0; zArg[i]>='0' && zArg[i]<='9'; i++){}
1768  }
1769  if( i>0 && zArg[i]==0 ) return (int)(integerValue(zArg) & 0xffffffff);
1770  if( sqlite3_stricmp(zArg, "on")==0 || sqlite3_stricmp(zArg,"yes")==0 ){
1771    return 1;
1772  }
1773  if( sqlite3_stricmp(zArg, "off")==0 || sqlite3_stricmp(zArg,"no")==0 ){
1774    return 0;
1775  }
1776  fprintf(stderr, "ERROR: Not a boolean value: \"%s\". Assuming \"no\".\n",
1777          zArg);
1778  return 0;
1762   int i;
1763   if( zArg[0]=='0' && zArg[1]=='x' ){
1764   for(i=2; hexDigitValue(zArg[i])>=0; i++){}
1765   }else{
1766   for(i=0; zArg[i]>='0' && zArg[i]<='9'; i++){}
1767   }
1768   if( i>0 && zArg[i]==0 ) return (int)(integerValue(zArg) & 0xffffffff);
1769   if( sqlite3_stricmp(zArg, "on")==0 || sqlite3_stricmp(zArg,"yes")==0 ){
1770   return 1;
1771   }
1772   if( sqlite3_stricmp(zArg, "off")==0 || sqlite3_stricmp(zArg,"no")==0 ){
1773   return 0;
1774   }
1775   fprintf(stderr, "ERROR: Not a boolean value: \"%s\". Assuming \"no\".\n",
1776         zArg);
1777   return 0;
17791778}
17801779
17811780/*
17821781** Close an output file, assuming it is not stderr or stdout
17831782*/
17841783static void output_file_close(FILE *f){
1785  if( f && f!=stdout && f!=stderr ) fclose(f);
1784   if( f && f!=stdout && f!=stderr ) fclose(f);
17861785}
17871786
17881787/*
17891788** Try to open an output file.   The names "stdout" and "stderr" are
1790** recognized and do the right thing.  NULL is returned if the output
1789** recognized and do the right thing.  NULL is returned if the output
17911790** filename is "off".
17921791*/
17931792static FILE *output_file_open(const char *zFile){
1794  FILE *f;
1795  if( strcmp(zFile,"stdout")==0 ){
1796    f = stdout;
1797  }else if( strcmp(zFile, "stderr")==0 ){
1798    f = stderr;
1799  }else if( strcmp(zFile, "off")==0 ){
1800    f = 0;
1801  }else{
1802    f = fopen(zFile, "wb");
1803    if( f==0 ){
1804      fprintf(stderr, "Error: cannot open \"%s\"\n", zFile);
1805    }
1806  }
1807  return f;
1793   FILE *f;
1794   if( strcmp(zFile,"stdout")==0 ){
1795   f = stdout;
1796   }else if( strcmp(zFile, "stderr")==0 ){
1797   f = stderr;
1798   }else if( strcmp(zFile, "off")==0 ){
1799   f = 0;
1800   }else{
1801   f = fopen(zFile, "wb");
1802   if( f==0 ){
1803      fprintf(stderr, "Error: cannot open \"%s\"\n", zFile);
1804   }
1805   }
1806   return f;
18081807}
18091808
18101809/*
18111810** A routine for handling output from sqlite3_trace().
18121811*/
18131812static void sql_trace_callback(void *pArg, const char *z){
1814  FILE *f = (FILE*)pArg;
1815  if( f ) fprintf(f, "%s\n", z);
1813   FILE *f = (FILE*)pArg;
1814   if( f ) fprintf(f, "%s\n", z);
18161815}
18171816
18181817/*
r31373r31374
18201819** a useful spot to set a debugger breakpoint.
18211820*/
18221821static void test_breakpoint(void){
1823  static int nCall = 0;
1824  nCall++;
1822   static int nCall = 0;
1823   nCall++;
18251824}
18261825
18271826/*
r31373r31374
18291828*/
18301829typedef struct CSVReader CSVReader;
18311830struct CSVReader {
1832  const char *zFile;  /* Name of the input file */
1833  FILE *in;           /* Read the CSV text from this input stream */
1834  char *z;            /* Accumulated text for a field */
1835  int n;              /* Number of bytes in z */
1836  int nAlloc;         /* Space allocated for z[] */
1837  int nLine;          /* Current line number */
1838  int cTerm;          /* Character that terminated the most recent field */
1839  int cSeparator;     /* The separator character.  (Usually ",") */
1831   const char *zFile;  /* Name of the input file */
1832   FILE *in;           /* Read the CSV text from this input stream */
1833   char *z;            /* Accumulated text for a field */
1834   int n;              /* Number of bytes in z */
1835   int nAlloc;         /* Space allocated for z[] */
1836   int nLine;          /* Current line number */
1837   int cTerm;          /* Character that terminated the most recent field */
1838   int cSeparator;     /* The separator character.  (Usually ",") */
18401839};
18411840
18421841/* Append a single byte to z[] */
18431842static void csv_append_char(CSVReader *p, int c){
1844  if( p->n+1>=p->nAlloc ){
1845    p->nAlloc += p->nAlloc + 100;
1846    p->z = (char *)sqlite3_realloc(p->z, p->nAlloc);
1847    if( p->z==0 ){
1848      fprintf(stderr, "out of memory\n");
1849      exit(1);
1850    }
1851  }
1852  p->z[p->n++] = (char)c;
1843   if( p->n+1>=p->nAlloc ){
1844   p->nAlloc += p->nAlloc + 100;
1845   p->z = (char *)sqlite3_realloc(p->z, p->nAlloc);
1846   if( p->z==0 ){
1847      fprintf(stderr, "out of memory\n");
1848      exit(1);
1849   }
1850   }
1851   p->z[p->n++] = (char)c;
18531852}
18541853
18551854/* Read a single field of CSV text.  Compatible with rfc4180 and extended
r31373r31374
18651864**   +  Report syntax errors on stderr
18661865*/
18671866static char *csv_read_one_field(CSVReader *p){
1868  int c, pc, ppc;
1869  int cSep = p->cSeparator;
1870  p->n = 0;
1871  c = fgetc(p->in);
1872  if( c==EOF || seenInterrupt ){
1873    p->cTerm = EOF;
1874    return 0;
1875  }
1876  if( c=='"' ){
1877    int startLine = p->nLine;
1878    int cQuote = c;
1879    pc = ppc = 0;
1880    while( 1 ){
1881      c = fgetc(p->in);
1882      if( c=='\n' ) p->nLine++;
1883      if( c==cQuote ){
1884        if( pc==cQuote ){
1885          pc = 0;
1886          continue;
1887        }
1888      }
1889      if( (c==cSep && pc==cQuote)
1890       || (c=='\n' && pc==cQuote)
1891       || (c=='\n' && pc=='\r' && ppc==cQuote)
1892       || (c==EOF && pc==cQuote)
1893      ){
1894        do{ p->n--; }while( p->z[p->n]!=cQuote );
1895        p->cTerm = c;
1896        break;
1897      }
1898      if( pc==cQuote && c!='\r' ){
1899        fprintf(stderr, "%s:%d: unescaped %c character\n",
1900                p->zFile, p->nLine, cQuote);
1901      }
1902      if( c==EOF ){
1903        fprintf(stderr, "%s:%d: unterminated %c-quoted field\n",
1904                p->zFile, startLine, cQuote);
1905        p->cTerm = EOF;
1906        break;
1907      }
1908      csv_append_char(p, c);
1909      ppc = pc;
1910      pc = c;
1911    }
1912  }else{
1913    while( c!=EOF && c!=cSep && c!='\n' ){
1914      csv_append_char(p, c);
1915      c = fgetc(p->in);
1916    }
1917    if( c=='\n' ){
1918      p->nLine++;
1919      if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--;
1920    }
1921    p->cTerm = c;
1922  }
1923  if( p->z ) p->z[p->n] = 0;
1924  return p->z;
1867   int c, pc, ppc;
1868   int cSep = p->cSeparator;
1869   p->n = 0;
1870   c = fgetc(p->in);
1871   if( c==EOF || seenInterrupt ){
1872   p->cTerm = EOF;
1873   return 0;
1874   }
1875   if( c=='"' ){
1876   int startLine = p->nLine;
1877   int cQuote = c;
1878   pc = ppc = 0;
1879   while( 1 ){
1880      c = fgetc(p->in);
1881      if( c=='\n' ) p->nLine++;
1882      if( c==cQuote ){
1883      if( pc==cQuote ){
1884         pc = 0;
1885         continue;
1886      }
1887      }
1888      if( (c==cSep && pc==cQuote)
1889      || (c=='\n' && pc==cQuote)
1890      || (c=='\n' && pc=='\r' && ppc==cQuote)
1891      || (c==EOF && pc==cQuote)
1892      ){
1893      do{ p->n--; }while( p->z[p->n]!=cQuote );
1894      p->cTerm = c;
1895      break;
1896      }
1897      if( pc==cQuote && c!='\r' ){
1898      fprintf(stderr, "%s:%d: unescaped %c character\n",
1899            p->zFile, p->nLine, cQuote);
1900      }
1901      if( c==EOF ){
1902      fprintf(stderr, "%s:%d: unterminated %c-quoted field\n",
1903            p->zFile, startLine, cQuote);
1904      p->cTerm = EOF;
1905      break;
1906      }
1907      csv_append_char(p, c);
1908      ppc = pc;
1909      pc = c;
1910   }
1911   }else{
1912   while( c!=EOF && c!=cSep && c!='\n' ){
1913      csv_append_char(p, c);
1914      c = fgetc(p->in);
1915   }
1916   if( c=='\n' ){
1917      p->nLine++;
1918      if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--;
1919   }
1920   p->cTerm = c;
1921   }
1922   if( p->z ) p->z[p->n] = 0;
1923   return p->z;
19251924}
19261925
19271926/*
r31373r31374
19301929** work for WITHOUT ROWID tables.
19311930*/
19321931static void tryToCloneData(
1933  struct callback_data *p,
1934  sqlite3 *newDb,
1935  const char *zTable
1932   struct callback_data *p,
1933   sqlite3 *newDb,
1934   const char *zTable
19361935){
1937  sqlite3_stmt *pQuery = 0;
1938  sqlite3_stmt *pInsert = 0;
1939  char *zQuery = 0;
1940  char *zInsert = 0;
1941  int rc;
1942  int i, j, n;
1943  int nTable = (int)strlen(zTable);
1944  int k = 0;
1945  int cnt = 0;
1946  const int spinRate = 10000;
1936   sqlite3_stmt *pQuery = 0;
1937   sqlite3_stmt *pInsert = 0;
1938   char *zQuery = 0;
1939   char *zInsert = 0;
1940   int rc;
1941   int i, j, n;
1942   int nTable = (int)strlen(zTable);
1943   int k = 0;
1944   int cnt = 0;
1945   const int spinRate = 10000;
19471946
1948  zQuery = sqlite3_mprintf("SELECT * FROM \"%w\"", zTable);
1949  rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
1950  if( rc ){
1951    fprintf(stderr, "Error %d: %s on [%s]\n",
1952            sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
1953            zQuery);
1954    goto end_data_xfer;
1955  }
1956  n = sqlite3_column_count(pQuery);
1957  zInsert = (char *)sqlite3_malloc(200 + nTable + n*3);
1958  if( zInsert==0 ){
1959    fprintf(stderr, "out of memory\n");
1960    goto end_data_xfer;
1961  }
1962  sqlite3_snprintf(200+nTable,zInsert,
1963                   "INSERT OR IGNORE INTO \"%s\" VALUES(?", zTable);
1964  i = (int)strlen(zInsert);
1965  for(j=1; j<n; j++){
1966    memcpy(zInsert+i, ",?", 2);
1967    i += 2;
1968  }
1969  memcpy(zInsert+i, ");", 3);
1970  rc = sqlite3_prepare_v2(newDb, zInsert, -1, &pInsert, 0);
1971  if( rc ){
1972    fprintf(stderr, "Error %d: %s on [%s]\n",
1973            sqlite3_extended_errcode(newDb), sqlite3_errmsg(newDb),
1974            zQuery);
1975    goto end_data_xfer;
1976  }
1977  for(k=0; k<2; k++){
1978    while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){
1979      for(i=0; i<n; i++){
1980        switch( sqlite3_column_type(pQuery, i) ){
1981          case SQLITE_NULL: {
1982            sqlite3_bind_null(pInsert, i+1);
1983            break;
1984          }
1985          case SQLITE_INTEGER: {
1986            sqlite3_bind_int64(pInsert, i+1, sqlite3_column_int64(pQuery,i));
1987            break;
1988          }
1989          case SQLITE_FLOAT: {
1990            sqlite3_bind_double(pInsert, i+1, sqlite3_column_double(pQuery,i));
1991            break;
1992          }
1993          case SQLITE_TEXT: {
1994            sqlite3_bind_text(pInsert, i+1,
1995                             (const char*)sqlite3_column_text(pQuery,i),
1996                             -1, SQLITE_STATIC);
1997            break;
1998          }
1999          case SQLITE_BLOB: {
2000            sqlite3_bind_blob(pInsert, i+1, sqlite3_column_blob(pQuery,i),
2001                                            sqlite3_column_bytes(pQuery,i),
2002                                            SQLITE_STATIC);
2003            break;
2004          }
2005        }
2006      } /* End for */
2007      rc = sqlite3_step(pInsert);
2008      if( rc!=SQLITE_OK && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){
2009        fprintf(stderr, "Error %d: %s\n", sqlite3_extended_errcode(newDb),
2010                        sqlite3_errmsg(newDb));
2011      }
2012      sqlite3_reset(pInsert);
2013      cnt++;
2014      if( (cnt%spinRate)==0 ){
2015        printf("%c\b", "|/-\\"[(cnt/spinRate)%4]);
2016        fflush(stdout);
2017      }
2018    } /* End while */
2019    if( rc==SQLITE_DONE ) break;
2020    sqlite3_finalize(pQuery);
2021    sqlite3_free(zQuery);
2022    zQuery = sqlite3_mprintf("SELECT * FROM \"%w\" ORDER BY rowid DESC;",
2023                             zTable);
2024    rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
2025    if( rc ){
2026      fprintf(stderr, "Warning: cannot step \"%s\" backwards", zTable);
2027      break;
2028    }
2029  } /* End for(k=0...) */
1947   zQuery = sqlite3_mprintf("SELECT * FROM \"%w\"", zTable);
1948   rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
1949   if( rc ){
1950   fprintf(stderr, "Error %d: %s on [%s]\n",
1951         sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
1952         zQuery);
1953   goto end_data_xfer;
1954   }
1955   n = sqlite3_column_count(pQuery);
1956   zInsert = (char *)sqlite3_malloc(200 + nTable + n*3);
1957   if( zInsert==0 ){
1958   fprintf(stderr, "out of memory\n");
1959   goto end_data_xfer;
1960   }
1961   sqlite3_snprintf(200+nTable,zInsert,
1962               "INSERT OR IGNORE INTO \"%s\" VALUES(?", zTable);
1963   i = (int)strlen(zInsert);
1964   for(j=1; j<n; j++){
1965   memcpy(zInsert+i, ",?", 2);
1966   i += 2;
1967   }
1968   memcpy(zInsert+i, ");", 3);
1969   rc = sqlite3_prepare_v2(newDb, zInsert, -1, &pInsert, 0);
1970   if( rc ){
1971   fprintf(stderr, "Error %d: %s on [%s]\n",
1972         sqlite3_extended_errcode(newDb), sqlite3_errmsg(newDb),
1973         zQuery);
1974   goto end_data_xfer;
1975   }
1976   for(k=0; k<2; k++){
1977   while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){
1978      for(i=0; i<n; i++){
1979      switch( sqlite3_column_type(pQuery, i) ){
1980         case SQLITE_NULL: {
1981         sqlite3_bind_null(pInsert, i+1);
1982         break;
1983         }
1984         case SQLITE_INTEGER: {
1985         sqlite3_bind_int64(pInsert, i+1, sqlite3_column_int64(pQuery,i));
1986         break;
1987         }
1988         case SQLITE_FLOAT: {
1989         sqlite3_bind_double(pInsert, i+1, sqlite3_column_double(pQuery,i));
1990         break;
1991         }
1992         case SQLITE_TEXT: {
1993         sqlite3_bind_text(pInsert, i+1,
1994                        (const char*)sqlite3_column_text(pQuery,i),
1995                        -1, SQLITE_STATIC);
1996         break;
1997         }
1998         case SQLITE_BLOB: {
1999         sqlite3_bind_blob(pInsert, i+1, sqlite3_column_blob(pQuery,i),
2000                                 sqlite3_column_bytes(pQuery,i),
2001                                 SQLITE_STATIC);
2002         break;
2003         }
2004      }
2005      } /* End for */
2006      rc = sqlite3_step(pInsert);
2007      if( rc!=SQLITE_OK && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){
2008      fprintf(stderr, "Error %d: %s\n", sqlite3_extended_errcode(newDb),
2009                  sqlite3_errmsg(newDb));
2010      }
2011      sqlite3_reset(pInsert);
2012      cnt++;
2013      if( (cnt%spinRate)==0 ){
2014      printf("%c\b", "|/-\\"[(cnt/spinRate)%4]);
2015      fflush(stdout);
2016      }
2017   } /* End while */
2018   if( rc==SQLITE_DONE ) break;
2019   sqlite3_finalize(pQuery);
2020   sqlite3_free(zQuery);
2021   zQuery = sqlite3_mprintf("SELECT * FROM \"%w\" ORDER BY rowid DESC;",
2022                        zTable);
2023   rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
2024   if( rc ){
2025      fprintf(stderr, "Warning: cannot step \"%s\" backwards", zTable);
2026      break;
2027   }
2028   } /* End for(k=0...) */
20302029
20312030end_data_xfer:
2032  sqlite3_finalize(pQuery);
2033  sqlite3_finalize(pInsert);
2034  sqlite3_free(zQuery);
2035  sqlite3_free(zInsert);
2031   sqlite3_finalize(pQuery);
2032   sqlite3_finalize(pInsert);
2033   sqlite3_free(zQuery);
2034   sqlite3_free(zInsert);
20362035}
20372036
20382037
r31373r31374
20432042** sqlite_master table, try again moving backwards.
20442043*/
20452044static void tryToCloneSchema(
2046  struct callback_data *p,
2047  sqlite3 *newDb,
2048  const char *zWhere,
2049  void (*xForEach)(struct callback_data*,sqlite3*,const char*)
2045   struct callback_data *p,
2046   sqlite3 *newDb,
2047   const char *zWhere,
2048   void (*xForEach)(struct callback_data*,sqlite3*,const char*)
20502049){
2051  sqlite3_stmt *pQuery = 0;
2052  char *zQuery = 0;
2053  int rc;
2054  const unsigned char *zName;
2055  const unsigned char *zSql;
2056  char *zErrMsg = 0;
2050   sqlite3_stmt *pQuery = 0;
2051   char *zQuery = 0;
2052   int rc;
2053   const unsigned char *zName;
2054   const unsigned char *zSql;
2055   char *zErrMsg = 0;
20572056
2058  zQuery = sqlite3_mprintf("SELECT name, sql FROM sqlite_master"
2059                           " WHERE %s", zWhere);
2060  rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
2061  if( rc ){
2062    fprintf(stderr, "Error: (%d) %s on [%s]\n",
2063                    sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
2064                    zQuery);
2065    goto end_schema_xfer;
2066  }
2067  while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){
2068    zName = sqlite3_column_text(pQuery, 0);
2069    zSql = sqlite3_column_text(pQuery, 1);
2070    printf("%s... ", zName); fflush(stdout);
2071    sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
2072    if( zErrMsg ){
2073      fprintf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
2074      sqlite3_free(zErrMsg);
2075      zErrMsg = 0;
2076    }
2077    if( xForEach ){
2078      xForEach(p, newDb, (const char*)zName);
2079    }
2080    printf("done\n");
2081  }
2082  if( rc!=SQLITE_DONE ){
2083    sqlite3_finalize(pQuery);
2084    sqlite3_free(zQuery);
2085    zQuery = sqlite3_mprintf("SELECT name, sql FROM sqlite_master"
2086                             " WHERE %s ORDER BY rowid DESC", zWhere);
2087    rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
2088    if( rc ){
2089      fprintf(stderr, "Error: (%d) %s on [%s]\n",
2090                      sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
2091                      zQuery);
2092      goto end_schema_xfer;
2093    }
2094    while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){
2095      zName = sqlite3_column_text(pQuery, 0);
2096      zSql = sqlite3_column_text(pQuery, 1);
2097      printf("%s... ", zName); fflush(stdout);
2098      sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
2099      if( zErrMsg ){
2100        fprintf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
2101        sqlite3_free(zErrMsg);
2102        zErrMsg = 0;
2103      }
2104      if( xForEach ){
2105        xForEach(p, newDb, (const char*)zName);
2106      }
2107      printf("done\n");
2108    }
2109  }
2057   zQuery = sqlite3_mprintf("SELECT name, sql FROM sqlite_master"
2058                     " WHERE %s", zWhere);
2059   rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
2060   if( rc ){
2061   fprintf(stderr, "Error: (%d) %s on [%s]\n",
2062               sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
2063               zQuery);
2064   goto end_schema_xfer;
2065   }
2066   while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){
2067   zName = sqlite3_column_text(pQuery, 0);
2068   zSql = sqlite3_column_text(pQuery, 1);
2069   printf("%s... ", zName); fflush(stdout);
2070   sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
2071   if( zErrMsg ){
2072      fprintf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
2073      sqlite3_free(zErrMsg);
2074      zErrMsg = 0;
2075   }
2076   if( xForEach ){
2077      xForEach(p, newDb, (const char*)zName);
2078   }
2079   printf("done\n");
2080   }
2081   if( rc!=SQLITE_DONE ){
2082   sqlite3_finalize(pQuery);
2083   sqlite3_free(zQuery);
2084   zQuery = sqlite3_mprintf("SELECT name, sql FROM sqlite_master"
2085                        " WHERE %s ORDER BY rowid DESC", zWhere);
2086   rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
2087   if( rc ){
2088      fprintf(stderr, "Error: (%d) %s on [%s]\n",
2089                  sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
2090                  zQuery);
2091      goto end_schema_xfer;
2092   }
2093   while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){
2094      zName = sqlite3_column_text(pQuery, 0);
2095      zSql = sqlite3_column_text(pQuery, 1);
2096      printf("%s... ", zName); fflush(stdout);
2097      sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
2098      if( zErrMsg ){
2099      fprintf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
2100      sqlite3_free(zErrMsg);
2101      zErrMsg = 0;
2102      }
2103      if( xForEach ){
2104      xForEach(p, newDb, (const char*)zName);
2105      }
2106      printf("done\n");
2107   }
2108   }
21102109end_schema_xfer:
2111  sqlite3_finalize(pQuery);
2112  sqlite3_free(zQuery);
2110   sqlite3_finalize(pQuery);
2111   sqlite3_free(zQuery);
21132112}
21142113
21152114/*
r31373r31374
21182117** into zNewDb.
21192118*/
21202119static void tryToClone(struct callback_data *p, const char *zNewDb){
2121  int rc;
2122  sqlite3 *newDb = 0;
2123  if( access(zNewDb,0)==0 ){
2124    fprintf(stderr, "File \"%s\" already exists.\n", zNewDb);
2125    return;
2126  }
2127  rc = sqlite3_open(zNewDb, &newDb);
2128  if( rc ){
2129    fprintf(stderr, "Cannot create output database: %s\n",
2130            sqlite3_errmsg(newDb));
2131  }else{
2132    sqlite3_exec(newDb, "BEGIN EXCLUSIVE;", 0, 0, 0);
2133    tryToCloneSchema(p, newDb, "type='table'", tryToCloneData);
2134    tryToCloneSchema(p, newDb, "type!='table'", 0);
2135    sqlite3_exec(newDb, "COMMIT;", 0, 0, 0);
2136  }
2137  sqlite3_close(newDb);
2120   int rc;
2121   sqlite3 *newDb = 0;
2122   if( access(zNewDb,0)==0 ){
2123   fprintf(stderr, "File \"%s\" already exists.\n", zNewDb);
2124   return;
2125   }
2126   rc = sqlite3_open(zNewDb, &newDb);
2127   if( rc ){
2128   fprintf(stderr, "Cannot create output database: %s\n",
2129         sqlite3_errmsg(newDb));
2130   }else{
2131   sqlite3_exec(newDb, "BEGIN EXCLUSIVE;", 0, 0, 0);
2132   tryToCloneSchema(p, newDb, "type='table'", tryToCloneData);
2133   tryToCloneSchema(p, newDb, "type!='table'", 0);
2134   sqlite3_exec(newDb, "COMMIT;", 0, 0, 0);
2135   }
2136   sqlite3_close(newDb);
21382137}
21392138
21402139/*
r31373r31374
21442143** Return 1 on error, 2 to exit, and 0 otherwise.
21452144*/
21462145static int do_meta_command(char *zLine, struct callback_data *p){
2147  int i = 1;
2148  int nArg = 0;
2149  int n, c;
2150  int rc = 0;
2151  char *azArg[50];
2146   int i = 1;
2147   int nArg = 0;
2148   int n, c;
2149   int rc = 0;
2150   char *azArg[50];
21522151
2153  /* Parse the input line into tokens.
2154  */
2155  while( zLine[i] && nArg<ArraySize(azArg) ){
2156    while( IsSpace(zLine[i]) ){ i++; }
2157    if( zLine[i]==0 ) break;
2158    if( zLine[i]=='\'' || zLine[i]=='"' ){
2159      int delim = zLine[i++];
2160      azArg[nArg++] = &zLine[i];
2161      while( zLine[i] && zLine[i]!=delim ){
2162        if( zLine[i]=='\\' && delim=='"' && zLine[i+1]!=0 ) i++;
2163        i++;
2164      }
2165      if( zLine[i]==delim ){
2166        zLine[i++] = 0;
2167      }
2168      if( delim=='"' ) resolve_backslashes(azArg[nArg-1]);
2169    }else{
2170      azArg[nArg++] = &zLine[i];
2171      while( zLine[i] && !IsSpace(zLine[i]) ){ i++; }
2172      if( zLine[i] ) zLine[i++] = 0;
2173      resolve_backslashes(azArg[nArg-1]);
2174    }
2175  }
2152   /* Parse the input line into tokens.
2153   */
2154   while( zLine[i] && nArg<ArraySize(azArg) ){
2155   while( IsSpace(zLine[i]) ){ i++; }
2156   if( zLine[i]==0 ) break;
2157   if( zLine[i]=='\'' || zLine[i]=='"' ){
2158      int delim = zLine[i++];
2159      azArg[nArg++] = &zLine[i];
2160      while( zLine[i] && zLine[i]!=delim ){
2161      if( zLine[i]=='\\' && delim=='"' && zLine[i+1]!=0 ) i++;
2162      i++;
2163      }
2164      if( zLine[i]==delim ){
2165      zLine[i++] = 0;
2166      }
2167      if( delim=='"' ) resolve_backslashes(azArg[nArg-1]);
2168   }else{
2169      azArg[nArg++] = &zLine[i];
2170      while( zLine[i] && !IsSpace(zLine[i]) ){ i++; }
2171      if( zLine[i] ) zLine[i++] = 0;
2172      resolve_backslashes(azArg[nArg-1]);
2173   }
2174   }
21762175
2177  /* Process the input line.
2178  */
2179  if( nArg==0 ) return 0; /* no tokens, no error */
2180  n = strlen30(azArg[0]);
2181  c = azArg[0][0];
2182  if( (c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0)
2183   || (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0)
2184  ){
2185    const char *zDestFile = 0;
2186    const char *zDb = 0;
2187    sqlite3 *pDest;
2188    sqlite3_backup *pBackup;
2189    int j;
2190    for(j=1; j<nArg; j++){
2191      const char *z = azArg[j];
2192      if( z[0]=='-' ){
2193        while( z[0]=='-' ) z++;
2194        /* No options to process at this time */
2195        {
2196          fprintf(stderr, "unknown option: %s\n", azArg[j]);
2197          return 1;
2198        }
2199      }else if( zDestFile==0 ){
2200        zDestFile = azArg[j];
2201      }else if( zDb==0 ){
2202        zDb = zDestFile;
2203        zDestFile = azArg[j];
2204      }else{
2205        fprintf(stderr, "too many arguments to .backup\n");
2206        return 1;
2207      }
2208    }
2209    if( zDestFile==0 ){
2210      fprintf(stderr, "missing FILENAME argument on .backup\n");
2211      return 1;
2212    }
2213    if( zDb==0 ) zDb = "main";
2214    rc = sqlite3_open(zDestFile, &pDest);
2215    if( rc!=SQLITE_OK ){
2216      fprintf(stderr, "Error: cannot open \"%s\"\n", zDestFile);
2217      sqlite3_close(pDest);
2218      return 1;
2219    }
2220    open_db(p, 0);
2221    pBackup = sqlite3_backup_init(pDest, "main", p->db, zDb);
2222    if( pBackup==0 ){
2223      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(pDest));
2224      sqlite3_close(pDest);
2225      return 1;
2226    }
2227    while(  (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK ){}
2228    sqlite3_backup_finish(pBackup);
2229    if( rc==SQLITE_DONE ){
2230      rc = 0;
2231    }else{
2232      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(pDest));
2233      rc = 1;
2234    }
2235    sqlite3_close(pDest);
2236  }else
2176   /* Process the input line.
2177   */
2178   if( nArg==0 ) return 0; /* no tokens, no error */
2179   n = strlen30(azArg[0]);
2180   c = azArg[0][0];
2181   if( (c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0)
2182   || (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0)
2183   ){
2184   const char *zDestFile = 0;
2185   const char *zDb = 0;
2186   sqlite3 *pDest;
2187   sqlite3_backup *pBackup;
2188   int j;
2189   for(j=1; j<nArg; j++){
2190      const char *z = azArg[j];
2191      if( z[0]=='-' ){
2192      while( z[0]=='-' ) z++;
2193      /* No options to process at this time */
2194      {
2195         fprintf(stderr, "unknown option: %s\n", azArg[j]);
2196         return 1;
2197      }
2198      }else if( zDestFile==0 ){
2199      zDestFile = azArg[j];
2200      }else if( zDb==0 ){
2201      zDb = zDestFile;
2202      zDestFile = azArg[j];
2203      }else{
2204      fprintf(stderr, "too many arguments to .backup\n");
2205      return 1;
2206      }
2207   }
2208   if( zDestFile==0 ){
2209      fprintf(stderr, "missing FILENAME argument on .backup\n");
2210      return 1;
2211   }
2212   if( zDb==0 ) zDb = "main";
2213   rc = sqlite3_open(zDestFile, &pDest);
2214   if( rc!=SQLITE_OK ){
2215      fprintf(stderr, "Error: cannot open \"%s\"\n", zDestFile);
2216      sqlite3_close(pDest);
2217      return 1;
2218   }
2219   open_db(p, 0);
2220   pBackup = sqlite3_backup_init(pDest, "main", p->db, zDb);
2221   if( pBackup==0 ){
2222      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(pDest));
2223      sqlite3_close(pDest);
2224      return 1;
2225   }
2226   while(  (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK ){}
2227   sqlite3_backup_finish(pBackup);
2228   if( rc==SQLITE_DONE ){
2229      rc = 0;
2230   }else{
2231      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(pDest));
2232      rc = 1;
2233   }
2234   sqlite3_close(pDest);
2235   }else
22372236
2238  if( c=='b' && n>=3 && strncmp(azArg[0], "bail", n)==0 && nArg>1 && nArg<3 ){
2239    bail_on_error = booleanValue(azArg[1]);
2240  }else
2237   if( c=='b' && n>=3 && strncmp(azArg[0], "bail", n)==0 && nArg>1 && nArg<3 ){
2238   bail_on_error = booleanValue(azArg[1]);
2239   }else
22412240
2242  /* The undocumented ".breakpoint" command causes a call to the no-op
2243  ** routine named test_breakpoint().
2244  */
2245  if( c=='b' && n>=3 && strncmp(azArg[0], "breakpoint", n)==0 ){
2246    test_breakpoint();
2247  }else
2241   /* The undocumented ".breakpoint" command causes a call to the no-op
2242   ** routine named test_breakpoint().
2243   */
2244   if( c=='b' && n>=3 && strncmp(azArg[0], "breakpoint", n)==0 ){
2245   test_breakpoint();
2246   }else
22482247
2249  if( c=='c' && strncmp(azArg[0], "clone", n)==0 && nArg>1 && nArg<3 ){
2250    tryToClone(p, azArg[1]);
2251  }else
2248   if( c=='c' && strncmp(azArg[0], "clone", n)==0 && nArg>1 && nArg<3 ){
2249   tryToClone(p, azArg[1]);
2250   }else
22522251
2253  if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 && nArg==1 ){
2254    struct callback_data data;
2255    char *zErrMsg = 0;
2256    open_db(p, 0);
2257    memcpy(&data, p, sizeof(data));
2258    data.showHeader = 1;
2259    data.mode = MODE_Column;
2260    data.colWidth[0] = 3;
2261    data.colWidth[1] = 15;
2262    data.colWidth[2] = 58;
2263    data.cnt = 0;
2264    sqlite3_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg);
2265    if( zErrMsg ){
2266      fprintf(stderr,"Error: %s\n", zErrMsg);
2267      sqlite3_free(zErrMsg);
2268      rc = 1;
2269    }
2270  }else
2252   if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 && nArg==1 ){
2253   struct callback_data data;
2254   char *zErrMsg = 0;
2255   open_db(p, 0);
2256   memcpy(&data, p, sizeof(data));
2257   data.showHeader = 1;
2258   data.mode = MODE_Column;
2259   data.colWidth[0] = 3;
2260   data.colWidth[1] = 15;
2261   data.colWidth[2] = 58;
2262   data.cnt = 0;
2263   sqlite3_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg);
2264   if( zErrMsg ){
2265      fprintf(stderr,"Error: %s\n", zErrMsg);
2266      sqlite3_free(zErrMsg);
2267      rc = 1;
2268   }
2269   }else
22712270
2272  if( c=='d' && strncmp(azArg[0], "dump", n)==0 && nArg<3 ){
2273    open_db(p, 0);
2274    /* When playing back a "dump", the content might appear in an order
2275    ** which causes immediate foreign key constraints to be violated.
2276    ** So disable foreign-key constraint enforcement to prevent problems. */
2277    fprintf(p->out, "PRAGMA foreign_keys=OFF;\n");
2278    fprintf(p->out, "BEGIN TRANSACTION;\n");
2279    p->writableSchema = 0;
2280    sqlite3_exec(p->db, "SAVEPOINT dump; PRAGMA writable_schema=ON", 0, 0, 0);
2281    p->nErr = 0;
2282    if( nArg==1 ){
2283      run_schema_dump_query(p,
2284        "SELECT name, type, sql FROM sqlite_master "
2285        "WHERE sql NOT NULL AND type=='table' AND name!='sqlite_sequence'"
2286      );
2287      run_schema_dump_query(p,
2288        "SELECT name, type, sql FROM sqlite_master "
2289        "WHERE name=='sqlite_sequence'"
2290      );
2291      run_table_dump_query(p,
2292        "SELECT sql FROM sqlite_master "
2293        "WHERE sql NOT NULL AND type IN ('index','trigger','view')", 0
2294      );
2295    }else{
2296      int i;
2297      for(i=1; i<nArg; i++){
2298        zShellStatic = azArg[i];
2299        run_schema_dump_query(p,
2300          "SELECT name, type, sql FROM sqlite_master "
2301          "WHERE tbl_name LIKE shellstatic() AND type=='table'"
2302          "  AND sql NOT NULL");
2303        run_table_dump_query(p,
2304          "SELECT sql FROM sqlite_master "
2305          "WHERE sql NOT NULL"
2306          "  AND type IN ('index','trigger','view')"
2307          "  AND tbl_name LIKE shellstatic()", 0
2308        );
2309        zShellStatic = 0;
2310      }
2311    }
2312    if( p->writableSchema ){
2313      fprintf(p->out, "PRAGMA writable_schema=OFF;\n");
2314      p->writableSchema = 0;
2315    }
2316    sqlite3_exec(p->db, "PRAGMA writable_schema=OFF;", 0, 0, 0);
2317    sqlite3_exec(p->db, "RELEASE dump;", 0, 0, 0);
2318    fprintf(p->out, p->nErr ? "ROLLBACK; -- due to errors\n" : "COMMIT;\n");
2319  }else
2271   if( c=='d' && strncmp(azArg[0], "dump", n)==0 && nArg<3 ){
2272   open_db(p, 0);
2273   /* When playing back a "dump", the content might appear in an order
2274   ** which causes immediate foreign key constraints to be violated.
2275   ** So disable foreign-key constraint enforcement to prevent problems. */
2276   fprintf(p->out, "PRAGMA foreign_keys=OFF;\n");
2277   fprintf(p->out, "BEGIN TRANSACTION;\n");
2278   p->writableSchema = 0;
2279   sqlite3_exec(p->db, "SAVEPOINT dump; PRAGMA writable_schema=ON", 0, 0, 0);
2280   p->nErr = 0;
2281   if( nArg==1 ){
2282      run_schema_dump_query(p,
2283      "SELECT name, type, sql FROM sqlite_master "
2284      "WHERE sql NOT NULL AND type=='table' AND name!='sqlite_sequence'"
2285      );
2286      run_schema_dump_query(p,
2287      "SELECT name, type, sql FROM sqlite_master "
2288      "WHERE name=='sqlite_sequence'"
2289      );
2290      run_table_dump_query(p,
2291      "SELECT sql FROM sqlite_master "
2292      "WHERE sql NOT NULL AND type IN ('index','trigger','view')", 0
2293      );
2294   }else{
2295      int i;
2296      for(i=1; i<nArg; i++){
2297      zShellStatic = azArg[i];
2298      run_schema_dump_query(p,
2299         "SELECT name, type, sql FROM sqlite_master "
2300         "WHERE tbl_name LIKE shellstatic() AND type=='table'"
2301         "  AND sql NOT NULL");
2302      run_table_dump_query(p,
2303         "SELECT sql FROM sqlite_master "
2304         "WHERE sql NOT NULL"
2305         "  AND type IN ('index','trigger','view')"
2306         "  AND tbl_name LIKE shellstatic()", 0
2307      );
2308      zShellStatic = 0;
2309      }
2310   }
2311   if( p->writableSchema ){
2312      fprintf(p->out, "PRAGMA writable_schema=OFF;\n");
2313      p->writableSchema = 0;
2314   }
2315   sqlite3_exec(p->db, "PRAGMA writable_schema=OFF;", 0, 0, 0);
2316   sqlite3_exec(p->db, "RELEASE dump;", 0, 0, 0);
2317   fprintf(p->out, p->nErr ? "ROLLBACK; -- due to errors\n" : "COMMIT;\n");
2318   }else
23202319
2321  if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){
2322    p->echoOn = booleanValue(azArg[1]);
2323  }else
2320   if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){
2321   p->echoOn = booleanValue(azArg[1]);
2322   }else
23242323
2325  if( c=='e' && strncmp(azArg[0], "eqp", n)==0 && nArg>1 && nArg<3 ){
2326    p->autoEQP = booleanValue(azArg[1]);
2327  }else
2324   if( c=='e' && strncmp(azArg[0], "eqp", n)==0 && nArg>1 && nArg<3 ){
2325   p->autoEQP = booleanValue(azArg[1]);
2326   }else
23282327
2329  if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
2330    if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
2331    rc = 2;
2332  }else
2328   if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
2329   if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
2330   rc = 2;
2331   }else
23332332
2334  if( c=='e' && strncmp(azArg[0], "explain", n)==0 && nArg<3 ){
2335    int val = nArg>=2 ? booleanValue(azArg[1]) : 1;
2336    if(val == 1) {
2337      if(!p->explainPrev.valid) {
2338        p->explainPrev.valid = 1;
2339        p->explainPrev.mode = p->mode;
2340        p->explainPrev.showHeader = p->showHeader;
2341        memcpy(p->explainPrev.colWidth,p->colWidth,sizeof(p->colWidth));
2342      }
2343      /* We could put this code under the !p->explainValid
2344      ** condition so that it does not execute if we are already in
2345      ** explain mode. However, always executing it allows us an easy
2346      ** was to reset to explain mode in case the user previously
2347      ** did an .explain followed by a .width, .mode or .header
2348      ** command.
2349      */
2350      p->mode = MODE_Explain;
2351      p->showHeader = 1;
2352      memset(p->colWidth,0,sizeof(p->colWidth));
2353      p->colWidth[0] = 4;                  /* addr */
2354      p->colWidth[1] = 13;                 /* opcode */
2355      p->colWidth[2] = 4;                  /* P1 */
2356      p->colWidth[3] = 4;                  /* P2 */
2357      p->colWidth[4] = 4;                  /* P3 */
2358      p->colWidth[5] = 13;                 /* P4 */
2359      p->colWidth[6] = 2;                  /* P5 */
2360      p->colWidth[7] = 13;                  /* Comment */
2361    }else if (p->explainPrev.valid) {
2362      p->explainPrev.valid = 0;
2363      p->mode = p->explainPrev.mode;
2364      p->showHeader = p->explainPrev.showHeader;
2365      memcpy(p->colWidth,p->explainPrev.colWidth,sizeof(p->colWidth));
2366    }
2367  }else
2333   if( c=='e' && strncmp(azArg[0], "explain", n)==0 && nArg<3 ){
2334   int val = nArg>=2 ? booleanValue(azArg[1]) : 1;
2335   if(val == 1) {
2336      if(!p->explainPrev.valid) {
2337      p->explainPrev.valid = 1;
2338      p->explainPrev.mode = p->mode;
2339      p->explainPrev.showHeader = p->showHeader;
2340      memcpy(p->explainPrev.colWidth,p->colWidth,sizeof(p->colWidth));
2341      }
2342      /* We could put this code under the !p->explainValid
2343      ** condition so that it does not execute if we are already in
2344      ** explain mode. However, always executing it allows us an easy
2345      ** was to reset to explain mode in case the user previously
2346      ** did an .explain followed by a .width, .mode or .header
2347      ** command.
2348      */
2349      p->mode = MODE_Explain;
2350      p->showHeader = 1;
2351      memset(p->colWidth,0,sizeof(p->colWidth));
2352      p->colWidth[0] = 4;                  /* addr */
2353      p->colWidth[1] = 13;                 /* opcode */
2354      p->colWidth[2] = 4;                  /* P1 */
2355      p->colWidth[3] = 4;                  /* P2 */
2356      p->colWidth[4] = 4;                  /* P3 */
2357      p->colWidth[5] = 13;                 /* P4 */
2358      p->colWidth[6] = 2;                  /* P5 */
2359      p->colWidth[7] = 13;                  /* Comment */
2360   }else if (p->explainPrev.valid) {
2361      p->explainPrev.valid = 0;
2362      p->mode = p->explainPrev.mode;
2363      p->showHeader = p->explainPrev.showHeader;
2364      memcpy(p->colWidth,p->explainPrev.colWidth,sizeof(p->colWidth));
2365   }
2366   }else
23682367
2369  if( c=='h' && (strncmp(azArg[0], "header", n)==0 ||
2370                 strncmp(azArg[0], "headers", n)==0) && nArg>1 && nArg<3 ){
2371    p->showHeader = booleanValue(azArg[1]);
2372  }else
2368   if( c=='h' && (strncmp(azArg[0], "header", n)==0 ||
2369               strncmp(azArg[0], "headers", n)==0) && nArg>1 && nArg<3 ){
2370   p->showHeader = booleanValue(azArg[1]);
2371   }else
23732372
2374  if( c=='h' && strncmp(azArg[0], "help", n)==0 ){
2375    fprintf(stderr,"%s",zHelp);
2376    if( HAS_TIMER ){
2377      fprintf(stderr,"%s",zTimerHelp);
2378    }
2379  }else
2373   if( c=='h' && strncmp(azArg[0], "help", n)==0 ){
2374   fprintf(stderr,"%s",zHelp);
2375   if( HAS_TIMER ){
2376      fprintf(stderr,"%s",zTimerHelp);
2377   }
2378   }else
23802379
2381  if( c=='i' && strncmp(azArg[0], "import", n)==0 && nArg==3 ){
2382    char *zTable = azArg[2];    /* Insert data into this table */
2383    char *zFile = azArg[1];     /* Name of file to extra content from */
2384    sqlite3_stmt *pStmt = NULL; /* A statement */
2385    int nCol;                   /* Number of columns in the table */
2386    int nByte;                  /* Number of bytes in an SQL string */
2387    int i, j;                   /* Loop counters */
2388    int needCommit;             /* True to COMMIT or ROLLBACK at end */
2389    int nSep;                   /* Number of bytes in p->separator[] */
2390    char *zSql;                 /* An SQL statement */
2391    CSVReader sCsv;             /* Reader context */
2392    int (*xCloser)(FILE*);      /* Procedure to close th3 connection */
2380   if( c=='i' && strncmp(azArg[0], "import", n)==0 && nArg==3 ){
2381   char *zTable = azArg[2];    /* Insert data into this table */
2382   char *zFile = azArg[1];     /* Name of file to extra content from */
2383   sqlite3_stmt *pStmt = NULL; /* A statement */
2384   int nCol;                   /* Number of columns in the table */
2385   int nByte;                  /* Number of bytes in an SQL string */
2386   int i, j;                   /* Loop counters */
2387   int needCommit;             /* True to COMMIT or ROLLBACK at end */
2388   int nSep;                   /* Number of bytes in p->separator[] */
2389   char *zSql;                 /* An SQL statement */
2390   CSVReader sCsv;             /* Reader context */
2391   int (*xCloser)(FILE*);      /* Procedure to close th3 connection */
23932392
2394    seenInterrupt = 0;
2395    memset(&sCsv, 0, sizeof(sCsv));
2396    open_db(p, 0);
2397    nSep = strlen30(p->separator);
2398    if( nSep==0 ){
2399      fprintf(stderr, "Error: non-null separator required for import\n");
2400      return 1;
2401    }
2402    if( nSep>1 ){
2403      fprintf(stderr, "Error: multi-character separators not allowed"
2404                      " for import\n");
2405      return 1;
2406    }
2407    sCsv.zFile = zFile;
2408    sCsv.nLine = 1;
2409    if( sCsv.zFile[0]=='|' ){
2410      sCsv.in = popen(sCsv.zFile+1, "r");
2411      sCsv.zFile = "<pipe>";
2412      xCloser = pclose;
2413    }else{
2414      sCsv.in = fopen(sCsv.zFile, "rb");
2415      xCloser = fclose;
2416    }
2417    if( sCsv.in==0 ){
2418      fprintf(stderr, "Error: cannot open \"%s\"\n", zFile);
2419      return 1;
2420    }
2421    sCsv.cSeparator = p->separator[0];
2422    zSql = sqlite3_mprintf("SELECT * FROM %s", zTable);
2423    if( zSql==0 ){
2424      fprintf(stderr, "Error: out of memory\n");
2425      xCloser(sCsv.in);
2426      return 1;
2427    }
2428    nByte = strlen30(zSql);
2429    rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
2430    if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(db))==0 ){
2431      char *zCreate = sqlite3_mprintf("CREATE TABLE %s", zTable);
2432      char cSep = '(';
2433      while( csv_read_one_field(&sCsv) ){
2434        zCreate = sqlite3_mprintf("%z%c\n  \"%s\" TEXT", zCreate, cSep, sCsv.z);
2435        cSep = ',';
2436        if( sCsv.cTerm!=sCsv.cSeparator ) break;
2437      }
2438      if( cSep=='(' ){
2439        sqlite3_free(zCreate);
2440        sqlite3_free(sCsv.z);
2441        xCloser(sCsv.in);
2442        fprintf(stderr,"%s: empty file\n", sCsv.zFile);
2443        return 1;
2444      }
2445      zCreate = sqlite3_mprintf("%z\n)", zCreate);
2446      rc = sqlite3_exec(p->db, zCreate, 0, 0, 0);
2447      sqlite3_free(zCreate);
2448      if( rc ){
2449        fprintf(stderr, "CREATE TABLE %s(...) failed: %s\n", zTable,
2450                sqlite3_errmsg(db));
2451        sqlite3_free(sCsv.z);
2452        xCloser(sCsv.in);
2453        return 1;
2454      }
2455      rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
2456    }
2457    sqlite3_free(zSql);
2458    if( rc ){
2459      if (pStmt) sqlite3_finalize(pStmt);
2460      fprintf(stderr,"Error: %s\n", sqlite3_errmsg(db));
2461      xCloser(sCsv.in);
2462      return 1;
2463    }
2464    nCol = sqlite3_column_count(pStmt);
2465    sqlite3_finalize(pStmt);
2466    pStmt = 0;
2467    if( nCol==0 ) return 0; /* no columns, no error */
2468    zSql = (char *)sqlite3_malloc( nByte*2 + 20 + nCol*2 );
2469    if( zSql==0 ){
2470      fprintf(stderr, "Error: out of memory\n");
2471      xCloser(sCsv.in);
2472      return 1;
2473    }
2474    sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable);
2475    j = strlen30(zSql);
2476    for(i=1; i<nCol; i++){
2477      zSql[j++] = ',';
2478      zSql[j++] = '?';
2479    }
2480    zSql[j++] = ')';
2481    zSql[j] = 0;
2482    rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
2483    sqlite3_free(zSql);
2484    if( rc ){
2485      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
2486      if (pStmt) sqlite3_finalize(pStmt);
2487      xCloser(sCsv.in);
2488      return 1;
2489    }
2490    needCommit = sqlite3_get_autocommit(db);
2491    if( needCommit ) sqlite3_exec(db, "BEGIN", 0, 0, 0);
2492    do{
2493      int startLine = sCsv.nLine;
2494      for(i=0; i<nCol; i++){
2495        char *z = csv_read_one_field(&sCsv);
2496        if( z==0 && i==0 ) break;
2497        sqlite3_bind_text(pStmt, i+1, z, -1, SQLITE_TRANSIENT);
2498        if( i<nCol-1 && sCsv.cTerm!=sCsv.cSeparator ){
2499          fprintf(stderr, "%s:%d: expected %d columns but found %d - "
2500                          "filling the rest with NULL\n",
2501                          sCsv.zFile, startLine, nCol, i+1);
2502          i++;
2503          while( i<nCol ){ sqlite3_bind_null(pStmt, i); i++; }
2504        }
2505      }
2506      if( sCsv.cTerm==sCsv.cSeparator ){
2507        do{
2508          csv_read_one_field(&sCsv);
2509          i++;
2510        }while( sCsv.cTerm==sCsv.cSeparator );
2511        fprintf(stderr, "%s:%d: expected %d columns but found %d - "
2512                        "extras ignored\n",
2513                        sCsv.zFile, startLine, nCol, i);
2514      }
2515      if( i>=nCol ){
2516        sqlite3_step(pStmt);
2517        rc = sqlite3_reset(pStmt);
2518        if( rc!=SQLITE_OK ){
2519          fprintf(stderr, "%s:%d: INSERT failed: %s\n", sCsv.zFile, startLine,
2520                  sqlite3_errmsg(db));
2521        }
2522      }
2523    }while( sCsv.cTerm!=EOF );
2393   seenInterrupt = 0;
2394   memset(&sCsv, 0, sizeof(sCsv));
2395   open_db(p, 0);
2396   nSep = strlen30(p->separator);
2397   if( nSep==0 ){
2398      fprintf(stderr, "Error: non-null separator required for import\n");
2399      return 1;
2400   }
2401   if( nSep>1 ){
2402      fprintf(stderr, "Error: multi-character separators not allowed"
2403                  " for import\n");
2404      return 1;
2405   }
2406   sCsv.zFile = zFile;
2407   sCsv.nLine = 1;
2408   if( sCsv.zFile[0]=='|' ){
2409      sCsv.in = popen(sCsv.zFile+1, "r");
2410      sCsv.zFile = "<pipe>";
2411      xCloser = pclose;
2412   }else{
2413      sCsv.in = fopen(sCsv.zFile, "rb");
2414      xCloser = fclose;
2415   }
2416   if( sCsv.in==0 ){
2417      fprintf(stderr, "Error: cannot open \"%s\"\n", zFile);
2418      return 1;
2419   }
2420   sCsv.cSeparator = p->separator[0];
2421   zSql = sqlite3_mprintf("SELECT * FROM %s", zTable);
2422   if( zSql==0 ){
2423      fprintf(stderr, "Error: out of memory\n");
2424      xCloser(sCsv.in);
2425      return 1;
2426   }
2427   nByte = strlen30(zSql);
2428   rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
2429   if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(db))==0 ){
2430      char *zCreate = sqlite3_mprintf("CREATE TABLE %s", zTable);
2431      char cSep = '(';
2432      while( csv_read_one_field(&sCsv) ){
2433      zCreate = sqlite3_mprintf("%z%c\n  \"%s\" TEXT", zCreate, cSep, sCsv.z);
2434      cSep = ',';
2435      if( sCsv.cTerm!=sCsv.cSeparator ) break;
2436      }
2437      if( cSep=='(' ){
2438      sqlite3_free(zCreate);
2439      sqlite3_free(sCsv.z);
2440      xCloser(sCsv.in);
2441      fprintf(stderr,"%s: empty file\n", sCsv.zFile);
2442      return 1;
2443      }
2444      zCreate = sqlite3_mprintf("%z\n)", zCreate);
2445      rc = sqlite3_exec(p->db, zCreate, 0, 0, 0);
2446      sqlite3_free(zCreate);
2447      if( rc ){
2448      fprintf(stderr, "CREATE TABLE %s(...) failed: %s\n", zTable,
2449            sqlite3_errmsg(db));
2450      sqlite3_free(sCsv.z);
2451      xCloser(sCsv.in);
2452      return 1;
2453      }
2454      rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
2455   }
2456   sqlite3_free(zSql);
2457   if( rc ){
2458      if (pStmt) sqlite3_finalize(pStmt);
2459      fprintf(stderr,"Error: %s\n", sqlite3_errmsg(db));
2460      xCloser(sCsv.in);
2461      return 1;
2462   }
2463   nCol = sqlite3_column_count(pStmt);
2464   sqlite3_finalize(pStmt);
2465   pStmt = 0;
2466   if( nCol==0 ) return 0; /* no columns, no error */
2467   zSql = (char *)sqlite3_malloc( nByte*2 + 20 + nCol*2 );
2468   if( zSql==0 ){
2469      fprintf(stderr, "Error: out of memory\n");
2470      xCloser(sCsv.in);
2471      return 1;
2472   }
2473   sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable);
2474   j = strlen30(zSql);
2475   for(i=1; i<nCol; i++){
2476      zSql[j++] = ',';
2477      zSql[j++] = '?';
2478   }
2479   zSql[j++] = ')';
2480   zSql[j] = 0;
2481   rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
2482   sqlite3_free(zSql);
2483   if( rc ){
2484      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
2485      if (pStmt) sqlite3_finalize(pStmt);
2486      xCloser(sCsv.in);
2487      return 1;
2488   }
2489   needCommit = sqlite3_get_autocommit(db);
2490   if( needCommit ) sqlite3_exec(db, "BEGIN", 0, 0, 0);
2491   do{
2492      int startLine = sCsv.nLine;
2493      for(i=0; i<nCol; i++){
2494      char *z = csv_read_one_field(&sCsv);
2495      if( z==0 && i==0 ) break;
2496      sqlite3_bind_text(pStmt, i+1, z, -1, SQLITE_TRANSIENT);
2497      if( i<nCol-1 && sCsv.cTerm!=sCsv.cSeparator ){
2498         fprintf(stderr, "%s:%d: expected %d columns but found %d - "
2499                     "filling the rest with NULL\n",
2500                     sCsv.zFile, startLine, nCol, i+1);
2501         i++;
2502         while( i<nCol ){ sqlite3_bind_null(pStmt, i); i++; }
2503      }
2504      }
2505      if( sCsv.cTerm==sCsv.cSeparator ){
2506      do{
2507         csv_read_one_field(&sCsv);
2508         i++;
2509      }while( sCsv.cTerm==sCsv.cSeparator );
2510      fprintf(stderr, "%s:%d: expected %d columns but found %d - "
2511                  "extras ignored\n",
2512                  sCsv.zFile, startLine, nCol, i);
2513      }
2514      if( i>=nCol ){
2515      sqlite3_step(pStmt);
2516      rc = sqlite3_reset(pStmt);
2517      if( rc!=SQLITE_OK ){
2518         fprintf(stderr, "%s:%d: INSERT failed: %s\n", sCsv.zFile, startLine,
2519               sqlite3_errmsg(db));
2520      }
2521      }
2522   }while( sCsv.cTerm!=EOF );
25242523
2525    xCloser(sCsv.in);
2526    sqlite3_free(sCsv.z);
2527    sqlite3_finalize(pStmt);
2528    if( needCommit ) sqlite3_exec(db, "COMMIT", 0, 0, 0);
2529  }else
2524   xCloser(sCsv.in);
2525   sqlite3_free(sCsv.z);
2526   sqlite3_finalize(pStmt);
2527   if( needCommit ) sqlite3_exec(db, "COMMIT", 0, 0, 0);
2528   }else
25302529
2531  if( c=='i' && strncmp(azArg[0], "indices", n)==0 && nArg<3 ){
2532    struct callback_data data;
2533    char *zErrMsg = 0;
2534    open_db(p, 0);
2535    memcpy(&data, p, sizeof(data));
2536    data.showHeader = 0;
2537    data.mode = MODE_List;
2538    if( nArg==1 ){
2539      rc = sqlite3_exec(p->db,
2540        "SELECT name FROM sqlite_master "
2541        "WHERE type='index' AND name NOT LIKE 'sqlite_%' "
2542        "UNION ALL "
2543        "SELECT name FROM sqlite_temp_master "
2544        "WHERE type='index' "
2545        "ORDER BY 1",
2546        callback, &data, &zErrMsg
2547      );
2548    }else{
2549      zShellStatic = azArg[1];
2550      rc = sqlite3_exec(p->db,
2551        "SELECT name FROM sqlite_master "
2552        "WHERE type='index' AND tbl_name LIKE shellstatic() "
2553        "UNION ALL "
2554        "SELECT name FROM sqlite_temp_master "
2555        "WHERE type='index' AND tbl_name LIKE shellstatic() "
2556        "ORDER BY 1",
2557        callback, &data, &zErrMsg
2558      );
2559      zShellStatic = 0;
2560    }
2561    if( zErrMsg ){
2562      fprintf(stderr,"Error: %s\n", zErrMsg);
2563      sqlite3_free(zErrMsg);
2564      rc = 1;
2565    }else if( rc != SQLITE_OK ){
2566      fprintf(stderr,"Error: querying sqlite_master and sqlite_temp_master\n");
2567      rc = 1;
2568    }
2569  }else
2530   if( c=='i' && strncmp(azArg[0], "indices", n)==0 && nArg<3 ){
2531   struct callback_data data;
2532   char *zErrMsg = 0;
2533   open_db(p, 0);
2534   memcpy(&data, p, sizeof(data));
2535   data.showHeader = 0;
2536   data.mode = MODE_List;
2537   if( nArg==1 ){
2538      rc = sqlite3_exec(p->db,
2539      "SELECT name FROM sqlite_master "
2540      "WHERE type='index' AND name NOT LIKE 'sqlite_%' "
2541      "UNION ALL "
2542      "SELECT name FROM sqlite_temp_master "
2543      "WHERE type='index' "
2544      "ORDER BY 1",
2545      callback, &data, &zErrMsg
2546      );
2547   }else{
2548      zShellStatic = azArg[1];
2549      rc = sqlite3_exec(p->db,
2550      "SELECT name FROM sqlite_master "
2551      "WHERE type='index' AND tbl_name LIKE shellstatic() "
2552      "UNION ALL "
2553      "SELECT name FROM sqlite_temp_master "
2554      "WHERE type='index' AND tbl_name LIKE shellstatic() "
2555      "ORDER BY 1",
2556      callback, &data, &zErrMsg
2557      );
2558      zShellStatic = 0;
2559   }
2560   if( zErrMsg ){
2561      fprintf(stderr,"Error: %s\n", zErrMsg);
2562      sqlite3_free(zErrMsg);
2563      rc = 1;
2564   }else if( rc != SQLITE_OK ){
2565      fprintf(stderr,"Error: querying sqlite_master and sqlite_temp_master\n");
2566      rc = 1;
2567   }
2568   }else
25702569
25712570#ifdef SQLITE_ENABLE_IOTRACE
2572  if( c=='i' && strncmp(azArg[0], "iotrace", n)==0 ){
2573    extern void (*sqlite3IoTrace)(const char*, ...);
2574    if( iotrace && iotrace!=stdout ) fclose(iotrace);
2575    iotrace = 0;
2576    if( nArg<2 ){
2577      sqlite3IoTrace = 0;
2578    }else if( strcmp(azArg[1], "-")==0 ){
2579      sqlite3IoTrace = iotracePrintf;
2580      iotrace = stdout;
2581    }else{
2582      iotrace = fopen(azArg[1], "w");
2583      if( iotrace==0 ){
2584        fprintf(stderr, "Error: cannot open \"%s\"\n", azArg[1]);
2585        sqlite3IoTrace = 0;
2586        rc = 1;
2587      }else{
2588        sqlite3IoTrace = iotracePrintf;
2589      }
2590    }
2591  }else
2571   if( c=='i' && strncmp(azArg[0], "iotrace", n)==0 ){
2572   extern void (*sqlite3IoTrace)(const char*, ...);
2573   if( iotrace && iotrace!=stdout ) fclose(iotrace);
2574   iotrace = 0;
2575   if( nArg<2 ){
2576      sqlite3IoTrace = 0;
2577   }else if( strcmp(azArg[1], "-")==0 ){
2578      sqlite3IoTrace = iotracePrintf;
2579      iotrace = stdout;
2580   }else{
2581      iotrace = fopen(azArg[1], "w");
2582      if( iotrace==0 ){
2583      fprintf(stderr, "Error: cannot open \"%s\"\n", azArg[1]);
2584      sqlite3IoTrace = 0;
2585      rc = 1;
2586      }else{
2587      sqlite3IoTrace = iotracePrintf;
2588      }
2589   }
2590   }else
25922591#endif
25932592
25942593#ifndef SQLITE_OMIT_LOAD_EXTENSION
2595  if( c=='l' && strncmp(azArg[0], "load", n)==0 && nArg>=2 ){
2596    const char *zFile, *zProc;
2597    char *zErrMsg = 0;
2598    zFile = azArg[1];
2599    zProc = nArg>=3 ? azArg[2] : 0;
2600    open_db(p, 0);
2601    rc = sqlite3_load_extension(p->db, zFile, zProc, &zErrMsg);
2602    if( rc!=SQLITE_OK ){
2603      fprintf(stderr, "Error: %s\n", zErrMsg);
2604      sqlite3_free(zErrMsg);
2605      rc = 1;
2606    }
2607  }else
2594   if( c=='l' && strncmp(azArg[0], "load", n)==0 && nArg>=2 ){
2595   const char *zFile, *zProc;
2596   char *zErrMsg = 0;
2597   zFile = azArg[1];
2598   zProc = nArg>=3 ? azArg[2] : 0;
2599   open_db(p, 0);
2600   rc = sqlite3_load_extension(p->db, zFile, zProc, &zErrMsg);
2601   if( rc!=SQLITE_OK ){
2602      fprintf(stderr, "Error: %s\n", zErrMsg);
2603      sqlite3_free(zErrMsg);
2604      rc = 1;
2605   }
2606   }else
26082607#endif
26092608
2610  if( c=='l' && strncmp(azArg[0], "log", n)==0 && nArg>=2 ){
2611    const char *zFile = azArg[1];
2612    output_file_close(p->pLog);
2613    p->pLog = output_file_open(zFile);
2614  }else
2609   if( c=='l' && strncmp(azArg[0], "log", n)==0 && nArg>=2 ){
2610   const char *zFile = azArg[1];
2611   output_file_close(p->pLog);
2612   p->pLog = output_file_open(zFile);
2613   }else
26152614
2616  if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg==2 ){
2617    int n2 = strlen30(azArg[1]);
2618    if( (n2==4 && strncmp(azArg[1],"line",n2)==0)
2619        ||
2620        (n2==5 && strncmp(azArg[1],"lines",n2)==0) ){
2621      p->mode = MODE_Line;
2622    }else if( (n2==6 && strncmp(azArg[1],"column",n2)==0)
2623              ||
2624              (n2==7 && strncmp(azArg[1],"columns",n2)==0) ){
2625      p->mode = MODE_Column;
2626    }else if( n2==4 && strncmp(azArg[1],"list",n2)==0 ){
2627      p->mode = MODE_List;
2628    }else if( n2==4 && strncmp(azArg[1],"html",n2)==0 ){
2629      p->mode = MODE_Html;
2630    }else if( n2==3 && strncmp(azArg[1],"tcl",n2)==0 ){
2631      p->mode = MODE_Tcl;
2632      sqlite3_snprintf(sizeof(p->separator), p->separator, " ");
2633    }else if( n2==3 && strncmp(azArg[1],"csv",n2)==0 ){
2634      p->mode = MODE_Csv;
2635      sqlite3_snprintf(sizeof(p->separator), p->separator, ",");
2636    }else if( n2==4 && strncmp(azArg[1],"tabs",n2)==0 ){
2637      p->mode = MODE_List;
2638      sqlite3_snprintf(sizeof(p->separator), p->separator, "\t");
2639    }else if( n2==6 && strncmp(azArg[1],"insert",n2)==0 ){
2640      p->mode = MODE_Insert;
2641      set_table_name(p, "table");
2642    }else {
2643      fprintf(stderr,"Error: mode should be one of: "
2644         "column csv html insert line list tabs tcl\n");
2645      rc = 1;
2646    }
2647  }else
2615   if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg==2 ){
2616   int n2 = strlen30(azArg[1]);
2617   if( (n2==4 && strncmp(azArg[1],"line",n2)==0)
2618      ||
2619      (n2==5 && strncmp(azArg[1],"lines",n2)==0) ){
2620      p->mode = MODE_Line;
2621   }else if( (n2==6 && strncmp(azArg[1],"column",n2)==0)
2622            ||
2623            (n2==7 && strncmp(azArg[1],"columns",n2)==0) ){
2624      p->mode = MODE_Column;
2625   }else if( n2==4 && strncmp(azArg[1],"list",n2)==0 ){
2626      p->mode = MODE_List;
2627   }else if( n2==4 && strncmp(azArg[1],"html",n2)==0 ){
2628      p->mode = MODE_Html;
2629   }else if( n2==3 && strncmp(azArg[1],"tcl",n2)==0 ){
2630      p->mode = MODE_Tcl;
2631      sqlite3_snprintf(sizeof(p->separator), p->separator, " ");
2632   }else if( n2==3 && strncmp(azArg[1],"csv",n2)==0 ){
2633      p->mode = MODE_Csv;
2634      sqlite3_snprintf(sizeof(p->separator), p->separator, ",");
2635   }else if( n2==4 && strncmp(azArg[1],"tabs",n2)==0 ){
2636      p->mode = MODE_List;
2637      sqlite3_snprintf(sizeof(p->separator), p->separator, "\t");
2638   }else if( n2==6 && strncmp(azArg[1],"insert",n2)==0 ){
2639      p->mode = MODE_Insert;
2640      set_table_name(p, "table");
2641   }else {
2642      fprintf(stderr,"Error: mode should be one of: "
2643         "column csv html insert line list tabs tcl\n");
2644      rc = 1;
2645   }
2646   }else
26482647
2649  if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg==3 ){
2650    int n2 = strlen30(azArg[1]);
2651    if( n2==6 && strncmp(azArg[1],"insert",n2)==0 ){
2652      p->mode = MODE_Insert;
2653      set_table_name(p, azArg[2]);
2654    }else {
2655      fprintf(stderr, "Error: invalid arguments: "
2656        " \"%s\". Enter \".help\" for help\n", azArg[2]);
2657      rc = 1;
2658    }
2659  }else
2648   if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg==3 ){
2649   int n2 = strlen30(azArg[1]);
2650   if( n2==6 && strncmp(azArg[1],"insert",n2)==0 ){
2651      p->mode = MODE_Insert;
2652      set_table_name(p, azArg[2]);
2653   }else {
2654      fprintf(stderr, "Error: invalid arguments: "
2655      " \"%s\". Enter \".help\" for help\n", azArg[2]);
2656      rc = 1;
2657   }
2658   }else
26602659
2661  if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 && nArg==2 ) {
2662    sqlite3_snprintf(sizeof(p->nullvalue), p->nullvalue,
2663                     "%.*s", (int)ArraySize(p->nullvalue)-1, azArg[1]);
2664  }else
2660   if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 && nArg==2 ) {
2661   sqlite3_snprintf(sizeof(p->nullvalue), p->nullvalue,
2662                  "%.*s", (int)ArraySize(p->nullvalue)-1, azArg[1]);
2663   }else
26652664
2666  if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
2667    sqlite3 *savedDb = p->db;
2668    const char *zSavedFilename = p->zDbFilename;
2669    char *zNewFilename = 0;
2670    p->db = 0;
2671    if( nArg>=2 ){
2672      p->zDbFilename = zNewFilename = sqlite3_mprintf("%s", azArg[1]);
2673    }
2674    open_db(p, 1);
2675    if( p->db!=0 ){
2676      sqlite3_close(savedDb);
2677      sqlite3_free(p->zFreeOnClose);
2678      p->zFreeOnClose = zNewFilename;
2679    }else{
2680      sqlite3_free(zNewFilename);
2681      p->db = savedDb;
2682      p->zDbFilename = zSavedFilename;
2683    }
2684  }else
2665   if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
2666   sqlite3 *savedDb = p->db;
2667   const char *zSavedFilename = p->zDbFilename;
2668   char *zNewFilename = 0;
2669   p->db = 0;
2670   if( nArg>=2 ){
2671      p->zDbFilename = zNewFilename = sqlite3_mprintf("%s", azArg[1]);
2672   }
2673   open_db(p, 1);
2674   if( p->db!=0 ){
2675      sqlite3_close(savedDb);
2676      sqlite3_free(p->zFreeOnClose);
2677      p->zFreeOnClose = zNewFilename;
2678   }else{
2679      sqlite3_free(zNewFilename);
2680      p->db = savedDb;
2681      p->zDbFilename = zSavedFilename;
2682   }
2683   }else
26852684
2686  if( c=='o' && strncmp(azArg[0], "output", n)==0 && nArg==2 ){
2687    if( p->outfile[0]=='|' ){
2688      pclose(p->out);
2689    }else{
2690      output_file_close(p->out);
2691    }
2692    p->outfile[0] = 0;
2693    if( azArg[1][0]=='|' ){
2694      p->out = popen(&azArg[1][1], "w");
2695      if( p->out==0 ){
2696        fprintf(stderr,"Error: cannot open pipe \"%s\"\n", &azArg[1][1]);
2697        p->out = stdout;
2698        rc = 1;
2699      }else{
2700        sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", azArg[1]);
2701      }
2702    }else{
2703      p->out = output_file_open(azArg[1]);
2704      if( p->out==0 ){
2705        if( strcmp(azArg[1],"off")!=0 ){
2706          fprintf(stderr,"Error: cannot write to \"%s\"\n", azArg[1]);
2707        }
2708        p->out = stdout;
2709        rc = 1;
2710      } else {
2711        sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", azArg[1]);
2712      }
2713    }
2714  }else
2685   if( c=='o' && strncmp(azArg[0], "output", n)==0 && nArg==2 ){
2686   if( p->outfile[0]=='|' ){
2687      pclose(p->out);
2688   }else{
2689      output_file_close(p->out);
2690   }
2691   p->outfile[0] = 0;
2692   if( azArg[1][0]=='|' ){
2693      p->out = popen(&azArg[1][1], "w");
2694      if( p->out==0 ){
2695      fprintf(stderr,"Error: cannot open pipe \"%s\"\n", &azArg[1][1]);
2696      p->out = stdout;
2697      rc = 1;
2698      }else{
2699      sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", azArg[1]);
2700      }
2701   }else{
2702      p->out = output_file_open(azArg[1]);
2703      if( p->out==0 ){
2704      if( strcmp(azArg[1],"off")!=0 ){
2705         fprintf(stderr,"Error: cannot write to \"%s\"\n", azArg[1]);
2706      }
2707      p->out = stdout;
2708      rc = 1;
2709      } else {
2710      sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", azArg[1]);
2711      }
2712   }
2713   }else
27152714
2716  if( c=='p' && n>=3 && strncmp(azArg[0], "print", n)==0 ){
2717    int i;
2718    for(i=1; i<nArg; i++){
2719      if( i>1 ) fprintf(p->out, " ");
2720      fprintf(p->out, "%s", azArg[i]);
2721    }
2722    fprintf(p->out, "\n");
2723  }else
2715   if( c=='p' && n>=3 && strncmp(azArg[0], "print", n)==0 ){
2716   int i;
2717   for(i=1; i<nArg; i++){
2718      if( i>1 ) fprintf(p->out, " ");
2719      fprintf(p->out, "%s", azArg[i]);
2720   }
2721   fprintf(p->out, "\n");
2722   }else
27242723
2725  if( c=='p' && strncmp(azArg[0], "prompt", n)==0 && (nArg==2 || nArg==3)){
2726    if( nArg >= 2) {
2727      strncpy(mainPrompt,azArg[1],(int)ArraySize(mainPrompt)-1);
2728    }
2729    if( nArg >= 3) {
2730      strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1);
2731    }
2732  }else
2724   if( c=='p' && strncmp(azArg[0], "prompt", n)==0 && (nArg==2 || nArg==3)){
2725   if( nArg >= 2) {
2726      strncpy(mainPrompt,azArg[1],(int)ArraySize(mainPrompt)-1);
2727   }
2728   if( nArg >= 3) {
2729      strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1);
2730   }
2731   }else
27332732
2734  if( c=='q' && strncmp(azArg[0], "quit", n)==0 && nArg==1 ){
2735    rc = 2;
2736  }else
2733   if( c=='q' && strncmp(azArg[0], "quit", n)==0 && nArg==1 ){
2734   rc = 2;
2735   }else
27372736
2738  if( c=='r' && n>=3 && strncmp(azArg[0], "read", n)==0 && nArg==2 ){
2739    FILE *alt = fopen(azArg[1], "rb");
2740    if( alt==0 ){
2741      fprintf(stderr,"Error: cannot open \"%s\"\n", azArg[1]);
2742      rc = 1;
2743    }else{
2744      rc = process_input(p, alt);
2745      fclose(alt);
2746    }
2747  }else
2737   if( c=='r' && n>=3 && strncmp(azArg[0], "read", n)==0 && nArg==2 ){
2738   FILE *alt = fopen(azArg[1], "rb");
2739   if( alt==0 ){
2740      fprintf(stderr,"Error: cannot open \"%s\"\n", azArg[1]);
2741      rc = 1;
2742   }else{
2743      rc = process_input(p, alt);
2744      fclose(alt);
2745   }
2746   }else
27482747
2749  if( c=='r' && n>=3 && strncmp(azArg[0], "restore", n)==0 && nArg>1 && nArg<4){
2750    const char *zSrcFile;
2751    const char *zDb;
2752    sqlite3 *pSrc;
2753    sqlite3_backup *pBackup;
2754    int nTimeout = 0;
2748   if( c=='r' && n>=3 && strncmp(azArg[0], "restore", n)==0 && nArg>1 && nArg<4){
2749   const char *zSrcFile;
2750   const char *zDb;
2751   sqlite3 *pSrc;
2752   sqlite3_backup *pBackup;
2753   int nTimeout = 0;
27552754
2756    if( nArg==2 ){
2757      zSrcFile = azArg[1];
2758      zDb = "main";
2759    }else{
2760      zSrcFile = azArg[2];
2761      zDb = azArg[1];
2762    }
2763    rc = sqlite3_open(zSrcFile, &pSrc);
2764    if( rc!=SQLITE_OK ){
2765      fprintf(stderr, "Error: cannot open \"%s\"\n", zSrcFile);
2766      sqlite3_close(pSrc);
2767      return 1;
2768    }
2769    open_db(p, 0);
2770    pBackup = sqlite3_backup_init(p->db, zDb, pSrc, "main");
2771    if( pBackup==0 ){
2772      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
2773      sqlite3_close(pSrc);
2774      return 1;
2775    }
2776    while( (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK
2777          || rc==SQLITE_BUSY  ){
2778      if( rc==SQLITE_BUSY ){
2779        if( nTimeout++ >= 3 ) break;
2780        sqlite3_sleep(100);
2781      }
2782    }
2783    sqlite3_backup_finish(pBackup);
2784    if( rc==SQLITE_DONE ){
2785      rc = 0;
2786    }else if( rc==SQLITE_BUSY || rc==SQLITE_LOCKED ){
2787      fprintf(stderr, "Error: source database is busy\n");
2788      rc = 1;
2789    }else{
2790      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
2791      rc = 1;
2792    }
2793    sqlite3_close(pSrc);
2794  }else
2755   if( nArg==2 ){
2756      zSrcFile = azArg[1];
2757      zDb = "main";
2758   }else{
2759      zSrcFile = azArg[2];
2760      zDb = azArg[1];
2761   }
2762   rc = sqlite3_open(zSrcFile, &pSrc);
2763   if( rc!=SQLITE_OK ){
2764      fprintf(stderr, "Error: cannot open \"%s\"\n", zSrcFile);
2765      sqlite3_close(pSrc);
2766      return 1;
2767   }
2768   open_db(p, 0);
2769   pBackup = sqlite3_backup_init(p->db, zDb, pSrc, "main");
2770   if( pBackup==0 ){
2771      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
2772      sqlite3_close(pSrc);
2773      return 1;
2774   }
2775   while( (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK
2776         || rc==SQLITE_BUSY  ){
2777      if( rc==SQLITE_BUSY ){
2778      if( nTimeout++ >= 3 ) break;
2779      sqlite3_sleep(100);
2780      }
2781   }
2782   sqlite3_backup_finish(pBackup);
2783   if( rc==SQLITE_DONE ){
2784      rc = 0;
2785   }else if( rc==SQLITE_BUSY || rc==SQLITE_LOCKED ){
2786      fprintf(stderr, "Error: source database is busy\n");
2787      rc = 1;
2788   }else{
2789      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
2790      rc = 1;
2791   }
2792   sqlite3_close(pSrc);
2793   }else
27952794
2796  if( c=='s' && strncmp(azArg[0], "schema", n)==0 && nArg<3 ){
2797    struct callback_data data;
2798    char *zErrMsg = 0;
2799    open_db(p, 0);
2800    memcpy(&data, p, sizeof(data));
2801    data.showHeader = 0;
2802    data.mode = MODE_Semi;
2803    if( nArg>1 ){
2804      int i;
2805      for(i=0; azArg[1][i]; i++) azArg[1][i] = ToLower(azArg[1][i]);
2806      if( strcmp(azArg[1],"sqlite_master")==0 ){
2807        char *new_argv[2], *new_colv[2];
2808        new_argv[0] = "CREATE TABLE sqlite_master (\n"
2809                      "  type text,\n"
2810                      "  name text,\n"
2811                      "  tbl_name text,\n"
2812                      "  rootpage integer,\n"
2813                      "  sql text\n"
2814                      ")";
2815        new_argv[1] = 0;
2816        new_colv[0] = "sql";
2817        new_colv[1] = 0;
2818        callback(&data, 1, new_argv, new_colv);
2819        rc = SQLITE_OK;
2820      }else if( strcmp(azArg[1],"sqlite_temp_master")==0 ){
2821        char *new_argv[2], *new_colv[2];
2822        new_argv[0] = "CREATE TEMP TABLE sqlite_temp_master (\n"
2823                      "  type text,\n"
2824                      "  name text,\n"
2825                      "  tbl_name text,\n"
2826                      "  rootpage integer,\n"
2827                      "  sql text\n"
2828                      ")";
2829        new_argv[1] = 0;
2830        new_colv[0] = "sql";
2831        new_colv[1] = 0;
2832        callback(&data, 1, new_argv, new_colv);
2833        rc = SQLITE_OK;
2834      }else{
2835        zShellStatic = azArg[1];
2836        rc = sqlite3_exec(p->db,
2837          "SELECT sql FROM "
2838          "  (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
2839          "     FROM sqlite_master UNION ALL"
2840          "   SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
2841          "WHERE lower(tbl_name) LIKE shellstatic()"
2842          "  AND type!='meta' AND sql NOTNULL "
2843          "ORDER BY rowid",
2844          callback, &data, &zErrMsg);
2845        zShellStatic = 0;
2846      }
2847    }else{
2848      rc = sqlite3_exec(p->db,
2849         "SELECT sql FROM "
2850         "  (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
2851         "     FROM sqlite_master UNION ALL"
2852         "   SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
2853         "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'"
2854         "ORDER BY rowid",
2855         callback, &data, &zErrMsg
2856      );
2857    }
2858    if( zErrMsg ){
2859      fprintf(stderr,"Error: %s\n", zErrMsg);
2860      sqlite3_free(zErrMsg);
2861      rc = 1;
2862    }else if( rc != SQLITE_OK ){
2863      fprintf(stderr,"Error: querying schema information\n");
2864      rc = 1;
2865    }else{
2866      rc = 0;
2867    }
2868  }else
2795   if( c=='s' && strncmp(azArg[0], "schema", n)==0 && nArg<3 ){
2796   struct callback_data data;
2797   char *zErrMsg = 0;
2798   open_db(p, 0);
2799   memcpy(&data, p, sizeof(data));
2800   data.showHeader = 0;
2801   data.mode = MODE_Semi;
2802   if( nArg>1 ){
2803      int i;
2804      for(i=0; azArg[1][i]; i++) azArg[1][i] = ToLower(azArg[1][i]);
2805      if( strcmp(azArg[1],"sqlite_master")==0 ){
2806      char *new_argv[2], *new_colv[2];
2807      new_argv[0] = "CREATE TABLE sqlite_master (\n"
2808                  "  type text,\n"
2809                  "  name text,\n"
2810                  "  tbl_name text,\n"
2811                  "  rootpage integer,\n"
2812                  "  sql text\n"
2813                  ")";
2814      new_argv[1] = 0;
2815      new_colv[0] = "sql";
2816      new_colv[1] = 0;
2817      callback(&data, 1, new_argv, new_colv);
2818      rc = SQLITE_OK;
2819      }else if( strcmp(azArg[1],"sqlite_temp_master")==0 ){
2820      char *new_argv[2], *new_colv[2];
2821      new_argv[0] = "CREATE TEMP TABLE sqlite_temp_master (\n"
2822                  "  type text,\n"
2823                  "  name text,\n"
2824                  "  tbl_name text,\n"
2825                  "  rootpage integer,\n"
2826                  "  sql text\n"
2827                  ")";
2828      new_argv[1] = 0;
2829      new_colv[0] = "sql";
2830      new_colv[1] = 0;
2831      callback(&data, 1, new_argv, new_colv);
2832      rc = SQLITE_OK;
2833      }else{
2834      zShellStatic = azArg[1];
2835      rc = sqlite3_exec(p->db,
2836         "SELECT sql FROM "
2837         "  (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
2838         "     FROM sqlite_master UNION ALL"
2839         "   SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
2840         "WHERE lower(tbl_name) LIKE shellstatic()"
2841         "  AND type!='meta' AND sql NOTNULL "
2842         "ORDER BY rowid",
2843         callback, &data, &zErrMsg);
2844      zShellStatic = 0;
2845      }
2846   }else{
2847      rc = sqlite3_exec(p->db,
2848         "SELECT sql FROM "
2849         "  (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
2850         "     FROM sqlite_master UNION ALL"
2851         "   SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
2852         "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'"
2853         "ORDER BY rowid",
2854         callback, &data, &zErrMsg
2855      );
2856   }
2857   if( zErrMsg ){
2858      fprintf(stderr,"Error: %s\n", zErrMsg);
2859      sqlite3_free(zErrMsg);
2860      rc = 1;
2861   }else if( rc != SQLITE_OK ){
2862      fprintf(stderr,"Error: querying schema information\n");
2863      rc = 1;
2864   }else{
2865      rc = 0;
2866   }
2867   }else
28692868
28702869#ifdef SQLITE_DEBUG
2871  /* Undocumented commands for internal testing.  Subject to change
2872  ** without notice. */
2873  if( c=='s' && n>=10 && strncmp(azArg[0], "selftest-", 9)==0 ){
2874    if( strncmp(azArg[0]+9, "boolean", n-9)==0 ){
2875      int i, v;
2876      for(i=1; i<nArg; i++){
2877        v = booleanValue(azArg[i]);
2878        fprintf(p->out, "%s: %d 0x%x\n", azArg[i], v, v);
2879      }
2880    }
2881    if( strncmp(azArg[0]+9, "integer", n-9)==0 ){
2882      int i; sqlite3_int64 v;
2883      for(i=1; i<nArg; i++){
2884        char zBuf[200];
2885        v = integerValue(azArg[i]);
2886        sqlite3_snprintf(sizeof(zBuf), zBuf, "%s: %lld 0x%llx\n", azArg[i], v, v);
2887        fprintf(p->out, "%s", zBuf);
2888      }
2889    }
2890  }else
2870   /* Undocumented commands for internal testing.  Subject to change
2871   ** without notice. */
2872   if( c=='s' && n>=10 && strncmp(azArg[0], "selftest-", 9)==0 ){
2873   if( strncmp(azArg[0]+9, "boolean", n-9)==0 ){
2874      int i, v;
2875      for(i=1; i<nArg; i++){
2876      v = booleanValue(azArg[i]);
2877      fprintf(p->out, "%s: %d 0x%x\n", azArg[i], v, v);
2878      }
2879   }
2880   if( strncmp(azArg[0]+9, "integer", n-9)==0 ){
2881      int i; sqlite3_int64 v;
2882      for(i=1; i<nArg; i++){
2883      char zBuf[200];
2884      v = integerValue(azArg[i]);
2885      sqlite3_snprintf(sizeof(zBuf), zBuf, "%s: %lld 0x%llx\n", azArg[i], v, v);
2886      fprintf(p->out, "%s", zBuf);
2887      }
2888   }
2889   }else
28912890#endif
28922891
2893  if( c=='s' && strncmp(azArg[0], "separator", n)==0 && nArg==2 ){
2894    sqlite3_snprintf(sizeof(p->separator), p->separator,
2895                     "%.*s", (int)sizeof(p->separator)-1, azArg[1]);
2896  }else
2892   if( c=='s' && strncmp(azArg[0], "separator", n)==0 && nArg==2 ){
2893   sqlite3_snprintf(sizeof(p->separator), p->separator,
2894                  "%.*s", (int)sizeof(p->separator)-1, azArg[1]);
2895   }else
28972896
2898  if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){
2899    int i;
2900    fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off");
2901    fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off");
2902    fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off");
2903    fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off");
2904    fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]);
2905    fprintf(p->out,"%9.9s: ", "nullvalue");
2906      output_c_string(p->out, p->nullvalue);
2907      fprintf(p->out, "\n");
2908    fprintf(p->out,"%9.9s: %s\n","output",
2909            strlen30(p->outfile) ? p->outfile : "stdout");
2910    fprintf(p->out,"%9.9s: ", "separator");
2911      output_c_string(p->out, p->separator);
2912      fprintf(p->out, "\n");
2913    fprintf(p->out,"%9.9s: %s\n","stats", p->statsOn ? "on" : "off");
2914    fprintf(p->out,"%9.9s: ","width");
2915    for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) {
2916      fprintf(p->out,"%d ",p->colWidth[i]);
2917    }
2918    fprintf(p->out,"\n");
2919  }else
2897   if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){
2898   int i;
2899   fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off");
2900   fprintf(p->out,"%9.9s: %s\n","eqp", p->autoEQP ? "on" : "off");
2901   fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off");
2902   fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off");
2903   fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]);
2904   fprintf(p->out,"%9.9s: ", "nullvalue");
2905      output_c_string(p->out, p->nullvalue);
2906      fprintf(p->out, "\n");
2907   fprintf(p->out,"%9.9s: %s\n","output",
2908         strlen30(p->outfile) ? p->outfile : "stdout");
2909   fprintf(p->out,"%9.9s: ", "separator");
2910      output_c_string(p->out, p->separator);
2911      fprintf(p->out, "\n");
2912   fprintf(p->out,"%9.9s: %s\n","stats", p->statsOn ? "on" : "off");
2913   fprintf(p->out,"%9.9s: ","width");
2914   for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) {
2915      fprintf(p->out,"%d ",p->colWidth[i]);
2916   }
2917   fprintf(p->out,"\n");
2918   }else
29202919
2921  if( c=='s' && strncmp(azArg[0], "stats", n)==0 && nArg>1 && nArg<3 ){
2922    p->statsOn = booleanValue(azArg[1]);
2923  }else
2920   if( c=='s' && strncmp(azArg[0], "stats", n)==0 && nArg>1 && nArg<3 ){
2921   p->statsOn = booleanValue(azArg[1]);
2922   }else
29242923
2925  if( c=='t' && n>1 && strncmp(azArg[0], "tables", n)==0 && nArg<3 ){
2926    sqlite3_stmt *pStmt;
2927    char **azResult;
2928    int nRow, nAlloc;
2929    char *zSql = 0;
2930    int ii;
2931    open_db(p, 0);
2932    rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
2933    if( rc ) return rc;
2934    zSql = sqlite3_mprintf(
2935        "SELECT name FROM sqlite_master"
2936        " WHERE type IN ('table','view')"
2937        "   AND name NOT LIKE 'sqlite_%%'"
2938        "   AND name LIKE ?1");
2939    while( sqlite3_step(pStmt)==SQLITE_ROW ){
2940      const char *zDbName = (const char*)sqlite3_column_text(pStmt, 1);
2941      if( zDbName==0 || strcmp(zDbName,"main")==0 ) continue;
2942      if( strcmp(zDbName,"temp")==0 ){
2943        zSql = sqlite3_mprintf(
2944                 "%z UNION ALL "
2945                 "SELECT 'temp.' || name FROM sqlite_temp_master"
2946                 " WHERE type IN ('table','view')"
2947                 "   AND name NOT LIKE 'sqlite_%%'"
2948                 "   AND name LIKE ?1", zSql);
2949      }else{
2950        zSql = sqlite3_mprintf(
2951                 "%z UNION ALL "
2952                 "SELECT '%q.' || name FROM \"%w\".sqlite_master"
2953                 " WHERE type IN ('table','view')"
2954                 "   AND name NOT LIKE 'sqlite_%%'"
2955                 "   AND name LIKE ?1", zSql, zDbName, zDbName);
2956      }
2957    }
2958    sqlite3_finalize(pStmt);
2959    zSql = sqlite3_mprintf("%z ORDER BY 1", zSql);
2960    rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
2961    sqlite3_free(zSql);
2962    if( rc ) return rc;
2963    nRow = nAlloc = 0;
2964    azResult = 0;
2965    if( nArg>1 ){
2966      sqlite3_bind_text(pStmt, 1, azArg[1], -1, SQLITE_TRANSIENT);
2967    }else{
2968      sqlite3_bind_text(pStmt, 1, "%", -1, SQLITE_STATIC);
2969    }
2970    while( sqlite3_step(pStmt)==SQLITE_ROW ){
2971      if( nRow>=nAlloc ){
2972        char **azNew;
2973        int n = nAlloc*2 + 10;
2974        azNew = (char **)sqlite3_realloc(azResult, sizeof(azResult[0])*n);
2975        if( azNew==0 ){
2976          fprintf(stderr, "Error: out of memory\n");
2977          break;
2978        }
2979        nAlloc = n;
2980        azResult = azNew;
2981      }
2982      azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0));
2983      if( azResult[nRow] ) nRow++;
2984    }
2985    sqlite3_finalize(pStmt);       
2986    if( nRow>0 ){
2987      int len, maxlen = 0;
2988      int i, j;
2989      int nPrintCol, nPrintRow;
2990      for(i=0; i<nRow; i++){
2991        len = strlen30(azResult[i]);
2992        if( len>maxlen ) maxlen = len;
2993      }
2994      nPrintCol = 80/(maxlen+2);
2995      if( nPrintCol<1 ) nPrintCol = 1;
2996      nPrintRow = (nRow + nPrintCol - 1)/nPrintCol;
2997      for(i=0; i<nPrintRow; i++){
2998        for(j=i; j<nRow; j+=nPrintRow){
2999          const char *zSp = j<nPrintRow ? "" : "  ";
3000          fprintf(p->out, "%s%-*s", zSp, maxlen, azResult[j] ? azResult[j] : "");
3001        }
3002        fprintf(p->out, "\n");
3003      }
3004    }
3005    for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
3006    sqlite3_free(azResult);
3007  }else
2924   if( c=='t' && n>1 && strncmp(azArg[0], "tables", n)==0 && nArg<3 ){
2925   sqlite3_stmt *pStmt;
2926   char **azResult;
2927   int nRow, nAlloc;
2928   char *zSql = 0;
2929   int ii;
2930   open_db(p, 0);
2931   rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0);
2932   if( rc ) return rc;
2933   zSql = sqlite3_mprintf(
2934      "SELECT name FROM sqlite_master"
2935      " WHERE type IN ('table','view')"
2936      "   AND name NOT LIKE 'sqlite_%%'"
2937      "   AND name LIKE ?1");
2938   while( sqlite3_step(pStmt)==SQLITE_ROW ){
2939      const char *zDbName = (const char*)sqlite3_column_text(pStmt, 1);
2940      if( zDbName==0 || strcmp(zDbName,"main")==0 ) continue;
2941      if( strcmp(zDbName,"temp")==0 ){
2942      zSql = sqlite3_mprintf(
2943               "%z UNION ALL "
2944               "SELECT 'temp.' || name FROM sqlite_temp_master"
2945               " WHERE type IN ('table','view')"
2946               "   AND name NOT LIKE 'sqlite_%%'"
2947               "   AND name LIKE ?1", zSql);
2948      }else{
2949      zSql = sqlite3_mprintf(
2950               "%z UNION ALL "
2951               "SELECT '%q.' || name FROM \"%w\".sqlite_master"
2952               " WHERE type IN ('table','view')"
2953               "   AND name NOT LIKE 'sqlite_%%'"
2954               "   AND name LIKE ?1", zSql, zDbName, zDbName);
2955      }
2956   }
2957   sqlite3_finalize(pStmt);
2958   zSql = sqlite3_mprintf("%z ORDER BY 1", zSql);
2959   rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
2960   sqlite3_free(zSql);
2961   if( rc ) return rc;
2962   nRow = nAlloc = 0;
2963   azResult = 0;
2964   if( nArg>1 ){
2965      sqlite3_bind_text(pStmt, 1, azArg[1], -1, SQLITE_TRANSIENT);
2966   }else{
2967      sqlite3_bind_text(pStmt, 1, "%", -1, SQLITE_STATIC);
2968   }
2969   while( sqlite3_step(pStmt)==SQLITE_ROW ){
2970      if( nRow>=nAlloc ){
2971      char **azNew;
2972      int n = nAlloc*2 + 10;
2973      azNew = (char **)sqlite3_realloc(azResult, sizeof(azResult[0])*n);
2974      if( azNew==0 ){
2975         fprintf(stderr, "Error: out of memory\n");
2976         break;
2977      }
2978      nAlloc = n;
2979      azResult = azNew;
2980      }
2981      azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0));
2982      if( azResult[nRow] ) nRow++;
2983   }
2984   sqlite3_finalize(pStmt);
2985   if( nRow>0 ){
2986      int len, maxlen = 0;
2987      int i, j;
2988      int nPrintCol, nPrintRow;
2989      for(i=0; i<nRow; i++){
2990      len = strlen30(azResult[i]);
2991      if( len>maxlen ) maxlen = len;
2992      }
2993      nPrintCol = 80/(maxlen+2);
2994      if( nPrintCol<1 ) nPrintCol = 1;
2995      nPrintRow = (nRow + nPrintCol - 1)/nPrintCol;
2996      for(i=0; i<nPrintRow; i++){
2997      for(j=i; j<nRow; j+=nPrintRow){
2998         const char *zSp = j<nPrintRow ? "" : "  ";
2999         fprintf(p->out, "%s%-*s", zSp, maxlen, azResult[j] ? azResult[j] : "");
3000      }
3001      fprintf(p->out, "\n");
3002      }
3003   }
3004   for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
3005   sqlite3_free(azResult);
3006   }else
30083007
3009  if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 && nArg>=2 ){
3010    static const struct {
3011       const char *zCtrlName;   /* Name of a test-control option */
3012       int ctrlCode;            /* Integer code for that option */
3013    } aCtrl[] = {
3014      { "prng_save",             SQLITE_TESTCTRL_PRNG_SAVE              },
3015      { "prng_restore",          SQLITE_TESTCTRL_PRNG_RESTORE           },
3016      { "prng_reset",            SQLITE_TESTCTRL_PRNG_RESET             },
3017      { "bitvec_test",           SQLITE_TESTCTRL_BITVEC_TEST            },
3018      { "fault_install",         SQLITE_TESTCTRL_FAULT_INSTALL          },
3019      { "benign_malloc_hooks",   SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS    },
3020      { "pending_byte",          SQLITE_TESTCTRL_PENDING_BYTE           },
3021      { "assert",                SQLITE_TESTCTRL_ASSERT                 },
3022      { "always",                SQLITE_TESTCTRL_ALWAYS                 },
3023      { "reserve",               SQLITE_TESTCTRL_RESERVE                },
3024      { "optimizations",         SQLITE_TESTCTRL_OPTIMIZATIONS          },
3025      { "iskeyword",             SQLITE_TESTCTRL_ISKEYWORD              },
3026      { "scratchmalloc",         SQLITE_TESTCTRL_SCRATCHMALLOC          },
3027    };
3028    int testctrl = -1;
3029    int rc = 0;
3030    int i, n;
3031    open_db(p, 0);
3008   if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 && nArg>=2 ){
3009   static const struct {
3010      const char *zCtrlName;   /* Name of a test-control option */
3011      int ctrlCode;            /* Integer code for that option */
3012   } aCtrl[] = {
3013      { "prng_save",             SQLITE_TESTCTRL_PRNG_SAVE              },
3014      { "prng_restore",          SQLITE_TESTCTRL_PRNG_RESTORE           },
3015      { "prng_reset",            SQLITE_TESTCTRL_PRNG_RESET             },
3016      { "bitvec_test",           SQLITE_TESTCTRL_BITVEC_TEST            },
3017      { "fault_install",         SQLITE_TESTCTRL_FAULT_INSTALL          },
3018      { "benign_malloc_hooks",   SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS    },
3019      { "pending_byte",          SQLITE_TESTCTRL_PENDING_BYTE           },
3020      { "assert",                SQLITE_TESTCTRL_ASSERT                 },
3021      { "always",                SQLITE_TESTCTRL_ALWAYS                 },
3022      { "reserve",               SQLITE_TESTCTRL_RESERVE                },
3023      { "optimizations",         SQLITE_TESTCTRL_OPTIMIZATIONS          },
3024      { "iskeyword",             SQLITE_TESTCTRL_ISKEYWORD              },
3025      { "scratchmalloc",         SQLITE_TESTCTRL_SCRATCHMALLOC          },
3026   };
3027   int testctrl = -1;
3028   int rc = 0;
3029   int i, n;
3030   open_db(p, 0);
30323031
3033    /* convert testctrl text option to value. allow any unique prefix
3034    ** of the option name, or a numerical value. */
3035    n = strlen30(azArg[1]);
3036    for(i=0; i<(int)(sizeof(aCtrl)/sizeof(aCtrl[0])); i++){
3037      if( strncmp(azArg[1], aCtrl[i].zCtrlName, n)==0 ){
3038        if( testctrl<0 ){
3039          testctrl = aCtrl[i].ctrlCode;
3040        }else{
3041          fprintf(stderr, "ambiguous option name: \"%s\"\n", azArg[1]);
3042          testctrl = -1;
3043          break;
3044        }
3045      }
3046    }
3047    if( testctrl<0 ) testctrl = (int)integerValue(azArg[1]);
3048    if( (testctrl<SQLITE_TESTCTRL_FIRST) || (testctrl>SQLITE_TESTCTRL_LAST) ){
3049      fprintf(stderr,"Error: invalid testctrl option: %s\n", azArg[1]);
3050    }else{
3051      switch(testctrl){
3032   /* convert testctrl text option to value. allow any unique prefix
3033   ** of the option name, or a numerical value. */
3034   n = strlen30(azArg[1]);
3035   for(i=0; i<(int)(sizeof(aCtrl)/sizeof(aCtrl[0])); i++){
3036      if( strncmp(azArg[1], aCtrl[i].zCtrlName, n)==0 ){
3037      if( testctrl<0 ){
3038         testctrl = aCtrl[i].ctrlCode;
3039      }else{
3040         fprintf(stderr, "ambiguous option name: \"%s\"\n", azArg[1]);
3041         testctrl = -1;
3042         break;
3043      }
3044      }
3045   }
3046   if( testctrl<0 ) testctrl = (int)integerValue(azArg[1]);
3047   if( (testctrl<SQLITE_TESTCTRL_FIRST) || (testctrl>SQLITE_TESTCTRL_LAST) ){
3048      fprintf(stderr,"Error: invalid testctrl option: %s\n", azArg[1]);
3049   }else{
3050      switch(testctrl){
3051      /* sqlite3_test_control(int, db, int) */
3052      case SQLITE_TESTCTRL_OPTIMIZATIONS:
3053      case SQLITE_TESTCTRL_RESERVE:
3054         if( nArg==3 ){
3055         int opt = (int)strtol(azArg[2], 0, 0);
3056         rc = sqlite3_test_control(testctrl, p->db, opt);
3057         fprintf(p->out, "%d (0x%08x)\n", rc, rc);
3058         } else {
3059         fprintf(stderr,"Error: testctrl %s takes a single int option\n",
3060               azArg[1]);
3061         }
3062         break;
30523063
3053        /* sqlite3_test_control(int, db, int) */
3054        case SQLITE_TESTCTRL_OPTIMIZATIONS:
3055        case SQLITE_TESTCTRL_RESERVE:             
3056          if( nArg==3 ){
3057            int opt = (int)strtol(azArg[2], 0, 0);       
3058            rc = sqlite3_test_control(testctrl, p->db, opt);
3059            fprintf(p->out, "%d (0x%08x)\n", rc, rc);
3060          } else {
3061            fprintf(stderr,"Error: testctrl %s takes a single int option\n",
3062                    azArg[1]);
3063          }
3064          break;
3064      /* sqlite3_test_control(int) */
3065      case SQLITE_TESTCTRL_PRNG_SAVE:
3066      case SQLITE_TESTCTRL_PRNG_RESTORE:
3067      case SQLITE_TESTCTRL_PRNG_RESET:
3068         if( nArg==2 ){
3069         rc = sqlite3_test_control(testctrl);
3070         fprintf(p->out, "%d (0x%08x)\n", rc, rc);
3071         } else {
3072         fprintf(stderr,"Error: testctrl %s takes no options\n", azArg[1]);
3073         }
3074         break;
30653075
3066        /* sqlite3_test_control(int) */
3067        case SQLITE_TESTCTRL_PRNG_SAVE:           
3068        case SQLITE_TESTCTRL_PRNG_RESTORE:       
3069        case SQLITE_TESTCTRL_PRNG_RESET:
3070          if( nArg==2 ){
3071            rc = sqlite3_test_control(testctrl);
3072            fprintf(p->out, "%d (0x%08x)\n", rc, rc);
3073          } else {
3074            fprintf(stderr,"Error: testctrl %s takes no options\n", azArg[1]);
3075          }
3076          break;
3076      /* sqlite3_test_control(int, uint) */
3077      case SQLITE_TESTCTRL_PENDING_BYTE:
3078         if( nArg==3 ){
3079         unsigned int opt = (unsigned int)integerValue(azArg[2]);
3080         rc = sqlite3_test_control(testctrl, opt);
3081         fprintf(p->out, "%d (0x%08x)\n", rc, rc);
3082         } else {
3083         fprintf(stderr,"Error: testctrl %s takes a single unsigned"
3084                     " int option\n", azArg[1]);
3085         }
3086         break;
30773087
3078        /* sqlite3_test_control(int, uint) */
3079        case SQLITE_TESTCTRL_PENDING_BYTE:       
3080          if( nArg==3 ){
3081            unsigned int opt = (unsigned int)integerValue(azArg[2]);
3082            rc = sqlite3_test_control(testctrl, opt);
3083            fprintf(p->out, "%d (0x%08x)\n", rc, rc);
3084          } else {
3085            fprintf(stderr,"Error: testctrl %s takes a single unsigned"
3086                           " int option\n", azArg[1]);
3087          }
3088          break;
3089         
3090        /* sqlite3_test_control(int, int) */
3091        case SQLITE_TESTCTRL_ASSERT:             
3092        case SQLITE_TESTCTRL_ALWAYS:             
3093          if( nArg==3 ){
3094            int opt = booleanValue(azArg[2]);       
3095            rc = sqlite3_test_control(testctrl, opt);
3096            fprintf(p->out, "%d (0x%08x)\n", rc, rc);
3097          } else {
3098            fprintf(stderr,"Error: testctrl %s takes a single int option\n",
3099                            azArg[1]);
3100          }
3101          break;
3088      /* sqlite3_test_control(int, int) */
3089      case SQLITE_TESTCTRL_ASSERT:
3090      case SQLITE_TESTCTRL_ALWAYS:
3091         if( nArg==3 ){
3092         int opt = booleanValue(azArg[2]);
3093         rc = sqlite3_test_control(testctrl, opt);
3094         fprintf(p->out, "%d (0x%08x)\n", rc, rc);
3095         } else {
3096         fprintf(stderr,"Error: testctrl %s takes a single int option\n",
3097                     azArg[1]);
3098         }
3099         break;
31023100
3103        /* sqlite3_test_control(int, char *) */
3101      /* sqlite3_test_control(int, char *) */
31043102#ifdef SQLITE_N_KEYWORD
3105        case SQLITE_TESTCTRL_ISKEYWORD:           
3106          if( nArg==3 ){
3107            const char *opt = azArg[2];       
3108            rc = sqlite3_test_control(testctrl, opt);
3109            fprintf(p->out, "%d (0x%08x)\n", rc, rc);
3110          } else {
3111            fprintf(stderr,"Error: testctrl %s takes a single char * option\n",
3112                            azArg[1]);
3113          }
3114          break;
3103      case SQLITE_TESTCTRL_ISKEYWORD:
3104         if( nArg==3 ){
3105         const char *opt = azArg[2];
3106         rc = sqlite3_test_control(testctrl, opt);
3107         fprintf(p->out, "%d (0x%08x)\n", rc, rc);
3108         } else {
3109         fprintf(stderr,"Error: testctrl %s takes a single char * option\n",
3110                     azArg[1]);
3111         }
3112         break;
31153113#endif
31163114
3117        case SQLITE_TESTCTRL_BITVEC_TEST:         
3118        case SQLITE_TESTCTRL_FAULT_INSTALL:       
3119        case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS:
3120        case SQLITE_TESTCTRL_SCRATCHMALLOC:       
3121        default:
3122          fprintf(stderr,"Error: CLI support for testctrl %s not implemented\n",
3123                  azArg[1]);
3124          break;
3125      }
3126    }
3127  }else
3115      case SQLITE_TESTCTRL_BITVEC_TEST:
3116      case SQLITE_TESTCTRL_FAULT_INSTALL:
3117      case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS:
3118      case SQLITE_TESTCTRL_SCRATCHMALLOC:
3119      default:
3120         fprintf(stderr,"Error: CLI support for testctrl %s not implemented\n",
3121               azArg[1]);
3122         break;
3123      }
3124   }
3125   }else
31283126
3129  if( c=='t' && n>4 && strncmp(azArg[0], "timeout", n)==0 && nArg==2 ){
3130    open_db(p, 0);
3131    sqlite3_busy_timeout(p->db, (int)integerValue(azArg[1]));
3132  }else
3133   
3134  if( HAS_TIMER && c=='t' && n>=5 && strncmp(azArg[0], "timer", n)==0
3135   && nArg==2
3136  ){
3137    enableTimer = booleanValue(azArg[1]);
3138  }else
3139 
3140  if( c=='t' && strncmp(azArg[0], "trace", n)==0 && nArg>1 ){
3141    open_db(p, 0);
3142    output_file_close(p->traceOut);
3143    p->traceOut = output_file_open(azArg[1]);
3127   if( c=='t' && n>4 && strncmp(azArg[0], "timeout", n)==0 && nArg==2 ){
3128   open_db(p, 0);
3129   sqlite3_busy_timeout(p->db, (int)integerValue(azArg[1]));
3130   }else
3131
3132   if( HAS_TIMER && c=='t' && n>=5 && strncmp(azArg[0], "timer", n)==0
3133   && nArg==2
3134   ){
3135   enableTimer = booleanValue(azArg[1]);
3136   }else
3137
3138   if( c=='t' && strncmp(azArg[0], "trace", n)==0 && nArg>1 ){
3139   open_db(p, 0);
3140   output_file_close(p->traceOut);
3141   p->traceOut = output_file_open(azArg[1]);
31443142#if !defined(SQLITE_OMIT_TRACE) && !defined(SQLITE_OMIT_FLOATING_POINT)
3145    if( p->traceOut==0 ){
3146      sqlite3_trace(p->db, 0, 0);
3147    }else{
3148      sqlite3_trace(p->db, sql_trace_callback, p->traceOut);
3149    }
3143   if( p->traceOut==0 ){
3144      sqlite3_trace(p->db, 0, 0);
3145   }else{
3146      sqlite3_trace(p->db, sql_trace_callback, p->traceOut);
3147   }
31503148#endif
3151  }else
3149   }else
31523150
3153  if( c=='v' && strncmp(azArg[0], "version", n)==0 ){
3154    fprintf(p->out, "SQLite %s %s\n" /*extra-version-info*/,
3155        sqlite3_libversion(), sqlite3_sourceid());
3156  }else
3151   if( c=='v' && strncmp(azArg[0], "version", n)==0 ){
3152   fprintf(p->out, "SQLite %s %s\n" /*extra-version-info*/,
3153      sqlite3_libversion(), sqlite3_sourceid());
3154   }else
31573155
3158  if( c=='v' && strncmp(azArg[0], "vfsname", n)==0 ){
3159    const char *zDbName = nArg==2 ? azArg[1] : "main";
3160    char *zVfsName = 0;
3161    if( p->db ){
3162      sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFSNAME, &zVfsName);
3163      if( zVfsName ){
3164        fprintf(p->out, "%s\n", zVfsName);
3165        sqlite3_free(zVfsName);
3166      }
3167    }
3168  }else
3156   if( c=='v' && strncmp(azArg[0], "vfsname", n)==0 ){
3157   const char *zDbName = nArg==2 ? azArg[1] : "main";
3158   char *zVfsName = 0;
3159   if( p->db ){
3160      sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFSNAME, &zVfsName);
3161      if( zVfsName ){
3162      fprintf(p->out, "%s\n", zVfsName);
3163      sqlite3_free(zVfsName);
3164      }
3165   }
3166   }else
31693167
31703168#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
3171  if( c=='w' && strncmp(azArg[0], "wheretrace", n)==0 ){
3172    extern int sqlite3WhereTrace;
3173    sqlite3WhereTrace = booleanValue(azArg[1]);
3174  }else
3169   if( c=='w' && strncmp(azArg[0], "wheretrace", n)==0 ){
3170   extern int sqlite3WhereTrace;
3171   sqlite3WhereTrace = booleanValue(azArg[1]);
3172   }else
31753173#endif
31763174
3177  if( c=='w' && strncmp(azArg[0], "width", n)==0 && nArg>1 ){
3178    int j;
3179    assert( nArg<=ArraySize(azArg) );
3180    for(j=1; j<nArg && j<ArraySize(p->colWidth); j++){
3181      p->colWidth[j-1] = (int)integerValue(azArg[j]);
3182    }
3183  }else
3175   if( c=='w' && strncmp(azArg[0], "width", n)==0 && nArg>1 ){
3176   int j;
3177   assert( nArg<=ArraySize(azArg) );
3178   for(j=1; j<nArg && j<ArraySize(p->colWidth); j++){
3179      p->colWidth[j-1] = (int)integerValue(azArg[j]);
3180   }
3181   }else
31843182
3185  {
3186    fprintf(stderr, "Error: unknown command or invalid arguments: "
3187      " \"%s\". Enter \".help\" for help\n", azArg[0]);
3188    rc = 1;
3189  }
3183   {
3184   fprintf(stderr, "Error: unknown command or invalid arguments: "
3185      " \"%s\". Enter \".help\" for help\n", azArg[0]);
3186   rc = 1;
3187   }
31903188
3191  return rc;
3189   return rc;
31923190}
31933191
31943192/*
r31373r31374
31963194** of string z[].
31973195*/
31983196static int line_contains_semicolon(const char *z, int N){
3199  int i;
3200  for(i=0; i<N; i++){  if( z[i]==';' ) return 1; }
3201  return 0;
3197   int i;
3198   for(i=0; i<N; i++){  if( z[i]==';' ) return 1; }
3199   return 0;
32023200}
32033201
32043202/*
32053203** Test to see if a line consists entirely of whitespace.
32063204*/
32073205static int _all_whitespace(const char *z){
3208  for(; *z; z++){
3209    if( IsSpace(z[0]) ) continue;
3210    if( *z=='/' && z[1]=='*' ){
3211      z += 2;
3212      while( *z && (*z!='*' || z[1]!='/') ){ z++; }
3213      if( *z==0 ) return 0;
3214      z++;
3215      continue;
3216    }
3217    if( *z=='-' && z[1]=='-' ){
3218      z += 2;
3219      while( *z && *z!='\n' ){ z++; }
3220      if( *z==0 ) return 1;
3221      continue;
3222    }
3223    return 0;
3224  }
3225  return 1;
3206   for(; *z; z++){
3207   if( IsSpace(z[0]) ) continue;
3208   if( *z=='/' && z[1]=='*' ){
3209      z += 2;
3210      while( *z && (*z!='*' || z[1]!='/') ){ z++; }
3211      if( *z==0 ) return 0;
3212      z++;
3213      continue;
3214   }
3215   if( *z=='-' && z[1]=='-' ){
3216      z += 2;
3217      while( *z && *z!='\n' ){ z++; }
3218      if( *z==0 ) return 1;
3219      continue;
3220   }
3221   return 0;
3222   }
3223   return 1;
32263224}
32273225
32283226/*
r31373r31374
32313229** as is the Oracle "/".
32323230*/
32333231static int line_is_command_terminator(const char *zLine){
3234  while( IsSpace(zLine[0]) ){ zLine++; };
3235  if( zLine[0]=='/' && _all_whitespace(&zLine[1]) ){
3236    return 1;  /* Oracle */
3237  }
3238  if( ToLower(zLine[0])=='g' && ToLower(zLine[1])=='o'
3239         && _all_whitespace(&zLine[2]) ){
3240    return 1;  /* SQL Server */
3241  }
3242  return 0;
3232   while( IsSpace(zLine[0]) ){ zLine++; };
3233   if( zLine[0]=='/' && _all_whitespace(&zLine[1]) ){
3234   return 1;  /* Oracle */
3235   }
3236   if( ToLower(zLine[0])=='g' && ToLower(zLine[1])=='o'
3237         && _all_whitespace(&zLine[2]) ){
3238   return 1;  /* SQL Server */
3239   }
3240   return 0;
32433241}
32443242
32453243/*
r31373r31374
32473245** ends in the middle of a string literal or C-style comment.
32483246*/
32493247static int line_is_complete(char *zSql, int nSql){
3250  int rc;
3251  if( zSql==0 ) return 1;
3252  zSql[nSql] = ';';
3253  zSql[nSql+1] = 0;
3254  rc = sqlite3_complete(zSql);
3255  zSql[nSql] = 0;
3256  return rc;
3248   int rc;
3249   if( zSql==0 ) return 1;
3250   zSql[nSql] = ';';
3251   zSql[nSql+1] = 0;
3252   rc = sqlite3_complete(zSql);
3253   zSql[nSql] = 0;
3254   return rc;
32573255}
32583256
32593257/*
r31373r31374
32663264** Return the number of errors.
32673265*/
32683266static int process_input(struct callback_data *p, FILE *in){
3269  char *zLine = 0;          /* A single input line */
3270  char *zSql = 0;           /* Accumulated SQL text */
3271  int nLine;                /* Length of current line */
3272  int nSql = 0;             /* Bytes of zSql[] used */
3273  int nAlloc = 0;           /* Allocated zSql[] space */
3274  int nSqlPrior = 0;        /* Bytes of zSql[] used by prior line */
3275  char *zErrMsg;            /* Error message returned */
3276  int rc;                   /* Error code */
3277  int errCnt = 0;           /* Number of errors seen */
3278  int lineno = 0;           /* Current line number */
3279  int startline = 0;        /* Line number for start of current input */
3267   char *zLine = 0;          /* A single input line */
3268   char *zSql = 0;           /* Accumulated SQL text */
3269   int nLine;                /* Length of current line */
3270   int nSql = 0;             /* Bytes of zSql[] used */
3271   int nAlloc = 0;           /* Allocated zSql[] space */
3272   int nSqlPrior = 0;        /* Bytes of zSql[] used by prior line */
3273   char *zErrMsg;            /* Error message returned */
3274   int rc;                   /* Error code */
3275   int errCnt = 0;           /* Number of errors seen */
3276   int lineno = 0;           /* Current line number */
3277   int startline = 0;        /* Line number for start of current input */
32803278
3281  while( errCnt==0 || !bail_on_error || (in==0 && stdin_is_interactive) ){
3282    fflush(p->out);
3283    zLine = one_input_line(in, zLine, nSql>0);
3284    if( zLine==0 ){
3285      /* End of input */
3286      if( stdin_is_interactive ) printf("\n");
3287      break;
3288    }
3289    if( seenInterrupt ){
3290      if( in!=0 ) break;
3291      seenInterrupt = 0;
3292    }
3293    lineno++;
3294    if( nSql==0 && _all_whitespace(zLine) ){
3295      if( p->echoOn ) printf("%s\n", zLine);
3296      continue;
3297    }
3298    if( zLine && zLine[0]=='.' && nSql==0 ){
3299      if( p->echoOn ) printf("%s\n", zLine);
3300      rc = do_meta_command(zLine, p);
3301      if( rc==2 ){ /* exit requested */
3302        break;
3303      }else if( rc ){
3304        errCnt++;
3305      }
3306      continue;
3307    }
3308    if( line_is_command_terminator(zLine) && line_is_complete(zSql, nSql) ){
3309      memcpy(zLine,";",2);
3310    }
3311    nLine = strlen30(zLine);
3312    if( nSql+nLine+2>=nAlloc ){
3313      nAlloc = nSql+nLine+100;
3314      zSql = (char *)realloc(zSql, nAlloc);
3315      if( zSql==0 ){
3316        fprintf(stderr, "Error: out of memory\n");
3317        exit(1);
3318      }
3319    }
3320    nSqlPrior = nSql;
3321    if( nSql==0 ){
3322      int i;
3323      for(i=0; zLine[i] && IsSpace(zLine[i]); i++){}
3324      assert( nAlloc>0 && zSql!=0 );
3325      memcpy(zSql, zLine+i, nLine+1-i);
3326      startline = lineno;
3327      nSql = nLine-i;
3328    }else{
3329      zSql[nSql++] = '\n';
3330      memcpy(zSql+nSql, zLine, nLine+1);
3331      nSql += nLine;
3332    }
3333    if( nSql && line_contains_semicolon(&zSql[nSqlPrior], nSql-nSqlPrior)
3334                && sqlite3_complete(zSql) ){
3335      p->cnt = 0;
3336      open_db(p, 0);
3337      BEGIN_TIMER;
3338      rc = shell_exec(p->db, zSql, shell_callback, p, &zErrMsg);
3339      END_TIMER;
3340      if( rc || zErrMsg ){
3341        char zPrefix[100];
3342        if( in!=0 || !stdin_is_interactive ){
3343          sqlite3_snprintf(sizeof(zPrefix), zPrefix,
3344                           "Error: near line %d:", startline);
3345        }else{
3346          sqlite3_snprintf(sizeof(zPrefix), zPrefix, "Error:");
3347        }
3348        if( zErrMsg!=0 ){
3349          fprintf(stderr, "%s %s\n", zPrefix, zErrMsg);
3350          sqlite3_free(zErrMsg);
3351          zErrMsg = 0;
3352        }else{
3353          fprintf(stderr, "%s %s\n", zPrefix, sqlite3_errmsg(p->db));
3354        }
3355        errCnt++;
3356      }
3357      nSql = 0;
3358    }else if( nSql && _all_whitespace(zSql) ){
3359      if( p->echoOn ) printf("%s\n", zSql);
3360      nSql = 0;
3361    }
3362  }
3363  if( nSql ){
3364    if( !_all_whitespace(zSql) ){
3365      fprintf(stderr, "Error: incomplete SQL: %s\n", zSql);
3366    }
3367    free(zSql);
3368  }
3369  free(zLine);
3370  return errCnt>0;
3279   while( errCnt==0 || !bail_on_error || (in==0 && stdin_is_interactive) ){
3280   fflush(p->out);
3281   zLine = one_input_line(in, zLine, nSql>0);
3282   if( zLine==0 ){
3283      /* End of input */
3284      if( stdin_is_interactive ) printf("\n");
3285      break;
3286   }
3287   if( seenInterrupt ){
3288      if( in!=0 ) break;
3289      seenInterrupt = 0;
3290   }
3291   lineno++;
3292   if( nSql==0 && _all_whitespace(zLine) ){
3293      if( p->echoOn ) printf("%s\n", zLine);
3294      continue;
3295   }
3296   if( zLine && zLine[0]=='.' && nSql==0 ){
3297      if( p->echoOn ) printf("%s\n", zLine);
3298      rc = do_meta_command(zLine, p);
3299      if( rc==2 ){ /* exit requested */
3300      break;
3301      }else if( rc ){
3302      errCnt++;
3303      }
3304      continue;
3305   }
3306   if( line_is_command_terminator(zLine) && line_is_complete(zSql, nSql) ){
3307      memcpy(zLine,";",2);
3308   }
3309   nLine = strlen30(zLine);
3310   if( nSql+nLine+2>=nAlloc ){
3311      nAlloc = nSql+nLine+100;
3312      zSql = (char *)realloc(zSql, nAlloc);
3313      if( zSql==0 ){
3314      fprintf(stderr, "Error: out of memory\n");
3315      exit(1);
3316      }
3317   }
3318   nSqlPrior = nSql;
3319   if( nSql==0 ){
3320      int i;
3321      for(i=0; zLine[i] && IsSpace(zLine[i]); i++){}
3322      assert( nAlloc>0 && zSql!=0 );
3323      memcpy(zSql, zLine+i, nLine+1-i);
3324      startline = lineno;
3325      nSql = nLine-i;
3326   }else{
3327      zSql[nSql++] = '\n';
3328      memcpy(zSql+nSql, zLine, nLine+1);
3329      nSql += nLine;
3330   }
3331   if( nSql && line_contains_semicolon(&zSql[nSqlPrior], nSql-nSqlPrior)
3332            && sqlite3_complete(zSql) ){
3333      p->cnt = 0;
3334      open_db(p, 0);
3335      BEGIN_TIMER;
3336      rc = shell_exec(p->db, zSql, shell_callback, p, &zErrMsg);
3337      END_TIMER;
3338      if( rc || zErrMsg ){
3339      char zPrefix[100];
3340      if( in!=0 || !stdin_is_interactive ){
3341         sqlite3_snprintf(sizeof(zPrefix), zPrefix,
3342                     "Error: near line %d:", startline);
3343      }else{
3344         sqlite3_snprintf(sizeof(zPrefix), zPrefix, "Error:");
3345      }
3346      if( zErrMsg!=0 ){
3347         fprintf(stderr, "%s %s\n", zPrefix, zErrMsg);
3348         sqlite3_free(zErrMsg);
3349         zErrMsg = 0;
3350      }else{
3351         fprintf(stderr, "%s %s\n", zPrefix, sqlite3_errmsg(p->db));
3352      }
3353      errCnt++;
3354      }
3355      nSql = 0;
3356   }else if( nSql && _all_whitespace(zSql) ){
3357      if( p->echoOn ) printf("%s\n", zSql);
3358      nSql = 0;
3359   }
3360   }
3361   if( nSql ){
3362   if( !_all_whitespace(zSql) ){
3363      fprintf(stderr, "Error: incomplete SQL: %s\n", zSql);
3364   }
3365   free(zSql);
3366   }
3367   free(zLine);
3368   return errCnt>0;
33713369}
33723370
33733371/*
r31373r31374
33753373** 0 return indicates an error of some kind.
33763374*/
33773375static char *find_home_dir(void){
3378  static char *home_dir = NULL;
3379  if( home_dir ) return home_dir;
3376   static char *home_dir = NULL;
3377   if( home_dir ) return home_dir;
33803378
33813379#if !defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE) && !defined(__RTP__) && !defined(_WRS_KERNEL)
3382  {
3383    struct passwd *pwent;
3384    uid_t uid = getuid();
3385    if( (pwent=getpwuid(uid)) != NULL) {
3386      home_dir = pwent->pw_dir;
3387    }
3388  }
3380   {
3381   struct passwd *pwent;
3382   uid_t uid = getuid();
3383   if( (pwent=getpwuid(uid)) != NULL) {
3384      home_dir = pwent->pw_dir;
3385   }
3386   }
33893387#endif
33903388
33913389#if defined(_WIN32_WCE)
3392  /* Windows CE (arm-wince-mingw32ce-gcc) does not provide getenv()
3393   */
3394  home_dir = "/";
3390   /* Windows CE (arm-wince-mingw32ce-gcc) does not provide getenv()
3391   */
3392   home_dir = "/";
33953393#else
33963394
33973395#if defined(_WIN32) || defined(WIN32)
3398  if (!home_dir) {
3399    home_dir = getenv("USERPROFILE");
3400  }
3396   if (!home_dir) {
3397   home_dir = getenv("USERPROFILE");
3398   }
34013399#endif
34023400
3403  if (!home_dir) {
3404    home_dir = getenv("HOME");
3405  }
3401   if (!home_dir) {
3402   home_dir = getenv("HOME");
3403   }
34063404
34073405#if defined(_WIN32) || defined(WIN32)
3408  if (!home_dir) {
3409    char *zDrive, *zPath;
3410    int n;
3411    zDrive = getenv("HOMEDRIVE");
3412    zPath = getenv("HOMEPATH");
3413    if( zDrive && zPath ){
3414      n = strlen30(zDrive) + strlen30(zPath) + 1;
3415      home_dir = (char *)malloc( n );
3416      if( home_dir==0 ) return 0;
3417      sqlite3_snprintf(n, home_dir, "%s%s", zDrive, zPath);
3418      return home_dir;
3419    }
3420    home_dir = "c:\\";
3421  }
3406   if (!home_dir) {
3407   char *zDrive, *zPath;
3408   int n;
3409   zDrive = getenv("HOMEDRIVE");
3410   zPath = getenv("HOMEPATH");
3411   if( zDrive && zPath ){
3412      n = strlen30(zDrive) + strlen30(zPath) + 1;
3413      home_dir = (char *)malloc( n );
3414      if( home_dir==0 ) return 0;
3415      sqlite3_snprintf(n, home_dir, "%s%s", zDrive, zPath);
3416      return home_dir;
3417   }
3418   home_dir = "c:\\";
3419   }
34223420#endif
34233421
34243422#endif /* !_WIN32_WCE */
34253423
3426  if( home_dir ){
3427    int n = strlen30(home_dir) + 1;
3428    char *z = (char *)malloc( n );
3429    if( z ) memcpy(z, home_dir, n);
3430    home_dir = z;
3431  }
3424   if( home_dir ){
3425   int n = strlen30(home_dir) + 1;
3426   char *z = (char *)malloc( n );
3427   if( z ) memcpy(z, home_dir, n);
3428   home_dir = z;
3429   }
34323430
3433  return home_dir;
3431   return home_dir;
34343432}
34353433
34363434/*
r31373r31374
34403438** Returns the number of errors.
34413439*/
34423440static int process_sqliterc(
3443  struct callback_data *p,        /* Configuration data */
3444  const char *sqliterc_override   /* Name of config file. NULL to use default */
3441   struct callback_data *p,        /* Configuration data */
3442   const char *sqliterc_override   /* Name of config file. NULL to use default */
34453443){
3446  char *home_dir = NULL;
3447  const char *sqliterc = sqliterc_override;
3448  char *zBuf = 0;
3449  FILE *in = NULL;
3450  int rc = 0;
3444   char *home_dir = NULL;
3445   const char *sqliterc = sqliterc_override;
3446   char *zBuf = 0;
3447   FILE *in = NULL;
3448   int rc = 0;
34513449
3452  if (sqliterc == NULL) {
3453    home_dir = find_home_dir();
3454    if( home_dir==0 ){
3450   if (sqliterc == NULL) {
3451   home_dir = find_home_dir();
3452   if( home_dir==0 ){
34553453#if !defined(__RTP__) && !defined(_WRS_KERNEL)
3456      fprintf(stderr,"%s: Error: cannot locate your home directory\n", Argv0);
3454      fprintf(stderr,"%s: Error: cannot locate your home directory\n", Argv0);
34573455#endif
3458      return 1;
3459    }
3460    sqlite3_initialize();
3461    zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
3462    sqliterc = zBuf;
3463  }
3464  in = fopen(sqliterc,"rb");
3465  if( in ){
3466    if( stdin_is_interactive ){
3467      fprintf(stderr,"-- Loading resources from %s\n",sqliterc);
3468    }
3469    rc = process_input(p,in);
3470    fclose(in);
3471  }
3472  sqlite3_free(zBuf);
3473  return rc;
3456      return 1;
3457   }
3458   sqlite3_initialize();
3459   zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir);
3460   sqliterc = zBuf;
3461   }
3462   in = fopen(sqliterc,"rb");
3463   if( in ){
3464   if( stdin_is_interactive ){
3465      fprintf(stderr,"-- Loading resources from %s\n",sqliterc);
3466   }
3467   rc = process_input(p,in);
3468   fclose(in);
3469   }
3470   sqlite3_free(zBuf);
3471   return rc;
34743472}
34753473
34763474/*
34773475** Show available command line options
34783476*/
3479static const char zOptions[] =
3480  "   -bail                stop after hitting an error\n"
3481  "   -batch               force batch I/O\n"
3482  "   -column              set output mode to 'column'\n"
3483  "   -cmd COMMAND         run \"COMMAND\" before reading stdin\n"
3484  "   -csv                 set output mode to 'csv'\n"
3485  "   -echo                print commands before execution\n"
3486  "   -init FILENAME       read/process named file\n"
3487  "   -[no]header          turn headers on or off\n"
3477static const char zOptions[] =
3478   "   -bail                stop after hitting an error\n"
3479   "   -batch               force batch I/O\n"
3480   "   -column              set output mode to 'column'\n"
3481   "   -cmd COMMAND         run \"COMMAND\" before reading stdin\n"
3482   "   -csv                 set output mode to 'csv'\n"
3483   "   -echo                print commands before execution\n"
3484   "   -init FILENAME       read/process named file\n"
3485   "   -[no]header          turn headers on or off\n"
34883486#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
3489  "   -heap SIZE           Size of heap for memsys3 or memsys5\n"
3487   "   -heap SIZE           Size of heap for memsys3 or memsys5\n"
34903488#endif
3491  "   -help                show this message\n"
3492  "   -html                set output mode to HTML\n"
3493  "   -interactive         force interactive I/O\n"
3494  "   -line                set output mode to 'line'\n"
3495  "   -list                set output mode to 'list'\n"
3496  "   -mmap N              default mmap size set to N\n"
3489   "   -help                show this message\n"
3490   "   -html                set output mode to HTML\n"
3491   "   -interactive         force interactive I/O\n"
3492   "   -line                set output mode to 'line'\n"
3493   "   -list                set output mode to 'list'\n"
3494   "   -mmap N              default mmap size set to N\n"
34973495#ifdef SQLITE_ENABLE_MULTIPLEX
3498  "   -multiplex           enable the multiplexor VFS\n"
3496   "   -multiplex           enable the multiplexor VFS\n"
34993497#endif
3500  "   -nullvalue TEXT      set text string for NULL values. Default ''\n"
3501  "   -separator SEP       set output field separator. Default: '|'\n"
3502  "   -stats               print memory stats before each finalize\n"
3503  "   -version             show SQLite version\n"
3504  "   -vfs NAME            use NAME as the default VFS\n"
3498   "   -nullvalue TEXT      set text string for NULL values. Default ''\n"
3499   "   -separator SEP       set output field separator. Default: '|'\n"
3500   "   -stats               print memory stats before each finalize\n"
3501   "   -version             show SQLite version\n"
3502   "   -vfs NAME            use NAME as the default VFS\n"
35053503#ifdef SQLITE_ENABLE_VFSTRACE
3506  "   -vfstrace            enable tracing of all VFS calls\n"
3504   "   -vfstrace            enable tracing of all VFS calls\n"
35073505#endif
35083506;
35093507static void usage(int showDetail){
3510  fprintf(stderr,
3511      "Usage: %s [OPTIONS] FILENAME [SQL]\n" 
3512      "FILENAME is the name of an SQLite database. A new database is created\n"
3513      "if the file does not previously exist.\n", Argv0);
3514  if( showDetail ){
3515    fprintf(stderr, "OPTIONS include:\n%s", zOptions);
3516  }else{
3517    fprintf(stderr, "Use the -help option for additional information\n");
3518  }
3519  exit(1);
3508   fprintf(stderr,
3509      "Usage: %s [OPTIONS] FILENAME [SQL]\n"
3510      "FILENAME is the name of an SQLite database. A new database is created\n"
3511      "if the file does not previously exist.\n", Argv0);
3512   if( showDetail ){
3513   fprintf(stderr, "OPTIONS include:\n%s", zOptions);
3514   }else{
3515   fprintf(stderr, "Use the -help option for additional information\n");
3516   }
3517   exit(1);
35203518}
35213519
35223520/*
35233521** Initialize the state information in data
35243522*/
35253523static void main_init(struct callback_data *data) {
3526  memset(data, 0, sizeof(*data));
3527  data->mode = MODE_List;
3528  memcpy(data->separator,"|", 2);
3529  data->showHeader = 0;
3530  sqlite3_config(SQLITE_CONFIG_URI, 1);
3531  sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
3532  sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
3533  sqlite3_snprintf(sizeof(continuePrompt), continuePrompt,"   ...> ");
3534  sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
3524   memset(data, 0, sizeof(*data));
3525   data->mode = MODE_List;
3526   memcpy(data->separator,"|", 2);
3527   data->showHeader = 0;
3528   sqlite3_config(SQLITE_CONFIG_URI, 1);
3529   sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
3530   sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
3531   sqlite3_snprintf(sizeof(continuePrompt), continuePrompt,"   ...> ");
3532   sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
35353533}
35363534
35373535/*
r31373r31374
35393537*/
35403538#ifdef _WIN32
35413539static void printBold(const char *zText){
3542  HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
3543  CONSOLE_SCREEN_BUFFER_INFO defaultScreenInfo;
3544  GetConsoleScreenBufferInfo(out, &defaultScreenInfo);
3545  SetConsoleTextAttribute(out,
3546         FOREGROUND_RED|FOREGROUND_INTENSITY
3547  );
3548  printf("%s", zText);
3549  SetConsoleTextAttribute(out, defaultScreenInfo.wAttributes);
3540   HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
3541   CONSOLE_SCREEN_BUFFER_INFO defaultScreenInfo;
3542   GetConsoleScreenBufferInfo(out, &defaultScreenInfo);
3543   SetConsoleTextAttribute(out,
3544         FOREGROUND_RED|FOREGROUND_INTENSITY
3545   );
3546   printf("%s", zText);
3547   SetConsoleTextAttribute(out, defaultScreenInfo.wAttributes);
35503548}
35513549#else
35523550static void printBold(const char *zText){
3553  printf("\033[1m%s\033[0m", zText);
3551   printf("\033[1m%s\033[0m", zText);
35543552}
35553553#endif
35563554
r31373r31374
35593557** is available.
35603558*/
35613559static char *cmdline_option_value(int argc, char **argv, int i){
3562  if( i==argc ){
3563    fprintf(stderr, "%s: Error: missing argument to %s\n",
3564            argv[0], argv[argc-1]);
3565    exit(1);
3566  }
3567  return argv[i];
3560   if( i==argc ){
3561   fprintf(stderr, "%s: Error: missing argument to %s\n",
3562         argv[0], argv[argc-1]);
3563   exit(1);
3564   }
3565   return argv[i];
35683566}
35693567
35703568int main(int argc, char **argv){
3571  char *zErrMsg = 0;
3572  struct callback_data data;
3573  const char *zInitFile = 0;
3574  char *zFirstCmd = 0;
3575  int i;
3576  int rc = 0;
3577  int warnInmemoryDb = 0;
3569   char *zErrMsg = 0;
3570   struct callback_data data;
3571   const char *zInitFile = 0;
3572   char *zFirstCmd = 0;
3573   int i;
3574   int rc = 0;
3575   int warnInmemoryDb = 0;
35783576
35793577#if USE_SYSTEM_SQLITE+0!=1
3580  if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
3581    fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
3582            sqlite3_sourceid(), SQLITE_SOURCE_ID);
3583    exit(1);
3584  }
3578   if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
3579   fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
3580         sqlite3_sourceid(), SQLITE_SOURCE_ID);
3581   exit(1);
3582   }
35853583#endif
3586  Argv0 = argv[0];
3587  main_init(&data);
3588  stdin_is_interactive = isatty(0);
3584   Argv0 = argv[0];
3585   main_init(&data);
3586   stdin_is_interactive = isatty(0);
35893587
3590  /* Make sure we have a valid signal handler early, before anything
3591  ** else is done.
3592  */
3588   /* Make sure we have a valid signal handler early, before anything
3589   ** else is done.
3590   */
35933591#ifdef SIGINT
3594  signal(SIGINT, interrupt_handler);
3592   signal(SIGINT, interrupt_handler);
35953593#endif
35963594
3597  /* Do an initial pass through the command-line argument to locate
3598  ** the name of the database file, the name of the initialization file,
3599  ** the size of the alternative malloc heap,
3600  ** and the first command to execute.
3601  */
3602  for(i=1; i<argc; i++){
3603    char *z;
3604    z = argv[i];
3605    if( z[0]!='-' ){
3606      if( data.zDbFilename==0 ){
3607        data.zDbFilename = z;
3608        continue;
3609      }
3610      if( zFirstCmd==0 ){
3611        zFirstCmd = z;
3612        continue;
3613      }
3614      fprintf(stderr,"%s: Error: too many options: \"%s\"\n", Argv0, argv[i]);
3615      fprintf(stderr,"Use -help for a list of options.\n");
3616      return 1;
3617    }
3618    if( z[1]=='-' ) z++;
3619    if( strcmp(z,"-separator")==0
3620     || strcmp(z,"-nullvalue")==0
3621     || strcmp(z,"-cmd")==0
3622    ){
3623      (void)cmdline_option_value(argc, argv, ++i);
3624    }else if( strcmp(z,"-init")==0 ){
3625      zInitFile = cmdline_option_value(argc, argv, ++i);
3626    }else if( strcmp(z,"-batch")==0 ){
3627      /* Need to check for batch mode here to so we can avoid printing
3628      ** informational messages (like from process_sqliterc) before
3629      ** we do the actual processing of arguments later in a second pass.
3630      */
3631      stdin_is_interactive = 0;
3632    }else if( strcmp(z,"-heap")==0 ){
3595   /* Do an initial pass through the command-line argument to locate
3596   ** the name of the database file, the name of the initialization file,
3597   ** the size of the alternative malloc heap,
3598   ** and the first command to execute.
3599   */
3600   for(i=1; i<argc; i++){
3601   char *z;
3602   z = argv[i];
3603   if( z[0]!='-' ){
3604      if( data.zDbFilename==0 ){
3605      data.zDbFilename = z;
3606      continue;
3607      }
3608      if( zFirstCmd==0 ){
3609      zFirstCmd = z;
3610      continue;
3611      }
3612      fprintf(stderr,"%s: Error: too many options: \"%s\"\n", Argv0, argv[i]);
3613      fprintf(stderr,"Use -help for a list of options.\n");
3614      return 1;
3615   }
3616   if( z[1]=='-' ) z++;
3617   if( strcmp(z,"-separator")==0
3618      || strcmp(z,"-nullvalue")==0
3619      || strcmp(z,"-cmd")==0
3620   ){
3621      (void)cmdline_option_value(argc, argv, ++i);
3622   }else if( strcmp(z,"-init")==0 ){
3623      zInitFile = cmdline_option_value(argc, argv, ++i);
3624   }else if( strcmp(z,"-batch")==0 ){
3625      /* Need to check for batch mode here to so we can avoid printing
3626      ** informational messages (like from process_sqliterc) before
3627      ** we do the actual processing of arguments later in a second pass.
3628      */
3629      stdin_is_interactive = 0;
3630   }else if( strcmp(z,"-heap")==0 ){
36333631#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
3634      const char *zSize;
3635      sqlite3_int64 szHeap;
3632      const char *zSize;
3633      sqlite3_int64 szHeap;
36363634
3637      zSize = cmdline_option_value(argc, argv, ++i);
3638      szHeap = integerValue(zSize);
3639      if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
3640      sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
3635      zSize = cmdline_option_value(argc, argv, ++i);
3636      szHeap = integerValue(zSize);
3637      if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
3638      sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
36413639#endif
36423640#ifdef SQLITE_ENABLE_VFSTRACE
3643    }else if( strcmp(z,"-vfstrace")==0 ){
3644      extern int vfstrace_register(
3645         const char *zTraceName,
3646         const char *zOldVfsName,
3647         int (*xOut)(const char*,void*),
3648         void *pOutArg,
3649         int makeDefault
3650      );
3651      vfstrace_register("trace",0,(int(*)(const char*,void*))fputs,stderr,1);
3641   }else if( strcmp(z,"-vfstrace")==0 ){
3642      extern int vfstrace_register(
3643         const char *zTraceName,
3644         const char *zOldVfsName,
3645         int (*xOut)(const char*,void*),
3646         void *pOutArg,
3647         int makeDefault
3648      );
3649      vfstrace_register("trace",0,(int(*)(const char*,void*))fputs,stderr,1);
36523650#endif
36533651#ifdef SQLITE_ENABLE_MULTIPLEX
3654    }else if( strcmp(z,"-multiplex")==0 ){
3655      extern int sqlite3_multiple_initialize(const char*,int);
3656      sqlite3_multiplex_initialize(0, 1);
3652   }else if( strcmp(z,"-multiplex")==0 ){
3653      extern int sqlite3_multiple_initialize(const char*,int);
3654      sqlite3_multiplex_initialize(0, 1);
36573655#endif
3658    }else if( strcmp(z,"-mmap")==0 ){
3659      sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
3660      sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
3661    }else if( strcmp(z,"-vfs")==0 ){
3662      sqlite3_vfs *pVfs = sqlite3_vfs_find(cmdline_option_value(argc,argv,++i));
3663      if( pVfs ){
3664        sqlite3_vfs_register(pVfs, 1);
3665      }else{
3666        fprintf(stderr, "no such VFS: \"%s\"\n", argv[i]);
3667        exit(1);
3668      }
3669    }
3670  }
3671  if( data.zDbFilename==0 ){
3656   }else if( strcmp(z,"-mmap")==0 ){
3657      sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
3658      sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
3659   }else if( strcmp(z,"-vfs")==0 ){
3660      sqlite3_vfs *pVfs = sqlite3_vfs_find(cmdline_option_value(argc,argv,++i));
3661      if( pVfs ){
3662      sqlite3_vfs_register(pVfs, 1);
3663      }else{
3664      fprintf(stderr, "no such VFS: \"%s\"\n", argv[i]);
3665      exit(1);
3666      }
3667   }
3668   }
3669   if( data.zDbFilename==0 ){
36723670#ifndef SQLITE_OMIT_MEMORYDB
3673    data.zDbFilename = ":memory:";
3674    warnInmemoryDb = argc==1;
3671   data.zDbFilename = ":memory:";
3672   warnInmemoryDb = argc==1;
36753673#else
3676    fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
3677    return 1;
3674   fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
3675   return 1;
36783676#endif
36793677#ifdef SQLITE_SHELL_DBNAME_PROC
3680    { extern void SQLITE_SHELL_DBNAME_PROC(const char**);
3681      SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename);
3682      warnInmemoryDb = 0; }
3678   { extern void SQLITE_SHELL_DBNAME_PROC(const char**);
3679      SQLITE_SHELL_DBNAME_PROC(&data.zDbFilename);
3680      warnInmemoryDb = 0; }
36833681#endif
3684  }
3685  data.out = stdout;
3682   }
3683   data.out = stdout;
36863684
3687  /* Go ahead and open the database file if it already exists.  If the
3688  ** file does not exist, delay opening it.  This prevents empty database
3689  ** files from being created if a user mistypes the database name argument
3690  ** to the sqlite command-line tool.
3691  */
3692  if( access(data.zDbFilename, 0)==0 ){
3693    open_db(&data, 0);
3694  }
3685   /* Go ahead and open the database file if it already exists.  If the
3686   ** file does not exist, delay opening it.  This prevents empty database
3687   ** files from being created if a user mistypes the database name argument
3688   ** to the sqlite command-line tool.
3689   */
3690   if( access(data.zDbFilename, 0)==0 ){
3691   open_db(&data, 0);
3692   }
36953693
3696  /* Process the initialization file if there is one.  If no -init option
3697  ** is given on the command line, look for a file named ~/.sqliterc and
3698  ** try to process it.
3699  */
3700  rc = process_sqliterc(&data,zInitFile);
3701  if( rc>0 ){
3702    return rc;
3703  }
3694   /* Process the initialization file if there is one.  If no -init option
3695   ** is given on the command line, look for a file named ~/.sqliterc and
3696   ** try to process it.
3697   */
3698   rc = process_sqliterc(&data,zInitFile);
3699   if( rc>0 ){
3700   return rc;
3701   }
37043702
3705  /* Make a second pass through the command-line argument and set
3706  ** options.  This second pass is delayed until after the initialization
3707  ** file is processed so that the command-line arguments will override
3708  ** settings in the initialization file.
3709  */
3710  for(i=1; i<argc; i++){
3711    char *z = argv[i];
3712    if( z[0]!='-' ) continue;
3713    if( z[1]=='-' ){ z++; }
3714    if( strcmp(z,"-init")==0 ){
3715      i++;
3716    }else if( strcmp(z,"-html")==0 ){
3717      data.mode = MODE_Html;
3718    }else if( strcmp(z,"-list")==0 ){
3719      data.mode = MODE_List;
3720    }else if( strcmp(z,"-line")==0 ){
3721      data.mode = MODE_Line;
3722    }else if( strcmp(z,"-column")==0 ){
3723      data.mode = MODE_Column;
3724    }else if( strcmp(z,"-csv")==0 ){
3725      data.mode = MODE_Csv;
3726      memcpy(data.separator,",",2);
3727    }else if( strcmp(z,"-separator")==0 ){
3728      sqlite3_snprintf(sizeof(data.separator), data.separator,
3729                       "%s",cmdline_option_value(argc,argv,++i));
3730    }else if( strcmp(z,"-nullvalue")==0 ){
3731      sqlite3_snprintf(sizeof(data.nullvalue), data.nullvalue,
3732                       "%s",cmdline_option_value(argc,argv,++i));
3733    }else if( strcmp(z,"-header")==0 ){
3734      data.showHeader = 1;
3735    }else if( strcmp(z,"-noheader")==0 ){
3736      data.showHeader = 0;
3737    }else if( strcmp(z,"-echo")==0 ){
3738      data.echoOn = 1;
3739    }else if( strcmp(z,"-eqp")==0 ){
3740      data.autoEQP = 1;
3741    }else if( strcmp(z,"-stats")==0 ){
3742      data.statsOn = 1;
3743    }else if( strcmp(z,"-bail")==0 ){
3744      bail_on_error = 1;
3745    }else if( strcmp(z,"-version")==0 ){
3746      printf("%s %s\n", sqlite3_libversion(), sqlite3_sourceid());
3747      return 0;
3748    }else if( strcmp(z,"-interactive")==0 ){
3749      stdin_is_interactive = 1;
3750    }else if( strcmp(z,"-batch")==0 ){
3751      stdin_is_interactive = 0;
3752    }else if( strcmp(z,"-heap")==0 ){
3753      i++;
3754    }else if( strcmp(z,"-mmap")==0 ){
3755      i++;
3756    }else if( strcmp(z,"-vfs")==0 ){
3757      i++;
3703   /* Make a second pass through the command-line argument and set
3704   ** options.  This second pass is delayed until after the initialization
3705   ** file is processed so that the command-line arguments will override
3706   ** settings in the initialization file.
3707   */
3708   for(i=1; i<argc; i++){
3709   char *z = argv[i];
3710   if( z[0]!='-' ) continue;
3711   if( z[1]=='-' ){ z++; }
3712   if( strcmp(z,"-init")==0 ){
3713      i++;
3714   }else if( strcmp(z,"-html")==0 ){
3715      data.mode = MODE_Html;
3716   }else if( strcmp(z,"-list")==0 ){
3717      data.mode = MODE_List;
3718   }else if( strcmp(z,"-line")==0 ){
3719      data.mode = MODE_Line;
3720   }else if( strcmp(z,"-column")==0 ){
3721      data.mode = MODE_Column;
3722   }else if( strcmp(z,"-csv")==0 ){
3723      data.mode = MODE_Csv;
3724      memcpy(data.separator,",",2);
3725   }else if( strcmp(z,"-separator")==0 ){
3726      sqlite3_snprintf(sizeof(data.separator), data.separator,
3727                  "%s",cmdline_option_value(argc,argv,++i));
3728   }else if( strcmp(z,"-nullvalue")==0 ){
3729      sqlite3_snprintf(sizeof(data.nullvalue), data.nullvalue,
3730                  "%s",cmdline_option_value(argc,argv,++i));
3731   }else if( strcmp(z,"-header")==0 ){
3732      data.showHeader = 1;
3733   }else if( strcmp(z,"-noheader")==0 ){
3734      data.showHeader = 0;
3735   }else if( strcmp(z,"-echo")==0 ){
3736      data.echoOn = 1;
3737   }else if( strcmp(z,"-eqp")==0 ){
3738      data.autoEQP = 1;
3739   }else if( strcmp(z,"-stats")==0 ){
3740      data.statsOn = 1;
3741   }else if( strcmp(z,"-bail")==0 ){
3742      bail_on_error = 1;
3743   }else if( strcmp(z,"-version")==0 ){
3744      printf("%s %s\n", sqlite3_libversion(), sqlite3_sourceid());
3745      return 0;
3746   }else if( strcmp(z,"-interactive")==0 ){
3747      stdin_is_interactive = 1;
3748   }else if( strcmp(z,"-batch")==0 ){
3749      stdin_is_interactive = 0;
3750   }else if( strcmp(z,"-heap")==0 ){
3751      i++;
3752   }else if( strcmp(z,"-mmap")==0 ){
3753      i++;
3754   }else if( strcmp(z,"-vfs")==0 ){
3755      i++;
37583756#ifdef SQLITE_ENABLE_VFSTRACE
3759    }else if( strcmp(z,"-vfstrace")==0 ){
3760      i++;
3757   }else if( strcmp(z,"-vfstrace")==0 ){
3758      i++;
37613759#endif
37623760#ifdef SQLITE_ENABLE_MULTIPLEX
3763    }else if( strcmp(z,"-multiplex")==0 ){
3764      i++;
3761   }else if( strcmp(z,"-multiplex")==0 ){
3762      i++;
37653763#endif
3766    }else if( strcmp(z,"-help")==0 ){
3767      usage(1);
3768    }else if( strcmp(z,"-cmd")==0 ){
3769      if( i==argc-1 ) break;
3770      z = cmdline_option_value(argc,argv,++i);
3771      if( z[0]=='.' ){
3772        rc = do_meta_command(z, &data);
3773        if( rc && bail_on_error ) return rc==2 ? 0 : rc;
3774      }else{
3775        open_db(&data, 0);
3776        rc = shell_exec(data.db, z, shell_callback, &data, &zErrMsg);
3777        if( zErrMsg!=0 ){
3778          fprintf(stderr,"Error: %s\n", zErrMsg);
3779          if( bail_on_error ) return rc!=0 ? rc : 1;
3780        }else if( rc!=0 ){
3781          fprintf(stderr,"Error: unable to process SQL \"%s\"\n", z);
3782          if( bail_on_error ) return rc;
3783        }
3784      }
3785    }else{
3786      fprintf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
3787      fprintf(stderr,"Use -help for a list of options.\n");
3788      return 1;
3789    }
3790  }
3764   }else if( strcmp(z,"-help")==0 ){
3765      usage(1);
3766   }else if( strcmp(z,"-cmd")==0 ){
3767      if( i==argc-1 ) break;
3768      z = cmdline_option_value(argc,argv,++i);
3769      if( z[0]=='.' ){
3770      rc = do_meta_command(z, &data);
3771      if( rc && bail_on_error ) return rc==2 ? 0 : rc;
3772      }else{
3773      open_db(&data, 0);
3774      rc = shell_exec(data.db, z, shell_callback, &data, &zErrMsg);
3775      if( zErrMsg!=0 ){
3776         fprintf(stderr,"Error: %s\n", zErrMsg);
3777         if( bail_on_error ) return rc!=0 ? rc : 1;
3778      }else if( rc!=0 ){
3779         fprintf(stderr,"Error: unable to process SQL \"%s\"\n", z);
3780         if( bail_on_error ) return rc;
3781      }
3782      }
3783   }else{
3784      fprintf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
3785      fprintf(stderr,"Use -help for a list of options.\n");
3786      return 1;
3787   }
3788   }
37913789
3792  if( zFirstCmd ){
3793    /* Run just the command that follows the database name
3794    */
3795    if( zFirstCmd[0]=='.' ){
3796      rc = do_meta_command(zFirstCmd, &data);
3797      if( rc==2 ) rc = 0;
3798    }else{
3799      open_db(&data, 0);
3800      rc = shell_exec(data.db, zFirstCmd, shell_callback, &data, &zErrMsg);
3801      if( zErrMsg!=0 ){
3802        fprintf(stderr,"Error: %s\n", zErrMsg);
3803        return rc!=0 ? rc : 1;
3804      }else if( rc!=0 ){
3805        fprintf(stderr,"Error: unable to process SQL \"%s\"\n", zFirstCmd);
3806        return rc;
3807      }
3808    }
3809  }else{
3810    /* Run commands received from standard input
3811    */
3812    if( stdin_is_interactive ){
3813      char *zHome;
3814      char *zHistory = 0;
3815      int nHistory;
3816      printf(
3817        "SQLite version %s %.19s\n" /*extra-version-info*/
3818        "Enter \".help\" for usage hints.\n",
3819        sqlite3_libversion(), sqlite3_sourceid()
3820      );
3821      if( warnInmemoryDb ){
3822        printf("Connected to a ");
3823        printBold("transient in-memory database");
3824        printf(".\nUse \".open FILENAME\" to reopen on a "
3825               "persistent database.\n");
3826      }
3827      zHome = find_home_dir();
3828      if( zHome ){
3829        nHistory = strlen30(zHome) + 20;
3830        if( (zHistory = (char *)malloc(nHistory))!=0 ){
3831          sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
3832        }
3833      }
3790   if( zFirstCmd ){
3791   /* Run just the command that follows the database name
3792   */
3793   if( zFirstCmd[0]=='.' ){
3794      rc = do_meta_command(zFirstCmd, &data);
3795      if( rc==2 ) rc = 0;
3796   }else{
3797      open_db(&data, 0);
3798      rc = shell_exec(data.db, zFirstCmd, shell_callback, &data, &zErrMsg);
3799      if( zErrMsg!=0 ){
3800      fprintf(stderr,"Error: %s\n", zErrMsg);
3801      return rc!=0 ? rc : 1;
3802      }else if( rc!=0 ){
3803      fprintf(stderr,"Error: unable to process SQL \"%s\"\n", zFirstCmd);
3804      return rc;
3805      }
3806   }
3807   }else{
3808   /* Run commands received from standard input
3809   */
3810   if( stdin_is_interactive ){
3811      char *zHome;
3812      char *zHistory = 0;
3813      int nHistory;
3814      printf(
3815      "SQLite version %s %.19s\n" /*extra-version-info*/
3816      "Enter \".help\" for usage hints.\n",
3817      sqlite3_libversion(), sqlite3_sourceid()
3818      );
3819      if( warnInmemoryDb ){
3820      printf("Connected to a ");
3821      printBold("transient in-memory database");
3822      printf(".\nUse \".open FILENAME\" to reopen on a "
3823            "persistent database.\n");
3824      }
3825      zHome = find_home_dir();
3826      if( zHome ){
3827      nHistory = strlen30(zHome) + 20;
3828      if( (zHistory = (char *)malloc(nHistory))!=0 ){
3829         sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
3830      }
3831      }
38343832#if defined(HAVE_READLINE)
3835      if( zHistory ) read_history(zHistory);
3833      if( zHistory ) read_history(zHistory);
38363834#endif
3837      rc = process_input(&data, 0);
3838      if( zHistory ){
3839        stifle_history(100);
3840        write_history(zHistory);
3841        free(zHistory);
3842      }
3843    }else{
3844      rc = process_input(&data, stdin);
3845    }
3846  }
3847  set_table_name(&data, 0);
3848  if( data.db ){
3849    sqlite3_close(data.db);
3850  }
3851  sqlite3_free(data.zFreeOnClose);
3852  return rc;
3853}
No newline at end of file
3835      rc = process_input(&data, 0);
3836      if( zHistory ){
3837      stifle_history(100);
3838      write_history(zHistory);
3839      free(zHistory);
3840      }
3841   }else{
3842      rc = process_input(&data, stdin);
3843   }
3844   }
3845   set_table_name(&data, 0);
3846   if( data.db ){
3847   sqlite3_close(data.db);
3848   }
3849   sqlite3_free(data.zFreeOnClose);
3850   return rc;
3851}
trunk/src/lib/formats/msx_dsk.c
r31373r31374
7171};
7272
7373const floppy_format_type FLOPPY_MSX_FORMAT = &floppy_image_format_creator<msx_format>;
74
trunk/src/lib/formats/ap2_dsk.c
r31373r31374
520520
521521****************************************************************************/
522522
523static const UINT8 dos_skewing[] =
523static const UINT8 dos_skewing[] =
524524{
525525   0x00, 0x07, 0x0E, 0x06, 0x0D, 0x05, 0x0C, 0x04,
526526   0x0B, 0x03, 0x0A, 0x02, 0x09, 0x01, 0x08, 0x0F
r31373r31374
623623         if (!memcmp("PRODOS", &sector_data[0x103], 6))
624624         {
625625            m_prodos_order = true;
626         }   // check for ProDOS order SOS disk
627         else if (!memcmp(sos_block1, &sector_data[0x100], 4))
626         }   // check for ProDOS order SOS disk
627         else if (!memcmp(sos_block1, &sector_data[0x100], 4))
628628         {
629629            m_prodos_order = true;
630         }   // check for Apple III A2 emulator disk in ProDOS order
631         else if (!memcmp(a3a2emul_block1, &sector_data[0x100], 6))
630         }   // check for Apple III A2 emulator disk in ProDOS order
631         else if (!memcmp(a3a2emul_block1, &sector_data[0x100], 6))
632632         {
633633            m_prodos_order = true;
634         }   // check for PCPI Applicard software in ProDOS order
635         else if (!memcmp("COPYRIGHT (C) 1979, DIGITAL RESEARCH", &sector_data[0x118], 36))
634         }   // check for PCPI Applicard software in ProDOS order
635         else if (!memcmp("COPYRIGHT (C) 1979, DIGITAL RESEARCH", &sector_data[0x118], 36))
636636         {
637637            printf("PCPI detected\n");
638638            m_prodos_order = true;
r31373r31374
646646            {
647647               m_prodos_order = true;
648648            }
649         }   // check for DOS 3.3 disks in ProDOS order
649         }   // check for DOS 3.3 disks in ProDOS order
650650         else if (!memcmp(dos33_block1, &sector_data[0x100], 4))
651651         {
652652            m_prodos_order = true;
r31373r31374
692692               nval = sdata[i - 0x56] >> 2;
693693            else {
694694               nval =
695                  ((sdata[i+0x00] & 0x01) << 1) |
696                  ((sdata[i+0x00] & 0x02) >> 1) |
697                  ((sdata[i+0x56] & 0x01) << 3) |
695                  ((sdata[i+0x00] & 0x01) << 1) |
696                  ((sdata[i+0x00] & 0x02) >> 1) |
697                  ((sdata[i+0x56] & 0x01) << 3) |
698698                  ((sdata[i+0x56] & 0x02) << 1);
699699               if(i < 256-0xac)
700700                  nval |=
701                     ((sdata[i+0xac] & 0x01) << 5) |
701                     ((sdata[i+0xac] & 0x01) << 5) |
702702                     ((sdata[i+0xac] & 0x02) << 3);
703703            }
704704            raw_w(track_data, offset, 8, translate6[nval ^ pval]);
r31373r31374
711711      assert(offset == 51090);
712712
713713      generate_track_from_levels(track, 0, track_data, 51090, 0, image);
714   }         
714   }
715715   return true;
716716}
717717
r31373r31374
789789            int dosver = 0; // apple dos version; 0 = >=3.3, 1 = <3.3
790790            for(;;) {
791791                  UINT8 v = gb(buf, ts, pos, wrap);
792                  if(v == 0xff)            {
792                  if(v == 0xff)               {
793793                        hb = 1;
794794                     }
795795                     else if(hb == 1 && v == 0xd5){
r31373r31374
852852
853853                                    if (m_prodos_order)
854854                                    {
855                                       dest = sectdata+(256)*prodos_skewing[se];
855                                       dest = sectdata+(256)*prodos_skewing[se];
856856                                    }
857857                                    else
858858                                    {
859                                       dest = sectdata+(256)*dos_skewing[se];
859                                       dest = sectdata+(256)*dos_skewing[se];
860860                                    }
861861
862862                                    // first read in sector and decode to 6bit form
trunk/src/lib/formats/rx50_dsk.c
r31373r31374
11/**********************************************************************
22
3   formats/rx50_dsk.c
4   Floppies used by Rainbow 100 and 190.
3    formats/rx50_dsk.c
4    Floppies used by Rainbow 100 and 190.
55
6   The RX50 drive: 5.25" format; 300 rpm; MFM 250 kbps; 96 - 100 tpi
7   - single sided with two disk slots (1 drive motor served both).
6    The RX50 drive: 5.25" format; 300 rpm; MFM 250 kbps; 96 - 100 tpi
7    - single sided with two disk slots (1 drive motor served both).
88
9   DEC used the RX50 in entirely different architectures (Pro / PDP-11).
10   Native Rainbow 100 format:
11   - SSQD - 80 tracks with 10 sectors per track (512 byte sectors)
12   - first two tracks are reserved for loader code (DOS / CPM / custom)
13   - FAT and root directory began immediately on track 2.
14   - 2:1 sector interleave pattern - except in tracks 0 and 1.
15   NOTE: PUTR tends to interleave loader tracks 0 + 1. Not recommended!
9    DEC used the RX50 in entirely different architectures (Pro / PDP-11).
10    Native Rainbow 100 format:
11    - SSQD - 80 tracks with 10 sectors per track (512 byte sectors)
12    - first two tracks are reserved for loader code (DOS / CPM / custom)
13    - FAT and root directory began immediately on track 2.
14    - 2:1 sector interleave pattern - except in tracks 0 and 1.
15    NOTE: PUTR tends to interleave loader tracks 0 + 1. Not recommended!
1616
17   Jeff's RBIMG is first choice for preservation, TeleDisk is second.
18   Always check the track layout. Both have problems with weak disks.
17    Jeff's RBIMG is first choice for preservation, TeleDisk is second.
18    Always check the track layout. Both have problems with weak disks.
1919
20   A container to handle copy protected RX 50 disks is needed. Some info
21   can be derived from Mark Hittinger's RBACKUP (CP/M source from Nov-94).
20    A container to handle copy protected RX 50 disks is needed. Some info
21    can be derived from Mark Hittinger's RBACKUP (CP/M source from Nov-94).
2222
23   TODO: improve code to accept 40 T / single sided / 9 or 8 sector disks:
24     a) disks from VT180 (9 sectors; READ ONLY - enforced by BIOS)
23    TODO: improve code to accept 40 T / single sided / 9 or 8 sector disks:
24      a) disks from VT180 (9 sectors; READ ONLY - enforced by BIOS)
2525
26     b) 8 sector 160k MS-DOS disks (READ + WRITE support on DEC)
27        FORMAT A: /F:160 on DOS; turn MEDIACHK ON
26      b) 8 sector 160k MS-DOS disks (READ + WRITE support on DEC)
27         FORMAT A: /F:160 on DOS; turn MEDIACHK ON
2828************************************************************************/
2929
3030#include "emu.h"
r31373r31374
4040   {   MFM, 0x4e, 80 },          // (*)   GAP (1)
4141   {   MFM, 0x00, 12 },          // Value from (*). (?? = unverified)
4242   {   RAW, 0x5224, 3 },
43   {   MFM, 0xfc, 1 },
44   {   MFM, 0x4e, 50 },
43   {   MFM, 0xfc, 1 },
44   {   MFM, 0x4e, 50 },
4545   { MFM, 0x00, 12 },
46   { SECTOR_LOOP_START, 0, 9 }, // 0 ... f.sector_count-1 
46   { SECTOR_LOOP_START, 0, 9 }, // 0 ... f.sector_count-1
4747   {   CRC_CCITT_START, 1 },
48   {     RAW, 0x4489, 3 },
49   {     MFM, 0xfe, 1 },   
48   {     RAW, 0x4489, 3 },
49   {     MFM, 0xfe, 1 },
5050   {     TRACK_ID },
5151   {     HEAD_ID },
5252   {     SECTOR_ID },
5353   {     SIZE_ID },
5454   {   CRC_END, 1 },
5555   {   CRC, 1 },
56   {   MFM, 0x4e, 22 },   // (*) POST-ID GAP (2)
57   {   MFM, 0x00, 12 },   // (*)
56   {   MFM, 0x4e, 22 },    // (*) POST-ID GAP (2)
57   {   MFM, 0x00, 12 },    // (*)
5858   {   CRC_CCITT_START, 2 },
59   {     RAW, 0x4489, 3 },
60   {     MFM, 0xfb, 1 },   
59   {     RAW, 0x4489, 3 },
60   {     MFM, 0xfb, 1 },
6161   {     SECTOR_DATA, -1 },
6262   {   CRC_END, 2 },
6363   {   CRC, 2 },
64   {   MFM, 0x4e, 48 },   // GAP (3) - taken from RBACKUP source.
64   {   MFM, 0x4e, 48 },    // GAP (3) - taken from RBACKUP source.
6565   {   MFM, 0x00, 12 },
66   { SECTOR_LOOP_END },     
66   { SECTOR_LOOP_END },
6767   { MFM, 0x4e, 1 },    // UNVERIFIED - ('esq_16' has 170 x $4e)
6868   { END }
6969};
r31373r31374
7878}
7979
8080const char *rx50img_format::description() const
81{
81{
8282   return "DEC Rainbow 100 floppy image";
8383}
8484
r31373r31374
106106   if (size == expected_size) // standard format has 409600 byte
107107      return;
108108/*
109   track_count = 40;
110   sector_count = 9; // [VT 180]
111   expected_size = 512 * track_count * head_count * sector_count;
112   if (size == expected_size)
113      return;
109    track_count = 40;
110    sector_count = 9; // [VT 180]
111    expected_size = 512 * track_count * head_count * sector_count;
112    if (size == expected_size)
113        return;
114114
115   track_count = 40;
116   sector_count = 8; // [DOS]
117   expected_size = 512 * track_count * head_count * sector_count;
118   if (size == expected_size)
119      return;
115    track_count = 40;
116    sector_count = 8; // [DOS]
117    expected_size = 512 * track_count * head_count * sector_count;
118    if (size == expected_size)
119        return;
120120*/
121121   track_count = head_count = sector_count = 0;
122122}
r31373r31374
131131   return 0;
132132}
133133
134 //  /* Sectors are numbered 1 to 10 */
134   //  /* Sectors are numbered 1 to 10 */
135135bool rx50img_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
136136{
137137   UINT8 track_count, head_count, sector_count;
r31373r31374
173173      head_count = 1;
174174
175175   if(sector_count == 9) // [VT180] 9 sector format : no save!
176      return false;
176      return false;
177177
178178   if(sector_count != 10) // either 8 or 10 sectors
179      sector_count = 10; // [STANDARD]
179      sector_count = 10; // [STANDARD]
180180
181181   /*
182182   if(sector_count != 10) // either 8 or 10 sectors
183183   {
184     if(sector_count == 8)   
184     if(sector_count == 8)
185185     {
186        track_count = 40;  // [DOS]
186         track_count = 40;  // [DOS]
187187     } else
188188     {
189         sector_count = 10; // [STANDARD]
189         sector_count = 10; // [STANDARD]
190190     }
191191   }
192192*/
r31373r31374
213213// The BIOS can also * read * VT-180 disks and access MS-DOS 160 k disks (R + W)
214214// ( 40 tracks; single sided with 9 or 8 sectors per track )
215215static LEGACY_FLOPPY_OPTIONS_START( dec100_floppy )
216   LEGACY_FLOPPY_OPTION( dec100_floppy, "td0", "Teledisk floppy disk image", td0_dsk_identify, td0_dsk_construct, td0_dsk_destruct, NULL )
217   LEGACY_FLOPPY_OPTION( dec100_floppy, "img", "DEC Rainbow 100", basicdsk_identify_default, basicdsk_construct_default,    NULL,
218      HEADS([1])
219      TRACKS(40/[80])
220      SECTORS(8/9/[10])
221      SECTOR_LENGTH([512])
222      INTERLEAVE([0])
223      FIRST_SECTOR_ID([1])
224                  )
216    LEGACY_FLOPPY_OPTION( dec100_floppy, "td0", "Teledisk floppy disk image", td0_dsk_identify, td0_dsk_construct, td0_dsk_destruct, NULL )
217    LEGACY_FLOPPY_OPTION( dec100_floppy, "img", "DEC Rainbow 100", basicdsk_identify_default, basicdsk_construct_default,    NULL,
218        HEADS([1])
219        TRACKS(40/[80])
220        SECTORS(8/9/[10])
221        SECTOR_LENGTH([512])
222        INTERLEAVE([0])
223        FIRST_SECTOR_ID([1])
224                        )
225225LEGACY_FLOPPY_OPTIONS_END
226226
227*/
No newline at end of file
227*/
trunk/src/lib/formats/oric_dsk.c
r31373r31374
8888                  copy = 7;
8989                  sector_size = 128 << (t[i+7] & 3);
9090                  logerror("%02x %x - %02x %02x %02x %02x\n",
91                        track, side, t[i+4], t[i+5], t[i+6], t[i+7]);
91                           track, side, t[i+4], t[i+5], t[i+6], t[i+7]);
9292               } else if(t[i+3] == 0xfb)
9393                  copy = sector_size+3;
9494               else
r31373r31374
102102         }
103103         generate_track_from_levels(track, side, stream, 100000, 0, image);
104104      }
105   
105
106106   return true;
107107}
108108
trunk/src/lib/util/corealloc.c
r31373r31374
181181
182182//-------------------------------------------------
183183//  track_memory - enables or disables the memory
184//   tracking
184//  tracking
185185//-------------------------------------------------
186186
187187void track_memory(bool track)
trunk/src/lib/util/zippath.c
r31373r31374
394394   const char *s = strrchr(path, '.');
395395   return (s != NULL) && !core_stricmp(s, ".7z");
396396}
397   
398   
397
398
399399/*-------------------------------------------------
400400    is_zip_file - tests to see if this file is a
401401    ZIP file
trunk/src/lib/web/mongoose.c
r31373r31374
121121
122122#ifdef NS_ENABLE_DEBUG
123123#define DBG(x) do { printf("%-20s ", __func__); printf x; putchar('\n'); \
124  fflush(stdout); } while(0)
124   fflush(stdout); } while(0)
125125#else
126126#define DBG(x)
127127#endif
r31373r31374
143143#endif // __cplusplus
144144
145145union socket_address {
146  struct sockaddr sa;
147  struct sockaddr_in sin;
146   struct sockaddr sa;
147   struct sockaddr_in sin;
148148#ifdef NS_ENABLE_IPV6
149  struct sockaddr_in6 sin6;
149   struct sockaddr_in6 sin6;
150150#else
151  struct sockaddr sin6;
151   struct sockaddr sin6;
152152#endif
153153};
154154
155155// IO buffers interface
156156struct iobuf {
157  char *buf;
158  size_t len;
159  size_t size;
157   char *buf;
158   size_t len;
159   size_t size;
160160};
161161
162162void iobuf_init(struct iobuf *, size_t initial_size);
r31373r31374
167167// Net skeleton interface
168168// Events. Meaning of event parameter (evp) is given in the comment.
169169enum ns_event {
170  NS_POLL,     // Sent to each connection on each call to ns_server_poll()
171  NS_ACCEPT,   // New connection accept()-ed. union socket_address *remote_addr
172  NS_CONNECT,  // connect() succeeded or failed. int *success_status
173  NS_RECV,     // Data has benn received. int *num_bytes
174  NS_SEND,     // Data has been written to a socket. int *num_bytes
175  NS_CLOSE     // Connection is closed. NULL
170   NS_POLL,     // Sent to each connection on each call to ns_server_poll()
171   NS_ACCEPT,   // New connection accept()-ed. union socket_address *remote_addr
172   NS_CONNECT,  // connect() succeeded or failed. int *success_status
173   NS_RECV,     // Data has benn received. int *num_bytes
174   NS_SEND,     // Data has been written to a socket. int *num_bytes
175   NS_CLOSE     // Connection is closed. NULL
176176};
177177
178178// Callback function (event handler) prototype, must be defined by user.
r31373r31374
181181typedef void (*ns_callback_t)(struct ns_connection *, enum ns_event, void *evp);
182182
183183struct ns_server {
184  void *server_data;
185  sock_t listening_sock;
186  struct ns_connection *active_connections;
187  ns_callback_t callback;
188  SSL_CTX *ssl_ctx;
189  SSL_CTX *client_ssl_ctx;
190  sock_t ctl[2];
184   void *server_data;
185   sock_t listening_sock;
186   struct ns_connection *active_connections;
187   ns_callback_t callback;
188   SSL_CTX *ssl_ctx;
189   SSL_CTX *client_ssl_ctx;
190   sock_t ctl[2];
191191};
192192
193193struct ns_connection {
194  struct ns_connection *prev, *next;
195  struct ns_server *server;
196  sock_t sock;
197  union socket_address sa;
198  struct iobuf recv_iobuf;
199  struct iobuf send_iobuf;
200  SSL *ssl;
201  void *connection_data;
202  time_t last_io_time;
203  unsigned int flags;
194   struct ns_connection *prev, *next;
195   struct ns_server *server;
196   sock_t sock;
197   union socket_address sa;
198   struct iobuf recv_iobuf;
199   struct iobuf send_iobuf;
200   SSL *ssl;
201   void *connection_data;
202   time_t last_io_time;
203   unsigned int flags;
204204#define NSF_FINISHED_SENDING_DATA   (1 << 0)
205205#define NSF_BUFFER_BUT_DONT_SEND    (1 << 1)
206206#define NSF_SSL_HANDSHAKE_DONE      (1 << 2)
r31373r31374
231231int ns_set_ssl_cert(struct ns_server *, const char *ssl_cert);
232232int ns_set_ssl_ca_cert(struct ns_server *, const char *ssl_ca_cert);
233233struct ns_connection *ns_connect(struct ns_server *, const char *host,
234                                 int port, int ssl, void *connection_param);
234                           int port, int ssl, void *connection_param);
235235
236236int ns_send(struct ns_connection *, const void *buf, int len);
237237int ns_printf(struct ns_connection *, const char *fmt, ...);
r31373r31374
280280#endif
281281
282282struct ctl_msg {
283  ns_callback_t callback;
284  char message[1024 * 8];
283   ns_callback_t callback;
284   char message[1024 * 8];
285285};
286286
287287void iobuf_init(struct iobuf *iobuf, size_t size) {
288  iobuf->len = iobuf->size = 0;
289  iobuf->buf = NULL;
288   iobuf->len = iobuf->size = 0;
289   iobuf->buf = NULL;
290290
291  if (size > 0 && (iobuf->buf = (char *) NS_MALLOC(size)) != NULL) {
292    iobuf->size = size;
293  }
291   if (size > 0 && (iobuf->buf = (char *) NS_MALLOC(size)) != NULL) {
292   iobuf->size = size;
293   }
294294}
295295
296296void iobuf_free(struct iobuf *iobuf) {
297  if (iobuf != NULL) {
298    if (iobuf->buf != NULL) NS_FREE(iobuf->buf);
299    iobuf_init(iobuf, 0);
300  }
297   if (iobuf != NULL) {
298   if (iobuf->buf != NULL) NS_FREE(iobuf->buf);
299   iobuf_init(iobuf, 0);
300   }
301301}
302302
303303size_t iobuf_append(struct iobuf *io, const void *buf, size_t len) {
304  char *p = NULL;
304   char *p = NULL;
305305
306  assert(io != NULL);
307  assert(io->len <= io->size);
306   assert(io != NULL);
307   assert(io->len <= io->size);
308308
309  if (len <= 0) {
310  } else if (io->len + len <= io->size) {
311    memcpy(io->buf + io->len, buf, len);
312    io->len += len;
313  } else if ((p = (char *) NS_REALLOC(io->buf, io->len + len)) != NULL) {
314    io->buf = p;
315    memcpy(io->buf + io->len, buf, len);
316    io->len += len;
317    io->size = io->len;
318  } else {
319    len = 0;
320  }
309   if (len <= 0) {
310   } else if (io->len + len <= io->size) {
311   memcpy(io->buf + io->len, buf, len);
312   io->len += len;
313   } else if ((p = (char *) NS_REALLOC(io->buf, io->len + len)) != NULL) {
314   io->buf = p;
315   memcpy(io->buf + io->len, buf, len);
316   io->len += len;
317   io->size = io->len;
318   } else {
319   len = 0;
320   }
321321
322  return len;
322   return len;
323323}
324324
325325void iobuf_remove(struct iobuf *io, size_t n) {
326  if (n > 0 && n <= io->len) {
327    memmove(io->buf, io->buf + n, io->len - n);
328    io->len -= n;
329  }
326   if (n > 0 && n <= io->len) {
327   memmove(io->buf, io->buf + n, io->len - n);
328   io->len -= n;
329   }
330330}
331331
332332#ifndef NS_DISABLE_THREADS
333333void *ns_start_thread(void *(*f)(void *), void *p) {
334334#ifdef _WIN32
335  return (void *) _beginthread((void (__cdecl *)(void *)) f, 0, p);
335   return (void *) _beginthread((void (__cdecl *)(void *)) f, 0, p);
336336#else
337  pthread_t thread_id = (pthread_t) 0;
338  pthread_attr_t attr;
337   pthread_t thread_id = (pthread_t) 0;
338   pthread_attr_t attr;
339339
340  (void) pthread_attr_init(&attr);
341  (void) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
340   (void) pthread_attr_init(&attr);
341   (void) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
342342
343343#if defined(NS_STACK_SIZE) && NS_STACK_SIZE > 1
344  (void) pthread_attr_setstacksize(&attr, NS_STACK_SIZE);
344   (void) pthread_attr_setstacksize(&attr, NS_STACK_SIZE);
345345#endif
346346
347  pthread_create(&thread_id, &attr, f, p);
348  pthread_attr_destroy(&attr);
347   pthread_create(&thread_id, &attr, f, p);
348   pthread_attr_destroy(&attr);
349349
350  return (void *) thread_id;
350   return (void *) thread_id;
351351#endif
352352}
353353#endif  // NS_DISABLE_THREADS
354354
355355static void ns_add_conn(struct ns_server *server, struct ns_connection *c) {
356  c->next = server->active_connections;
357  server->active_connections = c;
358  c->prev = NULL;
359  if (c->next != NULL) c->next->prev = c;
356   c->next = server->active_connections;
357   server->active_connections = c;
358   c->prev = NULL;
359   if (c->next != NULL) c->next->prev = c;
360360}
361361
362362static void ns_remove_conn(struct ns_connection *conn) {
363  if (conn->prev == NULL) conn->server->active_connections = conn->next;
364  if (conn->prev) conn->prev->next = conn->next;
365  if (conn->next) conn->next->prev = conn->prev;
363   if (conn->prev == NULL) conn->server->active_connections = conn->next;
364   if (conn->prev) conn->prev->next = conn->next;
365   if (conn->next) conn->next->prev = conn->prev;
366366}
367367
368368// Print message to buffer. If buffer is large enough to hold the message,
369369// return buffer. If buffer is to small, allocate large enough buffer on heap,
370370// and return allocated buffer.
371371static int ns_avprintf(char **buf, size_t size, const char *fmt, va_list ap) {
372  va_list ap_copy;
373  int len;
372   va_list ap_copy;
373   int len;
374374
375  va_copy(ap_copy, ap);
376  len = vsnprintf(*buf, size, fmt, ap_copy);
377  va_end(ap_copy);
375   va_copy(ap_copy, ap);
376   len = vsnprintf(*buf, size, fmt, ap_copy);
377   va_end(ap_copy);
378378
379  if (len < 0) {
380    // eCos and Windows are not standard-compliant and return -1 when
381    // the buffer is too small. Keep allocating larger buffers until we
382    // succeed or out of memory.
383    *buf = NULL;
384    while (len < 0) {
385      if (*buf) free(*buf);
386      size *= 2;
387      if ((*buf = (char *) NS_MALLOC(size)) == NULL) break;
388      va_copy(ap_copy, ap);
389      len = vsnprintf(*buf, size, fmt, ap_copy);
390      va_end(ap_copy);
391    }
392  } else if (len > (int) size) {
393    // Standard-compliant code path. Allocate a buffer that is large enough.
394    if ((*buf = (char *) NS_MALLOC(len + 1)) == NULL) {
395      len = -1;
396    } else {
397      va_copy(ap_copy, ap);
398      len = vsnprintf(*buf, len + 1, fmt, ap_copy);
399      va_end(ap_copy);
400    }
401  }
379   if (len < 0) {
380   // eCos and Windows are not standard-compliant and return -1 when
381   // the buffer is too small. Keep allocating larger buffers until we
382   // succeed or out of memory.
383   *buf = NULL;
384   while (len < 0) {
385      if (*buf) free(*buf);
386      size *= 2;
387      if ((*buf = (char *) NS_MALLOC(size)) == NULL) break;
388      va_copy(ap_copy, ap);
389      len = vsnprintf(*buf, size, fmt, ap_copy);
390      va_end(ap_copy);
391   }
392   } else if (len > (int) size) {
393   // Standard-compliant code path. Allocate a buffer that is large enough.
394   if ((*buf = (char *) NS_MALLOC(len + 1)) == NULL) {
395      len = -1;
396   } else {
397      va_copy(ap_copy, ap);
398      len = vsnprintf(*buf, len + 1, fmt, ap_copy);
399      va_end(ap_copy);
400   }
401   }
402402
403  return len;
403   return len;
404404}
405405
406406int ns_vprintf(struct ns_connection *conn, const char *fmt, va_list ap) {
407  char mem[2000], *buf = mem;
408  int len;
407   char mem[2000], *buf = mem;
408   int len;
409409
410  if ((len = ns_avprintf(&buf, sizeof(mem), fmt, ap)) > 0) {
411    iobuf_append(&conn->send_iobuf, buf, len);
412  }
413  if (buf != mem && buf != NULL) {
414    free(buf);
415  }
410   if ((len = ns_avprintf(&buf, sizeof(mem), fmt, ap)) > 0) {
411   iobuf_append(&conn->send_iobuf, buf, len);
412   }
413   if (buf != mem && buf != NULL) {
414   free(buf);
415   }
416416
417  return len;
417   return len;
418418}
419419
420420int ns_printf(struct ns_connection *conn, const char *fmt, ...) {
421  int len;
422  va_list ap;
423  va_start(ap, fmt);
424  len = ns_vprintf(conn, fmt, ap);
425  va_end(ap);
426  return len;
421   int len;
422   va_list ap;
423   va_start(ap, fmt);
424   len = ns_vprintf(conn, fmt, ap);
425   va_end(ap);
426   return len;
427427}
428428
429429static void ns_call(struct ns_connection *conn, enum ns_event ev, void *p) {
430  if (conn->server->callback) conn->server->callback(conn, ev, p);
430   if (conn->server->callback) conn->server->callback(conn, ev, p);
431431}
432432
433433static void ns_close_conn(struct ns_connection *conn) {
434  DBG(("%p %d", conn, conn->flags));
435  ns_call(conn, NS_CLOSE, NULL);
436  ns_remove_conn(conn);
437  closesocket(conn->sock);
438  iobuf_free(&conn->recv_iobuf);
439  iobuf_free(&conn->send_iobuf);
434   DBG(("%p %d", conn, conn->flags));
435   ns_call(conn, NS_CLOSE, NULL);
436   ns_remove_conn(conn);
437   closesocket(conn->sock);
438   iobuf_free(&conn->recv_iobuf);
439   iobuf_free(&conn->send_iobuf);
440440#ifdef NS_ENABLE_SSL
441  if (conn->ssl != NULL) {
442    SSL_free(conn->ssl);
443  }
441   if (conn->ssl != NULL) {
442   SSL_free(conn->ssl);
443   }
444444#endif
445  NS_FREE(conn);
445   NS_FREE(conn);
446446}
447447
448448void ns_set_close_on_exec(sock_t sock) {
449449#ifdef _WIN32
450  (void) SetHandleInformation((HANDLE) sock, HANDLE_FLAG_INHERIT, 0);
450   (void) SetHandleInformation((HANDLE) sock, HANDLE_FLAG_INHERIT, 0);
451451#else
452  fcntl(sock, F_SETFD, FD_CLOEXEC);
452   fcntl(sock, F_SETFD, FD_CLOEXEC);
453453#endif
454454}
455455
456456static void ns_set_non_blocking_mode(sock_t sock) {
457457#ifdef _WIN32
458  unsigned long on = 1;
459  ioctlsocket(sock, FIONBIO, &on);
458   unsigned long on = 1;
459   ioctlsocket(sock, FIONBIO, &on);
460460#else
461  int flags = fcntl(sock, F_GETFL, 0);
462  fcntl(sock, F_SETFL, flags | O_NONBLOCK);
461   int flags = fcntl(sock, F_GETFL, 0);
462   fcntl(sock, F_SETFL, flags | O_NONBLOCK);
463463#endif
464464}
465465
466466#ifndef NS_DISABLE_SOCKETPAIR
467467int ns_socketpair2(sock_t sp[2], int sock_type) {
468  union socket_address sa;
469  sock_t sock;
470  socklen_t len = sizeof(sa.sin);
471  int ret = 0;
468   union socket_address sa;
469   sock_t sock;
470   socklen_t len = sizeof(sa.sin);
471   int ret = 0;
472472
473  sp[0] = sp[1] = INVALID_SOCKET;
473   sp[0] = sp[1] = INVALID_SOCKET;
474474
475  (void) memset(&sa, 0, sizeof(sa));
476  sa.sin.sin_family = AF_INET;
477  sa.sin.sin_port = htons(0);
478  sa.sin.sin_addr.s_addr = htonl(0x7f000001);
475   (void) memset(&sa, 0, sizeof(sa));
476   sa.sin.sin_family = AF_INET;
477   sa.sin.sin_port = htons(0);
478   sa.sin.sin_addr.s_addr = htonl(0x7f000001);
479479
480  if ((sock = socket(AF_INET, sock_type, 0)) != INVALID_SOCKET &&
481      !bind(sock, &sa.sa, len) &&
482      (sock_type == SOCK_DGRAM || !listen(sock, 1)) &&
483      !getsockname(sock, &sa.sa, &len) &&
484      (sp[0] = socket(AF_INET, sock_type, 0)) != INVALID_SOCKET &&
485      !connect(sp[0], &sa.sa, len) &&
486      (sock_type == SOCK_STREAM ||
487       (!getsockname(sp[0], &sa.sa, &len) && !connect(sock, &sa.sa, len))) &&
488      (sp[1] = (sock_type == SOCK_DGRAM ? sock :
489                accept(sock, &sa.sa, &len))) != INVALID_SOCKET) {
490    ns_set_close_on_exec(sp[0]);
491    ns_set_close_on_exec(sp[1]);
492    ret = 1;
493  } else {
494    if (sp[0] != INVALID_SOCKET) closesocket(sp[0]);
495    if (sp[1] != INVALID_SOCKET) closesocket(sp[1]);
496    sp[0] = sp[1] = INVALID_SOCKET;
497  }
498  if (sock_type != SOCK_DGRAM) closesocket(sock);
480   if ((sock = socket(AF_INET, sock_type, 0)) != INVALID_SOCKET &&
481      !bind(sock, &sa.sa, len) &&
482      (sock_type == SOCK_DGRAM || !listen(sock, 1)) &&
483      !getsockname(sock, &sa.sa, &len) &&
484      (sp[0] = socket(AF_INET, sock_type, 0)) != INVALID_SOCKET &&
485      !connect(sp[0], &sa.sa, len) &&
486      (sock_type == SOCK_STREAM ||
487      (!getsockname(sp[0], &sa.sa, &len) && !connect(sock, &sa.sa, len))) &&
488      (sp[1] = (sock_type == SOCK_DGRAM ? sock :
489            accept(sock, &sa.sa, &len))) != INVALID_SOCKET) {
490   ns_set_close_on_exec(sp[0]);
491   ns_set_close_on_exec(sp[1]);
492   ret = 1;
493   } else {
494   if (sp[0] != INVALID_SOCKET) closesocket(sp[0]);
495   if (sp[1] != INVALID_SOCKET) closesocket(sp[1]);
496   sp[0] = sp[1] = INVALID_SOCKET;
497   }
498   if (sock_type != SOCK_DGRAM) closesocket(sock);
499499
500  return ret;
500   return ret;
501501}
502502
503503int ns_socketpair(sock_t sp[2]) {
504  return ns_socketpair2(sp, SOCK_STREAM);
504   return ns_socketpair2(sp, SOCK_STREAM);
505505}
506506#endif  // NS_DISABLE_SOCKETPAIR
507507
508508// Valid listening port spec is: [ip_address:]port, e.g. "80", "127.0.0.1:3128"
509509static int ns_parse_port_string(const char *str, union socket_address *sa) {
510  unsigned int a, b, c, d, port;
511  int len = 0;
510   unsigned int a, b, c, d, port;
511   int len = 0;
512512#ifdef NS_ENABLE_IPV6
513  char buf[100];
513   char buf[100];
514514#endif
515515
516  // MacOS needs that. If we do not zero it, subsequent bind() will fail.
517  // Also, all-zeroes in the socket address means binding to all addresses
518  // for both IPv4 and IPv6 (INADDR_ANY and IN6ADDR_ANY_INIT).
519  memset(sa, 0, sizeof(*sa));
520  sa->sin.sin_family = AF_INET;
516   // MacOS needs that. If we do not zero it, subsequent bind() will fail.
517   // Also, all-zeroes in the socket address means binding to all addresses
518   // for both IPv4 and IPv6 (INADDR_ANY and IN6ADDR_ANY_INIT).
519   memset(sa, 0, sizeof(*sa));
520   sa->sin.sin_family = AF_INET;
521521
522  if (sscanf(str, "%u.%u.%u.%u:%u%n", &a, &b, &c, &d, &port, &len) == 5) {
523    // Bind to a specific IPv4 address, e.g. 192.168.1.5:8080
524    sa->sin.sin_addr.s_addr = htonl((a << 24) | (b << 16) | (c << 8) | d);
525    sa->sin.sin_port = htons((uint16_t) port);
522   if (sscanf(str, "%u.%u.%u.%u:%u%n", &a, &b, &c, &d, &port, &len) == 5) {
523   // Bind to a specific IPv4 address, e.g. 192.168.1.5:8080
524   sa->sin.sin_addr.s_addr = htonl((a << 24) | (b << 16) | (c << 8) | d);
525   sa->sin.sin_port = htons((uint16_t) port);
526526#ifdef NS_ENABLE_IPV6
527  } else if (sscanf(str, "[%49[^]]]:%u%n", buf, &port, &len) == 2 &&
528             inet_pton(AF_INET6, buf, &sa->sin6.sin6_addr)) {
529    // IPv6 address, e.g. [3ffe:2a00:100:7031::1]:8080
530    sa->sin6.sin6_family = AF_INET6;
531    sa->sin6.sin6_port = htons((uint16_t) port);
527   } else if (sscanf(str, "[%49[^]]]:%u%n", buf, &port, &len) == 2 &&
528            inet_pton(AF_INET6, buf, &sa->sin6.sin6_addr)) {
529   // IPv6 address, e.g. [3ffe:2a00:100:7031::1]:8080
530   sa->sin6.sin6_family = AF_INET6;
531   sa->sin6.sin6_port = htons((uint16_t) port);
532532#endif
533  } else if (sscanf(str, "%u%n", &port, &len) == 1) {
534    // If only port is specified, bind to IPv4, INADDR_ANY
535    sa->sin.sin_port = htons((uint16_t) port);
536  } else {
537    port = 0;   // Parsing failure. Make port invalid.
538  }
533   } else if (sscanf(str, "%u%n", &port, &len) == 1) {
534   // If only port is specified, bind to IPv4, INADDR_ANY
535   sa->sin.sin_port = htons((uint16_t) port);
536   } else {
537   port = 0;   // Parsing failure. Make port invalid.
538   }
539539
540  return port <= 0xffff && str[len] == '\0';
540   return port <= 0xffff && str[len] == '\0';
541541}
542542
543543// 'sa' must be an initialized address to bind to
544544static sock_t ns_open_listening_socket(union socket_address *sa) {
545  socklen_t len = sizeof(*sa);
546  sock_t sock = INVALID_SOCKET;
545   socklen_t len = sizeof(*sa);
546   sock_t sock = INVALID_SOCKET;
547547#ifndef _WIN32
548  int on = 1;
548   int on = 1;
549549#endif
550550
551  if ((sock = socket(sa->sa.sa_family, SOCK_STREAM, 6)) != INVALID_SOCKET &&
551   if ((sock = socket(sa->sa.sa_family, SOCK_STREAM, 6)) != INVALID_SOCKET &&
552552#ifndef _WIN32
553      // SO_RESUSEADDR is not enabled on Windows because the semantics of
554      // SO_REUSEADDR on UNIX and Windows is different. On Windows,
555      // SO_REUSEADDR allows to bind a socket to a port without error even if
556      // the port is already open by another program. This is not the behavior
557      // SO_REUSEADDR was designed for, and leads to hard-to-track failure
558      // scenarios. Therefore, SO_REUSEADDR was disabled on Windows.
559      !setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &on, sizeof(on)) &&
553      // SO_RESUSEADDR is not enabled on Windows because the semantics of
554      // SO_REUSEADDR on UNIX and Windows is different. On Windows,
555      // SO_REUSEADDR allows to bind a socket to a port without error even if
556      // the port is already open by another program. This is not the behavior
557      // SO_REUSEADDR was designed for, and leads to hard-to-track failure
558      // scenarios. Therefore, SO_REUSEADDR was disabled on Windows.
559      !setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &on, sizeof(on)) &&
560560#endif
561      !bind(sock, &sa->sa, sa->sa.sa_family == AF_INET ?
562            sizeof(sa->sin) : sizeof(sa->sin6)) &&
563      !listen(sock, SOMAXCONN)) {
564    ns_set_non_blocking_mode(sock);
565    // In case port was set to 0, get the real port number
566    (void) getsockname(sock, &sa->sa, &len);
567  } else if (sock != INVALID_SOCKET) {
568    closesocket(sock);
569    sock = INVALID_SOCKET;
570  }
561      !bind(sock, &sa->sa, sa->sa.sa_family == AF_INET ?
562         sizeof(sa->sin) : sizeof(sa->sin6)) &&
563      !listen(sock, SOMAXCONN)) {
564   ns_set_non_blocking_mode(sock);
565   // In case port was set to 0, get the real port number
566   (void) getsockname(sock, &sa->sa, &len);
567   } else if (sock != INVALID_SOCKET) {
568   closesocket(sock);
569   sock = INVALID_SOCKET;
570   }
571571
572  return sock;
572   return sock;
573573}
574574
575575// Certificate generation script is at
576576// https://github.com/cesanta/net_skeleton/blob/master/examples/gen_certs.sh
577577int ns_set_ssl_ca_cert(struct ns_server *server, const char *cert) {
578578#ifdef NS_ENABLE_SSL
579  STACK_OF(X509_NAME) *list = SSL_load_client_CA_file(cert);
580  if (cert != NULL && server->ssl_ctx != NULL && list != NULL) {
581    SSL_CTX_set_client_CA_list(server->ssl_ctx, list);
582    SSL_CTX_set_verify(server->ssl_ctx, SSL_VERIFY_PEER |
583                       SSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL);
584    return 0;
585  }
579   STACK_OF(X509_NAME) *list = SSL_load_client_CA_file(cert);
580   if (cert != NULL && server->ssl_ctx != NULL && list != NULL) {
581   SSL_CTX_set_client_CA_list(server->ssl_ctx, list);
582   SSL_CTX_set_verify(server->ssl_ctx, SSL_VERIFY_PEER |
583                  SSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL);
584   return 0;
585   }
586586#endif
587  return server != NULL && cert == NULL ? 0 : -1;
587   return server != NULL && cert == NULL ? 0 : -1;
588588}
589589
590590int ns_set_ssl_cert(struct ns_server *server, const char *cert) {
591591#ifdef NS_ENABLE_SSL
592  if (cert != NULL &&
593      (server->ssl_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL) {
594    return -1;
595  } else if (SSL_CTX_use_certificate_file(server->ssl_ctx, cert, 1) == 0 ||
596             SSL_CTX_use_PrivateKey_file(server->ssl_ctx, cert, 1) == 0) {
597    return -2;
598  } else {
599    SSL_CTX_use_certificate_chain_file(server->ssl_ctx, cert);
600    return 0;
601  }
592   if (cert != NULL &&
593      (server->ssl_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL) {
594   return -1;
595   } else if (SSL_CTX_use_certificate_file(server->ssl_ctx, cert, 1) == 0 ||
596            SSL_CTX_use_PrivateKey_file(server->ssl_ctx, cert, 1) == 0) {
597   return -2;
598   } else {
599   SSL_CTX_use_certificate_chain_file(server->ssl_ctx, cert);
600   return 0;
601   }
602602#endif
603  return server != NULL && cert == NULL ? 0 : -3;
603   return server != NULL && cert == NULL ? 0 : -3;
604604}
605605
606606int ns_bind(struct ns_server *server, const char *str) {
607  union socket_address sa;
608  ns_parse_port_string(str, &sa);
609  if (server->listening_sock != INVALID_SOCKET) {
610    closesocket(server->listening_sock);
611  }
612  server->listening_sock = ns_open_listening_socket(&sa);
613  return server->listening_sock == INVALID_SOCKET ? -1 :
614  (int) ntohs(sa.sin.sin_port);
607   union socket_address sa;
608   ns_parse_port_string(str, &sa);
609   if (server->listening_sock != INVALID_SOCKET) {
610   closesocket(server->listening_sock);
611   }
612   server->listening_sock = ns_open_listening_socket(&sa);
613   return server->listening_sock == INVALID_SOCKET ? -1 :
614   (int) ntohs(sa.sin.sin_port);
615615}
616616
617617
618618static struct ns_connection *accept_conn(struct ns_server *server) {
619  struct ns_connection *c = NULL;
620  union socket_address sa;
621  socklen_t len = sizeof(sa);
622  sock_t sock = INVALID_SOCKET;
619   struct ns_connection *c = NULL;
620   union socket_address sa;
621   socklen_t len = sizeof(sa);
622   sock_t sock = INVALID_SOCKET;
623623
624  // NOTE(lsm): on Windows, sock is always > FD_SETSIZE
625  if ((sock = accept(server->listening_sock, &sa.sa, &len)) == INVALID_SOCKET) {
626  } else if ((c = (struct ns_connection *) NS_MALLOC(sizeof(*c))) == NULL ||
627             memset(c, 0, sizeof(*c)) == NULL) {
628    closesocket(sock);
624   // NOTE(lsm): on Windows, sock is always > FD_SETSIZE
625   if ((sock = accept(server->listening_sock, &sa.sa, &len)) == INVALID_SOCKET) {
626   } else if ((c = (struct ns_connection *) NS_MALLOC(sizeof(*c))) == NULL ||
627            memset(c, 0, sizeof(*c)) == NULL) {
628   closesocket(sock);
629629#ifdef NS_ENABLE_SSL
630  } else if (server->ssl_ctx != NULL &&
631             ((c->ssl = SSL_new(server->ssl_ctx)) == NULL ||
632              SSL_set_fd(c->ssl, sock) != 1)) {
633    DBG(("SSL error"));
634    closesocket(sock);
635    free(c);
636    c = NULL;
630   } else if (server->ssl_ctx != NULL &&
631            ((c->ssl = SSL_new(server->ssl_ctx)) == NULL ||
632            SSL_set_fd(c->ssl, sock) != 1)) {
633   DBG(("SSL error"));
634   closesocket(sock);
635   free(c);
636   c = NULL;
637637#endif
638  } else {
639    ns_set_close_on_exec(sock);
640    ns_set_non_blocking_mode(sock);
641    c->server = server;
642    c->sock = sock;
643    c->flags |= NSF_ACCEPTED;
638   } else {
639   ns_set_close_on_exec(sock);
640   ns_set_non_blocking_mode(sock);
641   c->server = server;
642   c->sock = sock;
643   c->flags |= NSF_ACCEPTED;
644644
645    ns_add_conn(server, c);
646    ns_call(c, NS_ACCEPT, &sa);
647    DBG(("%p %d %p %p", c, c->sock, c->ssl, server->ssl_ctx));
648  }
645   ns_add_conn(server, c);
646   ns_call(c, NS_ACCEPT, &sa);
647   DBG(("%p %d %p %p", c, c->sock, c->ssl, server->ssl_ctx));
648   }
649649
650  return c;
650   return c;
651651}
652652
653653static int ns_is_error(int n) {
654  return n == 0 ||
655    (n < 0 && errno != EINTR && errno != EINPROGRESS &&
656     errno != EAGAIN && errno != EWOULDBLOCK
654   return n == 0 ||
655   (n < 0 && errno != EINTR && errno != EINPROGRESS &&
656      errno != EAGAIN && errno != EWOULDBLOCK
657657#ifdef _WIN32
658     && WSAGetLastError() != WSAEINTR && WSAGetLastError() != WSAEWOULDBLOCK
658      && WSAGetLastError() != WSAEINTR && WSAGetLastError() != WSAEWOULDBLOCK
659659#endif
660    );
660   );
661661}
662662
663663void ns_sock_to_str(sock_t sock, char *buf, size_t len, int flags) {
664  union socket_address sa;
665  socklen_t slen = sizeof(sa);
664   union socket_address sa;
665   socklen_t slen = sizeof(sa);
666666
667  if (buf != NULL && len > 0) {
668    buf[0] = '\0';
669    memset(&sa, 0, sizeof(sa));
670    if (flags & 4) {
671      getpeername(sock, &sa.sa, &slen);
672    } else {
673      getsockname(sock, &sa.sa, &slen);
674    }
675    if (flags & 1) {
667   if (buf != NULL && len > 0) {
668   buf[0] = '\0';
669   memset(&sa, 0, sizeof(sa));
670   if (flags & 4) {
671      getpeername(sock, &sa.sa, &slen);
672   } else {
673      getsockname(sock, &sa.sa, &slen);
674   }
675   if (flags & 1) {
676676#if defined(NS_ENABLE_IPV6)
677      inet_ntop(sa.sa.sa_family, sa.sa.sa_family == AF_INET ?
678                (void *) &sa.sin.sin_addr :
679                (void *) &sa.sin6.sin6_addr, buf, len);
677      inet_ntop(sa.sa.sa_family, sa.sa.sa_family == AF_INET ?
678            (void *) &sa.sin.sin_addr :
679            (void *) &sa.sin6.sin6_addr, buf, len);
680680#elif defined(_WIN32)
681      // Only Windoze Vista (and newer) have inet_ntop()
682      strncpy(buf, inet_ntoa(sa.sin.sin_addr), len);
681      // Only Windoze Vista (and newer) have inet_ntop()
682      strncpy(buf, inet_ntoa(sa.sin.sin_addr), len);
683683#else
684      inet_ntop(sa.sa.sa_family, (void *) &sa.sin.sin_addr, buf, len);
684      inet_ntop(sa.sa.sa_family, (void *) &sa.sin.sin_addr, buf, len);
685685#endif
686    }
687    if (flags & 2) {
688      snprintf(buf + strlen(buf), len - (strlen(buf) + 1), "%s%d",
689               flags & 1 ? ":" : "", (int) ntohs(sa.sin.sin_port));
690    }
691  }
686   }
687   if (flags & 2) {
688      snprintf(buf + strlen(buf), len - (strlen(buf) + 1), "%s%d",
689            flags & 1 ? ":" : "", (int) ntohs(sa.sin.sin_port));
690   }
691   }
692692}
693693
694694int ns_hexdump(const void *buf, int len, char *dst, int dst_len) {
695  const unsigned char *p = (const unsigned char *) buf;
696  char ascii[17] = "";
697  int i, idx, n = 0;
695   const unsigned char *p = (const unsigned char *) buf;
696   char ascii[17] = "";
697   int i, idx, n = 0;
698698
699  for (i = 0; i < len; i++) {
700    idx = i % 16;
701    if (idx == 0) {
702      if (i > 0) n += snprintf(dst + n, dst_len - n, "  %s\n", ascii);
703      n += snprintf(dst + n, dst_len - n, "%04x ", i);
704    }
705    n += snprintf(dst + n, dst_len - n, " %02x", p[i]);
706    ascii[idx] = p[i] < 0x20 || p[i] > 0x7e ? '.' : p[i];
707    ascii[idx + 1] = '\0';
708  }
699   for (i = 0; i < len; i++) {
700   idx = i % 16;
701   if (idx == 0) {
702      if (i > 0) n += snprintf(dst + n, dst_len - n, "  %s\n", ascii);
703      n += snprintf(dst + n, dst_len - n, "%04x ", i);
704   }
705   n += snprintf(dst + n, dst_len - n, " %02x", p[i]);
706   ascii[idx] = p[i] < 0x20 || p[i] > 0x7e ? '.' : p[i];
707   ascii[idx + 1] = '\0';
708   }
709709
710  while (i++ % 16) n += snprintf(dst + n, dst_len - n, "%s", "   ");
711  n += snprintf(dst + n, dst_len - n, "  %s\n\n", ascii);
710   while (i++ % 16) n += snprintf(dst + n, dst_len - n, "%s", "   ");
711   n += snprintf(dst + n, dst_len - n, "  %s\n\n", ascii);
712712
713  return n;
713   return n;
714714}
715715
716716static void ns_read_from_socket(struct ns_connection *conn) {
717  char buf[2048];
718  int n = 0;
717   char buf[2048];
718   int n = 0;
719719
720  if (conn->flags & NSF_CONNECTING) {
721    int ok = 1, ret;
722    socklen_t len = sizeof(ok);
720   if (conn->flags & NSF_CONNECTING) {
721   int ok = 1, ret;
722   socklen_t len = sizeof(ok);
723723
724    ret = getsockopt(conn->sock, SOL_SOCKET, SO_ERROR, (char *) &ok, &len);
725    (void) ret;
724   ret = getsockopt(conn->sock, SOL_SOCKET, SO_ERROR, (char *) &ok, &len);
725   (void) ret;
726726#ifdef NS_ENABLE_SSL
727    if (ret == 0 && ok == 0 && conn->ssl != NULL) {
728      int res = SSL_connect(conn->ssl);
729      int ssl_err = SSL_get_error(conn->ssl, res);
730      DBG(("%p %d wres %d %d", conn, conn->flags, res, ssl_err));
731      if (ssl_err == SSL_ERROR_WANT_READ) conn->flags |= NSF_WANT_READ;
732      if (ssl_err == SSL_ERROR_WANT_WRITE) conn->flags |= NSF_WANT_WRITE;
733      if (res == 1) {
734        conn->flags |= NSF_SSL_HANDSHAKE_DONE;
735      } else if (ssl_err == SSL_ERROR_WANT_READ ||
736                 ssl_err == SSL_ERROR_WANT_WRITE) {
737        return; // Call us again
738      } else {
739        ok = 1;
740      }
741    }
727   if (ret == 0 && ok == 0 && conn->ssl != NULL) {
728      int res = SSL_connect(conn->ssl);
729      int ssl_err = SSL_get_error(conn->ssl, res);
730      DBG(("%p %d wres %d %d", conn, conn->flags, res, ssl_err));
731      if (ssl_err == SSL_ERROR_WANT_READ) conn->flags |= NSF_WANT_READ;
732      if (ssl_err == SSL_ERROR_WANT_WRITE) conn->flags |= NSF_WANT_WRITE;
733      if (res == 1) {
734      conn->flags |= NSF_SSL_HANDSHAKE_DONE;
735      } else if (ssl_err == SSL_ERROR_WANT_READ ||
736               ssl_err == SSL_ERROR_WANT_WRITE) {
737      return; // Call us again
738      } else {
739      ok = 1;
740      }
741   }
742742#endif
743    conn->flags &= ~NSF_CONNECTING;
744    DBG(("%p ok=%d", conn, ok));
745    if (ok != 0) {
746      conn->flags |= NSF_CLOSE_IMMEDIATELY;
747    }
748    ns_call(conn, NS_CONNECT, &ok);
749    return;
750  }
743   conn->flags &= ~NSF_CONNECTING;
744   DBG(("%p ok=%d", conn, ok));
745   if (ok != 0) {
746      conn->flags |= NSF_CLOSE_IMMEDIATELY;
747   }
748   ns_call(conn, NS_CONNECT, &ok);
749   return;
750   }
751751
752752#ifdef NS_ENABLE_SSL
753  if (conn->ssl != NULL) {
754    if (conn->flags & NSF_SSL_HANDSHAKE_DONE) {
755      n = SSL_read(conn->ssl, buf, sizeof(buf));
756    } else {
757      int res = SSL_accept(conn->ssl);
758      int ssl_err = SSL_get_error(conn->ssl, res);
759      DBG(("%p %d rres %d %d", conn, conn->flags, res, ssl_err));
760      if (ssl_err == SSL_ERROR_WANT_READ) conn->flags |= NSF_WANT_READ;
761      if (ssl_err == SSL_ERROR_WANT_WRITE) conn->flags |= NSF_WANT_WRITE;
762      if (res == 1) {
763        conn->flags |= NSF_SSL_HANDSHAKE_DONE;
764      } else if (ssl_err == SSL_ERROR_WANT_READ ||
765                 ssl_err == SSL_ERROR_WANT_WRITE) {
766        return; // Call us again
767      } else {
768        conn->flags |= NSF_CLOSE_IMMEDIATELY;
769      }
770      return;
771    }
772  } else
753   if (conn->ssl != NULL) {
754   if (conn->flags & NSF_SSL_HANDSHAKE_DONE) {
755      n = SSL_read(conn->ssl, buf, sizeof(buf));
756   } else {
757      int res = SSL_accept(conn->ssl);
758      int ssl_err = SSL_get_error(conn->ssl, res);
759      DBG(("%p %d rres %d %d", conn, conn->flags, res, ssl_err));
760      if (ssl_err == SSL_ERROR_WANT_READ) conn->flags |= NSF_WANT_READ;
761      if (ssl_err == SSL_ERROR_WANT_WRITE) conn->flags |= NSF_WANT_WRITE;
762      if (res == 1) {
763      conn->flags |= NSF_SSL_HANDSHAKE_DONE;
764      } else if (ssl_err == SSL_ERROR_WANT_READ ||
765               ssl_err == SSL_ERROR_WANT_WRITE) {
766      return; // Call us again
767      } else {
768      conn->flags |= NSF_CLOSE_IMMEDIATELY;
769      }
770      return;
771   }
772   } else
773773#endif
774  {
775    n = recv(conn->sock, buf, sizeof(buf), 0);
776  }
774   {
775   n = recv(conn->sock, buf, sizeof(buf), 0);
776   }
777777
778  DBG(("%p %d <- %d bytes", conn, conn->flags, n));
778   DBG(("%p %d <- %d bytes", conn, conn->flags, n));
779779
780  if (ns_is_error(n)) {
781    conn->flags |= NSF_CLOSE_IMMEDIATELY;
782  } else if (n > 0) {
783    iobuf_append(&conn->recv_iobuf, buf, n);
784    ns_call(conn, NS_RECV, &n);
785  }
780   if (ns_is_error(n)) {
781   conn->flags |= NSF_CLOSE_IMMEDIATELY;
782   } else if (n > 0) {
783   iobuf_append(&conn->recv_iobuf, buf, n);
784   ns_call(conn, NS_RECV, &n);
785   }
786786}
787787
788788static void ns_write_to_socket(struct ns_connection *conn) {
789  struct iobuf *io = &conn->send_iobuf;
790  int n = 0;
789   struct iobuf *io = &conn->send_iobuf;
790   int n = 0;
791791
792792#ifdef NS_ENABLE_SSL
793  if (conn->ssl != NULL) {
794    n = SSL_write(conn->ssl, io->buf, io->len);
795    if (n < 0) {
796      int ssl_err = SSL_get_error(conn->ssl, n);
797      DBG(("%p %d %d", conn, n, ssl_err));
798      if (ssl_err == 2 || ssl_err == 3) {
799        return; // Call us again
800      } else {
801        conn->flags |= NSF_CLOSE_IMMEDIATELY;
802      }
803    }
804  } else
793   if (conn->ssl != NULL) {
794   n = SSL_write(conn->ssl, io->buf, io->len);
795   if (n < 0) {
796      int ssl_err = SSL_get_error(conn->ssl, n);
797      DBG(("%p %d %d", conn, n, ssl_err));
798      if (ssl_err == 2 || ssl_err == 3) {
799      return; // Call us again
800      } else {
801      conn->flags |= NSF_CLOSE_IMMEDIATELY;
802      }
803   }
804   } else
805805#endif
806  { n = send(conn->sock, io->buf, io->len, 0); }
806   { n = send(conn->sock, io->buf, io->len, 0); }
807807
808  DBG(("%p %d -> %d bytes", conn, conn->flags, n));
808   DBG(("%p %d -> %d bytes", conn, conn->flags, n));
809809
810  ns_call(conn, NS_SEND, &n);
811  if (ns_is_error(n)) {
812    conn->flags |= NSF_CLOSE_IMMEDIATELY;
813  } else if (n > 0) {
814    iobuf_remove(io, n);
815  }
810   ns_call(conn, NS_SEND, &n);
811   if (ns_is_error(n)) {
812   conn->flags |= NSF_CLOSE_IMMEDIATELY;
813   } else if (n > 0) {
814   iobuf_remove(io, n);
815   }
816816
817  if (io->len == 0 && (conn->flags & NSF_FINISHED_SENDING_DATA)) {
818    conn->flags |= NSF_CLOSE_IMMEDIATELY;
819  }
817   if (io->len == 0 && (conn->flags & NSF_FINISHED_SENDING_DATA)) {
818   conn->flags |= NSF_CLOSE_IMMEDIATELY;
819   }
820820}
821821
822822int ns_send(struct ns_connection *conn, const void *buf, int len) {
823  return iobuf_append(&conn->send_iobuf, buf, len);
823   return iobuf_append(&conn->send_iobuf, buf, len);
824824}
825825
826826static void ns_add_to_set(sock_t sock, fd_set *set, sock_t *max_fd) {
827  if (sock != INVALID_SOCKET) {
828    FD_SET(sock, set);
829    if (*max_fd == INVALID_SOCKET || sock > *max_fd) {
830      *max_fd = sock;
831    }
832  }
827   if (sock != INVALID_SOCKET) {
828   FD_SET(sock, set);
829   if (*max_fd == INVALID_SOCKET || sock > *max_fd) {
830      *max_fd = sock;
831   }
832   }
833833}
834834
835835int ns_server_poll(struct ns_server *server, int milli) {
836  struct ns_connection *conn, *tmp_conn;
837  struct timeval tv;
838  fd_set read_set, write_set;
839  int num_active_connections = 0;
840  sock_t max_fd = INVALID_SOCKET;
841  time_t current_time = time(NULL);
836   struct ns_connection *conn, *tmp_conn;
837   struct timeval tv;
838   fd_set read_set, write_set;
839   int num_active_connections = 0;
840   sock_t max_fd = INVALID_SOCKET;
841   time_t current_time = time(NULL);
842842
843  if (server->listening_sock == INVALID_SOCKET &&
844      server->active_connections == NULL) return 0;
843   if (server->listening_sock == INVALID_SOCKET &&
844      server->active_connections == NULL) return 0;
845845
846  FD_ZERO(&read_set);
847  FD_ZERO(&write_set);
848  ns_add_to_set(server->listening_sock, &read_set, &max_fd);
849  ns_add_to_set(server->ctl[1], &read_set, &max_fd);
846   FD_ZERO(&read_set);
847   FD_ZERO(&write_set);
848   ns_add_to_set(server->listening_sock, &read_set, &max_fd);
849   ns_add_to_set(server->ctl[1], &read_set, &max_fd);
850850
851  for (conn = server->active_connections; conn != NULL; conn = tmp_conn) {
852    tmp_conn = conn->next;
853    ns_call(conn, NS_POLL, &current_time);
854    if (!(conn->flags & NSF_WANT_WRITE)) {
855      //DBG(("%p read_set", conn));
856      ns_add_to_set(conn->sock, &read_set, &max_fd);
857    }
858    if (((conn->flags & NSF_CONNECTING) && !(conn->flags & NSF_WANT_READ)) ||
859        (conn->send_iobuf.len > 0 && !(conn->flags & NSF_CONNECTING) &&
860         !(conn->flags & NSF_BUFFER_BUT_DONT_SEND))) {
861      //DBG(("%p write_set", conn));
862      ns_add_to_set(conn->sock, &write_set, &max_fd);
863    }
864    if (conn->flags & NSF_CLOSE_IMMEDIATELY) {
865      ns_close_conn(conn);
866    }
867  }
851   for (conn = server->active_connections; conn != NULL; conn = tmp_conn) {
852   tmp_conn = conn->next;
853   ns_call(conn, NS_POLL, &current_time);
854   if (!(conn->flags & NSF_WANT_WRITE)) {
855      //DBG(("%p read_set", conn));
856      ns_add_to_set(conn->sock, &read_set, &max_fd);
857   }
858   if (((conn->flags & NSF_CONNECTING) && !(conn->flags & NSF_WANT_READ)) ||
859      (conn->send_iobuf.len > 0 && !(conn->flags & NSF_CONNECTING) &&
860         !(conn->flags & NSF_BUFFER_BUT_DONT_SEND))) {
861      //DBG(("%p write_set", conn));
862      ns_add_to_set(conn->sock, &write_set, &max_fd);
863   }
864   if (conn->flags & NSF_CLOSE_IMMEDIATELY) {
865      ns_close_conn(conn);
866   }
867   }
868868
869  tv.tv_sec = milli / 1000;
870  tv.tv_usec = (milli % 1000) * 1000;
869   tv.tv_sec = milli / 1000;
870   tv.tv_usec = (milli % 1000) * 1000;
871871
872  if (select((int) max_fd + 1, &read_set, &write_set, NULL, &tv) > 0) {
873    // select() might have been waiting for a long time, reset current_time
874    // now to prevent last_io_time being set to the past.
875    current_time = time(NULL);
876   
877    // Accept new connections
878    if (server->listening_sock != INVALID_SOCKET &&
879        FD_ISSET(server->listening_sock, &read_set)) {
880      // We're not looping here, and accepting just one connection at
881      // a time. The reason is that eCos does not respect non-blocking
882      // flag on a listening socket and hangs in a loop.
883      if ((conn = accept_conn(server)) != NULL) {
884        conn->last_io_time = current_time;
885      }
886    }
872   if (select((int) max_fd + 1, &read_set, &write_set, NULL, &tv) > 0) {
873   // select() might have been waiting for a long time, reset current_time
874   // now to prevent last_io_time being set to the past.
875   current_time = time(NULL);
887876
888    // Read wakeup messages
889    if (server->ctl[1] != INVALID_SOCKET &&
890        FD_ISSET(server->ctl[1], &read_set)) {
891      struct ctl_msg ctl_msg;
892      int len = recv(server->ctl[1], (char *) &ctl_msg, sizeof(ctl_msg), 0);
893      send(server->ctl[1], ctl_msg.message, 1, 0);
894      if (len >= (int) sizeof(ctl_msg.callback) && ctl_msg.callback != NULL) {
895        ns_iterate(server, ctl_msg.callback, ctl_msg.message);
896      }
897    }
877   // Accept new connections
878   if (server->listening_sock != INVALID_SOCKET &&
879      FD_ISSET(server->listening_sock, &read_set)) {
880      // We're not looping here, and accepting just one connection at
881      // a time. The reason is that eCos does not respect non-blocking
882      // flag on a listening socket and hangs in a loop.
883      if ((conn = accept_conn(server)) != NULL) {
884      conn->last_io_time = current_time;
885      }
886   }
898887
899    for (conn = server->active_connections; conn != NULL; conn = tmp_conn) {
900      tmp_conn = conn->next;
901      if (FD_ISSET(conn->sock, &read_set)) {
902        conn->last_io_time = current_time;
903        ns_read_from_socket(conn);
904      }
905      if (FD_ISSET(conn->sock, &write_set)) {
906        if (conn->flags & NSF_CONNECTING) {
907          ns_read_from_socket(conn);
908        } else if (!(conn->flags & NSF_BUFFER_BUT_DONT_SEND)) {
909          conn->last_io_time = current_time;
910          ns_write_to_socket(conn);
911        }
912      }
913    }
914  }
888   // Read wakeup messages
889   if (server->ctl[1] != INVALID_SOCKET &&
890      FD_ISSET(server->ctl[1], &read_set)) {
891      struct ctl_msg ctl_msg;
892      int len = recv(server->ctl[1], (char *) &ctl_msg, sizeof(ctl_msg), 0);
893      send(server->ctl[1], ctl_msg.message, 1, 0);
894      if (len >= (int) sizeof(ctl_msg.callback) && ctl_msg.callback != NULL) {
895      ns_iterate(server, ctl_msg.callback, ctl_msg.message);
896      }
897   }
915898
916  for (conn = server->active_connections; conn != NULL; conn = tmp_conn) {
917    tmp_conn = conn->next;
918    num_active_connections++;
919    if (conn->flags & NSF_CLOSE_IMMEDIATELY) {
920      ns_close_conn(conn);
921    }
922  }
923  //DBG(("%d active connections", num_active_connections));
899   for (conn = server->active_connections; conn != NULL; conn = tmp_conn) {
900      tmp_conn = conn->next;
901      if (FD_ISSET(conn->sock, &read_set)) {
902      conn->last_io_time = current_time;
903      ns_read_from_socket(conn);
904      }
905      if (FD_ISSET(conn->sock, &write_set)) {
906      if (conn->flags & NSF_CONNECTING) {
907         ns_read_from_socket(conn);
908      } else if (!(conn->flags & NSF_BUFFER_BUT_DONT_SEND)) {
909         conn->last_io_time = current_time;
910         ns_write_to_socket(conn);
911      }
912      }
913   }
914   }
924915
925  return num_active_connections;
916   for (conn = server->active_connections; conn != NULL; conn = tmp_conn) {
917   tmp_conn = conn->next;
918   num_active_connections++;
919   if (conn->flags & NSF_CLOSE_IMMEDIATELY) {
920      ns_close_conn(conn);
921   }
922   }
923   //DBG(("%d active connections", num_active_connections));
924
925   return num_active_connections;
926926}
927927
928928struct ns_connection *ns_connect(struct ns_server *server, const char *host,
929                                 int port, int use_ssl, void *param) {
930  sock_t sock = INVALID_SOCKET;
931  struct sockaddr_in sin;
932  struct hostent *he = NULL;
933  struct ns_connection *conn = NULL;
934  int connect_ret_val;
929                           int port, int use_ssl, void *param) {
930   sock_t sock = INVALID_SOCKET;
931   struct sockaddr_in sin;
932   struct hostent *he = NULL;
933   struct ns_connection *conn = NULL;
934   int connect_ret_val;
935935
936  (void) use_ssl;
936   (void) use_ssl;
937937
938  if (host == NULL || (he = gethostbyname(host)) == NULL ||
939      (sock = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
940    DBG(("gethostbyname(%s) failed: %s", host, strerror(errno)));
941    return NULL;
942  }
938   if (host == NULL || (he = gethostbyname(host)) == NULL ||
939      (sock = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) {
940   DBG(("gethostbyname(%s) failed: %s", host, strerror(errno)));
941   return NULL;
942   }
943943
944  sin.sin_family = AF_INET;
945  sin.sin_port = htons((uint16_t) port);
946  sin.sin_addr = * (struct in_addr *) he->h_addr_list[0];
947  ns_set_non_blocking_mode(sock);
944   sin.sin_family = AF_INET;
945   sin.sin_port = htons((uint16_t) port);
946   sin.sin_addr = * (struct in_addr *) he->h_addr_list[0];
947   ns_set_non_blocking_mode(sock);
948948
949  connect_ret_val = connect(sock, (struct sockaddr *) &sin, sizeof(sin));
950  if (ns_is_error(connect_ret_val)) {
951    closesocket(sock);
952    return NULL;
953  } else if ((conn = (struct ns_connection *)
954              NS_MALLOC(sizeof(*conn))) == NULL) {
955    closesocket(sock);
956    return NULL;
957  }
949   connect_ret_val = connect(sock, (struct sockaddr *) &sin, sizeof(sin));
950   if (ns_is_error(connect_ret_val)) {
951   closesocket(sock);
952   return NULL;
953   } else if ((conn = (struct ns_connection *)
954            NS_MALLOC(sizeof(*conn))) == NULL) {
955   closesocket(sock);
956   return NULL;
957   }
958958
959  memset(conn, 0, sizeof(*conn));
960  conn->server = server;
961  conn->sock = sock;
962  conn->connection_data = param;
963  conn->flags = NSF_CONNECTING;
964  conn->last_io_time = time(NULL);
959   memset(conn, 0, sizeof(*conn));
960   conn->server = server;
961   conn->sock = sock;
962   conn->connection_data = param;
963   conn->flags = NSF_CONNECTING;
964   conn->last_io_time = time(NULL);
965965
966966#ifdef NS_ENABLE_SSL
967  if (use_ssl &&
968      (conn->ssl = SSL_new(server->client_ssl_ctx)) != NULL) {
969    SSL_set_fd(conn->ssl, sock);
970  }
967   if (use_ssl &&
968      (conn->ssl = SSL_new(server->client_ssl_ctx)) != NULL) {
969   SSL_set_fd(conn->ssl, sock);
970   }
971971#endif
972972
973  ns_add_conn(server, conn);
974  DBG(("%p %s:%d %d %p", conn, host, port, conn->sock, conn->ssl));
973   ns_add_conn(server, conn);
974   DBG(("%p %s:%d %d %p", conn, host, port, conn->sock, conn->ssl));
975975
976  return conn;
976   return conn;
977977}
978978
979979struct ns_connection *ns_add_sock(struct ns_server *s, sock_t sock, void *p) {
980  struct ns_connection *conn;
981  if ((conn = (struct ns_connection *) NS_MALLOC(sizeof(*conn))) != NULL) {
982    memset(conn, 0, sizeof(*conn));
983    ns_set_non_blocking_mode(sock);
984    conn->sock = sock;
985    conn->connection_data = p;
986    conn->server = s;
987    conn->last_io_time = time(NULL);
988    ns_add_conn(s, conn);
989    DBG(("%p %d", conn, sock));
990  }
991  return conn;
980   struct ns_connection *conn;
981   if ((conn = (struct ns_connection *) NS_MALLOC(sizeof(*conn))) != NULL) {
982   memset(conn, 0, sizeof(*conn));
983   ns_set_non_blocking_mode(sock);
984   conn->sock = sock;
985   conn->connection_data = p;
986   conn->server = s;
987   conn->last_io_time = time(NULL);
988   ns_add_conn(s, conn);
989   DBG(("%p %d", conn, sock));
990   }
991   return conn;
992992}
993993
994994struct ns_connection *ns_next(struct ns_server *s, struct ns_connection *conn) {
995  return conn == NULL ? s->active_connections : conn->next;
995   return conn == NULL ? s->active_connections : conn->next;
996996}
997997
998998void ns_iterate(struct ns_server *server, ns_callback_t cb, void *param) {
999  struct ns_connection *conn, *tmp_conn;
999   struct ns_connection *conn, *tmp_conn;
10001000
1001  for (conn = server->active_connections; conn != NULL; conn = tmp_conn) {
1002    tmp_conn = conn->next;
1003    cb(conn, NS_POLL, param);
1004  }
1001   for (conn = server->active_connections; conn != NULL; conn = tmp_conn) {
1002   tmp_conn = conn->next;
1003   cb(conn, NS_POLL, param);
1004   }
10051005}
10061006
10071007void ns_server_wakeup_ex(struct ns_server *server, ns_callback_t cb,
1008                         void *data, size_t len) {
1009  struct ctl_msg ctl_msg;
1010  if (server->ctl[0] != INVALID_SOCKET && data != NULL &&
1011      len < sizeof(ctl_msg.message)) {
1012    ctl_msg.callback = cb;
1013    memcpy(ctl_msg.message, data, len);
1014    send(server->ctl[0], (char *) &ctl_msg,
1015         offsetof(struct ctl_msg, message) + len, 0);
1016    recv(server->ctl[0], (char *) &len, 1, 0);
1017  }
1008                     void *data, size_t len) {
1009   struct ctl_msg ctl_msg;
1010   if (server->ctl[0] != INVALID_SOCKET && data != NULL &&
1011      len < sizeof(ctl_msg.message)) {
1012   ctl_msg.callback = cb;
1013   memcpy(ctl_msg.message, data, len);
1014   send(server->ctl[0], (char *) &ctl_msg,
1015         offsetof(struct ctl_msg, message) + len, 0);
1016   recv(server->ctl[0], (char *) &len, 1, 0);
1017   }
10181018}
10191019
10201020void ns_server_wakeup(struct ns_server *server) {
1021  ns_server_wakeup_ex(server, NULL, (void *) "", 0);
1021   ns_server_wakeup_ex(server, NULL, (void *) "", 0);
10221022}
10231023
10241024void ns_server_init(struct ns_server *s, void *server_data, ns_callback_t cb) {
1025  memset(s, 0, sizeof(*s));
1026  s->listening_sock = s->ctl[0] = s->ctl[1] = INVALID_SOCKET;
1027  s->server_data = server_data;
1028  s->callback = cb;
1025   memset(s, 0, sizeof(*s));
1026   s->listening_sock = s->ctl[0] = s->ctl[1] = INVALID_SOCKET;
1027   s->server_data = server_data;
1028   s->callback = cb;
10291029
10301030#ifdef _WIN32
1031  { WSADATA data; WSAStartup(MAKEWORD(2, 2), &data); }
1031   { WSADATA data; WSAStartup(MAKEWORD(2, 2), &data); }
10321032#else
1033  // Ignore SIGPIPE signal, so if client cancels the request, it
1034  // won't kill the whole process.
1035  signal(SIGPIPE, SIG_IGN);
1033   // Ignore SIGPIPE signal, so if client cancels the request, it
1034   // won't kill the whole process.
1035   signal(SIGPIPE, SIG_IGN);
10361036#endif
10371037
10381038#ifndef NS_DISABLE_SOCKETPAIR
1039  do {
1040    ns_socketpair2(s->ctl, SOCK_DGRAM);
1041  } while (s->ctl[0] == INVALID_SOCKET);
1039   do {
1040   ns_socketpair2(s->ctl, SOCK_DGRAM);
1041   } while (s->ctl[0] == INVALID_SOCKET);
10421042#endif
10431043
10441044#ifdef NS_ENABLE_SSL
1045  SSL_library_init();
1046  s->client_ssl_ctx = SSL_CTX_new(SSLv23_client_method());
1045   SSL_library_init();
1046   s->client_ssl_ctx = SSL_CTX_new(SSLv23_client_method());
10471047#endif
10481048}
10491049
10501050void ns_server_free(struct ns_server *s) {
1051  struct ns_connection *conn, *tmp_conn;
1051   struct ns_connection *conn, *tmp_conn;
10521052
1053  DBG(("%p", s));
1054  if (s == NULL) return;
1055  // Do one last poll, see https://github.com/cesanta/mongoose/issues/286
1056  ns_server_poll(s, 0);
1053   DBG(("%p", s));
1054   if (s == NULL) return;
1055   // Do one last poll, see https://github.com/cesanta/mongoose/issues/286
1056   ns_server_poll(s, 0);
10571057
1058  if (s->listening_sock != INVALID_SOCKET) closesocket(s->listening_sock);
1059  if (s->ctl[0] != INVALID_SOCKET) closesocket(s->ctl[0]);
1060  if (s->ctl[1] != INVALID_SOCKET) closesocket(s->ctl[1]);
1061  s->listening_sock = s->ctl[0] = s->ctl[1] = INVALID_SOCKET;
1058   if (s->listening_sock != INVALID_SOCKET) closesocket(s->listening_sock);
1059   if (s->ctl[0] != INVALID_SOCKET) closesocket(s->ctl[0]);
1060   if (s->ctl[1] != INVALID_SOCKET) closesocket(s->ctl[1]);
1061   s->listening_sock = s->ctl[0] = s->ctl[1] = INVALID_SOCKET;
10621062
1063  for (conn = s->active_connections; conn != NULL; conn = tmp_conn) {
1064    tmp_conn = conn->next;
1065    ns_close_conn(conn);
1066  }
1063   for (conn = s->active_connections; conn != NULL; conn = tmp_conn) {
1064   tmp_conn = conn->next;
1065   ns_close_conn(conn);
1066   }
10671067
10681068#ifdef NS_ENABLE_SSL
1069  if (s->ssl_ctx != NULL) SSL_CTX_free(s->ssl_ctx);
1070  if (s->client_ssl_ctx != NULL) SSL_CTX_free(s->client_ssl_ctx);
1071  s->ssl_ctx = s->client_ssl_ctx = NULL;
1069   if (s->ssl_ctx != NULL) SSL_CTX_free(s->ssl_ctx);
1070   if (s->client_ssl_ctx != NULL) SSL_CTX_free(s->client_ssl_ctx);
1071   s->ssl_ctx = s->client_ssl_ctx = NULL;
10721072#endif
10731073}
10741074// net_skeleton end
r31373r31374
11681168#endif
11691169
11701170struct vec {
1171  const char *ptr;
1172  int len;
1171   const char *ptr;
1172   int len;
11731173};
11741174
11751175// For directory listing and WevDAV support
11761176struct dir_entry {
1177  struct connection *conn;
1178  char *file_name;
1179  file_stat_t st;
1177   struct connection *conn;
1178   char *file_name;
1179   file_stat_t st;
11801180};
11811181
11821182// NOTE(lsm): this enum shoulds be in sync with the config_options.
11831183enum {
1184  ACCESS_CONTROL_LIST,
1184   ACCESS_CONTROL_LIST,
11851185#ifndef MONGOOSE_NO_FILESYSTEM
1186  ACCESS_LOG_FILE,
1186   ACCESS_LOG_FILE,
11871187#ifndef MONGOOSE_NO_AUTH
1188  AUTH_DOMAIN,
1188   AUTH_DOMAIN,
11891189#endif
11901190#ifndef MONGOOSE_NO_CGI
1191  CGI_INTERPRETER,
1192  CGI_PATTERN,
1191   CGI_INTERPRETER,
1192   CGI_PATTERN,
11931193#endif
1194  DAV_AUTH_FILE,
1195  DOCUMENT_ROOT,
1194   DAV_AUTH_FILE,
1195   DOCUMENT_ROOT,
11961196#ifndef MONGOOSE_NO_DIRECTORY_LISTING
1197  ENABLE_DIRECTORY_LISTING,
1197   ENABLE_DIRECTORY_LISTING,
11981198#endif
11991199#endif
1200  EXTRA_MIME_TYPES,
1200   EXTRA_MIME_TYPES,
12011201#if !defined(MONGOOSE_NO_FILESYSTEM) && !defined(MONGOOSE_NO_AUTH)
1202  GLOBAL_AUTH_FILE,
1202   GLOBAL_AUTH_FILE,
12031203#endif
12041204#ifndef MONGOOSE_NO_FILESYSTEM
1205  HIDE_FILES_PATTERN,
1206  HEXDUMP_FILE,
1207  INDEX_FILES,
1205   HIDE_FILES_PATTERN,
1206   HEXDUMP_FILE,
1207   INDEX_FILES,
12081208#endif
1209  LISTENING_PORT,
1209   LISTENING_PORT,
12101210#ifndef _WIN32
1211  RUN_AS_USER,
1211   RUN_AS_USER,
12121212#endif
12131213#ifndef MONGOOSE_NO_SSI
1214  SSI_PATTERN,
1214   SSI_PATTERN,
12151215#endif
12161216#ifdef NS_ENABLE_SSL
1217  SSL_CERTIFICATE,
1218  SSL_CA_CERTIFICATE,
1219  SSL_MITM_CERTS,
1217   SSL_CERTIFICATE,
1218   SSL_CA_CERTIFICATE,
1219   SSL_MITM_CERTS,
12201220#endif
1221  URL_REWRITES,
1222  NUM_OPTIONS
1221   URL_REWRITES,
1222   NUM_OPTIONS
12231223};
12241224
12251225static const char *static_config_options[] = {
1226  "access_control_list", NULL,
1226   "access_control_list", NULL,
12271227#ifndef MONGOOSE_NO_FILESYSTEM
1228  "access_log_file", NULL,
1228   "access_log_file", NULL,
12291229#ifndef MONGOOSE_NO_AUTH
1230  "auth_domain", "mydomain.com",
1230   "auth_domain", "mydomain.com",
12311231#endif
12321232#ifndef MONGOOSE_NO_CGI
1233  "cgi_interpreter", NULL,
1234  "cgi_pattern", DEFAULT_CGI_PATTERN,
1233   "cgi_interpreter", NULL,
1234   "cgi_pattern", DEFAULT_CGI_PATTERN,
12351235#endif
1236  "dav_auth_file", NULL,
1237  "document_root",  NULL,
1236   "dav_auth_file", NULL,
1237   "document_root",  NULL,
12381238#ifndef MONGOOSE_NO_DIRECTORY_LISTING
1239  "enable_directory_listing", "yes",
1239   "enable_directory_listing", "yes",
12401240#endif
12411241#endif
1242  "extra_mime_types", NULL,
1242   "extra_mime_types", NULL,
12431243#if !defined(MONGOOSE_NO_FILESYSTEM) && !defined(MONGOOSE_NO_AUTH)
1244  "global_auth_file", NULL,
1244   "global_auth_file", NULL,
12451245#endif
12461246#ifndef MONGOOSE_NO_FILESYSTEM
1247  "hide_files_patterns", NULL,
1248  "hexdump_file", NULL,
1249  "index_files","index.html,index.htm,index.shtml,index.cgi,index.php,index.lp",
1247   "hide_files_patterns", NULL,
1248   "hexdump_file", NULL,
1249   "index_files","index.html,index.htm,index.shtml,index.cgi,index.php,index.lp",
12501250#endif
1251  "listening_port", NULL,
1251   "listening_port", NULL,
12521252#ifndef _WIN32
1253  "run_as_user", NULL,
1253   "run_as_user", NULL,
12541254#endif
12551255#ifndef MONGOOSE_NO_SSI
1256  "ssi_pattern", "**.shtml$|**.shtm$",
1256   "ssi_pattern", "**.shtml$|**.shtm$",
12571257#endif
12581258#ifdef NS_ENABLE_SSL
1259  "ssl_certificate", NULL,
1260  "ssl_ca_certificate", NULL,
1261  "ssl_mitm_certs", NULL,
1259   "ssl_certificate", NULL,
1260   "ssl_ca_certificate", NULL,
1261   "ssl_mitm_certs", NULL,
12621262#endif
1263  "url_rewrites", NULL,
1264  NULL
1263   "url_rewrites", NULL,
1264   NULL
12651265};
12661266
12671267struct mg_server {
1268  struct ns_server ns_server;
1269  union socket_address lsa;   // Listening socket address
1270  mg_handler_t event_handler;
1271  char *config_options[NUM_OPTIONS];
1268   struct ns_server ns_server;
1269   union socket_address lsa;   // Listening socket address
1270   mg_handler_t event_handler;
1271   char *config_options[NUM_OPTIONS];
12721272};
12731273
12741274// Local endpoint representation
12751275union endpoint {
1276  int fd;                     // Opened regular local file
1277  struct ns_connection *nc;   // CGI or proxy->target connection
1276   int fd;                     // Opened regular local file
1277   struct ns_connection *nc;   // CGI or proxy->target connection
12781278};
12791279
12801280enum endpoint_type {
1281 EP_NONE, EP_FILE, EP_CGI, EP_USER, EP_PUT, EP_CLIENT, EP_PROXY
1281   EP_NONE, EP_FILE, EP_CGI, EP_USER, EP_PUT, EP_CLIENT, EP_PROXY
12821282};
12831283
12841284#define MG_HEADERS_SENT NSF_USER_1
r31373r31374
12871287#define MG_PROXY_CONN NSF_USER_4
12881288
12891289struct connection {
1290  struct ns_connection *ns_conn;  // NOTE(lsm): main.c depends on this order
1291  struct mg_connection mg_conn;
1292  struct mg_server *server;
1293  union endpoint endpoint;
1294  enum endpoint_type endpoint_type;
1295  char *path_info;
1296  char *request;
1297  int64_t num_bytes_sent; // Total number of bytes sent
1298  int64_t cl;             // Reply content length, for Range support
1299  int request_len;  // Request length, including last \r\n after last header
1290   struct ns_connection *ns_conn;  // NOTE(lsm): main.c depends on this order
1291   struct mg_connection mg_conn;
1292   struct mg_server *server;
1293   union endpoint endpoint;
1294   enum endpoint_type endpoint_type;
1295   char *path_info;
1296   char *request;
1297   int64_t num_bytes_sent; // Total number of bytes sent
1298   int64_t cl;             // Reply content length, for Range support
1299   int request_len;  // Request length, including last \r\n after last header
13001300};
13011301
13021302#define MG_CONN_2_CONN(c) ((struct connection *) ((char *) (c) - \
1303  offsetof(struct connection, mg_conn)))
1303   offsetof(struct connection, mg_conn)))
13041304
13051305static void open_local_endpoint(struct connection *conn, int skip_user);
13061306static void close_local_endpoint(struct connection *conn);
13071307
13081308static const struct {
1309  const char *extension;
1310  size_t ext_len;
1311  const char *mime_type;
1309   const char *extension;
1310   size_t ext_len;
1311   const char *mime_type;
13121312} static_builtin_mime_types[] = {
1313  {".html", 5, "text/html"},
1314  {".htm", 4, "text/html"},
1315  {".shtm", 5, "text/html"},
1316  {".shtml", 6, "text/html"},
1317  {".css", 4, "text/css"},
1318  {".js",  3, "application/x-javascript"},
1319  {".ico", 4, "image/x-icon"},
1320  {".gif", 4, "image/gif"},
1321  {".jpg", 4, "image/jpeg"},
1322  {".jpeg", 5, "image/jpeg"},
1323  {".png", 4, "image/png"},
1324  {".svg", 4, "image/svg+xml"},
1325  {".txt", 4, "text/plain"},
1326  {".torrent", 8, "application/x-bittorrent"},
1327  {".wav", 4, "audio/x-wav"},
1328  {".mp3", 4, "audio/x-mp3"},
1329  {".mid", 4, "audio/mid"},
1330  {".m3u", 4, "audio/x-mpegurl"},
1331  {".ogg", 4, "application/ogg"},
1332  {".ram", 4, "audio/x-pn-realaudio"},
1333  {".xml", 4, "text/xml"},
1334  {".json",  5, "text/json"},
1335  {".xslt", 5, "application/xml"},
1336  {".xsl", 4, "application/xml"},
1337  {".ra",  3, "audio/x-pn-realaudio"},
1338  {".doc", 4, "application/msword"},
1339  {".exe", 4, "application/octet-stream"},
1340  {".zip", 4, "application/x-zip-compressed"},
1341  {".xls", 4, "application/excel"},
1342  {".tgz", 4, "application/x-tar-gz"},
1343  {".tar", 4, "application/x-tar"},
1344  {".gz",  3, "application/x-gunzip"},
1345  {".arj", 4, "application/x-arj-compressed"},
1346  {".rar", 4, "application/x-rar-compressed"},
1347  {".rtf", 4, "application/rtf"},
1348  {".pdf", 4, "application/pdf"},
1349  {".swf", 4, "application/x-shockwave-flash"},
1350  {".mpg", 4, "video/mpeg"},
1351  {".webm", 5, "video/webm"},
1352  {".mpeg", 5, "video/mpeg"},
1353  {".mov", 4, "video/quicktime"},
1354  {".mp4", 4, "video/mp4"},
1355  {".m4v", 4, "video/x-m4v"},
1356  {".asf", 4, "video/x-ms-asf"},
1357  {".avi", 4, "video/x-msvideo"},
1358  {".bmp", 4, "image/bmp"},
1359  {".ttf", 4, "application/x-font-ttf"},
1360  {NULL,  0, NULL}
1313   {".html", 5, "text/html"},
1314   {".htm", 4, "text/html"},
1315   {".shtm", 5, "text/html"},
1316   {".shtml", 6, "text/html"},
1317   {".css", 4, "text/css"},
1318   {".js",  3, "application/x-javascript"},
1319   {".ico", 4, "image/x-icon"},
1320   {".gif", 4, "image/gif"},
1321   {".jpg", 4, "image/jpeg"},
1322   {".jpeg", 5, "image/jpeg"},
1323   {".png", 4, "image/png"},
1324   {".svg", 4, "image/svg+xml"},
1325   {".txt", 4, "text/plain"},
1326   {".torrent", 8, "application/x-bittorrent"},
1327   {".wav", 4, "audio/x-wav"},
1328   {".mp3", 4, "audio/x-mp3"},
1329   {".mid", 4, "audio/mid"},
1330   {".m3u", 4, "audio/x-mpegurl"},
1331   {".ogg", 4, "application/ogg"},
1332   {".ram", 4, "audio/x-pn-realaudio"},
1333   {".xml", 4, "text/xml"},
1334   {".json",  5, "text/json"},
1335   {".xslt", 5, "application/xml"},
1336   {".xsl", 4, "application/xml"},
1337   {".ra",  3, "audio/x-pn-realaudio"},
1338   {".doc", 4, "application/msword"},
1339   {".exe", 4, "application/octet-stream"},
1340   {".zip", 4, "application/x-zip-compressed"},
1341   {".xls", 4, "application/excel"},
1342   {".tgz", 4, "application/x-tar-gz"},
1343   {".tar", 4, "application/x-tar"},
1344   {".gz",  3, "application/x-gunzip"},
1345   {".arj", 4, "application/x-arj-compressed"},
1346   {".rar", 4, "application/x-rar-compressed"},
1347   {".rtf", 4, "application/rtf"},
1348   {".pdf", 4, "application/pdf"},
1349   {".swf", 4, "application/x-shockwave-flash"},
1350   {".mpg", 4, "video/mpeg"},
1351   {".webm", 5, "video/webm"},
1352   {".mpeg", 5, "video/mpeg"},
1353   {".mov", 4, "video/quicktime"},
1354   {".mp4", 4, "video/mp4"},
1355   {".m4v", 4, "video/x-m4v"},
1356   {".asf", 4, "video/x-ms-asf"},
1357   {".avi", 4, "video/x-msvideo"},
1358   {".bmp", 4, "image/bmp"},
1359   {".ttf", 4, "application/x-font-ttf"},
1360   {NULL,  0, NULL}
13611361};
13621362
13631363#ifndef MONGOOSE_NO_THREADS
13641364void *mg_start_thread(void *(*f)(void *), void *p) {
1365  return ns_start_thread(f, p);
1365   return ns_start_thread(f, p);
13661366}
13671367#endif  // MONGOOSE_NO_THREADS
13681368
r31373r31374
13701370// Encode 'path' which is assumed UTF-8 string, into UNICODE string.
13711371// wbuf and wbuf_len is a target buffer and its length.
13721372static void to_wchar(const char *path, wchar_t *wbuf, size_t wbuf_len) {
1373  char buf[MAX_PATH_SIZE * 2], buf2[MAX_PATH_SIZE * 2], *p;
1373   char buf[MAX_PATH_SIZE * 2], buf2[MAX_PATH_SIZE * 2], *p;
13741374
1375  strncpy(buf, path, sizeof(buf));
1376  buf[sizeof(buf) - 1] = '\0';
1375   strncpy(buf, path, sizeof(buf));
1376   buf[sizeof(buf) - 1] = '\0';
13771377
1378  // Trim trailing slashes. Leave backslash for paths like "X:\"
1379  p = buf + strlen(buf) - 1;
1380  while (p > buf && p[-1] != ':' && (p[0] == '\\' || p[0] == '/')) *p-- = '\0';
1378   // Trim trailing slashes. Leave backslash for paths like "X:\"
1379   p = buf + strlen(buf) - 1;
1380   while (p > buf && p[-1] != ':' && (p[0] == '\\' || p[0] == '/')) *p-- = '\0';
13811381
1382  // Convert to Unicode and back. If doubly-converted string does not
1383  // match the original, something is fishy, reject.
1384  memset(wbuf, 0, wbuf_len * sizeof(wchar_t));
1385  MultiByteToWideChar(CP_UTF8, 0, buf, -1, wbuf, (int) wbuf_len);
1386  WideCharToMultiByte(CP_UTF8, 0, wbuf, (int) wbuf_len, buf2, sizeof(buf2),
1387                      NULL, NULL);
1388  if (strcmp(buf, buf2) != 0) {
1389    wbuf[0] = L'\0';
1390  }
1382   // Convert to Unicode and back. If doubly-converted string does not
1383   // match the original, something is fishy, reject.
1384   memset(wbuf, 0, wbuf_len * sizeof(wchar_t));
1385   MultiByteToWideChar(CP_UTF8, 0, buf, -1, wbuf, (int) wbuf_len);
1386   WideCharToMultiByte(CP_UTF8, 0, wbuf, (int) wbuf_len, buf2, sizeof(buf2),
1387                  NULL, NULL);
1388   if (strcmp(buf, buf2) != 0) {
1389   wbuf[0] = L'\0';
1390   }
13911391}
13921392
13931393static int mg_stat(const char *path, file_stat_t *st) {
1394  wchar_t wpath[MAX_PATH_SIZE];
1395  to_wchar(path, wpath, ARRAY_SIZE(wpath));
1396  DBG(("[%ls] -> %d", wpath, _wstati64(wpath, st)));
1397  return _wstati64(wpath, st);
1394   wchar_t wpath[MAX_PATH_SIZE];
1395   to_wchar(path, wpath, ARRAY_SIZE(wpath));
1396   DBG(("[%ls] -> %d", wpath, _wstati64(wpath, st)));
1397   return _wstati64(wpath, st);
13981398}
13991399
14001400static FILE *mg_fopen(const char *path, const char *mode) {
1401  wchar_t wpath[MAX_PATH_SIZE], wmode[10];
1402  to_wchar(path, wpath, ARRAY_SIZE(wpath));
1403  to_wchar(mode, wmode, ARRAY_SIZE(wmode));
1404  return _wfopen(wpath, wmode);
1401   wchar_t wpath[MAX_PATH_SIZE], wmode[10];
1402   to_wchar(path, wpath, ARRAY_SIZE(wpath));
1403   to_wchar(mode, wmode, ARRAY_SIZE(wmode));
1404   return _wfopen(wpath, wmode);
14051405}
14061406
14071407static int mg_open(const char *path, int flag) {
1408  wchar_t wpath[MAX_PATH_SIZE];
1409  to_wchar(path, wpath, ARRAY_SIZE(wpath));
1410  return _wopen(wpath, flag);
1408   wchar_t wpath[MAX_PATH_SIZE];
1409   to_wchar(path, wpath, ARRAY_SIZE(wpath));
1410   return _wopen(wpath, flag);
14111411}
14121412#endif // _WIN32 && !MONGOOSE_NO_FILESYSTEM
14131413
r31373r31374
14181418// vector is initialized to point to the "y" part, and val vector length
14191419// is adjusted to point only to "x".
14201420static const char *next_option(const char *list, struct vec *val,
1421                               struct vec *eq_val) {
1422  if (list == NULL || *list == '\0') {
1423    // End of the list
1424    list = NULL;
1425  } else {
1426    val->ptr = list;
1427    if ((list = strchr(val->ptr, ',')) != NULL) {
1428      // Comma found. Store length and shift the list ptr
1429      val->len = list - val->ptr;
1430      list++;
1431    } else {
1432      // This value is the last one
1433      list = val->ptr + strlen(val->ptr);
1434      val->len = list - val->ptr;
1435    }
1421                        struct vec *eq_val) {
1422   if (list == NULL || *list == '\0') {
1423   // End of the list
1424   list = NULL;
1425   } else {
1426   val->ptr = list;
1427   if ((list = strchr(val->ptr, ',')) != NULL) {
1428      // Comma found. Store length and shift the list ptr
1429      val->len = list - val->ptr;
1430      list++;
1431   } else {
1432      // This value is the last one
1433      list = val->ptr + strlen(val->ptr);
1434      val->len = list - val->ptr;
1435   }
14361436
1437    if (eq_val != NULL) {
1438      // Value has form "x=y", adjust pointers and lengths
1439      // so that val points to "x", and eq_val points to "y".
1440      eq_val->len = 0;
1441      eq_val->ptr = (const char *) memchr(val->ptr, '=', val->len);
1442      if (eq_val->ptr != NULL) {
1443        eq_val->ptr++;  // Skip over '=' character
1444        eq_val->len = val->ptr + val->len - eq_val->ptr;
1445        val->len = (eq_val->ptr - val->ptr) - 1;
1446      }
1447    }
1448  }
1437   if (eq_val != NULL) {
1438      // Value has form "x=y", adjust pointers and lengths
1439      // so that val points to "x", and eq_val points to "y".
1440      eq_val->len = 0;
1441      eq_val->ptr = (const char *) memchr(val->ptr, '=', val->len);
1442      if (eq_val->ptr != NULL) {
1443      eq_val->ptr++;  // Skip over '=' character
1444      eq_val->len = val->ptr + val->len - eq_val->ptr;
1445      val->len = (eq_val->ptr - val->ptr) - 1;
1446      }
1447   }
1448   }
14491449
1450  return list;
1450   return list;
14511451}
14521452
14531453// Like snprintf(), but never returns negative value, or a value
14541454// that is larger than a supplied buffer.
14551455static int mg_vsnprintf(char *buf, size_t buflen, const char *fmt, va_list ap) {
1456  int n;
1457  if (buflen < 1) return 0;
1458  n = vsnprintf(buf, buflen, fmt, ap);
1459  if (n < 0) {
1460    n = 0;
1461  } else if (n >= (int) buflen) {
1462    n = (int) buflen - 1;
1463  }
1464  buf[n] = '\0';
1465  return n;
1456   int n;
1457   if (buflen < 1) return 0;
1458   n = vsnprintf(buf, buflen, fmt, ap);
1459   if (n < 0) {
1460   n = 0;
1461   } else if (n >= (int) buflen) {
1462   n = (int) buflen - 1;
1463   }
1464   buf[n] = '\0';
1465   return n;
14661466}
14671467
14681468static int mg_snprintf(char *buf, size_t buflen, const char *fmt, ...) {
1469  va_list ap;
1470  int n;
1471  va_start(ap, fmt);
1472  n = mg_vsnprintf(buf, buflen, fmt, ap);
1473  va_end(ap);
1474  return n;
1469   va_list ap;
1470   int n;
1471   va_start(ap, fmt);
1472   n = mg_vsnprintf(buf, buflen, fmt, ap);
1473   va_end(ap);
1474   return n;
14751475}
14761476
14771477// Check whether full request is buffered. Return:
r31373r31374
14791479//    0  if request is not yet fully buffered
14801480//   >0  actual request length, including last \r\n\r\n
14811481static int get_request_len(const char *s, int buf_len) {
1482  const unsigned char *buf = (unsigned char *) s;
1483  int i;
1482   const unsigned char *buf = (unsigned char *) s;
1483   int i;
14841484
1485  for (i = 0; i < buf_len; i++) {
1486    // Control characters are not allowed but >=128 are.
1487    // Abort scan as soon as one malformed character is found.
1488    if (!isprint(buf[i]) && buf[i] != '\r' && buf[i] != '\n' && buf[i] < 128) {
1489      return -1;
1490    } else if (buf[i] == '\n' && i + 1 < buf_len && buf[i + 1] == '\n') {
1491      return i + 2;
1492    } else if (buf[i] == '\n' && i + 2 < buf_len && buf[i + 1] == '\r' &&
1493               buf[i + 2] == '\n') {
1494      return i + 3;
1495    }
1496  }
1485   for (i = 0; i < buf_len; i++) {
1486   // Control characters are not allowed but >=128 are.
1487   // Abort scan as soon as one malformed character is found.
1488   if (!isprint(buf[i]) && buf[i] != '\r' && buf[i] != '\n' && buf[i] < 128) {
1489      return -1;
1490   } else if (buf[i] == '\n' && i + 1 < buf_len && buf[i + 1] == '\n') {
1491      return i + 2;
1492   } else if (buf[i] == '\n' && i + 2 < buf_len && buf[i + 1] == '\r' &&
1493            buf[i + 2] == '\n') {
1494      return i + 3;
1495   }
1496   }
14971497
1498  return 0;
1498   return 0;
14991499}
15001500
15011501// Skip the characters until one of the delimiters characters found.
15021502// 0-terminate resulting word. Skip the rest of the delimiters if any.
15031503// Advance pointer to buffer to the next word. Return found 0-terminated word.
15041504static char *skip(char **buf, const char *delimiters) {
1505  char *p, *begin_word, *end_word, *end_delimiters;
1505   char *p, *begin_word, *end_word, *end_delimiters;
15061506
1507  begin_word = *buf;
1508  end_word = begin_word + strcspn(begin_word, delimiters);
1509  end_delimiters = end_word + strspn(end_word, delimiters);
1507   begin_word = *buf;
1508   end_word = begin_word + strcspn(begin_word, delimiters);
1509   end_delimiters = end_word + strspn(end_word, delimiters);
15101510
1511  for (p = end_word; p < end_delimiters; p++) {
1512    *p = '\0';
1513  }
1511   for (p = end_word; p < end_delimiters; p++) {
1512   *p = '\0';
1513   }
15141514
1515  *buf = end_delimiters;
1515   *buf = end_delimiters;
15161516
1517  return begin_word;
1517   return begin_word;
15181518}
15191519
15201520// Parse HTTP headers from the given buffer, advance buffer to the point
15211521// where parsing stopped.
15221522static void parse_http_headers(char **buf, struct mg_connection *ri) {
1523  size_t i;
1523   size_t i;
15241524
1525  for (i = 0; i < ARRAY_SIZE(ri->http_headers); i++) {
1526    ri->http_headers[i].name = skip(buf, ": ");
1527    ri->http_headers[i].value = skip(buf, "\r\n");
1528    if (ri->http_headers[i].name[0] == '\0')
1529      break;
1530    ri->num_headers = i + 1;
1531  }
1525   for (i = 0; i < ARRAY_SIZE(ri->http_headers); i++) {
1526   ri->http_headers[i].name = skip(buf, ": ");
1527   ri->http_headers[i].value = skip(buf, "\r\n");
1528   if (ri->http_headers[i].name[0] == '\0')
1529      break;
1530   ri->num_headers = i + 1;
1531   }
15321532}
15331533
15341534static const char *status_code_to_str(int status_code) {
1535  switch (status_code) {
1536    case 200: return "OK";
1537    case 201: return "Created";
1538    case 204: return "No Content";
1539    case 301: return "Moved Permanently";
1540    case 302: return "Found";
1541    case 304: return "Not Modified";
1542    case 400: return "Bad Request";
1543    case 403: return "Forbidden";
1544    case 404: return "Not Found";
1545    case 405: return "Method Not Allowed";
1546    case 409: return "Conflict";
1547    case 411: return "Length Required";
1548    case 413: return "Request Entity Too Large";
1549    case 415: return "Unsupported Media Type";
1550    case 423: return "Locked";
1551    case 500: return "Server Error";
1552    case 501: return "Not Implemented";
1553    default:  return "Server Error";
1554  }
1535   switch (status_code) {
1536   case 200: return "OK";
1537   case 201: return "Created";
1538   case 204: return "No Content";
1539   case 301: return "Moved Permanently";
1540   case 302: return "Found";
1541   case 304: return "Not Modified";
1542   case 400: return "Bad Request";
1543   case 403: return "Forbidden";
1544   case 404: return "Not Found";
1545   case 405: return "Method Not Allowed";
1546   case 409: return "Conflict";
1547   case 411: return "Length Required";
1548   case 413: return "Request Entity Too Large";
1549   case 415: return "Unsupported Media Type";
1550   case 423: return "Locked";
1551   case 500: return "Server Error";
1552   case 501: return "Not Implemented";
1553   default:  return "Server Error";
1554   }
15551555}
15561556
15571557static int call_user(struct connection *conn, enum mg_event ev) {
1558  return conn != NULL && conn->server != NULL &&
1559    conn->server->event_handler != NULL ?
1560    conn->server->event_handler(&conn->mg_conn, ev) : MG_FALSE;
1558   return conn != NULL && conn->server != NULL &&
1559   conn->server->event_handler != NULL ?
1560   conn->server->event_handler(&conn->mg_conn, ev) : MG_FALSE;
15611561}
15621562
15631563static void send_http_error(struct connection *conn, int code,
1564                            const char *fmt, ...) {
1565  const char *message = status_code_to_str(code);
1566  const char *rewrites = conn->server->config_options[URL_REWRITES];
1567  char headers[200], body[200];
1568  struct vec a, b;
1569  va_list ap;
1570  int body_len, headers_len, match_code;
1564                     const char *fmt, ...) {
1565   const char *message = status_code_to_str(code);
1566   const char *rewrites = conn->server->config_options[URL_REWRITES];
1567   char headers[200], body[200];
1568   struct vec a, b;
1569   va_list ap;
1570   int body_len, headers_len, match_code;
15711571
1572  conn->mg_conn.status_code = code;
1572   conn->mg_conn.status_code = code;
15731573
1574  // Invoke error handler if it is set
1575  if (call_user(conn, MG_HTTP_ERROR) == MG_TRUE) {
1576    close_local_endpoint(conn);
1577    return;
1578  }
1574   // Invoke error handler if it is set
1575   if (call_user(conn, MG_HTTP_ERROR) == MG_TRUE) {
1576   close_local_endpoint(conn);
1577   return;
1578   }
15791579
1580  // Handle error code rewrites
1581  while ((rewrites = next_option(rewrites, &a, &b)) != NULL) {
1582    if ((match_code = atoi(a.ptr)) > 0 && match_code == code) {
1583      struct mg_connection *c = &conn->mg_conn;
1584      c->status_code = 302;
1585      mg_printf(c, "HTTP/1.1 %d Moved\r\n"
1586                "Location: %.*s?code=%d&orig_uri=%s&query_string=%s\r\n\r\n",
1587                c->status_code, b.len, b.ptr, code, c->uri,
1588                c->query_string == NULL ? "" : c->query_string);
1589      close_local_endpoint(conn);
1590      return;
1591    }
1592  }
1580   // Handle error code rewrites
1581   while ((rewrites = next_option(rewrites, &a, &b)) != NULL) {
1582   if ((match_code = atoi(a.ptr)) > 0 && match_code == code) {
1583      struct mg_connection *c = &conn->mg_conn;
1584      c->status_code = 302;
1585      mg_printf(c, "HTTP/1.1 %d Moved\r\n"
1586            "Location: %.*s?code=%d&orig_uri=%s&query_string=%s\r\n\r\n",
1587            c->status_code, b.len, b.ptr, code, c->uri,
1588            c->query_string == NULL ? "" : c->query_string);
1589      close_local_endpoint(conn);
1590      return;
1591   }
1592   }
15931593
1594  body_len = mg_snprintf(body, sizeof(body), "%d %s\n", code, message);
1595  if (fmt != NULL) {
1596    va_start(ap, fmt);
1597    body_len += mg_vsnprintf(body + body_len, sizeof(body) - body_len, fmt, ap);
1598    va_end(ap);
1599  }
1600  if ((code >= 300 && code <= 399) || code == 204) {
1601    // 3xx errors do not have body
1602    body_len = 0;
1603  }
1604  headers_len = mg_snprintf(headers, sizeof(headers),
1605                            "HTTP/1.1 %d %s\r\nContent-Length: %d\r\n"
1606                            "Content-Type: text/plain\r\n\r\n",
1607                            code, message, body_len);
1608  ns_send(conn->ns_conn, headers, headers_len);
1609  ns_send(conn->ns_conn, body, body_len);
1610  close_local_endpoint(conn);  // This will write to the log file
1594   body_len = mg_snprintf(body, sizeof(body), "%d %s\n", code, message);
1595   if (fmt != NULL) {
1596   va_start(ap, fmt);
1597   body_len += mg_vsnprintf(body + body_len, sizeof(body) - body_len, fmt, ap);
1598   va_end(ap);
1599   }
1600   if ((code >= 300 && code <= 399) || code == 204) {
1601   // 3xx errors do not have body
1602   body_len = 0;
1603   }
1604   headers_len = mg_snprintf(headers, sizeof(headers),
1605                     "HTTP/1.1 %d %s\r\nContent-Length: %d\r\n"
1606                     "Content-Type: text/plain\r\n\r\n",
1607                     code, message, body_len);
1608   ns_send(conn->ns_conn, headers, headers_len);
1609   ns_send(conn->ns_conn, body, body_len);
1610   close_local_endpoint(conn);  // This will write to the log file
16111611}
16121612
16131613static void write_chunk(struct connection *conn, const char *buf, int len) {
1614  char chunk_size[50];
1615  int n = mg_snprintf(chunk_size, sizeof(chunk_size), "%X\r\n", len);
1616  ns_send(conn->ns_conn, chunk_size, n);
1617  ns_send(conn->ns_conn, buf, len);
1618  ns_send(conn->ns_conn, "\r\n", 2);
1614   char chunk_size[50];
1615   int n = mg_snprintf(chunk_size, sizeof(chunk_size), "%X\r\n", len);
1616   ns_send(conn->ns_conn, chunk_size, n);
1617   ns_send(conn->ns_conn, buf, len);
1618   ns_send(conn->ns_conn, "\r\n", 2);
16191619}
16201620
16211621size_t mg_printf(struct mg_connection *conn, const char *fmt, ...) {
1622  struct connection *c = MG_CONN_2_CONN(conn);
1623  va_list ap;
1622   struct connection *c = MG_CONN_2_CONN(conn);
1623   va_list ap;
16241624
1625  va_start(ap, fmt);
1626  ns_vprintf(c->ns_conn, fmt, ap);
1627  va_end(ap);
1625   va_start(ap, fmt);
1626   ns_vprintf(c->ns_conn, fmt, ap);
1627   va_end(ap);
16281628
1629  return c->ns_conn->send_iobuf.len;
1629   return c->ns_conn->send_iobuf.len;
16301630}
16311631
16321632static void ns_forward(struct ns_connection *from, struct ns_connection *to) {
1633  DBG(("%p -> %p %zu bytes", from, to, from->recv_iobuf.len));
1634  ns_send(to, from->recv_iobuf.buf, from->recv_iobuf.len);
1635  iobuf_remove(&from->recv_iobuf, from->recv_iobuf.len);
1633   DBG(("%p -> %p %zu bytes", from, to, from->recv_iobuf.len));
1634   ns_send(to, from->recv_iobuf.buf, from->recv_iobuf.len);
1635   iobuf_remove(&from->recv_iobuf, from->recv_iobuf.len);
16361636}
16371637
16381638#ifndef MONGOOSE_NO_CGI
16391639#ifdef _WIN32
16401640struct threadparam {
1641  sock_t s;
1642  HANDLE hPipe;
1641   sock_t s;
1642   HANDLE hPipe;
16431643};
16441644
16451645static int wait_until_ready(sock_t sock, int for_read) {
1646  fd_set set;
1647  FD_ZERO(&set);
1648  FD_SET(sock, &set);
1649  select(sock + 1, for_read ? &set : 0, for_read ? 0 : &set, 0, 0);
1650  return 1;
1646   fd_set set;
1647   FD_ZERO(&set);
1648   FD_SET(sock, &set);
1649   select(sock + 1, for_read ? &set : 0, for_read ? 0 : &set, 0, 0);
1650   return 1;
16511651}
16521652
16531653static void *push_to_stdin(void *arg) {
1654  struct threadparam *tp = (struct threadparam *)arg;
1655  int n, sent, stop = 0;
1656  DWORD k;
1657  char buf[IOBUF_SIZE];
1654   struct threadparam *tp = (struct threadparam *)arg;
1655   int n, sent, stop = 0;
1656   DWORD k;
1657   char buf[IOBUF_SIZE];
16581658
1659  while (!stop && wait_until_ready(tp->s, 1) &&
1660         (n = recv(tp->s, buf, sizeof(buf), 0)) > 0) {
1661    if (n == -1 && GetLastError() == WSAEWOULDBLOCK) continue;
1662    for (sent = 0; !stop && sent < n; sent += k) {
1663      if (!WriteFile(tp->hPipe, buf + sent, n - sent, &k, 0)) stop = 1;
1664    }
1665  }
1666  DBG(("%s", "FORWARED EVERYTHING TO CGI"));
1667  CloseHandle(tp->hPipe);
1668  free(tp);
1669  _endthread();
1670  return NULL;
1659   while (!stop && wait_until_ready(tp->s, 1) &&
1660         (n = recv(tp->s, buf, sizeof(buf), 0)) > 0) {
1661   if (n == -1 && GetLastError() == WSAEWOULDBLOCK) continue;
1662   for (sent = 0; !stop && sent < n; sent += k) {
1663      if (!WriteFile(tp->hPipe, buf + sent, n - sent, &k, 0)) stop = 1;
1664   }
1665   }
1666   DBG(("%s", "FORWARED EVERYTHING TO CGI"));
1667   CloseHandle(tp->hPipe);
1668   free(tp);
1669   _endthread();
1670   return NULL;
16711671}
16721672
16731673static void *pull_from_stdout(void *arg) {
1674  struct threadparam *tp = (struct threadparam *)arg;
1675  int k = 0, stop = 0;
1676  DWORD n, sent;
1677  char buf[IOBUF_SIZE];
1674   struct threadparam *tp = (struct threadparam *)arg;
1675   int k = 0, stop = 0;
1676   DWORD n, sent;
1677   char buf[IOBUF_SIZE];
16781678
1679  while (!stop && ReadFile(tp->hPipe, buf, sizeof(buf), &n, NULL)) {
1680    for (sent = 0; !stop && sent < n; sent += k) {
1681      if (wait_until_ready(tp->s, 0) &&
1682          (k = send(tp->s, buf + sent, n - sent, 0)) <= 0) stop = 1;
1683    }
1684  }
1685  DBG(("%s", "EOF FROM CGI"));
1686  CloseHandle(tp->hPipe);
1687  shutdown(tp->s, 2);  // Without this, IO thread may get truncated data
1688  closesocket(tp->s);
1689  free(tp);
1690  _endthread();
1691  return NULL;
1679   while (!stop && ReadFile(tp->hPipe, buf, sizeof(buf), &n, NULL)) {
1680   for (sent = 0; !stop && sent < n; sent += k) {
1681      if (wait_until_ready(tp->s, 0) &&
1682         (k = send(tp->s, buf + sent, n - sent, 0)) <= 0) stop = 1;
1683   }
1684   }
1685   DBG(("%s", "EOF FROM CGI"));
1686   CloseHandle(tp->hPipe);
1687   shutdown(tp->s, 2);  // Without this, IO thread may get truncated data
1688   closesocket(tp->s);
1689   free(tp);
1690   _endthread();
1691   return NULL;
16921692}
16931693
16941694static void spawn_stdio_thread(sock_t sock, HANDLE hPipe,
1695                               void *(*func)(void *)) {
1696  struct threadparam *tp = (struct threadparam *)malloc(sizeof(*tp));
1697  if (tp != NULL) {
1698    tp->s = sock;
1699    tp->hPipe = hPipe;
1700    mg_start_thread(func, tp);
1701  }
1695                        void *(*func)(void *)) {
1696   struct threadparam *tp = (struct threadparam *)malloc(sizeof(*tp));
1697   if (tp != NULL) {
1698   tp->s = sock;
1699   tp->hPipe = hPipe;
1700   mg_start_thread(func, tp);
1701   }
17021702}
17031703
17041704static void abs_path(const char *utf8_path, char *abs_path, size_t len) {
1705  wchar_t buf[MAX_PATH_SIZE], buf2[MAX_PATH_SIZE];
1706  to_wchar(utf8_path, buf, ARRAY_SIZE(buf));
1707  GetFullPathNameW(buf, ARRAY_SIZE(buf2), buf2, NULL);
1708  WideCharToMultiByte(CP_UTF8, 0, buf2, wcslen(buf2) + 1, abs_path, len, 0, 0);
1705   wchar_t buf[MAX_PATH_SIZE], buf2[MAX_PATH_SIZE];
1706   to_wchar(utf8_path, buf, ARRAY_SIZE(buf));
1707   GetFullPathNameW(buf, ARRAY_SIZE(buf2), buf2, NULL);
1708   WideCharToMultiByte(CP_UTF8, 0, buf2, wcslen(buf2) + 1, abs_path, len, 0, 0);
17091709}
17101710
17111711static process_id_t start_process(char *interp, const char *cmd,
1712                                  const char *env, const char *envp[],
1713                                  const char *dir, sock_t sock) {
1714  STARTUPINFOW si = {0};
1715  PROCESS_INFORMATION pi = {0};
1716  HANDLE a[2], b[2], me = GetCurrentProcess();
1717  wchar_t wcmd[MAX_PATH_SIZE], full_dir[MAX_PATH_SIZE];
1718  char buf[MAX_PATH_SIZE], buf4[MAX_PATH_SIZE], buf5[MAX_PATH_SIZE],
1719       cmdline[MAX_PATH_SIZE], *p;
1720  DWORD flags = DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS;
1721  FILE *fp;
1712                           const char *env, const char *envp[],
1713                           const char *dir, sock_t sock) {
1714   STARTUPINFOW si = {0};
1715   PROCESS_INFORMATION pi = {0};
1716   HANDLE a[2], b[2], me = GetCurrentProcess();
1717   wchar_t wcmd[MAX_PATH_SIZE], full_dir[MAX_PATH_SIZE];
1718   char buf[MAX_PATH_SIZE], buf4[MAX_PATH_SIZE], buf5[MAX_PATH_SIZE],
1719      cmdline[MAX_PATH_SIZE], *p;
1720   DWORD flags = DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS;
1721   FILE *fp;
17221722
1723  si.cb = sizeof(si);
1724  si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
1725  si.wShowWindow = SW_HIDE;
1726  si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
1723   si.cb = sizeof(si);
1724   si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
1725   si.wShowWindow = SW_HIDE;
1726   si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
17271727
1728  CreatePipe(&a[0], &a[1], NULL, 0);
1729  CreatePipe(&b[0], &b[1], NULL, 0);
1730  DuplicateHandle(me, a[0], me, &si.hStdInput, 0, TRUE, flags);
1731  DuplicateHandle(me, b[1], me, &si.hStdOutput, 0, TRUE, flags);
1728   CreatePipe(&a[0], &a[1], NULL, 0);
1729   CreatePipe(&b[0], &b[1], NULL, 0);
1730   DuplicateHandle(me, a[0], me, &si.hStdInput, 0, TRUE, flags);
1731   DuplicateHandle(me, b[1], me, &si.hStdOutput, 0, TRUE, flags);
17321732
1733  if (interp == NULL && (fp = fopen(cmd, "r")) != NULL) {
1734    buf[0] = buf[1] = '\0';
1735    fgets(buf, sizeof(buf), fp);
1736    buf[sizeof(buf) - 1] = '\0';
1737    if (buf[0] == '#' && buf[1] == '!') {
1738      interp = buf + 2;
1739      for (p = interp + strlen(interp);
1740           isspace(* (uint8_t *) p) && p > interp; p--) *p = '\0';
1741    }
1742    fclose(fp);
1743  }
1733   if (interp == NULL && (fp = fopen(cmd, "r")) != NULL) {
1734   buf[0] = buf[1] = '\0';
1735   fgets(buf, sizeof(buf), fp);
1736   buf[sizeof(buf) - 1] = '\0';
1737   if (buf[0] == '#' && buf[1] == '!') {
1738      interp = buf + 2;
1739      for (p = interp + strlen(interp);
1740         isspace(* (uint8_t *) p) && p > interp; p--) *p = '\0';
1741   }
1742   fclose(fp);
1743   }
17441744
1745  if (interp != NULL) {
1746    abs_path(interp, buf4, ARRAY_SIZE(buf4));
1747    interp = buf4;
1748  }
1749  abs_path(dir, buf5, ARRAY_SIZE(buf5));
1750  to_wchar(dir, full_dir, ARRAY_SIZE(full_dir));
1751  mg_snprintf(cmdline, sizeof(cmdline), "%s%s\"%s\"",
1752              interp ? interp : "", interp ? " " : "", cmd);
1753  to_wchar(cmdline, wcmd, ARRAY_SIZE(wcmd));
1745   if (interp != NULL) {
1746   abs_path(interp, buf4, ARRAY_SIZE(buf4));
1747   interp = buf4;
1748   }
1749   abs_path(dir, buf5, ARRAY_SIZE(buf5));
1750   to_wchar(dir, full_dir, ARRAY_SIZE(full_dir));
1751   mg_snprintf(cmdline, sizeof(cmdline), "%s%s\"%s\"",
1752            interp ? interp : "", interp ? " " : "", cmd);
1753   to_wchar(cmdline, wcmd, ARRAY_SIZE(wcmd));
17541754
1755  if (CreateProcessW(NULL, wcmd, NULL, NULL, TRUE, CREATE_NEW_PROCESS_GROUP,
1756                     (void *) env, full_dir, &si, &pi) != 0) {
1757    spawn_stdio_thread(sock, a[1], push_to_stdin);
1758    spawn_stdio_thread(sock, b[0], pull_from_stdout);
1759  } else {
1760    CloseHandle(a[1]);
1761    CloseHandle(b[0]);
1762    closesocket(sock);
1763  }
1764  DBG(("CGI command: [%ls] -> %p", wcmd, pi.hProcess));
1755   if (CreateProcessW(NULL, wcmd, NULL, NULL, TRUE, CREATE_NEW_PROCESS_GROUP,
1756                  (void *) env, full_dir, &si, &pi) != 0) {
1757   spawn_stdio_thread(sock, a[1], push_to_stdin);
1758   spawn_stdio_thread(sock, b[0], pull_from_stdout);
1759   } else {
1760   CloseHandle(a[1]);
1761   CloseHandle(b[0]);
1762   closesocket(sock);
1763   }
1764   DBG(("CGI command: [%ls] -> %p", wcmd, pi.hProcess));
17651765
1766  CloseHandle(si.hStdOutput);
1767  CloseHandle(si.hStdInput);
1768  CloseHandle(a[0]);
1769  CloseHandle(b[1]);
1770  CloseHandle(pi.hThread);
1771  CloseHandle(pi.hProcess);
1766   CloseHandle(si.hStdOutput);
1767   CloseHandle(si.hStdInput);
1768   CloseHandle(a[0]);
1769   CloseHandle(b[1]);
1770   CloseHandle(pi.hThread);
1771   CloseHandle(pi.hProcess);
17721772
1773  return pi.hProcess;
1773   return pi.hProcess;
17741774}
17751775#else
17761776static process_id_t start_process(const char *interp, const char *cmd,
1777                                  const char *env, const char *envp[],
1778                                  const char *dir, sock_t sock) {
1779  char buf[500];
1780  process_id_t pid = fork();
1781  (void) env;
1777                           const char *env, const char *envp[],
1778                           const char *dir, sock_t sock) {
1779   char buf[500];
1780   process_id_t pid = fork();
1781   (void) env;
17821782
1783  if (pid == 0) {
1784    (void) chdir(dir);
1785    (void) dup2(sock, 0);
1786    (void) dup2(sock, 1);
1787    closesocket(sock);
1783   if (pid == 0) {
1784   (void) chdir(dir);
1785   (void) dup2(sock, 0);
1786   (void) dup2(sock, 1);
1787   closesocket(sock);
17881788
1789    // After exec, all signal handlers are restored to their default values,
1790    // with one exception of SIGCHLD. According to POSIX.1-2001 and Linux's
1791    // implementation, SIGCHLD's handler will leave unchanged after exec
1792    // if it was set to be ignored. Restore it to default action.
1793    signal(SIGCHLD, SIG_DFL);
1789   // After exec, all signal handlers are restored to their default values,
1790   // with one exception of SIGCHLD. According to POSIX.1-2001 and Linux's
1791   // implementation, SIGCHLD's handler will leave unchanged after exec
1792   // if it was set to be ignored. Restore it to default action.
1793   signal(SIGCHLD, SIG_DFL);
17941794
1795    if (interp == NULL) {
1796      execle(cmd, cmd, NULL, envp);
1797    } else {
1798      execle(interp, interp, cmd, NULL, envp);
1799    }
1800    snprintf(buf, sizeof(buf), "Status: 500\r\n\r\n"
1801             "500 Server Error: %s%s%s: %s", interp == NULL ? "" : interp,
1802             interp == NULL ? "" : " ", cmd, strerror(errno));
1803    send(1, buf, strlen(buf), 0);
1804    exit(EXIT_FAILURE);  // exec call failed
1805  }
1795   if (interp == NULL) {
1796      execle(cmd, cmd, NULL, envp);
1797   } else {
1798      execle(interp, interp, cmd, NULL, envp);
1799   }
1800   snprintf(buf, sizeof(buf), "Status: 500\r\n\r\n"
1801            "500 Server Error: %s%s%s: %s", interp == NULL ? "" : interp,
1802            interp == NULL ? "" : " ", cmd, strerror(errno));
1803   send(1, buf, strlen(buf), 0);
1804   exit(EXIT_FAILURE);  // exec call failed
1805   }
18061806
1807  return pid;
1807   return pid;
18081808}
18091809#endif  // _WIN32
18101810
r31373r31374
18171817// We satisfy both worlds: we create an envp array (which is vars), all
18181818// entries are actually pointers inside buf.
18191819struct cgi_env_block {
1820  struct mg_connection *conn;
1821  char buf[CGI_ENVIRONMENT_SIZE];       // Environment buffer
1822  const char *vars[MAX_CGI_ENVIR_VARS]; // char *envp[]
1823  int len;                              // Space taken
1824  int nvars;                            // Number of variables in envp[]
1820   struct mg_connection *conn;
1821   char buf[CGI_ENVIRONMENT_SIZE];       // Environment buffer
1822   const char *vars[MAX_CGI_ENVIR_VARS]; // char *envp[]
1823   int len;                              // Space taken
1824   int nvars;                            // Number of variables in envp[]
18251825};
18261826
18271827// Append VARIABLE=VALUE\0 string to the buffer, and add a respective
18281828// pointer into the vars array.
18291829static char *addenv(struct cgi_env_block *block, const char *fmt, ...) {
1830  int n, space;
1831  char *added;
1832  va_list ap;
1830   int n, space;
1831   char *added;
1832   va_list ap;
18331833
1834  // Calculate how much space is left in the buffer
1835  space = sizeof(block->buf) - block->len - 2;
1836  assert(space >= 0);
1834   // Calculate how much space is left in the buffer
1835   space = sizeof(block->buf) - block->len - 2;
1836   assert(space >= 0);
18371837
1838  // Make a pointer to the free space int the buffer
1839  added = block->buf + block->len;
1838   // Make a pointer to the free space int the buffer
1839   added = block->buf + block->len;
18401840
1841  // Copy VARIABLE=VALUE\0 string into the free space
1842  va_start(ap, fmt);
1843  n = mg_vsnprintf(added, (size_t) space, fmt, ap);
1844  va_end(ap);
1841   // Copy VARIABLE=VALUE\0 string into the free space
1842   va_start(ap, fmt);
1843   n = mg_vsnprintf(added, (size_t) space, fmt, ap);
1844   va_end(ap);
18451845
1846  // Make sure we do not overflow buffer and the envp array
1847  if (n > 0 && n + 1 < space &&
1848      block->nvars < (int) ARRAY_SIZE(block->vars) - 2) {
1849    // Append a pointer to the added string into the envp array
1850    block->vars[block->nvars++] = added;
1851    // Bump up used length counter. Include \0 terminator
1852    block->len += n + 1;
1853  }
1846   // Make sure we do not overflow buffer and the envp array
1847   if (n > 0 && n + 1 < space &&
1848      block->nvars < (int) ARRAY_SIZE(block->vars) - 2) {
1849   // Append a pointer to the added string into the envp array
1850   block->vars[block->nvars++] = added;
1851   // Bump up used length counter. Include \0 terminator
1852   block->len += n + 1;
1853   }
18541854
1855  return added;
1855   return added;
18561856}
18571857
18581858static void addenv2(struct cgi_env_block *blk, const char *name) {
1859  const char *s;
1860  if ((s = getenv(name)) != NULL) addenv(blk, "%s=%s", name, s);
1859   const char *s;
1860   if ((s = getenv(name)) != NULL) addenv(blk, "%s=%s", name, s);
18611861}
18621862
18631863static void prepare_cgi_environment(struct connection *conn,
1864                                    const char *prog,
1865                                    struct cgi_env_block *blk) {
1866  struct mg_connection *ri = &conn->mg_conn;
1867  const char *s, *slash;
1868  char *p, **opts = conn->server->config_options;
1869  int  i;
1864                           const char *prog,
1865                           struct cgi_env_block *blk) {
1866   struct mg_connection *ri = &conn->mg_conn;
1867   const char *s, *slash;
1868   char *p, **opts = conn->server->config_options;
1869   int  i;
18701870
1871  blk->len = blk->nvars = 0;
1872  blk->conn = ri;
1871   blk->len = blk->nvars = 0;
1872   blk->conn = ri;
18731873
1874  if ((s = getenv("SERVER_NAME")) != NULL) {
1875    addenv(blk, "SERVER_NAME=%s", s);
1876  } else {
1877    addenv(blk, "SERVER_NAME=%s", ri->local_ip);
1878  }
1879  addenv(blk, "SERVER_ROOT=%s", opts[DOCUMENT_ROOT]);
1880  addenv(blk, "DOCUMENT_ROOT=%s", opts[DOCUMENT_ROOT]);
1881  addenv(blk, "SERVER_SOFTWARE=%s/%s", "Mongoose", MONGOOSE_VERSION);
1874   if ((s = getenv("SERVER_NAME")) != NULL) {
1875   addenv(blk, "SERVER_NAME=%s", s);
1876   } else {
1877   addenv(blk, "SERVER_NAME=%s", ri->local_ip);
1878   }
1879   addenv(blk, "SERVER_ROOT=%s", opts[DOCUMENT_ROOT]);
1880   addenv(blk, "DOCUMENT_ROOT=%s", opts[DOCUMENT_ROOT]);
1881   addenv(blk, "SERVER_SOFTWARE=%s/%s", "Mongoose", MONGOOSE_VERSION);
18821882
1883  // Prepare the environment block
1884  addenv(blk, "%s", "GATEWAY_INTERFACE=CGI/1.1");
1885  addenv(blk, "%s", "SERVER_PROTOCOL=HTTP/1.1");
1886  addenv(blk, "%s", "REDIRECT_STATUS=200"); // For PHP
1883   // Prepare the environment block
1884   addenv(blk, "%s", "GATEWAY_INTERFACE=CGI/1.1");
1885   addenv(blk, "%s", "SERVER_PROTOCOL=HTTP/1.1");
1886   addenv(blk, "%s", "REDIRECT_STATUS=200"); // For PHP
18871887
1888  // TODO(lsm): fix this for IPv6 case
1889  //addenv(blk, "SERVER_PORT=%d", ri->remote_port);
1888   // TODO(lsm): fix this for IPv6 case
1889   //addenv(blk, "SERVER_PORT=%d", ri->remote_port);
18901890
1891  addenv(blk, "REQUEST_METHOD=%s", ri->request_method);
1892  addenv(blk, "REMOTE_ADDR=%s", ri->remote_ip);
1893  addenv(blk, "REMOTE_PORT=%d", ri->remote_port);
1894  addenv(blk, "REQUEST_URI=%s%s%s", ri->uri,
1895         ri->query_string == NULL ? "" : "?",
1896         ri->query_string == NULL ? "" : ri->query_string);
1891   addenv(blk, "REQUEST_METHOD=%s", ri->request_method);
1892   addenv(blk, "REMOTE_ADDR=%s", ri->remote_ip);
1893   addenv(blk, "REMOTE_PORT=%d", ri->remote_port);
1894   addenv(blk, "REQUEST_URI=%s%s%s", ri->uri,
1895         ri->query_string == NULL ? "" : "?",
1896         ri->query_string == NULL ? "" : ri->query_string);
18971897
1898  // SCRIPT_NAME
1899  if (conn->path_info != NULL) {
1900    addenv(blk, "SCRIPT_NAME=%.*s",
1901           (int) (strlen(ri->uri) - strlen(conn->path_info)), ri->uri);
1902    addenv(blk, "PATH_INFO=%s", conn->path_info);
1903  } else {
1904    s = strrchr(prog, '/');
1905    slash = strrchr(ri->uri, '/');
1906    addenv(blk, "SCRIPT_NAME=%.*s%s",
1907           slash == NULL ? 0 : (int) (slash - ri->uri), ri->uri,
1908           s == NULL ? prog : s);
1909  }
1898   // SCRIPT_NAME
1899   if (conn->path_info != NULL) {
1900   addenv(blk, "SCRIPT_NAME=%.*s",
1901         (int) (strlen(ri->uri) - strlen(conn->path_info)), ri->uri);
1902   addenv(blk, "PATH_INFO=%s", conn->path_info);
1903   } else {
1904   s = strrchr(prog, '/');
1905   slash = strrchr(ri->uri, '/');
1906   addenv(blk, "SCRIPT_NAME=%.*s%s",
1907         slash == NULL ? 0 : (int) (slash - ri->uri), ri->uri,
1908         s == NULL ? prog : s);
1909   }
19101910
1911  addenv(blk, "SCRIPT_FILENAME=%s", prog);
1912  addenv(blk, "PATH_TRANSLATED=%s", prog);
1913  addenv(blk, "HTTPS=%s", conn->ns_conn->ssl != NULL ? "on" : "off");
1911   addenv(blk, "SCRIPT_FILENAME=%s", prog);
1912   addenv(blk, "PATH_TRANSLATED=%s", prog);
1913   addenv(blk, "HTTPS=%s", conn->ns_conn->ssl != NULL ? "on" : "off");
19141914
1915  if ((s = mg_get_header(ri, "Content-Type")) != NULL)
1916    addenv(blk, "CONTENT_TYPE=%s", s);
1915   if ((s = mg_get_header(ri, "Content-Type")) != NULL)
1916   addenv(blk, "CONTENT_TYPE=%s", s);
19171917
1918  if (ri->query_string != NULL)
1919    addenv(blk, "QUERY_STRING=%s", ri->query_string);
1918   if (ri->query_string != NULL)
1919   addenv(blk, "QUERY_STRING=%s", ri->query_string);
19201920
1921  if ((s = mg_get_header(ri, "Content-Length")) != NULL)
1922    addenv(blk, "CONTENT_LENGTH=%s", s);
1921   if ((s = mg_get_header(ri, "Content-Length")) != NULL)
1922   addenv(blk, "CONTENT_LENGTH=%s", s);
19231923
1924  addenv2(blk, "PATH");
1925  addenv2(blk, "TMP");
1926  addenv2(blk, "TEMP");
1927  addenv2(blk, "TMPDIR");
1928  addenv2(blk, "PERLLIB");
1929  addenv2(blk, ENV_EXPORT_TO_CGI);
1924   addenv2(blk, "PATH");
1925   addenv2(blk, "TMP");
1926   addenv2(blk, "TEMP");
1927   addenv2(blk, "TMPDIR");
1928   addenv2(blk, "PERLLIB");
1929   addenv2(blk, ENV_EXPORT_TO_CGI);
19301930
19311931#if defined(_WIN32)
1932  addenv2(blk, "COMSPEC");
1933  addenv2(blk, "SYSTEMROOT");
1934  addenv2(blk, "SystemDrive");
1935  addenv2(blk, "ProgramFiles");
1936  addenv2(blk, "ProgramFiles(x86)");
1937  addenv2(blk, "CommonProgramFiles(x86)");
1932   addenv2(blk, "COMSPEC");
1933   addenv2(blk, "SYSTEMROOT");
1934   addenv2(blk, "SystemDrive");
1935   addenv2(blk, "ProgramFiles");
1936   addenv2(blk, "ProgramFiles(x86)");
1937   addenv2(blk, "CommonProgramFiles(x86)");
19381938#else
1939  addenv2(blk, "LD_LIBRARY_PATH");
1939   addenv2(blk, "LD_LIBRARY_PATH");
19401940#endif // _WIN32
19411941
1942  // Add all headers as HTTP_* variables
1943  for (i = 0; i < ri->num_headers; i++) {
1944    p = addenv(blk, "HTTP_%s=%s",
1945        ri->http_headers[i].name, ri->http_headers[i].value);
1942   // Add all headers as HTTP_* variables
1943   for (i = 0; i < ri->num_headers; i++) {
1944   p = addenv(blk, "HTTP_%s=%s",
1945      ri->http_headers[i].name, ri->http_headers[i].value);
19461946
1947    // Convert variable name into uppercase, and change - to _
1948    for (; *p != '=' && *p != '\0'; p++) {
1949      if (*p == '-')
1950        *p = '_';
1951      *p = (char) toupper(* (unsigned char *) p);
1952    }
1953  }
1947   // Convert variable name into uppercase, and change - to _
1948   for (; *p != '=' && *p != '\0'; p++) {
1949      if (*p == '-')
1950      *p = '_';
1951      *p = (char) toupper(* (unsigned char *) p);
1952   }
1953   }
19541954
1955  blk->vars[blk->nvars++] = NULL;
1956  blk->buf[blk->len++] = '\0';
1955   blk->vars[blk->nvars++] = NULL;
1956   blk->buf[blk->len++] = '\0';
19571957
1958  assert(blk->nvars < (int) ARRAY_SIZE(blk->vars));
1959  assert(blk->len > 0);
1960  assert(blk->len < (int) sizeof(blk->buf));
1958   assert(blk->nvars < (int) ARRAY_SIZE(blk->vars));
1959   assert(blk->len > 0);
1960   assert(blk->len < (int) sizeof(blk->buf));
19611961}
19621962
19631963static const char cgi_status[] = "HTTP/1.1 200 OK\r\n";
19641964
19651965static void open_cgi_endpoint(struct connection *conn, const char *prog) {
1966  struct cgi_env_block blk;
1967  char dir[MAX_PATH_SIZE];
1968  const char *p;
1969  sock_t fds[2];
1966   struct cgi_env_block blk;
1967   char dir[MAX_PATH_SIZE];
1968   const char *p;
1969   sock_t fds[2];
19701970
1971  prepare_cgi_environment(conn, prog, &blk);
1972  // CGI must be executed in its own directory. 'dir' must point to the
1973  // directory containing executable program, 'p' must point to the
1974  // executable program name relative to 'dir'.
1975  if ((p = strrchr(prog, '/')) == NULL) {
1976    mg_snprintf(dir, sizeof(dir), "%s", ".");
1977  } else {
1978    mg_snprintf(dir, sizeof(dir), "%.*s", (int) (p - prog), prog);
1979  }
1971   prepare_cgi_environment(conn, prog, &blk);
1972   // CGI must be executed in its own directory. 'dir' must point to the
1973   // directory containing executable program, 'p' must point to the
1974   // executable program name relative to 'dir'.
1975   if ((p = strrchr(prog, '/')) == NULL) {
1976   mg_snprintf(dir, sizeof(dir), "%s", ".");
1977   } else {
1978   mg_snprintf(dir, sizeof(dir), "%.*s", (int) (p - prog), prog);
1979   }
19801980
1981  // Try to create socketpair in a loop until success. ns_socketpair()
1982  // can be interrupted by a signal and fail.
1983  // TODO(lsm): use sigaction to restart interrupted syscall
1984  do {
1985    ns_socketpair(fds);
1986  } while (fds[0] == INVALID_SOCKET);
1981   // Try to create socketpair in a loop until success. ns_socketpair()
1982   // can be interrupted by a signal and fail.
1983   // TODO(lsm): use sigaction to restart interrupted syscall
1984   do {
1985   ns_socketpair(fds);
1986   } while (fds[0] == INVALID_SOCKET);
19871987
1988  if (start_process(conn->server->config_options[CGI_INTERPRETER],
1989                    prog, blk.buf, blk.vars, dir, fds[1]) > 0) {
1990    conn->endpoint_type = EP_CGI;
1991    conn->endpoint.nc = ns_add_sock(&conn->server->ns_server,
1992                                          fds[0], conn);
1993    conn->endpoint.nc->flags |= MG_CGI_CONN;
1994    ns_send(conn->ns_conn, cgi_status, sizeof(cgi_status) - 1);
1995    conn->mg_conn.status_code = 200;
1996    conn->ns_conn->flags |= NSF_BUFFER_BUT_DONT_SEND;
1997    // Pass POST data to the CGI process
1998    conn->endpoint.nc->send_iobuf = conn->ns_conn->recv_iobuf;
1999    iobuf_init(&conn->ns_conn->recv_iobuf, 0);
2000  } else {
2001    closesocket(fds[0]);
2002    send_http_error(conn, 500, "start_process(%s) failed", prog);
2003  }
1988   if (start_process(conn->server->config_options[CGI_INTERPRETER],
1989               prog, blk.buf, blk.vars, dir, fds[1]) > 0) {
1990   conn->endpoint_type = EP_CGI;
1991   conn->endpoint.nc = ns_add_sock(&conn->server->ns_server,
1992                                 fds[0], conn);
1993   conn->endpoint.nc->flags |= MG_CGI_CONN;
1994   ns_send(conn->ns_conn, cgi_status, sizeof(cgi_status) - 1);
1995   conn->mg_conn.status_code = 200;
1996   conn->ns_conn->flags |= NSF_BUFFER_BUT_DONT_SEND;
1997   // Pass POST data to the CGI process
1998   conn->endpoint.nc->send_iobuf = conn->ns_conn->recv_iobuf;
1999   iobuf_init(&conn->ns_conn->recv_iobuf, 0);
2000   } else {
2001   closesocket(fds[0]);
2002   send_http_error(conn, 500, "start_process(%s) failed", prog);
2003   }
20042004
20052005#ifndef _WIN32
2006  closesocket(fds[1]);  // On Windows, CGI stdio thread closes that socket
2006   closesocket(fds[1]);  // On Windows, CGI stdio thread closes that socket
20072007#endif
20082008}
20092009
20102010static void on_cgi_data(struct ns_connection *nc) {
2011  struct connection *conn = (struct connection *) nc->connection_data;
2012  const char *status = "500";
2013  struct mg_connection c;
2011   struct connection *conn = (struct connection *) nc->connection_data;
2012   const char *status = "500";
2013   struct mg_connection c;
20142014
2015  if (!conn) return;
2015   if (!conn) return;
20162016
2017  // Copy CGI data from CGI socket to the client send buffer
2018  ns_forward(nc, conn->ns_conn);
2017   // Copy CGI data from CGI socket to the client send buffer
2018   ns_forward(nc, conn->ns_conn);
20192019
2020  // If reply has not been parsed yet, parse it
2021  if (conn->ns_conn->flags & NSF_BUFFER_BUT_DONT_SEND) {
2022    struct iobuf *io = &conn->ns_conn->send_iobuf;
2023    int s_len = sizeof(cgi_status) - 1;
2024    int len = get_request_len(io->buf + s_len, io->len - s_len);
2025    char buf[MAX_REQUEST_SIZE], *s = buf;
2020   // If reply has not been parsed yet, parse it
2021   if (conn->ns_conn->flags & NSF_BUFFER_BUT_DONT_SEND) {
2022   struct iobuf *io = &conn->ns_conn->send_iobuf;
2023   int s_len = sizeof(cgi_status) - 1;
2024   int len = get_request_len(io->buf + s_len, io->len - s_len);
2025   char buf[MAX_REQUEST_SIZE], *s = buf;
20262026
2027    if (len == 0) return;
2027   if (len == 0) return;
20282028
2029    if (len < 0 || len > (int) sizeof(buf)) {
2030      len = io->len;
2031      iobuf_remove(io, io->len);
2032      send_http_error(conn, 500, "CGI program sent malformed headers: [%.*s]",
2033        len, io->buf);
2034    } else {
2035      memset(&c, 0, sizeof(c));
2036      memcpy(buf, io->buf + s_len, len);
2037      buf[len - 1] = '\0';
2038      parse_http_headers(&s, &c);
2039      if (mg_get_header(&c, "Location") != NULL) {
2040        status = "302";
2041      } else if ((status = (char *) mg_get_header(&c, "Status")) == NULL) {
2042        status = "200";
2043      }
2044      memcpy(io->buf + 9, status, 3);
2045      conn->mg_conn.status_code = atoi(status);
2046    }
2047    conn->ns_conn->flags &= ~NSF_BUFFER_BUT_DONT_SEND;
2048  }
2029   if (len < 0 || len > (int) sizeof(buf)) {
2030      len = io->len;
2031      iobuf_remove(io, io->len);
2032      send_http_error(conn, 500, "CGI program sent malformed headers: [%.*s]",
2033      len, io->buf);
2034   } else {
2035      memset(&c, 0, sizeof(c));
2036      memcpy(buf, io->buf + s_len, len);
2037      buf[len - 1] = '\0';
2038      parse_http_headers(&s, &c);
2039      if (mg_get_header(&c, "Location") != NULL) {
2040      status = "302";
2041      } else if ((status = (char *) mg_get_header(&c, "Status")) == NULL) {
2042      status = "200";
2043      }
2044      memcpy(io->buf + 9, status, 3);
2045      conn->mg_conn.status_code = atoi(status);
2046   }
2047   conn->ns_conn->flags &= ~NSF_BUFFER_BUT_DONT_SEND;
2048   }
20492049}
20502050#endif  // !MONGOOSE_NO_CGI
20512051
20522052static char *mg_strdup(const char *str) {
2053  char *copy = (char *) malloc(strlen(str) + 1);
2054  if (copy != NULL) {
2055    strcpy(copy, str);
2056  }
2057  return copy;
2053   char *copy = (char *) malloc(strlen(str) + 1);
2054   if (copy != NULL) {
2055   strcpy(copy, str);
2056   }
2057   return copy;
20582058}
20592059
20602060static int isbyte(int n) {
2061  return n >= 0 && n <= 255;
2061   return n >= 0 && n <= 255;
20622062}
20632063
20642064static int parse_net(const char *spec, uint32_t *net, uint32_t *mask) {
2065  int n, a, b, c, d, slash = 32, len = 0;
2065   int n, a, b, c, d, slash = 32, len = 0;
20662066
2067  if ((sscanf(spec, "%d.%d.%d.%d/%d%n", &a, &b, &c, &d, &slash, &n) == 5 ||
2068      sscanf(spec, "%d.%d.%d.%d%n", &a, &b, &c, &d, &n) == 4) &&
2069      isbyte(a) && isbyte(b) && isbyte(c) && isbyte(d) &&
2070      slash >= 0 && slash < 33) {
2071    len = n;
2072    *net = ((uint32_t)a << 24) | ((uint32_t)b << 16) | ((uint32_t)c << 8) | d;
2073    *mask = slash ? 0xffffffffU << (32 - slash) : 0;
2074  }
2067   if ((sscanf(spec, "%d.%d.%d.%d/%d%n", &a, &b, &c, &d, &slash, &n) == 5 ||
2068      sscanf(spec, "%d.%d.%d.%d%n", &a, &b, &c, &d, &n) == 4) &&
2069      isbyte(a) && isbyte(b) && isbyte(c) && isbyte(d) &&
2070      slash >= 0 && slash < 33) {
2071   len = n;
2072   *net = ((uint32_t)a << 24) | ((uint32_t)b << 16) | ((uint32_t)c << 8) | d;
2073   *mask = slash ? 0xffffffffU << (32 - slash) : 0;
2074   }
20752075
2076  return len;
2076   return len;
20772077}
20782078
20792079// Verify given socket address against the ACL.
20802080// Return -1 if ACL is malformed, 0 if address is disallowed, 1 if allowed.
20812081static int check_acl(const char *acl, uint32_t remote_ip) {
2082  int allowed, flag;
2083  uint32_t net, mask;
2084  struct vec vec;
2082   int allowed, flag;
2083   uint32_t net, mask;
2084   struct vec vec;
20852085
2086  // If any ACL is set, deny by default
2087  allowed = acl == NULL ? '+' : '-';
2086   // If any ACL is set, deny by default
2087   allowed = acl == NULL ? '+' : '-';
20882088
2089  while ((acl = next_option(acl, &vec, NULL)) != NULL) {
2090    flag = vec.ptr[0];
2091    if ((flag != '+' && flag != '-') ||
2092        parse_net(&vec.ptr[1], &net, &mask) == 0) {
2093      return -1;
2094    }
2089   while ((acl = next_option(acl, &vec, NULL)) != NULL) {
2090   flag = vec.ptr[0];
2091   if ((flag != '+' && flag != '-') ||
2092      parse_net(&vec.ptr[1], &net, &mask) == 0) {
2093      return -1;
2094   }
20952095
2096    if (net == (remote_ip & mask)) {
2097      allowed = flag;
2098    }
2099  }
2096   if (net == (remote_ip & mask)) {
2097      allowed = flag;
2098   }
2099   }
21002100
2101  return allowed == '+';
2101   return allowed == '+';
21022102}
21032103
21042104// Protect against directory disclosure attack by removing '..',
21052105// excessive '/' and '\' characters
21062106static void remove_double_dots_and_double_slashes(char *s) {
2107  char *p = s;
2107   char *p = s;
21082108
2109  while (*s != '\0') {
2110    *p++ = *s++;
2111    if (s[-1] == '/' || s[-1] == '\\') {
2112      // Skip all following slashes, backslashes and double-dots
2113      while (s[0] != '\0') {
2114        if (s[0] == '/' || s[0] == '\\') { s++; }
2115        else if (s[0] == '.' && s[1] == '.') { s += 2; }
2116        else { break; }
2117      }
2118    }
2119  }
2120  *p = '\0';
2109   while (*s != '\0') {
2110   *p++ = *s++;
2111   if (s[-1] == '/' || s[-1] == '\\') {
2112      // Skip all following slashes, backslashes and double-dots
2113      while (s[0] != '\0') {
2114      if (s[0] == '/' || s[0] == '\\') { s++; }
2115      else if (s[0] == '.' && s[1] == '.') { s += 2; }
2116      else { break; }
2117      }
2118   }
2119   }
2120   *p = '\0';
21212121}
21222122
21232123int mg_url_decode(const char *src, int src_len, char *dst,
2124                  int dst_len, int is_form_url_encoded) {
2125  int i, j, a, b;
2124               int dst_len, int is_form_url_encoded) {
2125   int i, j, a, b;
21262126#define HEXTOI(x) (isdigit(x) ? x - '0' : x - 'W')
21272127
2128  for (i = j = 0; i < src_len && j < dst_len - 1; i++, j++) {
2129    if (src[i] == '%' && i < src_len - 2 &&
2130        isxdigit(* (const unsigned char *) (src + i + 1)) &&
2131        isxdigit(* (const unsigned char *) (src + i + 2))) {
2132      a = tolower(* (const unsigned char *) (src + i + 1));
2133      b = tolower(* (const unsigned char *) (src + i + 2));
2134      dst[j] = (char) ((HEXTOI(a) << 4) | HEXTOI(b));
2135      i += 2;
2136    } else if (is_form_url_encoded && src[i] == '+') {
2137      dst[j] = ' ';
2138    } else {
2139      dst[j] = src[i];
2140    }
2141  }
2128   for (i = j = 0; i < src_len && j < dst_len - 1; i++, j++) {
2129   if (src[i] == '%' && i < src_len - 2 &&
2130      isxdigit(* (const unsigned char *) (src + i + 1)) &&
2131      isxdigit(* (const unsigned char *) (src + i + 2))) {
2132      a = tolower(* (const unsigned char *) (src + i + 1));
2133      b = tolower(* (const unsigned char *) (src + i + 2));
2134      dst[j] = (char) ((HEXTOI(a) << 4) | HEXTOI(b));
2135      i += 2;
2136   } else if (is_form_url_encoded && src[i] == '+') {
2137      dst[j] = ' ';
2138   } else {
2139      dst[j] = src[i];
2140   }
2141   }
21422142
2143  dst[j] = '\0'; // Null-terminate the destination
2143   dst[j] = '\0'; // Null-terminate the destination
21442144
2145  return i >= src_len ? j : -1;
2145   return i >= src_len ? j : -1;
21462146}
21472147
21482148static int is_valid_http_method(const char *s) {
2149  return !strcmp(s, "GET") || !strcmp(s, "POST") || !strcmp(s, "HEAD") ||
2150    !strcmp(s, "CONNECT") || !strcmp(s, "PUT") || !strcmp(s, "DELETE") ||
2151    !strcmp(s, "OPTIONS") || !strcmp(s, "PROPFIND") || !strcmp(s, "MKCOL");
2149   return !strcmp(s, "GET") || !strcmp(s, "POST") || !strcmp(s, "HEAD") ||
2150   !strcmp(s, "CONNECT") || !strcmp(s, "PUT") || !strcmp(s, "DELETE") ||
2151   !strcmp(s, "OPTIONS") || !strcmp(s, "PROPFIND") || !strcmp(s, "MKCOL");
21522152}
21532153
21542154// Parse HTTP request, fill in mg_request structure.
r31373r31374
21562156// HTTP request components, header names and header values.
21572157// Note that len must point to the last \n of HTTP headers.
21582158static int parse_http_message(char *buf, int len, struct mg_connection *ri) {
2159  int is_request, n;
2159   int is_request, n;
21602160
2161  // Reset the connection. Make sure that we don't touch fields that are
2162  // set elsewhere: remote_ip, remote_port, server_param
2163  ri->request_method = ri->uri = ri->http_version = ri->query_string = NULL;
2164  ri->num_headers = ri->status_code = ri->is_websocket = ri->content_len = 0;
2161   // Reset the connection. Make sure that we don't touch fields that are
2162   // set elsewhere: remote_ip, remote_port, server_param
2163   ri->request_method = ri->uri = ri->http_version = ri->query_string = NULL;
2164   ri->num_headers = ri->status_code = ri->is_websocket = ri->content_len = 0;
21652165
2166  buf[len - 1] = '\0';
2166   buf[len - 1] = '\0';
21672167
2168  // RFC says that all initial whitespaces should be ingored
2169  while (*buf != '\0' && isspace(* (unsigned char *) buf)) {
2170    buf++;
2171  }
2172  ri->request_method = skip(&buf, " ");
2173  ri->uri = skip(&buf, " ");
2174  ri->http_version = skip(&buf, "\r\n");
2168   // RFC says that all initial whitespaces should be ingored
2169   while (*buf != '\0' && isspace(* (unsigned char *) buf)) {
2170   buf++;
2171   }
2172   ri->request_method = skip(&buf, " ");
2173   ri->uri = skip(&buf, " ");
2174   ri->http_version = skip(&buf, "\r\n");
21752175
2176  // HTTP message could be either HTTP request or HTTP response, e.g.
2177  // "GET / HTTP/1.0 ...." or  "HTTP/1.0 200 OK ..."
2178  is_request = is_valid_http_method(ri->request_method);
2179  if ((is_request && memcmp(ri->http_version, "HTTP/", 5) != 0) ||
2180      (!is_request && memcmp(ri->request_method, "HTTP/", 5) != 0)) {
2181    len = -1;
2182  } else {
2183    if (is_request) {
2184      ri->http_version += 5;
2185    }
2186    parse_http_headers(&buf, ri);
2176   // HTTP message could be either HTTP request or HTTP response, e.g.
2177   // "GET / HTTP/1.0 ...." or  "HTTP/1.0 200 OK ..."
2178   is_request = is_valid_http_method(ri->request_method);
2179   if ((is_request && memcmp(ri->http_version, "HTTP/", 5) != 0) ||
2180      (!is_request && memcmp(ri->request_method, "HTTP/", 5) != 0)) {
2181   len = -1;
2182   } else {
2183   if (is_request) {
2184      ri->http_version += 5;
2185   }
2186   parse_http_headers(&buf, ri);
21872187
2188    if ((ri->query_string = strchr(ri->uri, '?')) != NULL) {
2189      *(char *) ri->query_string++ = '\0';
2190    }
2191    n = (int) strlen(ri->uri);
2192    mg_url_decode(ri->uri, n, (char *) ri->uri, n + 1, 0);
2193    if (*ri->uri == '/' || *ri->uri == '.') {
2194      remove_double_dots_and_double_slashes((char *) ri->uri);
2195    }
2196  }
2188   if ((ri->query_string = strchr(ri->uri, '?')) != NULL) {
2189      *(char *) ri->query_string++ = '\0';
2190   }
2191   n = (int) strlen(ri->uri);
2192   mg_url_decode(ri->uri, n, (char *) ri->uri, n + 1, 0);
2193   if (*ri->uri == '/' || *ri->uri == '.') {
2194      remove_double_dots_and_double_slashes((char *) ri->uri);
2195   }
2196   }
21972197
2198  return len;
2198   return len;
21992199}
22002200
22012201static int lowercase(const char *s) {
2202  return tolower(* (const unsigned char *) s);
2202   return tolower(* (const unsigned char *) s);
22032203}
22042204
22052205static int mg_strcasecmp(const char *s1, const char *s2) {
2206  int diff;
2206   int diff;
22072207
2208  do {
2209    diff = lowercase(s1++) - lowercase(s2++);
2210  } while (diff == 0 && s1[-1] != '\0');
2208   do {
2209   diff = lowercase(s1++) - lowercase(s2++);
2210   } while (diff == 0 && s1[-1] != '\0');
22112211
2212  return diff;
2212   return diff;
22132213}
22142214
22152215static int mg_strncasecmp(const char *s1, const char *s2, size_t len) {
2216  int diff = 0;
2216   int diff = 0;
22172217
2218  if (len > 0)
2219    do {
2220      diff = lowercase(s1++) - lowercase(s2++);
2221    } while (diff == 0 && s1[-1] != '\0' && --len > 0);
2218   if (len > 0)
2219   do {
2220      diff = lowercase(s1++) - lowercase(s2++);
2221   } while (diff == 0 && s1[-1] != '\0' && --len > 0);
22222222
2223  return diff;
2223   return diff;
22242224}
22252225
22262226// Return HTTP header value, or NULL if not found.
22272227const char *mg_get_header(const struct mg_connection *ri, const char *s) {
2228  int i;
2228   int i;
22292229
2230  for (i = 0; i < ri->num_headers; i++)
2231    if (!mg_strcasecmp(s, ri->http_headers[i].name))
2232      return ri->http_headers[i].value;
2230   for (i = 0; i < ri->num_headers; i++)
2231   if (!mg_strcasecmp(s, ri->http_headers[i].name))
2232      return ri->http_headers[i].value;
22332233
2234  return NULL;
2234   return NULL;
22352235}
22362236
22372237// Perform case-insensitive match of string against pattern
22382238int mg_match_prefix(const char *pattern, int pattern_len, const char *str) {
2239  const char *or_str;
2240  int len, res, i = 0, j = 0;
2239   const char *or_str;
2240   int len, res, i = 0, j = 0;
22412241
2242  if ((or_str = (const char *) memchr(pattern, '|', pattern_len)) != NULL) {
2243    res = mg_match_prefix(pattern, or_str - pattern, str);
2244    return res > 0 ? res : mg_match_prefix(or_str + 1,
2245      (pattern + pattern_len) - (or_str + 1), str);
2246  }
2242   if ((or_str = (const char *) memchr(pattern, '|', pattern_len)) != NULL) {
2243   res = mg_match_prefix(pattern, or_str - pattern, str);
2244   return res > 0 ? res : mg_match_prefix(or_str + 1,
2245      (pattern + pattern_len) - (or_str + 1), str);
2246   }
22472247
2248  for (; i < pattern_len; i++, j++) {
2249    if (pattern[i] == '?' && str[j] != '\0') {
2250      continue;
2251    } else if (pattern[i] == '$') {
2252      return str[j] == '\0' ? j : -1;
2253    } else if (pattern[i] == '*') {
2254      i++;
2255      if (pattern[i] == '*') {
2256        i++;
2257        len = (int) strlen(str + j);
2258      } else {
2259        len = (int) strcspn(str + j, "/");
2260      }
2261      if (i == pattern_len) {
2262        return j + len;
2263      }
2264      do {
2265        res = mg_match_prefix(pattern + i, pattern_len - i, str + j + len);
2266      } while (res == -1 && len-- > 0);
2267      return res == -1 ? -1 : j + res + len;
2268    } else if (lowercase(&pattern[i]) != lowercase(&str[j])) {
2269      return -1;
2270    }
2271  }
2272  return j;
2248   for (; i < pattern_len; i++, j++) {
2249   if (pattern[i] == '?' && str[j] != '\0') {
2250      continue;
2251   } else if (pattern[i] == '$') {
2252      return str[j] == '\0' ? j : -1;
2253   } else if (pattern[i] == '*') {
2254      i++;
2255      if (pattern[i] == '*') {
2256      i++;
2257      len = (int) strlen(str + j);
2258      } else {
2259      len = (int) strcspn(str + j, "/");
2260      }
2261      if (i == pattern_len) {
2262      return j + len;
2263      }
2264      do {
2265      res = mg_match_prefix(pattern + i, pattern_len - i, str + j + len);
2266      } while (res == -1 && len-- > 0);
2267      return res == -1 ? -1 : j + res + len;
2268   } else if (lowercase(&pattern[i]) != lowercase(&str[j])) {
2269      return -1;
2270   }
2271   }
2272   return j;
22732273}
22742274
22752275// This function prints HTML pages, and expands "{{something}}" blocks
r31373r31374
22772277// Note that {{@path/to/file}} construct outputs embedded file's contents,
22782278// which provides SSI-like functionality.
22792279void mg_template(struct mg_connection *conn, const char *s,
2280                 struct mg_expansion *expansions) {
2281  int i, j, pos = 0, inside_marker = 0;
2280               struct mg_expansion *expansions) {
2281   int i, j, pos = 0, inside_marker = 0;
22822282
2283  for (i = 0; s[i] != '\0'; i++) {
2284    if (inside_marker == 0 && !memcmp(&s[i], "{{", 2)) {
2285      if (i > pos) {
2286        mg_send_data(conn, &s[pos], i - pos);
2287      }
2288      pos = i;
2289      inside_marker = 1;
2290    }
2291    if (inside_marker == 1 && !memcmp(&s[i], "}}", 2)) {
2292      for (j = 0; expansions[j].keyword != NULL; j++) {
2293        const char *kw = expansions[j].keyword;
2294        if ((int) strlen(kw) == i - (pos + 2) &&
2295            memcmp(kw, &s[pos + 2], i - (pos + 2)) == 0) {
2296          expansions[j].handler(conn);
2297          pos = i + 2;
2298          break;
2299        }
2300      }
2301      inside_marker = 0;
2302    }
2303  }
2304  if (i > pos) {
2305    mg_send_data(conn, &s[pos], i - pos);
2306  }
2283   for (i = 0; s[i] != '\0'; i++) {
2284   if (inside_marker == 0 && !memcmp(&s[i], "{{", 2)) {
2285      if (i > pos) {
2286      mg_send_data(conn, &s[pos], i - pos);
2287      }
2288      pos = i;
2289      inside_marker = 1;
2290   }
2291   if (inside_marker == 1 && !memcmp(&s[i], "}}", 2)) {
2292      for (j = 0; expansions[j].keyword != NULL; j++) {
2293      const char *kw = expansions[j].keyword;
2294      if ((int) strlen(kw) == i - (pos + 2) &&
2295         memcmp(kw, &s[pos + 2], i - (pos + 2)) == 0) {
2296         expansions[j].handler(conn);
2297         pos = i + 2;
2298         break;
2299      }
2300      }
2301      inside_marker = 0;
2302   }
2303   }
2304   if (i > pos) {
2305   mg_send_data(conn, &s[pos], i - pos);
2306   }
23072307}
23082308
23092309#ifndef MONGOOSE_NO_FILESYSTEM
23102310static int must_hide_file(struct connection *conn, const char *path) {
2311  const char *pw_pattern = "**" PASSWORDS_FILE_NAME "$";
2312  const char *pattern = conn->server->config_options[HIDE_FILES_PATTERN];
2313  return mg_match_prefix(pw_pattern, strlen(pw_pattern), path) > 0 ||
2314    (pattern != NULL && mg_match_prefix(pattern, strlen(pattern), path) > 0);
2311   const char *pw_pattern = "**" PASSWORDS_FILE_NAME "$";
2312   const char *pattern = conn->server->config_options[HIDE_FILES_PATTERN];
2313   return mg_match_prefix(pw_pattern, strlen(pw_pattern), path) > 0 ||
2314   (pattern != NULL && mg_match_prefix(pattern, strlen(pattern), path) > 0);
23152315}
23162316
23172317// Return 1 if real file has been found, 0 otherwise
23182318static int convert_uri_to_file_name(struct connection *conn, char *buf,
2319                                    size_t buf_len, file_stat_t *st) {
2320  struct vec a, b;
2321  const char *rewrites = conn->server->config_options[URL_REWRITES];
2322  const char *root = conn->server->config_options[DOCUMENT_ROOT];
2319                           size_t buf_len, file_stat_t *st) {
2320   struct vec a, b;
2321   const char *rewrites = conn->server->config_options[URL_REWRITES];
2322   const char *root = conn->server->config_options[DOCUMENT_ROOT];
23232323#ifndef MONGOOSE_NO_CGI
2324  const char *cgi_pat = conn->server->config_options[CGI_PATTERN];
2325  char *p;
2324   const char *cgi_pat = conn->server->config_options[CGI_PATTERN];
2325   char *p;
23262326#endif
2327  const char *uri = conn->mg_conn.uri;
2328  const char *domain = mg_get_header(&conn->mg_conn, "Host");
2329  int match_len, root_len = root == NULL ? 0 : strlen(root);
2327   const char *uri = conn->mg_conn.uri;
2328   const char *domain = mg_get_header(&conn->mg_conn, "Host");
2329   int match_len, root_len = root == NULL ? 0 : strlen(root);
23302330
2331  // Perform virtual hosting rewrites
2332  if (rewrites != NULL && domain != NULL) {
2333    const char *colon = strchr(domain, ':');
2334    int domain_len = colon == NULL ? (int) strlen(domain) : colon - domain;
2331   // Perform virtual hosting rewrites
2332   if (rewrites != NULL && domain != NULL) {
2333   const char *colon = strchr(domain, ':');
2334   int domain_len = colon == NULL ? (int) strlen(domain) : colon - domain;
23352335
2336    while ((rewrites = next_option(rewrites, &a, &b)) != NULL) {
2337      if (a.len > 1 && a.ptr[0] == '@' && a.len == domain_len + 1 &&
2338          mg_strncasecmp(a.ptr + 1, domain, domain_len) == 0) {
2339        root = b.ptr;
2340        root_len = b.len;
2341        break;
2342      }
2343    }
2344  }
2336   while ((rewrites = next_option(rewrites, &a, &b)) != NULL) {
2337      if (a.len > 1 && a.ptr[0] == '@' && a.len == domain_len + 1 &&
2338         mg_strncasecmp(a.ptr + 1, domain, domain_len) == 0) {
2339      root = b.ptr;
2340      root_len = b.len;
2341      break;
2342      }
2343   }
2344   }
23452345
2346  // No filesystem access
2347  if (root == NULL || root_len == 0) return 0;
2346   // No filesystem access
2347   if (root == NULL || root_len == 0) return 0;
23482348
2349  // Handle URL rewrites
2350  mg_snprintf(buf, buf_len, "%.*s%s", root_len, root, uri);
2351  rewrites = conn->server->config_options[URL_REWRITES];  // Re-initialize!
2352  while ((rewrites = next_option(rewrites, &a, &b)) != NULL) {
2353    if ((match_len = mg_match_prefix(a.ptr, a.len, uri)) > 0) {
2354      mg_snprintf(buf, buf_len, "%.*s%s", (int) b.len, b.ptr, uri + match_len);
2355      break;
2356    }
2357  }
2349   // Handle URL rewrites
2350   mg_snprintf(buf, buf_len, "%.*s%s", root_len, root, uri);
2351   rewrites = conn->server->config_options[URL_REWRITES];  // Re-initialize!
2352   while ((rewrites = next_option(rewrites, &a, &b)) != NULL) {
2353   if ((match_len = mg_match_prefix(a.ptr, a.len, uri)) > 0) {
2354      mg_snprintf(buf, buf_len, "%.*s%s", (int) b.len, b.ptr, uri + match_len);
2355      break;
2356   }
2357   }
23582358
2359  if (stat(buf, st) == 0) return 1;
2359   if (stat(buf, st) == 0) return 1;
23602360
23612361#ifndef MONGOOSE_NO_CGI
2362  // Support PATH_INFO for CGI scripts.
2363  for (p = buf + strlen(root) + 2; *p != '\0'; p++) {
2364    if (*p == '/') {
2365      *p = '\0';
2366      if (mg_match_prefix(cgi_pat, strlen(cgi_pat), buf) > 0 &&
2367          !stat(buf, st)) {
2368      DBG(("!!!! [%s]", buf));
2369        *p = '/';
2370        conn->path_info = mg_strdup(p);
2371        *p = '\0';
2372        return 1;
2373      }
2374      *p = '/';
2375    }
2376  }
2362   // Support PATH_INFO for CGI scripts.
2363   for (p = buf + strlen(root) + 2; *p != '\0'; p++) {
2364   if (*p == '/') {
2365      *p = '\0';
2366      if (mg_match_prefix(cgi_pat, strlen(cgi_pat), buf) > 0 &&
2367         !stat(buf, st)) {
2368      DBG(("!!!! [%s]", buf));
2369      *p = '/';
2370      conn->path_info = mg_strdup(p);
2371      *p = '\0';
2372      return 1;
2373      }
2374      *p = '/';
2375   }
2376   }
23772377#endif
23782378
2379  return 0;
2379   return 0;
23802380}
23812381#endif  // MONGOOSE_NO_FILESYSTEM
23822382
23832383static int should_keep_alive(const struct mg_connection *conn) {
2384  struct connection *c = MG_CONN_2_CONN(conn);
2385  const char *method = conn->request_method;
2386  const char *http_version = conn->http_version;
2387  const char *header = mg_get_header(conn, "Connection");
2388  return method != NULL &&
2389    (!strcmp(method, "GET") || c->endpoint_type == EP_USER) &&
2390    ((header != NULL && !mg_strcasecmp(header, "keep-alive")) ||
2391     (header == NULL && http_version && !strcmp(http_version, "1.1")));
2384   struct connection *c = MG_CONN_2_CONN(conn);
2385   const char *method = conn->request_method;
2386   const char *http_version = conn->http_version;
2387   const char *header = mg_get_header(conn, "Connection");
2388   return method != NULL &&
2389   (!strcmp(method, "GET") || c->endpoint_type == EP_USER) &&
2390   ((header != NULL && !mg_strcasecmp(header, "keep-alive")) ||
2391      (header == NULL && http_version && !strcmp(http_version, "1.1")));
23922392}
23932393
23942394size_t mg_write(struct mg_connection *c, const void *buf, int len) {
2395  struct connection *conn = MG_CONN_2_CONN(c);
2396  ns_send(conn->ns_conn, buf, len);
2397  return conn->ns_conn->send_iobuf.len;
2395   struct connection *conn = MG_CONN_2_CONN(c);
2396   ns_send(conn->ns_conn, buf, len);
2397   return conn->ns_conn->send_iobuf.len;
23982398}
23992399
24002400void mg_send_status(struct mg_connection *c, int status) {
2401  if (c->status_code == 0) {
2402    c->status_code = status;
2403    mg_printf(c, "HTTP/1.1 %d %s\r\n", status, status_code_to_str(status));
2404  }
2401   if (c->status_code == 0) {
2402   c->status_code = status;
2403   mg_printf(c, "HTTP/1.1 %d %s\r\n", status, status_code_to_str(status));
2404   }
24052405}
24062406
24072407void mg_send_header(struct mg_connection *c, const char *name, const char *v) {
2408  if (c->status_code == 0) {
2409    c->status_code = 200;
2410    mg_printf(c, "HTTP/1.1 %d %s\r\n", 200, status_code_to_str(200));
2411  }
2412  mg_printf(c, "%s: %s\r\n", name, v);
2408   if (c->status_code == 0) {
2409   c->status_code = 200;
2410   mg_printf(c, "HTTP/1.1 %d %s\r\n", 200, status_code_to_str(200));
2411   }
2412   mg_printf(c, "%s: %s\r\n", name, v);
24132413}
24142414
24152415static void terminate_headers(struct mg_connection *c) {
2416  struct connection *conn = MG_CONN_2_CONN(c);
2417  if (!(conn->ns_conn->flags & MG_HEADERS_SENT)) {
2418    mg_send_header(c, "Transfer-Encoding", "chunked");
2419    mg_write(c, "\r\n", 2);
2420    conn->ns_conn->flags |= MG_HEADERS_SENT;
2421  }
2416   struct connection *conn = MG_CONN_2_CONN(c);
2417   if (!(conn->ns_conn->flags & MG_HEADERS_SENT)) {
2418   mg_send_header(c, "Transfer-Encoding", "chunked");
2419   mg_write(c, "\r\n", 2);
2420   conn->ns_conn->flags |= MG_HEADERS_SENT;
2421   }
24222422}
24232423
24242424size_t mg_send_data(struct mg_connection *c, const void *data, int data_len) {
2425  struct connection *conn = MG_CONN_2_CONN(c);
2426  terminate_headers(c);
2427  write_chunk(MG_CONN_2_CONN(c), (const char *) data, data_len);
2428  return conn->ns_conn->send_iobuf.len;
2425   struct connection *conn = MG_CONN_2_CONN(c);
2426   terminate_headers(c);
2427   write_chunk(MG_CONN_2_CONN(c), (const char *) data, data_len);
2428   return conn->ns_conn->send_iobuf.len;
24292429}
24302430
24312431size_t mg_printf_data(struct mg_connection *c, const char *fmt, ...) {
2432  struct connection *conn = MG_CONN_2_CONN(c);
2433  va_list ap;
2434  int len;
2435  char mem[IOBUF_SIZE], *buf = mem;
2432   struct connection *conn = MG_CONN_2_CONN(c);
2433   va_list ap;
2434   int len;
2435   char mem[IOBUF_SIZE], *buf = mem;
24362436
2437  terminate_headers(c);
2437   terminate_headers(c);
24382438
2439  va_start(ap, fmt);
2440  len = ns_avprintf(&buf, sizeof(mem), fmt, ap);
2441  va_end(ap);
2439   va_start(ap, fmt);
2440   len = ns_avprintf(&buf, sizeof(mem), fmt, ap);
2441   va_end(ap);
24422442
2443  if (len >= 0) {
2444    write_chunk((struct connection *) conn, buf, len);
2445  }
2446  if (buf != mem && buf != NULL) {
2447    free(buf);
2448  }
2449  return conn->ns_conn->send_iobuf.len;
2443   if (len >= 0) {
2444   write_chunk((struct connection *) conn, buf, len);
2445   }
2446   if (buf != mem && buf != NULL) {
2447   free(buf);
2448   }
2449   return conn->ns_conn->send_iobuf.len;
24502450}
24512451
24522452#if !defined(MONGOOSE_NO_WEBSOCKET) || !defined(MONGOOSE_NO_AUTH)
24532453static int is_big_endian(void) {
2454  static const int n = 1;
2455  return ((char *) &n)[0] == 0;
2454   static const int n = 1;
2455   return ((char *) &n)[0] == 0;
24562456}
24572457#endif
24582458
r31373r31374
24692469#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
24702470
24712471static uint32_t blk0(union char64long16 *block, int i) {
2472  // Forrest: SHA expect BIG_ENDIAN, swap if LITTLE_ENDIAN
2473  if (!is_big_endian()) {
2474    block->l[i] = (rol(block->l[i], 24) & 0xFF00FF00) |
2475      (rol(block->l[i], 8) & 0x00FF00FF);
2476  }
2477  return block->l[i];
2472   // Forrest: SHA expect BIG_ENDIAN, swap if LITTLE_ENDIAN
2473   if (!is_big_endian()) {
2474   block->l[i] = (rol(block->l[i], 24) & 0xFF00FF00) |
2475      (rol(block->l[i], 8) & 0x00FF00FF);
2476   }
2477   return block->l[i];
24782478}
24792479
24802480#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
2481    ^block->l[(i+2)&15]^block->l[i&15],1))
2481   ^block->l[(i+2)&15]^block->l[i&15],1))
24822482#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(block, i)+0x5A827999+rol(v,5);w=rol(w,30);
24832483#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
24842484#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
r31373r31374
24862486#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
24872487
24882488typedef struct {
2489    uint32_t state[5];
2490    uint32_t count[2];
2491    unsigned char buffer[64];
2489   uint32_t state[5];
2490   uint32_t count[2];
2491   unsigned char buffer[64];
24922492} SHA1_CTX;
24932493
24942494static void SHA1Transform(uint32_t state[5], const unsigned char buffer[64]) {
2495  uint32_t a, b, c, d, e;
2496  union char64long16 block[1];
2495   uint32_t a, b, c, d, e;
2496   union char64long16 block[1];
24972497
2498  memcpy(block, buffer, 64);
2499  a = state[0];
2500  b = state[1];
2501  c = state[2];
2502  d = state[3];
2503  e = state[4];
2504  R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
2505  R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
2506  R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
2507  R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
2508  R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
2509  R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
2510  R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
2511  R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
2512  R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
2513  R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
2514  R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
2515  R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
2516  R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
2517  R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
2518  R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
2519  R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
2520  R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
2521  R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
2522  R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
2523  R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
2524  state[0] += a;
2525  state[1] += b;
2526  state[2] += c;
2527  state[3] += d;
2528  state[4] += e;
2529  // Erase working structures. The order of operations is important,
2530  // used to ensure that compiler doesn't optimize those out.
2531  memset(block, 0, sizeof(block));
2532  a = b = c = d = e = 0;
2533  (void) a; (void) b; (void) c; (void) d; (void) e;
2498   memcpy(block, buffer, 64);
2499   a = state[0];
2500   b = state[1];
2501   c = state[2];
2502   d = state[3];
2503   e = state[4];
2504   R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
2505   R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
2506   R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
2507   R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
2508   R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
2509   R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
2510   R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
2511   R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
2512   R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
2513   R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
2514   R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
2515   R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
2516   R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
2517   R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
2518   R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
2519   R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
2520   R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
2521   R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
2522   R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
2523   R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
2524   state[0] += a;
2525   state[1] += b;
2526   state[2] += c;
2527   state[3] += d;
2528   state[4] += e;
2529   // Erase working structures. The order of operations is important,
2530   // used to ensure that compiler doesn't optimize those out.
2531   memset(block, 0, sizeof(block));
2532   a = b = c = d = e = 0;
2533   (void) a; (void) b; (void) c; (void) d; (void) e;
25342534}
25352535
25362536static void SHA1Init(SHA1_CTX* context) {
2537  context->state[0] = 0x67452301;
2538  context->state[1] = 0xEFCDAB89;
2539  context->state[2] = 0x98BADCFE;
2540  context->state[3] = 0x10325476;
2541  context->state[4] = 0xC3D2E1F0;
2542  context->count[0] = context->count[1] = 0;
2537   context->state[0] = 0x67452301;
2538   context->state[1] = 0xEFCDAB89;
2539   context->state[2] = 0x98BADCFE;
2540   context->state[3] = 0x10325476;
2541   context->state[4] = 0xC3D2E1F0;
2542   context->count[0] = context->count[1] = 0;
25432543}
25442544
25452545static void SHA1Update(SHA1_CTX* context, const unsigned char* data,
2546                       uint32_t len) {
2547  uint32_t i, j;
2546                  uint32_t len) {
2547   uint32_t i, j;
25482548
2549  j = context->count[0];
2550  if ((context->count[0] += len << 3) < j)
2551    context->count[1]++;
2552  context->count[1] += (len>>29);
2553  j = (j >> 3) & 63;
2554  if ((j + len) > 63) {
2555    memcpy(&context->buffer[j], data, (i = 64-j));
2556    SHA1Transform(context->state, context->buffer);
2557    for ( ; i + 63 < len; i += 64) {
2558      SHA1Transform(context->state, &data[i]);
2559    }
2560    j = 0;
2561  }
2562  else i = 0;
2563  memcpy(&context->buffer[j], &data[i], len - i);
2549   j = context->count[0];
2550   if ((context->count[0] += len << 3) < j)
2551   context->count[1]++;
2552   context->count[1] += (len>>29);
2553   j = (j >> 3) & 63;
2554   if ((j + len) > 63) {
2555   memcpy(&context->buffer[j], data, (i = 64-j));
2556   SHA1Transform(context->state, context->buffer);
2557   for ( ; i + 63 < len; i += 64) {
2558      SHA1Transform(context->state, &data[i]);
2559   }
2560   j = 0;
2561   }
2562   else i = 0;
2563   memcpy(&context->buffer[j], &data[i], len - i);
25642564}
25652565
25662566static void SHA1Final(unsigned char digest[20], SHA1_CTX* context) {
2567  unsigned i;
2568  unsigned char finalcount[8], c;
2567   unsigned i;
2568   unsigned char finalcount[8], c;
25692569
2570  for (i = 0; i < 8; i++) {
2571    finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
2572                                     >> ((3-(i & 3)) * 8) ) & 255);
2573  }
2574  c = 0200;
2575  SHA1Update(context, &c, 1);
2576  while ((context->count[0] & 504) != 448) {
2577    c = 0000;
2578    SHA1Update(context, &c, 1);
2579  }
2580  SHA1Update(context, finalcount, 8);
2581  for (i = 0; i < 20; i++) {
2582    digest[i] = (unsigned char)
2583      ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
2584  }
2585  memset(context, '\0', sizeof(*context));
2586  memset(&finalcount, '\0', sizeof(finalcount));
2570   for (i = 0; i < 8; i++) {
2571   finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
2572                              >> ((3-(i & 3)) * 8) ) & 255);
2573   }
2574   c = 0200;
2575   SHA1Update(context, &c, 1);
2576   while ((context->count[0] & 504) != 448) {
2577   c = 0000;
2578   SHA1Update(context, &c, 1);
2579   }
2580   SHA1Update(context, finalcount, 8);
2581   for (i = 0; i < 20; i++) {
2582   digest[i] = (unsigned char)
2583      ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
2584   }
2585   memset(context, '\0', sizeof(*context));
2586   memset(&finalcount, '\0', sizeof(finalcount));
25872587}
25882588// END OF SHA1 CODE
25892589
25902590static void base64_encode(const unsigned char *src, int src_len, char *dst) {
2591  static const char *b64 =
2592    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2593  int i, j, a, b, c;
2591   static const char *b64 =
2592   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2593   int i, j, a, b, c;
25942594
2595  for (i = j = 0; i < src_len; i += 3) {
2596    a = src[i];
2597    b = i + 1 >= src_len ? 0 : src[i + 1];
2598    c = i + 2 >= src_len ? 0 : src[i + 2];
2595   for (i = j = 0; i < src_len; i += 3) {
2596   a = src[i];
2597   b = i + 1 >= src_len ? 0 : src[i + 1];
2598   c = i + 2 >= src_len ? 0 : src[i + 2];
25992599
2600    dst[j++] = b64[a >> 2];
2601    dst[j++] = b64[((a & 3) << 4) | (b >> 4)];
2602    if (i + 1 < src_len) {
2603      dst[j++] = b64[(b & 15) << 2 | (c >> 6)];
2604    }
2605    if (i + 2 < src_len) {
2606      dst[j++] = b64[c & 63];
2607    }
2608  }
2609  while (j % 4 != 0) {
2610    dst[j++] = '=';
2611  }
2612  dst[j++] = '\0';
2600   dst[j++] = b64[a >> 2];
2601   dst[j++] = b64[((a & 3) << 4) | (b >> 4)];
2602   if (i + 1 < src_len) {
2603      dst[j++] = b64[(b & 15) << 2 | (c >> 6)];
2604   }
2605   if (i + 2 < src_len) {
2606      dst[j++] = b64[c & 63];
2607   }
2608   }
2609   while (j % 4 != 0) {
2610   dst[j++] = '=';
2611   }
2612   dst[j++] = '\0';
26132613}
26142614
26152615static void send_websocket_handshake(struct mg_connection *conn,
2616                                     const char *key) {
2617  static const char *magic = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
2618  char buf[500], sha[20], b64_sha[sizeof(sha) * 2];
2619  SHA1_CTX sha_ctx;
2616                              const char *key) {
2617   static const char *magic = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
2618   char buf[500], sha[20], b64_sha[sizeof(sha) * 2];
2619   SHA1_CTX sha_ctx;
26202620
2621  mg_snprintf(buf, sizeof(buf), "%s%s", key, magic);
2622  SHA1Init(&sha_ctx);
2623  SHA1Update(&sha_ctx, (unsigned char *) buf, strlen(buf));
2624  SHA1Final((unsigned char *) sha, &sha_ctx);
2625  base64_encode((unsigned char *) sha, sizeof(sha), b64_sha);
2626  mg_snprintf(buf, sizeof(buf), "%s%s%s",
2627              "HTTP/1.1 101 Switching Protocols\r\n"
2628              "Upgrade: websocket\r\n"
2629              "Connection: Upgrade\r\n"
2630              "Sec-WebSocket-Accept: ", b64_sha, "\r\n\r\n");
2621   mg_snprintf(buf, sizeof(buf), "%s%s", key, magic);
2622   SHA1Init(&sha_ctx);
2623   SHA1Update(&sha_ctx, (unsigned char *) buf, strlen(buf));
2624   SHA1Final((unsigned char *) sha, &sha_ctx);
2625   base64_encode((unsigned char *) sha, sizeof(sha), b64_sha);
2626   mg_snprintf(buf, sizeof(buf), "%s%s%s",
2627            "HTTP/1.1 101 Switching Protocols\r\n"
2628            "Upgrade: websocket\r\n"
2629            "Connection: Upgrade\r\n"
2630            "Sec-WebSocket-Accept: ", b64_sha, "\r\n\r\n");
26312631
2632  mg_write(conn, buf, strlen(buf));
2632   mg_write(conn, buf, strlen(buf));
26332633}
26342634
26352635static int deliver_websocket_frame(struct connection *conn) {
2636  // Having buf unsigned char * is important, as it is used below in arithmetic
2637  unsigned char *buf = (unsigned char *) conn->ns_conn->recv_iobuf.buf;
2638  int i, len, buf_len = conn->ns_conn->recv_iobuf.len, frame_len = 0,
2639      mask_len = 0, header_len = 0, data_len = 0, buffered = 0;
2636   // Having buf unsigned char * is important, as it is used below in arithmetic
2637   unsigned char *buf = (unsigned char *) conn->ns_conn->recv_iobuf.buf;
2638   int i, len, buf_len = conn->ns_conn->recv_iobuf.len, frame_len = 0,
2639      mask_len = 0, header_len = 0, data_len = 0, buffered = 0;
26402640
2641  if (buf_len >= 2) {
2642    len = buf[1] & 127;
2643    mask_len = buf[1] & 128 ? 4 : 0;
2644    if (len < 126 && buf_len >= mask_len) {
2645      data_len = len;
2646      header_len = 2 + mask_len;
2647    } else if (len == 126 && buf_len >= 4 + mask_len) {
2648      header_len = 4 + mask_len;
2649      data_len = ((((int) buf[2]) << 8) + buf[3]);
2650    } else if (buf_len >= 10 + mask_len) {
2651      header_len = 10 + mask_len;
2652      data_len = (int) (((uint64_t) htonl(* (uint32_t *) &buf[2])) << 32) +
2653        htonl(* (uint32_t *) &buf[6]);
2654    }
2655  }
2641   if (buf_len >= 2) {
2642   len = buf[1] & 127;
2643   mask_len = buf[1] & 128 ? 4 : 0;
2644   if (len < 126 && buf_len >= mask_len) {
2645      data_len = len;
2646      header_len = 2 + mask_len;
2647   } else if (len == 126 && buf_len >= 4 + mask_len) {
2648      header_len = 4 + mask_len;
2649      data_len = ((((int) buf[2]) << 8) + buf[3]);
2650   } else if (buf_len >= 10 + mask_len) {
2651      header_len = 10 + mask_len;
2652      data_len = (int) (((uint64_t) htonl(* (uint32_t *) &buf[2])) << 32) +
2653      htonl(* (uint32_t *) &buf[6]);
2654   }
2655   }
26562656
2657  frame_len = header_len + data_len;
2658  buffered = frame_len > 0 && frame_len <= buf_len;
2657   frame_len = header_len + data_len;
2658   buffered = frame_len > 0 && frame_len <= buf_len;
26592659
2660  if (buffered) {
2661    conn->mg_conn.content_len = data_len;
2662    conn->mg_conn.content = (char *) buf + header_len;
2663    conn->mg_conn.wsbits = buf[0];
2660   if (buffered) {
2661   conn->mg_conn.content_len = data_len;
2662   conn->mg_conn.content = (char *) buf + header_len;
2663   conn->mg_conn.wsbits = buf[0];
26642664
2665    // Apply mask if necessary
2666    if (mask_len > 0) {
2667      for (i = 0; i < data_len; i++) {
2668        buf[i + header_len] ^= (buf + header_len - mask_len)[i % 4];
2669      }
2670    }
2665   // Apply mask if necessary
2666   if (mask_len > 0) {
2667      for (i = 0; i < data_len; i++) {
2668      buf[i + header_len] ^= (buf + header_len - mask_len)[i % 4];
2669      }
2670   }
26712671
2672    // Call the handler and remove frame from the iobuf
2673    if (call_user(conn, MG_REQUEST) == MG_FALSE) {
2674      conn->ns_conn->flags |= NSF_FINISHED_SENDING_DATA;
2675    }
2676    iobuf_remove(&conn->ns_conn->recv_iobuf, frame_len);
2677  }
2672   // Call the handler and remove frame from the iobuf
2673   if (call_user(conn, MG_REQUEST) == MG_FALSE) {
2674      conn->ns_conn->flags |= NSF_FINISHED_SENDING_DATA;
2675   }
2676   iobuf_remove(&conn->ns_conn->recv_iobuf, frame_len);
2677   }
26782678
2679  return buffered;
2679   return buffered;
26802680}
26812681
26822682size_t mg_websocket_write(struct mg_connection* conn, int opcode,
2683                       const char *data, size_t data_len) {
2684    unsigned char mem[4192], *copy = mem;
2685    size_t copy_len = 0;
2683                  const char *data, size_t data_len) {
2684   unsigned char mem[4192], *copy = mem;
2685   size_t copy_len = 0;
26862686
2687    if (data_len + 10 > sizeof(mem) &&
2688        (copy = (unsigned char *) malloc(data_len + 10)) == NULL) {
2689      return 0;
2690    }
2687   if (data_len + 10 > sizeof(mem) &&
2688      (copy = (unsigned char *) malloc(data_len + 10)) == NULL) {
2689      return 0;
2690   }
26912691
2692    copy[0] = 0x80 + (opcode & 0x0f);
2692   copy[0] = 0x80 + (opcode & 0x0f);
26932693
2694    // Frame format: http://tools.ietf.org/html/rfc6455#section-5.2
2695    if (data_len < 126) {
2696      // Inline 7-bit length field
2697      copy[1] = data_len;
2698      memcpy(copy + 2, data, data_len);
2699      copy_len = 2 + data_len;
2700    } else if (data_len <= 0xFFFF) {
2701      // 16-bit length field
2702      copy[1] = 126;
2703      * (uint16_t *) (copy + 2) = (uint16_t) htons((uint16_t) data_len);
2704      memcpy(copy + 4, data, data_len);
2705      copy_len = 4 + data_len;
2706    } else {
2707      // 64-bit length field
2708      copy[1] = 127;
2709      * (uint32_t *) (copy + 2) = (uint32_t)
2710        htonl((uint32_t) ((uint64_t) data_len >> 32));
2711      * (uint32_t *) (copy + 6) = (uint32_t) htonl(data_len & 0xffffffff);
2712      memcpy(copy + 10, data, data_len);
2713      copy_len = 10 + data_len;
2714    }
2694   // Frame format: http://tools.ietf.org/html/rfc6455#section-5.2
2695   if (data_len < 126) {
2696      // Inline 7-bit length field
2697      copy[1] = data_len;
2698      memcpy(copy + 2, data, data_len);
2699      copy_len = 2 + data_len;
2700   } else if (data_len <= 0xFFFF) {
2701      // 16-bit length field
2702      copy[1] = 126;
2703      * (uint16_t *) (copy + 2) = (uint16_t) htons((uint16_t) data_len);
2704      memcpy(copy + 4, data, data_len);
2705      copy_len = 4 + data_len;
2706   } else {
2707      // 64-bit length field
2708      copy[1] = 127;
2709      * (uint32_t *) (copy + 2) = (uint32_t)
2710      htonl((uint32_t) ((uint64_t) data_len >> 32));
2711      * (uint32_t *) (copy + 6) = (uint32_t) htonl(data_len & 0xffffffff);
2712      memcpy(copy + 10, data, data_len);
2713      copy_len = 10 + data_len;
2714   }
27152715
2716    if (copy_len > 0) {
2717      mg_write(conn, copy, copy_len);
2718    }
2719    if (copy != mem) {
2720      free(copy);
2721    }
2716   if (copy_len > 0) {
2717      mg_write(conn, copy, copy_len);
2718   }
2719   if (copy != mem) {
2720      free(copy);
2721   }
27222722
2723    // If we send closing frame, schedule a connection to be closed after
2724    // data is drained to the client.
2725    if (opcode == WEBSOCKET_OPCODE_CONNECTION_CLOSE) {
2726      MG_CONN_2_CONN(conn)->ns_conn->flags |= NSF_FINISHED_SENDING_DATA;
2727    }
2723   // If we send closing frame, schedule a connection to be closed after
2724   // data is drained to the client.
2725   if (opcode == WEBSOCKET_OPCODE_CONNECTION_CLOSE) {
2726      MG_CONN_2_CONN(conn)->ns_conn->flags |= NSF_FINISHED_SENDING_DATA;
2727   }
27282728
2729    return MG_CONN_2_CONN(conn)->ns_conn->send_iobuf.len;
2729   return MG_CONN_2_CONN(conn)->ns_conn->send_iobuf.len;
27302730}
27312731
27322732size_t mg_websocket_printf(struct mg_connection* conn, int opcode,
2733                           const char *fmt, ...) {
2734  char mem[4192], *buf = mem;
2735  va_list ap;
2736  int len;
2733                     const char *fmt, ...) {
2734   char mem[4192], *buf = mem;
2735   va_list ap;
2736   int len;
27372737
2738  va_start(ap, fmt);
2739  if ((len = ns_avprintf(&buf, sizeof(mem), fmt, ap)) > 0) {
2740    mg_websocket_write(conn, opcode, buf, len);
2741  }
2742  va_end(ap);
2738   va_start(ap, fmt);
2739   if ((len = ns_avprintf(&buf, sizeof(mem), fmt, ap)) > 0) {
2740   mg_websocket_write(conn, opcode, buf, len);
2741   }
2742   va_end(ap);
27432743
2744  if (buf != mem && buf != NULL) {
2745    free(buf);
2746  }
2744   if (buf != mem && buf != NULL) {
2745   free(buf);
2746   }
27472747
2748  return MG_CONN_2_CONN(conn)->ns_conn->send_iobuf.len;
2748   return MG_CONN_2_CONN(conn)->ns_conn->send_iobuf.len;
27492749}
27502750
27512751static void send_websocket_handshake_if_requested(struct mg_connection *conn) {
2752  const char *ver = mg_get_header(conn, "Sec-WebSocket-Version"),
2753        *key = mg_get_header(conn, "Sec-WebSocket-Key");
2754  if (ver != NULL && key != NULL) {
2755    conn->is_websocket = 1;
2756    if (call_user(MG_CONN_2_CONN(conn), MG_WS_HANDSHAKE) == MG_FALSE) {
2757      send_websocket_handshake(conn, key);
2758    }
2759    call_user(MG_CONN_2_CONN(conn), MG_WS_CONNECT);
2760  }
2752   const char *ver = mg_get_header(conn, "Sec-WebSocket-Version"),
2753      *key = mg_get_header(conn, "Sec-WebSocket-Key");
2754   if (ver != NULL && key != NULL) {
2755   conn->is_websocket = 1;
2756   if (call_user(MG_CONN_2_CONN(conn), MG_WS_HANDSHAKE) == MG_FALSE) {
2757      send_websocket_handshake(conn, key);
2758   }
2759   call_user(MG_CONN_2_CONN(conn), MG_WS_CONNECT);
2760   }
27612761}
27622762
27632763static void ping_idle_websocket_connection(struct connection *conn, time_t t) {
2764  if (t - conn->ns_conn->last_io_time > MONGOOSE_USE_WEBSOCKET_PING_INTERVAL) {
2765    mg_websocket_write(&conn->mg_conn, WEBSOCKET_OPCODE_PING, "", 0);
2766  }
2764   if (t - conn->ns_conn->last_io_time > MONGOOSE_USE_WEBSOCKET_PING_INTERVAL) {
2765   mg_websocket_write(&conn->mg_conn, WEBSOCKET_OPCODE_PING, "", 0);
2766   }
27672767}
27682768#else
27692769#define ping_idle_websocket_connection(conn, t)
27702770#endif // !MONGOOSE_NO_WEBSOCKET
27712771
27722772static void write_terminating_chunk(struct connection *conn) {
2773  mg_write(&conn->mg_conn, "0\r\n\r\n", 5);
2773   mg_write(&conn->mg_conn, "0\r\n\r\n", 5);
27742774}
27752775
27762776static int call_request_handler(struct connection *conn) {
2777  int result;
2778  conn->mg_conn.content = conn->ns_conn->recv_iobuf.buf;
2779  if ((result = call_user(conn, MG_REQUEST)) == MG_TRUE) {
2780    if (conn->ns_conn->flags & MG_HEADERS_SENT) {
2781      write_terminating_chunk(conn);
2782    }
2783    close_local_endpoint(conn);
2784  }
2785  return result;
2777   int result;
2778   conn->mg_conn.content = conn->ns_conn->recv_iobuf.buf;
2779   if ((result = call_user(conn, MG_REQUEST)) == MG_TRUE) {
2780   if (conn->ns_conn->flags & MG_HEADERS_SENT) {
2781      write_terminating_chunk(conn);
2782   }
2783   close_local_endpoint(conn);
2784   }
2785   return result;
27862786}
27872787
27882788const char *mg_get_mime_type(const char *path, const char *default_mime_type) {
2789  const char *ext;
2790  size_t i, path_len;
2789   const char *ext;
2790   size_t i, path_len;
27912791
2792  path_len = strlen(path);
2792   path_len = strlen(path);
27932793
2794  for (i = 0; static_builtin_mime_types[i].extension != NULL; i++) {
2795    ext = path + (path_len - static_builtin_mime_types[i].ext_len);
2796    if (path_len > static_builtin_mime_types[i].ext_len &&
2797        mg_strcasecmp(ext, static_builtin_mime_types[i].extension) == 0) {
2798      return static_builtin_mime_types[i].mime_type;
2799    }
2800  }
2794   for (i = 0; static_builtin_mime_types[i].extension != NULL; i++) {
2795   ext = path + (path_len - static_builtin_mime_types[i].ext_len);
2796   if (path_len > static_builtin_mime_types[i].ext_len &&
2797      mg_strcasecmp(ext, static_builtin_mime_types[i].extension) == 0) {
2798      return static_builtin_mime_types[i].mime_type;
2799   }
2800   }
28012801
2802  return default_mime_type;
2802   return default_mime_type;
28032803}
28042804
28052805#ifndef MONGOOSE_NO_FILESYSTEM
28062806// Convert month to the month number. Return -1 on error, or month number
28072807static int get_month_index(const char *s) {
2808  static const char *month_names[] = {
2809    "Jan", "Feb", "Mar", "Apr", "May", "Jun",
2810    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
2811  };
2812  int i;
2808   static const char *month_names[] = {
2809   "Jan", "Feb", "Mar", "Apr", "May", "Jun",
2810   "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
2811   };
2812   int i;
28132813
2814  for (i = 0; i < (int) ARRAY_SIZE(month_names); i++)
2815    if (!strcmp(s, month_names[i]))
2816      return i;
2814   for (i = 0; i < (int) ARRAY_SIZE(month_names); i++)
2815   if (!strcmp(s, month_names[i]))
2816      return i;
28172817
2818  return -1;
2818   return -1;
28192819}
28202820
28212821static int num_leap_years(int year) {
2822  return year / 4 - year / 100 + year / 400;
2822   return year / 4 - year / 100 + year / 400;
28232823}
28242824
28252825// Parse UTC date-time string, and return the corresponding time_t value.
28262826static time_t parse_date_string(const char *datetime) {
2827  static const unsigned short days_before_month[] = {
2828    0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
2829  };
2830  char month_str[32];
2831  int second, minute, hour, day, month, year, leap_days, days;
2832  time_t result = (time_t) 0;
2827   static const unsigned short days_before_month[] = {
2828   0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
2829   };
2830   char month_str[32];
2831   int second, minute, hour, day, month, year, leap_days, days;
2832   time_t result = (time_t) 0;
28332833
2834  if (((sscanf(datetime, "%d/%3s/%d %d:%d:%d",
2835               &day, month_str, &year, &hour, &minute, &second) == 6) ||
2836       (sscanf(datetime, "%d %3s %d %d:%d:%d",
2837               &day, month_str, &year, &hour, &minute, &second) == 6) ||
2838       (sscanf(datetime, "%*3s, %d %3s %d %d:%d:%d",
2839               &day, month_str, &year, &hour, &minute, &second) == 6) ||
2840       (sscanf(datetime, "%d-%3s-%d %d:%d:%d",
2841               &day, month_str, &year, &hour, &minute, &second) == 6)) &&
2842      year > 1970 &&
2843      (month = get_month_index(month_str)) != -1) {
2844    leap_days = num_leap_years(year) - num_leap_years(1970);
2845    year -= 1970;
2846    days = year * 365 + days_before_month[month] + (day - 1) + leap_days;
2847    result = days * 24 * 3600 + hour * 3600 + minute * 60 + second;
2848  }
2834   if (((sscanf(datetime, "%d/%3s/%d %d:%d:%d",
2835            &day, month_str, &year, &hour, &minute, &second) == 6) ||
2836      (sscanf(datetime, "%d %3s %d %d:%d:%d",
2837            &day, month_str, &year, &hour, &minute, &second) == 6) ||
2838      (sscanf(datetime, "%*3s, %d %3s %d %d:%d:%d",
2839            &day, month_str, &year, &hour, &minute, &second) == 6) ||
2840      (sscanf(datetime, "%d-%3s-%d %d:%d:%d",
2841            &day, month_str, &year, &hour, &minute, &second) == 6)) &&
2842      year > 1970 &&
2843      (month = get_month_index(month_str)) != -1) {
2844   leap_days = num_leap_years(year) - num_leap_years(1970);
2845   year -= 1970;
2846   days = year * 365 + days_before_month[month] + (day - 1) + leap_days;
2847   result = days * 24 * 3600 + hour * 3600 + minute * 60 + second;
2848   }
28492849
2850  return result;
2850   return result;
28512851}
28522852
28532853// Look at the "path" extension and figure what mime type it has.
28542854// Store mime type in the vector.
28552855static void get_mime_type(const struct mg_server *server, const char *path,
2856                          struct vec *vec) {
2857  struct vec ext_vec, mime_vec;
2858  const char *list, *ext;
2859  size_t path_len;
2856                     struct vec *vec) {
2857   struct vec ext_vec, mime_vec;
2858   const char *list, *ext;
2859   size_t path_len;
28602860
2861  path_len = strlen(path);
2861   path_len = strlen(path);
28622862
2863  // Scan user-defined mime types first, in case user wants to
2864  // override default mime types.
2865  list = server->config_options[EXTRA_MIME_TYPES];
2866  while ((list = next_option(list, &ext_vec, &mime_vec)) != NULL) {
2867    // ext now points to the path suffix
2868    ext = path + path_len - ext_vec.len;
2869    if (mg_strncasecmp(ext, ext_vec.ptr, ext_vec.len) == 0) {
2870      *vec = mime_vec;
2871      return;
2872    }
2873  }
2863   // Scan user-defined mime types first, in case user wants to
2864   // override default mime types.
2865   list = server->config_options[EXTRA_MIME_TYPES];
2866   while ((list = next_option(list, &ext_vec, &mime_vec)) != NULL) {
2867   // ext now points to the path suffix
2868   ext = path + path_len - ext_vec.len;
2869   if (mg_strncasecmp(ext, ext_vec.ptr, ext_vec.len) == 0) {
2870      *vec = mime_vec;
2871      return;
2872   }
2873   }
28742874
2875  vec->ptr = mg_get_mime_type(path, "text/plain");
2876  vec->len = strlen(vec->ptr);
2875   vec->ptr = mg_get_mime_type(path, "text/plain");
2876   vec->len = strlen(vec->ptr);
28772877}
28782878
28792879static const char *suggest_connection_header(const struct mg_connection *conn) {
2880  return should_keep_alive(conn) ? "keep-alive" : "close";
2880   return should_keep_alive(conn) ? "keep-alive" : "close";
28812881}
28822882
28832883static void construct_etag(char *buf, size_t buf_len, const file_stat_t *st) {
2884  mg_snprintf(buf, buf_len, "\"%lx.%" INT64_FMT "\"",
2885              (unsigned long) st->st_mtime, (int64_t) st->st_size);
2884   mg_snprintf(buf, buf_len, "\"%lx.%" INT64_FMT "\"",
2885            (unsigned long) st->st_mtime, (int64_t) st->st_size);
28862886}
28872887
28882888// Return True if we should reply 304 Not Modified.
28892889static int is_not_modified(const struct connection *conn,
2890                           const file_stat_t *stp) {
2891  char etag[64];
2892  const char *ims = mg_get_header(&conn->mg_conn, "If-Modified-Since");
2893  const char *inm = mg_get_header(&conn->mg_conn, "If-None-Match");
2894  construct_etag(etag, sizeof(etag), stp);
2895  return (inm != NULL && !mg_strcasecmp(etag, inm)) ||
2896    (ims != NULL && stp->st_mtime <= parse_date_string(ims));
2890                     const file_stat_t *stp) {
2891   char etag[64];
2892   const char *ims = mg_get_header(&conn->mg_conn, "If-Modified-Since");
2893   const char *inm = mg_get_header(&conn->mg_conn, "If-None-Match");
2894   construct_etag(etag, sizeof(etag), stp);
2895   return (inm != NULL && !mg_strcasecmp(etag, inm)) ||
2896   (ims != NULL && stp->st_mtime <= parse_date_string(ims));
28972897}
28982898
28992899// For given directory path, substitute it to valid index file.
29002900// Return 0 if index file has been found, -1 if not found.
29012901// If the file is found, it's stats is returned in stp.
29022902static int find_index_file(struct connection *conn, char *path,
2903                           size_t path_len, file_stat_t *stp) {
2904  const char *list = conn->server->config_options[INDEX_FILES];
2905  file_stat_t st;
2906  struct vec filename_vec;
2907  size_t n = strlen(path), found = 0;
2903                     size_t path_len, file_stat_t *stp) {
2904   const char *list = conn->server->config_options[INDEX_FILES];
2905   file_stat_t st;
2906   struct vec filename_vec;
2907   size_t n = strlen(path), found = 0;
29082908
2909  // The 'path' given to us points to the directory. Remove all trailing
2910  // directory separator characters from the end of the path, and
2911  // then append single directory separator character.
2912  while (n > 0 && path[n - 1] == '/') {
2913    n--;
2914  }
2915  path[n] = '/';
2909   // The 'path' given to us points to the directory. Remove all trailing
2910   // directory separator characters from the end of the path, and
2911   // then append single directory separator character.
2912   while (n > 0 && path[n - 1] == '/') {
2913   n--;
2914   }
2915   path[n] = '/';
29162916
2917  // Traverse index files list. For each entry, append it to the given
2918  // path and see if the file exists. If it exists, break the loop
2919  while ((list = next_option(list, &filename_vec, NULL)) != NULL) {
2917   // Traverse index files list. For each entry, append it to the given
2918   // path and see if the file exists. If it exists, break the loop
2919   while ((list = next_option(list, &filename_vec, NULL)) != NULL) {
2920   // Ignore too long entries that may overflow path buffer
2921   if (filename_vec.len > (int) (path_len - (n + 2)))
2922      continue;
29202923
2921    // Ignore too long entries that may overflow path buffer
2922    if (filename_vec.len > (int) (path_len - (n + 2)))
2923      continue;
2924   // Prepare full path to the index file
2925   strncpy(path + n + 1, filename_vec.ptr, filename_vec.len);
2926   path[n + 1 + filename_vec.len] = '\0';
29242927
2925    // Prepare full path to the index file
2926    strncpy(path + n + 1, filename_vec.ptr, filename_vec.len);
2927    path[n + 1 + filename_vec.len] = '\0';
2928   //DBG(("[%s]", path));
29282929
2929    //DBG(("[%s]", path));
2930   // Does it exist?
2931   if (!stat(path, &st)) {
2932      // Yes it does, break the loop
2933      *stp = st;
2934      found = 1;
2935      break;
2936   }
2937   }
29302938
2931    // Does it exist?
2932    if (!stat(path, &st)) {
2933      // Yes it does, break the loop
2934      *stp = st;
2935      found = 1;
2936      break;
2937    }
2938  }
2939   // If no index file exists, restore directory path
2940   if (!found) {
2941   path[n] = '\0';
2942   }
29392943
2940  // If no index file exists, restore directory path
2941  if (!found) {
2942    path[n] = '\0';
2943  }
2944
2945  return found;
2944   return found;
29462945}
29472946
29482947static int parse_range_header(const char *header, int64_t *a, int64_t *b) {
2949  return sscanf(header, "bytes=%" INT64_FMT "-%" INT64_FMT, a, b);
2948   return sscanf(header, "bytes=%" INT64_FMT "-%" INT64_FMT, a, b);
29502949}
29512950
29522951static void gmt_time_string(char *buf, size_t buf_len, time_t *t) {
2953  strftime(buf, buf_len, "%a, %d %b %Y %H:%M:%S GMT", gmtime(t));
2952   strftime(buf, buf_len, "%a, %d %b %Y %H:%M:%S GMT", gmtime(t));
29542953}
29552954
29562955static void open_file_endpoint(struct connection *conn, const char *path,
2957                               file_stat_t *st) {
2958  char date[64], lm[64], etag[64], range[64], headers[500];
2959  const char *msg = "OK", *hdr;
2960  time_t curtime = time(NULL);
2961  int64_t r1, r2;
2962  struct vec mime_vec;
2963  int n;
2956                        file_stat_t *st) {
2957   char date[64], lm[64], etag[64], range[64], headers[500];
2958   const char *msg = "OK", *hdr;
2959   time_t curtime = time(NULL);
2960   int64_t r1, r2;
2961   struct vec mime_vec;
2962   int n;
29642963
2965  conn->endpoint_type = EP_FILE;
2966  ns_set_close_on_exec(conn->endpoint.fd);
2967  conn->mg_conn.status_code = 200;
2964   conn->endpoint_type = EP_FILE;
2965   ns_set_close_on_exec(conn->endpoint.fd);
2966   conn->mg_conn.status_code = 200;
29682967
2969  get_mime_type(conn->server, path, &mime_vec);
2970  conn->cl = st->st_size;
2971  range[0] = '\0';
2968   get_mime_type(conn->server, path, &mime_vec);
2969   conn->cl = st->st_size;
2970   range[0] = '\0';
29722971
2973  // If Range: header specified, act accordingly
2974  r1 = r2 = 0;
2975  hdr = mg_get_header(&conn->mg_conn, "Range");
2976  if (hdr != NULL && (n = parse_range_header(hdr, &r1, &r2)) > 0 &&
2977      r1 >= 0 && r2 >= 0) {
2978    conn->mg_conn.status_code = 206;
2979    conn->cl = n == 2 ? (r2 > conn->cl ? conn->cl : r2) - r1 + 1: conn->cl - r1;
2980    mg_snprintf(range, sizeof(range), "Content-Range: bytes "
2981                "%" INT64_FMT "-%" INT64_FMT "/%" INT64_FMT "\r\n",
2982                r1, r1 + conn->cl - 1, (int64_t) st->st_size);
2983    msg = "Partial Content";
2984    lseek(conn->endpoint.fd, r1, SEEK_SET);
2985  }
2972   // If Range: header specified, act accordingly
2973   r1 = r2 = 0;
2974   hdr = mg_get_header(&conn->mg_conn, "Range");
2975   if (hdr != NULL && (n = parse_range_header(hdr, &r1, &r2)) > 0 &&
2976      r1 >= 0 && r2 >= 0) {
2977   conn->mg_conn.status_code = 206;
2978   conn->cl = n == 2 ? (r2 > conn->cl ? conn->cl : r2) - r1 + 1: conn->cl - r1;
2979   mg_snprintf(range, sizeof(range), "Content-Range: bytes "
2980            "%" INT64_FMT "-%" INT64_FMT "/%" INT64_FMT "\r\n",
2981            r1, r1 + conn->cl - 1, (int64_t) st->st_size);
2982   msg = "Partial Content";
2983   lseek(conn->endpoint.fd, r1, SEEK_SET);
2984   }
29862985
2987  // Prepare Etag, Date, Last-Modified headers. Must be in UTC, according to
2988  // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
2989  gmt_time_string(date, sizeof(date), &curtime);
2990  gmt_time_string(lm, sizeof(lm), &st->st_mtime);
2991  construct_etag(etag, sizeof(etag), st);
2986   // Prepare Etag, Date, Last-Modified headers. Must be in UTC, according to
2987   // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3
2988   gmt_time_string(date, sizeof(date), &curtime);
2989   gmt_time_string(lm, sizeof(lm), &st->st_mtime);
2990   construct_etag(etag, sizeof(etag), st);
29922991
2993  n = mg_snprintf(headers, sizeof(headers),
2994                  "HTTP/1.1 %d %s\r\n"
2995                  "Date: %s\r\n"
2996                  "Last-Modified: %s\r\n"
2997                  "Etag: %s\r\n"
2998                  "Content-Type: %.*s\r\n"
2999                  "Content-Length: %" INT64_FMT "\r\n"
3000                  "Connection: %s\r\n"
3001                  "Accept-Ranges: bytes\r\n"
3002                  "%s%s\r\n",
3003                  conn->mg_conn.status_code, msg, date, lm, etag,
3004                  (int) mime_vec.len, mime_vec.ptr, conn->cl,
3005                  suggest_connection_header(&conn->mg_conn),
3006                  range, MONGOOSE_USE_EXTRA_HTTP_HEADERS);
3007  ns_send(conn->ns_conn, headers, n);
2992   n = mg_snprintf(headers, sizeof(headers),
2993               "HTTP/1.1 %d %s\r\n"
2994               "Date: %s\r\n"
2995               "Last-Modified: %s\r\n"
2996               "Etag: %s\r\n"
2997               "Content-Type: %.*s\r\n"
2998               "Content-Length: %" INT64_FMT "\r\n"
2999               "Connection: %s\r\n"
3000               "Accept-Ranges: bytes\r\n"
3001               "%s%s\r\n",
3002               conn->mg_conn.status_code, msg, date, lm, etag,
3003               (int) mime_vec.len, mime_vec.ptr, conn->cl,
3004               suggest_connection_header(&conn->mg_conn),
3005               range, MONGOOSE_USE_EXTRA_HTTP_HEADERS);
3006   ns_send(conn->ns_conn, headers, n);
30083007
3009  if (!strcmp(conn->mg_conn.request_method, "HEAD")) {
3010    conn->ns_conn->flags |= NSF_FINISHED_SENDING_DATA;
3011    close(conn->endpoint.fd);
3012    conn->endpoint_type = EP_NONE;
3013  }
3008   if (!strcmp(conn->mg_conn.request_method, "HEAD")) {
3009   conn->ns_conn->flags |= NSF_FINISHED_SENDING_DATA;
3010   close(conn->endpoint.fd);
3011   conn->endpoint_type = EP_NONE;
3012   }
30143013}
30153014#endif  // MONGOOSE_NO_FILESYSTEM
30163015
30173016static void call_request_handler_if_data_is_buffered(struct connection *conn) {
3018  struct iobuf *loc = &conn->ns_conn->recv_iobuf;
3019  struct mg_connection *c = &conn->mg_conn;
3017   struct iobuf *loc = &conn->ns_conn->recv_iobuf;
3018   struct mg_connection *c = &conn->mg_conn;
30203019
30213020#ifndef MONGOOSE_NO_WEBSOCKET
3022  if (conn->mg_conn.is_websocket) {
3023    do { } while (deliver_websocket_frame(conn));
3024  } else
3021   if (conn->mg_conn.is_websocket) {
3022   do { } while (deliver_websocket_frame(conn));
3023   } else
30253024#endif
3026  if ((size_t) loc->len >= c->content_len &&
3027      call_request_handler(conn) == MG_FALSE) {
3028    open_local_endpoint(conn, 1);
3029  }
3025   if ((size_t) loc->len >= c->content_len &&
3026      call_request_handler(conn) == MG_FALSE) {
3027   open_local_endpoint(conn, 1);
3028   }
30303029}
30313030
30323031#if !defined(MONGOOSE_NO_DIRECTORY_LISTING) || !defined(MONGOOSE_NO_DAV)
30333032
30343033#ifdef _WIN32
30353034struct dirent {
3036  char d_name[MAX_PATH_SIZE];
3035   char d_name[MAX_PATH_SIZE];
30373036};
30383037
30393038typedef struct DIR {
3040  HANDLE   handle;
3041  WIN32_FIND_DATAW info;
3042  struct dirent result;
3039   HANDLE   handle;
3040   WIN32_FIND_DATAW info;
3041   struct dirent result;
30433042} DIR;
30443043
30453044// Implementation of POSIX opendir/closedir/readdir for Windows.
30463045static DIR *opendir(const char *name) {
3047  DIR *dir = NULL;
3048  wchar_t wpath[MAX_PATH_SIZE];
3049  DWORD attrs;
3046   DIR *dir = NULL;
3047   wchar_t wpath[MAX_PATH_SIZE];
3048   DWORD attrs;
30503049
3051  if (name == NULL) {
3052    SetLastError(ERROR_BAD_ARGUMENTS);
3053  } else if ((dir = (DIR *) malloc(sizeof(*dir))) == NULL) {
3054    SetLastError(ERROR_NOT_ENOUGH_MEMORY);
3055  } else {
3056    to_wchar(name, wpath, ARRAY_SIZE(wpath));
3057    attrs = GetFileAttributesW(wpath);
3058    if (attrs != 0xFFFFFFFF &&
3059        ((attrs & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)) {
3060      (void) wcscat(wpath, L"\\*");
3061      dir->handle = FindFirstFileW(wpath, &dir->info);
3062      dir->result.d_name[0] = '\0';
3063    } else {
3064      free(dir);
3065      dir = NULL;
3066    }
3067  }
3050   if (name == NULL) {
3051   SetLastError(ERROR_BAD_ARGUMENTS);
3052   } else if ((dir = (DIR *) malloc(sizeof(*dir))) == NULL) {
3053   SetLastError(ERROR_NOT_ENOUGH_MEMORY);
3054   } else {
3055   to_wchar(name, wpath, ARRAY_SIZE(wpath));
3056   attrs = GetFileAttributesW(wpath);
3057   if (attrs != 0xFFFFFFFF &&
3058      ((attrs & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)) {
3059      (void) wcscat(wpath, L"\\*");
3060      dir->handle = FindFirstFileW(wpath, &dir->info);
3061      dir->result.d_name[0] = '\0';
3062   } else {
3063      free(dir);
3064      dir = NULL;
3065   }
3066   }
30683067
3069  return dir;
3068   return dir;
30703069}
30713070
30723071static int closedir(DIR *dir) {
3073  int result = 0;
3072   int result = 0;
30743073
3075  if (dir != NULL) {
3076    if (dir->handle != INVALID_HANDLE_VALUE)
3077      result = FindClose(dir->handle) ? 0 : -1;
3074   if (dir != NULL) {
3075   if (dir->handle != INVALID_HANDLE_VALUE)
3076      result = FindClose(dir->handle) ? 0 : -1;
30783077
3079    free(dir);
3080  } else {
3081    result = -1;
3082    SetLastError(ERROR_BAD_ARGUMENTS);
3083  }
3078   free(dir);
3079   } else {
3080   result = -1;
3081   SetLastError(ERROR_BAD_ARGUMENTS);
3082   }
30843083
3085  return result;
3084   return result;
30863085}
30873086
30883087static struct dirent *readdir(DIR *dir) {
3089  struct dirent *result = 0;
3088   struct dirent *result = 0;
30903089
3091  if (dir) {
3092    if (dir->handle != INVALID_HANDLE_VALUE) {
3093      result = &dir->result;
3094      (void) WideCharToMultiByte(CP_UTF8, 0,
3095          dir->info.cFileName, -1, result->d_name,
3096          sizeof(result->d_name), NULL, NULL);
3090   if (dir) {
3091   if (dir->handle != INVALID_HANDLE_VALUE) {
3092      result = &dir->result;
3093      (void) WideCharToMultiByte(CP_UTF8, 0,
3094         dir->info.cFileName, -1, result->d_name,
3095         sizeof(result->d_name), NULL, NULL);
30973096
3098      if (!FindNextFileW(dir->handle, &dir->info)) {
3099        (void) FindClose(dir->handle);
3100        dir->handle = INVALID_HANDLE_VALUE;
3101      }
3097      if (!FindNextFileW(dir->handle, &dir->info)) {
3098      (void) FindClose(dir->handle);
3099      dir->handle = INVALID_HANDLE_VALUE;
3100      }
31023101
3103    } else {
3104      SetLastError(ERROR_FILE_NOT_FOUND);
3105    }
3106  } else {
3107    SetLastError(ERROR_BAD_ARGUMENTS);
3108  }
3102   } else {
3103      SetLastError(ERROR_FILE_NOT_FOUND);
3104   }
3105   } else {
3106   SetLastError(ERROR_BAD_ARGUMENTS);
3107   }
31093108
3110  return result;
3109   return result;
31113110}
31123111#endif // _WIN32  POSIX opendir/closedir/readdir implementation
31133112
31143113static int scan_directory(struct connection *conn, const char *dir,
3115                          struct dir_entry **arr) {
3116  char path[MAX_PATH_SIZE];
3117  struct dir_entry *p;
3118  struct dirent *dp;
3119  int arr_size = 0, arr_ind = 0, inc = 100;
3120  DIR *dirp;
3114                     struct dir_entry **arr) {
3115   char path[MAX_PATH_SIZE];
3116   struct dir_entry *p;
3117   struct dirent *dp;
3118   int arr_size = 0, arr_ind = 0, inc = 100;
3119   DIR *dirp;
31213120
3122  *arr = NULL;
3123  if ((dirp = (opendir(dir))) == NULL) return 0;
3121   *arr = NULL;
3122   if ((dirp = (opendir(dir))) == NULL) return 0;
31243123
3125  while ((dp = readdir(dirp)) != NULL) {
3126    // Do not show current dir and hidden files
3127    if (!strcmp(dp->d_name, ".") ||
3128        !strcmp(dp->d_name, "..") ||
3129        must_hide_file(conn, dp->d_name)) {
3130      continue;
3131    }
3132    mg_snprintf(path, sizeof(path), "%s%c%s", dir, '/', dp->d_name);
3124   while ((dp = readdir(dirp)) != NULL) {
3125   // Do not show current dir and hidden files
3126   if (!strcmp(dp->d_name, ".") ||
3127      !strcmp(dp->d_name, "..") ||
3128      must_hide_file(conn, dp->d_name)) {
3129      continue;
3130   }
3131   mg_snprintf(path, sizeof(path), "%s%c%s", dir, '/', dp->d_name);
31333132
3134    // Resize the array if nesessary
3135    if (arr_ind >= arr_size) {
3136      if ((p = (struct dir_entry *)
3137           realloc(*arr, (inc + arr_size) * sizeof(**arr))) != NULL) {
3138        // Memset new chunk to zero, otherwize st_mtime will have garbage which
3139        // can make strftime() segfault, see
3140        // http://code.google.com/p/mongoose/issues/detail?id=79
3141        memset(p + arr_size, 0, sizeof(**arr) * inc);
3133   // Resize the array if nesessary
3134   if (arr_ind >= arr_size) {
3135      if ((p = (struct dir_entry *)
3136         realloc(*arr, (inc + arr_size) * sizeof(**arr))) != NULL) {
3137      // Memset new chunk to zero, otherwize st_mtime will have garbage which
3138      // can make strftime() segfault, see
3139      // http://code.google.com/p/mongoose/issues/detail?id=79
3140      memset(p + arr_size, 0, sizeof(**arr) * inc);
31423141
3143        *arr = p;
3144        arr_size += inc;
3145      }
3146    }
3142      *arr = p;
3143      arr_size += inc;
3144      }
3145   }
31473146
3148    if (arr_ind < arr_size) {
3149      (*arr)[arr_ind].conn = conn;
3150      (*arr)[arr_ind].file_name = strdup(dp->d_name);
3151      stat(path, &(*arr)[arr_ind].st);
3152      arr_ind++;
3153    }
3154  }
3155  closedir(dirp);
3147   if (arr_ind < arr_size) {
3148      (*arr)[arr_ind].conn = conn;
3149      (*arr)[arr_ind].file_name = strdup(dp->d_name);
3150      stat(path, &(*arr)[arr_ind].st);
3151      arr_ind++;
3152   }
3153   }
3154   closedir(dirp);
31563155
3157  return arr_ind;
3156   return arr_ind;
31583157}
31593158
31603159int mg_url_encode(const char *src, size_t s_len, char *dst, size_t dst_len) {
3161  static const char *dont_escape = "._-$,;~()";
3162  static const char *hex = "0123456789abcdef";
3163  size_t i = 0, j = 0;
3160   static const char *dont_escape = "._-$,;~()";
3161   static const char *hex = "0123456789abcdef";
3162   size_t i = 0, j = 0;
31643163
3165  for (i = j = 0; dst_len > 0 && i < s_len && j < dst_len - 1; i++, j++) {
3166    if (isalnum(* (const unsigned char *) (src + i)) ||
3167        strchr(dont_escape, * (const unsigned char *) (src + i)) != NULL) {
3168      dst[j] = src[i];
3169    } else if (j + 3 < dst_len) {
3170      dst[j] = '%';
3171      dst[j + 1] = hex[(* (const unsigned char *) (src + i)) >> 4];
3172      dst[j + 2] = hex[(* (const unsigned char *) (src + i)) & 0xf];
3173      j += 2;
3174    }
3175  }
3164   for (i = j = 0; dst_len > 0 && i < s_len && j < dst_len - 1; i++, j++) {
3165   if (isalnum(* (const unsigned char *) (src + i)) ||
3166      strchr(dont_escape, * (const unsigned char *) (src + i)) != NULL) {
3167      dst[j] = src[i];
3168   } else if (j + 3 < dst_len) {
3169      dst[j] = '%';
3170      dst[j + 1] = hex[(* (const unsigned char *) (src + i)) >> 4];
3171      dst[j + 2] = hex[(* (const unsigned char *) (src + i)) & 0xf];
3172      j += 2;
3173   }
3174   }
31763175
3177  dst[j] = '\0';
3178  return j;
3176   dst[j] = '\0';
3177   return j;
31793178}
31803179#endif  // !NO_DIRECTORY_LISTING || !MONGOOSE_NO_DAV
31813180
31823181#ifndef MONGOOSE_NO_DIRECTORY_LISTING
31833182
31843183static void print_dir_entry(const struct dir_entry *de) {
3185  char size[64], mod[64], href[MAX_PATH_SIZE * 3];
3186  int64_t fsize = de->st.st_size;
3187  int is_dir = S_ISDIR(de->st.st_mode);
3188  const char *slash = is_dir ? "/" : "";
3184   char size[64], mod[64], href[MAX_PATH_SIZE * 3];
3185   int64_t fsize = de->st.st_size;
3186   int is_dir = S_ISDIR(de->st.st_mode);
3187   const char *slash = is_dir ? "/" : "";
31893188
3190  if (is_dir) {
3191    mg_snprintf(size, sizeof(size), "%s", "[DIRECTORY]");
3192  } else {
3193     // We use (signed) cast below because MSVC 6 compiler cannot
3194     // convert unsigned __int64 to double.
3195    if (fsize < 1024) {
3196      mg_snprintf(size, sizeof(size), "%d", (int) fsize);
3197    } else if (fsize < 0x100000) {
3198      mg_snprintf(size, sizeof(size), "%.1fk", (double) fsize / 1024.0);
3199    } else if (fsize < 0x40000000) {
3200      mg_snprintf(size, sizeof(size), "%.1fM", (double) fsize / 1048576);
3201    } else {
3202      mg_snprintf(size, sizeof(size), "%.1fG", (double) fsize / 1073741824);
3203    }
3204  }
3205  strftime(mod, sizeof(mod), "%d-%b-%Y %H:%M", localtime(&de->st.st_mtime));
3206  mg_url_encode(de->file_name, strlen(de->file_name), href, sizeof(href));
3207  mg_printf_data(&de->conn->mg_conn,
3208                  "<tr><td><a href=\"%s%s\">%s%s</a></td>"
3209                  "<td>&nbsp;%s</td><td>&nbsp;&nbsp;%s</td></tr>\n",
3210                  href, slash, de->file_name, slash, mod, size);
3189   if (is_dir) {
3190   mg_snprintf(size, sizeof(size), "%s", "[DIRECTORY]");
3191   } else {
3192      // We use (signed) cast below because MSVC 6 compiler cannot
3193      // convert unsigned __int64 to double.
3194   if (fsize < 1024) {
3195      mg_snprintf(size, sizeof(size), "%d", (int) fsize);
3196   } else if (fsize < 0x100000) {
3197      mg_snprintf(size, sizeof(size), "%.1fk", (double) fsize / 1024.0);
3198   } else if (fsize < 0x40000000) {
3199      mg_snprintf(size, sizeof(size), "%.1fM", (double) fsize / 1048576);
3200   } else {
3201      mg_snprintf(size, sizeof(size), "%.1fG", (double) fsize / 1073741824);
3202   }
3203   }
3204   strftime(mod, sizeof(mod), "%d-%b-%Y %H:%M", localtime(&de->st.st_mtime));
3205   mg_url_encode(de->file_name, strlen(de->file_name), href, sizeof(href));
3206   mg_printf_data(&de->conn->mg_conn,
3207               "<tr><td><a href=\"%s%s\">%s%s</a></td>"
3208               "<td>&nbsp;%s</td><td>&nbsp;&nbsp;%s</td></tr>\n",
3209               href, slash, de->file_name, slash, mod, size);
32113210}
32123211
32133212// Sort directory entries by size, or name, or modification time.
32143213// On windows, __cdecl specification is needed in case if project is built
32153214// with __stdcall convention. qsort always requires __cdels callback.
32163215static int __cdecl compare_dir_entries(const void *p1, const void *p2) {
3217  const struct dir_entry *a = (const struct dir_entry *) p1,
3218        *b = (const struct dir_entry *) p2;
3219  const char *qs = a->conn->mg_conn.query_string ?
3220    a->conn->mg_conn.query_string : "na";
3221  int cmp_result = 0;
3216   const struct dir_entry *a = (const struct dir_entry *) p1,
3217      *b = (const struct dir_entry *) p2;
3218   const char *qs = a->conn->mg_conn.query_string ?
3219   a->conn->mg_conn.query_string : "na";
3220   int cmp_result = 0;
32223221
3223  if (S_ISDIR(a->st.st_mode) && !S_ISDIR(b->st.st_mode)) {
3224    return -1;  // Always put directories on top
3225  } else if (!S_ISDIR(a->st.st_mode) && S_ISDIR(b->st.st_mode)) {
3226    return 1;   // Always put directories on top
3227  } else if (*qs == 'n') {
3228    cmp_result = strcmp(a->file_name, b->file_name);
3229  } else if (*qs == 's') {
3230    cmp_result = a->st.st_size == b->st.st_size ? 0 :
3231      a->st.st_size > b->st.st_size ? 1 : -1;
3232  } else if (*qs == 'd') {
3233    cmp_result = a->st.st_mtime == b->st.st_mtime ? 0 :
3234      a->st.st_mtime > b->st.st_mtime ? 1 : -1;
3235  }
3222   if (S_ISDIR(a->st.st_mode) && !S_ISDIR(b->st.st_mode)) {
3223   return -1;  // Always put directories on top
3224   } else if (!S_ISDIR(a->st.st_mode) && S_ISDIR(b->st.st_mode)) {
3225   return 1;   // Always put directories on top
3226   } else if (*qs == 'n') {
3227   cmp_result = strcmp(a->file_name, b->file_name);
3228   } else if (*qs == 's') {
3229   cmp_result = a->st.st_size == b->st.st_size ? 0 :
3230      a->st.st_size > b->st.st_size ? 1 : -1;
3231   } else if (*qs == 'd') {
3232   cmp_result = a->st.st_mtime == b->st.st_mtime ? 0 :
3233      a->st.st_mtime > b->st.st_mtime ? 1 : -1;
3234   }
32363235
3237  return qs[1] == 'd' ? -cmp_result : cmp_result;
3236   return qs[1] == 'd' ? -cmp_result : cmp_result;
32383237}
32393238
32403239static void send_directory_listing(struct connection *conn, const char *dir) {
3241  struct dir_entry *arr = NULL;
3242  int i, num_entries, sort_direction = conn->mg_conn.query_string != NULL &&
3243    conn->mg_conn.query_string[1] == 'd' ? 'a' : 'd';
3240   struct dir_entry *arr = NULL;
3241   int i, num_entries, sort_direction = conn->mg_conn.query_string != NULL &&
3242   conn->mg_conn.query_string[1] == 'd' ? 'a' : 'd';
32443243
3245  mg_send_header(&conn->mg_conn, "Transfer-Encoding", "chunked");
3246  mg_send_header(&conn->mg_conn, "Content-Type", "text/html; charset=utf-8");
3244   mg_send_header(&conn->mg_conn, "Transfer-Encoding", "chunked");
3245   mg_send_header(&conn->mg_conn, "Content-Type", "text/html; charset=utf-8");
32473246
3248  mg_printf_data(&conn->mg_conn,
3249              "<html><head><title>Index of %s</title>"
3250              "<style>th {text-align: left;}</style></head>"
3251              "<body><h1>Index of %s</h1><pre><table cellpadding=\"0\">"
3252              "<tr><th><a href=\"?n%c\">Name</a></th>"
3253              "<th><a href=\"?d%c\">Modified</a></th>"
3254              "<th><a href=\"?s%c\">Size</a></th></tr>"
3255              "<tr><td colspan=\"3\"><hr></td></tr>",
3256              conn->mg_conn.uri, conn->mg_conn.uri,
3257              sort_direction, sort_direction, sort_direction);
3247   mg_printf_data(&conn->mg_conn,
3248            "<html><head><title>Index of %s</title>"
3249            "<style>th {text-align: left;}</style></head>"
3250            "<body><h1>Index of %s</h1><pre><table cellpadding=\"0\">"
3251            "<tr><th><a href=\"?n%c\">Name</a></th>"
3252            "<th><a href=\"?d%c\">Modified</a></th>"
3253            "<th><a href=\"?s%c\">Size</a></th></tr>"
3254            "<tr><td colspan=\"3\"><hr></td></tr>",
3255            conn->mg_conn.uri, conn->mg_conn.uri,
3256            sort_direction, sort_direction, sort_direction);
32583257
3259  num_entries = scan_directory(conn, dir, &arr);
3260  qsort(arr, num_entries, sizeof(arr[0]), compare_dir_entries);
3261  for (i = 0; i < num_entries; i++) {
3262    print_dir_entry(&arr[i]);
3263    free(arr[i].file_name);
3264  }
3265  free(arr);
3258   num_entries = scan_directory(conn, dir, &arr);
3259   qsort(arr, num_entries, sizeof(arr[0]), compare_dir_entries);
3260   for (i = 0; i < num_entries; i++) {
3261   print_dir_entry(&arr[i]);
3262   free(arr[i].file_name);
3263   }
3264   free(arr);
32663265
3267  write_terminating_chunk(conn);
3268  close_local_endpoint(conn);
3266   write_terminating_chunk(conn);
3267   close_local_endpoint(conn);
32693268}
32703269#endif  // MONGOOSE_NO_DIRECTORY_LISTING
32713270
32723271#ifndef MONGOOSE_NO_DAV
32733272static void print_props(struct connection *conn, const char *uri,
3274                        file_stat_t *stp) {
3275  char mtime[64];
3273                  file_stat_t *stp) {
3274   char mtime[64];
32763275
3277  gmt_time_string(mtime, sizeof(mtime), &stp->st_mtime);
3278  mg_printf(&conn->mg_conn,
3279      "<d:response>"
3280       "<d:href>%s</d:href>"
3281       "<d:propstat>"
3282        "<d:prop>"
3283         "<d:resourcetype>%s</d:resourcetype>"
3284         "<d:getcontentlength>%" INT64_FMT "</d:getcontentlength>"
3285         "<d:getlastmodified>%s</d:getlastmodified>"
3286        "</d:prop>"
3287        "<d:status>HTTP/1.1 200 OK</d:status>"
3288       "</d:propstat>"
3289      "</d:response>\n",
3290      uri, S_ISDIR(stp->st_mode) ? "<d:collection/>" : "",
3291      (int64_t) stp->st_size, mtime);
3276   gmt_time_string(mtime, sizeof(mtime), &stp->st_mtime);
3277   mg_printf(&conn->mg_conn,
3278      "<d:response>"
3279      "<d:href>%s</d:href>"
3280      "<d:propstat>"
3281      "<d:prop>"
3282         "<d:resourcetype>%s</d:resourcetype>"
3283         "<d:getcontentlength>%" INT64_FMT "</d:getcontentlength>"
3284         "<d:getlastmodified>%s</d:getlastmodified>"
3285      "</d:prop>"
3286      "<d:status>HTTP/1.1 200 OK</d:status>"
3287      "</d:propstat>"
3288      "</d:response>\n",
3289      uri, S_ISDIR(stp->st_mode) ? "<d:collection/>" : "",
3290      (int64_t) stp->st_size, mtime);
32923291}
32933292
32943293static void handle_propfind(struct connection *conn, const char *path,
3295                            file_stat_t *stp, int exists) {
3296  static const char header[] = "HTTP/1.1 207 Multi-Status\r\n"
3297    "Connection: close\r\n"
3298    "Content-Type: text/xml; charset=utf-8\r\n\r\n"
3299    "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
3300    "<d:multistatus xmlns:d='DAV:'>\n";
3301  static const char footer[] = "</d:multistatus>";
3302  const char *depth = mg_get_header(&conn->mg_conn, "Depth"),
3303        *list_dir = conn->server->config_options[ENABLE_DIRECTORY_LISTING];
3294                     file_stat_t *stp, int exists) {
3295   static const char header[] = "HTTP/1.1 207 Multi-Status\r\n"
3296   "Connection: close\r\n"
3297   "Content-Type: text/xml; charset=utf-8\r\n\r\n"
3298   "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
3299   "<d:multistatus xmlns:d='DAV:'>\n";
3300   static const char footer[] = "</d:multistatus>";
3301   const char *depth = mg_get_header(&conn->mg_conn, "Depth"),
3302      *list_dir = conn->server->config_options[ENABLE_DIRECTORY_LISTING];
33043303
3305  conn->mg_conn.status_code = 207;
3304   conn->mg_conn.status_code = 207;
33063305
3307  // Print properties for the requested resource itself
3308  if (!exists) {
3309    conn->mg_conn.status_code = 404;
3310    mg_printf(&conn->mg_conn, "%s", "HTTP/1.1 404 Not Found\r\n\r\n");
3311  } else if (S_ISDIR(stp->st_mode) && mg_strcasecmp(list_dir, "yes") != 0) {
3312    conn->mg_conn.status_code = 403;
3313    mg_printf(&conn->mg_conn, "%s",
3314              "HTTP/1.1 403 Directory Listing Denied\r\n\r\n");
3315  } else {
3316    ns_send(conn->ns_conn, header, sizeof(header) - 1);
3317    print_props(conn, conn->mg_conn.uri, stp);
3306   // Print properties for the requested resource itself
3307   if (!exists) {
3308   conn->mg_conn.status_code = 404;
3309   mg_printf(&conn->mg_conn, "%s", "HTTP/1.1 404 Not Found\r\n\r\n");
3310   } else if (S_ISDIR(stp->st_mode) && mg_strcasecmp(list_dir, "yes") != 0) {
3311   conn->mg_conn.status_code = 403;
3312   mg_printf(&conn->mg_conn, "%s",
3313            "HTTP/1.1 403 Directory Listing Denied\r\n\r\n");
3314   } else {
3315   ns_send(conn->ns_conn, header, sizeof(header) - 1);
3316   print_props(conn, conn->mg_conn.uri, stp);
33183317
3319    if (S_ISDIR(stp->st_mode) &&
3320             (depth == NULL || strcmp(depth, "0") != 0)) {
3321      struct dir_entry *arr = NULL;
3322      int i, num_entries = scan_directory(conn, path, &arr);
3318   if (S_ISDIR(stp->st_mode) &&
3319            (depth == NULL || strcmp(depth, "0") != 0)) {
3320      struct dir_entry *arr = NULL;
3321      int i, num_entries = scan_directory(conn, path, &arr);
33233322
3324      for (i = 0; i < num_entries; i++) {
3325        char buf[MAX_PATH_SIZE * 3];
3326        struct dir_entry *de = &arr[i];
3327        mg_url_encode(de->file_name, strlen(de->file_name), buf, sizeof(buf));
3328        print_props(conn, buf, &de->st);
3329      }
3330    }
3331    ns_send(conn->ns_conn, footer, sizeof(footer) - 1);
3332  }
3323      for (i = 0; i < num_entries; i++) {
3324      char buf[MAX_PATH_SIZE * 3];
3325      struct dir_entry *de = &arr[i];
3326      mg_url_encode(de->file_name, strlen(de->file_name), buf, sizeof(buf));
3327      print_props(conn, buf, &de->st);
3328      }
3329   }
3330   ns_send(conn->ns_conn, footer, sizeof(footer) - 1);
3331   }
33333332
3334  close_local_endpoint(conn);
3333   close_local_endpoint(conn);
33353334}
33363335
33373336static void handle_mkcol(struct connection *conn, const char *path) {
3338  int status_code = 500;
3337   int status_code = 500;
33393338
3340  if (conn->mg_conn.content_len > 0) {
3341    status_code = 415;
3342  } else if (!mkdir(path, 0755)) {
3343    status_code = 201;
3344  } else if (errno == EEXIST) {
3345    status_code = 405;
3346  } else if (errno == EACCES) {
3347    status_code = 403;
3348  } else if (errno == ENOENT) {
3349    status_code = 409;
3350  }
3351  send_http_error(conn, status_code, NULL);
3339   if (conn->mg_conn.content_len > 0) {
3340   status_code = 415;
3341   } else if (!mkdir(path, 0755)) {
3342   status_code = 201;
3343   } else if (errno == EEXIST) {
3344   status_code = 405;
3345   } else if (errno == EACCES) {
3346   status_code = 403;
3347   } else if (errno == ENOENT) {
3348   status_code = 409;
3349   }
3350   send_http_error(conn, status_code, NULL);
33523351}
33533352
33543353static int remove_directory(const char *dir) {
3355  char path[MAX_PATH_SIZE];
3356  struct dirent *dp;
3357  file_stat_t st;
3358  DIR *dirp;
3354   char path[MAX_PATH_SIZE];
3355   struct dirent *dp;
3356   file_stat_t st;
3357   DIR *dirp;
33593358
3360  if ((dirp = opendir(dir)) == NULL) return 0;
3359   if ((dirp = opendir(dir)) == NULL) return 0;
33613360
3362  while ((dp = readdir(dirp)) != NULL) {
3363    if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) continue;
3364    mg_snprintf(path, sizeof(path), "%s%c%s", dir, '/', dp->d_name);
3365    stat(path, &st);
3366    if (S_ISDIR(st.st_mode)) {
3367      remove_directory(path);
3368    } else {
3369      remove(path);
3370    }
3371  }
3372  closedir(dirp);
3373  rmdir(dir);
3361   while ((dp = readdir(dirp)) != NULL) {
3362   if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) continue;
3363   mg_snprintf(path, sizeof(path), "%s%c%s", dir, '/', dp->d_name);
3364   stat(path, &st);
3365   if (S_ISDIR(st.st_mode)) {
3366      remove_directory(path);
3367   } else {
3368      remove(path);
3369   }
3370   }
3371   closedir(dirp);
3372   rmdir(dir);
33743373
3375  return 1;
3374   return 1;
33763375}
33773376
33783377static void handle_delete(struct connection *conn, const char *path) {
3379  file_stat_t st;
3378   file_stat_t st;
33803379
3381  if (stat(path, &st) != 0) {
3382    send_http_error(conn, 404, NULL);
3383  } else if (S_ISDIR(st.st_mode)) {
3384    remove_directory(path);
3385    send_http_error(conn, 204, NULL);
3386  } else if (remove(path) == 0) {
3387    send_http_error(conn, 204, NULL);
3388  } else {
3389    send_http_error(conn, 423, NULL);
3390  }
3380   if (stat(path, &st) != 0) {
3381   send_http_error(conn, 404, NULL);
3382   } else if (S_ISDIR(st.st_mode)) {
3383   remove_directory(path);
3384   send_http_error(conn, 204, NULL);
3385   } else if (remove(path) == 0) {
3386   send_http_error(conn, 204, NULL);
3387   } else {
3388   send_http_error(conn, 423, NULL);
3389   }
33913390}
33923391
33933392// For a given PUT path, create all intermediate subdirectories
33943393// for given path. Return 0 if the path itself is a directory,
33953394// or -1 on error, 1 if OK.
33963395static int put_dir(const char *path) {
3397  char buf[MAX_PATH_SIZE];
3398  const char *s, *p;
3399  file_stat_t st;
3396   char buf[MAX_PATH_SIZE];
3397   const char *s, *p;
3398   file_stat_t st;
34003399
3401  // Create intermediate directories if they do not exist
3402  for (s = p = path + 1; (p = strchr(s, '/')) != NULL; s = ++p) {
3403    if (p - path >= (int) sizeof(buf)) return -1; // Buffer overflow
3404    memcpy(buf, path, p - path);
3405    buf[p - path] = '\0';
3406    if (stat(buf, &st) != 0 && mkdir(buf, 0755) != 0) return -1;
3407    if (p[1] == '\0') return 0;  // Path is a directory itself
3408  }
3400   // Create intermediate directories if they do not exist
3401   for (s = p = path + 1; (p = strchr(s, '/')) != NULL; s = ++p) {
3402   if (p - path >= (int) sizeof(buf)) return -1; // Buffer overflow
3403   memcpy(buf, path, p - path);
3404   buf[p - path] = '\0';
3405   if (stat(buf, &st) != 0 && mkdir(buf, 0755) != 0) return -1;
3406   if (p[1] == '\0') return 0;  // Path is a directory itself
3407   }
34093408
3410  return 1;
3409   return 1;
34113410}
34123411
34133412static void handle_put(struct connection *conn, const char *path) {
3414  file_stat_t st;
3415  const char *range, *cl_hdr = mg_get_header(&conn->mg_conn, "Content-Length");
3416  int64_t r1, r2;
3417  int rc;
3413   file_stat_t st;
3414   const char *range, *cl_hdr = mg_get_header(&conn->mg_conn, "Content-Length");
3415   int64_t r1, r2;
3416   int rc;
34183417
3419  conn->mg_conn.status_code = !stat(path, &st) ? 200 : 201;
3420  if ((rc = put_dir(path)) == 0) {
3421    mg_printf(&conn->mg_conn, "HTTP/1.1 %d OK\r\n\r\n",
3422              conn->mg_conn.status_code);
3423    close_local_endpoint(conn);
3424  } else if (rc == -1) {
3425    send_http_error(conn, 500, "put_dir: %s", strerror(errno));
3426  } else if (cl_hdr == NULL) {
3427    send_http_error(conn, 411, NULL);
3418   conn->mg_conn.status_code = !stat(path, &st) ? 200 : 201;
3419   if ((rc = put_dir(path)) == 0) {
3420   mg_printf(&conn->mg_conn, "HTTP/1.1 %d OK\r\n\r\n",
3421            conn->mg_conn.status_code);
3422   close_local_endpoint(conn);
3423   } else if (rc == -1) {
3424   send_http_error(conn, 500, "put_dir: %s", strerror(errno));
3425   } else if (cl_hdr == NULL) {
3426   send_http_error(conn, 411, NULL);
34283427#ifdef _WIN32
3429    //On Windows, open() is a macro with 2 params
3430  } else if ((conn->endpoint.fd =
3431              open(path, O_RDWR | O_CREAT | O_TRUNC)) < 0) {
3428   //On Windows, open() is a macro with 2 params
3429   } else if ((conn->endpoint.fd =
3430            open(path, O_RDWR | O_CREAT | O_TRUNC)) < 0) {
34323431#else
3433  } else if ((conn->endpoint.fd =
3434              open(path, O_RDWR | O_CREAT | O_TRUNC, 0644)) < 0) {
3432   } else if ((conn->endpoint.fd =
3433            open(path, O_RDWR | O_CREAT | O_TRUNC, 0644)) < 0) {
34353434#endif
3436    send_http_error(conn, 500, "open(%s): %s", path, strerror(errno));
3437  } else {
3438    DBG(("PUT [%s] %zu", path, conn->ns_conn->recv_iobuf.len));
3439    conn->endpoint_type = EP_PUT;
3440    ns_set_close_on_exec(conn->endpoint.fd);
3441    range = mg_get_header(&conn->mg_conn, "Content-Range");
3442    conn->cl = to64(cl_hdr);
3443    r1 = r2 = 0;
3444    if (range != NULL && parse_range_header(range, &r1, &r2) > 0) {
3445      conn->mg_conn.status_code = 206;
3446      lseek(conn->endpoint.fd, r1, SEEK_SET);
3447      conn->cl = r2 > r1 ? r2 - r1 + 1: conn->cl - r1;
3448    }
3449    mg_printf(&conn->mg_conn, "HTTP/1.1 %d OK\r\nContent-Length: 0\r\n\r\n",
3450              conn->mg_conn.status_code);
3451  }
3435   send_http_error(conn, 500, "open(%s): %s", path, strerror(errno));
3436   } else {
3437   DBG(("PUT [%s] %zu", path, conn->ns_conn->recv_iobuf.len));
3438   conn->endpoint_type = EP_PUT;
3439   ns_set_close_on_exec(conn->endpoint.fd);
3440   range = mg_get_header(&conn->mg_conn, "Content-Range");
3441   conn->cl = to64(cl_hdr);
3442   r1 = r2 = 0;
3443   if (range != NULL && parse_range_header(range, &r1, &r2) > 0) {
3444      conn->mg_conn.status_code = 206;
3445      lseek(conn->endpoint.fd, r1, SEEK_SET);
3446      conn->cl = r2 > r1 ? r2 - r1 + 1: conn->cl - r1;
3447   }
3448   mg_printf(&conn->mg_conn, "HTTP/1.1 %d OK\r\nContent-Length: 0\r\n\r\n",
3449            conn->mg_conn.status_code);
3450   }
34523451}
34533452
34543453static void forward_put_data(struct connection *conn) {
3455  struct iobuf *io = &conn->ns_conn->recv_iobuf;
3456  size_t k = conn->cl < (int64_t) io->len ? conn->cl : io->len;   // To write
3457  int n = write(conn->endpoint.fd, io->buf, k);   // Write them!
3458  if (n > 0) {
3459    iobuf_remove(io, n);
3460    conn->cl -= n;
3461  }
3462  if (conn->cl <= 0) {
3463    close_local_endpoint(conn);
3464  }
3454   struct iobuf *io = &conn->ns_conn->recv_iobuf;
3455   size_t k = conn->cl < (int64_t) io->len ? conn->cl : io->len;   // To write
3456   int n = write(conn->endpoint.fd, io->buf, k);   // Write them!
3457   if (n > 0) {
3458   iobuf_remove(io, n);
3459   conn->cl -= n;
3460   }
3461   if (conn->cl <= 0) {
3462   close_local_endpoint(conn);
3463   }
34653464}
34663465#endif //  MONGOOSE_NO_DAV
34673466
34683467static void send_options(struct connection *conn) {
3469  conn->mg_conn.status_code = 200;
3470  mg_printf(&conn->mg_conn, "%s",
3471            "HTTP/1.1 200 OK\r\nAllow: GET, POST, HEAD, CONNECT, PUT, "
3472            "DELETE, OPTIONS, PROPFIND, MKCOL\r\nDAV: 1\r\n\r\n");
3473  close_local_endpoint(conn);
3468   conn->mg_conn.status_code = 200;
3469   mg_printf(&conn->mg_conn, "%s",
3470         "HTTP/1.1 200 OK\r\nAllow: GET, POST, HEAD, CONNECT, PUT, "
3471         "DELETE, OPTIONS, PROPFIND, MKCOL\r\nDAV: 1\r\n\r\n");
3472   close_local_endpoint(conn);
34743473}
34753474
34763475#ifndef MONGOOSE_NO_AUTH
34773476void mg_send_digest_auth_request(struct mg_connection *c) {
3478  struct connection *conn = MG_CONN_2_CONN(c);
3479  c->status_code = 401;
3480  mg_printf(c,
3481            "HTTP/1.1 401 Unauthorized\r\n"
3482            "WWW-Authenticate: Digest qop=\"auth\", "
3483            "realm=\"%s\", nonce=\"%lu\"\r\n\r\n",
3484            conn->server->config_options[AUTH_DOMAIN],
3485            (unsigned long) time(NULL));
3486  close_local_endpoint(conn);
3477   struct connection *conn = MG_CONN_2_CONN(c);
3478   c->status_code = 401;
3479   mg_printf(c,
3480         "HTTP/1.1 401 Unauthorized\r\n"
3481         "WWW-Authenticate: Digest qop=\"auth\", "
3482         "realm=\"%s\", nonce=\"%lu\"\r\n\r\n",
3483         conn->server->config_options[AUTH_DOMAIN],
3484         (unsigned long) time(NULL));
3485   close_local_endpoint(conn);
34873486}
34883487
34893488// Use the global passwords file, if specified by auth_gpass option,
34903489// or search for .htpasswd in the requested directory.
34913490static FILE *open_auth_file(struct connection *conn, const char *path) {
3492  char name[MAX_PATH_SIZE];
3493  const char *p, *gpass = conn->server->config_options[GLOBAL_AUTH_FILE];
3494  file_stat_t st;
3495  FILE *fp = NULL;
3491   char name[MAX_PATH_SIZE];
3492   const char *p, *gpass = conn->server->config_options[GLOBAL_AUTH_FILE];
3493   file_stat_t st;
3494   FILE *fp = NULL;
34963495
3497  if (gpass != NULL) {
3498    // Use global passwords file
3499    fp = fopen(gpass, "r");
3500  } else if (!stat(path, &st) && S_ISDIR(st.st_mode)) {
3501    mg_snprintf(name, sizeof(name), "%s%c%s", path, '/', PASSWORDS_FILE_NAME);
3502    fp = fopen(name, "r");
3503  } else {
3504    // Try to find .htpasswd in requested directory.
3505    if ((p = strrchr(path, '/')) == NULL) p = path;
3506    mg_snprintf(name, sizeof(name), "%.*s%c%s",
3507                (int) (p - path), path, '/', PASSWORDS_FILE_NAME);
3508    fp = fopen(name, "r");
3509  }
3496   if (gpass != NULL) {
3497   // Use global passwords file
3498   fp = fopen(gpass, "r");
3499   } else if (!stat(path, &st) && S_ISDIR(st.st_mode)) {
3500   mg_snprintf(name, sizeof(name), "%s%c%s", path, '/', PASSWORDS_FILE_NAME);
3501   fp = fopen(name, "r");
3502   } else {
3503   // Try to find .htpasswd in requested directory.
3504   if ((p = strrchr(path, '/')) == NULL) p = path;
3505   mg_snprintf(name, sizeof(name), "%.*s%c%s",
3506            (int) (p - path), path, '/', PASSWORDS_FILE_NAME);
3507   fp = fopen(name, "r");
3508   }
35103509
3511  return fp;
3510   return fp;
35123511}
35133512
35143513#if !defined(HAVE_MD5) && !defined(MONGOOSE_NO_AUTH)
35153514typedef struct MD5Context {
3516  uint32_t buf[4];
3517  uint32_t bits[2];
3518  unsigned char in[64];
3515   uint32_t buf[4];
3516   uint32_t bits[2];
3517   unsigned char in[64];
35193518} MD5_CTX;
35203519
35213520static void byteReverse(unsigned char *buf, unsigned longs) {
3522  uint32_t t;
3521   uint32_t t;
35233522
3524  // Forrest: MD5 expect LITTLE_ENDIAN, swap if BIG_ENDIAN
3525  if (is_big_endian()) {
3526    do {
3527      t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
3528        ((unsigned) buf[1] << 8 | buf[0]);
3529      * (uint32_t *) buf = t;
3530      buf += 4;
3531    } while (--longs);
3532  }
3523   // Forrest: MD5 expect LITTLE_ENDIAN, swap if BIG_ENDIAN
3524   if (is_big_endian()) {
3525   do {
3526      t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
3527      ((unsigned) buf[1] << 8 | buf[0]);
3528      * (uint32_t *) buf = t;
3529      buf += 4;
3530   } while (--longs);
3531   }
35333532}
35343533
35353534#define F1(x, y, z) (z ^ (x & (y ^ z)))
r31373r31374
35383537#define F4(x, y, z) (y ^ (x | ~z))
35393538
35403539#define MD5STEP(f, w, x, y, z, data, s) \
3541  ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
3540   ( w += f(x, y, z) + data,  w = w<<s | w>>(32-s),  w += x )
35423541
35433542// Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
35443543// initialization constants.
35453544static void MD5Init(MD5_CTX *ctx) {
3546  ctx->buf[0] = 0x67452301;
3547  ctx->buf[1] = 0xefcdab89;
3548  ctx->buf[2] = 0x98badcfe;
3549  ctx->buf[3] = 0x10325476;
3545   ctx->buf[0] = 0x67452301;
3546   ctx->buf[1] = 0xefcdab89;
3547   ctx->buf[2] = 0x98badcfe;
3548   ctx->buf[3] = 0x10325476;
35503549
3551  ctx->bits[0] = 0;
3552  ctx->bits[1] = 0;
3550   ctx->bits[0] = 0;
3551   ctx->bits[1] = 0;
35533552}
35543553
35553554static void MD5Transform(uint32_t buf[4], uint32_t const in[16]) {
3556  register uint32_t a, b, c, d;
3555   register uint32_t a, b, c, d;
35573556
3558  a = buf[0];
3559  b = buf[1];
3560  c = buf[2];
3561  d = buf[3];
3557   a = buf[0];
3558   b = buf[1];
3559   c = buf[2];
3560   d = buf[3];
35623561
3563  MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
3564  MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
3565  MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
3566  MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
3567  MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
3568  MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
3569  MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
3570  MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
3571  MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
3572  MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
3573  MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
3574  MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
3575  MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
3576  MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
3577  MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
3578  MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
3562   MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
3563   MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
3564   MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
3565   MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
3566   MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
3567   MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
3568   MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
3569   MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
3570   MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
3571   MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
3572   MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
3573   MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
3574   MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
3575   MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
3576   MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
3577   MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
35793578
3580  MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
3581  MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
3582  MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
3583  MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
3584  MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
3585  MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
3586  MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
3587  MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
3588  MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
3589  MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
3590  MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
3591  MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
3592  MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
3593  MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
3594  MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
3595  MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
3579   MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
3580   MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
3581   MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
3582   MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
3583   MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
3584   MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
3585   MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
3586   MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
3587   MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
3588   MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
3589   MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
3590   MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
3591   MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
3592   MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
3593   MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
3594   MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
35963595
3597  MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
3598  MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
3599  MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
3600  MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
3601  MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
3602  MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
3603  MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
3604  MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
3605  MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
3606  MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
3607  MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
3608  MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
3609  MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
3610  MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
3611  MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
3612  MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
3596   MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
3597   MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
3598   MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
3599   MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
3600   MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
3601   MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
3602   MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
3603   MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
3604   MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
3605   MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
3606   MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
3607   MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
3608   MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
3609   MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
3610   MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
3611   MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
36133612
3614  MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
3615  MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
3616  MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
3617  MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
3618  MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
3619  MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
3620  MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
3621  MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
3622  MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
3623  MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
3624  MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
3625  MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
3626  MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
3627  MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
3628  MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
3629  MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
3613   MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
3614   MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
3615   MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
3616   MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
3617   MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
3618   MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
3619   MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
3620   MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
3621   MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
3622   MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
3623   MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
3624   MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
3625   MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
3626   MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
3627   MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
3628   MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
36303629
3631  buf[0] += a;
3632  buf[1] += b;
3633  buf[2] += c;
3634  buf[3] += d;
3630   buf[0] += a;
3631   buf[1] += b;
3632   buf[2] += c;
3633   buf[3] += d;
36353634}
36363635
36373636static void MD5Update(MD5_CTX *ctx, unsigned char const *buf, unsigned len) {
3638  uint32_t t;
3637   uint32_t t;
36393638
3640  t = ctx->bits[0];
3641  if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t)
3642    ctx->bits[1]++;
3643  ctx->bits[1] += len >> 29;
3639   t = ctx->bits[0];
3640   if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t)
3641   ctx->bits[1]++;
3642   ctx->bits[1] += len >> 29;
36443643
3645  t = (t >> 3) & 0x3f;
3644   t = (t >> 3) & 0x3f;
36463645
3647  if (t) {
3648    unsigned char *p = (unsigned char *) ctx->in + t;
3646   if (t) {
3647   unsigned char *p = (unsigned char *) ctx->in + t;
36493648
3650    t = 64 - t;
3651    if (len < t) {
3652      memcpy(p, buf, len);
3653      return;
3654    }
3655    memcpy(p, buf, t);
3656    byteReverse(ctx->in, 16);
3657    MD5Transform(ctx->buf, (uint32_t *) ctx->in);
3658    buf += t;
3659    len -= t;
3660  }
3649   t = 64 - t;
3650   if (len < t) {
3651      memcpy(p, buf, len);
3652      return;
3653   }
3654   memcpy(p, buf, t);
3655   byteReverse(ctx->in, 16);
3656   MD5Transform(ctx->buf, (uint32_t *) ctx->in);
3657   buf += t;
3658   len -= t;
3659   }
36613660
3662  while (len >= 64) {
3663    memcpy(ctx->in, buf, 64);
3664    byteReverse(ctx->in, 16);
3665    MD5Transform(ctx->buf, (uint32_t *) ctx->in);
3666    buf += 64;
3667    len -= 64;
3668  }
3661   while (len >= 64) {
3662   memcpy(ctx->in, buf, 64);
3663   byteReverse(ctx->in, 16);
3664   MD5Transform(ctx->buf, (uint32_t *) ctx->in);
3665   buf += 64;
3666   len -= 64;
3667   }
36693668
3670  memcpy(ctx->in, buf, len);
3669   memcpy(ctx->in, buf, len);
36713670}
36723671
36733672static void MD5Final(unsigned char digest[16], MD5_CTX *ctx) {
3674  unsigned count;
3675  unsigned char *p;
3676  uint32_t *a;
3673   unsigned count;
3674   unsigned char *p;
3675   uint32_t *a;
36773676
3678  count = (ctx->bits[0] >> 3) & 0x3F;
3677   count = (ctx->bits[0] >> 3) & 0x3F;
36793678
3680  p = ctx->in + count;
3681  *p++ = 0x80;
3682  count = 64 - 1 - count;
3683  if (count < 8) {
3684    memset(p, 0, count);
3685    byteReverse(ctx->in, 16);
3686    MD5Transform(ctx->buf, (uint32_t *) ctx->in);
3687    memset(ctx->in, 0, 56);
3688  } else {
3689    memset(p, 0, count - 8);
3690  }
3691  byteReverse(ctx->in, 14);
3679   p = ctx->in + count;
3680   *p++ = 0x80;
3681   count = 64 - 1 - count;
3682   if (count < 8) {
3683   memset(p, 0, count);
3684   byteReverse(ctx->in, 16);
3685   MD5Transform(ctx->buf, (uint32_t *) ctx->in);
3686   memset(ctx->in, 0, 56);
3687   } else {
3688   memset(p, 0, count - 8);
3689   }
3690   byteReverse(ctx->in, 14);
36923691
3693  a = (uint32_t *)ctx->in;
3694  a[14] = ctx->bits[0];
3695  a[15] = ctx->bits[1];
3692   a = (uint32_t *)ctx->in;
3693   a[14] = ctx->bits[0];
3694   a[15] = ctx->bits[1];
36963695
3697  MD5Transform(ctx->buf, (uint32_t *) ctx->in);
3698  byteReverse((unsigned char *) ctx->buf, 4);
3699  memcpy(digest, ctx->buf, 16);
3700  memset((char *) ctx, 0, sizeof(*ctx));
3696   MD5Transform(ctx->buf, (uint32_t *) ctx->in);
3697   byteReverse((unsigned char *) ctx->buf, 4);
3698   memcpy(digest, ctx->buf, 16);
3699   memset((char *) ctx, 0, sizeof(*ctx));
37013700}
37023701#endif // !HAVE_MD5
37033702
r31373r31374
37063705// Stringify binary data. Output buffer must be twice as big as input,
37073706// because each byte takes 2 bytes in string representation
37083707static void bin2str(char *to, const unsigned char *p, size_t len) {
3709  static const char *hex = "0123456789abcdef";
3708   static const char *hex = "0123456789abcdef";
37103709
3711  for (; len--; p++) {
3712    *to++ = hex[p[0] >> 4];
3713    *to++ = hex[p[0] & 0x0f];
3714  }
3715  *to = '\0';
3710   for (; len--; p++) {
3711   *to++ = hex[p[0] >> 4];
3712   *to++ = hex[p[0] & 0x0f];
3713   }
3714   *to = '\0';
37163715}
37173716
37183717// Return stringified MD5 hash for list of strings. Buffer must be 33 bytes.
37193718char *mg_md5(char buf[33], ...) {
3720  unsigned char hash[16];
3721  const char *p;
3722  va_list ap;
3723  MD5_CTX ctx;
3719   unsigned char hash[16];
3720   const char *p;
3721   va_list ap;
3722   MD5_CTX ctx;
37243723
3725  MD5Init(&ctx);
3724   MD5Init(&ctx);
37263725
3727  va_start(ap, buf);
3728  while ((p = va_arg(ap, const char *)) != NULL) {
3729    MD5Update(&ctx, (const unsigned char *) p, (unsigned) strlen(p));
3730  }
3731  va_end(ap);
3726   va_start(ap, buf);
3727   while ((p = va_arg(ap, const char *)) != NULL) {
3728   MD5Update(&ctx, (const unsigned char *) p, (unsigned) strlen(p));
3729   }
3730   va_end(ap);
37323731
3733  MD5Final(hash, &ctx);
3734  bin2str(buf, hash, sizeof(hash));
3735  return buf;
3732   MD5Final(hash, &ctx);
3733   bin2str(buf, hash, sizeof(hash));
3734   return buf;
37363735}
37373736
37383737// Check the user's password, return 1 if OK
37393738static int check_password(const char *method, const char *ha1, const char *uri,
3740                          const char *nonce, const char *nc, const char *cnonce,
3741                          const char *qop, const char *response) {
3742  char ha2[32 + 1], expected_response[32 + 1];
3739                     const char *nonce, const char *nc, const char *cnonce,
3740                     const char *qop, const char *response) {
3741   char ha2[32 + 1], expected_response[32 + 1];
37433742
37443743#if 0
3745  // Check for authentication timeout
3746  if ((unsigned long) time(NULL) - (unsigned long) to64(nonce) > 3600 * 2) {
3747    return 0;
3748  }
3744   // Check for authentication timeout
3745   if ((unsigned long) time(NULL) - (unsigned long) to64(nonce) > 3600 * 2) {
3746   return 0;
3747   }
37493748#endif
37503749
3751  mg_md5(ha2, method, ":", uri, NULL);
3752  mg_md5(expected_response, ha1, ":", nonce, ":", nc,
3753      ":", cnonce, ":", qop, ":", ha2, NULL);
3750   mg_md5(ha2, method, ":", uri, NULL);
3751   mg_md5(expected_response, ha1, ":", nonce, ":", nc,
3752      ":", cnonce, ":", qop, ":", ha2, NULL);
37543753
3755  return mg_strcasecmp(response, expected_response) == 0 ? MG_TRUE : MG_FALSE;
3754   return mg_strcasecmp(response, expected_response) == 0 ? MG_TRUE : MG_FALSE;
37563755}
37573756
37583757
37593758// Authorize against the opened passwords file. Return 1 if authorized.
37603759int mg_authorize_digest(struct mg_connection *c, FILE *fp) {
3761  struct connection *conn = MG_CONN_2_CONN(c);
3762  const char *hdr;
3763  char line[256], f_user[256], ha1[256], f_domain[256], user[100], nonce[100],
3764       uri[MAX_REQUEST_SIZE], cnonce[100], resp[100], qop[100], nc[100];
3760   struct connection *conn = MG_CONN_2_CONN(c);
3761   const char *hdr;
3762   char line[256], f_user[256], ha1[256], f_domain[256], user[100], nonce[100],
3763      uri[MAX_REQUEST_SIZE], cnonce[100], resp[100], qop[100], nc[100];
37653764
3766  if (c == NULL || fp == NULL) return 0;
3767  if ((hdr = mg_get_header(c, "Authorization")) == NULL ||
3768      mg_strncasecmp(hdr, "Digest ", 7) != 0) return 0;
3769  if (!mg_parse_header(hdr, "username", user, sizeof(user))) return 0;
3770  if (!mg_parse_header(hdr, "cnonce", cnonce, sizeof(cnonce))) return 0;
3771  if (!mg_parse_header(hdr, "response", resp, sizeof(resp))) return 0;
3772  if (!mg_parse_header(hdr, "uri", uri, sizeof(uri))) return 0;
3773  if (!mg_parse_header(hdr, "qop", qop, sizeof(qop))) return 0;
3774  if (!mg_parse_header(hdr, "nc", nc, sizeof(nc))) return 0;
3775  if (!mg_parse_header(hdr, "nonce", nonce, sizeof(nonce))) return 0;
3765   if (c == NULL || fp == NULL) return 0;
3766   if ((hdr = mg_get_header(c, "Authorization")) == NULL ||
3767      mg_strncasecmp(hdr, "Digest ", 7) != 0) return 0;
3768   if (!mg_parse_header(hdr, "username", user, sizeof(user))) return 0;
3769   if (!mg_parse_header(hdr, "cnonce", cnonce, sizeof(cnonce))) return 0;
3770   if (!mg_parse_header(hdr, "response", resp, sizeof(resp))) return 0;
3771   if (!mg_parse_header(hdr, "uri", uri, sizeof(uri))) return 0;
3772   if (!mg_parse_header(hdr, "qop", qop, sizeof(qop))) return 0;
3773   if (!mg_parse_header(hdr, "nc", nc, sizeof(nc))) return 0;
3774   if (!mg_parse_header(hdr, "nonce", nonce, sizeof(nonce))) return 0;
37763775
3777  while (fgets(line, sizeof(line), fp) != NULL) {
3778    if (sscanf(line, "%[^:]:%[^:]:%s", f_user, f_domain, ha1) == 3 &&
3779        !strcmp(user, f_user) &&
3780        // NOTE(lsm): due to a bug in MSIE, we do not compare URIs
3781        !strcmp(conn->server->config_options[AUTH_DOMAIN], f_domain))
3782      return check_password(c->request_method, ha1, uri,
3783                            nonce, nc, cnonce, qop, resp);
3784  }
3785  return MG_FALSE;
3776   while (fgets(line, sizeof(line), fp) != NULL) {
3777   if (sscanf(line, "%[^:]:%[^:]:%s", f_user, f_domain, ha1) == 3 &&
3778      !strcmp(user, f_user) &&
3779      // NOTE(lsm): due to a bug in MSIE, we do not compare URIs
3780      !strcmp(conn->server->config_options[AUTH_DOMAIN], f_domain))
3781      return check_password(c->request_method, ha1, uri,
3782                     nonce, nc, cnonce, qop, resp);
3783   }
3784   return MG_FALSE;
37863785}
37873786
37883787
37893788// Return 1 if request is authorised, 0 otherwise.
37903789static int is_authorized(struct connection *conn, const char *path) {
3791  FILE *fp;
3792  int authorized = MG_TRUE;
3790   FILE *fp;
3791   int authorized = MG_TRUE;
37933792
3794  if ((fp = open_auth_file(conn, path)) != NULL) {
3795    authorized = mg_authorize_digest(&conn->mg_conn, fp);
3796    fclose(fp);
3797  }
3793   if ((fp = open_auth_file(conn, path)) != NULL) {
3794   authorized = mg_authorize_digest(&conn->mg_conn, fp);
3795   fclose(fp);
3796   }
37983797
3799  return authorized;
3798   return authorized;
38003799}
38013800
38023801static int is_authorized_for_dav(struct connection *conn) {
3803  const char *auth_file = conn->server->config_options[DAV_AUTH_FILE];
3804  const char *method = conn->mg_conn.request_method;
3805  FILE *fp;
3806  int authorized = MG_FALSE;
3802   const char *auth_file = conn->server->config_options[DAV_AUTH_FILE];
3803   const char *method = conn->mg_conn.request_method;
3804   FILE *fp;
3805   int authorized = MG_FALSE;
38073806
3808  // If dav_auth_file is not set, allow non-authorized PROPFIND
3809  if (method != NULL && !strcmp(method, "PROPFIND") && auth_file == NULL) {
3810    authorized = MG_TRUE;
3811  } else if (auth_file != NULL && (fp = fopen(auth_file, "r")) != NULL) {
3812    authorized = mg_authorize_digest(&conn->mg_conn, fp);
3813    fclose(fp);
3814  }
3807   // If dav_auth_file is not set, allow non-authorized PROPFIND
3808   if (method != NULL && !strcmp(method, "PROPFIND") && auth_file == NULL) {
3809   authorized = MG_TRUE;
3810   } else if (auth_file != NULL && (fp = fopen(auth_file, "r")) != NULL) {
3811   authorized = mg_authorize_digest(&conn->mg_conn, fp);
3812   fclose(fp);
3813   }
38153814
3816  return authorized;
3815   return authorized;
38173816}
38183817
38193818static int is_dav_request(const struct connection *conn) {
3820  const char *s = conn->mg_conn.request_method;
3821  return !strcmp(s, "PUT") || !strcmp(s, "DELETE") ||
3822    !strcmp(s, "MKCOL") || !strcmp(s, "PROPFIND");
3819   const char *s = conn->mg_conn.request_method;
3820   return !strcmp(s, "PUT") || !strcmp(s, "DELETE") ||
3821   !strcmp(s, "MKCOL") || !strcmp(s, "PROPFIND");
38233822}
38243823#endif // MONGOOSE_NO_AUTH
38253824
38263825static int parse_header(const char *str, int str_len, const char *var_name,
3827                        char *buf, size_t buf_size) {
3828  int ch = ' ', len = 0, n = strlen(var_name);
3829  const char *p, *end = str + str_len, *s = NULL;
3826                  char *buf, size_t buf_size) {
3827   int ch = ' ', len = 0, n = strlen(var_name);
3828   const char *p, *end = str + str_len, *s = NULL;
38303829
3831  if (buf != NULL && buf_size > 0) buf[0] = '\0';
3830   if (buf != NULL && buf_size > 0) buf[0] = '\0';
38323831
3833  // Find where variable starts
3834  for (s = str; s != NULL && s + n < end; s++) {
3835    if ((s == str || s[-1] == ' ' || s[-1] == ',') && s[n] == '=' &&
3836        !memcmp(s, var_name, n)) break;
3837  }
3832   // Find where variable starts
3833   for (s = str; s != NULL && s + n < end; s++) {
3834   if ((s == str || s[-1] == ' ' || s[-1] == ',') && s[n] == '=' &&
3835      !memcmp(s, var_name, n)) break;
3836   }
38383837
3839  if (s != NULL && &s[n + 1] < end) {
3840    s += n + 1;
3841    if (*s == '"' || *s == '\'') ch = *s++;
3842    p = s;
3843    while (p < end && p[0] != ch && p[0] != ',' && len < (int) buf_size) {
3844      if (p[0] == '\\' && p[1] == ch) p++;
3845      buf[len++] = *p++;
3846    }
3847    if (len >= (int) buf_size || (ch != ' ' && *p != ch)) {
3848      len = 0;
3849    } else {
3850      if (len > 0 && s[len - 1] == ',') len--;
3851      if (len > 0 && s[len - 1] == ';') len--;
3852      buf[len] = '\0';
3853    }
3854  }
3838   if (s != NULL && &s[n + 1] < end) {
3839   s += n + 1;
3840   if (*s == '"' || *s == '\'') ch = *s++;
3841   p = s;
3842   while (p < end && p[0] != ch && p[0] != ',' && len < (int) buf_size) {
3843      if (p[0] == '\\' && p[1] == ch) p++;
3844      buf[len++] = *p++;
3845   }
3846   if (len >= (int) buf_size || (ch != ' ' && *p != ch)) {
3847      len = 0;
3848   } else {
3849      if (len > 0 && s[len - 1] == ',') len--;
3850      if (len > 0 && s[len - 1] == ';') len--;
3851      buf[len] = '\0';
3852   }
3853   }
38553854
3856  return len;
3855   return len;
38573856}
38583857
38593858int mg_parse_header(const char *s, const char *var_name, char *buf,
3860                    size_t buf_size) {
3861  return parse_header(s, s == NULL ? 0 : strlen(s), var_name, buf, buf_size);
3859               size_t buf_size) {
3860   return parse_header(s, s == NULL ? 0 : strlen(s), var_name, buf, buf_size);
38623861}
38633862
38643863#ifndef MONGOOSE_NO_SSI
38653864static void send_ssi_file(struct mg_connection *, const char *, FILE *, int);
38663865
38673866static void send_file_data(struct mg_connection *conn, FILE *fp) {
3868  char buf[IOBUF_SIZE];
3869  int n;
3870  while ((n = fread(buf, 1, sizeof(buf), fp)) > 0) {
3871    mg_write(conn, buf, n);
3872  }
3867   char buf[IOBUF_SIZE];
3868   int n;
3869   while ((n = fread(buf, 1, sizeof(buf), fp)) > 0) {
3870   mg_write(conn, buf, n);
3871   }
38733872}
38743873
38753874static void do_ssi_include(struct mg_connection *conn, const char *ssi,
3876                           char *tag, int include_level) {
3877  char file_name[IOBUF_SIZE], path[MAX_PATH_SIZE], *p;
3878  char **opts = (MG_CONN_2_CONN(conn))->server->config_options;
3879  FILE *fp;
3875                     char *tag, int include_level) {
3876   char file_name[IOBUF_SIZE], path[MAX_PATH_SIZE], *p;
3877   char **opts = (MG_CONN_2_CONN(conn))->server->config_options;
3878   FILE *fp;
38803879
3881  // sscanf() is safe here, since send_ssi_file() also uses buffer
3882  // of size MG_BUF_LEN to get the tag. So strlen(tag) is always < MG_BUF_LEN.
3883  if (sscanf(tag, " virtual=\"%[^\"]\"", file_name) == 1) {
3884    // File name is relative to the webserver root
3885    mg_snprintf(path, sizeof(path), "%s%c%s",
3886                opts[DOCUMENT_ROOT], '/', file_name);
3887  } else if (sscanf(tag, " abspath=\"%[^\"]\"", file_name) == 1) {
3888    // File name is relative to the webserver working directory
3889    // or it is absolute system path
3890    mg_snprintf(path, sizeof(path), "%s", file_name);
3891  } else if (sscanf(tag, " file=\"%[^\"]\"", file_name) == 1 ||
3892             sscanf(tag, " \"%[^\"]\"", file_name) == 1) {
3893    // File name is relative to the currect document
3894    mg_snprintf(path, sizeof(path), "%s", ssi);
3895    if ((p = strrchr(path, '/')) != NULL) {
3896      p[1] = '\0';
3897    }
3898    mg_snprintf(path + strlen(path), sizeof(path) - strlen(path), "%s",
3899                file_name);
3900  } else {
3901    mg_printf(conn, "Bad SSI #include: [%s]", tag);
3902    return;
3903  }
3880   // sscanf() is safe here, since send_ssi_file() also uses buffer
3881   // of size MG_BUF_LEN to get the tag. So strlen(tag) is always < MG_BUF_LEN.
3882   if (sscanf(tag, " virtual=\"%[^\"]\"", file_name) == 1) {
3883   // File name is relative to the webserver root
3884   mg_snprintf(path, sizeof(path), "%s%c%s",
3885            opts[DOCUMENT_ROOT], '/', file_name);
3886   } else if (sscanf(tag, " abspath=\"%[^\"]\"", file_name) == 1) {
3887   // File name is relative to the webserver working directory
3888   // or it is absolute system path
3889   mg_snprintf(path, sizeof(path), "%s", file_name);
3890   } else if (sscanf(tag, " file=\"%[^\"]\"", file_name) == 1 ||
3891            sscanf(tag, " \"%[^\"]\"", file_name) == 1) {
3892   // File name is relative to the currect document
3893   mg_snprintf(path, sizeof(path), "%s", ssi);
3894   if ((p = strrchr(path, '/')) != NULL) {
3895      p[1] = '\0';
3896   }
3897   mg_snprintf(path + strlen(path), sizeof(path) - strlen(path), "%s",
3898            file_name);
3899   } else {
3900   mg_printf(conn, "Bad SSI #include: [%s]", tag);
3901   return;
3902   }
39043903
3905  if ((fp = fopen(path, "rb")) == NULL) {
3906    mg_printf(conn, "Cannot open SSI #include: [%s]: fopen(%s): %s",
3907              tag, path, strerror(errno));
3908  } else {
3909    ns_set_close_on_exec(fileno(fp));
3910    if (mg_match_prefix(opts[SSI_PATTERN], strlen(opts[SSI_PATTERN]),
3911        path) > 0) {
3912      send_ssi_file(conn, path, fp, include_level + 1);
3913    } else {
3914      send_file_data(conn, fp);
3915    }
3916    fclose(fp);
3917  }
3904   if ((fp = fopen(path, "rb")) == NULL) {
3905   mg_printf(conn, "Cannot open SSI #include: [%s]: fopen(%s): %s",
3906            tag, path, strerror(errno));
3907   } else {
3908   ns_set_close_on_exec(fileno(fp));
3909   if (mg_match_prefix(opts[SSI_PATTERN], strlen(opts[SSI_PATTERN]),
3910      path) > 0) {
3911      send_ssi_file(conn, path, fp, include_level + 1);
3912   } else {
3913      send_file_data(conn, fp);
3914   }
3915   fclose(fp);
3916   }
39183917}
39193918
39203919#ifndef MONGOOSE_NO_POPEN
39213920static void do_ssi_exec(struct mg_connection *conn, char *tag) {
3922  char cmd[IOBUF_SIZE];
3923  FILE *fp;
3921   char cmd[IOBUF_SIZE];
3922   FILE *fp;
39243923
3925  if (sscanf(tag, " \"%[^\"]\"", cmd) != 1) {
3926    mg_printf(conn, "Bad SSI #exec: [%s]", tag);
3927  } else if ((fp = popen(cmd, "r")) == NULL) {
3928    mg_printf(conn, "Cannot SSI #exec: [%s]: %s", cmd, strerror(errno));
3929  } else {
3930    send_file_data(conn, fp);
3931    pclose(fp);
3932  }
3924   if (sscanf(tag, " \"%[^\"]\"", cmd) != 1) {
3925   mg_printf(conn, "Bad SSI #exec: [%s]", tag);
3926   } else if ((fp = popen(cmd, "r")) == NULL) {
3927   mg_printf(conn, "Cannot SSI #exec: [%s]: %s", cmd, strerror(errno));
3928   } else {
3929   send_file_data(conn, fp);
3930   pclose(fp);
3931   }
39333932}
39343933#endif // !MONGOOSE_NO_POPEN
39353934
39363935static void send_ssi_file(struct mg_connection *conn, const char *path,
3937                          FILE *fp, int include_level) {
3938  char buf[IOBUF_SIZE];
3939  int ch, offset, len, in_ssi_tag;
3936                     FILE *fp, int include_level) {
3937   char buf[IOBUF_SIZE];
3938   int ch, offset, len, in_ssi_tag;
39403939
3941  if (include_level > 10) {
3942    mg_printf(conn, "SSI #include level is too deep (%s)", path);
3943    return;
3944  }
3940   if (include_level > 10) {
3941   mg_printf(conn, "SSI #include level is too deep (%s)", path);
3942   return;
3943   }
39453944
3946  in_ssi_tag = len = offset = 0;
3947  while ((ch = fgetc(fp)) != EOF) {
3948    if (in_ssi_tag && ch == '>') {
3949      in_ssi_tag = 0;
3950      buf[len++] = (char) ch;
3951      buf[len] = '\0';
3952      assert(len <= (int) sizeof(buf));
3953      if (len < 6 || memcmp(buf, "<!--#", 5) != 0) {
3954        // Not an SSI tag, pass it
3955        (void) mg_write(conn, buf, (size_t) len);
3956      } else {
3957        if (!memcmp(buf + 5, "include", 7)) {
3958          do_ssi_include(conn, path, buf + 12, include_level);
3945   in_ssi_tag = len = offset = 0;
3946   while ((ch = fgetc(fp)) != EOF) {
3947   if (in_ssi_tag && ch == '>') {
3948      in_ssi_tag = 0;
3949      buf[len++] = (char) ch;
3950      buf[len] = '\0';
3951      assert(len <= (int) sizeof(buf));
3952      if (len < 6 || memcmp(buf, "<!--#", 5) != 0) {
3953      // Not an SSI tag, pass it
3954      (void) mg_write(conn, buf, (size_t) len);
3955      } else {
3956      if (!memcmp(buf + 5, "include", 7)) {
3957         do_ssi_include(conn, path, buf + 12, include_level);
39593958#if !defined(MONGOOSE_NO_POPEN)
3960        } else if (!memcmp(buf + 5, "exec", 4)) {
3961          do_ssi_exec(conn, buf + 9);
3959      } else if (!memcmp(buf + 5, "exec", 4)) {
3960         do_ssi_exec(conn, buf + 9);
39623961#endif // !NO_POPEN
3963        } else {
3964          mg_printf(conn, "%s: unknown SSI " "command: \"%s\"", path, buf);
3965        }
3966      }
3967      len = 0;
3968    } else if (in_ssi_tag) {
3969      if (len == 5 && memcmp(buf, "<!--#", 5) != 0) {
3970        // Not an SSI tag
3971        in_ssi_tag = 0;
3972      } else if (len == (int) sizeof(buf) - 2) {
3973        mg_printf(conn, "%s: SSI tag is too large", path);
3974        len = 0;
3975      }
3976      buf[len++] = ch & 0xff;
3977    } else if (ch == '<') {
3978      in_ssi_tag = 1;
3979      if (len > 0) {
3980        mg_write(conn, buf, (size_t) len);
3981      }
3982      len = 0;
3983      buf[len++] = ch & 0xff;
3984    } else {
3985      buf[len++] = ch & 0xff;
3986      if (len == (int) sizeof(buf)) {
3987        mg_write(conn, buf, (size_t) len);
3988        len = 0;
3989      }
3990    }
3991  }
3962      } else {
3963         mg_printf(conn, "%s: unknown SSI " "command: \"%s\"", path, buf);
3964      }
3965      }
3966      len = 0;
3967   } else if (in_ssi_tag) {
3968      if (len == 5 && memcmp(buf, "<!--#", 5) != 0) {
3969      // Not an SSI tag
3970      in_ssi_tag = 0;
3971      } else if (len == (int) sizeof(buf) - 2) {
3972      mg_printf(conn, "%s: SSI tag is too large", path);
3973      len = 0;
3974      }
3975      buf[len++] = ch & 0xff;
3976   } else if (ch == '<') {
3977      in_ssi_tag = 1;
3978      if (len > 0) {
3979      mg_write(conn, buf, (size_t) len);
3980      }
3981      len = 0;
3982      buf[len++] = ch & 0xff;
3983   } else {
3984      buf[len++] = ch & 0xff;
3985      if (len == (int) sizeof(buf)) {
3986      mg_write(conn, buf, (size_t) len);
3987      len = 0;
3988      }
3989   }
3990   }
39923991
3993  // Send the rest of buffered data
3994  if (len > 0) {
3995    mg_write(conn, buf, (size_t) len);
3996  }
3992   // Send the rest of buffered data
3993   if (len > 0) {
3994   mg_write(conn, buf, (size_t) len);
3995   }
39973996}
39983997
39993998static void handle_ssi_request(struct connection *conn, const char *path) {
4000  FILE *fp;
4001  struct vec mime_vec;
3999   FILE *fp;
4000   struct vec mime_vec;
40024001
4003  if ((fp = fopen(path, "rb")) == NULL) {
4004    send_http_error(conn, 500, "fopen(%s): %s", path, strerror(errno));
4005  } else {
4006    ns_set_close_on_exec(fileno(fp));
4007    get_mime_type(conn->server, path, &mime_vec);
4008    conn->mg_conn.status_code = 200;
4009    mg_printf(&conn->mg_conn,
4010              "HTTP/1.1 %d OK\r\n"
4011              "Content-Type: %.*s\r\n"
4012              "Connection: close\r\n\r\n",
4013              conn->mg_conn.status_code, (int) mime_vec.len, mime_vec.ptr);
4014    send_ssi_file(&conn->mg_conn, path, fp, 0);
4015    fclose(fp);
4016    close_local_endpoint(conn);
4017  }
4002   if ((fp = fopen(path, "rb")) == NULL) {
4003   send_http_error(conn, 500, "fopen(%s): %s", path, strerror(errno));
4004   } else {
4005   ns_set_close_on_exec(fileno(fp));
4006   get_mime_type(conn->server, path, &mime_vec);
4007   conn->mg_conn.status_code = 200;
4008   mg_printf(&conn->mg_conn,
4009            "HTTP/1.1 %d OK\r\n"
4010            "Content-Type: %.*s\r\n"
4011            "Connection: close\r\n\r\n",
4012            conn->mg_conn.status_code, (int) mime_vec.len, mime_vec.ptr);
4013   send_ssi_file(&conn->mg_conn, path, fp, 0);
4014   fclose(fp);
4015   close_local_endpoint(conn);
4016   }
40184017}
40194018#endif
40204019
40214020static void proxy_request(struct ns_connection *pc, struct mg_connection *c) {
4022  int i, sent_close_header = 0;
4021   int i, sent_close_header = 0;
40234022
4024  ns_printf(pc, "%s %s HTTP/%s\r\n", c->request_method, c->uri,
4025            c->http_version);
4026  for (i = 0; i < c->num_headers; i++) {
4027    if (mg_strcasecmp(c->http_headers[i].name, "Connection") == 0) {
4028      // Force connection close, cause we don't parse proxy replies
4029      // therefore we don't know message boundaries
4030      //ns_printf(pc, "%s: %s\r\n", "Connection", "close");
4031      sent_close_header = 1;
4032    //} else {
4033    }
4034      ns_printf(pc, "%s: %s\r\n", c->http_headers[i].name,
4035                c->http_headers[i].value);
4036  }
4037  if (!sent_close_header) {
4038    ns_printf(pc, "%s: %s\r\n", "Connection", "close");
4039  }
4040  ns_printf(pc, "%s", "\r\n");
4041  ns_send(pc, c->content, c->content_len);
4023   ns_printf(pc, "%s %s HTTP/%s\r\n", c->request_method, c->uri,
4024         c->http_version);
4025   for (i = 0; i < c->num_headers; i++) {
4026   if (mg_strcasecmp(c->http_headers[i].name, "Connection") == 0) {
4027      // Force connection close, cause we don't parse proxy replies
4028      // therefore we don't know message boundaries
4029      //ns_printf(pc, "%s: %s\r\n", "Connection", "close");
4030      sent_close_header = 1;
4031   //} else {
4032   }
4033      ns_printf(pc, "%s: %s\r\n", c->http_headers[i].name,
4034            c->http_headers[i].value);
4035   }
4036   if (!sent_close_header) {
4037   ns_printf(pc, "%s: %s\r\n", "Connection", "close");
4038   }
4039   ns_printf(pc, "%s", "\r\n");
4040   ns_send(pc, c->content, c->content_len);
40424041
40434042}
40444043
40454044#ifdef NS_ENABLE_SSL
40464045int mg_terminate_ssl(struct mg_connection *c, const char *cert) {
4047  static const char ok[] = "HTTP/1.0 200 OK\r\n\r\n";
4048  struct connection *conn = MG_CONN_2_CONN(c);
4049  int n;
4050  SSL_CTX *ctx;
4046   static const char ok[] = "HTTP/1.0 200 OK\r\n\r\n";
4047   struct connection *conn = MG_CONN_2_CONN(c);
4048   int n;
4049   SSL_CTX *ctx;
40514050
4052  DBG(("%p MITM", conn));
4053  SSL_library_init();
4054  if ((ctx = SSL_CTX_new(SSLv23_server_method())) == NULL) return 0;
4051   DBG(("%p MITM", conn));
4052   SSL_library_init();
4053   if ((ctx = SSL_CTX_new(SSLv23_server_method())) == NULL) return 0;
40554054
4056  SSL_CTX_use_certificate_file(ctx, cert, 1);
4057  SSL_CTX_use_PrivateKey_file(ctx, cert, 1);
4058  SSL_CTX_use_certificate_chain_file(ctx, cert);
4055   SSL_CTX_use_certificate_file(ctx, cert, 1);
4056   SSL_CTX_use_PrivateKey_file(ctx, cert, 1);
4057   SSL_CTX_use_certificate_chain_file(ctx, cert);
40594058
4060  // When clear-text reply is pushed to client, switch to SSL mode.
4061  n = send(conn->ns_conn->sock, ok, sizeof(ok) - 1, 0);
4062  DBG(("%p %lu %d SEND", c, sizeof(ok) - 1, n));
4063  conn->ns_conn->send_iobuf.len = 0;
4064  conn->endpoint_type = EP_USER;  // To keep-alive in close_local_endpoint()
4065  close_local_endpoint(conn);     // Clean up current CONNECT request
4066  if ((conn->ns_conn->ssl = SSL_new(ctx)) != NULL) {
4067    SSL_set_fd(conn->ns_conn->ssl, conn->ns_conn->sock);
4068  }
4069  SSL_CTX_free(ctx);
4070  return 1;
4059   // When clear-text reply is pushed to client, switch to SSL mode.
4060   n = send(conn->ns_conn->sock, ok, sizeof(ok) - 1, 0);
4061   DBG(("%p %lu %d SEND", c, sizeof(ok) - 1, n));
4062   conn->ns_conn->send_iobuf.len = 0;
4063   conn->endpoint_type = EP_USER;  // To keep-alive in close_local_endpoint()
4064   close_local_endpoint(conn);     // Clean up current CONNECT request
4065   if ((conn->ns_conn->ssl = SSL_new(ctx)) != NULL) {
4066   SSL_set_fd(conn->ns_conn->ssl, conn->ns_conn->sock);
4067   }
4068   SSL_CTX_free(ctx);
4069   return 1;
40714070}
40724071#endif
40734072
40744073static void proxify_connection(struct connection *conn) {
4075  char proto[10], host[500], cert[500];
4076  unsigned short port = 80;
4077  struct mg_connection *c = &conn->mg_conn;
4078  struct ns_server *server = &conn->server->ns_server;
4079  struct ns_connection *pc = NULL;
4080  int n = 0;
4081  const char *url = c->uri;
4074   char proto[10], host[500], cert[500];
4075   unsigned short port = 80;
4076   struct mg_connection *c = &conn->mg_conn;
4077   struct ns_server *server = &conn->server->ns_server;
4078   struct ns_connection *pc = NULL;
4079   int n = 0;
4080   const char *url = c->uri;
40824081
4083  proto[0] = host[0] = cert[0] = '\0';
4084  if (sscanf(url, "%499[^: ]:%hu%n", host, &port, &n) != 2 &&
4085      sscanf(url, "%9[a-z]://%499[^: ]:%hu%n", proto, host, &port, &n) != 3 &&
4086      sscanf(url, "%9[a-z]://%499[^/ ]%n", proto, host, &n) != 2) {
4087    n = 0;
4088  }
4082   proto[0] = host[0] = cert[0] = '\0';
4083   if (sscanf(url, "%499[^: ]:%hu%n", host, &port, &n) != 2 &&
4084      sscanf(url, "%9[a-z]://%499[^: ]:%hu%n", proto, host, &port, &n) != 3 &&
4085      sscanf(url, "%9[a-z]://%499[^/ ]%n", proto, host, &n) != 2) {
4086   n = 0;
4087   }
40894088
40904089#ifdef NS_ENABLE_SSL
4091  // Find out whether we should be in the MITM mode
4092  {
4093    const char *certs = conn->server->config_options[SSL_MITM_CERTS];
4094    int host_len = strlen(host);
4095    struct vec a, b;
4090   // Find out whether we should be in the MITM mode
4091   {
4092   const char *certs = conn->server->config_options[SSL_MITM_CERTS];
4093   int host_len = strlen(host);
4094   struct vec a, b;
40964095
4097    while (conn->ns_conn->ssl == NULL && port != 80 &&
4098           (certs = next_option(certs, &a, &b)) != NULL) {
4099      if (a.len != host_len || mg_strncasecmp(a.ptr, host, a.len)) continue;
4100      snprintf(cert, sizeof(cert), "%.*s", b.len, b.ptr);
4101      mg_terminate_ssl(&conn->mg_conn, cert);
4102      return;
4103    }
4104  }
4096   while (conn->ns_conn->ssl == NULL && port != 80 &&
4097         (certs = next_option(certs, &a, &b)) != NULL) {
4098      if (a.len != host_len || mg_strncasecmp(a.ptr, host, a.len)) continue;
4099      snprintf(cert, sizeof(cert), "%.*s", b.len, b.ptr);
4100      mg_terminate_ssl(&conn->mg_conn, cert);
4101      return;
4102   }
4103   }
41054104#endif
41064105
4107  if (n > 0 &&
4108      (pc = ns_connect(server, host, port, conn->ns_conn->ssl != NULL,
4109                       conn)) != NULL) {
4110    // Interlink two connections
4111    pc->flags |= MG_PROXY_CONN;
4112    conn->endpoint_type = EP_PROXY;
4113    conn->endpoint.nc = pc;
4114    DBG(("%p [%s] -> %p %p", conn, c->uri, pc, conn->ns_conn->ssl));
4106   if (n > 0 &&
4107      (pc = ns_connect(server, host, port, conn->ns_conn->ssl != NULL,
4108                  conn)) != NULL) {
4109   // Interlink two connections
4110   pc->flags |= MG_PROXY_CONN;
4111   conn->endpoint_type = EP_PROXY;
4112   conn->endpoint.nc = pc;
4113   DBG(("%p [%s] -> %p %p", conn, c->uri, pc, conn->ns_conn->ssl));
41154114
4116    if (strcmp(c->request_method, "CONNECT") == 0) {
4117      // For CONNECT request, reply with 200 OK. Tunnel is established.
4118      mg_printf(c, "%s", "HTTP/1.1 200 OK\r\n\r\n");
4119      conn->request_len = 0;
4120      free(conn->request);
4121      conn->request = NULL;
4122    } else {
4123      // For other methods, forward the request to the target host.
4124      c->uri += n;
4125      proxy_request(pc, c);
4126    }
4127  } else {
4128    conn->ns_conn->flags |= NSF_CLOSE_IMMEDIATELY;
4129  }
4115   if (strcmp(c->request_method, "CONNECT") == 0) {
4116      // For CONNECT request, reply with 200 OK. Tunnel is established.
4117      mg_printf(c, "%s", "HTTP/1.1 200 OK\r\n\r\n");
4118      conn->request_len = 0;
4119      free(conn->request);
4120      conn->request = NULL;
4121   } else {
4122      // For other methods, forward the request to the target host.
4123      c->uri += n;
4124      proxy_request(pc, c);
4125   }
4126   } else {
4127   conn->ns_conn->flags |= NSF_CLOSE_IMMEDIATELY;
4128   }
41304129}
41314130
41324131#ifndef MONGOOSE_NO_FILESYSTEM
41334132void mg_send_file(struct mg_connection *c, const char *file_name) {
4134  struct connection *conn = MG_CONN_2_CONN(c);
4135  file_stat_t st;
4136  char path[MAX_PATH_SIZE];
4137  int exists = 0, is_directory = 0;
4133   struct connection *conn = MG_CONN_2_CONN(c);
4134   file_stat_t st;
4135   char path[MAX_PATH_SIZE];
4136   int exists = 0, is_directory = 0;
41384137#ifndef MONGOOSE_NO_CGI
4139  const char *cgi_pat = conn->server->config_options[CGI_PATTERN];
4138   const char *cgi_pat = conn->server->config_options[CGI_PATTERN];
41404139#else
4141  const char *cgi_pat = DEFAULT_CGI_PATTERN;
4140   const char *cgi_pat = DEFAULT_CGI_PATTERN;
41424141#endif
41434142#ifndef MONGOOSE_NO_DIRECTORY_LISTING
4144  const char *dir_lst = conn->server->config_options[ENABLE_DIRECTORY_LISTING];
4143   const char *dir_lst = conn->server->config_options[ENABLE_DIRECTORY_LISTING];
41454144#else
4146  const char *dir_lst = "yes";
4145   const char *dir_lst = "yes";
41474146#endif
41484147
4149  mg_snprintf(path, sizeof(path), "%s", file_name);
4150  exists = stat(path, &st) == 0;
4151  is_directory = S_ISDIR(st.st_mode);
4152 
4153  if (!exists || must_hide_file(conn, path)) {
4154    send_http_error(conn, 404, NULL);
4155  } else if (is_directory &&
4156             conn->mg_conn.uri[strlen(conn->mg_conn.uri) - 1] != '/') {
4157    conn->mg_conn.status_code = 301;
4158    mg_printf(&conn->mg_conn, "HTTP/1.1 301 Moved Permanently\r\n"
4159              "Location: %s/\r\n\r\n", conn->mg_conn.uri);
4160    close_local_endpoint(conn);
4161  } else if (is_directory && !find_index_file(conn, path, sizeof(path), &st)) {
4162    if (!mg_strcasecmp(dir_lst, "yes")) {
4148   mg_snprintf(path, sizeof(path), "%s", file_name);
4149   exists = stat(path, &st) == 0;
4150   is_directory = S_ISDIR(st.st_mode);
4151
4152   if (!exists || must_hide_file(conn, path)) {
4153   send_http_error(conn, 404, NULL);
4154   } else if (is_directory &&
4155            conn->mg_conn.uri[strlen(conn->mg_conn.uri) - 1] != '/') {
4156   conn->mg_conn.status_code = 301;
4157   mg_printf(&conn->mg_conn, "HTTP/1.1 301 Moved Permanently\r\n"
4158            "Location: %s/\r\n\r\n", conn->mg_conn.uri);
4159   close_local_endpoint(conn);
4160   } else if (is_directory && !find_index_file(conn, path, sizeof(path), &st)) {
4161   if (!mg_strcasecmp(dir_lst, "yes")) {
41634162#ifndef MONGOOSE_NO_DIRECTORY_LISTING
4164      send_directory_listing(conn, path);
4163      send_directory_listing(conn, path);
41654164#else
4166      send_http_error(conn, 501, NULL);
4165      send_http_error(conn, 501, NULL);
41674166#endif
4168    } else {
4169      send_http_error(conn, 403, NULL);
4170    }
4171  } else if (mg_match_prefix(cgi_pat, strlen(cgi_pat), path) > 0) {
4167   } else {
4168      send_http_error(conn, 403, NULL);
4169   }
4170   } else if (mg_match_prefix(cgi_pat, strlen(cgi_pat), path) > 0) {
41724171#if !defined(MONGOOSE_NO_CGI)
4173    open_cgi_endpoint(conn, path);
4172   open_cgi_endpoint(conn, path);
41744173#else
4175    send_http_error(conn, 501, NULL);
4174   send_http_error(conn, 501, NULL);
41764175#endif // !MONGOOSE_NO_CGI
41774176#ifndef MONGOOSE_NO_SSI
4178  } else if (mg_match_prefix(conn->server->config_options[SSI_PATTERN],
4179                             strlen(conn->server->config_options[SSI_PATTERN]),
4180                             path) > 0) {
4181    handle_ssi_request(conn, path);
4177   } else if (mg_match_prefix(conn->server->config_options[SSI_PATTERN],
4178                        strlen(conn->server->config_options[SSI_PATTERN]),
4179                        path) > 0) {
4180   handle_ssi_request(conn, path);
41824181#endif
4183  } else if (is_not_modified(conn, &st)) {
4184    send_http_error(conn, 304, NULL);
4185  } else if ((conn->endpoint.fd = open(path, O_RDONLY | O_BINARY)) != -1) {
4186    // O_BINARY is required for Windows, otherwise in default text mode
4187    // two bytes \r\n will be read as one.
4188    open_file_endpoint(conn, path, &st);
4189  } else {
4190    send_http_error(conn, 404, NULL);
4191  }
4182   } else if (is_not_modified(conn, &st)) {
4183   send_http_error(conn, 304, NULL);
4184   } else if ((conn->endpoint.fd = open(path, O_RDONLY | O_BINARY)) != -1) {
4185   // O_BINARY is required for Windows, otherwise in default text mode
4186   // two bytes \r\n will be read as one.
4187   open_file_endpoint(conn, path, &st);
4188   } else {
4189   send_http_error(conn, 404, NULL);
4190   }
41924191}
41934192#endif  // !MONGOOSE_NO_FILESYSTEM
41944193
41954194static void open_local_endpoint(struct connection *conn, int skip_user) {
41964195#ifndef MONGOOSE_NO_FILESYSTEM
4197  char path[MAX_PATH_SIZE];
4198  file_stat_t st;
4199  int exists = 0;
4196   char path[MAX_PATH_SIZE];
4197   file_stat_t st;
4198   int exists = 0;
42004199#endif
42014200
4202  // If EP_USER was set in a prev call, reset it
4203  conn->endpoint_type = EP_NONE;
4201   // If EP_USER was set in a prev call, reset it
4202   conn->endpoint_type = EP_NONE;
42044203
42054204#ifndef MONGOOSE_NO_AUTH
4206  if (conn->server->event_handler && call_user(conn, MG_AUTH) == MG_FALSE) {
4207    mg_send_digest_auth_request(&conn->mg_conn);
4208    return;
4209  }
4205   if (conn->server->event_handler && call_user(conn, MG_AUTH) == MG_FALSE) {
4206   mg_send_digest_auth_request(&conn->mg_conn);
4207   return;
4208   }
42104209#endif
42114210
4212  // Call URI handler if one is registered for this URI
4213  if (skip_user == 0 && conn->server->event_handler != NULL) {
4214    conn->endpoint_type = EP_USER;
4211   // Call URI handler if one is registered for this URI
4212   if (skip_user == 0 && conn->server->event_handler != NULL) {
4213   conn->endpoint_type = EP_USER;
42154214#if MONGOOSE_POST_SIZE_LIMIT > 1
4216    {
4217      const char *cl = mg_get_header(&conn->mg_conn, "Content-Length");
4218      if ((strcmp(conn->mg_conn.request_method, "POST") == 0 ||
4219           strcmp(conn->mg_conn.request_method, "PUT") == 0) &&
4220          (cl == NULL || to64(cl) > MONGOOSE_POST_SIZE_LIMIT)) {
4221        send_http_error(conn, 500, "POST size > %zu",
4222                        (size_t) MONGOOSE_POST_SIZE_LIMIT);
4223      }
4224    }
4215   {
4216      const char *cl = mg_get_header(&conn->mg_conn, "Content-Length");
4217      if ((strcmp(conn->mg_conn.request_method, "POST") == 0 ||
4218         strcmp(conn->mg_conn.request_method, "PUT") == 0) &&
4219         (cl == NULL || to64(cl) > MONGOOSE_POST_SIZE_LIMIT)) {
4220      send_http_error(conn, 500, "POST size > %zu",
4221                  (size_t) MONGOOSE_POST_SIZE_LIMIT);
4222      }
4223   }
42254224#endif
4226    return;
4227  }
4225   return;
4226   }
42284227
4229  if (strcmp(conn->mg_conn.request_method, "CONNECT") == 0 ||
4230      memcmp(conn->mg_conn.uri, "http", 4) == 0) {
4231    proxify_connection(conn);
4232    return;
4233  }
4234 
4235  if (!strcmp(conn->mg_conn.request_method, "OPTIONS")) {
4236    send_options(conn);
4237    return;
4238  }
4239 
4228   if (strcmp(conn->mg_conn.request_method, "CONNECT") == 0 ||
4229      memcmp(conn->mg_conn.uri, "http", 4) == 0) {
4230   proxify_connection(conn);
4231   return;
4232   }
4233
4234   if (!strcmp(conn->mg_conn.request_method, "OPTIONS")) {
4235   send_options(conn);
4236   return;
4237   }
4238
42404239#ifdef MONGOOSE_NO_FILESYSTEM
4241  send_http_error(conn, 404, NULL);
4240   send_http_error(conn, 404, NULL);
42424241#else
4243  exists = convert_uri_to_file_name(conn, path, sizeof(path), &st);
4242   exists = convert_uri_to_file_name(conn, path, sizeof(path), &st);
42444243
4245  if (!strcmp(conn->mg_conn.request_method, "OPTIONS")) {
4246    send_options(conn);
4247  } else if (conn->server->config_options[DOCUMENT_ROOT] == NULL) {
4248    send_http_error(conn, 404, NULL);
4244   if (!strcmp(conn->mg_conn.request_method, "OPTIONS")) {
4245   send_options(conn);
4246   } else if (conn->server->config_options[DOCUMENT_ROOT] == NULL) {
4247   send_http_error(conn, 404, NULL);
42494248#ifndef MONGOOSE_NO_AUTH
4250  } else if ((!is_dav_request(conn) && !is_authorized(conn, path)) ||
4251             (is_dav_request(conn) && !is_authorized_for_dav(conn))) {
4252    mg_send_digest_auth_request(&conn->mg_conn);
4253    close_local_endpoint(conn);
4249   } else if ((!is_dav_request(conn) && !is_authorized(conn, path)) ||
4250            (is_dav_request(conn) && !is_authorized_for_dav(conn))) {
4251   mg_send_digest_auth_request(&conn->mg_conn);
4252   close_local_endpoint(conn);
42544253#endif
42554254#ifndef MONGOOSE_NO_DAV
4256  } else if (!strcmp(conn->mg_conn.request_method, "PROPFIND")) {
4257    handle_propfind(conn, path, &st, exists);
4258  } else if (!strcmp(conn->mg_conn.request_method, "MKCOL")) {
4259    handle_mkcol(conn, path);
4260  } else if (!strcmp(conn->mg_conn.request_method, "DELETE")) {
4261    handle_delete(conn, path);
4262  } else if (!strcmp(conn->mg_conn.request_method, "PUT")) {
4263    handle_put(conn, path);
4255   } else if (!strcmp(conn->mg_conn.request_method, "PROPFIND")) {
4256   handle_propfind(conn, path, &st, exists);
4257   } else if (!strcmp(conn->mg_conn.request_method, "MKCOL")) {
4258   handle_mkcol(conn, path);
4259   } else if (!strcmp(conn->mg_conn.request_method, "DELETE")) {
4260   handle_delete(conn, path);
4261   } else if (!strcmp(conn->mg_conn.request_method, "PUT")) {
4262   handle_put(conn, path);
42644263#endif
4265  } else {
4266    mg_send_file(&conn->mg_conn, path);
4267  }
4264   } else {
4265   mg_send_file(&conn->mg_conn, path);
4266   }
42684267#endif  // MONGOOSE_NO_FILESYSTEM
42694268}
42704269
42714270static void send_continue_if_expected(struct connection *conn) {
4272  static const char expect_response[] = "HTTP/1.1 100 Continue\r\n\r\n";
4273  const char *expect_hdr = mg_get_header(&conn->mg_conn, "Expect");
4271   static const char expect_response[] = "HTTP/1.1 100 Continue\r\n\r\n";
4272   const char *expect_hdr = mg_get_header(&conn->mg_conn, "Expect");
42744273
4275  if (expect_hdr != NULL && !mg_strcasecmp(expect_hdr, "100-continue")) {
4276    ns_send(conn->ns_conn, expect_response, sizeof(expect_response) - 1);
4277  }
4274   if (expect_hdr != NULL && !mg_strcasecmp(expect_hdr, "100-continue")) {
4275   ns_send(conn->ns_conn, expect_response, sizeof(expect_response) - 1);
4276   }
42784277}
42794278
42804279// Conform to http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2
42814280static int is_valid_uri(const char *uri) {
4282  unsigned short n;
4283  return uri[0] == '/' ||
4284    strcmp(uri, "*") == 0 ||            // OPTIONS method can use asterisk URI
4285    memcmp(uri, "http", 4) == 0 ||      // Naive check for the absolute URI
4286    sscanf(uri, "%*[^ :]:%hu", &n) > 0; // CONNECT method can use host:port
4281   unsigned short n;
4282   return uri[0] == '/' ||
4283   strcmp(uri, "*") == 0 ||            // OPTIONS method can use asterisk URI
4284   memcmp(uri, "http", 4) == 0 ||      // Naive check for the absolute URI
4285   sscanf(uri, "%*[^ :]:%hu", &n) > 0; // CONNECT method can use host:port
42874286}
42884287
42894288static void try_parse(struct connection *conn) {
4290  struct iobuf *io = &conn->ns_conn->recv_iobuf;
4289   struct iobuf *io = &conn->ns_conn->recv_iobuf;
42914290
4292  if (conn->request_len == 0 &&
4293      (conn->request_len = get_request_len(io->buf, io->len)) > 0) {
4294    // If request is buffered in, remove it from the iobuf. This is because
4295    // iobuf could be reallocated, and pointers in parsed request could
4296    // become invalid.
4297    conn->request = (char *) malloc(conn->request_len);
4298    memcpy(conn->request, io->buf, conn->request_len);
4299    //DBG(("%p [%.*s]", conn, conn->request_len, conn->request));
4300    iobuf_remove(io, conn->request_len);
4301    conn->request_len = parse_http_message(conn->request, conn->request_len,
4302                                           &conn->mg_conn);
4303    if (conn->request_len > 0) {
4304      const char *cl_hdr = mg_get_header(&conn->mg_conn, "Content-Length");
4305      conn->cl = cl_hdr == NULL ? 0 : to64(cl_hdr);
4306      conn->mg_conn.content_len = (size_t) conn->cl;
4307    }
4308  }
4291   if (conn->request_len == 0 &&
4292      (conn->request_len = get_request_len(io->buf, io->len)) > 0) {
4293   // If request is buffered in, remove it from the iobuf. This is because
4294   // iobuf could be reallocated, and pointers in parsed request could
4295   // become invalid.
4296   conn->request = (char *) malloc(conn->request_len);
4297   memcpy(conn->request, io->buf, conn->request_len);
4298   //DBG(("%p [%.*s]", conn, conn->request_len, conn->request));
4299   iobuf_remove(io, conn->request_len);
4300   conn->request_len = parse_http_message(conn->request, conn->request_len,
4301                                 &conn->mg_conn);
4302   if (conn->request_len > 0) {
4303      const char *cl_hdr = mg_get_header(&conn->mg_conn, "Content-Length");
4304      conn->cl = cl_hdr == NULL ? 0 : to64(cl_hdr);
4305      conn->mg_conn.content_len = (size_t) conn->cl;
4306   }
4307   }
43094308}
43104309
43114310static void do_proxy(struct connection *conn) {
4312  if (conn->request_len == 0) {
4313    try_parse(conn);
4314    DBG(("%p parsing -> %d", conn, conn->request_len));
4315    if (conn->request_len > 0 && call_user(conn, MG_REQUEST) == MG_FALSE) {
4316      proxy_request(conn->endpoint.nc, &conn->mg_conn);
4317    } else if (conn->request_len < 0) {
4318      ns_forward(conn->ns_conn, conn->endpoint.nc);
4319    }
4320  } else {
4321    DBG(("%p forwarding", conn));
4322    ns_forward(conn->ns_conn, conn->endpoint.nc);
4323  }
4311   if (conn->request_len == 0) {
4312   try_parse(conn);
4313   DBG(("%p parsing -> %d", conn, conn->request_len));
4314   if (conn->request_len > 0 && call_user(conn, MG_REQUEST) == MG_FALSE) {
4315      proxy_request(conn->endpoint.nc, &conn->mg_conn);
4316   } else if (conn->request_len < 0) {
4317      ns_forward(conn->ns_conn, conn->endpoint.nc);
4318   }
4319   } else {
4320   DBG(("%p forwarding", conn));
4321   ns_forward(conn->ns_conn, conn->endpoint.nc);
4322   }
43244323}
43254324
43264325static void on_recv_data(struct connection *conn) {
4327  struct iobuf *io = &conn->ns_conn->recv_iobuf;
4326   struct iobuf *io = &conn->ns_conn->recv_iobuf;
43284327
4329  if (conn->endpoint_type == EP_PROXY && conn->endpoint.nc != NULL) {
4330    do_proxy(conn);
4331    return;
4332  }
4328   if (conn->endpoint_type == EP_PROXY && conn->endpoint.nc != NULL) {
4329   do_proxy(conn);
4330   return;
4331   }
43334332
4334  try_parse(conn);
4335  DBG(("%p %d %zu %d", conn, conn->request_len, io->len, conn->ns_conn->flags));
4336  if (conn->request_len < 0 ||
4337      (conn->request_len > 0 && !is_valid_uri(conn->mg_conn.uri))) {
4338    send_http_error(conn, 400, NULL);
4339  } else if (conn->request_len == 0 && io->len > MAX_REQUEST_SIZE) {
4340    send_http_error(conn, 413, NULL);
4341  } else if (conn->request_len > 0 &&
4342             strcmp(conn->mg_conn.http_version, "1.0") != 0 &&
4343             strcmp(conn->mg_conn.http_version, "1.1") != 0) {
4344    send_http_error(conn, 505, NULL);
4345  } else if (conn->request_len > 0 && conn->endpoint_type == EP_NONE) {
4333   try_parse(conn);
4334   DBG(("%p %d %zu %d", conn, conn->request_len, io->len, conn->ns_conn->flags));
4335   if (conn->request_len < 0 ||
4336      (conn->request_len > 0 && !is_valid_uri(conn->mg_conn.uri))) {
4337   send_http_error(conn, 400, NULL);
4338   } else if (conn->request_len == 0 && io->len > MAX_REQUEST_SIZE) {
4339   send_http_error(conn, 413, NULL);
4340   } else if (conn->request_len > 0 &&
4341            strcmp(conn->mg_conn.http_version, "1.0") != 0 &&
4342            strcmp(conn->mg_conn.http_version, "1.1") != 0) {
4343   send_http_error(conn, 505, NULL);
4344   } else if (conn->request_len > 0 && conn->endpoint_type == EP_NONE) {
43464345#ifndef MONGOOSE_NO_WEBSOCKET
4347    send_websocket_handshake_if_requested(&conn->mg_conn);
4346   send_websocket_handshake_if_requested(&conn->mg_conn);
43484347#endif
4349    send_continue_if_expected(conn);
4350    open_local_endpoint(conn, 0);
4351  }
4348   send_continue_if_expected(conn);
4349   open_local_endpoint(conn, 0);
4350   }
43524351
43534352#ifndef MONGOOSE_NO_CGI
4354  if (conn->endpoint_type == EP_CGI && conn->endpoint.nc != NULL) {
4355    ns_forward(conn->ns_conn, conn->endpoint.nc);
4356  }
4353   if (conn->endpoint_type == EP_CGI && conn->endpoint.nc != NULL) {
4354   ns_forward(conn->ns_conn, conn->endpoint.nc);
4355   }
43574356#endif
4358  if (conn->endpoint_type == EP_USER) {
4359    call_request_handler_if_data_is_buffered(conn);
4360  }
4357   if (conn->endpoint_type == EP_USER) {
4358   call_request_handler_if_data_is_buffered(conn);
4359   }
43614360#ifndef MONGOOSE_NO_DAV
4362  if (conn->endpoint_type == EP_PUT && io->len > 0) {
4363    forward_put_data(conn);
4364  }
4361   if (conn->endpoint_type == EP_PUT && io->len > 0) {
4362   forward_put_data(conn);
4363   }
43654364#endif
43664365}
43674366
43684367static void call_http_client_handler(struct connection *conn) {
4369  //conn->mg_conn.status_code = code;
4370  // For responses without Content-Lengh, use the whole buffer
4371  if (conn->cl == 0) {
4372    conn->mg_conn.content_len = conn->ns_conn->recv_iobuf.len;
4373  }
4374  conn->mg_conn.content = conn->ns_conn->recv_iobuf.buf;
4375  if (call_user(conn, MG_REPLY) == MG_FALSE) {
4376    conn->ns_conn->flags |= NSF_CLOSE_IMMEDIATELY;
4377  }
4378  iobuf_remove(&conn->ns_conn->recv_iobuf, conn->mg_conn.content_len);
4379  conn->mg_conn.status_code = 0;
4380  conn->cl = conn->num_bytes_sent = conn->request_len = 0;
4381  free(conn->request);
4382  conn->request = NULL;
4368   //conn->mg_conn.status_code = code;
4369   // For responses without Content-Lengh, use the whole buffer
4370   if (conn->cl == 0) {
4371   conn->mg_conn.content_len = conn->ns_conn->recv_iobuf.len;
4372   }
4373   conn->mg_conn.content = conn->ns_conn->recv_iobuf.buf;
4374   if (call_user(conn, MG_REPLY) == MG_FALSE) {
4375   conn->ns_conn->flags |= NSF_CLOSE_IMMEDIATELY;
4376   }
4377   iobuf_remove(&conn->ns_conn->recv_iobuf, conn->mg_conn.content_len);
4378   conn->mg_conn.status_code = 0;
4379   conn->cl = conn->num_bytes_sent = conn->request_len = 0;
4380   free(conn->request);
4381   conn->request = NULL;
43834382}
43844383
43854384static void process_response(struct connection *conn) {
4386  struct iobuf *io = &conn->ns_conn->recv_iobuf;
4385   struct iobuf *io = &conn->ns_conn->recv_iobuf;
43874386
4388  try_parse(conn);
4389  DBG(("%p %d %zu", conn, conn->request_len, io->len));
4390  if (conn->request_len < 0 ||
4391      (conn->request_len == 0 && io->len > MAX_REQUEST_SIZE)) {
4392    call_http_client_handler(conn);
4393  } else if ((int64_t) io->len >= conn->cl) {
4394    call_http_client_handler(conn);
4395  }
4387   try_parse(conn);
4388   DBG(("%p %d %zu", conn, conn->request_len, io->len));
4389   if (conn->request_len < 0 ||
4390      (conn->request_len == 0 && io->len > MAX_REQUEST_SIZE)) {
4391   call_http_client_handler(conn);
4392   } else if ((int64_t) io->len >= conn->cl) {
4393   call_http_client_handler(conn);
4394   }
43964395}
43974396
43984397struct mg_connection *mg_connect(struct mg_server *server, const char *host,
4399                                 int port, int use_ssl) {
4400  struct ns_connection *nsconn;
4401  struct connection *conn;
4398                           int port, int use_ssl) {
4399   struct ns_connection *nsconn;
4400   struct connection *conn;
44024401
4403  nsconn = ns_connect(&server->ns_server, host, port, use_ssl, NULL);
4404  if (nsconn == NULL) return 0;
4402   nsconn = ns_connect(&server->ns_server, host, port, use_ssl, NULL);
4403   if (nsconn == NULL) return 0;
44054404
4406  if ((conn = (struct connection *) calloc(1, sizeof(*conn))) == NULL) {
4407    nsconn->flags |= NSF_CLOSE_IMMEDIATELY;
4408    return 0;
4409  }
4405   if ((conn = (struct connection *) calloc(1, sizeof(*conn))) == NULL) {
4406   nsconn->flags |= NSF_CLOSE_IMMEDIATELY;
4407   return 0;
4408   }
44104409
4411  // Interlink two structs
4412  conn->ns_conn = nsconn;
4413  nsconn->connection_data = conn;
4410   // Interlink two structs
4411   conn->ns_conn = nsconn;
4412   nsconn->connection_data = conn;
44144413
4415  conn->server = server;
4416  conn->endpoint_type = EP_CLIENT;
4417  //conn->handler = handler;
4418  conn->mg_conn.server_param = server->ns_server.server_data;
4419  conn->ns_conn->flags = NSF_CONNECTING;
4414   conn->server = server;
4415   conn->endpoint_type = EP_CLIENT;
4416   //conn->handler = handler;
4417   conn->mg_conn.server_param = server->ns_server.server_data;
4418   conn->ns_conn->flags = NSF_CONNECTING;
44204419
4421  return &conn->mg_conn;
4420   return &conn->mg_conn;
44224421}
44234422
44244423#ifndef MONGOOSE_NO_LOGGING
44254424static void log_header(const struct mg_connection *conn, const char *header,
4426                       FILE *fp) {
4427  const char *header_value;
4425                  FILE *fp) {
4426   const char *header_value;
44284427
4429  if ((header_value = mg_get_header(conn, header)) == NULL) {
4430    (void) fprintf(fp, "%s", " -");
4431  } else {
4432    (void) fprintf(fp, " \"%s\"", header_value);
4433  }
4428   if ((header_value = mg_get_header(conn, header)) == NULL) {
4429   (void) fprintf(fp, "%s", " -");
4430   } else {
4431   (void) fprintf(fp, " \"%s\"", header_value);
4432   }
44344433}
44354434
44364435static void log_access(const struct connection *conn, const char *path) {
4437  const struct mg_connection *c = &conn->mg_conn;
4438  FILE *fp = (path == NULL) ?  NULL : fopen(path, "a+");
4439  char date[64], user[100];
4440  time_t now;
4436   const struct mg_connection *c = &conn->mg_conn;
4437   FILE *fp = (path == NULL) ?  NULL : fopen(path, "a+");
4438   char date[64], user[100];
4439   time_t now;
44414440
4442  if (fp == NULL) return;
4443  now = time(NULL);
4444  strftime(date, sizeof(date), "%d/%b/%Y:%H:%M:%S %z", localtime(&now));
4441   if (fp == NULL) return;
4442   now = time(NULL);
4443   strftime(date, sizeof(date), "%d/%b/%Y:%H:%M:%S %z", localtime(&now));
44454444
4446  flockfile(fp);
4447  mg_parse_header(mg_get_header(&conn->mg_conn, "Authorization"), "username",
4448                  user, sizeof(user));
4449  fprintf(fp, "%s - %s [%s] \"%s %s%s%s HTTP/%s\" %d %" INT64_FMT,
4450          c->remote_ip, user[0] == '\0' ? "-" : user, date,
4451          c->request_method ? c->request_method : "-",
4452          c->uri ? c->uri : "-", c->query_string ? "?" : "",
4453          c->query_string ? c->query_string : "",
4454          c->http_version, c->status_code, conn->num_bytes_sent);
4455  log_header(c, "Referer", fp);
4456  log_header(c, "User-Agent", fp);
4457  fputc('\n', fp);
4458  fflush(fp);
4445   flockfile(fp);
4446   mg_parse_header(mg_get_header(&conn->mg_conn, "Authorization"), "username",
4447               user, sizeof(user));
4448   fprintf(fp, "%s - %s [%s] \"%s %s%s%s HTTP/%s\" %d %" INT64_FMT,
4449         c->remote_ip, user[0] == '\0' ? "-" : user, date,
4450         c->request_method ? c->request_method : "-",
4451         c->uri ? c->uri : "-", c->query_string ? "?" : "",
4452         c->query_string ? c->query_string : "",
4453         c->http_version, c->status_code, conn->num_bytes_sent);
4454   log_header(c, "Referer", fp);
4455   log_header(c, "User-Agent", fp);
4456   fputc('\n', fp);
4457   fflush(fp);
44594458
4460  funlockfile(fp);
4461  fclose(fp);
4459   funlockfile(fp);
4460   fclose(fp);
44624461}
44634462#endif
44644463
44654464static void close_local_endpoint(struct connection *conn) {
4466  struct mg_connection *c = &conn->mg_conn;
4467  // Must be done before free()
4468  int keep_alive = should_keep_alive(&conn->mg_conn) &&
4469    (conn->endpoint_type == EP_FILE || conn->endpoint_type == EP_USER);
4470  DBG(("%p %d %d %d", conn, conn->endpoint_type, keep_alive,
4471       conn->ns_conn->flags));
4465   struct mg_connection *c = &conn->mg_conn;
4466   // Must be done before free()
4467   int keep_alive = should_keep_alive(&conn->mg_conn) &&
4468   (conn->endpoint_type == EP_FILE || conn->endpoint_type == EP_USER);
4469   DBG(("%p %d %d %d", conn, conn->endpoint_type, keep_alive,
4470      conn->ns_conn->flags));
44724471
4473  switch (conn->endpoint_type) {
4474    case EP_PUT:
4475    case EP_FILE:
4476      close(conn->endpoint.fd);
4477      break;
4478    case EP_CGI:
4479    case EP_PROXY:
4480      if (conn->endpoint.nc != NULL) {
4481        DBG(("%p %p %p :-)", conn, conn->ns_conn, conn->endpoint.nc));
4482        conn->endpoint.nc->flags |= NSF_CLOSE_IMMEDIATELY;
4483        conn->endpoint.nc->connection_data = NULL;
4484      }
4485      break;
4486    default: break;
4487  }
4472   switch (conn->endpoint_type) {
4473   case EP_PUT:
4474   case EP_FILE:
4475      close(conn->endpoint.fd);
4476      break;
4477   case EP_CGI:
4478   case EP_PROXY:
4479      if (conn->endpoint.nc != NULL) {
4480      DBG(("%p %p %p :-)", conn, conn->ns_conn, conn->endpoint.nc));
4481      conn->endpoint.nc->flags |= NSF_CLOSE_IMMEDIATELY;
4482      conn->endpoint.nc->connection_data = NULL;
4483      }
4484      break;
4485   default: break;
4486   }
44884487
44894488#ifndef MONGOOSE_NO_LOGGING
4490  if (c->status_code > 0 && conn->endpoint_type != EP_CLIENT &&
4491      c->status_code != 400) {
4492    log_access(conn, conn->server->config_options[ACCESS_LOG_FILE]);
4493  }
4489   if (c->status_code > 0 && conn->endpoint_type != EP_CLIENT &&
4490      c->status_code != 400) {
4491   log_access(conn, conn->server->config_options[ACCESS_LOG_FILE]);
4492   }
44944493#endif
44954494
4496  // Gobble possible POST data sent to the URI handler
4497  iobuf_free(&conn->ns_conn->recv_iobuf);
4498  free(conn->request);
4499  free(conn->path_info);
4495   // Gobble possible POST data sent to the URI handler
4496   iobuf_free(&conn->ns_conn->recv_iobuf);
4497   free(conn->request);
4498   free(conn->path_info);
45004499
4501  conn->endpoint_type = EP_NONE;
4502  conn->cl = conn->num_bytes_sent = conn->request_len = 0;
4503  conn->ns_conn->flags &= ~(NSF_FINISHED_SENDING_DATA |
4504                            NSF_BUFFER_BUT_DONT_SEND | NSF_CLOSE_IMMEDIATELY |
4505                            MG_HEADERS_SENT | MG_LONG_RUNNING);
4506  c->num_headers = c->status_code = c->is_websocket = c->content_len = 0;
4507  conn->endpoint.nc = NULL;
4508  c->request_method = c->uri = c->http_version = c->query_string = NULL;
4509  conn->request = conn->path_info = NULL;
4500   conn->endpoint_type = EP_NONE;
4501   conn->cl = conn->num_bytes_sent = conn->request_len = 0;
4502   conn->ns_conn->flags &= ~(NSF_FINISHED_SENDING_DATA |
4503                     NSF_BUFFER_BUT_DONT_SEND | NSF_CLOSE_IMMEDIATELY |
4504                     MG_HEADERS_SENT | MG_LONG_RUNNING);
4505   c->num_headers = c->status_code = c->is_websocket = c->content_len = 0;
4506   conn->endpoint.nc = NULL;
4507   c->request_method = c->uri = c->http_version = c->query_string = NULL;
4508   conn->request = conn->path_info = NULL;
45104509
4511  if (keep_alive) {
4512    on_recv_data(conn);  // Can call us recursively if pipelining is used
4513  } else {
4514    conn->ns_conn->flags |= conn->ns_conn->send_iobuf.len == 0 ?
4515      NSF_CLOSE_IMMEDIATELY : NSF_FINISHED_SENDING_DATA;
4516  }
4510   if (keep_alive) {
4511   on_recv_data(conn);  // Can call us recursively if pipelining is used
4512   } else {
4513   conn->ns_conn->flags |= conn->ns_conn->send_iobuf.len == 0 ?
4514      NSF_CLOSE_IMMEDIATELY : NSF_FINISHED_SENDING_DATA;
4515   }
45174516}
45184517
45194518static void transfer_file_data(struct connection *conn) {
4520  char buf[IOBUF_SIZE];
4521  int n;
4519   char buf[IOBUF_SIZE];
4520   int n;
45224521
4523  // If output buffer is too big, don't send anything. Wait until
4524  // mongoose drains already buffered data to the client.
4525  if (conn->ns_conn->send_iobuf.len > sizeof(buf) * 2) return;
4522   // If output buffer is too big, don't send anything. Wait until
4523   // mongoose drains already buffered data to the client.
4524   if (conn->ns_conn->send_iobuf.len > sizeof(buf) * 2) return;
45264525
4527  // Do not send anyt
4528  n = read(conn->endpoint.fd, buf, conn->cl < (int64_t) sizeof(buf) ?
4529           (int) conn->cl : (int) sizeof(buf));
4526   // Do not send anyt
4527   n = read(conn->endpoint.fd, buf, conn->cl < (int64_t) sizeof(buf) ?
4528         (int) conn->cl : (int) sizeof(buf));
45304529
4531  if (n <= 0) {
4532    close_local_endpoint(conn);
4533  } else if (n > 0) {
4534    conn->cl -= n;
4535    ns_send(conn->ns_conn, buf, n);
4536    if (conn->cl <= 0) {
4537      close_local_endpoint(conn);
4538    }
4539  }
4530   if (n <= 0) {
4531   close_local_endpoint(conn);
4532   } else if (n > 0) {
4533   conn->cl -= n;
4534   ns_send(conn->ns_conn, buf, n);
4535   if (conn->cl <= 0) {
4536      close_local_endpoint(conn);
4537   }
4538   }
45404539}
45414540
45424541int mg_poll_server(struct mg_server *server, int milliseconds) {
4543  return ns_server_poll(&server->ns_server, milliseconds);
4542   return ns_server_poll(&server->ns_server, milliseconds);
45444543}
45454544
45464545void mg_destroy_server(struct mg_server **server) {
4547  if (server != NULL && *server != NULL) {
4548    struct mg_server *s = *server;
4549    int i;
4546   if (server != NULL && *server != NULL) {
4547   struct mg_server *s = *server;
4548   int i;
45504549
4551    ns_server_free(&s->ns_server);
4552    for (i = 0; i < (int) ARRAY_SIZE(s->config_options); i++) {
4553      free(s->config_options[i]);  // It is OK to free(NULL)
4554    }
4555    free(s);
4556    *server = NULL;
4557  }
4550   ns_server_free(&s->ns_server);
4551   for (i = 0; i < (int) ARRAY_SIZE(s->config_options); i++) {
4552      free(s->config_options[i]);  // It is OK to free(NULL)
4553   }
4554   free(s);
4555   *server = NULL;
4556   }
45584557}
45594558
45604559struct mg_iterator {
4561  mg_handler_t cb;
4562  void *param;
4560   mg_handler_t cb;
4561   void *param;
45634562};
45644563
45654564static void iter(struct ns_connection *nsconn, enum ns_event ev, void *param) {
4566  if (ev == NS_POLL) {
4567    struct mg_iterator *it = (struct mg_iterator *) param;
4568    struct connection *c = (struct connection *) nsconn->connection_data;
4569    if (c != NULL) c->mg_conn.callback_param = it->param;
4570    it->cb(&c->mg_conn, MG_POLL);
4571  }
4565   if (ev == NS_POLL) {
4566   struct mg_iterator *it = (struct mg_iterator *) param;
4567   struct connection *c = (struct connection *) nsconn->connection_data;
4568   if (c != NULL) c->mg_conn.callback_param = it->param;
4569   it->cb(&c->mg_conn, MG_POLL);
4570   }
45724571}
45734572
45744573struct mg_connection *mg_next(struct mg_server *s, struct mg_connection *c) {
4575  struct connection *conn = MG_CONN_2_CONN(c);
4576  struct ns_connection *nc = ns_next(&s->ns_server,
4577                                     c == NULL ? NULL : conn->ns_conn);
4578   
4579  return nc == NULL ? NULL :
4580    & ((struct connection *) nc->connection_data)->mg_conn;
4574   struct connection *conn = MG_CONN_2_CONN(c);
4575   struct ns_connection *nc = ns_next(&s->ns_server,
4576                              c == NULL ? NULL : conn->ns_conn);
4577
4578   return nc == NULL ? NULL :
4579   & ((struct connection *) nc->connection_data)->mg_conn;
45814580}
45824581
45834582// Apply function to all active connections.
45844583void mg_iterate_over_connections(struct mg_server *server, mg_handler_t cb,
4585  void *param) {
4586  struct mg_iterator it = { cb, param };
4587  ns_iterate(&server->ns_server, iter, &it);
4584   void *param) {
4585   struct mg_iterator it = { cb, param };
4586   ns_iterate(&server->ns_server, iter, &it);
45884587}
45894588
45904589static int get_var(const char *data, size_t data_len, const char *name,
4591                   char *dst, size_t dst_len) {
4592  const char *p, *e, *s;
4593  size_t name_len;
4594  int len;
4590               char *dst, size_t dst_len) {
4591   const char *p, *e, *s;
4592   size_t name_len;
4593   int len;
45954594
4596  if (dst == NULL || dst_len == 0) {
4597    len = -2;
4598  } else if (data == NULL || name == NULL || data_len == 0) {
4599    len = -1;
4600    dst[0] = '\0';
4601  } else {
4602    name_len = strlen(name);
4603    e = data + data_len;
4604    len = -1;
4605    dst[0] = '\0';
4595   if (dst == NULL || dst_len == 0) {
4596   len = -2;
4597   } else if (data == NULL || name == NULL || data_len == 0) {
4598   len = -1;
4599   dst[0] = '\0';
4600   } else {
4601   name_len = strlen(name);
4602   e = data + data_len;
4603   len = -1;
4604   dst[0] = '\0';
46064605
4607    // data is "var1=val1&var2=val2...". Find variable first
4608    for (p = data; p + name_len < e; p++) {
4609      if ((p == data || p[-1] == '&') && p[name_len] == '=' &&
4610          !mg_strncasecmp(name, p, name_len)) {
4606   // data is "var1=val1&var2=val2...". Find variable first
4607   for (p = data; p + name_len < e; p++) {
4608      if ((p == data || p[-1] == '&') && p[name_len] == '=' &&
4609         !mg_strncasecmp(name, p, name_len)) {
4610      // Point p to variable value
4611      p += name_len + 1;
46114612
4612        // Point p to variable value
4613        p += name_len + 1;
4613      // Point s to the end of the value
4614      s = (const char *) memchr(p, '&', (size_t)(e - p));
4615      if (s == NULL) {
4616         s = e;
4617      }
4618      assert(s >= p);
46144619
4615        // Point s to the end of the value
4616        s = (const char *) memchr(p, '&', (size_t)(e - p));
4617        if (s == NULL) {
4618          s = e;
4619        }
4620        assert(s >= p);
4620      // Decode variable into destination buffer
4621      len = mg_url_decode(p, (size_t)(s - p), dst, dst_len, 1);
46214622
4622        // Decode variable into destination buffer
4623        len = mg_url_decode(p, (size_t)(s - p), dst, dst_len, 1);
4623      // Redirect error code from -1 to -2 (destination buffer too small).
4624      if (len == -1) {
4625         len = -2;
4626      }
4627      break;
4628      }
4629   }
4630   }
46244631
4625        // Redirect error code from -1 to -2 (destination buffer too small).
4626        if (len == -1) {
4627          len = -2;
4628        }
4629        break;
4630      }
4631    }
4632  }
4633
4634  return len;
4632   return len;
46354633}
46364634
46374635int mg_get_var(const struct mg_connection *conn, const char *name,
4638               char *dst, size_t dst_len) {
4639  int len = get_var(conn->query_string, conn->query_string == NULL ? 0 :
4640                    strlen(conn->query_string), name, dst, dst_len);
4641  if (len < 0) {
4642    len = get_var(conn->content, conn->content_len, name, dst, dst_len);
4643  }
4644  return len;
4636            char *dst, size_t dst_len) {
4637   int len = get_var(conn->query_string, conn->query_string == NULL ? 0 :
4638               strlen(conn->query_string), name, dst, dst_len);
4639   if (len < 0) {
4640   len = get_var(conn->content, conn->content_len, name, dst, dst_len);
4641   }
4642   return len;
46454643}
46464644
46474645static int get_line_len(const char *buf, int buf_len) {
4648  int len = 0;
4649  while (len < buf_len && buf[len] != '\n') len++;
4650  return buf[len] == '\n' ? len + 1: -1;
4646   int len = 0;
4647   while (len < buf_len && buf[len] != '\n') len++;
4648   return buf[len] == '\n' ? len + 1: -1;
46514649}
46524650
46534651int mg_parse_multipart(const char *buf, int buf_len,
4654                       char *var_name, int var_name_len,
4655                       char *file_name, int file_name_len,
4656                       const char **data, int *data_len) {
4657  static const char cd[] = "Content-Disposition: ";
4658  //struct mg_connection c;
4659  int hl, bl, n, ll, pos, cdl = sizeof(cd) - 1;
4660  //char *p;
4652                  char *var_name, int var_name_len,
4653                  char *file_name, int file_name_len,
4654                  const char **data, int *data_len) {
4655   static const char cd[] = "Content-Disposition: ";
4656   //struct mg_connection c;
4657   int hl, bl, n, ll, pos, cdl = sizeof(cd) - 1;
4658   //char *p;
46614659
4662  if (buf == NULL || buf_len <= 0) return 0;
4663  if ((hl = get_request_len(buf, buf_len)) <= 0) return 0;
4664  if (buf[0] != '-' || buf[1] != '-' || buf[2] == '\n') return 0;
4660   if (buf == NULL || buf_len <= 0) return 0;
4661   if ((hl = get_request_len(buf, buf_len)) <= 0) return 0;
4662   if (buf[0] != '-' || buf[1] != '-' || buf[2] == '\n') return 0;
46654663
4666  // Get boundary length
4667  bl = get_line_len(buf, buf_len);
4664   // Get boundary length
4665   bl = get_line_len(buf, buf_len);
46684666
4669  // Loop through headers, fetch variable name and file name
4670  var_name[0] = file_name[0] = '\0';
4671  for (n = bl; (ll = get_line_len(buf + n, hl - n)) > 0; n += ll) {
4672    if (mg_strncasecmp(cd, buf + n, cdl) == 0) {
4673      parse_header(buf + n + cdl, ll - (cdl + 2), "name",
4674                   var_name, var_name_len);
4675      parse_header(buf + n + cdl, ll - (cdl + 2), "filename",
4676                   file_name, file_name_len);
4677    }
4678  }
4667   // Loop through headers, fetch variable name and file name
4668   var_name[0] = file_name[0] = '\0';
4669   for (n = bl; (ll = get_line_len(buf + n, hl - n)) > 0; n += ll) {
4670   if (mg_strncasecmp(cd, buf + n, cdl) == 0) {
4671      parse_header(buf + n + cdl, ll - (cdl + 2), "name",
4672               var_name, var_name_len);
4673      parse_header(buf + n + cdl, ll - (cdl + 2), "filename",
4674               file_name, file_name_len);
4675   }
4676   }
46794677
4680  // Scan body, search for terminating boundary
4681  for (pos = hl; pos + (bl - 2) < buf_len; pos++) {
4682    if (buf[pos] == '-' && !memcmp(buf, &buf[pos], bl - 2)) {
4683      if (data_len != NULL) *data_len = (pos - 2) - hl;
4684      if (data != NULL) *data = buf + hl;
4685      return pos;
4686    }
4687  }
4678   // Scan body, search for terminating boundary
4679   for (pos = hl; pos + (bl - 2) < buf_len; pos++) {
4680   if (buf[pos] == '-' && !memcmp(buf, &buf[pos], bl - 2)) {
4681      if (data_len != NULL) *data_len = (pos - 2) - hl;
4682      if (data != NULL) *data = buf + hl;
4683      return pos;
4684   }
4685   }
46884686
4689  return 0;
4687   return 0;
46904688}
46914689
46924690const char **mg_get_valid_option_names(void) {
4693  return static_config_options;
4691   return static_config_options;
46944692}
46954693
46964694static int get_option_index(const char *name) {
4697  int i;
4695   int i;
46984696
4699  for (i = 0; static_config_options[i * 2] != NULL; i++) {
4700    if (strcmp(static_config_options[i * 2], name) == 0) {
4701      return i;
4702    }
4703  }
4704  return -1;
4697   for (i = 0; static_config_options[i * 2] != NULL; i++) {
4698   if (strcmp(static_config_options[i * 2], name) == 0) {
4699      return i;
4700   }
4701   }
4702   return -1;
47054703}
47064704
47074705static void set_default_option_values(char **opts) {
4708  const char *value, **all_opts = mg_get_valid_option_names();
4709  int i;
4706   const char *value, **all_opts = mg_get_valid_option_names();
4707   int i;
47104708
4711  for (i = 0; all_opts[i * 2] != NULL; i++) {
4712    value = all_opts[i * 2 + 1];
4713    if (opts[i] == NULL && value != NULL) {
4714      opts[i] = mg_strdup(value);
4715    }
4716  }
4709   for (i = 0; all_opts[i * 2] != NULL; i++) {
4710   value = all_opts[i * 2 + 1];
4711   if (opts[i] == NULL && value != NULL) {
4712      opts[i] = mg_strdup(value);
4713   }
4714   }
47174715}
47184716
47194717const char *mg_set_option(struct mg_server *server, const char *name,
4720                          const char *value) {
4721  int ind = get_option_index(name);
4722  const char *error_msg = NULL;
4723  char **v = NULL;
4718                     const char *value) {
4719   int ind = get_option_index(name);
4720   const char *error_msg = NULL;
4721   char **v = NULL;
47244722
4725  if (ind < 0) return  "No such option";
4726  v = &server->config_options[ind];
4723   if (ind < 0) return  "No such option";
4724   v = &server->config_options[ind];
47274725
4728  // Return success immediately if setting to the same value
4729  if ((*v == NULL && value == NULL) ||
4730      (value != NULL && *v != NULL && !strcmp(value, *v))) {
4731    return NULL;
4732  }
4726   // Return success immediately if setting to the same value
4727   if ((*v == NULL && value == NULL) ||
4728      (value != NULL && *v != NULL && !strcmp(value, *v))) {
4729   return NULL;
4730   }
47334731
4734  if (*v != NULL) {
4735    free(*v);
4736    *v = NULL;
4737  }
4732   if (*v != NULL) {
4733   free(*v);
4734   *v = NULL;
4735   }
47384736
4739  if (value == NULL || value[0] == '\0') return NULL;
4737   if (value == NULL || value[0] == '\0') return NULL;
47404738
4741  *v = mg_strdup(value);
4742  DBG(("%s [%s]", name, *v));
4739   *v = mg_strdup(value);
4740   DBG(("%s [%s]", name, *v));
47434741
4744  if (ind == LISTENING_PORT) {
4745    int port = ns_bind(&server->ns_server, value);
4746    if (port < 0) {
4747      error_msg = "Cannot bind to port";
4748    } else {
4749      char buf[100];
4750      ns_sock_to_str(server->ns_server.listening_sock, buf, sizeof(buf), 2);
4751      free(*v);
4752      *v = mg_strdup(buf);
4753    }
4742   if (ind == LISTENING_PORT) {
4743   int port = ns_bind(&server->ns_server, value);
4744   if (port < 0) {
4745      error_msg = "Cannot bind to port";
4746   } else {
4747      char buf[100];
4748      ns_sock_to_str(server->ns_server.listening_sock, buf, sizeof(buf), 2);
4749      free(*v);
4750      *v = mg_strdup(buf);
4751   }
47544752#ifndef _WIN32
4755  } else if (ind == RUN_AS_USER) {
4756    struct passwd *pw;
4757    if ((pw = getpwnam(value)) == NULL) {
4758      error_msg = "Unknown user";
4759    } else if (setgid(pw->pw_gid) != 0) {
4760      error_msg = "setgid() failed";
4761    } else if (setuid(pw->pw_uid) != 0) {
4762      error_msg = "setuid() failed";
4763    }
4753   } else if (ind == RUN_AS_USER) {
4754   struct passwd *pw;
4755   if ((pw = getpwnam(value)) == NULL) {
4756      error_msg = "Unknown user";
4757   } else if (setgid(pw->pw_gid) != 0) {
4758      error_msg = "setgid() failed";
4759   } else if (setuid(pw->pw_uid) != 0) {
4760      error_msg = "setuid() failed";
4761   }
47644762#endif
47654763#ifdef NS_ENABLE_SSL
4766  } else if (ind == SSL_CERTIFICATE) {
4767    int res = ns_set_ssl_cert(&server->ns_server, value);
4768    if (res == -2) {
4769      error_msg = "Cannot load PEM";
4770    } else if (res == -3) {
4771      error_msg = "SSL not enabled";
4772    } else if (res == -1) {
4773      error_msg = "SSL_CTX_new() failed";
4774    }
4775  } else if (ind == SSL_CA_CERTIFICATE) {
4776    if (ns_set_ssl_ca_cert(&server->ns_server, value) != 0) {
4777       error_msg = "Error setting CA cert";
4778     }
4764   } else if (ind == SSL_CERTIFICATE) {
4765   int res = ns_set_ssl_cert(&server->ns_server, value);
4766   if (res == -2) {
4767      error_msg = "Cannot load PEM";
4768   } else if (res == -3) {
4769      error_msg = "SSL not enabled";
4770   } else if (res == -1) {
4771      error_msg = "SSL_CTX_new() failed";
4772   }
4773   } else if (ind == SSL_CA_CERTIFICATE) {
4774   if (ns_set_ssl_ca_cert(&server->ns_server, value) != 0) {
4775      error_msg = "Error setting CA cert";
4776      }
47794777#endif
4780  }
4778   }
47814779
4782  return error_msg;
4780   return error_msg;
47834781}
47844782
47854783static void set_ips(struct ns_connection *nc, int is_rem) {
4786  struct connection *conn = (struct connection *) nc->connection_data;
4787  struct mg_connection *c = &conn->mg_conn;
4788  char buf[100];
4784   struct connection *conn = (struct connection *) nc->connection_data;
4785   struct mg_connection *c = &conn->mg_conn;
4786   char buf[100];
47894787
4790  ns_sock_to_str(nc->sock, buf, sizeof(buf), is_rem ? 7 : 3);
4791  sscanf(buf, "%47[^:]:%hu",
4792         is_rem ? c->remote_ip : c->local_ip,
4793         is_rem ? &c->remote_port : &c->local_port);
4794  //DBG(("%p %s %s", conn, is_rem ? "rem" : "loc", buf));
4788   ns_sock_to_str(nc->sock, buf, sizeof(buf), is_rem ? 7 : 3);
4789   sscanf(buf, "%47[^:]:%hu",
4790         is_rem ? c->remote_ip : c->local_ip,
4791         is_rem ? &c->remote_port : &c->local_port);
4792   //DBG(("%p %s %s", conn, is_rem ? "rem" : "loc", buf));
47954793}
47964794
47974795static void on_accept(struct ns_connection *nc, union socket_address *sa) {
4798  struct mg_server *server = (struct mg_server *) nc->server;
4799  struct connection *conn;
4796   struct mg_server *server = (struct mg_server *) nc->server;
4797   struct connection *conn;
48004798
4801  if (!check_acl(server->config_options[ACCESS_CONTROL_LIST],
4802                 ntohl(* (uint32_t *) &sa->sin.sin_addr)) ||
4803      (conn = (struct connection *) calloc(1, sizeof(*conn))) == NULL) {
4804    nc->flags |= NSF_CLOSE_IMMEDIATELY;
4805  } else {
4806    // Circularly link two connection structures
4807    nc->connection_data = conn;
4808    conn->ns_conn = nc;
4799   if (!check_acl(server->config_options[ACCESS_CONTROL_LIST],
4800               ntohl(* (uint32_t *) &sa->sin.sin_addr)) ||
4801      (conn = (struct connection *) calloc(1, sizeof(*conn))) == NULL) {
4802   nc->flags |= NSF_CLOSE_IMMEDIATELY;
4803   } else {
4804   // Circularly link two connection structures
4805   nc->connection_data = conn;
4806   conn->ns_conn = nc;
48094807
4810    // Initialize the rest of connection attributes
4811    conn->server = server;
4812    conn->mg_conn.server_param = nc->server->server_data;
4813    set_ips(nc, 1);
4814    set_ips(nc, 0);
4815  }
4808   // Initialize the rest of connection attributes
4809   conn->server = server;
4810   conn->mg_conn.server_param = nc->server->server_data;
4811   set_ips(nc, 1);
4812   set_ips(nc, 0);
4813   }
48164814}
48174815
48184816#ifndef MONGOOSE_NO_FILESYSTEM
48194817static void hexdump(struct ns_connection *nc, const char *path,
4820                    int num_bytes, int is_sent) {
4821  const struct iobuf *io = is_sent ? &nc->send_iobuf : &nc->recv_iobuf;
4822  FILE *fp;
4823  char *buf, src[60], dst[60];
4824  int buf_size = num_bytes * 5 + 100;
4818               int num_bytes, int is_sent) {
4819   const struct iobuf *io = is_sent ? &nc->send_iobuf : &nc->recv_iobuf;
4820   FILE *fp;
4821   char *buf, src[60], dst[60];
4822   int buf_size = num_bytes * 5 + 100;
48254823
4826  if (path != NULL && (fp = fopen(path, "a")) != NULL) {
4827    ns_sock_to_str(nc->sock, src, sizeof(src), 3);
4828    ns_sock_to_str(nc->sock, dst, sizeof(dst), 7);
4829    fprintf(fp, "%lu %p %s %s %s %d\n", (unsigned long) time(NULL),
4830            nc->connection_data, src,
4831            is_sent == 0 ? "<-" : is_sent == 1 ? "->" :
4832            is_sent == 2 ? "<A" : "C>", dst, num_bytes);
4833    if (num_bytes > 0 && (buf = (char *) malloc(buf_size)) != NULL) {
4834      ns_hexdump(io->buf + (is_sent ? 0 : io->len) - (is_sent ? 0 : num_bytes),
4835                 num_bytes, buf, buf_size);
4836      fprintf(fp, "%s", buf);
4837      free(buf);
4838    }
4839    fclose(fp);
4840  }
4824   if (path != NULL && (fp = fopen(path, "a")) != NULL) {
4825   ns_sock_to_str(nc->sock, src, sizeof(src), 3);
4826   ns_sock_to_str(nc->sock, dst, sizeof(dst), 7);
4827   fprintf(fp, "%lu %p %s %s %s %d\n", (unsigned long) time(NULL),
4828         nc->connection_data, src,
4829         is_sent == 0 ? "<-" : is_sent == 1 ? "->" :
4830         is_sent == 2 ? "<A" : "C>", dst, num_bytes);
4831   if (num_bytes > 0 && (buf = (char *) malloc(buf_size)) != NULL) {
4832      ns_hexdump(io->buf + (is_sent ? 0 : io->len) - (is_sent ? 0 : num_bytes),
4833               num_bytes, buf, buf_size);
4834      fprintf(fp, "%s", buf);
4835      free(buf);
4836   }
4837   fclose(fp);
4838   }
48414839}
48424840#endif
48434841
48444842static void mg_ev_handler(struct ns_connection *nc, enum ns_event ev, void *p) {
4845  struct connection *conn = (struct connection *) nc->connection_data;
4843   struct connection *conn = (struct connection *) nc->connection_data;
48464844#ifndef MONGOOSE_NO_FILESYSTEM
4847  struct mg_server *server = (struct mg_server *) nc->server;
4845   struct mg_server *server = (struct mg_server *) nc->server;
48484846#endif
48494847
4850  // Send NS event to the handler. Note that call_user won't send an event
4851  // if conn == NULL. Therefore, repeat this for NS_ACCEPT event as well.
4848   // Send NS event to the handler. Note that call_user won't send an event
4849   // if conn == NULL. Therefore, repeat this for NS_ACCEPT event as well.
48524850#ifdef MONGOOSE_SEND_NS_EVENTS
4853  {
4854    struct connection *conn = (struct connection *) nc->connection_data;
4855    if (conn != NULL) conn->mg_conn.callback_param = p;
4856    call_user(conn, (enum mg_event) ev);
4857  }
4851   {
4852   struct connection *conn = (struct connection *) nc->connection_data;
4853   if (conn != NULL) conn->mg_conn.callback_param = p;
4854   call_user(conn, (enum mg_event) ev);
4855   }
48584856#endif
48594857
4860  switch (ev) {
4861    case NS_ACCEPT:
4862      on_accept(nc, (union socket_address *) p);
4858   switch (ev) {
4859   case NS_ACCEPT:
4860      on_accept(nc, (union socket_address *) p);
48634861#ifndef MONGOOSE_NO_FILESYSTEM
4864      hexdump(nc, server->config_options[HEXDUMP_FILE], 0, 2);
4862      hexdump(nc, server->config_options[HEXDUMP_FILE], 0, 2);
48654863#endif
48664864#ifdef MONGOOSE_SEND_NS_EVENTS
4867      {
4868        struct connection *conn = (struct connection *) nc->connection_data;
4869        if (conn != NULL) conn->mg_conn.callback_param = p;
4870        call_user(conn, (enum mg_event) ev);
4871      }
4865      {
4866      struct connection *conn = (struct connection *) nc->connection_data;
4867      if (conn != NULL) conn->mg_conn.callback_param = p;
4868      call_user(conn, (enum mg_event) ev);
4869      }
48724870#endif
4873      break;
4871      break;
48744872
4875    case NS_CONNECT:
4876      if (nc->connection_data != NULL) {
4877        set_ips(nc, 1);
4878        set_ips(nc, 0);
4879      }
4873   case NS_CONNECT:
4874      if (nc->connection_data != NULL) {
4875      set_ips(nc, 1);
4876      set_ips(nc, 0);
4877      }
48804878#ifndef MONGOOSE_NO_FILESYSTEM
4881      hexdump(nc, server->config_options[HEXDUMP_FILE], 0, 3);
4879      hexdump(nc, server->config_options[HEXDUMP_FILE], 0, 3);
48824880#endif
4883      conn->mg_conn.status_code = * (int *) p;
4884      if (conn->mg_conn.status_code != 0 ||
4885          (!(nc->flags & MG_PROXY_CONN) &&
4886           call_user(conn, MG_CONNECT) == MG_FALSE)) {
4887        nc->flags |= NSF_CLOSE_IMMEDIATELY;
4888      }
4889      break;
4881      conn->mg_conn.status_code = * (int *) p;
4882      if (conn->mg_conn.status_code != 0 ||
4883         (!(nc->flags & MG_PROXY_CONN) &&
4884         call_user(conn, MG_CONNECT) == MG_FALSE)) {
4885      nc->flags |= NSF_CLOSE_IMMEDIATELY;
4886      }
4887      break;
48904888
4891    case NS_RECV:
4889   case NS_RECV:
48924890#ifndef MONGOOSE_NO_FILESYSTEM
4893      hexdump(nc, server->config_options[HEXDUMP_FILE], * (int *) p, 0);
4891      hexdump(nc, server->config_options[HEXDUMP_FILE], * (int *) p, 0);
48944892#endif
4895      if (nc->flags & NSF_ACCEPTED) {
4896        on_recv_data(conn);
4893      if (nc->flags & NSF_ACCEPTED) {
4894      on_recv_data(conn);
48974895#ifndef MONGOOSE_NO_CGI
4898      } else if (nc->flags & MG_CGI_CONN) {
4899        on_cgi_data(nc);
4896      } else if (nc->flags & MG_CGI_CONN) {
4897      on_cgi_data(nc);
49004898#endif
4901      } else if (nc->flags & MG_PROXY_CONN) {
4902        if (conn != NULL) {
4903          ns_forward(nc, conn->ns_conn);
4904        }
4905      } else {
4906        process_response(conn);
4907      }
4908      break;
4899      } else if (nc->flags & MG_PROXY_CONN) {
4900      if (conn != NULL) {
4901         ns_forward(nc, conn->ns_conn);
4902      }
4903      } else {
4904      process_response(conn);
4905      }
4906      break;
49094907
4910    case NS_SEND:
4908   case NS_SEND:
49114909#ifndef MONGOOSE_NO_FILESYSTEM
4912      hexdump(nc, server->config_options[HEXDUMP_FILE], * (int *) p, 1);
4910      hexdump(nc, server->config_options[HEXDUMP_FILE], * (int *) p, 1);
49134911#endif
4914      break;
4912      break;
49154913
4916    case NS_CLOSE:
4917      nc->connection_data = NULL;
4918      if (nc->flags & (MG_CGI_CONN | MG_PROXY_CONN)) {
4919        DBG(("%p %p closing cgi/proxy conn", conn, nc));
4920        if (conn && conn->ns_conn) {
4921          conn->ns_conn->flags &= ~NSF_BUFFER_BUT_DONT_SEND;
4922          conn->ns_conn->flags |= conn->ns_conn->send_iobuf.len > 0 ?
4923            NSF_FINISHED_SENDING_DATA : NSF_CLOSE_IMMEDIATELY;
4924          conn->endpoint.nc = NULL;
4925        }
4926      } else if (conn != NULL) {
4927        DBG(("%p %p %d closing", conn, nc, conn->endpoint_type));
4914   case NS_CLOSE:
4915      nc->connection_data = NULL;
4916      if (nc->flags & (MG_CGI_CONN | MG_PROXY_CONN)) {
4917      DBG(("%p %p closing cgi/proxy conn", conn, nc));
4918      if (conn && conn->ns_conn) {
4919         conn->ns_conn->flags &= ~NSF_BUFFER_BUT_DONT_SEND;
4920         conn->ns_conn->flags |= conn->ns_conn->send_iobuf.len > 0 ?
4921         NSF_FINISHED_SENDING_DATA : NSF_CLOSE_IMMEDIATELY;
4922         conn->endpoint.nc = NULL;
4923      }
4924      } else if (conn != NULL) {
4925      DBG(("%p %p %d closing", conn, nc, conn->endpoint_type));
49284926
4929        if (conn->endpoint_type == EP_CLIENT && nc->recv_iobuf.len > 0) {
4930          call_http_client_handler(conn);
4931        }
4927      if (conn->endpoint_type == EP_CLIENT && nc->recv_iobuf.len > 0) {
4928         call_http_client_handler(conn);
4929      }
49324930
4933        call_user(conn, MG_CLOSE);
4934        close_local_endpoint(conn);
4935        conn->ns_conn = NULL;
4936        free(conn);
4937      }
4938      break;
4931      call_user(conn, MG_CLOSE);
4932      close_local_endpoint(conn);
4933      conn->ns_conn = NULL;
4934      free(conn);
4935      }
4936      break;
49394937
4940    case NS_POLL:
4941      if (call_user(conn, MG_POLL) == MG_TRUE) {
4942        if (conn->ns_conn->flags & MG_HEADERS_SENT) {
4943          write_terminating_chunk(conn);
4944        }
4945        close_local_endpoint(conn);
4946      }
4938   case NS_POLL:
4939      if (call_user(conn, MG_POLL) == MG_TRUE) {
4940      if (conn->ns_conn->flags & MG_HEADERS_SENT) {
4941         write_terminating_chunk(conn);
4942      }
4943      close_local_endpoint(conn);
4944      }
49474945
4948      if (conn != NULL && conn->endpoint_type == EP_FILE) {
4949        transfer_file_data(conn);
4950      }
4946      if (conn != NULL && conn->endpoint_type == EP_FILE) {
4947      transfer_file_data(conn);
4948      }
49514949
4952      // Expire idle connections
4953      {
4954        time_t current_time = * (time_t *) p;
4950      // Expire idle connections
4951      {
4952      time_t current_time = * (time_t *) p;
49554953
4956        if (conn != NULL && conn->mg_conn.is_websocket) {
4957          ping_idle_websocket_connection(conn, current_time);
4958        }
4954      if (conn != NULL && conn->mg_conn.is_websocket) {
4955         ping_idle_websocket_connection(conn, current_time);
4956      }
49594957
4960        if (nc->last_io_time + MONGOOSE_IDLE_TIMEOUT_SECONDS < current_time) {
4961          mg_ev_handler(nc, NS_CLOSE, NULL);
4962          nc->flags |= NSF_CLOSE_IMMEDIATELY;
4963        }
4964      }
4965      break;
4958      if (nc->last_io_time + MONGOOSE_IDLE_TIMEOUT_SECONDS < current_time) {
4959         mg_ev_handler(nc, NS_CLOSE, NULL);
4960         nc->flags |= NSF_CLOSE_IMMEDIATELY;
4961      }
4962      }
4963      break;
49664964
4967    default:
4968      break;
4969  }
4965   default:
4966      break;
4967   }
49704968}
49714969
49724970static void iter2(struct ns_connection *nc, enum ns_event ev, void *param) {
4973  mg_handler_t func = NULL;
4974  struct connection *conn = (struct connection *) nc->connection_data;
4975  const char *msg = (const char *) param;
4976  int n;
4977  (void) ev;
4971   mg_handler_t func = NULL;
4972   struct connection *conn = (struct connection *) nc->connection_data;
4973   const char *msg = (const char *) param;
4974   int n;
4975   (void) ev;
49784976
4979  //DBG(("%p [%s]", conn, msg));
4980  if (sscanf(msg, "%p %n", &func, &n) && func != NULL) {
4981    conn->mg_conn.callback_param = (void *) (msg + n);
4982    func(&conn->mg_conn, MG_POLL);
4983  }
4977   //DBG(("%p [%s]", conn, msg));
4978   if (sscanf(msg, "%p %n", &func, &n) && func != NULL) {
4979   conn->mg_conn.callback_param = (void *) (msg + n);
4980   func(&conn->mg_conn, MG_POLL);
4981   }
49844982}
49854983
49864984void mg_wakeup_server_ex(struct mg_server *server, mg_handler_t cb,
4987                         const char *fmt, ...) {
4988  va_list ap;
4989  char buf[8 * 1024];
4990  int len;
4985                     const char *fmt, ...) {
4986   va_list ap;
4987   char buf[8 * 1024];
4988   int len;
49914989
4992  // Encode callback (cb) into a buffer
4993  len = snprintf(buf, sizeof(buf), "%p ", cb);
4994  va_start(ap, fmt);
4995  len += vsnprintf(buf + len, sizeof(buf) - len, fmt, ap);
4996  va_end(ap);
4990   // Encode callback (cb) into a buffer
4991   len = snprintf(buf, sizeof(buf), "%p ", cb);
4992   va_start(ap, fmt);
4993   len += vsnprintf(buf + len, sizeof(buf) - len, fmt, ap);
4994   va_end(ap);
49974995
4998  // "len + 1" is to include terminating \0 in the message
4999  ns_server_wakeup_ex(&server->ns_server, iter2, buf, len + 1);
4996   // "len + 1" is to include terminating \0 in the message
4997   ns_server_wakeup_ex(&server->ns_server, iter2, buf, len + 1);
50004998}
50014999
50025000void mg_wakeup_server(struct mg_server *server) {
5003  ns_server_wakeup_ex(&server->ns_server, NULL, (void *) "", 0);
5001   ns_server_wakeup_ex(&server->ns_server, NULL, (void *) "", 0);
50045002}
50055003
50065004void mg_set_listening_socket(struct mg_server *server, int sock) {
5007  if (server->ns_server.listening_sock != INVALID_SOCKET) {
5008    closesocket(server->ns_server.listening_sock);
5009  }
5010  server->ns_server.listening_sock = (sock_t) sock;
5005   if (server->ns_server.listening_sock != INVALID_SOCKET) {
5006   closesocket(server->ns_server.listening_sock);
5007   }
5008   server->ns_server.listening_sock = (sock_t) sock;
50115009}
50125010
50135011int mg_get_listening_socket(struct mg_server *server) {
5014  return server->ns_server.listening_sock;
5012   return server->ns_server.listening_sock;
50155013}
50165014
50175015const char *mg_get_option(const struct mg_server *server, const char *name) {
5018  const char **opts = (const char **) server->config_options;
5019  int i = get_option_index(name);
5020  return i == -1 ? NULL : opts[i] == NULL ? "" : opts[i];
5016   const char **opts = (const char **) server->config_options;
5017   int i = get_option_index(name);
5018   return i == -1 ? NULL : opts[i] == NULL ? "" : opts[i];
50215019}
50225020
50235021struct mg_server *mg_create_server(void *server_data, mg_handler_t handler) {
5024  struct mg_server *server = (struct mg_server *) calloc(1, sizeof(*server));
5025  ns_server_init(&server->ns_server, server_data, mg_ev_handler);
5026  set_default_option_values(server->config_options);
5027  server->event_handler = handler;
5028  return server;
5022   struct mg_server *server = (struct mg_server *) calloc(1, sizeof(*server));
5023   ns_server_init(&server->ns_server, server_data, mg_ev_handler);
5024   set_default_option_values(server->config_options);
5025   server->event_handler = handler;
5026   return server;
50295027}
trunk/src/version.c
r31373r31374
99***************************************************************************/
1010
1111extern const char build_version[];
12const char build_version[] = "0.153 ("__DATE__")";
12const char build_version[] = "0.154 ("__DATE__")";
trunk/src/mess/drivers/ng_aes.c
r31373r31374
11221122 *************************************/
11231123
11241124static ADDRESS_MAP_START( aes_main_map, AS_PROGRAM, 16, ng_aes_state )
1125//   AM_RANGE(0x000000, 0x00007f) AM_ROMBANK("vectors")
1125//  AM_RANGE(0x000000, 0x00007f) AM_ROMBANK("vectors")
11261126   AM_RANGE(0x000000, 0x00007f) AM_READ(neogeo_slot_rom_low_bectors_r)
11271127   AM_RANGE(0x000080, 0x0fffff) AM_ROM
11281128   AM_RANGE(0x100000, 0x10ffff) AM_MIRROR(0x0f0000) AM_RAM
r31373r31374
11491149
11501150
11511151static ADDRESS_MAP_START( neocd_main_map, AS_PROGRAM, 16, ng_aes_state )
1152//   AM_RANGE(0x000000, 0x00007f) AM_READ_BANK("vectors") // writes will fall through to area below
1153   AM_RANGE(0x000000, 0x00007f) AM_READ(banked_vectors_r)   
1152//  AM_RANGE(0x000000, 0x00007f) AM_READ_BANK("vectors") // writes will fall through to area below
1153   AM_RANGE(0x000000, 0x00007f) AM_READ(banked_vectors_r)
11541154   AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_REGION("maincpu", 0x00000)
11551155
11561156   AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01fffe) AM_READ(aes_in0_r)
trunk/src/mess/drivers/atom.c
r31373r31374
811811   MCFG_CASSETTE_ADD("cassette")
812812   MCFG_CASSETTE_FORMATS(atom_cassette_formats)
813813   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED)
814   
814
815815   MCFG_QUICKLOAD_ADD("quickload", atom_state, atom_atm, "atm", 0)
816816
817817   /* cartridge */
r31373r31374
897897
898898   MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG)
899899
900   MCFG_CASSETTE_ADD("cassette")   
900   MCFG_CASSETTE_ADD("cassette")
901901   MCFG_CASSETTE_FORMATS(atom_cassette_formats)
902902   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED)
903903
trunk/src/mess/drivers/super80.c
r31373r31374
732732   /* cassette */
733733   MCFG_CASSETTE_ADD( "cassette" )
734734   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED)
735   
735
736736   MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", super80_state, timer_p, attotime::from_hz(40000)) // cass read
737737   MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_k", super80_state, timer_k, attotime::from_hz(300)) // keyb scan
738738   MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_h", super80_state, timer_h, attotime::from_hz(100)) // half-speed
trunk/src/mess/drivers/wicat.c
r31373r31374
1010
1111/*
1212
13   TODO:
13    TODO:
1414
15   - video DMA is done line by line and needs to be in perfect sync
15    - video DMA is done line by line and needs to be in perfect sync
1616
1717*/
1818
trunk/src/mess/drivers/svi318.c
r31373r31374
433433
434434   MCFG_MC6845_ADD("crtc", MC6845, "svi806", XTAL_12MHz / 8)
435435   MCFG_MC6845_SHOW_BORDER_AREA(false)
436   MCFG_MC6845_CHAR_WIDTH(8)   /* ? */
436   MCFG_MC6845_CHAR_WIDTH(8)   /* ? */
437437   MCFG_MC6845_UPDATE_ROW_CB(svi318_state, crtc_update_row)
438438
439439   MCFG_VIDEO_START_OVERRIDE(svi318_state, svi328_806 )
trunk/src/mess/drivers/d6800.c
r31373r31374
412412
413413   MCFG_CASSETTE_ADD("cassette")
414414   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED)
415   
415
416416   MCFG_TIMER_DRIVER_ADD_PERIODIC("d6800_c", d6800_state, d6800_c, attotime::from_hz(4800))
417417   MCFG_TIMER_DRIVER_ADD_PERIODIC("d6800_p", d6800_state, d6800_p, attotime::from_hz(40000))
418418
trunk/src/mess/drivers/a310.c
r31373r31374
8888   DECLARE_DRIVER_INIT(a310);
8989   virtual void machine_start();
9090   virtual void machine_reset();
91    DECLARE_INPUT_CHANGED_MEMBER(key_stroke);
91   DECLARE_INPUT_CHANGED_MEMBER(key_stroke);
9292   DECLARE_FLOPPY_FORMATS( floppy_formats );
9393
9494
r31373r31374
166166
167167INPUT_CHANGED_MEMBER(a310_state::key_stroke)
168168{
169    UINT8 row_val = (UINT8)(FPTR)(param) >> 4;
170    UINT8 col_val = (UINT8)(FPTR)(param) & 0xf;
169   UINT8 row_val = (UINT8)(FPTR)(param) >> 4;
170   UINT8 col_val = (UINT8)(FPTR)(param) & 0xf;
171171
172172   if(newval && !oldval)
173173      m_kart->send_keycode_down(row_val,col_val);
r31373r31374
214214   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("TAB") PORT_CODE(KEYCODE_TAB) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x26) PORT_IMPULSE(1)
215215
216216   PORT_START("key2") /* KEY ROW 2 */
217    PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("q  Q") PORT_CODE(KEYCODE_Q) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x27) PORT_IMPULSE(1)
217   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("q  Q") PORT_CODE(KEYCODE_Q) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x27) PORT_IMPULSE(1)
218218   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("w  W") PORT_CODE(KEYCODE_W) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x28) PORT_IMPULSE(1)
219219   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("e  E") PORT_CODE(KEYCODE_E) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x29) PORT_IMPULSE(1)
220220   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("r  R") PORT_CODE(KEYCODE_R) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x2a) PORT_IMPULSE(1)
r31373r31374
266266   PORT_START("key7") /* KEY ROW 7 */
267267   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("LINE FEED")
268268   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x5f) PORT_IMPULSE(1)
269    PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("- (KP)") PORT_CODE(KEYCODE_MINUS_PAD)
270    PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME(", (KP)") PORT_CODE(KEYCODE_PLUS_PAD)
269   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("- (KP)") PORT_CODE(KEYCODE_MINUS_PAD)
270   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME(", (KP)") PORT_CODE(KEYCODE_PLUS_PAD)
271271   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("ENTER (KP)") PORT_CODE(KEYCODE_ENTER_PAD)
272272   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME(". (KP)") PORT_CODE(KEYCODE_DEL_PAD)
273273   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("0 (KP)") PORT_CODE(KEYCODE_0_PAD)
274274   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("1 (KP)") PORT_CODE(KEYCODE_1_PAD)
275275
276276   PORT_START("key8") /* KEY ROW 8 */
277    PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("2 (KP)") PORT_CODE(KEYCODE_2_PAD)
278    PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("3 (KP)") PORT_CODE(KEYCODE_3_PAD)
279    PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("4 (KP)") PORT_CODE(KEYCODE_4_PAD)
280    PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("5 (KP)") PORT_CODE(KEYCODE_5_PAD)
281    PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("6 (KP)") PORT_CODE(KEYCODE_6_PAD)
282    PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("7 (KP)") PORT_CODE(KEYCODE_7_PAD)
283    PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("8 (KP)") PORT_CODE(KEYCODE_8_PAD)
284    PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("9 (KP)") PORT_CODE(KEYCODE_9_PAD)
277   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("2 (KP)") PORT_CODE(KEYCODE_2_PAD)
278   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("3 (KP)") PORT_CODE(KEYCODE_3_PAD)
279   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("4 (KP)") PORT_CODE(KEYCODE_4_PAD)
280   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("5 (KP)") PORT_CODE(KEYCODE_5_PAD)
281   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("6 (KP)") PORT_CODE(KEYCODE_6_PAD)
282   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("7 (KP)") PORT_CODE(KEYCODE_7_PAD)
283   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("8 (KP)") PORT_CODE(KEYCODE_8_PAD)
284   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("9 (KP)") PORT_CODE(KEYCODE_9_PAD)
285285
286    PORT_START("key9")
287    PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x20) PORT_IMPULSE(1)
288    PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("*") PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x24) PORT_IMPULSE(1) // (KP?)
289    PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("#") PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x25) PORT_IMPULSE(1) // (KP?)
286   PORT_START("key9")
287   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("HOME") PORT_CODE(KEYCODE_HOME) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x20) PORT_IMPULSE(1)
288   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("*") PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x24) PORT_IMPULSE(1) // (KP?)
289   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("#") PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x25) PORT_IMPULSE(1) // (KP?)
290290
291    PORT_START("keya")
292    PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x01) PORT_IMPULSE(1)
293    PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x02) PORT_IMPULSE(1)
294    PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x03) PORT_IMPULSE(1)
295    PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x04) PORT_IMPULSE(1)
296    PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x05) PORT_IMPULSE(1)
297    PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x06) PORT_IMPULSE(1)
298    PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x07) PORT_IMPULSE(1)
299    PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x08) PORT_IMPULSE(1)
291   PORT_START("keya")
292   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("F1") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x01) PORT_IMPULSE(1)
293   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("F2") PORT_CODE(KEYCODE_F2) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x02) PORT_IMPULSE(1)
294   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("F3") PORT_CODE(KEYCODE_F3) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x03) PORT_IMPULSE(1)
295   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("F4") PORT_CODE(KEYCODE_F4) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x04) PORT_IMPULSE(1)
296   PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x05) PORT_IMPULSE(1)
297   PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x06) PORT_IMPULSE(1)
298   PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x07) PORT_IMPULSE(1)
299   PORT_BIT(0x80, 0x00, IPT_KEYBOARD) PORT_NAME("F8") PORT_CODE(KEYCODE_F8) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x08) PORT_IMPULSE(1)
300300
301    PORT_START("keyb")
302    PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x09) PORT_IMPULSE(1)
303    PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0a) PORT_IMPULSE(1)
304    PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0b) PORT_IMPULSE(1)
305    PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0c) PORT_IMPULSE(1)
301   PORT_START("keyb")
302   PORT_BIT(0x01, 0x00, IPT_KEYBOARD) PORT_NAME("F9") PORT_CODE(KEYCODE_F9) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x09) PORT_IMPULSE(1)
303   PORT_BIT(0x02, 0x00, IPT_KEYBOARD) PORT_NAME("F10") PORT_CODE(KEYCODE_F10) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0a) PORT_IMPULSE(1)
304   PORT_BIT(0x04, 0x00, IPT_KEYBOARD) PORT_NAME("F11") PORT_CODE(KEYCODE_F11) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0b) PORT_IMPULSE(1)
305   PORT_BIT(0x08, 0x00, IPT_KEYBOARD) PORT_NAME("F12") PORT_CODE(KEYCODE_F12) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x0c) PORT_IMPULSE(1)
306306//    PORT_BIT(0x10, 0x00, IPT_KEYBOARD) PORT_NAME("F5") PORT_CODE(KEYCODE_F5) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x05) PORT_IMPULSE(1)
307307//    PORT_BIT(0x20, 0x00, IPT_KEYBOARD) PORT_NAME("F6") PORT_CODE(KEYCODE_F6) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x06) PORT_IMPULSE(1)
308308//    PORT_BIT(0x40, 0x00, IPT_KEYBOARD) PORT_NAME("F7") PORT_CODE(KEYCODE_F7) PORT_CHANGED_MEMBER(DEVICE_SELF, a310_state, key_stroke, 0x07) PORT_IMPULSE(1)
trunk/src/mess/drivers/special.c
r31373r31374
389389   MCFG_CASSETTE_FORMATS(rks_cassette_formats)
390390   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
391391   MCFG_CASSETTE_INTERFACE("special_cass")
392   
392
393393   MCFG_SOFTWARE_LIST_ADD("cass_list","special_cass")
394394MACHINE_CONFIG_END
395395
trunk/src/mess/drivers/phc25.c
r31373r31374
321321   MCFG_CASSETTE_ADD("cassette")
322322   MCFG_CASSETTE_FORMATS(phc25_cassette_formats)
323323   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED)
324   
324
325325   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_printers, "printer")
326326   MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(phc25_state, write_centronics_busy))
327327
trunk/src/mess/drivers/nes.c
r31373r31374
749749   MCFG_CASSETTE_ADD( "tape" )
750750   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
751751   MCFG_CASSETTE_INTERFACE("fc_cass")
752   
752
753753   MCFG_SOFTWARE_LIST_ADD("cass_list", "famicom_cass")
754754MACHINE_CONFIG_END
755755
trunk/src/mess/drivers/spectrum.c
r31373r31374
716716   MCFG_CASSETTE_FORMATS(tzx_cassette_formats)
717717   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
718718   MCFG_CASSETTE_INTERFACE("spectrum_cass")
719   
719
720720   MCFG_SOFTWARE_LIST_ADD("cass_list","spectrum_cass")
721721
722722   /* cartridge */
trunk/src/mess/drivers/ti630.c
r31373r31374
1414   * LCD works
1515
1616================
17   Messages displayed on screen are in brazilian portuguese.
18    During boot, it says:
17    Messages displayed on screen are in brazilian portuguese.
18    During boot, it says:
1919
2020"TI auto-test."
2121"Wait!"
2222
23   Then it says:
23    Then it says:
2424
2525"Initializing..."
2626"Wait!"
2727
28   And finally:
28    And finally:
2929
3030"TI did not receive"
3131"the dial tone"
r31373r31374
108108
109109WRITE8_MEMBER(ti630_state::ti630_io_w)
110110{
111    static UINT8 p0=0, p1=0, p2=0, p3=0;
112    switch (offset)
113    {
114        case 0x00:
115        {
116            if (data != p0)
117            {
118                p0=data;
111   static UINT8 p0=0, p1=0, p2=0, p3=0;
112   switch (offset)
113   {
114      case 0x00:
115      {
116         if (data != p0)
117         {
118            p0=data;
119119#if LOG_IO_PORTS
120                printf("Write to P0: %02X\n", data);
120            printf("Write to P0: %02X\n", data);
121121#endif
122            }
123            break;
124        }
125        case 0x01:
126        {
127            if (data != p1)
128            {
129                p1=data;
122         }
123         break;
124      }
125      case 0x01:
126      {
127         if (data != p1)
128         {
129            p1=data;
130130#if LOG_IO_PORTS
131                printf("Write to P1: %02X\n", data);
131            printf("Write to P1: %02X\n", data);
132132#endif
133            }
134            break;
135        }
136        case 0x02:
137        {
138            if (data != p2)
139            {
140                p2=data;
133         }
134         break;
135      }
136      case 0x02:
137      {
138         if (data != p2)
139         {
140            p2=data;
141141#if LOG_IO_PORTS
142                printf("Write to P2: %02X\n", data);
142            printf("Write to P2: %02X\n", data);
143143#endif
144            }
145            break;
146        }
147        case 0x03:
148        {
149            if (data != p3)
150            {
151                p3=data;
144         }
145         break;
146      }
147      case 0x03:
148      {
149         if (data != p3)
150         {
151            p3=data;
152152#if LOG_IO_PORTS
153                printf("Write to P3: %02X\n", data);
153            printf("Write to P3: %02X\n", data);
154154#endif
155            }
156            break;
157        }
158    }
155         }
156         break;
157      }
158   }
159159}
160160
161161PALETTE_INIT_MEMBER(ti630_state, ti630)
trunk/src/mess/drivers/ep64.c
r31373r31374
528528   MCFG_CASSETTE_ADD(CASSETTE1_TAG)
529529   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED)
530530   MCFG_CASSETTE_INTERFACE("ep64_cass")
531   
531
532532   MCFG_CASSETTE_ADD(CASSETTE2_TAG)
533533   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED)
534534   MCFG_CASSETTE_INTERFACE("ep64_cass")
trunk/src/mess/drivers/px4.c
r31373r31374
14001400   // external cassette
14011401   MCFG_CASSETTE_ADD("extcas")
14021402   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED)
1403   
1403
14041404   MCFG_TIMER_DRIVER_ADD("extcas_timer", px4_state, ext_cassette_read)
14051405
14061406   // sio port
trunk/src/mess/drivers/mikrosha.c
r31373r31374
237237   MCFG_CASSETTE_FORMATS(rkm_cassette_formats)
238238   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
239239   MCFG_CASSETTE_INTERFACE("mikrosha_cass")
240   
240
241241   MCFG_SOFTWARE_LIST_ADD("cass_list","mikrosha")
242242MACHINE_CONFIG_END
243243
trunk/src/mess/drivers/sorcerer.c
r31373r31374
423423   MCFG_DEVICE_ADD( "uart", AY31015, 0 )
424424   MCFG_AY31015_TX_CLOCK(4800.0)
425425   MCFG_AY31015_RX_CLOCK(4800.0)
426   
426
427427   /* printer */
428428   MCFG_CENTRONICS_ADD("centronics", centronics_printers, "covox")
429429   MCFG_SLOT_OPTION_ADD( "covox", CENTRONICS_COVOX )
r31373r31374
442442   MCFG_CASSETTE_FORMATS(sorcerer_cassette_formats)
443443   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
444444   MCFG_CASSETTE_INTERFACE("sorcerer_cass")
445   
445
446446   MCFG_CASSETTE_ADD( "cassette2" )
447447   MCFG_CASSETTE_FORMATS(sorcerer_cassette_formats)
448448   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
trunk/src/mess/drivers/x1twin.c
r31373r31374
501501   MCFG_CASSETTE_FORMATS(x1_cassette_formats)
502502   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED)
503503   MCFG_CASSETTE_INTERFACE("x1_cass")
504   
504
505505   MCFG_SOFTWARE_LIST_ADD("cass_list","x1_cass")
506506
507507   MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(x1_floppy_interface)
trunk/src/mess/drivers/crvision.c
r31373r31374
851851
852852   MCFG_CASSETTE_ADD("cassette")
853853   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED)
854   
854
855855   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_printers, "printer")
856856   MCFG_CENTRONICS_BUSY_HANDLER(DEVWRITELINE("cent_status_in", input_buffer_device, write_bit7))
857857
trunk/src/mess/drivers/mmd1.c
r31373r31374
502502
503503   /* Devices */
504504   MCFG_DEVICE_ADD("i8279", I8279, 400000) // based on divider
505   MCFG_I8279_OUT_SL_CB(WRITE8(mmd1_state, mmd2_scanlines_w))         // scan SL lines
506   MCFG_I8279_OUT_DISP_CB(WRITE8(mmd1_state, mmd2_digit_w))         // display A&B
507   MCFG_I8279_IN_RL_CB(READ8(mmd1_state, mmd2_kbd_r))               // kbd RL lines
508   MCFG_I8279_IN_SHIFT_CB(VCC)                              // Shift key
505   MCFG_I8279_OUT_SL_CB(WRITE8(mmd1_state, mmd2_scanlines_w))          // scan SL lines
506   MCFG_I8279_OUT_DISP_CB(WRITE8(mmd1_state, mmd2_digit_w))            // display A&B
507   MCFG_I8279_IN_RL_CB(READ8(mmd1_state, mmd2_kbd_r))                  // kbd RL lines
508   MCFG_I8279_IN_SHIFT_CB(VCC)                                     // Shift key
509509   MCFG_I8279_IN_CTRL_CB(VCC)
510510
511511MACHINE_CONFIG_END
trunk/src/mess/drivers/rainbow.c
r31373r31374
1313Issues with this driver:
1414    (1) Keyboard emulation incomplete (inhibits the system from booting with ERROR 50).
1515
16(2) IRQ / DMA / arbitration logic should be verified
17   DMA (needed for 'Extended communication option') or Z80-8088 arbitration is non-existent (E11/E13 dumps anyone?).
16(2) IRQ / DMA / arbitration logic should be verified
17    DMA (needed for 'Extended communication option') or Z80-8088 arbitration is non-existent (E11/E13 dumps anyone?).
1818
19(3) Read errors when booting CPM 2 / DOS 2.x / DOS 3 (secondary boot loader finds errors on tracks >= 2).
19(3) Read errors when booting CPM 2 / DOS 2.x / DOS 3 (secondary boot loader finds errors on tracks >= 2).
2020Seek (+ verify) and a number of signals (TRACK > 43 TG43, INDEX etc.) appear to be incorrect (-> diag.disk aborts drive test).
2121UCSD systems (fort_sys, pas_sys) and diag disks boot!
2222
r31373r31374
2828                    MHFU gets active if the 8088 has not acknowledged a video processor interrupt within approx. 108 milliseconds
2929
3030    - TO BE IMPLEMENTED AS SLOT DEVICES (for now, DIP settings affect 'system_parameter_r' only and are disabled):
31            * Color graphics option (uses NEC upd7220 GDC).       REFERENCE: Programmer's Reference: AA-AE36A-TV.
32            Either 384 x 240 x 16 or 800 x 240 x 4 colors (out of 4096). 8 × 64 K video RAM. Pallette limited to 4 colors on 100-A.
31            * Color graphics option (uses NEC upd7220 GDC).         REFERENCE: Programmer's Reference: AA-AE36A-TV.
32            Either 384 x 240 x 16 or 800 x 240 x 4 colors (out of 4096). 8 ? 64 K video RAM. Pallette limited to 4 colors on 100-A.
3333
34            * Extended communication option (occupies BUNDLE_OPTION ports)   REFERENCE: AA-V172A-TV + Addendum AV-Y890A-TV.
34            * Extended communication option (occupies BUNDLE_OPTION ports)  REFERENCE: AA-V172A-TV + Addendum AV-Y890A-TV.
3535            See also NEWCOM1.DOC in RBETECDOC.ZIP.   Board connected to the front rightmost expansion slot (1 of the expansion
3636            ports used by the hard disk controller). Thus can't be added to a system that includes the DEC RD50/51.
3737            => 2 ports, a high-speed RS-422 half-duplex interface (port A) + lower-speed RS-423 full/half-duplex interface
r31373r31374
4242                    Plugs into the NVM chip socket on a 100-A and into the Boot ROM on the 100-B (there is a socket
4343                    on the ClikClok for the NVM / ROM chip). Came with software for 'all versions of MS-DOS'.
4444
45            * 8087   Numerical Data Coprocessor daughterboard.      REFERENCE: EK-PCNDP-IN-PRE
45            * 8087  Numerical Data Coprocessor daughterboard.       REFERENCE: EK-PCNDP-IN-PRE
4646                    Daughterboard, to be plugged into the expansion port where the memory expansion card usually sits.
4747                    If a memory adapter board is present, it has to be plugged into a connector atop the 8087 copro board.
4848                    The 8088 is put into the CPU socket on the coprocessor board.
49               => see MATH test on 'Design Maturity Diagnostics' disk <=
49                    => see MATH test on 'Design Maturity Diagnostics' disk <=
5050
5151            * Suitable Solutions TURBOW286: 12 Mhz, 68-pin, low power AMD N80L286-12 and WAYLAND/EDSUN EL286-88-10-B ( 80286 to 8088 Processor Signal Converter )
5252              plus DC 7174 or DT 7174 (barely readable). Add-on card, replaces main 8088 cpu (via ribbon cable). Patched V5.03 BOOT ROM labeled 'TBSS1.3 - 3ED4'.
r31373r31374
207207#include "video/vtvideo.h"
208208
209209#include "machine/wd_fdc.h"
210#include "formats/rx50_dsk.h"
211#include "imagedev/flopdrv.h"
210#include "formats/rx50_dsk.h"
211#include "imagedev/flopdrv.h"
212212
213213#include "machine/i8251.h"
214214#include "machine/clock.h"
r31373r31374
218218#include "rainbow.lh" // BEZEL - LAYOUT with LEDs for diag 1-7, keyboard 8-11 and floppy 20-23
219219
220220#define LK201_TAG   "lk201"
221#define FD1793_TAG  "fd1793x" 
221#define FD1793_TAG  "fd1793x"
222222#define INVALID_DRIVE 255
223223
224224class rainbow_state : public driver_device
r31373r31374
243243      m_crtc(*this, "vt100_video"),
244244      m_i8088(*this, "maincpu"),
245245      m_z80(*this, "subcpu"),
246      m_fdc(*this, FD1793_TAG),
246      m_fdc(*this, FD1793_TAG),
247247      m_kbd8251(*this, "kbdser"),
248248      m_lk201(*this, LK201_TAG),
249249      m_p_ram(*this, "p_ram"),
r31373r31374
299299   DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock);
300300   TIMER_DEVICE_CALLBACK_MEMBER(motor_tick);
301301
302   DECLARE_FLOPPY_FORMATS( floppy_formats );
302   DECLARE_FLOPPY_FORMATS( floppy_formats );
303303protected:
304304   virtual void machine_start();
305305
306306private:
307307   enum
308308   {
309        IRQ_8088_MAILBOX = 0,   // vector 0x27/a7   (lowest priority)
310        IRQ_8088_KBD,           // vector 0x26/a6   KEYBOARD (8251A) Interrupt
311//      IRQ_EXT_COMM,         // vector 0x25      [OPTION BOARD] Interrupt from external COMM.BOARD (non DMA)
312//      IRQ_COMM_PRN_7201,      // vector 0x24      COMM./PRINTER (7201) IRQ
313//      IRQ_EXT_DMAC,         // vector 0x23      [OPTION BOARD] : from external COMM.BOARD (DMA Control IRQ)
314//      IRQ_GRF,            // vector 0x22      GRAPHICS IRQ
315//      IRQ_SH_10_BDL,         // vector 0x21      BUNDLE IRQ (hard disc / COMM.BOARD) : Pin 23 of expansion connector J4
316        IRQ_8088_VBL,           // vector 0x20/a0   (highest priority)
309      IRQ_8088_MAILBOX = 0,   // vector 0x27/a7   (lowest priority)
310      IRQ_8088_KBD,           // vector 0x26/a6   KEYBOARD (8251A) Interrupt
311//      IRQ_EXT_COMM,           // vector 0x25      [OPTION BOARD] Interrupt from external COMM.BOARD (non DMA)
312//      IRQ_COMM_PRN_7201,      // vector 0x24      COMM./PRINTER (7201) IRQ
313//      IRQ_EXT_DMAC,           // vector 0x23      [OPTION BOARD] : from external COMM.BOARD (DMA Control IRQ)
314//      IRQ_GRF,                // vector 0x22      GRAPHICS IRQ
315//      IRQ_SH_10_BDL,          // vector 0x21      BUNDLE IRQ (hard disc / COMM.BOARD) : Pin 23 of expansion connector J4
316      IRQ_8088_VBL,           // vector 0x20/a0   (highest priority)
317317      IRQ_8088_MAX
318318   };
319319
r31373r31374
381381   FLOPPY_RX50IMG_FORMAT
382382FLOPPY_FORMATS_END
383383
384static SLOT_INTERFACE_START( rainbow_floppies )
385   SLOT_INTERFACE("525qd", FLOPPY_525_SSQD) 
384static SLOT_INTERFACE_START( rainbow_floppies )
385   SLOT_INTERFACE("525qd", FLOPPY_525_SSQD)
386386SLOT_INTERFACE_END
387387
388388
r31373r31374
417417
418418   rom[0xf4000 + 0x363b]= 0xeb;  // COND => JMPS
419419
420    if (rom[0xf4174] == 0x75)
420   if (rom[0xf4174] == 0x75)
421421   {
422422      rom[0xf4174] = 0xeb; // jmps  RAINBOW100_LOGO__loc_33D
423        rom[0xf4175] = 0x08;
424    }
423      rom[0xf4175] = 0x08;
424   }
425425
426    if (rom[0xf4000 + 0x3ffc] == 0x31) // 100-B
427        rom[0xf4384] = 0xeb; // JMPS  =>  BOOT80
426   if (rom[0xf4000 + 0x3ffc] == 0x31) // 100-B
427      rom[0xf4384] = 0xeb; // JMPS  =>  BOOT80
428428
429    if (rom[0xf4000 + 0x3ffc] == 0x35) // v5.05
430        rom[0xf437b] = 0xeb;
429   if (rom[0xf4000 + 0x3ffc] == 0x35) // v5.05
430      rom[0xf437b] = 0xeb;
431431#endif
432432
433433#ifdef KEYBOARD_WORKAROUND
r31373r31374
482482   AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("kbdser", i8251_device, status_r, control_w)
483483
484484   // UNMAPPED:
485    // 0x20 -> 0x2f ***** EXTENDED COMM. OPTION / Option Select 1.
486    // See boot rom @1EA6: 0x27 (<- RESET EXTENDED COMM OPTION  )
487    // ===========================================================
485   // 0x20 -> 0x2f ***** EXTENDED COMM. OPTION / Option Select 1.
486   // See boot rom @1EA6: 0x27 (<- RESET EXTENDED COMM OPTION  )
487   // ===========================================================
488488   // 0x30 -> 0x3f ***** EXTENDED COMM. OPTION / Option Select 3.
489489   // ===========================================================
490    // 0x40  COMMUNICATIONS DATA REGISTER (MPSC) 
490   // 0x40  COMMUNICATIONS DATA REGISTER (MPSC)
491491   // 0x41  PRINTER DATA REGISTER (MPSC)
492492   // 0x42  COMMUNICATIONS CONTROL / STATUS REGISTER (MPSC)
493493   // 0x43  PRINTER CONTROL / STATUS REGISTER (MPSC)
494    // ===========================================================
495    // 0x50 - 0x57 ***** COLOR GRAPHICS OPTION:
496    //  50h   Graphics option software reset.  Any write to this
497    //        port also resynchronizes the read/modify/write memory
498    //        cycles of the Graphics Option to those of the GDC (*)
494   // ===========================================================
495   // 0x50 - 0x57 ***** COLOR GRAPHICS OPTION:
496   //  50h   Graphics option software reset.  Any write to this
497   //        port also resynchronizes the read/modify/write memory
498   //        cycles of the Graphics Option to those of the GDC (*)
499499   //                                       * see boot ROM @1EB4/8
500    //  51h   Data written to this port is loaded into the area
501    //        selected by the previous write to port 53h.
500   //  51h   Data written to this port is loaded into the area
501   //        selected by the previous write to port 53h.
502502
503    //  52h   Data written to this port is loaded into the Write Buffer.
503   //  52h   Data written to this port is loaded into the Write Buffer.
504504
505    //  53h   Data written to this port provides address selection
506    //        for indirect addressing (see Indirect Register).
505   //  53h   Data written to this port provides address selection
506   //        for indirect addressing (see Indirect Register).
507507
508    //  54h   Data written to this port is loaded into the low-order
509    //        byte of the Write Mask.
508   //  54h   Data written to this port is loaded into the low-order
509   //        byte of the Write Mask.
510510
511    //  55h   Data written to this port is loaded into the high-order
512    //        byte of the Write Mask.
511   //  55h   Data written to this port is loaded into the high-order
512   //        byte of the Write Mask.
513513
514    //  56h   Data written to this port is loaded into the GDC's FIFO
515    //        Buffer and flagged as a parameter.
514   //  56h   Data written to this port is loaded into the GDC's FIFO
515   //        Buffer and flagged as a parameter.
516516   // ===========================================================
517517   // 0x60 -> 0x6f ***** EXTENDED COMM. OPTION / Option Select 2.
518518   // ===========================================================
r31373r31374
520520   // ------ Rainbow uses 'WD 1010 AL' (Western Digital 1983)
521521   //        Register compatible to WD2010 (present in MESS)
522522   // R/W REGISTERS 60 - 68 (?)
523    AM_RANGE (0x68, 0x68) AM_READ(hd_status_68_r)
523   AM_RANGE (0x68, 0x68) AM_READ(hd_status_68_r)
524524   // ===========================================================
525525   // HARD DISC SIZES AND LIMITS
526526   //   HARDWARE:
r31373r31374
551551   AM_RANGE(0x20, 0x20) AM_READWRITE(z80_generalstat_r, z80_diskdiag_read_w) // read to port 0x20 used by MS-DOS 2.x diskette loader.
552552   AM_RANGE(0x21, 0x21) AM_READWRITE(z80_generalstat_r, z80_diskdiag_write_w)
553553   AM_RANGE(0x40, 0x40) AM_READWRITE(z80_diskstatus_r, z80_diskcontrol_w)
554   AM_RANGE(0x60, 0x63)   AM_DEVREADWRITE(FD1793_TAG, fd1793_t, read, write)
554   AM_RANGE(0x60, 0x63)   AM_DEVREADWRITE(FD1793_TAG, fd1793_t, read, write)
555555ADDRESS_MAP_END
556556
557557/* Input ports */
r31373r31374
572572      PORT_START("MEMORY PRESENT")
573573      PORT_DIPNAME( 0xF0000, 0x20000, "MEMORY PRESENT")
574574      PORT_DIPSETTING(    0x10000, "64  K (MINIMUM ON 100-A)" ) // see BOARD_RAM
575        PORT_DIPSETTING(    0x20000, "128 K (MINIMUM ON 100-B)" )
575      PORT_DIPSETTING(    0x20000, "128 K (MINIMUM ON 100-B)" )
576576      PORT_DIPSETTING(    0x30000, "192 K (MEMORY OPTION)" )
577577      PORT_DIPSETTING(    0x40000, "256 K (MEMORY OPTION)" )
578578      PORT_DIPSETTING(    0x50000, "320 K (MEMORY OPTION)" )
r31373r31374
589589   // Floppy is always 'on', BUNDLE + GRAPHICS are not implemented yet:
590590      PORT_START("FLOPPY CONTROLLER")
591591      PORT_DIPNAME( 0x01, 0x01, "FLOPPY CONTROLLER") PORT_TOGGLE
592        PORT_DIPSETTING(    0x01, DEF_STR( On ) )
592      PORT_DIPSETTING(    0x01, DEF_STR( On ) )
593593
594    //   BUNDLE_OPTION: EXT.COMM.card -or- hard disk controller (marketed later).
595    //         - hard disc and COMM.extension exclude each other!
596    //         - connector J4 has 4 select lines (Option Select 1-4)
594   //  BUNDLE_OPTION: EXT.COMM.card -or- hard disk controller (marketed later).
595   //         - hard disc and COMM.extension exclude each other!
596   //         - connector J4 has 4 select lines (Option Select 1-4)
597597      PORT_START("BUNDLE OPTION")
598598      PORT_DIPNAME( 0x00, 0x00, "BUNDLE OPTION") PORT_TOGGLE
599599      PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
r31373r31374
604604      PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
605605      PORT_DIPSETTING(    0x01, DEF_STR( On ) )
606606
607   // W13 - W18 are used for factory tests   and affect the boot process -
608    PORT_START("W13")
607   // W13 - W18 are used for factory tests and affect the boot process -
608   PORT_START("W13")
609609      PORT_DIPNAME( 0x02, 0x02, "W13 (FACTORY TEST A, LEAVE OFF)") PORT_TOGGLE
610610      PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
611611      PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r31373r31374
644644
645645   /* configure RAM */
646646   address_space &program = m_maincpu->space(AS_PROGRAM);
647    if (m_inp8->read() < END_OF_RAM)
647   if (m_inp8->read() < END_OF_RAM)
648648   {
649649      program.unmap_readwrite(m_inp8->read(), END_OF_RAM);
650650   }
r31373r31374
713713// Interrupt handling and arbitration.  See 3.1.3.8 OF PC-100 spec.
714714void rainbow_state::update_8088_irqs()
715715{
716    static const int vectors[] = { 0x27, 0x26, 0x20 };
716   static const int vectors[] = { 0x27, 0x26, 0x20 };
717717
718718   if (m_irq_mask != 0)
719719   {
r31373r31374
820820    B F G M
821821    ( 1 means NOT present; 4-7 reserved )
822822*/
823    return   ( ((m_inp5->read() == 1)      ? 0 : 1)  |
824       ((m_inp6->read() == 1)      ? 0 : 2)  |
825       ((m_inp7->read() == 1)      ? 0 : 4)  |
826              ((m_inp8->read() > BOARD_RAM)   ? 0 : 8)  |
827              16 | 32 | 64 | 128 // to be verified.
823   return  ( ((m_inp5->read() == 1)        ? 0 : 1)  |
824         ((m_inp6->read() == 1)      ? 0 : 2)  |
825         ((m_inp7->read() == 1)      ? 0 : 4)  |
826            ((m_inp8->read() > BOARD_RAM)   ? 0 : 8)  |
827            16 | 32 | 64 | 128 // to be verified.
828828      );
829829}
830830
r31373r31374
842842   int data;
843843   if (COLD_BOOT == 2)
844844      data = 0;
845   else
845   else
846846      data = m_crtc->MHFU(1);
847   
847
848848   return (  ( (data > 0) ? 0x00 : 0x20) |// (L): status of MHFU flag => bit pos.5
849849               (   (INT88)    ? 0x00 : 0x40 ) |               // (L)
850850               (   (INTZ80)   ? 0x00 : 0x80 )                 // (L)
r31373r31374
935935D1 : INTZ80 L: (bit reads the INTZ80 bit sent by 8088 to interrupt Z80)
936936D0 : ZFLIP L: (read from the diagnostic control register of Z80A)
937937*/
938    static int last_track;
938   static int last_track;
939939   int track = m_fdc->track_r( space, 0);
940940   int fdc_step = 0;
941   int   fdc_ready =   0;
942   int   tk00 = 0;
941   int fdc_ready = 0;
942   int tk00 = 0;
943943
944944   if(m_unit != INVALID_DRIVE)
945945   {
r31373r31374
947947         fdc_step = 1;
948948      last_track = track;
949949
950      fdc_ready =   m_floppy->ready_r();
951      tk00 = ( m_floppy->trk00_r() != CLEAR_LINE );
950      fdc_ready = m_floppy->ready_r();
951      tk00 = ( m_floppy->trk00_r() != CLEAR_LINE );
952952   }
953953
954954   int last_dir = 0;      // FAKE LAST_DIR + WRITE_GATE FOR NOW.
955955   int fdc_write_gate = 1;
956956
957    // ***** ALL LOW ACTIVE - EXCEPT tk00 :
957      // ***** ALL LOW ACTIVE - EXCEPT tk00 :
958958   int data=(
959            (  (fdc_step)             ? 0x00 : 0x80 )        | 
960              (  (fdc_write_gate == 1)  ? 0x00 : 0x40 )         |
961           (  (tk00)                 ? 0x20 : 0x00 )        |
962           (  (last_dir == 1)        ? 0x00 : 0x10 )        |
963           (  (fdc_ready)            ? 0x00 : 0x08 )        |
959            (  (fdc_step)             ? 0x00 : 0x80 )        |
960            (  (fdc_write_gate == 1)  ? 0x00 : 0x40 )          |
961            (  (tk00)                 ? 0x20 : 0x00 )        |
962            (  (last_dir == 1)        ? 0x00 : 0x10 )        |
963            (  (fdc_ready)            ? 0x00 : 0x08 )        |
964964            (   (INT88)    ? 0x00 : 0x04 )                     |
965965            (   (INTZ80)   ? 0x00 : 0x02 )                     |
966966            (  (m_zflip)  ? 0x00 : 0x01 )
r31373r31374
10521052   {
10531053      m_floppy = con->get_device();
10541054         if (m_floppy)
1055         { 
1056            selected_drive = drive;
1055         {
1056            selected_drive = drive;
10571057
10581058            m_fdc->set_floppy(m_floppy);  // Sets new  _image device_
10591059            m_floppy->set_rpm(300.);
10601060
10611061            // RX50 board has additional 'side select' - ignored by WD emulation?
10621062            m_floppy->ss_w((data & 20) ? 1 : 0);
1063         }
1064   }
1063         }
1064   }
10651065
10661066   output_set_value("driveled0",  (selected_drive == 0) ? 1 : 0 );
10671067   output_set_value("driveled1",  (selected_drive == 1) ? 1 : 0 );
r31373r31374
10741074         m_unit = selected_drive;
10751075
10761076         if (MOTOR_DISABLE_counter == 0) // "one shot"
1077            MOTOR_DISABLE_counter = 4800; // 2400 = 500 ms
1077            MOTOR_DISABLE_counter = 4800; // 2400 = 500 ms
10781078
1079//         m_fdc->set_force_ready(force_ready);
1079//          m_fdc->set_force_ready(force_ready);
10801080   }
10811081   else
10821082   {
1083//          m_fdc->set_force_ready(false);
1084   }
1083//          m_fdc->set_force_ready(false);
1084   }
10851085
10861086         for(int f_num=0; f_num <= 3; f_num++)
10871087         {
10881088            floppy_connector *con = machine().device<floppy_connector>(names[f_num]);
1089            floppy_image_device *tmp_floppy = con->get_device();
1090            tmp_floppy->mon_w( (f_num == m_unit) ? CLEAR_LINE : ASSERT_LINE );
1089            floppy_image_device *tmp_floppy = con->get_device();
1090            tmp_floppy->mon_w( (f_num == m_unit) ? CLEAR_LINE : ASSERT_LINE );
10911091   }
10921092
10931093   if(m_unit == INVALID_DRIVE)
1094   {   
1095      data = data & (255 -3); 
1094   {
1095      data = data & (255 -3);
10961096      data = data | 8;  // MOTOR 0 OFF
10971097      data = data | 16; // MOTOR 1 OFF
10981098   }
r31373r31374
11001100   {
11011101      data = (data & (255 - 3)) | m_unit;
11021102
1103       if(m_unit < 2)
1103      if(m_unit < 2)
11041104         data = data & (255 - 8); // MOTOR 0 (for A or B)
11051105
11061106      if(m_unit > 1)
r31373r31374
11591159
11601160   if(m_unit != INVALID_DRIVE)
11611161   {
1162      if ( (m_diagnostic & 1) && !(data & 1) ) 
1163      {       
1162      if ( (m_diagnostic & 1) && !(data & 1) )
1163      {
11641164         m_fdc->soft_reset();
1165      }   
1165      }
11661166
1167      if ( !(m_diagnostic & 1) && (data & 1) ) 
1168       {   
1167      if ( !(m_diagnostic & 1) && (data & 1) )
1168      {
11691169         m_fdc->soft_reset(); // See formatter description p.197 or 5-13
11701170      }
11711171   }
11721172   // MISSING BITS (* not vital for normal operation, see diag.disk) -
11731173   // BIT 2: GRF VID SEL (0 = system module; 1 = graphics option)
1174   // BIT 3: PARITY TEST (1 = enables parity test on memory option board)       
1174   // BIT 3: PARITY TEST (1 = enables parity test on memory option board)
11751175   // * BIT 4: DIAG LOOPBACK (0 at power-up; 1 directs RX50 and DC12 output to printer port)
11761176   // * BIT 5: PORT LOOPBACK (1 enables loopback for COMM, PRINTER, KEYBOARD ports)
11771177
r31373r31374
13081308   MCFG_VT_VIDEO_RAM_CALLBACK(READ8(rainbow_state, read_video_ram_r))
13091309   MCFG_VT_VIDEO_CLEAR_VIDEO_INTERRUPT_CALLBACK(WRITELINE(rainbow_state, clear_video_interrupt))
13101310
1311   MCFG_FD1793x_ADD(FD1793_TAG, XTAL_24_0734MHz / 24) // no separate 1 Mhz quartz
1311   MCFG_FD1793x_ADD(FD1793_TAG, XTAL_24_0734MHz / 24) // no separate 1 Mhz quartz
13121312   MCFG_WD_FDC_FORCE_READY
13131313   MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":0", rainbow_floppies, "525qd", rainbow_state::floppy_formats)
13141314   MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":1", rainbow_floppies, "525qd", rainbow_state::floppy_formats)
1315   MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":2", rainbow_floppies, "525qd", rainbow_state::floppy_formats)
1316   MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":3", rainbow_floppies, "525qd", rainbow_state::floppy_formats) 
1315   MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":2", rainbow_floppies, "525qd", rainbow_state::floppy_formats)
1316   MCFG_FLOPPY_DRIVE_ADD(FD1793_TAG ":3", rainbow_floppies, "525qd", rainbow_state::floppy_formats)
13171317   MCFG_SOFTWARE_LIST_ADD("flop_list","rainbow")
13181318
13191319   MCFG_DEVICE_ADD("kbdser", I8251, 0)
trunk/src/mess/drivers/newbrain.c
r31373r31374
13341334   // devices
13351335   MCFG_CASSETTE_ADD("cassette")
13361336   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED)
1337   
1337
13381338   MCFG_CASSETTE_ADD("cassette2")
13391339   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED)
13401340
trunk/src/mess/drivers/poisk1.c
r31373r31374
239239   MCFG_PIC8259_ADD( "pic8259", INPUTLINE(":maincpu", 0), VCC, NULL )
240240
241241   MCFG_DEVICE_ADD("ppi8255n1", I8255A, 0)
242   MCFG_I8255_IN_PORTA_CB(READ8(p1_state, p1_ppi_porta_r))   /*60H*/
242   MCFG_I8255_IN_PORTA_CB(READ8(p1_state, p1_ppi_porta_r)) /*60H*/
243243   MCFG_I8255_OUT_PORTA_CB(WRITE8(p1_state, p1_ppi_porta_w))
244   MCFG_I8255_IN_PORTB_CB(READ8(p1_state, p1_ppi_portb_r))   /*69H*/
244   MCFG_I8255_IN_PORTB_CB(READ8(p1_state, p1_ppi_portb_r)) /*69H*/
245245   MCFG_I8255_IN_PORTC_CB(READ8(p1_state, p1_ppi_portc_r))
246   MCFG_I8255_OUT_PORTC_CB(WRITE8(p1_state, p1_ppi_portc_w))   /*6AH*/
246   MCFG_I8255_OUT_PORTC_CB(WRITE8(p1_state, p1_ppi_portc_w))   /*6AH*/
247247
248248   MCFG_DEVICE_ADD("ppi8255n2", I8255A, 0)
249   MCFG_I8255_OUT_PORTA_CB(WRITE8(p1_state, p1_ppi2_porta_w))   /*68H*/
250   MCFG_I8255_OUT_PORTB_CB(WRITE8(p1_state, p1_ppi2_portb_w))   /*61H*/
251   MCFG_I8255_IN_PORTC_CB(READ8(p1_state, p1_ppi2_portc_r))   /*62H*/
249   MCFG_I8255_OUT_PORTA_CB(WRITE8(p1_state, p1_ppi2_porta_w))  /*68H*/
250   MCFG_I8255_OUT_PORTB_CB(WRITE8(p1_state, p1_ppi2_portb_w))  /*61H*/
251   MCFG_I8255_IN_PORTC_CB(READ8(p1_state, p1_ppi2_portc_r))    /*62H*/
252252
253253   MCFG_DEVICE_ADD("isa", ISA8, 0)
254254   MCFG_ISA8_CPU(":maincpu")
trunk/src/mess/drivers/mbee.c
r31373r31374
705705
706706   MCFG_CASSETTE_ADD( "cassette" )
707707   MCFG_CASSETTE_FORMATS(mbee_cassette_formats)
708   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)   
708   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
709709MACHINE_CONFIG_END
710710
711711
r31373r31374
763763
764764   MCFG_CASSETTE_ADD( "cassette" )
765765   MCFG_CASSETTE_FORMATS(mbee_cassette_formats)
766   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)   
766   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
767767MACHINE_CONFIG_END
768768
769769static MACHINE_CONFIG_DERIVED( mbeepc, mbeeic )
trunk/src/mess/drivers/pc8801.c
r31373r31374
26082608   //MCFG_CENTRONICS_ADD("centronics", centronics_printers, "printer")
26092609   MCFG_CASSETTE_ADD("cassette")
26102610   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED)
2611   
2611
26122612   MCFG_SOFTWARE_LIST_ADD("tape_list","pc8801_cass")
26132613
26142614   MCFG_DEVICE_ADD(I8251_TAG, I8251, 0)
trunk/src/mess/drivers/osborne1.c
r31373r31374
166166 * - DEC 1820 double density: 40 tracks, 9 sectors per track, 512-byte sectors (180 KByte)
167167 *
168168 */
169 /*
169   /*
170170static LEGACY_FLOPPY_OPTIONS_START(osborne1 )
171171   LEGACY_FLOPPY_OPTION( osd, "img", "Osborne single density", basicdsk_identify_default, basicdsk_construct_default, NULL,
172      HEADS([1])
173      TRACKS([40])
174      SECTORS([10])
175      SECTOR_LENGTH([256])
176      FIRST_SECTOR_ID([1]))
172       HEADS([1])
173       TRACKS([40])
174       SECTORS([10])
175       SECTOR_LENGTH([256])
176       FIRST_SECTOR_ID([1]))
177177   LEGACY_FLOPPY_OPTION( odd, "img", "Osborne double density", basicdsk_identify_default, basicdsk_construct_default, NULL,
178      HEADS([1])
179      TRACKS([40])
180      SECTORS([5])
181      SECTOR_LENGTH([1024])
182      FIRST_SECTOR_ID([1]))
178       HEADS([1])
179       TRACKS([40])
180       SECTORS([5])
181       SECTOR_LENGTH([1024])
182       FIRST_SECTOR_ID([1]))
183183   LEGACY_FLOPPY_OPTION( ibm, "img", "IBM Personal Computer", basicdsk_identify_default, basicdsk_construct_default, NULL,
184      HEADS([1])
185      TRACKS([40])
186      SECTORS([8])
187      SECTOR_LENGTH([512])
188      FIRST_SECTOR_ID([1]))
184       HEADS([1])
185       TRACKS([40])
186       SECTORS([8])
187       SECTOR_LENGTH([512])
188       FIRST_SECTOR_ID([1]))
189189   LEGACY_FLOPPY_OPTION( xerox, "img", "Xerox 820 Computer", basicdsk_identify_default, basicdsk_construct_default, NULL,
190      HEADS([1])
191      TRACKS([40])
192      SECTORS([18])
193      SECTOR_LENGTH([128])
194      FIRST_SECTOR_ID([1]))
190       HEADS([1])
191       TRACKS([40])
192       SECTORS([18])
193       SECTOR_LENGTH([128])
194       FIRST_SECTOR_ID([1]))
195195   LEGACY_FLOPPY_OPTION( dec, "img", "DEC 1820 double density", basicdsk_identify_default, basicdsk_construct_default, NULL,
196      HEADS([1])
197      TRACKS([40])
198      SECTORS([9])
199      SECTOR_LENGTH([512])
200      FIRST_SECTOR_ID([1]))
196       HEADS([1])
197       TRACKS([40])
198       SECTORS([9])
199       SECTOR_LENGTH([512])
200       FIRST_SECTOR_ID([1]))
201201LEGACY_FLOPPY_OPTIONS_END
202202*/
203203
trunk/src/mess/drivers/sun3.c
r31373r31374
11/***************************************************************************
2
2
33  sun3.c: preliminary driver for Sun 3 and Sun 3x models.
4
4
55  status: 3/80 POSTs, 3/460 needs its unique RTC chip (also used by non-3x Sun 3s).
6
6
77  TODO:
88    - Z8530 SCC needs to actually speak serial so we can hook up the mouse and keyboard.
99    - Improve interrupt controller emulation.
r31373r31374
1313    - AM7990 LANCE chip support for everyone.
1414    - Figure out how the parallel printer port maps to Centronics and make it so.
1515    - Much more...
16 
17 
16
17
1818    Sun-3 Models
1919    ------------
2020
r31373r31374
218218                        factor. Serial and keyboard ports. External RAM,
219219                        framebuffer, and SCSI/ethernet boards
220220                        available.
221
221
222222    Sun3X notes from NetBSD and Linux:
223223
224224    RAM_END    0x40000000
r31373r31374
234234    IDPROM1    0x61000c00 (3/470)
235235    MEMREG     0x61001000
236236    INTERREG   0x61001400
237    SCC1      0x62000000 (keyboard/mouse)
237    SCC1       0x62000000 (keyboard/mouse)
238238    SCC2       0x62002000 (serial console)
239239    EEPROM     0x64000000
240240    IDPROM2    0x640007d8 (3/80)
r31373r31374
261261    +---+---+---+---+---+---+---+---+---+---+---+---+---+---.---.---+
262262    |BT |FPP|DMA| 0 |VID|RES|FPA|DIA| 0 |CCH|IOC|LBK|DCH|  UNUSED   |
263263    +---+---+---+---+---+---+---+---+---+---+---+---+---+---.---.---+
264
264
265265    Where: DCH = debug mode for system cache
266266    LBK = VME loopback
267267    IOC = I/O cache enable
r31373r31374
273273    DMA = enable system DVMA
274274    FPP = enable 68881/2 FPU
275275    BT  = 0 for boot state, 1 for normal state
276
276
277277    bad '030 MMU mapping: L fef82000 -> P 00000000
278
278
279279****************************************************************************/
280280
281281#include "emu.h"
r31373r31374
291291#include "formats/mfi_dsk.h"
292292
293293#define TIMEKEEPER_TAG  "timekpr"
294#define SCC1_TAG      "scc1"
295#define SCC2_TAG      "scc2"
296#define ESP_TAG         "esp"
297#define FDC_TAG         "fdc"
294#define SCC1_TAG        "scc1"
295#define SCC2_TAG        "scc2"
296#define ESP_TAG         "esp"
297#define FDC_TAG         "fdc"
298298
299299class sun3_state : public driver_device
300300{
301301public:
302302   sun3_state(const machine_config &mconfig, device_type type, const char *tag)
303     : driver_device(mconfig, type, tag),
303      : driver_device(mconfig, type, tag),
304304      m_maincpu(*this, "maincpu"),
305305      m_scc1(*this, SCC1_TAG),
306306      m_scc2(*this, SCC2_TAG),
r31373r31374
376376   AM_RANGE(0x61000800, 0x61000803) AM_READWRITE(diag_r, diag_w)
377377   AM_RANGE(0x61001000, 0x61001003) AM_READWRITE(memreg_r, memreg_w)
378378   AM_RANGE(0x61001004, 0x61001007) AM_READWRITE(memrerraddr_r, memrerraddr_w)
379   AM_RANGE(0x61001400, 0x61001403) AM_READWRITE(irqctrl_r, irqctrl_w)
379   AM_RANGE(0x61001400, 0x61001403) AM_READWRITE(irqctrl_r, irqctrl_w)
380380   AM_RANGE(0x62000000, 0x6200000f) AM_READWRITE8(scc1_r, scc1_w, 0xff00ff00)
381381   AM_RANGE(0x62002000, 0x6200200f) AM_READWRITE8(scc2_r, scc2_w, 0xff00ff00)
382382   AM_RANGE(0x63000000, 0x6301ffff) AM_ROM AM_REGION("user1",0)
r31373r31374
400400   AM_RANGE(0x61000800, 0x61000803) AM_READWRITE(diag_r, diag_w)
401401   AM_RANGE(0x61001000, 0x61001003) AM_READWRITE(memreg_r, memreg_w)
402402   AM_RANGE(0x61001004, 0x61001007) AM_READWRITE(memrerraddr_r, memrerraddr_w)
403   AM_RANGE(0x61001400, 0x61001403) AM_READWRITE(irqctrl_r, irqctrl_w)
403   AM_RANGE(0x61001400, 0x61001403) AM_READWRITE(irqctrl_r, irqctrl_w)
404404   AM_RANGE(0x62000000, 0x6200000f) AM_READWRITE8(scc1_r, scc1_w, 0xff00ff00)
405405   AM_RANGE(0x62002000, 0x6200200f) AM_READWRITE8(scc2_r, scc2_w, 0xff00ff00)
406406   AM_RANGE(0x63000000, 0x6301ffff) AM_ROM AM_REGION("user1",0)
r31373r31374
411411
412412READ32_MEMBER( sun3_state::p4id_r )
413413{
414   return (1<<24);   // 0 = hires bw2 1600x1280, 1 = bw2 1152x900, 0x45 is "Ibis" color, blt 0x68 is "Lego" color
414   return (1<<24); // 0 = hires bw2 1600x1280, 1 = bw2 1152x900, 0x45 is "Ibis" color, blt 0x68 is "Lego" color
415415}
416416
417417WRITE32_MEMBER( sun3_state::fdc_control_w )
r31373r31374
491491            m_memreg &= ~0x0c;
492492            break;
493493
494         case 0xffffffff:   // no address adjust, show all 4 lanes as problematic
494         case 0xffffffff:    // no address adjust, show all 4 lanes as problematic
495495            break;
496496      }
497497
498      m_bInBusErr = true;   // prevent recursion
498      m_bInBusErr = true; // prevent recursion
499499      m_maincpu->set_input_line_and_vector(M68K_IRQ_7, ASSERT_LINE, 2);
500500   }
501501
r31373r31374
535535
536536WRITE32_MEMBER(sun3_state::enable_w)
537537{
538//   printf("sun3x: %08x to enable (mask %08x)\n", data, mem_mask);
538//  printf("sun3x: %08x to enable (mask %08x)\n", data, mem_mask);
539539   COMBINE_DATA(&m_enable);
540540}
541541
r31373r31374
548548
549549WRITE32_MEMBER(sun3_state::buserr_w)
550550{
551//   printf("sun3x: %08x to buserr (mask %08x)\n", data, mem_mask);
551//  printf("sun3x: %08x to buserr (mask %08x)\n", data, mem_mask);
552552   COMBINE_DATA(&m_buserr);
553553}
554554
r31373r31374
559559
560560WRITE32_MEMBER(sun3_state::diag_w)
561561{
562//   printf("sun3x: %08x to diag (mask %08x)\n", data, mem_mask);
562//  printf("sun3x: %08x to diag (mask %08x)\n", data, mem_mask);
563563   COMBINE_DATA(&m_diag);
564564}
565565
r31373r31374
570570
571571WRITE32_MEMBER(sun3_state::printer_w)
572572{
573//   printf("sun3x: %08x to printer (mask %08x)\n", data, mem_mask);
573//  printf("sun3x: %08x to printer (mask %08x)\n", data, mem_mask);
574574   COMBINE_DATA(&m_printer);
575575}
576576
r31373r31374
581581
582582WRITE32_MEMBER(sun3_state::irqctrl_w)
583583{
584//   printf("sun3x: %08x to interrupt control (mask %08x)\n", data, mem_mask);
584//  printf("sun3x: %08x to interrupt control (mask %08x)\n", data, mem_mask);
585585   COMBINE_DATA(&m_irqctrl);
586586
587587   if (data & 0x01000000)
r31373r31374
603603         m_maincpu->set_input_line(M68K_IRQ_7, CLEAR_LINE);
604604      }
605605   }
606   else   // master enable clear, clear all interrupts
606   else    // master enable clear, clear all interrupts
607607   {
608608      m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE);
609609      m_maincpu->set_input_line(M68K_IRQ_2, CLEAR_LINE);
r31373r31374
622622
623623WRITE32_MEMBER(sun3_state::memreg_w)
624624{
625//   printf("sun3x: %08x to memory control (mask %08x)\n", data, mem_mask);
625//  printf("sun3x: %08x to memory control (mask %08x)\n", data, mem_mask);
626626   COMBINE_DATA(&m_memreg);
627627}
628628
r31373r31374
635635
636636WRITE32_MEMBER(sun3_state::memrerraddr_w)
637637{
638//   printf("sun3x: %08x to memory error address (mask %08x)\n", data, mem_mask);
638//  printf("sun3x: %08x to memory error address (mask %08x)\n", data, mem_mask);
639639   COMBINE_DATA(&m_memerraddr);
640640}
641641
r31373r31374
941941
942942   // default NVRAM: includes valid settings for console on framebuffer, boot from SCSI disk, Ethernet ID, more
943943   ROM_REGION( 0x800, TIMEKEEPER_TAG, 0 )
944   ROM_LOAD( "timekpr_380.bin", 0x000000, 0x000800, CRC(e76f1aae) SHA1(8e7c36e3928887a94a8133e8416ee4126c31edd7) )
944   ROM_LOAD( "timekpr_380.bin", 0x000000, 0x000800, CRC(e76f1aae) SHA1(8e7c36e3928887a94a8133e8416ee4126c31edd7) )
945945ROM_END
946946
947947ROM_START( sun3_460 )
trunk/src/mess/drivers/osbexec.c
r31373r31374
437437 * - DEC 1820 double density: 40 tracks, 9 sectors per track, 512-byte sectors (180 KByte)
438438 *
439439 */
440 /*
440   /*
441441static LEGACY_FLOPPY_OPTIONS_START(osbexec )
442442   LEGACY_FLOPPY_OPTION( osd, "img", "Osborne single density", basicdsk_identify_default, basicdsk_construct_default, NULL,
443      HEADS([1])
444      TRACKS([40])
445      SECTORS([10])
446      SECTOR_LENGTH([256])
447      FIRST_SECTOR_ID([1]))
443       HEADS([1])
444       TRACKS([40])
445       SECTORS([10])
446       SECTOR_LENGTH([256])
447       FIRST_SECTOR_ID([1]))
448448   LEGACY_FLOPPY_OPTION( odd, "img", "Osborne double density", basicdsk_identify_default, basicdsk_construct_default, NULL,
449      HEADS([1])
450      TRACKS([40])
451      SECTORS([5])
452      SECTOR_LENGTH([1024])
453      FIRST_SECTOR_ID([1]))
449       HEADS([1])
450       TRACKS([40])
451       SECTORS([5])
452       SECTOR_LENGTH([1024])
453       FIRST_SECTOR_ID([1]))
454454   LEGACY_FLOPPY_OPTION( ibm, "img", "IBM Personal Computer", basicdsk_identify_default, basicdsk_construct_default, NULL,
455      HEADS([1])
456      TRACKS([40])
457      SECTORS([8])
458      SECTOR_LENGTH([512])
459      FIRST_SECTOR_ID([1]))
455       HEADS([1])
456       TRACKS([40])
457       SECTORS([8])
458       SECTOR_LENGTH([512])
459       FIRST_SECTOR_ID([1]))
460460   LEGACY_FLOPPY_OPTION( xerox, "img", "Xerox 820 Computer", basicdsk_identify_default, basicdsk_construct_default, NULL,
461      HEADS([1])
462      TRACKS([40])
463      SECTORS([18])
464      SECTOR_LENGTH([128])
465      FIRST_SECTOR_ID([1]))
461       HEADS([1])
462       TRACKS([40])
463       SECTORS([18])
464       SECTOR_LENGTH([128])
465       FIRST_SECTOR_ID([1]))
466466   LEGACY_FLOPPY_OPTION( dec, "img", "DEC 1820 double density", basicdsk_identify_default, basicdsk_construct_default, NULL,
467      HEADS([1])
468      TRACKS([40])
469      SECTORS([9])
470      SECTOR_LENGTH([512])
471      FIRST_SECTOR_ID([1]))
467       HEADS([1])
468       TRACKS([40])
469       SECTORS([9])
470       SECTOR_LENGTH([512])
471       FIRST_SECTOR_ID([1]))
472472LEGACY_FLOPPY_OPTIONS_END
473473*/
474474
trunk/src/mess/drivers/c80.c
r31373r31374
269269
270270   MCFG_CASSETTE_ADD("cassette")
271271   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED )
272   
272
273273   MCFG_SPEAKER_STANDARD_MONO("mono")
274274   MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette")
275275   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
trunk/src/mess/drivers/kim1.c
r31373r31374
340340   MCFG_CASSETTE_ADD( "cassette" )
341341   MCFG_CASSETTE_FORMATS(kim1_cassette_formats)
342342   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)
343   
343
344344   MCFG_TIMER_DRIVER_ADD_PERIODIC("led_timer", kim1_state, kim1_update_leds, attotime::from_hz(60))
345345   MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", kim1_state, kim1_cassette_input, attotime::from_hz(44100))
346346MACHINE_CONFIG_END
trunk/src/mess/drivers/zx.c
r31373r31374
403403   MCFG_GFXDECODE_MODIFY("gfxdecode", zx81)
404404
405405   MCFG_CASSETTE_MODIFY( "cassette" )
406   MCFG_CASSETTE_FORMATS(zx81_p_format)   
406   MCFG_CASSETTE_FORMATS(zx81_p_format)
407407MACHINE_CONFIG_END
408408
409409static MACHINE_CONFIG_DERIVED( ts1000, zx81 )
trunk/src/mess/drivers/apogee.c
r31373r31374
266266   MCFG_CASSETTE_FORMATS(rka_cassette_formats)
267267   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
268268   MCFG_CASSETTE_INTERFACE("apogee_cass")
269   
269
270270   MCFG_SOFTWARE_LIST_ADD("cass_list","apogee")
271271MACHINE_CONFIG_END
272272
trunk/src/mess/drivers/ms0515.c
r31373r31374
134134INPUT_PORTS_END
135135/*
136136static LEGACY_FLOPPY_OPTIONS_START(ms0515)
137   LEGACY_FLOPPY_OPTION(ms0515, "dsk", "MS0515 disk image", basicdsk_identify_default, basicdsk_construct_default, NULL,
138      HEADS([1])
139      TRACKS([80])
140      SECTORS([10])
141      SECTOR_LENGTH([512])
142      FIRST_SECTOR_ID([0]))
137    LEGACY_FLOPPY_OPTION(ms0515, "dsk", "MS0515 disk image", basicdsk_identify_default, basicdsk_construct_default, NULL,
138        HEADS([1])
139        TRACKS([80])
140        SECTORS([10])
141        SECTOR_LENGTH([512])
142        FIRST_SECTOR_ID([0]))
143143LEGACY_FLOPPY_OPTIONS_END
144144*/
145145
trunk/src/mess/drivers/pyl601.c
r31373r31374
547547   /* Devices */
548548   MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_2MHz)
549549   MCFG_MC6845_SHOW_BORDER_AREA(false)
550   MCFG_MC6845_CHAR_WIDTH(8)   /* ? */
550   MCFG_MC6845_CHAR_WIDTH(8)   /* ? */
551551   MCFG_MC6845_UPDATE_ROW_CB(pyl601_state, pyl601_update_row)
552552
553553   MCFG_UPD765A_ADD("upd765", true, true)
r31373r31374
569569   MCFG_DEVICE_REMOVE("crtc")
570570   MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_2MHz)
571571   MCFG_MC6845_SHOW_BORDER_AREA(false)
572   MCFG_MC6845_CHAR_WIDTH(8)   /* ? */
572   MCFG_MC6845_CHAR_WIDTH(8)   /* ? */
573573   MCFG_MC6845_UPDATE_ROW_CB(pyl601_state, pyl601a_update_row)
574574MACHINE_CONFIG_END
575575
trunk/src/mess/drivers/gimix.c
r31373r31374
434434      {
435435         // write to disk
436436         m_fdc->data_w(m_ram->read(m_dma_current_addr));
437//         logerror("DMA: read from RAM %05x\n",m_dma_current_addr);
437//          logerror("DMA: read from RAM %05x\n",m_dma_current_addr);
438438      }
439439      else
440440      {
441441         // read from disk
442442         m_ram->write(m_dma_current_addr,m_fdc->data_r());
443//         logerror("DMA: write to RAM %05x\n",m_dma_current_addr);
443//          logerror("DMA: write to RAM %05x\n",m_dma_current_addr);
444444      }
445445      m_dma_current_addr++;
446446   }
r31373r31374
621621   /* CPU board U4: gimixf8.bin  - checksum 68DB - 2716 - GMXBUG09 V2.1 | (c)1981 GIMIX | $F800 I2716 */
622622      ROM_LOAD( "gimixf8.u4",  0x000000, 0x000800, CRC(7d60f838) SHA1(eb7546e8bbf50d33e181f3e86c3e4c5c9032cab2) )
623623/* CPU board U5: gimixv14.bin - checksum 97E2 - 2716 - GIMIX 6809 | AUTOBOOT | V1.4 I2716 */
624        ROM_LOAD( "gimixv14.u5", 0x000800, 0x000800, CRC(f795b8b9) SHA1(eda2de51cc298d94b36605437d900ce971b3b276) )
624      ROM_LOAD( "gimixv14.u5", 0x000800, 0x000800, CRC(f795b8b9) SHA1(eda2de51cc298d94b36605437d900ce971b3b276) )
625625/* CPU board U6: os9l1v11.bin - checksum 2C84 - 2716 - OS-9tmL1 V1 | GIMIX P1 " (c)1982 MSC
626626   CPU board U7: os9l1v12.bin - checksum 7694 - 2716 - OS-9tmL1 V1 | GIMIX P2-68 | (c)1982 MSC */
627        ROM_LOAD( "os9l1v11.u6", 0x001000, 0x000800, CRC(0d6527a0) SHA1(1435a22581c6e9e0ae338071a72eed646f429530) )
628        ROM_LOAD( "os9l1v12.u7", 0x001800, 0x000800, CRC(b3c65feb) SHA1(19d1ea1e84473b25c95cbb8449e6b9828567e998) )
627      ROM_LOAD( "os9l1v11.u6", 0x001000, 0x000800, CRC(0d6527a0) SHA1(1435a22581c6e9e0ae338071a72eed646f429530) )
628      ROM_LOAD( "os9l1v12.u7", 0x001800, 0x000800, CRC(b3c65feb) SHA1(19d1ea1e84473b25c95cbb8449e6b9828567e998) )
629629
630630/* Hard drive controller board 2 (XEBEC board) 11H: gimixhd.bin - checksum 2436 - 2732 - 104521D */
631      ROM_REGION( 0x10000, "xebec", 0)
632        ROM_LOAD( "gimixhd.h11",  0x000000, 0x001000, CRC(35c12201) SHA1(51ac9052f9757d79c7f5bd3aa5d8421e98cfcc37) )
631   ROM_REGION( 0x10000, "xebec", 0)
632      ROM_LOAD( "gimixhd.h11",  0x000000, 0x001000, CRC(35c12201) SHA1(51ac9052f9757d79c7f5bd3aa5d8421e98cfcc37) )
633633ROM_END
634634
635635COMP( 1980, gimix,    0,      0,      gimix,        gimix, driver_device, 0,      "Gimix",  "Gimix 6809 System",  GAME_IS_SKELETON | GAME_NOT_WORKING | GAME_NO_SOUND )
trunk/src/mess/drivers/isbc.c
r31373r31374
199199   MCFG_CPU_PROGRAM_MAP(isbc86_mem)
200200   MCFG_CPU_IO_MAP(isbc_io)
201201   MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic_0", pic8259_device, inta_cb)
202   
202
203203   MCFG_PIC8259_ADD("pic_0", INPUTLINE(":maincpu", 0), VCC, NULL)
204204
205205   MCFG_DEVICE_ADD("pit", PIT8253, 0)
r31373r31374
231231   MCFG_CPU_PROGRAM_MAP(rpc86_mem)
232232   MCFG_CPU_IO_MAP(rpc86_io)
233233   MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic_0", pic8259_device, inta_cb)
234   
234
235235   MCFG_PIC8259_ADD("pic_0", INPUTLINE(":maincpu", 0), VCC, NULL)
236236
237237   MCFG_DEVICE_ADD("pit", PIT8253, 0)
r31373r31374
266266   MCFG_CPU_PROGRAM_MAP(isbc286_mem)
267267   MCFG_CPU_IO_MAP(isbc286_io)
268268   MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic_0", pic8259_device, inta_cb)
269   
269
270270   MCFG_PIC8259_ADD("pic_0", INPUTLINE(":maincpu", 0), VCC, READ8(isbc_state, get_slave_ack))
271271   MCFG_PIC8259_ADD("pic_1", DEVWRITELINE("pic_0", pic8259_device, ir7_w), GND, NULL)
272272
trunk/src/mess/drivers/mbc200.c
r31373r31374
140140
141141void mbc200_state::machine_start()
142142{
143//   floppy_image_device *floppy = NULL;
144//   floppy = m_floppy0->get_device();
143//  floppy_image_device *floppy = NULL;
144//  floppy = m_floppy0->get_device();
145145// floppy1 not supported currently
146//   m_fdc->set_floppy(floppy);
146//  m_fdc->set_floppy(floppy);
147147
148//   if (floppy)
149//      floppy->mon_w(0);
148//  if (floppy)
149//      floppy->mon_w(0);
150150
151151   m_floppy0->floppy_mon_w(0);
152152   m_floppy1->floppy_mon_w(0);
r31373r31374
169169};
170170
171171//static SLOT_INTERFACE_START( mbc200_floppies )
172//   SLOT_INTERFACE( "525dd", FLOPPY_525_SSDD )
172//  SLOT_INTERFACE( "525dd", FLOPPY_525_SSDD )
173173//SLOT_INTERFACE_END
174174
175175MC6845_UPDATE_ROW( mbc200_state::update_row )
trunk/src/mess/drivers/qx10.c
r31373r31374
776776   MCFG_PIC8259_ADD("pic8259_master", INPUTLINE("maincpu", 0), VCC, READ8(qx10_state, get_slave_ack))
777777   MCFG_PIC8259_ADD("pic8259_slave", DEVWRITELINE("pic8259_master", pic8259_device, ir7_w), GND, NULL)
778778
779   MCFG_UPD7201_ADD("upd7201", MAIN_CLK/4, 0, 0, 0, 0)   // channel b clock set by pit2 channel 2
779   MCFG_UPD7201_ADD("upd7201", MAIN_CLK/4, 0, 0, 0, 0) // channel b clock set by pit2 channel 2
780780   // Channel A: Keyboard
781781   MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("kbd", rs232_port_device, write_txd))
782782   // Channel B: RS232
trunk/src/mess/drivers/ptcsol.c
r31373r31374
750750   MCFG_CASSETTE_ADD( "cassette" )
751751   MCFG_CASSETTE_FORMATS(sol20_cassette_formats)
752752   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
753   
753
754754   MCFG_CASSETTE_ADD( "cassette2" )
755755   MCFG_CASSETTE_FORMATS(sol20_cassette_formats)
756756   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
757   
757
758758   MCFG_DEVICE_ADD( "uart", AY31015, 0 )
759759   MCFG_AY31015_TX_CLOCK(4800.0)
760760   MCFG_AY31015_RX_CLOCK(4800.0)
trunk/src/mess/drivers/vt100.c
r31373r31374
454454static MACHINE_CONFIG_DERIVED( vt102, vt100 )
455455   MCFG_CPU_REPLACE("maincpu",I8085A, XTAL_24_8832MHz / 9)
456456   MCFG_CPU_PROGRAM_MAP(vt100_mem)
457   MCFG_CPU_IO_MAP(vt100_io)   
457   MCFG_CPU_IO_MAP(vt100_io)
458458   MCFG_CPU_VBLANK_INT_DRIVER("screen", vt100_state,  vt100_vertical_interrupt)
459459   MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(vt100_state,vt100_irq_callback)
460460MACHINE_CONFIG_END
trunk/src/mess/drivers/mz700.c
r31373r31374
367367   MCFG_CASSETTE_FORMATS(mz700_cassette_formats)
368368   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
369369   MCFG_CASSETTE_INTERFACE("mz_cass")
370   
370
371371   MCFG_SOFTWARE_LIST_ADD("cass_list","mz700_cass")
372372
373373   /* internal ram */
trunk/src/mess/drivers/zorba.c
r31373r31374
322322   /* devices */
323323   MCFG_DEVICE_ADD("dma", Z80DMA, XTAL_24MHz/6)
324324   // busack on cpu connects to bai pin
325   MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(zorba_state, busreq_w))    //connects to busreq on cpu
326   MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))   // connects to IRQ0 on cpu
325   MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(zorba_state, busreq_w))  //connects to busreq on cpu
326   MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))   // connects to IRQ0 on cpu
327327   //ba0 - not connected
328328   MCFG_Z80DMA_IN_MREQ_CB(READ8(zorba_state, memory_read_byte))
329329   MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(zorba_state, memory_write_byte))
trunk/src/mess/drivers/minicom.c
r31373r31374
22// copyright-holders: Felipe Sanches
33/***************************************************************************
44
5   Ultratec Minicom IV
6   http://www.ultratec.com/ttys/non-printing/minicom.php
5    Ultratec Minicom IV
6    http://www.ultratec.com/ttys/non-printing/minicom.php
77
88  Driver by Felipe Sanches
99
r31373r31374
2626 toggling T0 and then the other half of data is written to P0 again but toggling T1 afterwards.
2727
2828  Changelog:
29
29
3030   2014 JUL 19 [Felipe Sanches]:
3131   * Got the display working except for a few glitches
3232
r31373r31374
7171   memset(m_p, 0, 4);
7272   m_digit_index = 0;
7373   m_display_data = 0;
74   
74
7575   // register for savestates
7676   save_item(NAME(m_p));
7777   save_item(NAME(m_digit_index));
r31373r31374
8989
9090READ8_MEMBER(minicom_state::minicom_io_r)
9191{
92    switch (offset)
93    {
92   switch (offset)
93   {
9494      case 1:
9595         //P1.3 seems to be an indicator of whether or not we have a printer device attached.
9696         // at address 0xABF the code checks this flag in order to decide which string to display:
9797         // "MINIPRINT IS RESET" or "MINICOM IS RESET"
9898         return PRINTER_ATTACHED << 3;
99        case 2:
100//         return 0; //para a palestra no Garoa... :-)
99      case 2:
100//          return 0; //para a palestra no Garoa... :-)
101101         return 1; //to skip the "NO POWER" warning. I'm not sure why.
102102      default:
103103#if LOG_IO_PORTS
r31373r31374
122122#define P3_UNKNOWN_BITS (0xFF & ~((1 << 4)|(1 << 5)))
123123WRITE8_MEMBER(minicom_state::minicom_io_w)
124124{
125    switch (offset)
126    {
127        case 0x00:
128        {
129            m_p[offset]=data;
130            break;
131        }
132        case 0x01:
133        {
134            if (data != m_p[offset])
135            {
125   switch (offset)
126   {
127      case 0x00:
128      {
129         m_p[offset]=data;
130         break;
131      }
132      case 0x01:
133      {
134         if (data != m_p[offset])
135         {
136136#if LOG_IO_PORTS
137137            UINT8 changed = m_p[offset] ^ data;
138138            if (changed ^ P1_UNKNOWN_BITS)
139139            {
140                   printf("Write to P1: %02X changed: (        ) (", data);
140               printf("Write to P1: %02X changed: (        ) (", data);
141141               printbits(changed);
142142               printf(") (        ) (        )\n");
143143            }
r31373r31374
147147               m_digit_index--;
148148               if (m_digit_index<0) m_digit_index = 19;
149149            }
150                m_p[offset]=data;
151            }
152            break;
153        }
154        case 0x02:
155        {
156            if (data != m_p[offset])
157            {
150            m_p[offset]=data;
151         }
152         break;
153      }
154      case 0x02:
155      {
156         if (data != m_p[offset])
157         {
158158#if LOG_IO_PORTS
159159            UINT8 changed = m_p[offset] ^ data;
160160            if (changed ^ P2_UNKNOWN_BITS)
161161            {
162                   printf("Write to P2: %02X changed: (        ) (        ) (", data);
162               printf("Write to P2: %02X changed: (        ) (        ) (", data);
163163               printbits(changed);
164164               printf(") (        )\n");
165165            }
166166#endif
167                m_p[offset]=data;
168            }
169            break;
170        }
171        case 0x03:
172        {
173            if (data != m_p[offset])
174            {
167            m_p[offset]=data;
168         }
169         break;
170      }
171      case 0x03:
172      {
173         if (data != m_p[offset])
174         {
175175            UINT8 changed = m_p[offset] ^ data;
176176#if LOG_IO_PORTS
177177            if (changed ^ P3_UNKNOWN_BITS)
178178            {
179                   printf("Write to P3: %02X changed: (        ) (        ) (        ) (", data);
179               printf("Write to P3: %02X changed: (        ) (        ) (        ) (", data);
180180               printbits(changed);
181181               printf(")\n");
182182            }
r31373r31374
198198            {
199199               output_set_digit_value(m_digit_index, BITSWAP16(m_display_data,  9,  1,  3, 11, 12,  4,  2, 10, 14, 6,  7, 5,  0, 15,  13, 8) & 0x3FFF);
200200            }
201                m_p[offset]=data;
202            }
203            break;
204        }
205    }
201            m_p[offset]=data;
202         }
203         break;
204      }
205   }
206206}
207207
208208DRIVER_INIT_MEMBER( minicom_state, minicom )
r31373r31374
216216
217217   /* video hardware */
218218   /* fluorescent 14-segment display forming a row of 20 characters */
219   MCFG_DEFAULT_LAYOUT(layout_minicom)
219   MCFG_DEFAULT_LAYOUT(layout_minicom)
220220
221221/* TODO: Map the keyboard rows/cols inputs (43-key, 4-row keyboard) */
222222
r31373r31374
230230
231231/*    YEAR  NAME      PARENT  COMPAT  MACHINE     INPUT     CLASS          INIT     COMPANY     FULLNAME         FLAGS */
232232COMP( 1997, minicom,   0,     0,      minicom,    0,        minicom_state, minicom, "Ultratec", "Minicom IV",    GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND) /* fw release data: 11th Aug 1997 */
233//COMP( 2002, minicom,   0,     0,      minicom,    0,        minicom_state, minicom, "Ultratec", "Minicom IV",    GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND) /* fw release data: 19th Apr 2002 - Seen at a subway station in São Paulo, Brazil (Metrô Trianon MASP) */
233//COMP( 2002, minicom,   0,     0,      minicom,    0,        minicom_state, minicom, "Ultratec", "Minicom IV",    GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND) /* fw release data: 19th Apr 2002 - Seen at a subway station in S??o Paulo, Brazil (Metr?? Trianon MASP) */
trunk/src/mess/drivers/bml3.c
r31373r31374
10191019   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
10201020
10211021   /* slot devices */
1022   MCFG_DEVICE_ADD("bml3bus", BML3BUS, 0)
1022   MCFG_DEVICE_ADD("bml3bus", BML3BUS, 0)
10231023   MCFG_BML3BUS_CPU("maincpu")
10241024   MCFG_BML3BUS_OUT_NMI_CB(WRITELINE(bml3_state, bml3bus_nmi_w))
10251025   MCFG_BML3BUS_OUT_IRQ_CB(WRITELINE(bml3_state, bml3bus_irq_w))
trunk/src/mess/drivers/fmtowns.c
r31373r31374
27492749   MCFG_UPD71071_DMA_READ_1_CB(READ16(towns_state, towns_scsi_dma_r))
27502750   MCFG_UPD71071_DMA_READ_3_CB(READ16(towns_state, towns_cdrom_dma_r))
27512751   MCFG_UPD71071_DMA_WRITE_0_CB(WRITE16(towns_state, towns_fdc_dma_w))
2752   MCFG_UPD71071_DMA_WRITE_1_CB(WRITE16(towns_state, towns_scsi_dma_w))   
2752   MCFG_UPD71071_DMA_WRITE_1_CB(WRITE16(towns_state, towns_scsi_dma_w))
27532753   MCFG_DEVICE_ADD("dma_2", UPD71071, 0)
27542754   MCFG_UPD71071_CPU("maincpu")
27552755   MCFG_UPD71071_CLOCK(4000000)
r31373r31374
27572757   MCFG_UPD71071_DMA_READ_1_CB(READ16(towns_state, towns_scsi_dma_r))
27582758   MCFG_UPD71071_DMA_READ_3_CB(READ16(towns_state, towns_cdrom_dma_r))
27592759   MCFG_UPD71071_DMA_WRITE_0_CB(WRITE16(towns_state, towns_fdc_dma_w))
2760   MCFG_UPD71071_DMA_WRITE_1_CB(WRITE16(towns_state, towns_scsi_dma_w))   
2760   MCFG_UPD71071_DMA_WRITE_1_CB(WRITE16(towns_state, towns_scsi_dma_w))
27612761
27622762   //MCFG_VIDEO_START_OVERRIDE(towns_state,towns)
27632763
trunk/src/mess/drivers/nascom1.c
r31373r31374
281281   MCFG_AY31015_RX_CLOCK(( XTAL_16MHz / 16 ) / 256)
282282   MCFG_AY51013_READ_SI_CB(READ8(nascom1_state, nascom1_hd6402_si))
283283   MCFG_AY51013_WRITE_SO_CB(WRITE8(nascom1_state, nascom1_hd6402_so))
284   
284
285285   MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_16MHz/8)
286286
287287   /* devices */
trunk/src/mess/drivers/mc1000.c
r31373r31374
449449   /* devices */
450450   MCFG_CASSETTE_ADD("cassette")
451451   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
452   
452
453453   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_printers, "printer")
454454   MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(mc1000_state, write_centronics_busy))
455455
trunk/src/mess/drivers/hprot1.c
r31373r31374
1515   * new derivative "CARD II PCB rev.6"
1616   * fixed LCD rendering (now both lines are displayed properly)
1717   * inverted logic of the inputs so that now we can navigate the menu
18
18
1919   2014 JAN 03 [Felipe Sanches]:
2020   * Initial driver skeleton
2121   * Address lines bitswaping
r31373r31374
126126   AM_RANGE(0xc020,0xc020) AM_MIRROR(0x13cf) AM_DEVREAD("hd44780", hd44780_device, control_read)
127127   AM_RANGE(0xc030,0xc030) AM_MIRROR(0x13cf) AM_DEVREAD("hd44780", hd44780_device, data_read)
128128/*TODO: attach the watchdog/brownout reset device:
129   AM_RANGE(0xe000,0xe0??) AM_MIRROR(?) AM_DEVREAD("adm965an", adm965an_device, data_read) */
129    AM_RANGE(0xe000,0xe0??) AM_MIRROR(?) AM_DEVREAD("adm965an", adm965an_device, data_read) */
130130
131131   //AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READWRITE(henry_io_r, henry_io_w)
132132   AM_RANGE(MCS51_PORT_P0, MCS51_PORT_P3) AM_READ(henry_io_r)
r31373r31374
147147
148148static INPUT_PORTS_START( hprot_jumpers )
149149/*
150There is a set of 3 jumpers that switch the communications circuitry between a
150There is a set of 3 jumpers that switch the communications circuitry between a
151151RS232 chip (U8: MAX232AN) and a differential bus transceiver (U7: SN65176BP)
152152
153It seems that all three jumpers must select the same configuration:
153It seems that all three jumpers must select the same configuration:
154154eighter differential bus or RS232.
155155And I don't see yet how this could affect the emulation of the device, so, for now, I'll
156156simply leave this note here but not actually include this details in the driver code.
157157
158   PORT_START("jumpers")
159   PORT_DIPNAME( 0x01, 0x01, "TX")
160   PORT_DIPSETTING(    0x01, "differential bus")
161   PORT_DIPSETTING(    0x00, "RS232")
162   PORT_DIPNAME( 0x02, 0x02, "RX")
163   PORT_DIPSETTING(    0x02, "differential bus")
164   PORT_DIPSETTING(    0x00, "RS232")
165   PORT_DIPNAME( 0x04, 0x04, "CPU-TX")
166   PORT_DIPSETTING(    0x04, "differential bus")
167   PORT_DIPSETTING(    0x00, "RS232")
158    PORT_START("jumpers")
159    PORT_DIPNAME( 0x01, 0x01, "TX")
160    PORT_DIPSETTING(    0x01, "differential bus")
161    PORT_DIPSETTING(    0x00, "RS232")
162    PORT_DIPNAME( 0x02, 0x02, "RX")
163    PORT_DIPSETTING(    0x02, "differential bus")
164    PORT_DIPSETTING(    0x00, "RS232")
165    PORT_DIPNAME( 0x04, 0x04, "CPU-TX")
166    PORT_DIPSETTING(    0x04, "differential bus")
167    PORT_DIPSETTING(    0x00, "RS232")
168168*/
169169INPUT_PORTS_END
170170
r31373r31374
337337   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
338338
339339   /* TODO: add an RS232 interface (emulate MAX232N chip)
340 (the board has GND/VCC/RX/TX pins available in a connector) */
340   (the board has GND/VCC/RX/TX pins available in a connector) */
341341
342342   /* TODO: add an I2C interface (the board has GND/VCC/SDA/SCL pins available in a connector) */
343343MACHINE_CONFIG_END
trunk/src/mess/drivers/tiki100.c
r31373r31374
697697
698698   MCFG_CASSETTE_ADD(CASSETTE_TAG)
699699   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED)
700   
700
701701   MCFG_TIMER_DRIVER_ADD_PERIODIC("tape", tiki100_state, tape_tick, attotime::from_hz(44100))
702702
703703   /* sound hardware */
trunk/src/mess/drivers/ace.c
r31373r31374
698698   MCFG_CASSETTE_ADD("cassette")
699699   MCFG_CASSETTE_FORMATS(ace_cassette_formats)
700700   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)
701   
701
702702   MCFG_SNAPSHOT_ADD("snapshot", ace_state, ace, "ace", 1)
703703
704704   MCFG_DEVICE_ADD(I8255_TAG, I8255A, 0)
trunk/src/mess/drivers/abc1600.c
r31373r31374
880880   MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr))
881881   MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts))
882882   MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE(ABC_KEYBOARD_PORT_TAG, abc_keyboard_port_device, txd_w))
883   MCFG_Z80DART_OUT_INT_CB(INPUTLINE(MC68008P8_TAG, M68K_IRQ_5))    // shared with SCC
883   MCFG_Z80DART_OUT_INT_CB(INPUTLINE(MC68008P8_TAG, M68K_IRQ_5))    // shared with SCC
884884
885885   MCFG_DEVICE_ADD(Z8530B1_TAG, SCC8530, XTAL_64MHz/16)
886886   MCFG_Z8530_INTRQ_CALLBACK(INPUTLINE(MC68008P8_TAG, M68K_IRQ_5))
trunk/src/mess/drivers/coco3.c
r31373r31374
273273   MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w))
274274   MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI))
275275   MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT))
276     
276
277277   MCFG_COCO_VHD_ADD(VHD0_TAG)
278278   MCFG_COCO_VHD_ADD(VHD1_TAG)
279279
trunk/src/mess/drivers/fp1100.c
r31373r31374
192192
193193WRITE8_MEMBER( fp1100_state::main_to_sub_w )
194194{
195//   machine().scheduler().synchronize(); // force resync
196//   m_subcpu->set_input_line(UPD7810_INTF2, ASSERT_LINE);
195//  machine().scheduler().synchronize(); // force resync
196//  m_subcpu->set_input_line(UPD7810_INTF2, ASSERT_LINE);
197197   m_sub_latch = data;
198   if (LOG) printf("%s: From main:%X\n",machine().describe_context(),data);
198   if (LOG) printf("%s: From main:%X\n",machine().describe_context(),data);
199199}
200200
201201READ8_MEMBER( fp1100_state::sub_to_main_r )
202202{
203//   machine().scheduler().synchronize(); // force resync
204//   m_maincpu->set_input_line(0, CLEAR_LINE);
203//  machine().scheduler().synchronize(); // force resync
204//  m_maincpu->set_input_line(0, CLEAR_LINE);
205205   if (LOG) printf("%s: To main:%X\n",machine().describe_context(),m_main_latch);
206206   return m_main_latch;
207207}
r31373r31374
235235
236236READ8_MEMBER( fp1100_state::main_to_sub_r )
237237{
238//   machine().scheduler().synchronize(); // force resync
239//   m_subcpu->set_input_line(UPD7810_INTF2, CLEAR_LINE);
238//  machine().scheduler().synchronize(); // force resync
239//  m_subcpu->set_input_line(UPD7810_INTF2, CLEAR_LINE);
240240   if (LOG) printf("%s: To sub:%X\n",machine().describe_context(),m_sub_latch);
241241   return m_sub_latch;
242242}
243243
244244WRITE8_MEMBER( fp1100_state::sub_to_main_w )
245245{
246//   machine().scheduler().synchronize(); // force resync
247//   m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0xf0);
246//  machine().scheduler().synchronize(); // force resync
247//  m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, 0xf0);
248248   m_main_latch = data;
249249   if (LOG) printf("%s: From sub:%X\n",machine().describe_context(),data);
250250}
r31373r31374
594594
595595INTERRUPT_GEN_MEMBER(fp1100_state::fp1100_vblank_irq)
596596{
597//   if BIT(m_irq_mask, 4)
598//      m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xf8);
597//  if BIT(m_irq_mask, 4)
598//      m_maincpu->set_input_line_and_vector(0, HOLD_LINE, 0xf8);
599599}
600600
601601MACHINE_RESET_MEMBER( fp1100_state, fp1100 )
trunk/src/mess/drivers/pve500.c
r31373r31374
1111  Notes:
1212  One can induce the self-diagnose by booting the device holding LEARN and P2-RESET buttons togheter
1313  With the default keyboard map, this can be done by holding keys L and S while pressing F3.
14   (Don't forget to unlock the keyboard by using the UI TOGGLE key)
14    (Don't forget to unlock the keyboard by using the UI TOGGLE key)
1515
16   This self-diagnose routine displays the value C817, which is the checksum value of the subcpu ROM
16    This self-diagnose routine displays the value C817, which is the checksum value of the subcpu ROM
1717  and afterwards it displays the following message:
1818
1919  SELFdIAG Error___ _F3 F3_CtC3c
r31373r31374
2121  which means it detected an error in the CTC circuitry (it means we're emulating it wrong!)
2222  F3 is the coordinate of the subcpu EEPROM chip in the PCB.
2323
24   According to the service manual, this error code means: "ICF3 CTC CH-3 counter operation failure (No interruption)"
24    According to the service manual, this error code means: "ICF3 CTC CH-3 counter operation failure (No interruption)"
2525
2626  Known issues:
2727  There's still an annoying blinking in the 7-seg display.
2828
2929  Changelog:
3030
31    2014 JUN 24 [Felipe Sanches]:
31    2014 JUN 24 [Felipe Sanches]:
3232   * figured out the multiplexing signals for the 7seg display
3333
34    2014 JUN 23 [Felipe Sanches]:
34    2014 JUN 23 [Felipe Sanches]:
3535   * hooked-up the RS422 ports
3636
3737   2014 JAN 14 [Felipe Sanches]:
r31373r31374
269269
270270READ8_MEMBER(pve500_state::io_expander_r)
271271{
272//   printf("READ IO_EXPANDER_PORT%c\n", 'A'+offset);
272//  printf("READ IO_EXPANDER_PORT%c\n", 'A'+offset);
273273   switch (offset){
274274      case IO_EXPANDER_PORTA:
275275         return io_SC;
r31373r31374
351351}
352352
353353static MACHINE_CONFIG_START( pve500, pve500_state )
354  /* Main CPU */
354   /* Main CPU */
355355   MCFG_CPU_ADD("maincpu", TMPZ84C015, XTAL_12MHz / 2) /* TMPZ84C015BF-6 */
356356   MCFG_CPU_PROGRAM_MAP(maincpu_prg)
357357   MCFG_CPU_IO_MAP(maincpu_io)
r31373r31374
369369   MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("player2", rs232_port_device, write_txd))
370370   MCFG_Z80DART_OUT_TXDB_CB(DEVWRITELINE("edl_inout", rs232_port_device, write_txd))
371371
372  /* Secondary CPU */
372   /* Secondary CPU */
373373   MCFG_CPU_ADD("subcpu", TMPZ84C015, XTAL_12MHz / 2) /* TMPZ84C015BF-6 */
374374   MCFG_CPU_PROGRAM_MAP(subcpu_prg)
375375   MCFG_CPU_IO_MAP(subcpu_io)
trunk/src/mess/drivers/exelv.c
r31373r31374
9999   UINT8   m_wx319;    /* data of 74sl374 labeled wx319 */
100100   DECLARE_PALETTE_INIT(exelv);
101101   TIMER_DEVICE_CALLBACK_MEMBER(exelv_hblank_interrupt);
102   
102
103103   DECLARE_DEVICE_IMAGE_LOAD_MEMBER( exelvision_cartridge );
104   
104
105105};
106106
107107
r31373r31374
223223
224224READ8_MEMBER(exelv_state::mailbox_wx319_r)
225225{
226    logerror("[TMS7220] reading mailbox %d\n", m_wx319);
226   logerror("[TMS7220] reading mailbox %d\n", m_wx319);
227227   return m_wx319;
228228}
229229
r31373r31374
285285READ8_MEMBER(exelv_state::tms7041_porta_r)
286286{
287287   UINT8 data = 0x00;
288    static UINT8 data_last=0;
288   static UINT8 data_last=0;
289289
290    // TMS5220 OK
290   // TMS5220 OK
291291   data |= m_tms5220c->intq_r() ? 0x08 : 0x00; // A3
292292   data |= m_tms5220c->readyq_r() ? 0x80 : 0x00; // A7
293293
294    // TMS7220
294   // TMS7220
295295   data |= (m_tms7020_portb & 0x01 ) ? 0x04 : 0x00; // A2
296296   data |= (m_tms7020_portb & 0x02) ? 0x10 : 0x00; // A4
297   
297
298298   // SERIAL PORT
299299
300    if (data!=data_last) {
301       logerror("tms7041_porta_r %x\n",data);
302    }
303    data_last=data;
304   
300   if (data!=data_last) {
301      logerror("tms7041_porta_r %x\n",data);
302   }
303   data_last=data;
304
305305   return data;
306306}
307307
r31373r31374
324324   m_tms5220c->wsq_w((data & 0x01) ? 1 : 0);
325325   m_tms5220c->rsq_w((data & 0x02) ? 1 : 0);
326326
327    logerror("TMS7020 %s int1\n",((data & 0x04) ? "clear" : "assert"));
327   logerror("TMS7020 %s int1\n",((data & 0x04) ? "clear" : "assert"));
328328   m_maincpu->set_input_line(TMS7000_INT1_LINE, (data & 0x04) ? CLEAR_LINE : ASSERT_LINE);
329329
330330   /* Check for low->high transition on B6 */
r31373r31374
375375READ8_MEMBER(exelv_state::tms7041_portd_r)
376376{
377377   UINT8 data = 0xff;
378   data=m_tms5220c->status_r(space, 0, data);
378   data=m_tms5220c->status_r(space, 0, data);
379379   logerror("tms7041_portd_r\n");
380380   return data;
381381}
r31373r31374
416416
417417static ADDRESS_MAP_START(tms7020_mem, AS_PROGRAM, 8, exelv_state)
418418   AM_RANGE(0x0080, 0x00ff) AM_NOP
419    AM_RANGE(0x0124, 0x0124) AM_DEVREAD("tms3556", tms3556_device, vram_r)
420    AM_RANGE(0x0125, 0x0125) AM_DEVREAD("tms3556", tms3556_device, reg_r)
421    AM_RANGE(0x0128, 0x0128) AM_DEVREAD("tms3556", tms3556_device, initptr_r)
422    AM_RANGE(0x012d, 0x012d) AM_DEVWRITE("tms3556", tms3556_device, reg_w)
423    AM_RANGE(0x012e, 0x012e) AM_DEVWRITE("tms3556", tms3556_device, vram_w)
419   AM_RANGE(0x0124, 0x0124) AM_DEVREAD("tms3556", tms3556_device, vram_r)
420   AM_RANGE(0x0125, 0x0125) AM_DEVREAD("tms3556", tms3556_device, reg_r)
421   AM_RANGE(0x0128, 0x0128) AM_DEVREAD("tms3556", tms3556_device, initptr_r)
422   AM_RANGE(0x012d, 0x012d) AM_DEVWRITE("tms3556", tms3556_device, reg_w)
423   AM_RANGE(0x012e, 0x012e) AM_DEVWRITE("tms3556", tms3556_device, vram_w)
424424
425425   AM_RANGE(0x0130, 0x0130) AM_READWRITE(mailbox_wx319_r, mailbox_wx318_w)
426426   AM_RANGE(0x0200, 0x7fff) AM_ROMBANK("bank1")                                /* system ROM */
r31373r31374
444444
445445static ADDRESS_MAP_START(tms7040_mem, AS_PROGRAM, 8, exelv_state)
446446   AM_RANGE(0x0080, 0x00ff) AM_NOP
447    AM_RANGE(0x0124, 0x0124) AM_DEVREAD("tms3556", tms3556_device, vram_r)
448    AM_RANGE(0x0125, 0x0125) AM_DEVREAD("tms3556", tms3556_device, reg_r)
449    AM_RANGE(0x0128, 0x0128) AM_DEVREAD("tms3556", tms3556_device, initptr_r)
450    AM_RANGE(0x012d, 0x012d) AM_DEVWRITE("tms3556", tms3556_device, reg_w)
451    AM_RANGE(0x012e, 0x012e) AM_DEVWRITE("tms3556", tms3556_device, vram_w)
447   AM_RANGE(0x0124, 0x0124) AM_DEVREAD("tms3556", tms3556_device, vram_r)
448   AM_RANGE(0x0125, 0x0125) AM_DEVREAD("tms3556", tms3556_device, reg_r)
449   AM_RANGE(0x0128, 0x0128) AM_DEVREAD("tms3556", tms3556_device, initptr_r)
450   AM_RANGE(0x012d, 0x012d) AM_DEVWRITE("tms3556", tms3556_device, reg_w)
451   AM_RANGE(0x012e, 0x012e) AM_DEVWRITE("tms3556", tms3556_device, vram_w)
452452   AM_RANGE(0x0130, 0x0130) AM_READWRITE(mailbox_wx319_r, mailbox_wx318_w)
453453   AM_RANGE(0x0200, 0x7fff) AM_ROMBANK("bank1")                                /* system ROM */
454454   AM_RANGE(0x8000, 0xbfff) AM_NOP
r31373r31374
537537   MCFG_SOUND_ADD("tms5220c", TMS5220C, 640000)
538538   // MCFG_TMS52XX_SPEECHROM("vsm")
539539   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
540   
540
541541/* cartridge */
542542   MCFG_CARTSLOT_ADD("cart")
543543   MCFG_CARTSLOT_EXTENSION_LIST("bin,rom")
r31373r31374
600600
601601   ROM_REGION(0x10000, "tms7041", 0)
602602   ROM_LOAD("exl100_7041.bin", 0xf000, 0x1000, CRC(38f6fc7a) SHA1(b71d545664a974d8ad39bdf600c5b9884c3efab6))           /* TMS7041 internal ROM, correct  */
603//   ROM_REGION(0x8000, "vsm", 0)
603//  ROM_REGION(0x8000, "vsm", 0)
604604
605605   ROM_REGION(0x10000, "user1", ROMREGION_ERASEFF)         /* cartridge area */
606606ROM_END
r31373r31374
627627/*   YEAR   NAME     PARENT      COMPAT  MACHINE     INPUT   INIT    COMPANY         FULLNAME */
628628COMP(1984,  exl100,  0,          0,      exl100,     exelv, driver_device,  0,       "Exelvision",   "EXL 100",  GAME_NOT_WORKING)
629629COMP(1986,  exeltel, exl100,     0,      exeltel,    exelv, driver_device,  0,       "Exelvision",   "Exeltel",  GAME_NOT_WORKING)
630
trunk/src/mess/drivers/selz80.c
r31373r31374
164164
165165   /* Devices */
166166   MCFG_DEVICE_ADD("i8279", I8279, 2500000) // based on divider
167   MCFG_I8279_OUT_SL_CB(WRITE8(selz80_state, scanlines_w))         // scan SL lines
168   MCFG_I8279_OUT_DISP_CB(WRITE8(selz80_state, digit_w))         // display A&B
169   MCFG_I8279_IN_RL_CB(READ8(selz80_state, kbd_r))               // kbd RL lines
170   MCFG_I8279_IN_SHIFT_CB(VCC)                              // Shift key
167   MCFG_I8279_OUT_SL_CB(WRITE8(selz80_state, scanlines_w))         // scan SL lines
168   MCFG_I8279_OUT_DISP_CB(WRITE8(selz80_state, digit_w))           // display A&B
169   MCFG_I8279_IN_RL_CB(READ8(selz80_state, kbd_r))                 // kbd RL lines
170   MCFG_I8279_IN_SHIFT_CB(VCC)                                     // Shift key
171171   MCFG_I8279_IN_CTRL_CB(VCC)
172172MACHINE_CONFIG_END
173173
trunk/src/mess/drivers/pet.c
r31373r31374
17611761   MCFG_SCREEN_VISIBLE_AREA(0, 320 - 1, 0, 250 - 1)
17621762   MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update)
17631763   MCFG_DEVICE_REMOVE("sync_timer")
1764   
1764
17651765   MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, XTAL_16MHz/16)
17661766   MCFG_MC6845_SHOW_BORDER_AREA(true)
17671767   MCFG_MC6845_CHAR_WIDTH(8)
trunk/src/mess/drivers/sg1000.c
r31373r31374
731731   /* video hardware */
732732   MCFG_DEVICE_ADD( TMS9918A_TAG, TMS9918A, XTAL_10_738635MHz / 2 )
733733   MCFG_TMS9928A_VRAM_SIZE(0x4000)
734   MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(sg1000_state, sg1000_vdp_interrupt))   
734   MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(sg1000_state, sg1000_vdp_interrupt))
735735   MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG )
736736   MCFG_SCREEN_UPDATE_DEVICE( TMS9918A_TAG, tms9918a_device, screen_update )
737737
trunk/src/mess/drivers/ampro.c
r31373r31374
166166   /* Devices */
167167   MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_16MHz / 4)
168168   MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
169   MCFG_Z80CTC_ZC0_CB(WRITELINE(ampro_state, ctc_z0_w))   // Z80DART Ch A, SIO Ch A
170   MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80dart", z80dart_device, rxtxcb_w))   // SIO Ch B
169   MCFG_Z80CTC_ZC0_CB(WRITELINE(ampro_state, ctc_z0_w))    // Z80DART Ch A, SIO Ch A
170   MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80dart", z80dart_device, rxtxcb_w))   // SIO Ch B
171171
172172   MCFG_Z80DART_ADD("z80dart", XTAL_16MHz / 4, 0, 0, 0, 0 )
173173   MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd))
trunk/src/mess/drivers/coco12.c
r31373r31374
312312   MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(coco_state, cart_w))
313313   MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI))
314314   MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT))
315   
315
316316   // video hardware
317317   MCFG_SCREEN_MC6847_NTSC_ADD(SCREEN_TAG, VDG_TAG)
318318
trunk/src/mess/drivers/next.c
r31373r31374
1313
1414    - Really implement the MO, it's only faking it for the startup test right now
1515
16   - Fix the networking
16    - Fix the networking
1717
1818    - Find out why netbsd goes to hell even before loading the kernel
1919
trunk/src/mess/drivers/x68k.c
r31373r31374
16361636   MCFG_CPU_ADD("maincpu", M68000, 10000000)  /* 10 MHz */
16371637   MCFG_CPU_PROGRAM_MAP(x68k_map)
16381638   MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(x68k_state,x68k_int_ack)
1639   
1639
16401640   MCFG_QUANTUM_TIME(attotime::from_hz(60))
16411641
16421642   MCFG_MACHINE_START_OVERRIDE(x68k_state, x68000 )
r31373r31374
16611661   MCFG_I8255_OUT_PORTC_CB(WRITE8(x68k_state, ppi_port_c_w))
16621662
16631663   MCFG_DEVICE_ADD("hd63450", HD63450, 0)
1664   MCFG_HD63450_CPU("maincpu")   // CPU - 68000
1664   MCFG_HD63450_CPU("maincpu") // CPU - 68000
16651665   MCFG_HD63450_CLOCKS(attotime::from_usec(2), attotime::from_nsec(450), attotime::from_usec(4), attotime::from_hz(15625/2))
16661666   MCFG_HD63450_BURST_CLOCKS(attotime::from_usec(2), attotime::from_nsec(450), attotime::from_nsec(50), attotime::from_nsec(50))
16671667   MCFG_HD63450_DMA_END_CB(WRITE8(x68k_state, dma_end))
trunk/src/mess/drivers/alphatro.c
r31373r31374
484484   MCFG_CASSETTE_ADD("cassette")
485485   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
486486   MCFG_CASSETTE_INTERFACE("alphatro_cass")
487   
487
488488   MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_c", alphatro_state, timer_c, attotime::from_hz(4800))
489489   MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", alphatro_state, timer_p, attotime::from_hz(40000))
490490
trunk/src/mess/drivers/bullet.c
r31373r31374
11361136   MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0))
11371137   MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("cent_data_out", output_latch_device, write))
11381138   MCFG_Z80PIO_IN_PB_CB(READ8(bullet_state, pio_pb_r))
1139   
1139
11401140   MCFG_MB8877x_ADD(MB8877_TAG, XTAL_16MHz/16)
11411141   MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE(Z80DART_TAG, z80dart_device, dcda_w))
11421142   MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(bullet_state, fdc_drq_w))
trunk/src/mess/drivers/x1.c
r31373r31374
24992499   MCFG_CASSETTE_ADD("cassette")
25002500   MCFG_CASSETTE_FORMATS(x1_cassette_formats)
25012501   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED)
2502   MCFG_CASSETTE_INTERFACE("x1_cass")   
2503   
2502   MCFG_CASSETTE_INTERFACE("x1_cass")
2503
25042504   MCFG_SOFTWARE_LIST_ADD("cass_list","x1_cass")
25052505
25062506   MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(x1_floppy_interface)
r31373r31374
25312531   MCFG_DEVICE_REMOVE("fdc")
25322532   MCFG_DEVICE_ADD("fdc", MB8877, 0)
25332533   MCFG_WD17XX_DEFAULT_DRIVE4_TAGS
2534    MCFG_WD17XX_DRQ_CALLBACK(WRITELINE(x1_state,fdc_drq_w))
2534   MCFG_WD17XX_DRQ_CALLBACK(WRITELINE(x1_state,fdc_drq_w))
25352535
25362536   MCFG_YM2151_ADD("ym", MAIN_CLOCK/8) //option board
25372537   MCFG_SOUND_ROUTE(0, "lspeaker",  0.50)
r31373r31374
26472647// x1twin in x1twin.c
26482648COMP( 1984, x1turbo,   x1,     0,       x1turbo, x1turbo, x1_state,    x1_kanji, "Sharp", "X1 Turbo (CZ-850C)", GAME_NOT_WORKING ) //model 10
26492649COMP( 1985, x1turbo40, x1,     0,       x1turbo, x1turbo, x1_state,    x1_kanji, "Sharp", "X1 Turbo (CZ-862C)", 0 ) //model 40
2650//COMP( 1986, x1turboz, x1,     0,       x1turbo, x1turbo, x1_state,    x1_kanji, "Sharp", "X1 TurboZ", GAME_NOT_WORKING )
No newline at end of file
2650//COMP( 1986, x1turboz, x1,     0,       x1turbo, x1turbo, x1_state,    x1_kanji, "Sharp", "X1 TurboZ", GAME_NOT_WORKING )
trunk/src/mess/drivers/vtech1.c
r31373r31374
512512ROM_END
513513
514514#define rom_laser200    rom_laser110
515#define rom_fellow     rom_laser110
515#define rom_fellow      rom_laser110
516516
517517// It's possible that the Texet TX-8000 came with BASIC V1.0, but this needs to be verified
518518#define rom_tx8000  rom_laser110
r31373r31374
541541   ROMX_LOAD("vtechv21.u12", 0x0000, 0x4000, CRC(f7df980f) SHA1(5ba14a7a2eedca331b033901080fa5d205e245ea), ROM_BIOS(2))
542542ROM_END
543543
544#define rom_vz300      rom_laser310
544#define rom_vz300       rom_laser310
545545#define rom_laser310h   rom_laser310
546546
547547
trunk/src/mess/drivers/altos5.c
r31373r31374
419419
420420   MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_8MHz / 2)
421421   MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
422   MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80sio", z80dart_device, rxtxcb_w))   // SIO Ch B
423   MCFG_Z80CTC_ZC1_CB(WRITELINE(altos5_state, ctc_z1_w))      // Z80DART Ch A, SIO Ch A
424   MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80dart", z80dart_device, rxtxcb_w))      // Z80DART Ch B
422   MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80sio", z80dart_device, rxtxcb_w))    // SIO Ch B
423   MCFG_Z80CTC_ZC1_CB(WRITELINE(altos5_state, ctc_z1_w))       // Z80DART Ch A, SIO Ch A
424   MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80dart", z80dart_device, rxtxcb_w))       // Z80DART Ch B
425425
426426   MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "terminal")
427427   MCFG_RS232_RXD_HANDLER(DEVWRITELINE("z80sio", z80dart_device, rxb_w))
trunk/src/mess/drivers/partner.c
r31373r31374
207207   MCFG_CASSETTE_FORMATS(rkp_cassette_formats)
208208   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
209209   MCFG_CASSETTE_INTERFACE("partner_cass")
210   
210
211211   MCFG_SOFTWARE_LIST_ADD("cass_list","partner_cass")
212212
213213   MCFG_FD1793x_ADD("wd1793", XTAL_16MHz / 16)
trunk/src/mess/drivers/galaxy.c
r31373r31374
171171   MCFG_CPU_PROGRAM_MAP(galaxy_mem)
172172   MCFG_CPU_VBLANK_INT_DRIVER("screen", galaxy_state,  galaxy_interrupt)
173173   MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(galaxy_state,galaxy_irq_callback)
174   
174
175175   MCFG_SCREEN_ADD("screen", RASTER)
176176   MCFG_SCREEN_REFRESH_RATE(50)
177177   MCFG_SCREEN_PALETTE("palette")
r31373r31374
198198   MCFG_CASSETTE_FORMATS(gtp_cassette_formats)
199199   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
200200   MCFG_CASSETTE_INTERFACE("galaxy_cass")
201   
201
202202   MCFG_SOFTWARE_LIST_ADD("cass_list","galaxy")
203203
204204   /* internal ram */
r31373r31374
214214   MCFG_CPU_IO_MAP(galaxyp_io)
215215   MCFG_CPU_VBLANK_INT_DRIVER("screen", galaxy_state,  galaxy_interrupt)
216216   MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(galaxy_state,galaxy_irq_callback)
217   
217
218218   MCFG_SCREEN_ADD("screen", RASTER)
219219   MCFG_SCREEN_REFRESH_RATE(50)
220220   MCFG_SCREEN_PALETTE("palette")
r31373r31374
242242   MCFG_CASSETTE_FORMATS(gtp_cassette_formats)
243243   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
244244   MCFG_CASSETTE_INTERFACE("galaxy_cass")
245   
245
246246   MCFG_SOFTWARE_LIST_ADD("cass_list","galaxy")
247247
248248   /* internal ram */
trunk/src/mess/drivers/compis.c
r31373r31374
697697
698698   MCFG_CASSETTE_ADD(CASSETTE_TAG)
699699   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED)
700   
700
701701   MCFG_TIMER_DRIVER_ADD_PERIODIC("tape", compis_state, tape_tick, attotime::from_hz(44100))
702702
703703   MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL)
trunk/src/mess/drivers/mac.c
r31373r31374
21922192
21932193/*
21942194ROM_START( mactw )
2195   ROM_REGION16_BE(0x20000, "bootrom", 0)
2196   ROM_LOAD( "rom4.3t_07-04-83.bin", 0x0000, 0x10000, CRC(d2c42f18) SHA1(f868c09ca70383a69751c37a5a3110a9597462a4) )
2195    ROM_REGION16_BE(0x20000, "bootrom", 0)
2196    ROM_LOAD( "rom4.3t_07-04-83.bin", 0x0000, 0x10000, CRC(d2c42f18) SHA1(f868c09ca70383a69751c37a5a3110a9597462a4) )
21972197ROM_END
21982198*/
21992199
trunk/src/mess/drivers/at.c
r31373r31374
706706static MACHINE_CONFIG_START( at586, at586_state )
707707   MCFG_CPU_ADD("maincpu", PENTIUM, 60000000)
708708   MCFG_CPU_PROGRAM_MAP(at586_map)
709   MCFG_CPU_IO_MAP(at586_io)   
709   MCFG_CPU_IO_MAP(at586_io)
710710   MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pcibus:1:i82371ab:pic8259_master", pic8259_device, inta_cb)
711711
712712   MCFG_RAM_ADD(RAM_TAG)
r31373r31374
730730static MACHINE_CONFIG_START( at586x3, at586_state )
731731   MCFG_CPU_ADD("maincpu", PENTIUM, 60000000)
732732   MCFG_CPU_PROGRAM_MAP(at586_map)
733   MCFG_CPU_IO_MAP(at586_io)   
733   MCFG_CPU_IO_MAP(at586_io)
734734   MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pcibus:1:i82371sb:pic8259_master", pic8259_device, inta_cb)
735735
736736   MCFG_RAM_ADD(RAM_TAG)
trunk/src/mess/drivers/esq5505.c
r31373r31374
659659   MCFG_FLOPPY_DRIVE_ADD("wd1772:0", ensoniq_floppies, "35dd", esq5505_state::floppy_formats)
660660
661661   MCFG_DEVICE_ADD("mc68450", HD63450, 0)   // MC68450 compatible
662   MCFG_HD63450_CPU("maincpu")   // CPU - 68000
662   MCFG_HD63450_CPU("maincpu") // CPU - 68000
663663   MCFG_HD63450_CLOCKS(attotime::from_usec(32), attotime::from_nsec(450), attotime::from_usec(4), attotime::from_hz(15625/2))
664664   MCFG_HD63450_BURST_CLOCKS(attotime::from_usec(32), attotime::from_nsec(450), attotime::from_nsec(50), attotime::from_nsec(50))
665665   MCFG_HD63450_DMA_END_CB(WRITE8(esq5505_state, dma_end))
trunk/src/mess/drivers/ut88.c
r31373r31374
213213   MCFG_CASSETTE_FORMATS(rku_cassette_formats)
214214   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
215215   MCFG_CASSETTE_INTERFACE("ut88_cass")
216   
216
217217   MCFG_SOFTWARE_LIST_ADD("cass_list","ut88")
218218MACHINE_CONFIG_END
219219
r31373r31374
237237   MCFG_CASSETTE_FORMATS(rku_cassette_formats)
238238   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
239239   MCFG_CASSETTE_INTERFACE("ut88_cass")
240   
240
241241   MCFG_SOFTWARE_LIST_ADD("cass_list","ut88")
242242MACHINE_CONFIG_END
243243
trunk/src/mess/drivers/dragon.c
r31373r31374
159159   MCFG_CASSETTE_ADD("cassette")
160160   MCFG_CASSETTE_FORMATS(coco_cassette_formats)
161161   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_MUTED)
162   
162
163163   MCFG_DEVICE_ADD(PRINTER_TAG, PRINTER, 0)
164164
165165   // video hardware
trunk/src/mess/drivers/ql.c
r31373r31374
176176   }
177177   if (offset >= 0x20000 && offset < 0x40000)
178178   {
179      m_zx8301->data_w(space, offset & 0x1ffff, data);
179         m_zx8301->data_w(space, offset & 0x1ffff, data);
180180   }
181181   if (m_qimi_enabled)
182182   {
trunk/src/mess/drivers/myb3k.c
r31373r31374
269269   MCFG_MC6845_SHOW_BORDER_AREA(false)
270270   MCFG_MC6845_CHAR_WIDTH(8)
271271
272   MCFG_DEVICE_ADD("fdc", MB8877x, 2000000)   // unknown type
272   MCFG_DEVICE_ADD("fdc", MB8877x, 2000000)    // unknown type
273273   MCFG_FLOPPY_DRIVE_ADD("fdc:0", myb3k_floppies, "8dsdd", floppy_image_device::default_floppy_formats)
274274   MCFG_FLOPPY_DRIVE_ADD("fdc:1", myb3k_floppies, "8dsdd", floppy_image_device::default_floppy_formats)
275275MACHINE_CONFIG_END
trunk/src/mess/drivers/a2600.c
r31373r31374
19491949   MCFG_CASSETTE_ADD( "cassette" )
19501950   MCFG_CASSETTE_FORMATS(a26_cassette_formats)
19511951   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED)
1952   MCFG_CASSETTE_INTERFACE("a2600_cass")   
1952   MCFG_CASSETTE_INTERFACE("a2600_cass")
19531953MACHINE_CONFIG_END
19541954
19551955
trunk/src/mess/drivers/mikro80.c
r31373r31374
186186
187187   MCFG_CASSETTE_ADD( "cassette" )
188188   MCFG_CASSETTE_FORMATS(rk8_cassette_formats)
189   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)   
189   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
190190MACHINE_CONFIG_END
191191
192192static MACHINE_CONFIG_DERIVED( radio99, mikro80 )
trunk/src/mess/drivers/applix.c
r31373r31374
885885
886886   MCFG_CASSETTE_ADD("cassette")
887887   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED)
888   
888
889889   MCFG_WD1772x_ADD("fdc", XTAL_16MHz / 2) //connected to Z80H clock pin
890890   MCFG_FLOPPY_DRIVE_ADD("fdc:0", applix_floppies, "35dd", applix_state::floppy_formats)
891891   MCFG_FLOPPY_DRIVE_ADD("fdc:1", applix_floppies, "35dd", applix_state::floppy_formats)
trunk/src/mess/drivers/sdk85.c
r31373r31374
125125
126126   /* Devices */
127127   MCFG_DEVICE_ADD("i8279", I8279, 3100000) // based on divider
128   MCFG_I8279_OUT_IRQ_CB(INPUTLINE("maincpu", I8085_RST55_LINE))   // irq
129   MCFG_I8279_OUT_SL_CB(WRITE8(sdk85_state, scanlines_w))         // scan SL lines
130   MCFG_I8279_OUT_DISP_CB(WRITE8(sdk85_state, digit_w))         // display A&B
131   MCFG_I8279_IN_RL_CB(READ8(sdk85_state, kbd_r))               // kbd RL lines
132   MCFG_I8279_IN_SHIFT_CB(VCC)                              // Shift key
128   MCFG_I8279_OUT_IRQ_CB(INPUTLINE("maincpu", I8085_RST55_LINE))   // irq
129   MCFG_I8279_OUT_SL_CB(WRITE8(sdk85_state, scanlines_w))          // scan SL lines
130   MCFG_I8279_OUT_DISP_CB(WRITE8(sdk85_state, digit_w))            // display A&B
131   MCFG_I8279_IN_RL_CB(READ8(sdk85_state, kbd_r))                  // kbd RL lines
132   MCFG_I8279_IN_SHIFT_CB(VCC)                                     // Shift key
133133   MCFG_I8279_IN_CTRL_CB(VCC)
134134MACHINE_CONFIG_END
135135
trunk/src/mess/drivers/msx.c
r31373r31374
12241224
12251225   /* cassette */
12261226   MCFG_CASSETTE_ADD( "cassette" )
1227   MCFG_CASSETTE_FORMATS(fmsx_cassette_formats)   
1227   MCFG_CASSETTE_FORMATS(fmsx_cassette_formats)
12281228   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY)
12291229   MCFG_CASSETTE_INTERFACE("msx_cass")
12301230
r31373r31374
12361236static MACHINE_CONFIG_DERIVED( msx_ntsc, msx )
12371237   /* Video hardware */
12381238   MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 )
1239    MCFG_TMS9928A_VRAM_SIZE(0x4000)
1239   MCFG_TMS9928A_VRAM_SIZE(0x4000)
12401240   MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0))
12411241   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
12421242   MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update)
r31373r31374
12461246static MACHINE_CONFIG_DERIVED( msx_pal, msx )
12471247   /* Video hardware */
12481248   MCFG_DEVICE_ADD( "tms9928a", TMS9929A, XTAL_10_738635MHz / 2 )
1249    MCFG_TMS9928A_VRAM_SIZE(0x4000)
1249   MCFG_TMS9928A_VRAM_SIZE(0x4000)
12501250   MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(msx_state,msx_irq_source0))
12511251   MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" )
12521252   MCFG_SCREEN_UPDATE_DEVICE("tms9928a", tms9928a_device, screen_update)
r31373r31374
13161316
13171317   /* cassette */
13181318   MCFG_CASSETTE_ADD( "cassette" )
1319   MCFG_CASSETTE_FORMATS(fmsx_cassette_formats)   
1319   MCFG_CASSETTE_FORMATS(fmsx_cassette_formats)
13201320   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY)
13211321   MCFG_CASSETTE_INTERFACE("msx_cass")
13221322
r31373r31374
13841384
13851385   /* cassette */
13861386   MCFG_CASSETTE_ADD( "cassette" )
1387   MCFG_CASSETTE_FORMATS(fmsx_cassette_formats)   
1387   MCFG_CASSETTE_FORMATS(fmsx_cassette_formats)
13881388   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY)
13891389   MCFG_CASSETTE_INTERFACE("msx_cass")
13901390
r31373r31374
14621462   // FDC: None, 0 drives
14631463   // 2 Cartridge slots
14641464
1465    MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000)
1465   MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000)
14661466   MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0)
1467    MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1)   /* 16KB RAM */
1467   MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 3, 1)   /* 16KB RAM */
14681468   MCFG_MSX_LAYOUT_CARTRIDGE("cartslot12", 3, 0)
14691469
14701470   MCFG_FRAGMENT_ADD( msx1_cartlist )
r31373r31374
14811481   // FDC: None, 0 drives
14821482   // 2 Cartridge slots
14831483
1484    MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000)
1484   MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000)
14851485   MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0)
14861486   MCFG_MSX_LAYOUT_RAM("ram", 2, 0, 0, 4)  /* 64KB RAM */
14871487   MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 3, 0)
r31373r31374
14971497ROM_END
14981498
14991499static MACHINE_CONFIG_DERIVED( pv16, msx_ntsc )
1500    // AY8910
1500   // AY8910
15011501   // FDC: None, 0 drives
15021502   // 1 Cartridge slot
15031503   // No printer port
r31373r31374
25402540ROM_START (svi728)
25412541   ROM_REGION (0xc000, "maincpu", 0)
25422542   ROM_LOAD ("728bios.rom", 0x0000, 0x8000, CRC(1ce9246c) SHA1(ea6a82cf8c6e65eb30b98755c8577cde8d9186c0))
2543//   ROM_LOAD ("707disk.rom", 0x8000, 0x4000, CRC(f9978853) SHA1(6aa856cc56eb98863c9da7a566571605682b5c6b))
2543//  ROM_LOAD ("707disk.rom", 0x8000, 0x4000, CRC(f9978853) SHA1(6aa856cc56eb98863c9da7a566571605682b5c6b))
25442544ROM_END
25452545
25462546static MACHINE_CONFIG_DERIVED( svi728, msx_pal )
r31373r31374
45734573   MCFG_MSX_LAYOUT_RAM("ram2", 0, 2, 0, 2)   /* 32KB RAM */
45744574   MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0)
45754575   MCFG_MSX_LAYOUT_CARTRIDGE("cartslot2", 2, 0)
4576   MCFG_MSX_LAYOUT_ROM("empty", 3, 0, 0, 4, "maincpu", 0x10000)    // Empty? or is this the 3rd cartridge/expansion slot ? 0x10000 used to be the "special" loading spot for the fmpac rom
4576   MCFG_MSX_LAYOUT_ROM("empty", 3, 0, 0, 4, "maincpu", 0x10000)    // Empty? or is this the 3rd cartridge/expansion slot ? 0x10000 used to be the "special" loading spot for the fmpac rom
45774577
45784578   MCFG_FRAGMENT_ADD( msx2_cartlist )
45794579MACHINE_CONFIG_END
r31373r31374
47304730   MCFG_MSX_LAYOUT_DISK1("disk", 3, 0, 1, 1, "maincpu", 0xc000)
47314731   MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 3, 1, 0x40000)   /* 256KB Mapper RAM */
47324732   MCFG_MSX_RAMIO_SET_BITS(0x80)
4733   MCFG_MSX_LAYOUT_ROM("empty", 3, 3, 1, 1, "maincpu", 0x10000)   // Empty/unknown, optional fmpac rom used to be loaded here, or should the util rom be loaded?
4733   MCFG_MSX_LAYOUT_ROM("empty", 3, 3, 1, 1, "maincpu", 0x10000)    // Empty/unknown, optional fmpac rom used to be loaded here, or should the util rom be loaded?
47344734
47354735   MCFG_FRAGMENT_ADD( msx_wd2793_force_ready )
47364736   MCFG_FRAGMENT_ADD( msx_2_35_dd_drive )
r31373r31374
48444844   // YM2149 (in S-1985 MSX Engine)
48454845   // FDC: None, 0 drives
48464846   // 2 Cartridge slots
4847    // S-1985 MSX Engine
4847   // S-1985 MSX Engine
48484848
48494849   MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000)
48504850   MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0)
r31373r31374
49554955
49564956   MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000)
49574957   MCFG_MSX_LAYOUT_RAM_MM("ram_mm", 1, 0, 0x20000)   /* 128KB Mapper RAM */
4958      MCFG_MSX_RAMIO_SET_BITS(0x80)
4958   MCFG_MSX_RAMIO_SET_BITS(0x80)
49594959   MCFG_MSX_LAYOUT_CARTRIDGE("cartslot", 2, 0)
49604960   MCFG_MSX_LAYOUT_ROM("ext", 3, 0, 0, 1, "maincpu", 0x8000)
49614961   MCFG_MSX_LAYOUT_ROM("turbo", 3, 0, 1, 1, "maincpu", 0x20000)
r31373r31374
52105210static MACHINE_CONFIG_DERIVED( expert3t, msx2p )
52115211   // AY8910
52125212   // FDC: wd2793?, 1 or 2? drives
5213    // 4 Cartridge/Expansion slots?
5214    // FM/YM2413 built-in
5213   // 4 Cartridge/Expansion slots?
5214   // FM/YM2413 built-in
52155215
52165216   MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000)
52175217   MCFG_MSX_LAYOUT_CARTRIDGE("cartslot1", 1, 0)
r31373r31374
57505750static MACHINE_CONFIG_DERIVED( fsa1gt, msx2 )
57515751   // AY8910/YM2149?
57525752   // FDC: tc8566af, 1 3.5" DSDD drive
5753    // 2 Cartridge slots
5754    // FM built-in
5755    // MIDI
5753   // 2 Cartridge slots
5754   // FM built-in
5755   // MIDI
57565756
57575757   MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000)
57585758   MCFG_MSX_LAYOUT_MUSIC("mus", 0, 2, 1, 1, "maincpu", 0x38000)
r31373r31374
57935793static MACHINE_CONFIG_DERIVED( fsa1st, msx2 )
57945794   // AY8910/YM2149?
57955795   // FDC: tc8566af, 1 3.5" DSDD drive
5796    // 2 Cartridge slots
5797    // FM built-in
5796   // 2 Cartridge slots
5797   // FM built-in
57985798
57995799   MCFG_MSX_LAYOUT_ROM("bios", 0, 0, 0, 2, "maincpu", 0x0000)
58005800   MCFG_MSX_LAYOUT_MUSIC("mus", 0, 2, 1, 1, "maincpu", 0x38000)
trunk/src/mess/drivers/fc100.c
r31373r31374
535535   MCFG_CASSETTE_ADD("cassette")
536536   MCFG_CASSETTE_FORMATS(fc100_cassette_formats)
537537   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED)
538   
538
539539   MCFG_DEVICE_ADD("uart", I8251, 0)
540540   MCFG_I8251_TXD_HANDLER(WRITELINE(fc100_state, txdata_callback))
541541   MCFG_DEVICE_ADD("uart_clock", CLOCK, XTAL_4_9152MHz/16/16) // gives 19200
trunk/src/mess/drivers/amiga.c
r31373r31374
405405// ocs chipset (agnus with support for 512k or 1mb chip ram, denise)
406406DRIVER_INIT_MEMBER( a1000_state, pal )
407407{
408   m_agnus_id = AGNUS_PAL;      // 8367
409   m_denise_id = DENISE;      // 8362
408   m_agnus_id = AGNUS_PAL;     // 8367
409   m_denise_id = DENISE;       // 8362
410410}
411411
412412DRIVER_INIT_MEMBER( a1000_state, ntsc )
413413{
414   m_agnus_id = AGNUS_NTSC;   // 8361
415   m_denise_id = DENISE;      // 8362
414   m_agnus_id = AGNUS_NTSC;    // 8361
415   m_denise_id = DENISE;       // 8362
416416}
417417
418418DRIVER_INIT_MEMBER( a2000_state, pal )
419419{
420   m_agnus_id = AGNUS_PAL;      // 8371 (later versions 8372A)
421   m_denise_id = DENISE;      // 8362
420   m_agnus_id = AGNUS_PAL;     // 8371 (later versions 8372A)
421   m_denise_id = DENISE;       // 8362
422422}
423423
424424DRIVER_INIT_MEMBER( a2000_state, ntsc )
425425{
426   m_agnus_id = AGNUS_NTSC;   // 8370 (later versions 8372A)
427   m_denise_id = DENISE;      // 8362
426   m_agnus_id = AGNUS_NTSC;    // 8370 (later versions 8372A)
427   m_denise_id = DENISE;       // 8362
428428}
429429
430430DRIVER_INIT_MEMBER( a500_state, pal )
431431{
432   m_agnus_id = AGNUS_PAL;      // 8371 (later versions 8372A)
433   m_denise_id = DENISE;      // 8362
432   m_agnus_id = AGNUS_PAL;     // 8371 (later versions 8372A)
433   m_denise_id = DENISE;       // 8362
434434}
435435
436436DRIVER_INIT_MEMBER( a500_state, ntsc )
437437{
438   m_agnus_id = AGNUS_NTSC;   // 8370 (later versions 8372A)
439   m_denise_id = DENISE;      // 8362
438   m_agnus_id = AGNUS_NTSC;    // 8370 (later versions 8372A)
439   m_denise_id = DENISE;       // 8362
440440}
441441
442442DRIVER_INIT_MEMBER( cdtv_state, pal )
443443{
444   m_agnus_id = AGNUS_HR_PAL;   // 8372A
445   m_denise_id = DENISE;      // 8362
444   m_agnus_id = AGNUS_HR_PAL;  // 8372A
445   m_denise_id = DENISE;       // 8362
446446}
447447
448448DRIVER_INIT_MEMBER( cdtv_state, ntsc )
449449{
450   m_agnus_id = AGNUS_HR_NTSC;   // 8372A
451   m_denise_id = DENISE;      // 8362
450   m_agnus_id = AGNUS_HR_NTSC; // 8372A
451   m_denise_id = DENISE;       // 8362
452452}
453453
454454// ecs chipset (agnus with support for 2mb chip ram, super denise)
455455DRIVER_INIT_MEMBER( a3000_state, pal )
456456{
457   m_agnus_id = AGNUS_HR_PAL_NEW;   // 8372B (early versions: 8372AB)
458   m_denise_id = DENISE_HR;      // 8373
457   m_agnus_id = AGNUS_HR_PAL_NEW;  // 8372B (early versions: 8372AB)
458   m_denise_id = DENISE_HR;        // 8373
459459}
460460
461461DRIVER_INIT_MEMBER( a3000_state, ntsc )
462462{
463   m_agnus_id = AGNUS_HR_NTSC_NEW;   // 8372B (early versions: 8372AB)
464   m_denise_id = DENISE_HR;      // 8373
463   m_agnus_id = AGNUS_HR_NTSC_NEW; // 8372B (early versions: 8372AB)
464   m_denise_id = DENISE_HR;        // 8373
465465}
466466
467467DRIVER_INIT_MEMBER( a500p_state, pal )
468468{
469   m_agnus_id = AGNUS_HR_PAL;   // 8375 (390544-01)
470   m_denise_id = DENISE_HR;   // 8373
469   m_agnus_id = AGNUS_HR_PAL;  // 8375 (390544-01)
470   m_denise_id = DENISE_HR;    // 8373
471471}
472472
473473DRIVER_INIT_MEMBER( a500p_state, ntsc )
474474{
475   m_agnus_id = AGNUS_HR_NTSC;   // 8375 (390544-02)
476   m_denise_id = DENISE_HR;   // 8373
475   m_agnus_id = AGNUS_HR_NTSC; // 8375 (390544-02)
476   m_denise_id = DENISE_HR;    // 8373
477477}
478478
479479DRIVER_INIT_MEMBER( a600_state, pal )
480480{
481   m_agnus_id = AGNUS_HR_PAL;   // 8375 (390544-01)
482   m_denise_id = DENISE_HR;   // 8373
481   m_agnus_id = AGNUS_HR_PAL;  // 8375 (390544-01)
482   m_denise_id = DENISE_HR;    // 8373
483483}
484484
485485DRIVER_INIT_MEMBER( a600_state, ntsc )
486486{
487   m_agnus_id = AGNUS_HR_NTSC;   // 8375 (390544-02)
488   m_denise_id = DENISE_HR;   // 8373
487   m_agnus_id = AGNUS_HR_NTSC; // 8375 (390544-02)
488   m_denise_id = DENISE_HR;    // 8373
489489}
490490
491491// aga chipset (alice and lisa)
r31373r31374
20292029
20302030ROM_START( cd32 )
20312031   ROM_REGION32_BE(0x100000, "kickstart", 0)
2032//   ROM_LOAD16_WORD("391640-03.u6a", 0x000000, 0x100000, CRC(a4fbc94a) SHA1(816ce6c5077875850c7d43452230a9ba3a2902db)) // todo: this is the real dump
2032//  ROM_LOAD16_WORD("391640-03.u6a", 0x000000, 0x100000, CRC(a4fbc94a) SHA1(816ce6c5077875850c7d43452230a9ba3a2902db)) // todo: this is the real dump
20332033   ROM_LOAD16_WORD("391640-03.u6a", 0x000000, 0x100000, CRC(d3837ae4) SHA1(06807db3181637455f4d46582d9972afec8956d9))
20342034ROM_END
20352035
trunk/src/mess/drivers/orion.c
r31373r31374
123123   MCFG_CASSETTE_FORMATS(rko_cassette_formats)
124124   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
125125   MCFG_CASSETTE_INTERFACE("orion_cass")
126   
126
127127   MCFG_SOFTWARE_LIST_ADD("cass_list","orion_cass")
128128
129129   MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8)
r31373r31374
202202   MCFG_CASSETTE_FORMATS(rko_cassette_formats)
203203   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
204204   MCFG_CASSETTE_INTERFACE("orion_cass")
205   
205
206206   MCFG_SOFTWARE_LIST_ADD("cass_list","orion_cass")
207207
208208   MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8)
r31373r31374
277277   MCFG_CASSETTE_FORMATS(rko_cassette_formats)
278278   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
279279   MCFG_CASSETTE_INTERFACE("orion_cass")
280   
280
281281   MCFG_SOFTWARE_LIST_ADD("cass_list","orion_cass")
282282
283283   MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8)
trunk/src/mess/drivers/a7800.c
r31373r31374
8383
8484    2014/03/25 Mike Saarna  Fixed Riot Timer
8585
86    2014/05/06 Mike Saarna/Robert Tuccitto Brought initial Maria cycle counts
87+           inline from measurements taken with logic analyzer and tests.
86    2014/05/06 Mike Saarna/Robert Tuccitto Brought initial Maria cycle counts
87+           inline from measurements taken with logic analyzer and tests.
8888***************************************************************************/
8989
9090#include "emu.h"
trunk/src/mess/drivers/ms9540.c
r31373r31374
8585   /* video hardware */
8686   MCFG_DEVICE_ADD(TERMINAL_TAG, GENERIC_TERMINAL, 0)
8787   MCFG_GENERIC_TERMINAL_KEYBOARD_CB(WRITE8(ms9540_state, kbd_put))
88   
88
8989MACHINE_CONFIG_END
9090
9191/* ROM definition */
trunk/src/mess/drivers/pc1500.c
r31373r31374
3636   required_shared_ptr<UINT8> m_lcd_data;
3737   required_ioport_array<8> m_keyboard;
3838   required_ioport m_io_on;
39   
39
4040   UINT8 m_kb_matrix;
4141
4242   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
r31373r31374
7272   UINT8 data = 0xff;
7373
7474   if (!started()) return 0;
75   
75
7676   for (int i = 0; i < 8; i++)
7777   {
7878      if (!BIT(m_kb_matrix, i))
trunk/src/mess/drivers/sdk86.c
r31373r31374
170170   MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(sdk86_state, write_usart_clock))
171171
172172   MCFG_DEVICE_ADD("i8279", I8279, 2500000) // based on divider
173   MCFG_I8279_OUT_SL_CB(WRITE8(sdk86_state, scanlines_w))         // scan SL lines
174   MCFG_I8279_OUT_DISP_CB(WRITE8(sdk86_state, digit_w))         // display A&B
175   MCFG_I8279_IN_RL_CB(READ8(sdk86_state, kbd_r))               // kbd RL lines
176   MCFG_I8279_IN_SHIFT_CB(GND)                              // Shift key
173   MCFG_I8279_OUT_SL_CB(WRITE8(sdk86_state, scanlines_w))          // scan SL lines
174   MCFG_I8279_OUT_DISP_CB(WRITE8(sdk86_state, digit_w))            // display A&B
175   MCFG_I8279_IN_RL_CB(READ8(sdk86_state, kbd_r))                  // kbd RL lines
176   MCFG_I8279_IN_SHIFT_CB(GND)                                     // Shift key
177177   MCFG_I8279_IN_CTRL_CB(GND)
178178
179179MACHINE_CONFIG_END
trunk/src/mess/drivers/apf.c
r31373r31374
491491{
492492   UINT8 *ROM = memregion("cart")->base();
493493   UINT32 cart_size;
494   
494
495495   if (image.software_entry() == NULL)
496496   {
497497      cart_size = image.length();
r31373r31374
502502      }
503503
504504      image.fread(ROM, cart_size);
505     
505
506506      // attempt to identify Space Destroyer, which needs 1K of additional RAM
507507      if (cart_size == 0x1800)
508508      {
r31373r31374
527527         m_cart_ram.resize(image.get_software_region_length("ram"));
528528      }
529529   }
530   
530
531531   return IMAGE_INIT_PASS;
532532}
533533
r31373r31374
611611   MCFG_CASSETTE_ADD( "cassette" )
612612   MCFG_CASSETTE_FORMATS(apf_cassette_formats)
613613   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY)
614   
614
615615   MCFG_FD1771x_ADD("fdc", 1000000) // guess
616616   MCFG_FLOPPY_DRIVE_ADD("fdc:0", apf_floppies, "525dd", floppy_image_device::default_floppy_formats)
617617   MCFG_FLOPPY_DRIVE_ADD("fdc:1", apf_floppies, "525dd", floppy_image_device::default_floppy_formats)
trunk/src/mess/drivers/einstein.c
r31373r31374
717717
718718   /* video hardware */
719719   MCFG_DEVICE_ADD( "tms9929a", TMS9929A, XTAL_10_738635MHz / 2 )
720   MCFG_TMS9928A_VRAM_SIZE(0x4000)   /* 16k RAM, provided by IC i040 and i041 */
720   MCFG_TMS9928A_VRAM_SIZE(0x4000) /* 16k RAM, provided by IC i040 and i041 */
721721   MCFG_TMS9928A_SET_SCREEN( "screen" )
722722   MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" )
723723   MCFG_SCREEN_UPDATE_DEVICE( "tms9929a", tms9929a_device, screen_update )
trunk/src/mess/drivers/trs80.c
r31373r31374
592592   MCFG_CASSETTE_MODIFY( "cassette" )
593593   MCFG_CASSETTE_FORMATS(trs80l2_cassette_formats)
594594   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY)
595   
595
596596   MCFG_QUICKLOAD_ADD("quickload", trs80_state, trs80_cmd, "cmd", 0.5)
597597
598598   MCFG_DEVICE_ADD("wd179x", FD1793, 0) // should be FD1771 or FD1791 but inverted data lines are too tricky to fix now
trunk/src/mess/drivers/mtx.c
r31373r31374
323323   MCFG_SNAPSHOT_ADD("snapshot", mtx_state, mtx, "mtx", 1)
324324   MCFG_CASSETTE_ADD("cassette")
325325   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED)
326   
326
327327   MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", mtx_state, cassette_tick, attotime::from_hz(44100))
328328
329329   /* internal ram */
trunk/src/mess/drivers/saturn.c
r31373r31374
99    Many thanks to Guru, Fabien, Runik and Charles MacDonald for the help given.
1010
1111===================================================================================================
12
12
1313Notes:
1414-To enter into an Advanced Test Mode,keep pressed the Test Button (F2) on the start-up.
1515-Memo: Some tests done on the original & working PCB,to be implemented:
trunk/src/mess/drivers/samcoupe.c
r31373r31374
558558   MCFG_CASSETTE_FORMATS(tzx_cassette_formats)
559559   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
560560   MCFG_CASSETTE_INTERFACE("samcoupe_cass")
561   
561
562562   MCFG_SOFTWARE_LIST_ADD("cass_list","samcoupe_cass")
563563
564564   MCFG_WD1772x_ADD("wd1772", SAMCOUPE_XTAL_X1/3)
trunk/src/mess/drivers/z9001.c
r31373r31374
236236   MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
237237   MCFG_Z80PIO_OUT_PA_CB(WRITE8(z9001_state, port88_w))
238238
239   MCFG_DEVICE_ADD("z80pio2", Z80PIO, XTAL_9_8304MHz / 4)    // keyboard PIO
239   MCFG_DEVICE_ADD("z80pio2", Z80PIO, XTAL_9_8304MHz / 4)  // keyboard PIO
240240   MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
241241
242242   MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_9_8304MHz / 4)
trunk/src/mess/drivers/cc40.c
r31373r31374
4242  AMI 1041036-1 - 68-pin QFP AMI Gate Array
4343  HD44100H      - 60-pin QFP Hitachi HD44100 LCD Driver
4444  HD44780A00    - 80-pin TFP Hitachi HD44780 LCD Controller
45 
45
4646  *             - indicates that it's on the other side of the PCB
47 
48 
47
48
4949  CC-40 is powered by 4 AA batteries. These will also save internal RAM,
5050  provided that the machine is turned off properly. If a program is running,
5151  you may have to press [BREAK] before turning the CC-40 off.
52 
52
5353  To run a cartridge, usually the command RUN "DIR" shows which program(s)
5454  can be loaded. Load a program by pressing the [RUN] key while viewing the list,
5555  or manually with the command RUN "<shortname of program in list>"
r31373r31374
9090
9191   required_device<tms70c20_device> m_maincpu;
9292   required_device<dac_device> m_dac;
93   
93
9494   ioport_port *m_key_matrix[8];
9595
9696   UINT8 m_power;
9797   UINT8 m_banks;
9898   UINT8 m_clock_control;
9999   UINT8 m_key_select;
100   
100
101101   void update_lcd_indicator(UINT8 y, UINT8 x, int state);
102102
103103   DECLARE_READ8_MEMBER(bus_control_r);
r31373r31374
215215{
216216   // d0: power-on hold latch
217217   m_power = data & 1;
218   
218
219219   // stop running
220220   if (!m_power)
221221      m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
r31373r31374
242242{
243243   // d0-d1: system rom bankswitch
244244   membank("sysbank")->set_entry(data & 3);
245   
245
246246   // d2-d3: cartridge rom bankswitch
247247   membank("cartbank")->set_entry(data >> 2 & 3);
248248
r31373r31374
271271      // high to low
272272      m_maincpu->set_clock_scale(1);
273273   }
274   
274
275275   m_clock_control = data & 0x0f;
276276}
277277
r31373r31374
285285      if (m_key_select >> i & 1)
286286         ret |= m_key_matrix[i]->read();
287287   }
288   
288
289289   return ret;
290290}
291291
r31373r31374
427427void cc40_state::machine_reset()
428428{
429429   m_power = 1;
430   
430
431431   address_space &space = m_maincpu->space(AS_PROGRAM);
432432   bankswitch_w(space, 0, 0);
433433}
r31373r31374
437437   static const char *const tags[] = { "IN0", "IN1", "IN2", "IN3", "IN4", "IN5", "IN6", "IN7" };
438438   for (int i = 0; i < 8; i++)
439439      m_key_matrix[i] = ioport(tags[i]);
440   
440
441441   membank("sysbank")->configure_entries(0, 4, memregion("system")->base(), 0x2000);
442442   membank("cartbank")->configure_entries(0, 4, memregion("user1")->base(), 0x8000);
443443
r31373r31374
446446   m_banks = 0;
447447   m_clock_control = 0;
448448   m_key_select = 0;
449   
449
450450   // register for savestates
451451   save_item(NAME(m_power));
452452   save_item(NAME(m_banks));
r31373r31374
511511
512512   ROM_REGION( 0x8000, "system", 0 )
513513   ROM_LOAD( "cc40.bin",     0x0000, 0x8000, CRC(f5322fab) SHA1(1b5c4052a53654363c458f75eac7a27f0752def6) ) // system rom, banked
514   
514
515515   ROM_REGION( 0x20000, "user1", ROMREGION_ERASEFF ) // cartridge area, max 4*32KB
516516ROM_END
517517
trunk/src/mess/drivers/interact.c
r31373r31374
160160   MCFG_CASSETTE_FORMATS(hector_cassette_formats)
161161   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MASK_SPEAKER)
162162   MCFG_CASSETTE_INTERFACE("interact_cass")
163   
163
164164   MCFG_SOFTWARE_LIST_ADD("cass_list","interact")
165165
166166   /* printer */
trunk/src/mess/drivers/radio86.c
r31373r31374
378378   MCFG_CASSETTE_FORMATS(rkr_cassette_formats)
379379   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
380380   MCFG_CASSETTE_INTERFACE("radio86_cass")
381   
381
382382   MCFG_SOFTWARE_LIST_ADD("cass_list","radio86")
383383MACHINE_CONFIG_END
384384
trunk/src/mess/drivers/pasopia7.c
r31373r31374
938938   MCFG_DEVICE_ADD("z80ctc", Z80CTC, XTAL_4MHz)
939939   MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
940940   MCFG_Z80CTC_ZC0_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg1))
941   MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg2))   // beep interface
941   MCFG_Z80CTC_ZC1_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg2)) // beep interface
942942   MCFG_Z80CTC_ZC2_CB(DEVWRITELINE("z80ctc", z80ctc_device, trg3))
943943
944944   MCFG_DEVICE_ADD("z80pio", Z80PIO, XTAL_4MHz)
trunk/src/mess/drivers/fb01.c
r31373r31374
6565   AM_RANGE(0x00, 0x00) AM_DEVWRITE("ym2164", ym2151_device, register_w)
6666   AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("ym2164", ym2151_device, status_r, data_w)
6767
68    // 10-11  USART uPD71051C  4MHz & 4MHz / 8
68   // 10-11  USART uPD71051C  4MHz & 4MHz / 8
6969   AM_RANGE(0x10, 0x10) AM_DEVREADWRITE("upd71051", i8251_device, data_r, data_w)
7070   AM_RANGE(0x11, 0x11) AM_DEVREADWRITE("upd71051", i8251_device, status_r, control_w)
7171
r31373r31374
224224
225225/*    YEAR  NAME  PARENT  COMPAT   MACHINE  INPUT  INIT                  COMPANY   FULLNAME  FLAGS */
226226CONS( 1986, fb01, 0,      0,       fb01,    fb01,  driver_device,   0,   "Yamaha", "FB-01",  GAME_SUPPORTS_SAVE )
227
trunk/src/mess/drivers/oric.c
r31373r31374
1313    Apple 2 disc drives for storage.
1414
1515    This driver originally by Paul Cook, rewritten by Kevin Thacker,
16   re-rewritten by Olivier Galibert.
16    re-rewritten by Olivier Galibert.
1717
1818*********************************************************************/
1919
r31373r31374
4646
4747   oric_state(const machine_config &mconfig, device_type type, const char *tag)
4848      : driver_device(mconfig, type, tag),
49        m_maincpu(*this, "maincpu"),
50        m_psg(*this, "ay8912"),
51        m_centronics(*this, "centronics"),
52        m_cent_data_out(*this, "cent_data_out"),
53        m_cassette(*this, "cassette"),
54        m_via(*this, "via6522"),
55        m_ram(*this, "ram"),
56        m_rom(*this, "maincpu"),
57        m_bank_c000_r(*this, "bank_c000_r"),
58        m_bank_e000_r(*this, "bank_e000_r"),
59        m_bank_f800_r(*this, "bank_f800_r"),
60        m_bank_c000_w(*this, "bank_c000_w"),
61        m_bank_e000_w(*this, "bank_e000_w"),
62        m_bank_f800_w(*this, "bank_f800_w"),
63        m_config(*this, "CONFIG") { }
49         m_maincpu(*this, "maincpu"),
50         m_psg(*this, "ay8912"),
51         m_centronics(*this, "centronics"),
52         m_cent_data_out(*this, "cent_data_out"),
53         m_cassette(*this, "cassette"),
54         m_via(*this, "via6522"),
55         m_ram(*this, "ram"),
56         m_rom(*this, "maincpu"),
57         m_bank_c000_r(*this, "bank_c000_r"),
58         m_bank_e000_r(*this, "bank_e000_r"),
59         m_bank_f800_r(*this, "bank_f800_r"),
60         m_bank_c000_w(*this, "bank_c000_w"),
61         m_bank_e000_w(*this, "bank_e000_w"),
62         m_bank_f800_w(*this, "bank_f800_w"),
63         m_config(*this, "CONFIG") { }
6464
6565   DECLARE_INPUT_CHANGED_MEMBER(nmi_pressed);
6666   DECLARE_WRITE8_MEMBER(via_a_w);
r31373r31374
120120      m_telmon24(*this, "telmon24"),
121121      m_joy1(*this, "JOY1"),
122122      m_joy2(*this, "JOY2")
123 { }
123   { }
124124
125125   DECLARE_WRITE8_MEMBER(via2_a_w);
126126   DECLARE_WRITE8_MEMBER(via2_b_w);
r31373r31374
307307
308308INPUT_CHANGED_MEMBER(oric_state::nmi_pressed)
309309{
310   m_maincpu->set_input_line(m6502_device::NMI_LINE, newval ? ASSERT_LINE : CLEAR_LINE);   
310   m_maincpu->set_input_line(m6502_device::NMI_LINE, newval ? ASSERT_LINE : CLEAR_LINE);
311311}
312312
313313WRITE8_MEMBER(oric_state::via_a_w)
r31373r31374
323323   update_keyboard();
324324   m_centronics->write_strobe(data & 0x10 ? 1 : 0);
325325   m_cassette->change_state(data & 0x40 ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,
326                      CASSETTE_MOTOR_DISABLED);
326                        CASSETTE_MOTOR_DISABLED);
327327   m_cassette->output(data & 0x80 ? -1.0 : +1.0);
328328}
329329
r31373r31374
426426void telestrat_state::update_irq()
427427{
428428   m_maincpu->set_input_line(m6502_device::IRQ_LINE,
429                       m_via_irq ||
430                       m_ext_irq ||
431                       (m_fdc_irq && (m_port_314 & P_IRQEN)) ||
432                       m_via2_irq ||
433                       m_acia_irq ? ASSERT_LINE : CLEAR_LINE);
429                        m_via_irq ||
430                        m_ext_irq ||
431                        (m_fdc_irq && (m_port_314 & P_IRQEN)) ||
432                        m_via2_irq ||
433                        m_acia_irq ? ASSERT_LINE : CLEAR_LINE);
434434}
435435
436436WRITE8_MEMBER(telestrat_state::via2_a_w)
r31373r31374
801801   MCFG_CASSETTE_ADD( "cassette" )
802802   MCFG_CASSETTE_FORMATS(oric_cassette_formats)
803803   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED)
804   
804
805805   MCFG_TIMER_DRIVER_ADD_PERIODIC("tape_timer", oric_state, update_tape, attotime::from_hz(4800))
806806
807807   /* via */
r31373r31374
933933ROM_START(prav8d)
934934   ROM_REGION(0x4000, "maincpu", 0)   /* 0x10000 + 0x04000 + 0x00100 + 0x00200 */
935935   ROM_LOAD( "pravetzt.rom", 0, 0x4000, CRC(58079502) SHA1(7afc276cb118adff72e4f16698f94bf3b2c64146) )
936//   ROM_LOAD_OPTIONAL( "8ddoslo.rom", 0x014000, 0x0100, CRC(0c82f636) SHA1(b29d151a0dfa3c7cd50439b51d0a8f95559bc2b6) )
937//   ROM_LOAD_OPTIONAL( "8ddoshi.rom", 0x014100, 0x0200, CRC(66309641) SHA1(9c2e82b3c4d385ade6215fcb89f8b92e6fd2bf4b) )
936//  ROM_LOAD_OPTIONAL( "8ddoslo.rom", 0x014000, 0x0100, CRC(0c82f636) SHA1(b29d151a0dfa3c7cd50439b51d0a8f95559bc2b6) )
937//  ROM_LOAD_OPTIONAL( "8ddoshi.rom", 0x014100, 0x0200, CRC(66309641) SHA1(9c2e82b3c4d385ade6215fcb89f8b92e6fd2bf4b) )
938938ROM_END
939939
940940ROM_START(prav8dd)
r31373r31374
943943   ROMX_LOAD( "8d.rom",       0, 0x4000, CRC(b48973ef) SHA1(fd47c977fc215a3b577596a7483df53e8a1e9c83), ROM_BIOS(1) )
944944   ROM_SYSTEM_BIOS( 1, "radosoft", "RadoSoft Disk ROM, 1992")
945945   ROMX_LOAD( "pravetzd.rom", 0, 0x4000, CRC(f8d23821) SHA1(f87ad3c5832773b6e0614905552a80c98dc8e2a5), ROM_BIOS(2) )
946//   ROM_LOAD_OPTIONAL( "8ddoslo.rom", 0x014000, 0x0100, CRC(0c82f636) SHA1(b29d151a0dfa3c7cd50439b51d0a8f95559bc2b6) )
947//   ROM_LOAD_OPTIONAL( "8ddoshi.rom", 0x014100, 0x0200, CRC(66309641) SHA1(9c2e82b3c4d385ade6215fcb89f8b92e6fd2bf4b) )
946//  ROM_LOAD_OPTIONAL( "8ddoslo.rom", 0x014000, 0x0100, CRC(0c82f636) SHA1(b29d151a0dfa3c7cd50439b51d0a8f95559bc2b6) )
947//  ROM_LOAD_OPTIONAL( "8ddoshi.rom", 0x014100, 0x0200, CRC(66309641) SHA1(9c2e82b3c4d385ade6215fcb89f8b92e6fd2bf4b) )
948948ROM_END
949949
950950
trunk/src/mess/drivers/orao.c
r31373r31374
190190   MCFG_CASSETTE_FORMATS(orao_cassette_formats)
191191   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
192192   MCFG_CASSETTE_INTERFACE("orao_cass")
193   
193
194194   MCFG_SOFTWARE_LIST_ADD("cass_list","orao")
195195MACHINE_CONFIG_END
196196
trunk/src/mess/drivers/pcm.c
r31373r31374
298298   MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
299299   // ZC0 : SIO channel A clock
300300   // ZC1 : SIO channel B clock
301   MCFG_Z80CTC_ZC2_CB(WRITELINE(pcm_state, pcm_82_w))   // speaker
301   MCFG_Z80CTC_ZC2_CB(WRITELINE(pcm_state, pcm_82_w))  // speaker
302302MACHINE_CONFIG_END
303303
304304/* ROM definition */
trunk/src/mess/drivers/cybiko.c
r31373r31374
154154static ADDRESS_MAP_START( cybikoxt_io, AS_IO, 16, cybiko_state )
155155   AM_RANGE(h8_device::PORT_A, h8_device::PORT_A) AM_READ(xtpower_r)
156156   AM_RANGE(h8_device::PORT_F, h8_device::PORT_F) AM_READWRITE(xtclock_r, xtclock_w)
157ADDRESS_MAP_END                         
157ADDRESS_MAP_END
158158
159159/////////////////
160160// INPUT PORTS //
r31373r31374
360360   MCFG_AT45DBXXX_SO_CALLBACK(DEVWRITELINE("maincpu:sci1", h8_sci_device, rx_w))
361361
362362   MCFG_NVRAM_ADD_0FILL("nvram")
363   
363
364364   /* internal ram */
365365   MCFG_RAM_ADD(RAM_TAG)
366366   MCFG_RAM_DEFAULT_SIZE("512K")
r31373r31374
397397
398398   // machine
399399   MCFG_DEVICE_REMOVE("flash1")
400   MCFG_SST_39VF400A_ADD("flashxt")   
400   MCFG_SST_39VF400A_ADD("flashxt")
401401
402402   /* internal ram */
403403   MCFG_RAM_MODIFY(RAM_TAG)
trunk/src/mess/drivers/apple2.c
r31373r31374
981981   SLOT_INTERFACE("corvus", A2BUS_CORVUS)  /* Corvus flat-cable HDD interface (must go in slot 6) */
982982   SLOT_INTERFACE("mcms1", A2BUS_MCMS1)  /* Mountain Computer Music System, card 1 of 2 */
983983   SLOT_INTERFACE("mcms2", A2BUS_MCMS2)  /* Mountain Computer Music System, card 2 of 2.  must be in card 1's slot + 1! */
984   SLOT_INTERFACE("dx1", A2BUS_DX1)   /* Decillonix DX-1 sampler card */
984   SLOT_INTERFACE("dx1", A2BUS_DX1)    /* Decillonix DX-1 sampler card */
985985SLOT_INTERFACE_END
986986
987987static SLOT_INTERFACE_START(apple2eaux_cards)
r31373r31374
10621062   /* default configuration: on real machine is present also in configurations */
10631063   /* with less memory, provided that the language card is installed           */
10641064   MCFG_CASSETTE_ADD( "cassette" )
1065   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)   
1065   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)
10661066MACHINE_CONFIG_END
10671067
10681068static MACHINE_CONFIG_DERIVED( apple2p, apple2_common )
r31373r31374
10781078   /* default configuration: on real machine is present also in configurations */
10791079   /* with less memory, provided that the language card is installed           */
10801080   MCFG_CASSETTE_ADD( "cassette" )
1081   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)   
1081   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)
10821082MACHINE_CONFIG_END
10831083
10841084static MACHINE_CONFIG_DERIVED( apple2e, apple2_common )
r31373r31374
11621162   MCFG_A2BUS_SLOT_REMOVE("sl7")
11631163
11641164   MCFG_DEVICE_ADD(IIC_ACIA1_TAG, MOS6551, 0)
1165   MCFG_MOS6551_XTAL(XTAL_14_31818MHz / 8)   // ~1.789 MHz
1165   MCFG_MOS6551_XTAL(XTAL_14_31818MHz / 8) // ~1.789 MHz
11661166   MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE(PRINTER_PORT_TAG, rs232_port_device, write_txd))
11671167
11681168   MCFG_DEVICE_ADD(IIC_ACIA2_TAG, MOS6551, 0)
1169   MCFG_MOS6551_XTAL(XTAL_1_8432MHz)   // matches SSC so modem software is compatible
1169   MCFG_MOS6551_XTAL(XTAL_1_8432MHz)   // matches SSC so modem software is compatible
11701170   MCFG_MOS6551_TXD_HANDLER(DEVWRITELINE("modem", rs232_port_device, write_txd))
11711171
11721172   MCFG_RS232_PORT_ADD(PRINTER_PORT_TAG, default_rs232_devices, NULL)
trunk/src/mess/drivers/fanucspmg.c
r31373r31374
456456              |      /-->| Graphic memory|------|                             |
457457              |      |   |---------------|      |                             |     |----------------|
458458              |      |                          |         |--------|          |<--->|RS232C interface|---CN2
459              |       |                          |         | BOOT   |<-------->|     |----------------|
459              |      |                          |         | BOOT   |<-------->|     |----------------|
460460              |      |                          |         | EPROM  |          |
461461              |      |   |----------------|     |         |--------|          |     |----------------|
462462              |<-----|-->|Character memory|--|  |                             |<--->|RS232C interface|---CN3
463463              |      |-->|----------------|  |  |         |--------|          |     |----------------|
464464              |      |                       |  |         |Main RAM|<-------->|
465465              |      |                       |  |         |--------|          |     |----------------|
466              |      |                        |  |                             |<--->|RS232C interface|---CN4
466              |      |                       |  |                             |<--->|RS232C interface|---CN4
467467              |      |                       |  |                             |     |----------------|
468468|---------|   |      |                       \/ \/                            |
469469|Keyboard |   \/     \---|---------------------------|                        |     |-----------------|  CN9  |--------|
r31373r31374
485485    - Shared RAM is 8k, but there are 2 6264s on the sub board.  Is shared RAM
486486       banked?
487487
488   To boot a floppy put "bp fc5fa,1,{ip=c682;g}" and "bp fc6d7,1,{ip=c755;g}"
489   into the debugger.
488    To boot a floppy put "bp fc5fa,1,{ip=c682;g}" and "bp fc6d7,1,{ip=c755;g}"
489    into the debugger.
490490
491   At NMI: f8008 must have bit 7 clear and bit 6 set (e008 on 8085)
492         f8009 must not equal 0x01 (e009 on 8085)
491    At NMI: f8008 must have bit 7 clear and bit 6 set (e008 on 8085)
492            f8009 must not equal 0x01 (e009 on 8085)
493493
494         8085 sets f8008 to keyboard row 0 AND 0xf3
495          "     "  f8009 to keyboard row 1
496 
494            8085 sets f8008 to keyboard row 0 AND 0xf3
495             "     "  f8009 to keyboard row 1
496
497497****************************************************************************/
498498
499499#include "emu.h"
r31373r31374
671671
672672READ16_MEMBER(fanucspmg_state::magic_r)
673673{
674   return 0x0041;   // 31 = memory error
674   return 0x0041;  // 31 = memory error
675675}
676676
677677static ADDRESS_MAP_START(maincpu_mem, AS_PROGRAM, 16, fanucspmg_state)
678678   AM_RANGE(0x00000, 0x7ffff) AM_RAM   // main RAM
679679
680   AM_RANGE(0x80000, 0x81fff) AM_RAM   // believed to be shared RAM with a CPU inside the Program File
681   AM_RANGE(0x88000, 0x88001) AM_NOP   // Program File "ready" bit
680   AM_RANGE(0x80000, 0x81fff) AM_RAM   // believed to be shared RAM with a CPU inside the Program File
681   AM_RANGE(0x88000, 0x88001) AM_NOP   // Program File "ready" bit
682682
683683   AM_RANGE(0xf0000, 0xf0003) AM_DEVREADWRITE8(PIC0_TAG, pic8259_device, read, write, 0x00ff)
684684   AM_RANGE(0xf0004, 0xf0007) AM_DEVICE8(FDC_TAG, upd765a_device, map, 0x00ff)
r31373r31374
831831      if (m_video_ctrl & 0x02)
832832      {
833833         if (offset <= 0x5ff)
834         {                                                 
834         {
835835            UINT8 chr = m_vram[offset + 0x600];
836836            UINT8 attr = m_vram[offset];
837837            UINT8 data = chargen[ chr + (ra * 256) ];
r31373r31374
879879      if (m_video_ctrl & 0x02)
880880      {
881881         if (offset <= 0x5ff)
882         {                                                 
882         {
883883            UINT8 chr = m_vram[offset + 0x600];
884//            UINT8 attr = m_vram[offset];
884//              UINT8 attr = m_vram[offset];
885885            UINT8 data = chargen[ chr + (ra * 256) ];
886886            UINT32 fg = 0xff00;
887887            UINT32 bg = 0;
r31373r31374
995995
996996ROM_START( fanucspgm )
997997   ROM_REGION(0x4000, MAINCPU_TAG, 0)
998   ROM_LOAD16_BYTE( "a25_001a.33e", 0x000000, 0x002000, CRC(81159267) SHA1(f5d53cc6e929f57e8c3747f80fc74d4b1643222d) )
999   ROM_LOAD16_BYTE( "a25_002a.35e", 0x000001, 0x002000, CRC(4fb82c4d) SHA1(eb75e9a2d3c8e4ad56a74624ee8c52c785bd0da6) )
998   ROM_LOAD16_BYTE( "a25_001a.33e", 0x000000, 0x002000, CRC(81159267) SHA1(f5d53cc6e929f57e8c3747f80fc74d4b1643222d) )
999   ROM_LOAD16_BYTE( "a25_002a.35e", 0x000001, 0x002000, CRC(4fb82c4d) SHA1(eb75e9a2d3c8e4ad56a74624ee8c52c785bd0da6) )
10001000
10011001   ROM_REGION(0x4000, SUBCPU_TAG, 0)
1002   ROM_LOAD( "a21_010f.17d", 0x000000, 0x002000, CRC(ef192717) SHA1(7fb3f7ca290d2437ae5956700f88c801018ce1cc) )
1002   ROM_LOAD( "a21_010f.17d", 0x000000, 0x002000, CRC(ef192717) SHA1(7fb3f7ca290d2437ae5956700f88c801018ce1cc) )
10031003
10041004   ROM_REGION(0x8000, CHARGEN_TAG, 0)
1005   ROM_LOAD( "a22_020b.5g",  0x000000, 0x002000, CRC(7b5f8e20) SHA1(9de607e541d8aad2d1ea56321270bb8466b16e3d) )
1005   ROM_LOAD( "a22_020b.5g",  0x000000, 0x002000, CRC(7b5f8e20) SHA1(9de607e541d8aad2d1ea56321270bb8466b16e3d) )
10061006ROM_END
10071007
10081008/* Driver */
trunk/src/mess/drivers/ondra.c
r31373r31374
139139   MCFG_CASSETTE_ADD( "cassette" )
140140   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
141141   MCFG_CASSETTE_INTERFACE("ondra_cass")
142   
142
143143   MCFG_SOFTWARE_LIST_ADD("cass_list","ondra")
144144
145145   /* internal ram */
trunk/src/mess/drivers/mz2000.c
r31373r31374
829829   MCFG_CASSETTE_FORMATS(mz700_cassette_formats)
830830   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
831831   MCFG_CASSETTE_INTERFACE("mz_cass")
832   
832
833833   MCFG_SOFTWARE_LIST_ADD("cass_list","mz2000_cass")
834834
835835   /* video hardware */
trunk/src/mess/drivers/amstrad.c
r31373r31374
883883   MCFG_CASSETTE_FORMATS(cdt_cassette_formats)
884884   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED)
885885   MCFG_CASSETTE_INTERFACE("cpc_cass")
886   
886
887887   MCFG_SOFTWARE_LIST_ADD("cass_list","cpc_cass")
888888
889889   MCFG_DEVICE_ADD("exp", CPC_EXPANSION_SLOT, 0)
r31373r31374
991991   MCFG_CPC_EXPANSION_SLOT_OUT_IRQ_CB(INPUTLINE("maincpu", 0))
992992   MCFG_CPC_EXPANSION_SLOT_OUT_NMI_CB(INPUTLINE("maincpu", INPUT_LINE_NMI))
993993   MCFG_CPC_EXPANSION_SLOT_OUT_ROMDIS_CB(WRITELINE(amstrad_state, cpc_romdis))  // ROMDIS
994   MCFG_CPC_EXPANSION_SLOT_OUT_ROMEN_CB(WRITELINE(amstrad_state, cpc_romen))  // /ROMEN   
994   MCFG_CPC_EXPANSION_SLOT_OUT_ROMEN_CB(WRITELINE(amstrad_state, cpc_romen))  // /ROMEN
995995
996996   /* internal ram */
997997   MCFG_RAM_ADD(RAM_TAG)
trunk/src/mess/drivers/pc1512.c
r31373r31374
12301230   MCFG_I8237_OUT_IOW_0_CB(WRITE8(pc1512_state, iow0_w))
12311231   MCFG_I8237_OUT_IOW_1_CB(WRITE8(pc1512_state, iow1_w))
12321232   MCFG_I8237_OUT_IOW_2_CB(WRITE8(pc1512_state, iow2_w))
1233   MCFG_I8237_OUT_IOW_3_CB(WRITE8(pc1512_state, iow3_w))   
1233   MCFG_I8237_OUT_IOW_3_CB(WRITE8(pc1512_state, iow3_w))
12341234   MCFG_I8237_OUT_DACK_0_CB(WRITELINE(pc1512_state, dack0_w))
12351235   MCFG_I8237_OUT_DACK_1_CB(WRITELINE(pc1512_state, dack1_w))
12361236   MCFG_I8237_OUT_DACK_2_CB(WRITELINE(pc1512_state, dack2_w))
r31373r31374
12571257   MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr))
12581258   MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts))
12591259   MCFG_INS8250_OUT_INT_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir4_w))
1260   
1260
12611261   MCFG_CENTRONICS_ADD("centronics", centronics_printers, "printer")
12621262   MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(pc1512_state, write_centronics_ack))
12631263   MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(pc1512_state, write_centronics_busy))
r31373r31374
13501350   MCFG_I8237_OUT_IOW_0_CB(WRITE8(pc1512_state, iow0_w))
13511351   MCFG_I8237_OUT_IOW_1_CB(WRITE8(pc1512_state, iow1_w))
13521352   MCFG_I8237_OUT_IOW_2_CB(WRITE8(pc1512_state, iow2_w))
1353   MCFG_I8237_OUT_IOW_3_CB(WRITE8(pc1512_state, iow3_w))   
1353   MCFG_I8237_OUT_IOW_3_CB(WRITE8(pc1512_state, iow3_w))
13541354   MCFG_I8237_OUT_DACK_0_CB(WRITELINE(pc1512_state, dack0_w))
13551355   MCFG_I8237_OUT_DACK_1_CB(WRITELINE(pc1512_state, dack1_w))
13561356   MCFG_I8237_OUT_DACK_2_CB(WRITELINE(pc1512_state, dack2_w))
r31373r31374
13771377   MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr))
13781378   MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts))
13791379   MCFG_INS8250_OUT_INT_CB(DEVWRITELINE(I8259A2_TAG, pic8259_device, ir4_w))
1380   
13811380
1381
13821382   MCFG_CENTRONICS_ADD("centronics", centronics_printers, "printer")
13831383   MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(pc1512_state, write_centronics_ack))
13841384   MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(pc1512_state, write_centronics_busy))
trunk/src/mess/drivers/bebox.c
r31373r31374
231231   MCFG_KBDC8042_KEYBOARD_TYPE(KBDC8042_STANDARD)
232232   MCFG_KBDC8042_SYSTEM_RESET_CB(INPUTLINE("ppc1", INPUT_LINE_RESET))
233233   MCFG_KBDC8042_INPUT_BUFFER_FULL_CB(WRITELINE(bebox_state, bebox_keyboard_interrupt))
234   
234
235235   /* internal ram */
236236   MCFG_RAM_ADD(RAM_TAG)
237237   MCFG_RAM_DEFAULT_SIZE("32M")
trunk/src/mess/drivers/iq151.c
r31373r31374
411411   MCFG_CASSETTE_ADD( "cassette" )
412412   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)
413413   MCFG_CASSETTE_INTERFACE("iq151_cass")
414   
414
415415   MCFG_TIMER_DRIVER_ADD_PERIODIC("cassette_timer", iq151_state, cassette_timer, attotime::from_hz(2000))
416416
417417   /* cartridge */
trunk/src/mess/drivers/tecnbras.c
r31373r31374
55  TECNBRAS dot matrix display (70x7 pixels)
66  Driver by Felipe Correa da Silva Sanches <juca@members.fsf.org>
77
8   The display is composed of 14 blocks of 5x7 LEDs
8    The display is composed of 14 blocks of 5x7 LEDs
99
10   These LEDs are driven by several 74xx chips:
11   * one 74138
12   * several 74164 and ULN2003 chips
10    These LEDs are driven by several 74xx chips:
11    * one 74138
12    * several 74164 and ULN2003 chips
1313
1414  Changelog:
1515
r31373r31374
3434   DECLARE_WRITE8_MEMBER(set_x_position_w);
3535   DECLARE_WRITE8_MEMBER(print_column_w);
3636
37//   DECLARE_WRITE8_MEMBER(tecnbras_io_w);
38//   DECLARE_READ8_MEMBER(tecnbras_io_r);
37//  DECLARE_WRITE8_MEMBER(tecnbras_io_w);
38//  DECLARE_READ8_MEMBER(tecnbras_io_r);
3939   DECLARE_DRIVER_INIT(tecnbras);
4040private:
41   int m_xcoord;
41   int m_xcoord;
4242   char m_digit[14][7];
4343   virtual void machine_start();
4444   virtual void machine_reset();
r31373r31374
8484void tecnbras_state::machine_start()
8585{
8686/*
87   for (int x=0; x<14; x++){
88      for (int y=0; y<7; y++){
89         output_set_indexed_value("dmd_", x*7 + y, y);
90      }
91   }
87    for (int x=0; x<14; x++){
88        for (int y=0; y<7; y++){
89            output_set_indexed_value("dmd_", x*7 + y, y);
90        }
91    }
9292*/
9393}
9494
r31373r31374
103103   MCFG_CPU_IO_MAP(i80c31_io)
104104
105105/* TODO: Add an I2C RTC (Phillips PCF8583P)
106   pin 6 (SCL): cpu T0/P3.4 (pin 14)
106   pin 6 (SCL): cpu T0/P3.4 (pin 14)
107107   pin 5 (SDA): cpu T1/P3.5 (pin 15)
108108*/
109109
110110/*
111   TODO: Add a speaker
112   CPU P1.0 (pin 1)
111    TODO: Add a speaker
112    CPU P1.0 (pin 1)
113113*/
114114
115115/*
116   TODO: Add a communications port to receive commands from the remote control
116    TODO: Add a communications port to receive commands from the remote control
117117*/
118118
119119   /* video hardware */
trunk/src/mess/drivers/pecom.c
r31373r31374
185185   MCFG_CASSETTE_ADD( "cassette" )
186186   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED)
187187   MCFG_CASSETTE_INTERFACE("pecom_cass")
188   
188
189189   MCFG_SOFTWARE_LIST_ADD("cass_list","pecom_cass")
190190
191191   /* internal ram */
trunk/src/mess/drivers/abc80x.c
r31373r31374
14471447
14481448   ROM_REGION( 0x200, "v50", 0 )
14491449   ROM_LOAD( "60 90242-01.7e", 0x000, 0x200, CRC(788a56d8) SHA1(d81e55cdddc36f5d41bf0a33104c75fac590b764) ) // "V50" 7621 (82S131), HR vertical timing 50Hz
1450   
1450
14511451   //ROM_REGION( 0x200, "v60", 0 )
14521452   //ROM_LOAD( "60 90319-01.7e", 0x000, 0x200, NO_DUMP ) // "V60" 7621 (82S131), HR vertical timing 60Hz
14531453
14541454   ROM_REGION( 0x400, "att_hand", 0 )
14551455   /*
1456      1   E6P (RAD A8)
1457      2   THP (chargen A12)
1458      3   CCLK
1459      4   B0 (TX ATT 6)
1460      5   B1 (TX ATT 7)
1461      6   CONDP (40/80)
1462      7   B2 (TX ATT 0)
1463      8   B3 (TX ATT 1)
1464      9   ULP (RAD A5)
1465      10  FLP (RAD A6)
1466      11  F2P (RTF)
1467      12  GND
1468      13  F3P (GTF)
1469      14  F4P (BTF)
1470      15  B5P (RTB)
1471      16  B4 (TX ATT 2)
1472      17  B5 (TX ATT 3)
1473      18  B6 (TX ATT 4)
1474      19  B7 (TX ATT 5)
1475      20  LP (*DEN+3)
1476      21  B6P (GTB)
1477      22  B7P (BTB)
1478      23  E5P (RAD A7)
1479      24  Vcc
1456       1   E6P (RAD A8)
1457       2   THP (chargen A12)
1458       3   CCLK
1459       4   B0 (TX ATT 6)
1460       5   B1 (TX ATT 7)
1461       6   CONDP (40/80)
1462       7   B2 (TX ATT 0)
1463       8   B3 (TX ATT 1)
1464       9   ULP (RAD A5)
1465       10  FLP (RAD A6)
1466       11  F2P (RTF)
1467       12  GND
1468       13  F3P (GTF)
1469       14  F4P (BTF)
1470       15  B5P (RTB)
1471       16  B4 (TX ATT 2)
1472       17  B5 (TX ATT 3)
1473       18  B6 (TX ATT 4)
1474       19  B7 (TX ATT 5)
1475       20  LP (*DEN+3)
1476       21  B6P (GTB)
1477       22  B7P (BTB)
1478       23  E5P (RAD A7)
1479       24  Vcc
14801480   */
14811481   ROM_LOAD( "60 90225-01.11c", 0x000, 0x400, NO_DUMP ) // "VIDEO ATTRIBUTE" 40033A (?)
14821482
trunk/src/mess/drivers/xerox820.c
r31373r31374
328328
329329       bit     description
330330
331      0       NBSY
331       0       NBSY
332332       1       NMSG
333333       2       NC/D
334334       3       NREQ
trunk/src/mess/drivers/lviv.c
r31373r31374
466466   MCFG_CASSETTE_FORMATS(lviv_lvt_format)
467467   MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED)
468468   MCFG_CASSETTE_INTERFACE("lviv_cass")
469   
469
470470   MCFG_SOFTWARE_LIST_ADD("cass_list","lviv")
471471
472472   /* internal ram */
trunk/src/mess/tools/castool/main.c
r31373r31374
8888   {"rka", rka_cassette_formats               ,"Apogee"},
8989   {"rkm", rkm_cassette_formats               ,"Mikrosha"},
9090   {"rkp", rkp_cassette_formats               ,"Partner"},
91   {"sc3000", sc3000_cassette_formats         ,"Sega SC-3000"},
91   {"sc3000", sc3000_cassette_formats         ,"Sega SC-3000"},
9292   {"sordm5", sordm5_cassette_formats         ,"Sord M5"},
9393   {"svi", svi_cassette_formats               ,"SVI"},
9494   {"to7", to7_cassette_formats               ,"Thomson TO"},
trunk/src/mess/tools/imgtool/modules/hp48.c
r31373r31374
2121
2222  Currently, we only support storing host files into backup objects and
2323  retreiving backup objects into files.
24  For attached library objects in the memory card, we only show their name, but
24  For attached library objects in the memory card, we only show their name, but
2525  cannot retrieve their contents.
2626
2727  To install a library contained in a host file, copy it with imgtool to
2828  the card; it creates a backup object visible in the "PORTS" menu;
29  then evalue the object, store it into some port (e.g, 0 STO),
30  turn off the HP48 and back on; the library should now be attached and
31  visible in the  "LIBRARY" menu.
32  (The process is similar to installing a library from a file you get
29  then evalue the object, store it into some port (e.g, 0 STO),
30  turn off the HP48 and back on; the library should now be attached and
31  visible in the  "LIBRARY" menu.
32  (The process is similar to installing a library from a file you get
3333  from the serial interface.)
3434*/
3535
r31373r31374
6060
6161   total length: len+4
6262
63   i.e., the backup object is a container containing the object name
64   and two objects: the  backuped object itself and a system integer
63   i.e., the backup object is a container containing the object name
64   and two objects: the  backuped object itself and a system integer
6565   that contains the CRC.
6666
67   HP48 host files start with a "HPHP48-X" header (where X can be any
68   single letter, which denotes a ROM revision and, implicitly, whether
67   HP48 host files start with a "HPHP48-X" header (where X can be any
68   single letter, which denotes a ROM revision and, implicitly, whether
6969   the program is for the S/SX or the G/GX family).
70   When storing a file to the memory card, we strip the header and
70   When storing a file to the memory card, we strip the header and
7171   embed the object into a backup object with the correct CRC.
72   When copying from the memory card to a host file, we extract the object
72   When copying from the memory card to a host file, we extract the object
7373   from the backup container, stripping its CRC, and add the HPHP48-X header.
7474
7575 */
r31373r31374
9191*****************************************************************************/
9292
9393
94struct hp48_card
94struct hp48_card
9595{
9696   imgtool_stream *stream;
97        int modified;
98       
99        /* size, in bytes of card data: from 32 KB to 4 MB */
100        int size;
101       
102        /* we store each nibble (4-bit) into its own byte, for simpler addressing;
103           hence, data has 2*size
104        */
105        UINT8* data;
106       
97      int modified;
98
99      /* size, in bytes of card data: from 32 KB to 4 MB */
100      int size;
101
102      /* we store each nibble (4-bit) into its own byte, for simpler addressing;
103         hence, data has 2*size
104      */
105      UINT8* data;
106
107107};
108108
109109struct hp48_partition
110110{
111        /* pointer to the begining of the partition inside the hp48_card */
112        UINT8* data;
111      /* pointer to the begining of the partition inside the hp48_card */
112      UINT8* data;
113113
114        /* size, in bytes (128 KB or less) */
115        int size;
116       
114      /* size, in bytes (128 KB or less) */
115      int size;
116
117117};
118118
119struct hp48_directory
119struct hp48_directory
120120{
121        int pos;
121      int pos;
122122};
123123
124124
r31373r31374
146146/*****************************************************************************
147147 Utility functions
148148*****************************************************************************/
149       
150149
150
151151/* byes to nibbles */
152152static void unpack(UINT8* dst, UINT8* src, int nsize)
153153{
154        int i;
154      int i;
155155
156        if ( nsize & 1 )
157        {
158                dst[nsize-1] = src[nsize/2] & 0xf;
159        }
156      if ( nsize & 1 )
157      {
158            dst[nsize-1] = src[nsize/2] & 0xf;
159      }
160160
161        for ( i = nsize/2-1; i >= 0; i-- )
162        {
163                dst[2*i+1] = src[i] >> 4;
164                dst[2*i  ] = src[i] & 0xf;
165        }
161      for ( i = nsize/2-1; i >= 0; i-- )
162      {
163            dst[2*i+1] = src[i] >> 4;
164            dst[2*i  ] = src[i] & 0xf;
165      }
166166}
167167
168168/* nibbles to bytes */
169169static void pack(UINT8* dst, UINT8* src, int nsize)
170170{
171        int i;
171      int i;
172172
173        for ( i = 0 ; i  < nsize/2; i++ )
174        {
175                dst[i] = (src[2*i] & 0xf) | (src[2*i+1] << 4);
176        }
173      for ( i = 0 ; i  < nsize/2; i++ )
174      {
175            dst[i] = (src[2*i] & 0xf) | (src[2*i+1] << 4);
176      }
177177
178        if ( nsize & 1 )
179        {
180                dst[nsize/2] = src[nsize-1] & 0xf;
181        }
182 }
178      if ( nsize & 1 )
179      {
180            dst[nsize/2] = src[nsize-1] & 0xf;
181      }
182   }
183183
184184
185185static int read20(UINT8* data)
186186{
187        return data[0] | (data[1] << 4) | (data[2] << 8) | (data[3] << 12) | (data[4] << 16);
187      return data[0] | (data[1] << 4) | (data[2] << 8) | (data[3] << 12) | (data[4] << 16);
188188}
189189
190190static int read8(UINT8* data)
191191{
192        return data[0] | (data[1] << 4);
192      return data[0] | (data[1] << 4);
193193}
194194
195195static void readstring(char* dst, UINT8* data, int nb)
196196{
197        int i;
198        for ( i = 0; i < nb; i++ )
199        {
200                dst[i] = read8( data + 2*i );
201        }
202        dst[nb] = 0;
197      int i;
198      for ( i = 0; i < nb; i++ )
199      {
200            dst[i] = read8( data + 2*i );
201      }
202      dst[nb] = 0;
203203}
204204
205205static void write20(UINT8* data, int v)
206206{
207        data[0] = v & 0xf;
208        data[1] = (v >> 4) & 0xf;
209        data[2] = (v >> 8) & 0xf;
210        data[3] = (v >> 12) & 0xf;
211        data[4] = (v >> 16) & 0xf;
207      data[0] = v & 0xf;
208      data[1] = (v >> 4) & 0xf;
209      data[2] = (v >> 8) & 0xf;
210      data[3] = (v >> 12) & 0xf;
211      data[4] = (v >> 16) & 0xf;
212212}
213213
214214static void write8(UINT8* data, int v)
215215{
216        data[0] = v & 0xf;
217        data[1] = (v >> 4) & 0xf;
216      data[0] = v & 0xf;
217      data[1] = (v >> 4) & 0xf;
218218}
219219
220220static void writestring(UINT8* data, const char* str, int nb)
221221{
222        int i;
223        for ( i = 0; i < nb; i++ )
224        {
225                write8( data + 2*i, str[i] );
226        }
222      int i;
223      for ( i = 0; i < nb; i++ )
224      {
225            write8( data + 2*i, str[i] );
226      }
227227}
228228
229229
230230/* go to the end, return its offset */
231231static int find_end(hp48_partition* p)
232232{
233        int pos = 0;
234        while (1)
235        {
236                if ( pos + 10 > 2*p->size) break;
237               
238                int prolog = read20( p->data + pos );
239                if ( !IS_OBJECT( prolog )) break;
240               
241                pos += read20( p->data + pos + 5 ) + 5;
242        }
243       
244        if ( pos > 2*p->size ) pos = 2*p->size;
245        return pos;
233      int pos = 0;
234      while (1)
235      {
236            if ( pos + 10 > 2*p->size) break;
237
238            int prolog = read20( p->data + pos );
239            if ( !IS_OBJECT( prolog )) break;
240
241            pos += read20( p->data + pos + 5 ) + 5;
242      }
243
244      if ( pos > 2*p->size ) pos = 2*p->size;
245      return pos;
246246}
247247
248248
249249/* find the backup object with the given name, returns its offset or -1 (not found) */
250250static int find_file(hp48_partition* p, const char* filename, int *ptotalsize, int* pstart, int* pcontentsize)
251251{
252        UINT8* data = p->data;
253        int pos = 0;
252      UINT8* data = p->data;
253      int pos = 0;
254254
255       /* find file */
256        while (1)
257        {
258                if ( pos + 10 > 2*p->size) return -1;
259               
260                /* get prolog */
261                int prolog = read20( data+pos );
262                if ( !IS_OBJECT(prolog)) return -1;
255      /* find file */
256      while (1)
257      {
258            if ( pos + 10 > 2*p->size) return -1;
263259
264                /* get size */
265                int totalsize = read20( data+pos+5 );
266                if ( totalsize < 14) return -1;
267                if ( pos + 5 + totalsize > 2*p->size ) return -1;
260            /* get prolog */
261            int prolog = read20( data+pos );
262            if ( !IS_OBJECT(prolog)) return -1;
268263
269                if ( prolog == PROLOG_BACKUP )
270                {
271                        /* get name */
272                        int namelen = read8( data + pos + 10 );
273                        char name[257];
274                        if ( 9 + 2*namelen > totalsize ) return -1;
275                        readstring( name, data + pos + 12, namelen );
264            /* get size */
265            int totalsize = read20( data+pos+5 );
266            if ( totalsize < 14) return -1;
267            if ( pos + 5 + totalsize > 2*p->size ) return -1;
276268
277                        /* check name */
278                        if ( !strcmp( name, filename ) )
279                        {
280                                /* found! */
281                                if ( ptotalsize ) *ptotalsize = totalsize;
282                                if ( pstart ) *pstart = pos + 14 + 2*namelen;
283                                if ( pcontentsize ) *pcontentsize = totalsize - (9 + 2*namelen);
284                                return pos;
285                        }
286                        else
287                        {
288                                /* skip */
289                                pos += totalsize + 5;
290                        }
291                }
292                else
293                {
294                        /* skip */
295                        pos += totalsize + 5;
296                }
269            if ( prolog == PROLOG_BACKUP )
270            {
271                  /* get name */
272                  int namelen = read8( data + pos + 10 );
273                  char name[257];
274                  if ( 9 + 2*namelen > totalsize ) return -1;
275                  readstring( name, data + pos + 12, namelen );
297276
298        }
277                  /* check name */
278                  if ( !strcmp( name, filename ) )
279                  {
280                        /* found! */
281                        if ( ptotalsize ) *ptotalsize = totalsize;
282                        if ( pstart ) *pstart = pos + 14 + 2*namelen;
283                        if ( pcontentsize ) *pcontentsize = totalsize - (9 + 2*namelen);
284                        return pos;
285                  }
286                  else
287                  {
288                        /* skip */
289                        pos += totalsize + 5;
290                  }
291            }
292            else
293            {
294                  /* skip */
295                  pos += totalsize + 5;
296            }
299297
300        return -1;
298      }
299
300      return -1;
301301}
302302
303303
304/* CRC computing.
304/* CRC computing.
305305   This is the same CRC that is computed by the HP48 hardware.
306306 */
307307static UINT16 crc(UINT8* data, int len)
308308{
309        UINT16 crc = 0;
310        int i;
309      UINT16 crc = 0;
310      int i;
311311
312        for ( i = 0; i < len; i++ )
313        {
314                crc = (crc >> 4) ^ (((crc ^ data[i]) & 0xf) * 0x1081);
315        }
316       
317        return crc;
312      for ( i = 0; i < len; i++ )
313      {
314            crc = (crc >> 4) ^ (((crc ^ data[i]) & 0xf) * 0x1081);
315      }
316
317      return crc;
318318}
319319
320320
r31373r31374
329329   hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img );
330330   int size = stream_size( stream );
331331
332        /* check that size is a power of 2 between 32 KB and 4 MG */
333        if ( (size < 32 * 1024) ||
334             (size > 4 * 1024 * 1024) ||
335             (size & (size-1)) )
336        {
337                return IMGTOOLERR_CORRUPTIMAGE;
338        }
332      /* check that size is a power of 2 between 32 KB and 4 MG */
333      if ( (size < 32 * 1024) ||
334            (size > 4 * 1024 * 1024) ||
335            (size & (size-1)) )
336      {
337            return IMGTOOLERR_CORRUPTIMAGE;
338      }
339339
340        /* store info */
340      /* store info */
341341   c->stream = stream;
342342   c->modified = 0;
343        c->size = size;
344        c->data = (UINT8*) malloc( 2 * size );
345        if ( !c->data )
346        {
347                return IMGTOOLERR_READERROR;
348        }
343      c->size = size;
344      c->data = (UINT8*) malloc( 2 * size );
345      if ( !c->data )
346      {
347            return IMGTOOLERR_READERROR;
348      }
349349
350        /* fully load image */
350      /* fully load image */
351351   stream_seek( stream, 0, SEEK_SET );
352352   if ( stream_read( stream, c->data, size ) < size )
353        {
354                return IMGTOOLERR_READERROR;
355        }
356        unpack( c->data, c->data, 2 * size );
353      {
354            return IMGTOOLERR_READERROR;
355      }
356      unpack( c->data, c->data, 2 * size );
357357
358358   return IMGTOOLERR_SUCCESS;
359359}
r31373r31374
367367   hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img );
368368   int size;
369369
370        size = option_resolution_lookup_int(opts, 'S');
370      size = option_resolution_lookup_int(opts, 'S');
371371
372        c->stream = stream;
373        c->modified = 1;
374        c->size = size * 1024;
375        c->data = (UINT8*) malloc( 2 * c->size );
376        if ( !c->data )
377        {
378                return IMGTOOLERR_READERROR;
379        }
372      c->stream = stream;
373      c->modified = 1;
374      c->size = size * 1024;
375      c->data = (UINT8*) malloc( 2 * c->size );
376      if ( !c->data )
377      {
378            return IMGTOOLERR_READERROR;
379      }
380380
381        /* zeroing the image seems fine */
382        memset( c->data, 0, 2 * c->size );
381      /* zeroing the image seems fine */
382      memset( c->data, 0, 2 * c->size );
383383
384384   return IMGTOOLERR_SUCCESS;
385385}
r31373r31374
390390{
391391   hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img );
392392
393   if ( c->modified )
394        {
395                /* save image */
396                pack( c->data, c->data, 2 * c->size );
397                stream_seek( c->stream, 0, SEEK_SET );
398                stream_write( c->stream, c->data, c->size );
399        }
393   if ( c->modified )
394      {
395            /* save image */
396            pack( c->data, c->data, 2 * c->size );
397            stream_seek( c->stream, 0, SEEK_SET );
398            stream_write( c->stream, c->data, c->size );
399      }
400400
401        /* clean up */
402        free( c->data );
401      /* clean up */
402      free( c->data );
403403   stream_close( c->stream );
404404}
405405
r31373r31374
411411void hp48_partition_get_info(const imgtool_class *imgclass, UINT32 state, union imgtoolinfo *info);
412412
413413static imgtoolerr_t hp48_list_partitions(imgtool_image *img,
414                                         imgtool_partition_info *partitions,
415                                         size_t len)
416{       
414                                 imgtool_partition_info *partitions,
415                                 size_t len)
416{
417417   hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img );
418418
419        int i;
420        for ( i = 0; i < len && i * MAX_PORT_SIZE < c->size ; i++ )
421        {
422                /* offset and size in bytes */
423                partitions[i].base_block = i * MAX_PORT_SIZE;
424                partitions[i].block_count = c->size - partitions[i].base_block;
425                if ( partitions[i].block_count > MAX_PORT_SIZE )
426                {
427                        partitions[i].block_count = MAX_PORT_SIZE;
428                }
419      int i;
420      for ( i = 0; i < len && i * MAX_PORT_SIZE < c->size ; i++ )
421      {
422            /* offset and size in bytes */
423            partitions[i].base_block = i * MAX_PORT_SIZE;
424            partitions[i].block_count = c->size - partitions[i].base_block;
425            if ( partitions[i].block_count > MAX_PORT_SIZE )
426            {
427                  partitions[i].block_count = MAX_PORT_SIZE;
428            }
429429
430                partitions[i].get_info = hp48_partition_get_info;
431        }
430            partitions[i].get_info = hp48_partition_get_info;
431      }
432432
433433   return IMGTOOLERR_SUCCESS;
434434}
r31373r31374
436436static imgtoolerr_t hp48_open_partition(imgtool_partition *part,
437437               UINT64 first_block, UINT64 block_count)
438438{
439       
440439   imgtool_image* img = imgtool_partition_image( part );
441440   hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img );
442441   hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part );
443442
444        if ( first_block + block_count > c->size )
445                return IMGTOOLERR_INVALIDPARTITION;
443      if ( first_block + block_count > c->size )
444            return IMGTOOLERR_INVALIDPARTITION;
446445
447        /* store partition position */
448        p->data = c->data + first_block;
449        p->size = block_count;
446      /* store partition position */
447      p->data = c->data + first_block;
448      p->size = block_count;
450449
451450   return IMGTOOLERR_SUCCESS;
452451}
r31373r31374
454453
455454
456455static imgtoolerr_t hp48_beginenum(imgtool_directory *enumeration,
457                                   const char *path)
456                           const char *path)
458457{
459458   hp48_directory* d = (hp48_directory*) imgtool_directory_extrabytes( enumeration );
460459
461        d->pos = 0;
460      d->pos = 0;
462461
463462   return IMGTOOLERR_SUCCESS;
464463}
r31373r31374
466465
467466
468467static imgtoolerr_t hp48_nextenum(imgtool_directory *enumeration,
469                                  imgtool_dirent *ent)
468                           imgtool_dirent *ent)
470469{
471470   imgtool_partition *part = imgtool_directory_partition( enumeration );
472471   //imgtool_image* img = imgtool_partition_image( part );
r31373r31374
474473   hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part );
475474   hp48_directory* d = (hp48_directory*) imgtool_directory_extrabytes( enumeration );
476475
477        UINT8* data = p->data;
478        int pos = d->pos;
476      UINT8* data = p->data;
477      int pos = d->pos;
479478
480        if ( pos < 0 || pos+12 > 2*p->size )
481        {
482                ent->eof = 1;
483                return IMGTOOLERR_SUCCESS;
484        }
485       
486        int prolog = read20( data+pos );
479      if ( pos < 0 || pos+12 > 2*p->size )
480      {
481            ent->eof = 1;
482            return IMGTOOLERR_SUCCESS;
483      }
487484
488        if ( IS_OBJECT(prolog) )
489        {
490                pos += 5;
491                int totalsize = read20( data+pos );
492                pos += 5;
485      int prolog = read20( data+pos );
493486
494                int namelen = read8( data+pos );
495                pos += 2;
496                if ( (pos + 2*namelen > 2*p->size) ||
497                     (namelen >= sizeof(ent->filename)) )
498                {
499                        ent->eof = 1;
500                        return IMGTOOLERR_CORRUPTFILE;
501                }
502                readstring( ent->filename, data+pos, namelen );
487      if ( IS_OBJECT(prolog) )
488      {
489            pos += 5;
490            int totalsize = read20( data+pos );
491            pos += 5;
503492
504                /* compute size in bytes, removing name, length & CRC fields */
493            int namelen = read8( data+pos );
494            pos += 2;
495            if ( (pos + 2*namelen > 2*p->size) ||
496                  (namelen >= sizeof(ent->filename)) )
497            {
498                  ent->eof = 1;
499                  return IMGTOOLERR_CORRUPTFILE;
500            }
501            readstring( ent->filename, data+pos, namelen );
502
503            /* compute size in bytes, removing name, length & CRC fields */
505504      ent->filesize = ((totalsize - 19 - 2*namelen) + 1) / 2;
506505
507                switch (prolog)
508                {
509                case PROLOG_LIBRARY:  strncpy( ent->attr, "LIB", sizeof(ent->attr) ); break;
510                case PROLOG_BACKUP:   strncpy( ent->attr, "BAK", sizeof(ent->attr) ); break;
511                default:              strncpy( ent->attr, "?", sizeof(ent->attr) );
512                }
506            switch (prolog)
507            {
508            case PROLOG_LIBRARY:  strncpy( ent->attr, "LIB", sizeof(ent->attr) ); break;
509            case PROLOG_BACKUP:   strncpy( ent->attr, "BAK", sizeof(ent->attr) ); break;
510            default:              strncpy( ent->attr, "?", sizeof(ent->attr) );
511            }
513512
514                d->pos = d->pos + totalsize + 5;
515        }
516        else               
517        {
518                /* 0 or unknown object => end */
519                ent->eof = 1;
520        }
513            d->pos = d->pos + totalsize + 5;
514      }
515      else
516      {
517            /* 0 or unknown object => end */
518            ent->eof = 1;
519      }
521520
522521   return IMGTOOLERR_SUCCESS;
523522}
524523
525524
526       
525
527526static imgtoolerr_t hp48_freespace(imgtool_partition *part, UINT64 *size)
528527{
529528   //imgtool_image* img = imgtool_partition_image( part );
530    //hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img );
529   //hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img );
531530   hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part );
532531
533        *size = p->size - (find_end(p)+1)/2;
532      *size = p->size - (find_end(p)+1)/2;
534533
535534   return IMGTOOLERR_SUCCESS;
536535}
r31373r31374
538537
539538
540539static imgtoolerr_t hp48_readfile(imgtool_partition *part,
541                                  const char *filename,
542                                  const char *fork,
543                                  imgtool_stream *destf)
540                           const char *filename,
541                           const char *fork,
542                           imgtool_stream *destf)
544543{
545544   //imgtool_image* img = imgtool_partition_image( part );
546545   //hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img );
547546   hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part );
548547
549        /* find entry */
550        int totalsize, start, size;
551        int pos = find_file(p, filename, &totalsize, &start, &size);
552        if ( pos == -1 )
553        {
554                return IMGTOOLERR_FILENOTFOUND;
555        }
548      /* find entry */
549      int totalsize, start, size;
550      int pos = find_file(p, filename, &totalsize, &start, &size);
551      if ( pos == -1 )
552      {
553            return IMGTOOLERR_FILENOTFOUND;
554      }
556555
557        /* CRC check */
558        UINT16 objcrc = read20( p->data + pos + totalsize ) >> 4;
559        UINT16 mycrc = crc( p->data + pos + 5, totalsize - 4);
560        if ( objcrc != mycrc )
561        {
562                return IMGTOOLERR_CORRUPTIMAGE;
563        }
564        size -= 10;
556      /* CRC check */
557      UINT16 objcrc = read20( p->data + pos + totalsize ) >> 4;
558      UINT16 mycrc = crc( p->data + pos + 5, totalsize - 4);
559      if ( objcrc != mycrc )
560      {
561            return IMGTOOLERR_CORRUPTIMAGE;
562      }
563      size -= 10;
565564
566        /* save header */
567        stream_write( destf, hp48_prefix, 8);
565      /* save header */
566      stream_write( destf, hp48_prefix, 8);
568567
569        /* save contents to host file */
570        int bytesize = (size + 1) / 2;
571        UINT8* buf = (UINT8*) malloc( bytesize );
572        if (!buf)
573        {
574                return IMGTOOLERR_FILENOTFOUND;
575        }
576        pack( buf, p->data + start, size );
577        stream_write( destf, buf, bytesize );
578        free( buf );
579       
580        return IMGTOOLERR_SUCCESS;
568      /* save contents to host file */
569      int bytesize = (size + 1) / 2;
570      UINT8* buf = (UINT8*) malloc( bytesize );
571      if (!buf)
572      {
573            return IMGTOOLERR_FILENOTFOUND;
574      }
575      pack( buf, p->data + start, size );
576      stream_write( destf, buf, bytesize );
577      free( buf );
578
579      return IMGTOOLERR_SUCCESS;
581580}
582581
583582
584583
585584static imgtoolerr_t hp48_deletefile(imgtool_partition *part,
586                                    const char *filename)
585                           const char *filename)
587586{
588587   imgtool_image* img = imgtool_partition_image( part );
589        hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img );
588      hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img );
590589   hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part );
591590
592        /* find entry */
593        int totalsize;
594        int pos = find_file(p, filename, &totalsize, NULL, NULL );
595        if ( pos == -1 )
596        {
597                return IMGTOOLERR_FILENOTFOUND;
598        }
591      /* find entry */
592      int totalsize;
593      int pos = find_file(p, filename, &totalsize, NULL, NULL );
594      if ( pos == -1 )
595      {
596            return IMGTOOLERR_FILENOTFOUND;
597      }
599598
600        /* move */
601        totalsize += 5;
602        memmove( p->data+pos, p->data+pos+totalsize, 2*p->size-(pos+totalsize) );
603        memset( p->data + 2*p->size-totalsize, 0, totalsize);
604        c->modified = 1;
599      /* move */
600      totalsize += 5;
601      memmove( p->data+pos, p->data+pos+totalsize, 2*p->size-(pos+totalsize) );
602      memset( p->data + 2*p->size-totalsize, 0, totalsize);
603      c->modified = 1;
605604
606605   return IMGTOOLERR_SUCCESS;
607606}
r31373r31374
609608
610609
611610static imgtoolerr_t hp48_writefile(imgtool_partition *part,
612                                   const char *filename,
613                                   const char *fork,
614                                   imgtool_stream *sourcef,
615                                   option_resolution *opts)
611                           const char *filename,
612                           const char *fork,
613                           imgtool_stream *sourcef,
614                           option_resolution *opts)
616615{
617616   imgtool_image* img = imgtool_partition_image( part );
618        hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img );
617      hp48_card* c = (hp48_card*) imgtool_image_extra_bytes( img );
619618   hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part );
620619
621        /* check header */
622        char head[8];
623        stream_read( sourcef, head, 8 );
624        if ( memcmp( head, hp48_prefix, 7) )
625        {
626                return IMGTOOLERR_READERROR;
627        }
620      /* check header */
621      char head[8];
622      stream_read( sourcef, head, 8 );
623      if ( memcmp( head, hp48_prefix, 7) )
624      {
625            return IMGTOOLERR_READERROR;
626      }
628627
629        /* ensure that the file does not exist */
630        /* TODO: resize the existing file instead, to keep it in place? */
631        hp48_deletefile( part, filename );
628      /* ensure that the file does not exist */
629      /* TODO: resize the existing file instead, to keep it in place? */
630      hp48_deletefile( part, filename );
632631
633        /* goto end */
634        //UINT8* data = p->data;
635        int pos = find_end(p);
632      /* goto end */
633      //UINT8* data = p->data;
634      int pos = find_end(p);
636635
637        int len = strlen( filename );
638        if ( len > 255 ) len = 255;
636      int len = strlen( filename );
637      if ( len > 255 ) len = 255;
639638
640        /* check size */
639      /* check size */
641640   int filesize = stream_size( sourcef ) - 8;
642        if ( pos + 2*filesize + 24 + 2*len > 2 * p->size )
643        {
644                return IMGTOOLERR_NOSPACE;
645        }
641      if ( pos + 2*filesize + 24 + 2*len > 2 * p->size )
642      {
643            return IMGTOOLERR_NOSPACE;
644      }
646645
647        /* load file */
648        UINT8* buf = (UINT8*) malloc( filesize );
649        if ( !buf ) return IMGTOOLERR_NOSPACE;
650        stream_read( sourcef, buf, filesize );
646      /* load file */
647      UINT8* buf = (UINT8*) malloc( filesize );
648      if ( !buf ) return IMGTOOLERR_NOSPACE;
649      stream_read( sourcef, buf, filesize );
651650
652        /* store backup object */
653        int org = pos;
654        int totalsize = 2*filesize + 19 + 2*len;
655        write20( p->data+pos, PROLOG_BACKUP );
656        pos +=5;
657        write20( p->data+pos, totalsize );
658        pos +=5;
659        write8( p->data+pos, len );
660        pos += 2;
661        writestring( p->data+pos, filename, len );
662        pos += 2*len;
663        write8( p->data+pos, len );
664        pos += 2;
665        unpack( p->data+pos, buf, 2*filesize );
666        pos += 2*filesize;
651      /* store backup object */
652      int org = pos;
653      int totalsize = 2*filesize + 19 + 2*len;
654      write20( p->data+pos, PROLOG_BACKUP );
655      pos +=5;
656      write20( p->data+pos, totalsize );
657      pos +=5;
658      write8( p->data+pos, len );
659      pos += 2;
660      writestring( p->data+pos, filename, len );
661      pos += 2*len;
662      write8( p->data+pos, len );
663      pos += 2;
664      unpack( p->data+pos, buf, 2*filesize );
665      pos += 2*filesize;
667666
668        /* store crc */
669        write20( p->data+pos, PROLOG_SYSINT );
670        pos += 5;
671        p->data[pos] = 0;
672        write20( p->data+pos, crc(p->data+org+5, totalsize-4) << 4 );
667      /* store crc */
668      write20( p->data+pos, PROLOG_SYSINT );
669      pos += 5;
670      p->data[pos] = 0;
671      write20( p->data+pos, crc(p->data+org+5, totalsize-4) << 4 );
673672
674        free(buf);
673      free(buf);
675674
676        c->modified = 1;
675      c->modified = 1;
677676
678677   return IMGTOOLERR_SUCCESS;
679678}
r31373r31374
705704      case IMGTOOLINFO_PTR_FREE_SPACE:                    info->free_space  = hp48_freespace; break;
706705      case IMGTOOLINFO_PTR_READ_FILE:                     info->read_file   = hp48_readfile; break;
707706      case IMGTOOLINFO_PTR_WRITE_FILE:                    info->write_file  = hp48_writefile; break;
708                case IMGTOOLINFO_PTR_DELETE_FILE:                   info->delete_file = hp48_deletefile; break;
707            case IMGTOOLINFO_PTR_DELETE_FILE:                   info->delete_file = hp48_deletefile; break;
709708
710709      case IMGTOOLINFO_INT_PARTITION_EXTRA_BYTES:         info->i = sizeof(hp48_partition); break;
711710      case IMGTOOLINFO_INT_DIRECTORY_EXTRA_BYTES:         info->i = sizeof(hp48_directory); break;
r31373r31374
730729      case IMGTOOLINFO_PTR_OPEN:                          info->open        = hp48_open; break;
731730      case IMGTOOLINFO_PTR_CREATE:                        info->create      = hp48_create; break;
732731      case IMGTOOLINFO_PTR_CLOSE:                         info->close       = hp48_close; break;
733                case IMGTOOLINFO_PTR_LIST_PARTITIONS:               info->list_partitions = hp48_list_partitions; break;
732            case IMGTOOLINFO_PTR_LIST_PARTITIONS:               info->list_partitions = hp48_list_partitions; break;
734733
735734      case IMGTOOLINFO_INT_IMAGE_EXTRA_BYTES:             info->i = sizeof(hp48_card); break;
736        }
735      }
737736}
trunk/src/mess/machine/radio86.c
r31373r31374
221221{
222222   m_charmap = memregion("gfx1")->base();
223223}
224
trunk/src/mess/machine/genpc.c
r31373r31374
422422   MCFG_I8237_OUT_DACK_1_CB(WRITELINE(ibm5160_mb_device, pc_dack1_w))
423423   MCFG_I8237_OUT_DACK_2_CB(WRITELINE(ibm5160_mb_device, pc_dack2_w))
424424   MCFG_I8237_OUT_DACK_3_CB(WRITELINE(ibm5160_mb_device, pc_dack3_w))
425   
425
426426   MCFG_PIC8259_ADD( "pic8259", INPUTLINE(":maincpu", 0), VCC, NULL )
427427
428428   MCFG_DEVICE_ADD("ppi8255", I8255A, 0)
trunk/src/mess/machine/amstrad.c
r31373r31374
28222822      8,  0,  0,  0,  8,  0,  0,  0,  8,  0,  0,  0,  8,  0,  0,  0
28232823};
28242824
2825#define NEXT_ROM_SLOT    m_rom_count++; \
2825#define NEXT_ROM_SLOT   m_rom_count++; \
28262826                  if(slot3 && m_rom_count == 3) m_rom_count++; \
28272827                  if(slot7 && m_rom_count == 7) m_rom_count++;
28282828
trunk/src/mess/machine/msx_switched.c
r31373r31374
1818   space.install_read_handler(start, end, read8_delegate(FUNC(msx_switched_device::io_read), this));
1919   space.install_write_handler(start, end, write8_delegate(FUNC(msx_switched_device::io_write), this));
2020}
21
trunk/src/mess/machine/dec_lk201.c
r31373r31374
230230
231231   DEC omitted terms like 'Interrupt', 'Break' and 'Data / Talk' on some keyboards,
232232   so Fn numbers are definitely important for end users.
233
233
234234   === CURRENT SPECIAL KEYS ===
235   [PC-AT] ......=> [DEC]
236   LEFT CONTROL..=> Control
237   LEFT ALT .....=> Compose
238   
239   RIGHT ALT ....=> Help
240   RIGHT CONTROL => Do
235   [PC-AT] ......=> [DEC]
236   LEFT CONTROL..=> Control
237   LEFT ALT .....=> Compose
238
239   RIGHT ALT ....=> Help
240   RIGHT CONTROL => Do
241241   ==============================================================================================
242242   === (PC - AT ) keys above cursor block ===
243243   * KEYCODE_INSERT * KEYCODE_HOME * KEYCODE_PGUP
r31373r31374
249249   ==============================================================================================
250250   === CURRENT NUM PAD ASSIGNMENTS ===
251251   [PF1] to [PF4] are mapped to NUM LOCK, SLASH etc. (=> 4 keys on top on num pad).
252   Num pad '+' gives         ',' on the DEC. 
252   Num pad '+' gives         ',' on the DEC.
253253           ',' translates to '.' (=> more or less the layout of model 'LK-201-AG')
254         
254
255255   Switch between 'full' and 'partial keyboard emulation' with Scroll Lock.
256256*/
257257
r31373r31374
276276   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED )
277277   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Compose") PORT_CODE(KEYCODE_LALT)
278278   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK)
279   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL)
279   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL)
280280
281281   PORT_START("KBD2")
282282   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Z") PORT_CODE(KEYCODE_Z)
r31373r31374
369369   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
370370
371371   PORT_START("KBD11")
372   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH) 
373   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(";") PORT_CODE(KEYCODE_COLON)     
372   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("/") PORT_CODE(KEYCODE_SLASH)
373   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME(";") PORT_CODE(KEYCODE_COLON)
374374   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) // FIXME - duplicate "Return"
375375   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("P") PORT_CODE(KEYCODE_P)
376376   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0)
r31373r31374
394394   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE)
395395   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("[") PORT_CODE(KEYCODE_OPENBRACE)
396396   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Previous [^]") PORT_CODE(KEYCODE_END)
397   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Do (F16) [Ausfuehren]") PORT_CODE(KEYCODE_RCONTROL)
397   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Do (F16) [Ausfuehren]") PORT_CODE(KEYCODE_RCONTROL)
398398   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS)
399399   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Insert Here") PORT_CODE(KEYCODE_HOME)
400400
r31373r31374
433433   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("Num ,") PORT_CODE(KEYCODE_PLUS_PAD)
434434   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) // PORT_NAME("Num -") = duplicate...see KBD13
435435   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("PF4") PORT_CODE(KEYCODE_MINUS_PAD)
436   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F20")
436   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F20")
437437   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED )
438438   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_NAME("F19")
439439   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
r31373r31374
755755
756756//  printf("SPI %02x to %x (PC=%x)\n", data, offset, m_maincpu->pc());
757757}
758
trunk/src/mess/machine/nes.c
r31373r31374
158158      m_ppu->set_latch(ppu2c0x_latch_delegate(FUNC(device_nes_cart_interface::ppu_latch),m_cartslot->m_cart));
159159
160160      // install additional handlers (read_h, read_ex, write_ex)
161      if (m_cartslot->get_pcb_id() == STD_EXROM || m_cartslot->get_pcb_id() == STD_NROM368
161      if (m_cartslot->get_pcb_id() == STD_EXROM || m_cartslot->get_pcb_id() == STD_NROM368
162162         || m_cartslot->get_pcb_id() == GG_NROM || m_cartslot->get_pcb_id() == CAMERICA_ALADDIN || m_cartslot->get_pcb_id() == SUNSOFT_DCS
163163         || m_cartslot->get_pcb_id() == BANDAI_DATACH || m_cartslot->get_pcb_id() == BANDAI_KARAOKE || m_cartslot->get_pcb_id() == BTL_2A03_PURITANS || m_cartslot->get_pcb_id() == AVE_MAXI15
164164         || m_cartslot->get_pcb_id() == KAISER_KS7022 || m_cartslot->get_pcb_id() == KAISER_KS7031 || m_cartslot->get_pcb_id() == BMC_VT5201
trunk/src/mess/machine/msx.c
r31373r31374
527527      this->space().write_byte( (m_current_switched_device << 8) | offset, data );
528528   }
529529}
530
trunk/src/mess/machine/apollo.c
r31373r31374
9797      PORT_CONFSETTING(0x00, DEF_STR ( Off ) )
9898      PORT_CONFSETTING(APOLLO_CONF_25_YEARS_AGO, DEF_STR ( On ) )
9999
100//      PORT_CONFNAME(APOLLO_CONF_NODE_ID, APOLLO_CONF_NODE_ID, "Node ID from Disk")
101//      PORT_CONFSETTING(0x00, DEF_STR ( Off ) )
102//      PORT_CONFSETTING(APOLLO_CONF_NODE_ID, DEF_STR ( On ) )
100//      PORT_CONFNAME(APOLLO_CONF_NODE_ID, APOLLO_CONF_NODE_ID, "Node ID from Disk")
101//      PORT_CONFSETTING(0x00, DEF_STR ( Off ) )
102//      PORT_CONFSETTING(APOLLO_CONF_NODE_ID, DEF_STR ( On ) )
103103
104//      PORT_CONFNAME(APOLLO_CONF_IDLE_SLEEP, 0x00, "Idle Sleep")
105//      PORT_CONFSETTING(0x00, DEF_STR ( Off ) )
106//      PORT_CONFSETTING(APOLLO_CONF_IDLE_SLEEP, DEF_STR ( On ) )
104//      PORT_CONFNAME(APOLLO_CONF_IDLE_SLEEP, 0x00, "Idle Sleep")
105//      PORT_CONFSETTING(0x00, DEF_STR ( Off ) )
106//      PORT_CONFSETTING(APOLLO_CONF_IDLE_SLEEP, DEF_STR ( On ) )
107107
108108      PORT_CONFNAME(APOLLO_CONF_TRAP_TRACE, 0x00, "Trap Trace")
109109      PORT_CONFSETTING(0x00, DEF_STR ( Off ) )
r31373r31374
113113      PORT_CONFSETTING(0x00, DEF_STR ( Off ) )
114114      PORT_CONFSETTING(APOLLO_CONF_FPU_TRACE, DEF_STR ( On ) )
115115
116//      PORT_CONFNAME(APOLLO_CONF_DISK_TRACE, 0x00, "Disk Trace")
117//      PORT_CONFSETTING(0x00, DEF_STR ( Off ) )
118//      PORT_CONFSETTING(APOLLO_CONF_DISK_TRACE, DEF_STR ( On ) )
116//      PORT_CONFNAME(APOLLO_CONF_DISK_TRACE, 0x00, "Disk Trace")
117//      PORT_CONFSETTING(0x00, DEF_STR ( Off ) )
118//      PORT_CONFSETTING(APOLLO_CONF_DISK_TRACE, DEF_STR ( On ) )
119119
120//      PORT_CONFNAME(APOLLO_CONF_NET_TRACE, 0x00, "Network Trace")
121//      PORT_CONFSETTING(0x00, DEF_STR ( Off ) )
122//      PORT_CONFSETTING(APOLLO_CONF_NET_TRACE, DEF_STR ( On ) )
120//      PORT_CONFNAME(APOLLO_CONF_NET_TRACE, 0x00, "Network Trace")
121//      PORT_CONFSETTING(0x00, DEF_STR ( Off ) )
122//      PORT_CONFSETTING(APOLLO_CONF_NET_TRACE, DEF_STR ( On ) )
123123
124124INPUT_PORTS_END
125125
r31373r31374
740740   ip3_w((input_data & 0x08) ? ASSERT_LINE : CLEAR_LINE);
741741   ip4_w((input_data & 0x10) ? ASSERT_LINE : CLEAR_LINE);
742742   ip5_w((input_data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
743//   ip6_w((input_data & 0x40) ? ASSERT_LINE : CLEAR_LINE);
743//  ip6_w((input_data & 0x40) ? ASSERT_LINE : CLEAR_LINE);
744744
745745   // MC2681 has IP[6] (instead of /IACK on MC68681)
746746   m_ip6 = (input_data & 0x40) ? ASSERT_LINE : CLEAR_LINE;
r31373r31374
829829
830830WRITE8_MEMBER(apollo_state::sio_output)
831831{
832//   CLOG2(("apollo_sio - sio_output %02x", data));
832//  CLOG2(("apollo_sio - sio_output %02x", data));
833833
834834   if ((data & 0x80) != (sio_output_data & 0x80))
835835   {
trunk/src/mess/machine/super80.c
r31373r31374
5757}
5858
5959/* cassette load circuit
60   This "emulates" U79 CD4046BCN PLL chip and U1 LM311P op-amp. U79 converts a frequency to a voltage,
61   and U1 amplifies that voltage to digital levels. U1 has a trimpot connected, to set the midpoint.
60    This "emulates" U79 CD4046BCN PLL chip and U1 LM311P op-amp. U79 converts a frequency to a voltage,
61    and U1 amplifies that voltage to digital levels. U1 has a trimpot connected, to set the midpoint.
6262
63   The MDS homebrew input circuit consists of 2 op-amps followed by a D-flipflop.
64   The "read-any-system" cassette circuit is a CA3140 op-amp, the smarts being done in software.
63    The MDS homebrew input circuit consists of 2 op-amps followed by a D-flipflop.
64    The "read-any-system" cassette circuit is a CA3140 op-amp, the smarts being done in software.
6565
66   bit 0 = original system (U79 and U1)
67   bit 1 = MDS fast system
68   bit 2 = CA3140 */
66    bit 0 = original system (U79 and U1)
67    bit 1 = MDS fast system
68    bit 2 = CA3140 */
6969TIMER_DEVICE_CALLBACK_MEMBER( super80_state::timer_p )
7070{
7171   UINT8 cass_ws=0;
trunk/src/mess/machine/beta.c
r31373r31374
142142{
143143   const char *floppy_tags[4] = { FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3 };
144144
145   if (m_betadisk_active == 1)
145   if (m_betadisk_active == 1)
146146   {
147147      m_wd179x->set_drive(data & 3);
148148      m_wd179x->set_side ((data & 0x10) ? 0 : 1 );
trunk/src/mess/machine/apple1.c
r31373r31374
400400      another display write. */
401401   pia->cb1_w(1);
402402}
403
404
trunk/src/mess/machine/msx_s1985.c
r31373r31374
6262         break;
6363   }
6464}
65
trunk/src/mess/machine/rmnimbus.c
r31373r31374
178178
179179void rmnimbus_state::external_int(UINT8 vector, bool state)
180180{
181
182181   if(!state && (vector != m_vector))
183182      return;
184183
trunk/src/mess/machine/apple2.c
r31373r31374
354354            offset &= 0xf;
355355            if (offset >= 8 && offset <= 0xb)
356356            {
357               return m_acia1->read(space, offset-8);
357               return m_acia1->read(space, offset-8);
358358            }
359359         }
360360         else if (slot == 2)
r31373r31374
362362            offset &= 0xf;
363363            if (offset >= 8 && offset <= 0xb)
364364            {
365               return m_acia2->read(space, offset-8);
365               return m_acia2->read(space, offset-8);
366366            }
367367         }
368368      }
trunk/src/mess/machine/msx_matsushita.c
r31373r31374
165165         break;
166166   }
167167}
168
trunk/src/mess/machine/hp48.c
r31373r31374
682682        NCE1         256KB ROM      512KB ROM         2MB flash ROM
683683
684684
685   - NCE1 (ROM) cannot be configured, it is always visible at addresses
685   - NCE1 (ROM) cannot be configured, it is always visible at addresses
686686   00000-7ffff not covered by higher priority modules.
687687
688688   - only the address of HDW (I/O) can be configured, its size is constant
r31373r31374
712712      LOG(( "hp48_apply_modules: high ROM bank is %i\n", bank_hi ));
713713      space.install_read_bank( 0x00000, 0x3ffff, 0, 0x80000, "bank5" );
714714      space.install_read_bank( 0x40000, 0x7ffff, 0, 0x80000, "bank6" );
715      if ( m_rom )
715      if ( m_rom )
716716      {
717717         membank("bank5")->set_base( m_rom + bank_lo * 0x40000 );
718718         membank("bank6")->set_base( m_rom + bank_hi * 0x40000 );
r31373r31374
743743         LOG(( "hp48_apply_modules: A19 disabled, NCE3 %s\n", nce3_enable ? "enabled" : "disabled" ));
744744         space.install_read_bank( 0, 0x7ffff, 0, 0x80000, "bank5" );
745745      }
746      if ( m_rom )
746      if ( m_rom )
747747         membank("bank5")->set_base( m_rom );
748748   }
749749   else
trunk/src/mess/machine/apple3.c
r31373r31374
3939            bits 0-5: 6-bit audio DAC output
4040            bit 6: screen blank
4141            bit 7: OR of NMI from slots
42
42
4343***************************************************************************/
4444
4545#include "emu.h"
r31373r31374
157157         pdl_handler(offset);
158158         break;
159159
160      case 0x60:   // joystick switch 0
160      case 0x60:  // joystick switch 0
161161      case 0x68:
162162         result = (m_joybuttons->read() & 1) ? 0x80 : 0x00;
163163         break;
164164
165      case 0x61:   // joystick switch 1 (margin switch for Silentype)
165      case 0x61:  // joystick switch 1 (margin switch for Silentype)
166166      case 0x69:
167167         result = (m_joybuttons->read() & 4) ? 0x80 : 0x00;
168168         break;
169169
170      case 0x62:   // joystick switch 2
170      case 0x62:  // joystick switch 2
171171      case 0x6a:
172172         result = (m_joybuttons->read() & 2) ? 0x80 : 0x00;
173173         break;
174174
175      case 0x63:   // joystick switch 3 (serial clock for silentype)
175      case 0x63:  // joystick switch 3 (serial clock for silentype)
176176      case 0x6b:
177177         result = (m_joybuttons->read() & 8) ? 0x80 : 0x00;
178178         break;
179179
180      case 0x66:   // paddle A/D conversion done (bit 7 = 1 while counting, 0 when done)
180      case 0x66:  // paddle A/D conversion done (bit 7 = 1 while counting, 0 when done)
181181      case 0x6e:
182182         return m_ramp_active ? 0x80 : 0x00;
183183         break;
r31373r31374
11971197         }
11981198         m_pdltimer->adjust(attotime::from_hz(1000000.0));
11991199         m_ramp_active = true;
1200         break;
1200         break;
12011201
12021202      case 0x5e:
12031203         m_analog_sel &= ~2;
r31373r31374
12311231      m_pdltimer->adjust(attotime::from_hz(1000000.0));
12321232   }
12331233}
1234
trunk/src/mess/machine/msx_systemflags.c
r31373r31374
3636{
3737   m_system_flags = data;
3838}
39
trunk/src/mess/video/abc1600.c
r31373r31374
165165{
166166   int x = 0;
167167   const pen_t *pen = m_palette->pens();
168   
168
169169   for (int column = 0; column < x_count; column += 2)
170170   {
171171      UINT16 dma = get_crtca(ma, ra, column);
172     
172
173173      // data is read out of video RAM in nibble mode by strobing CAS 4 times
174174      for (int cas = 0; cas < 4; cas++)
175175      {
176176         UINT16 data = read_videoram(dma + cas);
177         
177
178178         for (int bit = 0; bit < 16; bit++)
179179         {
180180            int color = ((BIT(data, 15) ^ PIX_POL) && !BLANK) && de;
181           
181
182182            bitmap.pix32(vbp + y, hbp + x++) = pen[color];
183           
183
184184            data <<= 1;
185185         }
186186      }
trunk/src/mess/video/a7800.c
r31373r31374
44
55  Routines to control the Atari 7800 video hardware
66
7    2014-05-06 Mike Saarna Added interrupts to DMA cycle eating. Updates to
8               LL, OL, and spin accounting for HALT behavior.
7    2014-05-06 Mike Saarna Added interrupts to DMA cycle eating. Updates to
8                LL, OL, and spin accounting for HALT behavior.
99
1010    2014-03-24 Mike Saarna Fixed DMA regarding startup, shutdown and
1111                            cycle stealing.
r31373r31374
133133   {
134134      if(READ_MEM(m_maria_dll+3) & 0x80)
135135         maria_cycles=40; // DMA + maria interrupt overhead
136       else
136      else
137137         maria_cycles=19; // DMA
138    }
139    else
140    {
141           maria_cycles = 16; // DMA
142           }
138      }
139      else
140      {
141         maria_cycles = 16; // DMA
142         }
143143
144144   cells = 0;
145145
r31373r31374
215215   // Spin the CPU for Maria DMA, if it's not already spinning for WSYNC.
216216   // MARIA generates the 6502 clock by dividing its own clock by 4. It needs to HALT and unHALT
217217   // the 6502 on ths same clock phase, so MARIA will wait until its clock divides evenly by 4.
218   // To spin until an even divisor, we just round-up any would-be truncations by adding 3. 
218   // To spin until an even divisor, we just round-up any would-be truncations by adding 3.
219219   if ( ! m_maria_wsync )
220220      m_maincpu->spin_until_time(m_maincpu->cycles_to_attotime((maria_cycles+3)/4));
221221
trunk/src/mess/video/rmnimbus.c
r31373r31374
3131
3232#define FG_COLOUR       (m_colours&0x0F)
3333#define BG_COLOUR       ((m_colours&0xF0)>>4)
34#define SELECT_COL(x,c)   (IS_80COL ? ((((x) & 1) ? ((c) << 2) : (c)) & 0xC) : (c))
35#define FILL_WORD(c)   (((c) << 12) | ((c) << 8) | ((c) << 4) | (c))
34#define SELECT_COL(x,c) (IS_80COL ? ((((x) & 1) ? ((c) << 2) : (c)) & 0xC) : (c))
35#define FILL_WORD(c)    (((c) << 12) | ((c) << 8) | ((c) << 4) | (c))
3636
3737#define IS_80COL        (m_mode&0x10)
3838#define IS_XOR          (m_op&8)
trunk/src/mess/video/pc_t1t.c
r31373r31374
427427{
428428   if (m_update_row_type == -1)
429429      return;
430   
430
431431   switch (m_update_row_type)
432432   {
433433      case T1000_TEXT_INTEN:
r31373r31374
456456{
457457   if (m_update_row_type == -1)
458458      return;
459   
459
460460   switch (m_update_row_type)
461461   {
462462      case PCJX_TEXT:
trunk/src/mess/video/abc806.c
r31373r31374
1010
1111    TODO:
1212
13   - hook up RAD prom
13    - hook up RAD prom
1414    - flashing
1515    - double height
1616    - underline
trunk/src/mess/video/bbc.c
r31373r31374
180180         if (((ma>>13)&1)==0)
181181         {
182182            m_Teletext_Latch=0;
183         }
184         else
183         }
184         else
185185         {
186186            m_Teletext_Latch=(m_BBC_Video_RAM[calculate_video_address(ma+x_pos,ra)]);
187187         }
trunk/src/mess/video/vtvideo.c
r31373r31374
2121- REQUIRED TODOS / TESTS :
2222  * do line and character attributes (plus combinations) match real hardware?
2323  * how does the AVO fit in?
24 
24
2525- SCROLLING REGIONS / SPLIT SCREEN SCROLLING UNTESTED (if you open > 1 file with the VAX editor EDT)
2626  See VT100 Technical Manual: 4.7.4 Address Shuffling to 4.7.9 Split Screen Smooth Scrolling.
2727  More on scrolling regions: Rainbow 100 B technical documentation (QV069-GZ) April 1985 page 22
28 
28
2929- NEW - INTERLACED MODE (Rainbow only):
3030  Vertical resolution increases from 240 to 480, while the refresh rate halves (flickers on CRTs).
3131  To accomplish this, the display controller repeats even lines in odd scans.
3232  VTVIDEO activates line doubling in 24 line, interlaced mode only.
33 
33
3434  Although the DC12 has the ability to display 48 lines, most units are low on screen RAM and
35  won't even show 80 x 48. -> REASON: (83 x 48 = 3984 Byte) > (screen RAM) minus 'scratch area'
35  won't even show 80 x 48. -> REASON: (83 x 48 = 3984 Byte) > (screen RAM) minus 'scratch area'
3636  On a VT-180, BIOS scratch requires up to 700 bytes used for SETUP, flags, SILO, keyboard.
37 
37
3838- POSSIBLE IMPROVEMENTS:
39
39
4040* exact colors for different VR201 monitors ('paper white', green and amber)
4141
4242* ACCURATE VIDEO DELAYS:
43  Position of the first visible scanline (relative to the vertical reset) depends on
44  content of fill bytes at the beginning of screen RAM.
43  Position of the first visible scanline (relative to the vertical reset) depends on
44  content of fill bytes at the beginning of screen RAM.
4545
4646  Six invisible, linked lines are initially provided (at location $EE000+ on a Rainbow).
4747  Real-world DC hardware parses the (circular) chain until interrupted by blanking.
r31373r31374
185185   m_basic_attribute = 0;
186186
187187   m_columns = 80;
188   
189   m_frequency = 60;
190188
191   m_interlaced = 1;
189   m_frequency = 60;
190
191   m_interlaced = 1;
192192   m_fill_lines = 2; // for 60Hz (not in use any longer -> detected)
193193   recompute_parameters();
194194}
r31373r31374
210210
211211   int vert_pix_total = ((m_linedoubler == false) ? m_height : m_height_MAX) * 10;
212212
213   if (m_columns == 132)
214      horiz_pix_total = m_columns * 9; // display 1 less filler pixel in 132 char. mode
213   if (m_columns == 132)
214      horiz_pix_total = m_columns * 9; // display 1 less filler pixel in 132 char. mode
215215   else
216216      horiz_pix_total = m_columns * 10; // normal 80 character mode.
217217
r31373r31374
239239// Also used by Rainbow-100 ************
240240WRITE8_MEMBER(vt100_video_device::dc012_w)
241241{
242
243242   // TODO: writes to 10C/0C should be treated differently (emulation disables the watchdog too often).
244243   // - see 3.1.3.9.5 DC012 Programming Information (PC-100 spec)
245244   if (data == 0) // MHFU is disabled by writing 00 to port 010C.
r31373r31374
254253   }
255254   }
256255   else
257   {   
256   {
258257      // RESET
259258            MHFU_FLAG = true;
260259      MHFU_counter = 0;
r31373r31374
343342// Writing to DC011 resets internal counters (& disturbs display) on real hardware.
344343WRITE8_MEMBER(vt100_video_device::dc011_w)
345344{
346   if (!BIT(data, 5))
345   if (!BIT(data, 5))
347346   {
348      m_interlaced = 1; 
347      m_interlaced = 1;
349348
350349      if (!BIT(data, 4))
351350         m_columns = 80;
r31373r31374
359358      if (!BIT(data, 4))
360359      {
361360         m_frequency = 60;
362         m_fill_lines = 2; 
361         m_fill_lines = 2;
363362      }
364363      else
365364      {
366365         m_frequency = 50;
367         m_fill_lines = 5;
366         m_fill_lines = 5;
368367      }
369368   }
370369
371   recompute_parameters();
370   recompute_parameters();
372371}
373372
374373WRITE8_MEMBER(vt100_video_device::brightness_w)
r31373r31374
534533
535534   UINT16 y_preset;
536535
537   UINT16 CHARPOS_y_preset = y << 3; // CHARPOS_y_preset = y * 10;
536   UINT16 CHARPOS_y_preset = y << 3; // CHARPOS_y_preset = y * 10;
538537   CHARPOS_y_preset += y;
539538   CHARPOS_y_preset += y;
540539
r31373r31374
546545   int back_intensity, back_default_intensity;
547546
548547   int invert = (display_type & 8) ? 1 : 0; // REVERSE
549   int bold  = (display_type & 16) ? 0 : 1; // BIT 4
548   int bold  = (display_type & 16) ? 0 : 1; // BIT 4
550549   int blink = (display_type & 32) ? 0 : 1; // BIT 5
551   int underline = (display_type & 64) ? 0 : 1; // BIT 6
552   bool blank = (display_type & 128) ? true : false; // BIT 7
550   int underline = (display_type & 64) ? 0 : 1; // BIT 6
551   bool blank = (display_type & 128) ? true : false; // BIT 7
553552
554553   display_type = display_type & 3;
555554
r31373r31374
730729   // Skip fill (0xFF) lines and put result in ADDR.
731730   for (int xp = 1; xp <= 6; xp += 1) // beware of circular references
732731   {
733      // Fetch LINE ATTRIBUTE before it is gone
732      // Fetch LINE ATTRIBUTE before it is gone
734733      attr_addr = 0x1000 | ((addr + 1) & 0x0fff);
735734
736735      temp = m_read_ram(addr + 2) * 256 + m_read_ram(addr + 1);
trunk/src/mess/video/pc1512.c
r31373r31374
360360
361361
362362//-------------------------------------------------
363//  mc6845
363//  mc6845
364364//-------------------------------------------------
365365
366366int pc1512_state::get_display_mode(UINT8 mode)
trunk/src/mess/video/k1ge.c
r31373r31374
4444READ8_MEMBER( k1ge_device::read )
4545{
4646   assert(offset < 0x4000);
47   
47
4848   UINT8 data = m_vram[offset];
4949
5050   switch( offset )
r31373r31374
6363WRITE8_MEMBER( k1ge_device::write )
6464{
6565   assert(offset < 0x4000);
66   
66
6767   switch( offset )
6868   {
6969   case 0x000:
trunk/src/mame/drivers/byvid.c
r31373r31374
687687{
688688   m_u11_a = data;
689689   m_pia_u7->ca1_w(BIT(data, 1));
690     m_pia_u7->ca2_w(BIT(data, 2));
690   m_pia_u7->ca2_w(BIT(data, 2));
691691}
692692
693693READ8_MEMBER( by133_state::u11_b_r )
r31373r31374
705705{
706706   m_u10_timer ^= 1;
707707   m_pia_u10->cb1_w(m_u10_timer);
708}   
708}
709709
710710// 555 timer for display refresh
711711TIMER_DEVICE_CALLBACK_MEMBER( by133_state::u11_timer )
trunk/src/mame/drivers/tapatune.c
r31373r31374
151151      int r = m_paletteram[3 * i + 0];
152152      int g = m_paletteram[3 * i + 1];
153153      int b = m_paletteram[3 * i + 2];
154     
154
155155      r = pal6bit(r);
156156      g = pal6bit(g);
157157      b = pal6bit(b);
158     
158
159159      m_pens[i] = rgb_t(r, g, b);
160160   }
161161}
r31373r31374
513513   MCFG_QUANTUM_PERFECT_CPU("maincpu")
514514
515515   MCFG_NVRAM_ADD_0FILL("nvram")
516   
516
517517   MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_24MHz / 16)
518518   MCFG_MC6845_SHOW_BORDER_AREA(false)
519519   MCFG_MC6845_CHAR_WIDTH(5)
trunk/src/mame/drivers/meritm.c
r31373r31374
10451045   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", meritm_state, meritm_interrupt, "screen", 0, 1)
10461046
10471047   MCFG_DEVICE_ADD("ppi8255", I8255, 0)
1048   MCFG_I8255_OUT_PORTB_CB(WRITE8(meritm_state, meritm_crt250_port_b_w))   // used LMP x DRIVE
1048   MCFG_I8255_OUT_PORTB_CB(WRITE8(meritm_state, meritm_crt250_port_b_w))   // used LMP x DRIVE
10491049   MCFG_I8255_IN_PORTC_CB(READ8(meritm_state, meritm_8255_port_c_r))
10501050
10511051   MCFG_DEVICE_ADD("z80pio_0", Z80PIO, SYSTEM_CLK/6)
trunk/src/mame/drivers/cninja.c
r31373r31374
818818      case 0x8000: return 0xf0 | 0xcc;
819819      case 0xc000: return 0xf0 | 0xcc; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */
820820   }
821   
821
822822   return 0;
823823}
824824
trunk/src/mame/drivers/kenseim.c
r31373r31374
124124D8  | 9
125125D7  | 10
126126D6  | 11
127D5  | 12
127D5  | 12
128128D4  | 13
129129D3  | 14
130130D2  | 15
r31373r31374
152152      m_to_68k_cmd_low(0),
153153      m_to_68k_cmd_d9(0),
154154      m_to_68k_cmd_req(0),
155      m_to_68k_cmd_LVm(0),   
155      m_to_68k_cmd_LVm(0),
156156      m_from68k_ack(0),
157157      m_from68k_st4(0),
158158      m_from68k_st3(0),
159159      m_from68k_st2(0)
160160
161   {
161   {
162162      for (int i = 0; i < 6; i++)
163163      {
164164         mole_state_a[i] = 0x00;
r31373r31374
190190         sprintf(temp, "molea_%d", i);
191191         output_set_value(temp, mole_state_a[i]);
192192      }
193     
193
194194      for (int i = 0; i < 6; i++)
195195      {
196196         char temp[32];
r31373r31374
226226   UINT8 m_to_68k_cmd_d9;
227227   UINT8 m_to_68k_cmd_req;
228228   UINT8 m_to_68k_cmd_LVm;
229   
230229
230
231231   int m_from68k_ack;
232232   int m_from68k_st4;
233233   int m_from68k_st3;
r31373r31374
258258void kenseim_state::set_leds(UINT32 ledstates)
259259{
260260   for (int i=0; i<20; i++)
261      output_set_lamp_value(i+1, ((ledstates & (1 << i)) != 0));   
261      output_set_lamp_value(i+1, ((ledstates & (1 << i)) != 0));
262262}
263263
264264// could be wrong
r31373r31374
266266{
267267   // I'm guessing these are the 20 'power meter' LEDs, 10 for each player? (it writes 42 times, with the last write being some terminator?)
268268
269//   printf("%s mb8936 write %02x to port C but no handler assigned (serial data?)\n", machine().describe_context(), data);
269//  printf("%s mb8936 write %02x to port C but no handler assigned (serial data?)\n", machine().describe_context(), data);
270270
271271   if (data & 0x08)
272272   {
273
274273      if (data & 0x02)
275274      {
276275         if (data & 0x04)
r31373r31374
317316
318317   update_moles();
319318
320}
319}
321320
322321WRITE8_MEMBER(kenseim_state::mb8936_portb_w) // maybe molesb output? (6-bits?)
323322{
r31373r31374
503502   PORT_START("IN0")
504503   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED /*IPT_COIN1*/ ) // n/c
505504   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED /*IPT_COIN2*/ ) // n/c
506   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_9_r, NULL) //   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) // D9
505   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_9_r, NULL) //   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) // D9
507506   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) // n/c?
508   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_req_r, NULL) //   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) // REQ
509   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_LVm_r, NULL) //   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) // LVm
507   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_req_r, NULL) // PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) // REQ
508   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_LVm_r, NULL) // PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) // LVm
510509   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) // PORT_SERVICE( 0x40, IP_ACTIVE_LOW ) n/c
511510   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // n/c?
512511
513512   PORT_START("IN1")
514//   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) // D5
515//   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) // D6
516//   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) // D7
517//   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) // D8
513//  PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) // D5
514//  PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) // D6
515//  PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) // D7
516//  PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) // D8
518517   PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_5678_r, NULL)
519518   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED/*IPT_BUTTON1*/ ) /*PORT_PLAYER(1)*/ // n/c
520519   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED/*IPT_BUTTON2*/ ) /*PORT_PLAYER(1)*/ // n/c
521520   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED/*IPT_BUTTON3*/ ) /*PORT_PLAYER(1)*/ // n/c
522521   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) // n/c?
523522
524//   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) // D1
525//   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) // D2
526//   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) // D3
527//   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) // D4
523//  PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) // D1
524//  PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) // D2
525//  PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) // D3
526//  PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) // D4
528527   PORT_BIT( 0x0f00, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, kenseim_state, kenseim_cmd_1234_r, NULL)
529528   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNUSED /*IPT_BUTTON1*/ ) /*PORT_PLAYER(2)*/ // n/c
530529   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNUSED /*IPT_BUTTON2*/ ) /*PORT_PLAYER(2)*/ // n/c
531530   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED /*IPT_BUTTON3*/ ) /*PORT_PLAYER(2)*/ // n/c
532531   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // n/c?
533532
534   // most of the regular CPS1 dips are unused 
533   // most of the regular CPS1 dips are unused
535534   PORT_START("DSWA")
536535   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "CPSA SW(A):1" )
537536   PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "CPSA SW(A):2" )
r31373r31374
699698// 1994.04.18 is from extra PCB rom, Siguma or Sigma? (Siguma is in the ROM)
700699// the CPS1 board roms contain "M O G U R A   9 2 0 9 2 4" strings suggesting that part of the code was developed earlier
701700GAMEL( 1994, kenseim,       0,        kenseim, kenseim,      kenseim_state,   kenseim,     ROT0,   "Capcom / Togo / Sigma", "Ken Sei Mogura: Street Fighter II (Japan 940418, Ver 1.00)", GAME_CLICKABLE_ARTWORK, layout_kenseim )
702
trunk/src/mame/drivers/bfm_sc1.c
r31373r31374
355355
356356WRITE8_MEMBER(bfm_sc1_state::vfd_w)
357357{
358/*   int changed = m_vfd_latch ^ data;
358/*  int changed = m_vfd_latch ^ data;
359359
360   m_vfd_latch = data;
360    m_vfd_latch = data;
361361
362   if ( changed )
363   {
364      if ( changed & VFD_RESET )
365      { // vfd reset line changed
366         if ( !(data & VFD_RESET) )
367         { // reset the vfd
368         m_vfd0->reset();
369         }
370      }
371      if ( changed & VFD_CLOCK1 )
372      { // clock line changed
373         if ( !(data & VFD_CLOCK1) && (data & VFD_RESET) )
374         { // new data clocked into vfd
375            m_vfd0->shift_data(data & VFD_DATA );
376         }
377      }
378   }
362    if ( changed )
363    {
364        if ( changed & VFD_RESET )
365        { // vfd reset line changed
366            if ( !(data & VFD_RESET) )
367            { // reset the vfd
368            m_vfd0->reset();
369            }
370        }
371        if ( changed & VFD_CLOCK1 )
372        { // clock line changed
373            if ( !(data & VFD_CLOCK1) && (data & VFD_RESET) )
374            { // new data clocked into vfd
375                m_vfd0->shift_data(data & VFD_DATA );
376            }
377        }
378    }
379379*/
380380   m_vfd0->por(data & VFD_RESET);
381381   m_vfd0->data(data & VFD_DATA);
trunk/src/mame/drivers/segaxbd.c
r31373r31374
642642{
643643   m_segaic16vid->segaic16_tilemap_reset(*m_screen);
644644
645   // hook the RESET line, which resets CPU #1   
645   // hook the RESET line, which resets CPU #1
646646   m_maincpu->set_reset_callback(write_line_delegate(FUNC(segaxbd_state::m68k_reset_callback),this));
647647
648648   // start timers to track interrupts
trunk/src/mame/drivers/alpha68k.c
r31373r31374
31183118   ROM_LOAD( "gw-5.21f",            0x080000, 0x20000, CRC(9ef36031) SHA1(2faeb6a769991ab11403c6c37507b706a61bad69) )
31193119   ROM_LOAD( "guernica-c2.18h",     0x100000, 0x80000, CRC(2fcbea97) SHA1(eb60bf374ef771e379030d2b660a813be76bed5e) )
31203120   ROM_LOAD( "gw-6.20f",            0x180000, 0x20000, CRC(ddbbcda7) SHA1(1c368ad2a4ed31748c94545fc7c808aa53d76f64) )
3121   ROM_LOAD( "guernica-c1.20h",     0x200000, 0x80000, CRC(b0fd1c23) SHA1(a6dbed81b751c1f662f63a7426d8333aca866d79) )
3121   ROM_LOAD( "guernica-c1.20h",     0x200000, 0x80000, CRC(b0fd1c23) SHA1(a6dbed81b751c1f662f63a7426d8333aca866d79) )
31223122   ROM_LOAD( "gw-7.18f",            0x280000, 0x20000, CRC(4656d377) SHA1(67d6f714cca3891be0173c543ece5e8ab699f645) )
31233123   ROM_LOAD( "guernica-c0.21h",     0x300000, 0x80000, CRC(e60c9882) SHA1(8cf1d9cf0db72977b303fd6b469611600631ab9a) )
31243124   ROM_LOAD( "gw-8.17f",            0x380000, 0x20000, CRC(798ed82a) SHA1(1932131e05aae0a77ba8d8ef947c1a3b0b5e3d43) )
r31373r31374
31513151   ROM_LOAD( "u5",                  0x080000, 0x20000, CRC(94612190) SHA1(dd7818744b1b6738d268044f13e0647e7a3b2d1e) ) // this set of u5,u6,u7,u8 have a one-way sign, used on stage 3
31523152   ROM_LOAD( "guernica-c2.18h",     0x100000, 0x80000, CRC(2fcbea97) SHA1(eb60bf374ef771e379030d2b660a813be76bed5e) )
31533153   ROM_LOAD( "u6",                  0x180000, 0x20000, CRC(5a4ea0f0) SHA1(7ea8b3f66f32ab9b33a522edca6d5c6416fd7a9b) )
3154   ROM_LOAD( "guernica-c1.20h",     0x200000, 0x80000, CRC(b0fd1c23) SHA1(a6dbed81b751c1f662f63a7426d8333aca866d79) )
3154   ROM_LOAD( "guernica-c1.20h",     0x200000, 0x80000, CRC(b0fd1c23) SHA1(a6dbed81b751c1f662f63a7426d8333aca866d79) )
31553155   ROM_LOAD( "u7",                  0x280000, 0x20000, CRC(33f324cb) SHA1(c00f55ce85749cbbb9569a22cc6c9c886ed9ab78) )
31563156   ROM_LOAD( "guernica-c0.21h",     0x300000, 0x80000, CRC(e60c9882) SHA1(8cf1d9cf0db72977b303fd6b469611600631ab9a) )
31573157   ROM_LOAD( "u8",                  0x380000, 0x20000, CRC(c1995c2c) SHA1(909e1070b4ec28a1f4a2cd9fbc3bde781ffbdda8) )
trunk/src/mame/drivers/maygay1bsw.c
r31373r31374
33/*
44 the MSM6376 is on the ROM board, so some games might not have it
55 the YM2149F is on the MAIN board, but it seems very rarely used for sound.
6
6
77 On various PCBs, I've seen the AY slot filled with AY8913's, 8910's,
88 YM2419s and even AY8930s.
99
trunk/src/mame/drivers/galaxold.c
r31373r31374
31753175
31763176ROM_START( tazzmang2 )  // Original Sparcade set
31773177   ROM_REGION( 0x10000, "maincpu", 0 )
3178   ROM_LOAD( "tazmania.1",   0x000000, 0x000800, CRC(6ecc84a2) SHA1(6f31e69bd613b93e1fac26163f39676299c65a76) )
3179   ROM_LOAD( "tazmania.2",   0x000800, 0x000800, CRC(e27b09f6) SHA1(1a419c8f45639e2c2351eeb94bf62fca35d5928e) )
3180   ROM_LOAD( "tazmania.3",   0x001000, 0x000800, CRC(954868f3) SHA1(3882e17ffd9bcfcff383ed95279606962f89dafd) )
3181   ROM_LOAD( "tazmania.4",   0x001800, 0x000800, CRC(238520e6) SHA1(eec76b54058a6a6139f13f188d243f20d1a7aa12) )
3182   ROM_LOAD( "tazmania.5",   0x002000, 0x000800, CRC(0527e513) SHA1(20175c293f1cf45fa21dd400cb2718dd8ee0dcea) )
3183   ROM_LOAD( "tazmania.6",   0x002800, 0x000800, CRC(af2b92d8) SHA1(5642666eb66d549390cd5b13a7029daede6d3ff8) )
3184   ROM_LOAD( "tazmania.7",   0x003000, 0x000800, CRC(bbdc41d3) SHA1(17de825efd56541dbdbacdc83f77f3ccaef2d07f) )
3185   ROM_LOAD( "tazmania.8",   0x003800, 0x000800, CRC(eb35f49c) SHA1(0f2bf1043092e746fdbc5d2e0292aeaa7b7f0218) )
3186   ROM_LOAD( "tazmania.a",   0x004000, 0x001000, CRC(38f326f8) SHA1(5c5463666b6ed15cbcc874faf79cc06ae1cba59a) )
3187   ROM_LOAD( "tazmania.b",   0x005000, 0x001000, CRC(2a22a9dc) SHA1(07aecdff852065671e488682cf710fd48273b88c) )
3178   ROM_LOAD( "tazmania.1",   0x000000, 0x000800, CRC(6ecc84a2) SHA1(6f31e69bd613b93e1fac26163f39676299c65a76) )
3179   ROM_LOAD( "tazmania.2",   0x000800, 0x000800, CRC(e27b09f6) SHA1(1a419c8f45639e2c2351eeb94bf62fca35d5928e) )
3180   ROM_LOAD( "tazmania.3",   0x001000, 0x000800, CRC(954868f3) SHA1(3882e17ffd9bcfcff383ed95279606962f89dafd) )
3181   ROM_LOAD( "tazmania.4",   0x001800, 0x000800, CRC(238520e6) SHA1(eec76b54058a6a6139f13f188d243f20d1a7aa12) )
3182   ROM_LOAD( "tazmania.5",   0x002000, 0x000800, CRC(0527e513) SHA1(20175c293f1cf45fa21dd400cb2718dd8ee0dcea) )
3183   ROM_LOAD( "tazmania.6",   0x002800, 0x000800, CRC(af2b92d8) SHA1(5642666eb66d549390cd5b13a7029daede6d3ff8) )
3184   ROM_LOAD( "tazmania.7",   0x003000, 0x000800, CRC(bbdc41d3) SHA1(17de825efd56541dbdbacdc83f77f3ccaef2d07f) )
3185   ROM_LOAD( "tazmania.8",   0x003800, 0x000800, CRC(eb35f49c) SHA1(0f2bf1043092e746fdbc5d2e0292aeaa7b7f0218) )
3186   ROM_LOAD( "tazmania.a",   0x004000, 0x001000, CRC(38f326f8) SHA1(5c5463666b6ed15cbcc874faf79cc06ae1cba59a) )
3187   ROM_LOAD( "tazmania.b",   0x005000, 0x001000, CRC(2a22a9dc) SHA1(07aecdff852065671e488682cf710fd48273b88c) )
31883188
31893189   ROM_REGION( 0x1000, "gfx1", 0 )
31903190   ROM_LOAD( "tazm8.1lk",    0x0000, 0x0800, CRC(2c5b612b) SHA1(32e3a41a9a4a8b1285b6a195213ff0d98012360a) ) // tazmania.g1
trunk/src/mame/drivers/cocoloco.c
r31373r31374
3030***************************************************************************************
3131
3232  PCB Layout...
33
33
3434  .------------------------------------------------------------------------------------.
3535  |     A             B             C              D              E          F         |
3636  |                  .-----. .-----. .-----. .-----. .-----. .-----.                   |
r31373r31374
125125                                        |                             | 0.1 uf |    |
126126                                        |   R 2.2                     '--| |---'   -+-
127127                                        '--/\/\/\/--.                              GND
128                                                    |                 
128                                                    |
129129                                                   -+-
130130                                                   GND
131131
r31373r31374
211211
212212static NETLIST_START(nl_cocoloco)
213213
214    /* Standard stuff */
214   /* Standard stuff */
215215
216    SOLVER(Solver, 48000)
217    PARAM(Solver.ACCURACY, 1e-5)
218    ANALOG_INPUT(V5, 5)
216   SOLVER(Solver, 48000)
217   PARAM(Solver.ACCURACY, 1e-5)
218   ANALOG_INPUT(V5, 5)
219219
220    /* AY 8910 internal resistors */
220   /* AY 8910 internal resistors */
221221
222    RES(R_AY1_1, 1000);
223    RES(R_AY1_2, 1000);
224    RES(R_AY1_3, 1000);
222   RES(R_AY1_1, 1000);
223   RES(R_AY1_2, 1000);
224   RES(R_AY1_3, 1000);
225225
226    RES(R1, 4700)
227    RES(R2, 4700)
228    RES(R3, 4700)
229    RES(RAMP, 150000)
230    //RES(RAMP, 150)
231    POT(P1, 5000)
232    PARAM(P1.DIAL, 0.5) // 50%
226   RES(R1, 4700)
227   RES(R2, 4700)
228   RES(R3, 4700)
229   RES(RAMP, 150000)
230   //RES(RAMP, 150)
231   POT(P1, 5000)
232   PARAM(P1.DIAL, 0.5) // 50%
233233
234    CAP(C1, 10e-6)
234   CAP(C1, 10e-6)
235235
236    NET_C(V5, R_AY1_1.1, R_AY1_2.1, R_AY1_3.1)
236   NET_C(V5, R_AY1_1.1, R_AY1_2.1, R_AY1_3.1)
237237
238    NET_C(R_AY1_1.2, R1.1)
239    NET_C(R_AY1_2.2, R2.1)
240    NET_C(R_AY1_3.2, R3.1)
238   NET_C(R_AY1_1.2, R1.1)
239   NET_C(R_AY1_2.2, R2.1)
240   NET_C(R_AY1_3.2, R3.1)
241241
242    NET_C(R1.2, R2.2, R3.2, P1.1)
242   NET_C(R1.2, R2.2, R3.2, P1.1)
243243
244    NET_C(P1.3, RAMP.2, GND)
245    NET_C(P1.2, C1.1)
246    NET_C(C1.2, RAMP.1)
244   NET_C(P1.3, RAMP.2, GND)
245   NET_C(P1.2, C1.1)
246   NET_C(C1.2, RAMP.1)
247247#if 0
248    CAP(C2, 0.1e-6)
249    NET_C(C2.2, GND)
250    NET_C(C2.1, RAMP.1)
248   CAP(C2, 0.1e-6)
249   NET_C(C2.2, GND)
250   NET_C(C2.1, RAMP.1)
251251#endif
252252NETLIST_END()
253253
r31373r31374
339339WRITE8_MEMBER( cocoloco_state::cocoloco_vram_clear_w )
340340{
341341   /* ??? */
342//   for(int i=0;i<0x8000;i++)
343//      m_videoram[i] = 0;
342//  for(int i=0;i<0x8000;i++)
343//      m_videoram[i] = 0;
344344
345//   popmessage("A005 writes: %02X", data);
345//  popmessage("A005 writes: %02X", data);
346346}
347347
348348
r31373r31374
354354    xxxx -xxx   Unknown.
355355
356356    The coin counter gives 2 pulses for each coin inserted.
357   They explain in a sheet that the coin in for 50 pesetas
358   behaves like 2x 25 pesetas (1 duro) coins, so has sense.
357    They explain in a sheet that the coin in for 50 pesetas
358    behaves like 2x 25 pesetas (1 duro) coins, so has sense.
359359*/
360360   coin_counter_w(machine(), 0, data & 0x08);
361361}
r31373r31374
367367
368368static ADDRESS_MAP_START( cocoloco_map, AS_PROGRAM, 8, cocoloco_state )
369369   AM_RANGE(0x0000, 0x1fff) AM_RAM
370   AM_RANGE(0x2000, 0x3fff) AM_READWRITE(cocoloco_vram_r, cocoloco_vram_w)      // 256 x 256 x 1
370   AM_RANGE(0x2000, 0x3fff) AM_READWRITE(cocoloco_vram_r, cocoloco_vram_w)     // 256 x 256 x 1
371371   AM_RANGE(0x6001, 0x6001) AM_DEVREAD("ay8910", ay8910_device, data_r)
372372   AM_RANGE(0x6002, 0x6002) AM_DEVWRITE("ay8910", ay8910_device, data_w)
373373   AM_RANGE(0x6003, 0x6003) AM_DEVWRITE("ay8910", ay8910_device, address_w)
r31373r31374
414414   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
415415
416416   PORT_START("DSW1") // DSW1 @4B
417   PORT_DIPNAME( 0x01, 0x00, "Char Speed" )               PORT_DIPLOCATION("DSW1:!1")
417   PORT_DIPNAME( 0x01, 0x00, "Char Speed" )                    PORT_DIPLOCATION("DSW1:!1")
418418   PORT_DIPSETTING(    0x00, "Fast" )
419419   PORT_DIPSETTING(    0x01, "Slow" )
420   PORT_DIPNAME( 0x02, 0x00, "Monsters Speed" )            PORT_DIPLOCATION("DSW1:!2")
420   PORT_DIPNAME( 0x02, 0x00, "Monsters Speed" )                PORT_DIPLOCATION("DSW1:!2")
421421   PORT_DIPSETTING(    0x00, "Fast" )
422422   PORT_DIPSETTING(    0x02, "Slow" )
423   PORT_DIPNAME( 0x0c, 0x00, "Monsters: Time before go out" )   PORT_DIPLOCATION("DSW1:!3,!4")
423   PORT_DIPNAME( 0x0c, 0x00, "Monsters: Time before go out" )  PORT_DIPLOCATION("DSW1:!3,!4")
424424   PORT_DIPSETTING(    0x00, "Long" )
425425   PORT_DIPSETTING(    0x04, "Medium-Long" )
426426   PORT_DIPSETTING(    0x08, "Medium-Short" )
427427   PORT_DIPSETTING(    0x0c, "Short" )
428   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )            // switches 5-6-7-8 marked as unused.
428   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )             // switches 5-6-7-8 marked as unused.
429429
430430   PORT_START("DSW2") // DSW2 @5C
431   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )         PORT_DIPLOCATION("DSW2:!1,!2")
431   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )          PORT_DIPLOCATION("DSW2:!1,!2")
432432   PORT_DIPSETTING(    0x00, DEF_STR( 1C_2C ) )
433433   PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
434434   PORT_DIPSETTING(    0x01, DEF_STR( 1C_4C ) )
435435   PORT_DIPSETTING(    0x03, DEF_STR( 1C_5C ) )
436   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )      PORT_DIPLOCATION("DSW2:!3,!4")
436   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )       PORT_DIPLOCATION("DSW2:!3,!4")
437437   PORT_DIPSETTING(    0x00, "10000 Points" )
438438   PORT_DIPSETTING(    0x04, "15000 Points" )
439439   PORT_DIPSETTING(    0x08, "20000 Points" )
440440   PORT_DIPSETTING(    0x0c, "30000 Points" )
441   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Lives ) )         PORT_DIPLOCATION("DSW2:!5")
441   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Lives ) )            PORT_DIPLOCATION("DSW2:!5")
442442   PORT_DIPSETTING(    0x00, "2" )
443443   PORT_DIPSETTING(    0x10, "3" )
444   PORT_DIPNAME( 0x20, 0x00, "Monsters" )               PORT_DIPLOCATION("DSW2:!6")
444   PORT_DIPNAME( 0x20, 0x00, "Monsters" )                  PORT_DIPLOCATION("DSW2:!6")
445445   PORT_DIPSETTING(    0x00, "4" )
446446   PORT_DIPSETTING(    0x20, "5" )
447   PORT_DIPNAME( 0xc0, 0x00, "Vitamine Time" )            PORT_DIPLOCATION("DSW2:!7,!8")
447   PORT_DIPNAME( 0xc0, 0x00, "Vitamine Time" )             PORT_DIPLOCATION("DSW2:!7,!8")
448448   PORT_DIPSETTING(    0x00, "Long" )
449449   PORT_DIPSETTING(    0x40, "Medium-Long" )
450450   PORT_DIPSETTING(    0x80, "Medium-Short" )
r31373r31374
459459static MACHINE_CONFIG_START( cocoloco, cocoloco_state )
460460
461461   /* basic machine hardware */
462   MCFG_CPU_ADD("maincpu", M6502, CPU_CLOCK)    /* confirmed */
462   MCFG_CPU_ADD("maincpu", M6502, CPU_CLOCK)   /* confirmed */
463463   MCFG_CPU_PROGRAM_MAP(cocoloco_map)
464464
465465   /* video hardware */
r31373r31374
473473
474474   /* sound hardware */
475475   MCFG_SPEAKER_STANDARD_MONO("mono")
476   MCFG_SOUND_ADD("ay8910", AY8910, SND_CLOCK)   /* confirmed */
476   MCFG_SOUND_ADD("ay8910", AY8910, SND_CLOCK) /* confirmed */
477477   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW1"))
478478   MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW2"))
479    MCFG_AY8910_OUTPUT_TYPE(AY8910_RESISTOR_OUTPUT)
480    MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 0)
481    MCFG_SOUND_ROUTE_EX(1, "snd_nl", 1.0, 1)
482    MCFG_SOUND_ROUTE_EX(2, "snd_nl", 1.0, 2)
479   MCFG_AY8910_OUTPUT_TYPE(AY8910_RESISTOR_OUTPUT)
480   MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 0)
481   MCFG_SOUND_ROUTE_EX(1, "snd_nl", 1.0, 1)
482   MCFG_SOUND_ROUTE_EX(2, "snd_nl", 1.0, 2)
483483
484    /* NETLIST configuration using internal AY8910 resistor values */
484   /* NETLIST configuration using internal AY8910 resistor values */
485485
486    MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000)
487    MCFG_NETLIST_SETUP(nl_cocoloco)
488    MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
486   MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000)
487   MCFG_NETLIST_SETUP(nl_cocoloco)
488   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
489489
490    MCFG_NETLIST_STREAM_INPUT("snd_nl", 0, "R_AY1_1.R")
491    MCFG_NETLIST_STREAM_INPUT("snd_nl", 1, "R_AY1_2.R")
492    MCFG_NETLIST_STREAM_INPUT("snd_nl", 2, "R_AY1_3.R")
490   MCFG_NETLIST_STREAM_INPUT("snd_nl", 0, "R_AY1_1.R")
491   MCFG_NETLIST_STREAM_INPUT("snd_nl", 1, "R_AY1_2.R")
492   MCFG_NETLIST_STREAM_INPUT("snd_nl", 2, "R_AY1_3.R")
493493
494    MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "RAMP.1")
495    MCFG_NETLIST_ANALOG_MULT_OFFSET(30000.0 * 1.5, 0)
494   MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "RAMP.1")
495   MCFG_NETLIST_ANALOG_MULT_OFFSET(30000.0 * 1.5, 0)
496496
497497MACHINE_CONFIG_END
498498
trunk/src/mame/drivers/cave.c
r31373r31374
21012101   MCFG_DEVICE_ADD("nmk112", NMK112, 0)
21022102   MCFG_NMK112_ROM0("oki1")
21032103   MCFG_NMK112_ROM1("oki2")
2104   MCFG_NMK112_DISABLE_PAGEMASK(1 << 0)   // chip #0 (music) is not paged
2104   MCFG_NMK112_DISABLE_PAGEMASK(1 << 0)    // chip #0 (music) is not paged
21052105MACHINE_CONFIG_END
21062106
21072107
trunk/src/mame/drivers/midvunit.c
r31373r31374
10331033
10341034
10351035static MACHINE_CONFIG_DERIVED( crusnwld, midvunit )
1036   /* valid values are 450 or 460 */   
1037   MCFG_DEVICE_ADD("serial_pic", MIDWAY_SERIAL_PIC, 0)   
1036   /* valid values are 450 or 460 */
1037   MCFG_DEVICE_ADD("serial_pic", MIDWAY_SERIAL_PIC, 0)
10381038   MCFG_MIDWAY_SERIAL_PIC_UPPER(450)
10391039MACHINE_CONFIG_END
10401040
10411041static MACHINE_CONFIG_DERIVED( offroadc, midvunit )
10421042   /* valid values are 230 or 234 */
1043   MCFG_DEVICE_ADD("serial_pic2", MIDWAY_SERIAL_PIC2, 0)   
1043   MCFG_DEVICE_ADD("serial_pic2", MIDWAY_SERIAL_PIC2, 0)
10441044   MCFG_MIDWAY_SERIAL_PIC2_UPPER(230)
1045   MCFG_MIDWAY_SERIAL_PIC2_YEAR_OFFS(94)   
1045   MCFG_MIDWAY_SERIAL_PIC2_YEAR_OFFS(94)
10461046MACHINE_CONFIG_END
10471047
10481048
r31373r31374
10621062   MCFG_MIDWAY_IOASIC_SHUFFLE(0)
10631063   MCFG_MIDWAY_IOASIC_UPPER(452) /* no alternates */
10641064   MCFG_MIDWAY_IOASIC_YEAR_OFFS(94)
1065   
1065
10661066   /* sound hardware */
10671067   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2115, 0)
10681068   MCFG_DCS2_AUDIO_DRAM_IN_MB(2)
trunk/src/mame/drivers/vroulet.c
r31373r31374
294294
295295   MCFG_SOUND_ADD("aysnd", AY8910, 2000000)
296296   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSWA"))
297   MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSWB"))   
297   MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSWB"))
298298   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
299299
300300MACHINE_CONFIG_END
trunk/src/mame/drivers/rastersp.c
r31373r31374
102102   required_device<timer_device>   m_tms_timer1;
103103   required_device<timer_device>   m_tms_tx_timer;
104104   required_device<palette_device> m_palette;
105   required_device<nvram_device>    m_nvram;
105   required_device<nvram_device>   m_nvram;
106106
107107   DECLARE_WRITE32_MEMBER(cyrix_cache_w);
108108   DECLARE_READ8_MEMBER(nvram_r);
trunk/src/mame/drivers/taitopjc.c
r31373r31374
5656
5757/*
5858    PPC -> TLCS Commands:
59      0x5010:            ?                              RTC?
60      0x5020:            ?                              RTC?
61      0x6000:            ?                              Backup RAM init?
59        0x5010:            ?                                        RTC?
60        0x5020:            ?                                        RTC?
61        0x6000:            ?                                        Backup RAM init?
6262        0x6010:            ?                                        Backup RAM Read. Address in io_shared[0x1d00].
6363        0x6020:            ?                                        Backup RAM Write. Address in io_shared[0x1d00].
64      0x6030:            ?                              ?
65      0x6040:            ?                              ?
66      0x4000:            ?                              Sound?
67      0x4001:            ?
68      0x4002:            ?
69      0x4003:            ?
70      0x4004:            ?
71      0xf055:
72      0xf0ff:
73      0xf000:
74      0xf001:
75      0xf010:
76      0xf020:
64        0x6030:            ?                                        ?
65        0x6040:            ?                                        ?
66        0x4000:            ?                                        Sound?
67        0x4001:            ?
68        0x4002:            ?
69        0x4003:            ?
70        0x4004:            ?
71        0xf055:
72        0xf0ff:
73        0xf000:
74        0xf001:
75        0xf010:
76        0xf020:
7777
7878*/
7979
r31373r31374
8383#include "cpu/mn10200/mn10200.h"
8484#include "machine/nvram.h"
8585
86#define LOG_TLCS_TO_PPC_COMMANDS      1
87#define LOG_PPC_TO_TLCS_COMMANDS      1
86#define LOG_TLCS_TO_PPC_COMMANDS        1
87#define LOG_PPC_TO_TLCS_COMMANDS        1
8888
8989
9090static UINT32 jc_char_ram[0x2000];
r31373r31374
269269{
270270   UINT32 address = offset * 2;
271271
272//   logerror("ppc_common_w: %08X, %I64X, %I64X\n", offset, data, mem_mask);
272//  logerror("ppc_common_w: %08X, %I64X, %I64X\n", offset, data, mem_mask);
273273
274274   if (ACCESSING_BITS_48_63)
275275   {
r31373r31374
422422#if LOG_TLCS_TO_PPC_COMMANDS
423423      printf("TLCS -> PPC cmd %04X\n", m_io_share_ram[0xffe]);
424424#endif
425   
425
426426      m_iocpu->set_input_line(TLCS900_INT1, CLEAR_LINE);
427427      m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
428428   }
r31373r31374
472472static ADDRESS_MAP_START( tlcs900h_mem, AS_PROGRAM, 16, taitopjc_state )
473473   AM_RANGE(0x010000, 0x02ffff) AM_RAM     // Work RAM
474474   AM_RANGE(0x040000, 0x0400ff) AM_READWRITE8(tlcs_sound_r, tlcs_sound_w, 0xffff)
475   AM_RANGE(0x044000, 0x045fff) AM_RAM AM_SHARE("nvram")
475   AM_RANGE(0x044000, 0x045fff) AM_RAM AM_SHARE("nvram")
476476   AM_RANGE(0x060000, 0x061fff) AM_READWRITE8(tlcs_common_r, tlcs_common_w, 0xffff)
477477   AM_RANGE(0x06c000, 0x06c00f) AM_WRITE(tlcs_unk_w)
478478   AM_RANGE(0xfc0000, 0xffffff) AM_ROM AM_REGION("io_cpu", 0)
r31373r31374
536536DRIVER_INIT_MEMBER(taitopjc_state, optiger)
537537{
538538   UINT8 *rom = (UINT8*)memregion("io_cpu")->base();
539   
539
540540   // skip sound check
541541   rom[0x217] = 0x00;
542542   rom[0x218] = 0x00;
trunk/src/mame/drivers/ajax.c
r31373r31374
259259   ROM_LOAD32_BYTE( "770c12-b.e5",     0x040002, 0x010000, CRC(5f221cc6) SHA1(9a7a9c7853a3b582c4034b773cef08aee5391d6e) )
260260   ROM_LOAD32_BYTE( "770c12-d.e6",     0x040003, 0x010000, CRC(f1edb2f4) SHA1(3e66cc711e25cbf6e6a747d43a9efec0710d5b7a) )
261261
262   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
262   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
263263   ROM_LOAD32_BYTE( "770c09-a.f8",     0x000000, 0x010000, CRC(76690fb8) SHA1(afe267a37b65d63d3765dc3b88d8a8262446f786) )
264264   ROM_LOAD32_BYTE( "770c09-e.f9",     0x000001, 0x010000, CRC(17b482c9) SHA1(3535197956f5bf5b564fec1ddbb3e3ea3bf1f7bd) )
265265   ROM_LOAD32_BYTE( "770c08-a.f10",    0x000002, 0x010000, CRC(efd29a56) SHA1(2a9f138d1242a35162a3f092b0343dff899e3b83) )
r31373r31374
277277   ROM_LOAD32_BYTE( "770c08-d.c10",    0x0c0002, 0x010000, CRC(91591777) SHA1(53f416a51f7075f070168bced7b6f925f54c7b84) )
278278   ROM_LOAD32_BYTE( "770c08-h.c11",    0x0c0003, 0x010000, CRC(d97d4b15) SHA1(e3d7d7adeec8c8c808acb9f84641fd3a6bf249be) )
279279
280   ROM_REGION( 0x080000, "k051316", 0 )   /* zoom/rotate */
280   ROM_REGION( 0x080000, "k051316", 0 )    /* zoom/rotate */
281281   ROM_LOAD( "770c06.f4",     0x000000, 0x040000, CRC(d0c592ee) SHA1(c1be73dd259f2779d715659b177e47513776a0d4) )
282282   ROM_LOAD( "770c07.h4",     0x040000, 0x040000, CRC(0b399fb1) SHA1(fbe26f9aa9a655d08bebcdd79719d35134ca4dd5) )
283283
r31373r31374
319319   ROM_LOAD32_WORD( "770c13.n22",     0x000000, 0x040000, CRC(b859ca4e) SHA1(f58678d503683f78cca0d5ed2d79f6f68ab3495a) )
320320   ROM_LOAD32_WORD( "770c12.k22",     0x000002, 0x040000, CRC(50d14b72) SHA1(e3ff4a5aeefa6c10b5f7fec18297948b7c5acfdf) )
321321
322   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
322   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
323323   ROM_LOAD32_WORD( "770c09.n4",     0x000000, 0x080000, CRC(1ab4a7ff) SHA1(fa007b41027f95d29d2a9f931a2fe235844db637) )
324324   ROM_LOAD32_WORD( "770c08.k4",     0x000002, 0x080000, CRC(a8e80586) SHA1(0401f59baa691905287cef94427f39e0c3f0adc6) )
325325
326   ROM_REGION( 0x080000, "k051316", 0 )   /* zoom/rotate */
326   ROM_REGION( 0x080000, "k051316", 0 )    /* zoom/rotate */
327327   ROM_LOAD( "770c06.f4",     0x000000, 0x040000, CRC(d0c592ee) SHA1(c1be73dd259f2779d715659b177e47513776a0d4) )
328328   ROM_LOAD( "770c07.h4",     0x040000, 0x040000, CRC(0b399fb1) SHA1(fbe26f9aa9a655d08bebcdd79719d35134ca4dd5) )
329329
r31373r31374
355355   ROM_LOAD32_WORD( "770c13.n22",     0x000000, 0x040000, CRC(b859ca4e) SHA1(f58678d503683f78cca0d5ed2d79f6f68ab3495a) )
356356   ROM_LOAD32_WORD( "770c12.k22",     0x000002, 0x040000, CRC(50d14b72) SHA1(e3ff4a5aeefa6c10b5f7fec18297948b7c5acfdf) )
357357
358   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
358   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
359359   ROM_LOAD32_WORD( "770c09.n4",     0x000000, 0x080000, CRC(1ab4a7ff) SHA1(fa007b41027f95d29d2a9f931a2fe235844db637) )
360360   ROM_LOAD32_WORD( "770c08.k4",     0x000002, 0x080000, CRC(a8e80586) SHA1(0401f59baa691905287cef94427f39e0c3f0adc6) )
361361
362   ROM_REGION( 0x080000, "k051316", 0 )   /* zoom/rotate */
362   ROM_REGION( 0x080000, "k051316", 0 )    /* zoom/rotate */
363363   ROM_LOAD( "770c06.f4",     0x000000, 0x040000, CRC(d0c592ee) SHA1(c1be73dd259f2779d715659b177e47513776a0d4) )
364364   ROM_LOAD( "770c07.h4",     0x040000, 0x040000, CRC(0b399fb1) SHA1(fbe26f9aa9a655d08bebcdd79719d35134ca4dd5) )
365365
trunk/src/mame/drivers/gp_1.c
r31373r31374
290290{
291291   m_ctc->trg2(0);
292292   m_ctc->trg2(1);
293}   
293}
294294
295295static const z80_daisy_config daisy_chain[] =
296296{
trunk/src/mame/drivers/wpc_s.c
r31373r31374
1414public:
1515   wpc_s_state(const machine_config &mconfig, device_type type, const char *tag)
1616      : driver_device(mconfig, type, tag),
17        maincpu(*this, "maincpu"),
18        dcs(*this, "dcs"),
19        rombank(*this, "rombank"),
20        mainram(*this, "mainram"),
21        nvram(*this, "nvram"),
22        pic(*this, "pic"),
23        lamp(*this, "lamp"),
24        out(*this, "out")
17         maincpu(*this, "maincpu"),
18         dcs(*this, "dcs"),
19         rombank(*this, "rombank"),
20         mainram(*this, "mainram"),
21         nvram(*this, "nvram"),
22         pic(*this, "pic"),
23         lamp(*this, "lamp"),
24         out(*this, "out")
2525   { }
2626
2727   DECLARE_WRITE8_MEMBER(bank_w);
r31373r31374
374374};
375375
376376const char *const wpc_s_state::outputs_corv[54] = {
377   "s:Trough eject", "s:ZR1 low rev gate", "s:Kickback", "s:Pit stop popper", "s:ZR1 up rev gate", NULL, "s:Knocker", "s:Route 66 kickout",
378   "s:L slingshot", "s:R slingshot", "s:Left jet", "s:Bottom jet", "s:Right jet", NULL, "s:ZR1 lockup", "s:Loop gate",
379   "s:Race direction", "s:L race enable", "s:R race enable", "f:Tenth corvette", "f:Jets", "f:R ramps", "f:U L flipper", "f:Catch me",
377   "s:Trough eject", "s:ZR1 low rev gate", "s:Kickback", "s:Pit stop popper", "s:ZR1 up rev gate", NULL, "s:Knocker", "s:Route 66 kickout",
378   "s:L slingshot", "s:R slingshot", "s:Left jet", "s:Bottom jet", "s:Right jet", NULL, "s:ZR1 lockup", "s:Loop gate",
379   "s:Race direction", "s:L race enable", "s:R race enable", "f:Tenth corvette", "f:Jets", "f:R ramps", "f:U L flipper", "f:Catch me",
380380   "f:ZR1 ramp", "f:ZR1 underside", "f:R rear panel", "f:R standup", "s:R flip power", "s:R flip hold", "s:L flip power", "s:L flip hold",
381   "s:Diverter power", "s:Diverter hold", "s:UL flip power", "s:UL flip hold", NULL, NULL, NULL, NULL,
381   "s:Diverter power", "s:Diverter hold", "s:UL flip power", "s:UL flip hold", NULL, NULL, NULL, NULL,
382382   NULL,
383383   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
384384   "g:Upper left", "g:Upper right", "g:Lower left", "g:Lower right", "g:Back box title"
r31373r31374
386386
387387static INPUT_PORTS_START( corv )
388388   PORT_START("SW.0")
389    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left out lane")
390    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right out lane")
391    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
392    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
393    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plunger")
394    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L return lane")
395    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R return lane")
396    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Spinner")
389   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left out lane")
390   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right out lane")
391   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
392   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
393   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plunger")
394   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L return lane")
395   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R return lane")
396   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Spinner")
397397
398398   PORT_START("SW.1")
399    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
400    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
401    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Buy in button")
402    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
403    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("1st gear (opt)")
404    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("2nd gear (opt)")
405    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("3rd gear (opt)")
406    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("4th gear (opt)")
399   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
400   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
401   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Buy in button")
402   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
403   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("1st gear (opt)")
404   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("2nd gear (opt)")
405   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("3rd gear (opt)")
406   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("4th gear (opt)")
407407
408408   PORT_START("SW.2")
409    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
410    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
411    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
412    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
413    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Route 66 entry")
414    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Pit stop popper")
415    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
416    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop entry")
409   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
410   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
411   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
412   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
413   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Route 66 entry")
414   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Pit stop popper")
415   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
416   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop entry")
417417
418418   PORT_START("SW.3")
419    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("ZR1 bottom entry")
420    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("ZR1 top entry")
421    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Skid pad entry")
422    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Skid pad exit")
423    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Route 66 exit")
424    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L standup 3")
425    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L standup 2")
426    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L standup 1")
419   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("ZR1 bottom entry")
420   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("ZR1 top entry")
421   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Skid pad entry")
422   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Skid pad exit")
423   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Route 66 exit")
424   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L standup 3")
425   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L standup 2")
426   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L standup 1")
427427
428428   PORT_START("SW.4")
429    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L race start")
430    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R race start")
431    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
432    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
433    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L race encoder")
434    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R race encoder")
435    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Route 66 kickout")
436    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Skid rte66 exit")
429   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L race start")
430   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R race start")
431   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
432   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
433   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L race encoder")
434   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R race encoder")
435   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Route 66 kickout")
436   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Skid rte66 exit")
437437
438438   PORT_START("SW.5")
439    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L slingshot")
440    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R slingshot")
441    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
442    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
443    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
444    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L rollover")
445    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M rollover")
446    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R rollover")
439   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L slingshot")
440   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R slingshot")
441   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
442   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
443   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
444   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L rollover")
445   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M rollover")
446   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R rollover")
447447
448448   PORT_START("SW.6")
449    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("ZR1 full left")
450    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("ZR1 full right")
451    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
452    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
453    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("ZR1 exit")
454    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("ZR1 lock ball 1")
455    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("ZR1 lock ball 2")
456    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("ZR1 lock ball 3")
449   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("ZR1 full left")
450   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("ZR1 full right")
451   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
452   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
453   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("ZR1 exit")
454   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("ZR1 lock ball 1")
455   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("ZR1 lock ball 2")
456   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("ZR1 lock ball 3")
457457
458458   PORT_START("SW.7")
459    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Million standup")
460    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Skid pad standup")
461    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R standup")
462    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R rubber")
463    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
464    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Jet rubber")
465    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L outer loop")
466    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R outer loop")
459   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Million standup")
460   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Skid pad standup")
461   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R standup")
462   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R rubber")
463   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
464   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Jet rubber")
465   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L outer loop")
466   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R outer loop")
467467
468468   PORT_START("DOOR")
469    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
470    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
471    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
472    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
473    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
474    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
475    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
476    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
469   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
470   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
471   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
472   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
473   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
474   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
475   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
476   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
477477
478478   PORT_START("DSW")
479479   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
484484   PORT_DIPSETTING(   0xec, "Spain")
485485
486486   PORT_START("FLIPPERS")
487    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
488    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
489    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
490    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
491    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
492    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
493    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper EOS")
494    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
487   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
488   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
489   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
490   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
491   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
492   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
493   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper EOS")
494   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
495495INPUT_PORTS_END
496496
497497const char *const wpc_s_state::lamps_dh[64] = {
r31373r31374
506506};
507507
508508const char *const wpc_s_state::outputs_dh[54] = {
509   "s:Ball release", "s:Autoplunger", "s:Gun launch", "s:Top R popper", "s:Gun popper", "s:Drop target down", "s:Knocker", "s:Trap door hi",
510   "s:Left sling", "s:Right sling", "s:Left jet", "s:Middle jet", "s:Right jet", "s:Left popper", "s:Right diverter", "s:Trap door hold",
511   "f:Headquarters", "f:Top L popper", "f:Warehouse", "s:Gun motor", "f:Gun loaded", "f:Right ramp", "f:Right back", "f:Left back",
509   "s:Ball release", "s:Autoplunger", "s:Gun launch", "s:Top R popper", "s:Gun popper", "s:Drop target down", "s:Knocker", "s:Trap door hi",
510   "s:Left sling", "s:Right sling", "s:Left jet", "s:Middle jet", "s:Right jet", "s:Left popper", "s:Right diverter", "s:Trap door hold",
511   "f:Headquarters", "f:Top L popper", "f:Warehouse", "s:Gun motor", "f:Gun loaded", "f:Right ramp", "f:Right back", "f:Left back",
512512   "s:Drop reset", "s:Top L popper", "s:Left diverter", "s:Right loop gate", "s:R flip power", "s:R flip hold", "s:L flip power", "s:L flip hold",
513   "s:UR flip power", "s:UR flip hold", "s:R loop magnet", "s:Left loop gate", NULL, NULL, NULL, NULL,
513   "s:UR flip power", "s:UR flip hold", "s:R loop magnet", "s:Left loop gate", NULL, NULL, NULL, NULL,
514514   "s:Coin meter",
515515   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
516516   "g:Right string", "g:Left string", "g:Backbox title", "g:Backbox face", "g:Bottom string"
r31373r31374
518518
519519static INPUT_PORTS_START( dh )
520520   PORT_START("SW.0")
521    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Gun handle trig")
522    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
523    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
524    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
525    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
526    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
527    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right inlane")
528    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 8")
521   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Gun handle trig")
522   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
523   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
524   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
525   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
526   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
527   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right inlane")
528   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 8")
529529
530530   PORT_START("SW.1")
531    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
532    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
533    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ex ball button")
534    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
535    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left inlane")
536    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
537    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 1")
538    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 2")
531   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
532   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
533   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ex ball button")
534   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
535   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left inlane")
536   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
537   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 1")
538   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 2")
539539
540540   PORT_START("SW.2")
541    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough jam")
542    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
543    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
544    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
545    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
546    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
547    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
548    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right ramp make")
541   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough jam")
542   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
543   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
544   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
545   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
546   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
547   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
548   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right ramp make")
549549
550550   PORT_START("SW.3")
551    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left ramp enter")
552    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop")
553    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left ramp make")
554    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Gun chamber")
555    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Gun popper")
556    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Top R popper")
557    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
558    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
551   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left ramp enter")
552   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop")
553   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left ramp make")
554   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Gun chamber")
555   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Gun popper")
556   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Top R popper")
557   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
558   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
559559
560560   PORT_START("SW.4")
561    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp enter")
562    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
563    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target down")
564    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 6")
565    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 7")
566    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 5")
567    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 4")
568    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 3")
561   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp enter")
562   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
563   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target down")
564   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 6")
565   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 7")
566   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 5")
567   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 4")
568   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 3")
569569
570570   PORT_START("SW.5")
571    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left sling")
572    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right sling")
573    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
574    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle jet")
575    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
576    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left rollover")
577    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle rollover")
578    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right rollover")
571   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left sling")
572   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right sling")
573   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
574   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle jet")
575   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
576   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left rollover")
577   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle rollover")
578   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right rollover")
579579
580580   PORT_START("SW.6")
581    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
582    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
583    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top L popper")
584    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
585    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
586    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Gun position")
587    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Gun lockup")
588    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
581   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
582   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
583   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top L popper")
584   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
585   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
586   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Gun position")
587   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Gun lockup")
588   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
589589
590590   PORT_START("SW.7")
591    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
592    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
593    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
594    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
595    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
596    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
597    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
598    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Test switch")
591   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
592   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
593   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
594   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
595   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
596   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
597   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
598   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Test switch")
599599
600600   PORT_START("DOOR")
601    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
602    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
603    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
604    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
605    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
606    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
607    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
608    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
601   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
602   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
603   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
604   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
605   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
606   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
607   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
608   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
609609
610610   PORT_START("DSW")
611611   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
616616   PORT_DIPSETTING(   0xec, "Spain")
617617
618618   PORT_START("FLIPPERS")
619    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
620    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
621    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
622    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
623    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper EOS")
624    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
625    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
626    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
619   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
620   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
621   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
622   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
623   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper EOS")
624   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
625   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
626   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
627627INPUT_PORTS_END
628628
629629const char *const wpc_s_state::lamps_i500[64] = {
r31373r31374
638638};
639639
640640const char *const wpc_s_state::outputs_i500[54] = {
641   "s:Auto plunger", "s:Upper popper", "s:Upper eject", "s:Lower eject", "s:Turbo popper", NULL, "s:Knocker", "s:Left jet",
642   "s:Right jet", "s:Center jet", "s:Left sling", "s:Right sling", "s:Trough", NULL, "f:Upper popper fls", "f:Top left corner",
643   "f:Top right corner", "s:Race track motor", "f:Orange car", "f:Yellow car", "f:Blue car", "f:Green car", "f:Lft jet flasher", "f:Rt jet flasher",
641   "s:Auto plunger", "s:Upper popper", "s:Upper eject", "s:Lower eject", "s:Turbo popper", NULL, "s:Knocker", "s:Left jet",
642   "s:Right jet", "s:Center jet", "s:Left sling", "s:Right sling", "s:Trough", NULL, "f:Upper popper fls", "f:Top left corner",
643   "f:Top right corner", "s:Race track motor", "f:Orange car", "f:Yellow car", "f:Blue car", "f:Green car", "f:Lft jet flasher", "f:Rt jet flasher",
644644   "f:Cntr jet flasher", "f:Right side", "f:Left side (2)", "f:Rt ramp enter", "s:R flip power", "s:R flip hold", "s:L flip power", "s:L flip hold",
645   "s:UR flip power", "s:UR flip hold", "s:Diverter power", "s:Diverter hold", NULL, NULL, NULL, NULL,
645   "s:UR flip power", "s:UR flip hold", "s:Diverter power", "s:Diverter hold", NULL, NULL, NULL, NULL,
646646   "s:Coin meter",
647647   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
648648   "g:Upper lft plyfld", "g:Upper rt plyfld", "g:Lower playfield", "g:Backbox", "g:Title-coindoor"
r31373r31374
650650
651651static INPUT_PORTS_START( i500 )
652652   PORT_START("SW.0")
653    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Ball launch")
654    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
655    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
656    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
657    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
658    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left flip lane")
659    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right flip lane")
660    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right oulane")
653   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Ball launch")
654   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
655   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
656   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
657   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
658   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left flip lane")
659   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right flip lane")
660   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right oulane")
661661
662662   PORT_START("SW.1")
663    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
664    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
665    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Buy-in button")
666    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
667    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
668    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
669    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
670    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank upper")
663   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
664   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
665   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Buy-in button")
666   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
667   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
668   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
669   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
670   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank upper")
671671
672672   PORT_START("SW.2")
673    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank center")
674    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank lower")
675    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
676    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rt flip wrench")
677    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp enter")
678    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp made")
679    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
680    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop")
673   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank center")
674   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank lower")
675   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
676   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rt flip wrench")
677   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp enter")
678   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp made")
679   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
680   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop")
681681
682682   PORT_START("SW.3")
683    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Top trough")
684    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
685    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
686    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
687    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
688    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lft ramp standup")
689    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Turbo wrench")
690    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Jet bumpr wrench")
683   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Top trough")
684   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
685   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
686   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
687   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
688   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lft ramp standup")
689   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Turbo wrench")
690   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Jet bumpr wrench")
691691
692692   PORT_START("SW.4")
693    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left lane")
694    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center lane")
695    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right lane")
696    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ten point")
697    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lest ramp wrench")
698    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left light-up")
699    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Center light-up")
700    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right light-up")
693   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left lane")
694   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center lane")
695   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right lane")
696   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ten point")
697   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lest ramp wrench")
698   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left light-up")
699   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Center light-up")
700   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right light-up")
701701
702702   PORT_START("SW.5")
703    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Upper popper")
704    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Turbo popper")
705    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Turbo ball sense")
706    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Upper eject")
707    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lower kicker")
708    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Turbo index")
709    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
710    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
703   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Upper popper")
704   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Turbo popper")
705   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Turbo ball sense")
706   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Upper eject")
707   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lower kicker")
708   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Turbo index")
709   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
710   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
711711
712712   PORT_START("SW.6")
713    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
714    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
715    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
716    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center jet")
717    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp enter")
718    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp made")
719    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
720    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
713   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
714   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
715   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
716   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center jet")
717   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp enter")
718   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp made")
719   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
720   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
721721
722722   PORT_START("SW.7")
723    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
723   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
724724
725725   PORT_START("DOOR")
726    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
727    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
728    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
729    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
730    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
731    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
732    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
733    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
726   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
727   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
728   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
729   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
730   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
731   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
732   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
733   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
734734
735735   PORT_START("DSW")
736736   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
741741   PORT_DIPSETTING(   0xec, "Spain")
742742
743743   PORT_START("FLIPPERS")
744    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
745    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
746    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
747    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
748    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper EOS")
749    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
750    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
751    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
744   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
745   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
746   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
747   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
748   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper EOS")
749   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
750   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
751   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
752752INPUT_PORTS_END
753753
754754const char *const wpc_s_state::lamps_jb[64] = {
r31373r31374
763763};
764764
765765const char *const wpc_s_state::outputs_jb[54] = {
766   "s:Ball release", NULL, "s:Game saucer", "s:Drop targets", "s:Right eject hole", "s:Raise ramp", "s:Knocker", "s:Left eject hole",
767   "s:Left slingshot", "s:Right slingshot", "s:Lower jet bumper", "s:Left jet bumber", "s:Upper jet bumper", "s:Drop ramp", "f:Right visor", "f:Left visor",
768   "f:Center visor", "f:Pinbot face", "f:Jet bumpers", "f:Lower left", "f:Mid left", "f:Lower right", "f:Back panel 1 (L)", "f:Back panel 2",
766   "s:Ball release", NULL, "s:Game saucer", "s:Drop targets", "s:Right eject hole", "s:Raise ramp", "s:Knocker", "s:Left eject hole",
767   "s:Left slingshot", "s:Right slingshot", "s:Lower jet bumper", "s:Left jet bumber", "s:Upper jet bumper", "s:Drop ramp", "f:Right visor", "f:Left visor",
768   "f:Center visor", "f:Pinbot face", "f:Jet bumpers", "f:Lower left", "f:Mid left", "f:Lower right", "f:Back panel 1 (L)", "f:Back panel 2",
769769   "f:Back panel 3", "f:Back panel 4", "f:Back panel 5 (R)", NULL, "s:R flip power", "s:R flip hold", "s:L flip power", "s:L flip hold",
770   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
770   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
771771   "s:Coin meter",
772772   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
773773   "g:Playfield lower", "g:Playfield left", "g:Playfield upper", "g:Playfield right", "g:Insert"
r31373r31374
775775
776776static INPUT_PORTS_START( jb )
777777   PORT_START("SW.0")
778    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L left 10 point")
779    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U left 10 point")
780    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
781    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
782    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp is down")
783    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("High drop target")
784    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Center drop target")
785    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Low drop target")
778   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L left 10 point")
779   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U left 10 point")
780   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
781   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
782   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp is down")
783   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("High drop target")
784   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Center drop target")
785   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Low drop target")
786786
787787   PORT_START("SW.1")
788    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
789    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
790    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Buy extra ball")
791    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
792    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
793    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L flipper lane")
794    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R flipper lane")
795    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
788   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
789   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
790   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Buy extra ball")
791   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
792   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
793   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L flipper lane")
794   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R flipper lane")
795   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
796796
797797   PORT_START("SW.2")
798    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough jam")
799    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
800    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
801    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
802    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
803    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp exit")
804    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp entrance")
805    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Targ under ramp")
798   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough jam")
799   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
800   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
801   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
802   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
803   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp exit")
804   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp entrance")
805   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Targ under ramp")
806806
807807   PORT_START("SW.3")
808    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Visor 1 (left)")
809    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Visor 2")
810    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Visor 3")
811    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Visor 4")
812    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Visor 5 (right)")
813    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Game saucer")
814    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right eject hole")
815    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left eject hole")
808   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Visor 1 (left)")
809   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Visor 2")
810   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Visor 3")
811   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Visor 4")
812   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Visor 5 (right)")
813   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Game saucer")
814   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right eject hole")
815   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left eject hole")
816816
817817   PORT_START("SW.4")
818    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5-bank 1 (upper)")
819    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5-bank target 2")
820    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5-bank target 3")
821    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5-bank target 4")
822    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5-bank 5 (lower)")
823    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Vortex upper")
824    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Vortex center")
825    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Vortex lower")
818   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5-bank 1 (upper)")
819   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5-bank target 2")
820   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5-bank target 3")
821   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5-bank target 4")
822   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5-bank 5 (lower)")
823   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Vortex upper")
824   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Vortex center")
825   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Vortex lower")
826826
827827   PORT_START("SW.5")
828    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Upper jet bumper")
829    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet bumper")
830    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lower jet bumper")
831    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
832    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
833    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right 10 point")
834    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hit me target")
835    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ball shooter")
828   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Upper jet bumper")
829   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet bumper")
830   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lower jet bumper")
831   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
832   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
833   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right 10 point")
834   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hit me target")
835   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ball shooter")
836836
837837   PORT_START("SW.6")
838    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
838   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
839839
840840   PORT_START("SW.7")
841    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
841   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
842842
843843   PORT_START("DOOR")
844    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
845    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
846    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
847    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
848    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
849    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
850    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
851    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
844   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
845   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
846   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
847   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
848   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
849   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
850   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
851   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
852852
853853   PORT_START("DSW")
854854   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
859859   PORT_DIPSETTING(   0xec, "Spain")
860860
861861   PORT_START("FLIPPERS")
862    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
863    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
864    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
865    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
866    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Visor is closed")
867    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
868    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Visor is open")
869    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
862   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
863   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
864   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
865   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
866   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Visor is closed")
867   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
868   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Visor is open")
869   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
870870INPUT_PORTS_END
871871
872872const char *const wpc_s_state::lamps_jm[64] = {
r31373r31374
881881};
882882
883883const char *const wpc_s_state::outputs_jm[54] = {
884   "s:Trough eject", "s:Autoplunger", "s:Popper", NULL, "s:Clear matrix", "s:Hand magnet", "s:Knocker", NULL,
885   "s:Left sling", "s:Right sling", "s:Left jet", "s:Bottom jet", "s:Right jet", "s:Crazy Bob's", "s:Drop target up", "s:Drop target down",
886   "f:Jets", "f:Crazy Bob's", "f:Left sling", "f:Right sling", "s:X mot direction", "s:X motor enable", "s:Y mot direction", "s:Y motor enable",
884   "s:Trough eject", "s:Autoplunger", "s:Popper", NULL, "s:Clear matrix", "s:Hand magnet", "s:Knocker", NULL,
885   "s:Left sling", "s:Right sling", "s:Left jet", "s:Bottom jet", "s:Right jet", "s:Crazy Bob's", "s:Drop target up", "s:Drop target down",
886   "f:Jets", "f:Crazy Bob's", "f:Left sling", "f:Right sling", "s:X mot direction", "s:X motor enable", "s:Y mot direction", "s:Y motor enable",
887887   "f:Left ramp", "f:Right ramp", "f:Hand popper", "f:R backpanel", "s:R flip power", "s:R flip hold", "s:L flip power", "s:L flip hold",
888   "s:L diverter power", "s:L diverter hold", "s:R diverter power", "s:R diverter hold", NULL, NULL, NULL, NULL,
888   "s:L diverter power", "s:L diverter hold", "s:R diverter power", "s:R diverter hold", NULL, NULL, NULL, NULL,
889889   "s:Coin meter",
890890   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
891891   "g:String 1", "g:String 2", "g:String 3", "g:String 4", "g:String 5"
r31373r31374
893893
894894static INPUT_PORTS_START( jm )
895895   PORT_START("SW.0")
896    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Ball launch")
897    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("X hand home")
898    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
899    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
900    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
901    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left flip lane")
902    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right flip lane")
903    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
896   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Ball launch")
897   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("X hand home")
898   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
899   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
900   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
901   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left flip lane")
902   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right flip lane")
903   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
904904
905905   PORT_START("SW.1")
906    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
907    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
908    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Buy in button")
909    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
910    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L slingshot")
911    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R slingshot")
912    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L standup")
913    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R standup")
906   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
907   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
908   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Buy in button")
909   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
910   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L slingshot")
911   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R slingshot")
912   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L standup")
913   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R standup")
914914
915915   PORT_START("SW.2")
916    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough jam")
917    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
918    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
919    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
920    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
921    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Popper ball 1")
922    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Y hand home")
923    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R rubber")
916   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough jam")
917   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
918   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
919   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
920   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
921   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Popper ball 1")
922   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Y hand home")
923   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R rubber")
924924
925925   PORT_START("SW.3")
926    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp enter")
927    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp made")
928    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
929    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
930    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
931    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
932    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Crazy Bob's")
933    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Spinner")
926   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp enter")
927   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp made")
928   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
929   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
930   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
931   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
932   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Crazy Bob's")
933   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Spinner")
934934
935935   PORT_START("SW.4")
936    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 11")
937    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 21")
938    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 31")
939    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp enter")
940    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp made")
941    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
942    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop")
943    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop entry")
936   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 11")
937   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 21")
938   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 31")
939   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp enter")
940   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp made")
941   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
942   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop")
943   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop entry")
944944
945945   PORT_START("SW.5")
946    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 12")
947    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 22")
948    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 32")
949    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet lane")
950    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle jet lane")
951    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet lane")
952    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R hand control")
953    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L hand control")
946   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 12")
947   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 22")
948   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 32")
949   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet lane")
950   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle jet lane")
951   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet lane")
952   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R hand control")
953   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L hand control")
954954
955955   PORT_START("SW.6")
956    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 13")
957    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 23")
958    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 33")
959    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("X encoder A")
960    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("X encoder B")
961    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Y encoder B")
962    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Y encoder A")
963    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
956   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 13")
957   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 23")
958   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Cyber matrix 33")
959   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("X encoder A")
960   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("X encoder B")
961   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Y encoder B")
962   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Y encoder A")
963   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
964964
965965   PORT_START("SW.7")
966    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
966   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
967967
968968   PORT_START("DOOR")
969    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
970    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
971    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
972    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
973    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
974    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
975    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
976    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
969   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
970   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
971   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
972   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
973   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
974   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
975   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
976   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
977977
978978   PORT_START("DSW")
979979   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
984984   PORT_DIPSETTING(   0xec, "Spain")
985985
986986   PORT_START("FLIPPERS")
987    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
988    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
989    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
990    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
991    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Ball in hand")
992    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
993    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
994    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
987   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
988   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
989   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
990   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
991   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Ball in hand")
992   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
993   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
994   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
995995INPUT_PORTS_END
996996
997997const char *const wpc_s_state::lamps_nf[64] = {
r31373r31374
10061006};
10071007
10081008const char *const wpc_s_state::outputs_nf[54] = {
1009   "s:Right popper", "s:Auto plunger", "s:Right magnet", "s:Kickback", "s:Center magnet", "s:Left magnet", "s:Knocker", "s:Drop target down",
1010   NULL, "s:Right slingshot", "s:Left slingshot", "s:Drop target up", NULL, "s:Trough", "s:Eject", "s:Skull mouth",
1011   "f:Fls(2) flip rtrn", "f:Fls spinner", "f:Fls no fear", "f:Fls(3) rt ramp", "f:Fls(2) skull", "f:Fls bkbox expl", "f:Fls(3) left ramp", "f:Fls top left",
1009   "s:Right popper", "s:Auto plunger", "s:Right magnet", "s:Kickback", "s:Center magnet", "s:Left magnet", "s:Knocker", "s:Drop target down",
1010   NULL, "s:Right slingshot", "s:Left slingshot", "s:Drop target up", NULL, "s:Trough", "s:Eject", "s:Skull mouth",
1011   "f:Fls(2) flip rtrn", "f:Fls spinner", "f:Fls no fear", "f:Fls(3) rt ramp", "f:Fls(2) skull", "f:Fls bkbox expl", "f:Fls(3) left ramp", "f:Fls top left",
10121012   "f:Fls(2) auto-fire", "f:Fls bkbox L top", "f:Fls bkbox R top", "f:Fls rt popper", "s:R flip power", "s:R flip hold", "s:L flip power", "s:L flip hold",
1013   "s:UR flip power", "s:UR flip hold", NULL, NULL, NULL, NULL, NULL, NULL,
1013   "s:UR flip power", "s:UR flip hold", NULL, NULL, NULL, NULL, NULL, NULL,
10141014   "s:Coin meter",
10151015   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
10161016   "g:Playfield top", "g:Playfield right", "g:Playfield left", "g:Insert title", "g:Insert bkground"
r31373r31374
10181018
10191019static INPUT_PORTS_START( nf )
10201020   PORT_START("SW.0")
1021    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Ball launch")
1022    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1023    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1024    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1025    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1026    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Spinner")
1027    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1028    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1021   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Ball launch")
1022   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1023   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1024   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1025   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1026   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Spinner")
1027   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1028   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
10291029
10301030   PORT_START("SW.1")
1031    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1032    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1033    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Buy extra ball")
1034    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1035    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Kickback")
1036    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1037    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1038    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1031   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1032   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1033   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Buy extra ball")
1034   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1035   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Kickback")
1036   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1037   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1038   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
10391039
10401040   PORT_START("SW.2")
1041    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough stack")
1042    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough 1 (right)")
1043    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough 2")
1044    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough 3")
1045    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough 4")
1041   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough stack")
1042   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough 1 (right)")
1043   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough 2")
1044   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough 3")
1045   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough 4")
10461046   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
1047    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Center tr entr")
1048    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left tr entr")
1047   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Center tr entr")
1048   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left tr entr")
10491049
10501050   PORT_START("SW.3")
1051    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper 1")
1052    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper 2")
1051   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper 1")
1052   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper 2")
10531053   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1054    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
1055    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1056    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left magnet")
1057    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Center magnet")
1058    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right magnet")
1054   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
1055   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1056   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left magnet")
1057   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Center magnet")
1058   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right magnet")
10591059
10601060   PORT_START("SW.4")
1061    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1062    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1063    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1064    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left wireform")
1065    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop")
1066    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Light kb bottom")
1067    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Light kb top")
1068    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop")
1061   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1062   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1063   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1064   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left wireform")
1065   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop")
1066   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Light kb bottom")
1067   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Light kb top")
1068   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop")
10691069
10701070   PORT_START("SW.5")
1071    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Eject hole")
1072    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
1073    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp enter")
1074    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp middle")
1075    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1076    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp enter")
1077    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp exit")
1078    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1071   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Eject hole")
1072   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
1073   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp enter")
1074   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp middle")
1075   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1076   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp enter")
1077   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp exit")
1078   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
10791079
10801080   PORT_START("SW.6")
1081    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1081   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
10821082
10831083   PORT_START("SW.7")
1084    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1084   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
10851085
10861086   PORT_START("DOOR")
1087    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1088    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1089    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1090    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1091    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1092    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1093    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1094    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1087   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1088   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1089   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1090   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1091   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1092   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1093   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1094   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
10951095
10961096   PORT_START("DSW")
10971097   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
11021102   PORT_DIPSETTING(   0xec, "Spain")
11031103
11041104   PORT_START("FLIPPERS")
1105    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1106    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1107    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1108    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1109    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper EOS")
1110    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1111    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1112    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1105   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1106   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1107   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1108   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1109   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper EOS")
1110   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1111   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1112   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
11131113INPUT_PORTS_END
11141114
11151115const char *const wpc_s_state::lamps_rs[64] = {
r31373r31374
11241124};
11251125
11261126const char *const wpc_s_state::outputs_rs[54] = {
1127   "s:Trough", "s:L left diverter", "s:Lock-up pin", "s:U left diverter", "s:U right diverter", "s:Start city", "s:Knocker", "s:Lock kickout",
1128   "s:\"Ted\" eyes left", "s:\"Ted\" lids down", "s:\"Ted\" lids up", "s:\"Ted\" eyes right", "s:\"Red\" lids down", "s:\"Red\" eyes left", "s:\"Red\" lids up", "s:\"Red\" eyes right",
1129   "s:", "s:", "s:", "s:", "s:Left sling", "s:Right sling", "s:Bulldozer motor", "s:\"Red\" eject",
1130   "s:Top jet", "s:Left jet", "s:Right jet", "s:Shaker motor", "s:", "s:", "s:", "s:",
1131   "s:", "s:", "s:", "s:", "f:Little flipper", "f:Left ramp", "f:Back white", "f:Back yellow",
1127   "s:Trough", "s:L left diverter", "s:Lock-up pin", "s:U left diverter", "s:U right diverter", "s:Start city", "s:Knocker", "s:Lock kickout",
1128   "s:\"Ted\" eyes left", "s:\"Ted\" lids down", "s:\"Ted\" lids up", "s:\"Ted\" eyes right", "s:\"Red\" lids down", "s:\"Red\" eyes left", "s:\"Red\" lids up", "s:\"Red\" eyes right",
1129   "s:", "s:", "s:", "s:", "s:Left sling", "s:Right sling", "s:Bulldozer motor", "s:\"Red\" eject",
1130   "s:Top jet", "s:Left jet", "s:Right jet", "s:Shaker motor", "s:", "s:", "s:", "s:",
1131   "s:", "s:", "s:", "s:", "f:Little flipper", "f:Left ramp", "f:Back white", "f:Back yellow",
11321132   "s:Coin meter",
11331133   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
11341134   "g:Playfld/insert 1", "g:Playfld/insert 2", "g:Playfld/insert 3", "g:Right playfield", "g:Left playfield"
r31373r31374
11361136
11371137static INPUT_PORTS_START( rs )
11381138   PORT_START("SW.0")
1139    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1140    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1141    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1142    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1143    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1144    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1145    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1146    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1139   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1140   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1141   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1142   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1143   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1144   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1145   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1146   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
11471147
11481148   PORT_START("SW.1")
1149    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1150    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1151    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1152    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1153    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1154    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1155    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1156    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1149   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1150   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1151   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1152   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1153   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1154   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1155   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1156   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
11571157
11581158   PORT_START("SW.2")
1159    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1160    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1161    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1162    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1163    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1164    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1165    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1166    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
1159   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1160   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1161   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1162   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1163   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1164   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1165   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1166   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
11671167
11681168   PORT_START("SW.3")
1169    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1170    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1171    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1172    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1173    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1174    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1175    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1176    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
1169   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1170   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1171   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1172   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1173   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1174   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1175   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1176   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
11771177
11781178   PORT_START("SW.4")
1179    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1180    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1181    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1182    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1183    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1184    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1185    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1186    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
1179   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1180   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1181   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1182   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1183   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1184   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1185   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1186   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
11871187
11881188   PORT_START("SW.5")
1189    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1190    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1191    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1192    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1193    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1194    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1195    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1196    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1189   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1190   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1191   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1192   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1193   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1194   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1195   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1196   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
11971197
11981198   PORT_START("SW.6")
1199    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1200    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1201    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1202    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1203    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1204    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1205    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1206    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
1199   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1200   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1201   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1202   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1203   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1204   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1205   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1206   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
12071207
12081208   PORT_START("SW.7")
1209    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1209   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
12101210
12111211   PORT_START("DOOR")
1212    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1213    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1214    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1215    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1216    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1217    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1218    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1219    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1212   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1213   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1214   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1215   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1216   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1217   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1218   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1219   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
12201220
12211221   PORT_START("DSW")
12221222   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
12271227   PORT_DIPSETTING(   0xec, "Spain")
12281228
12291229   PORT_START("FLIPPERS")
1230    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1231    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1232    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1233    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1234    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1235    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1236    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1237    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1230   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1231   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1232   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1233   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1234   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1235   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1236   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1237   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
12381238INPUT_PORTS_END
12391239
12401240const char *const wpc_s_state::lamps_fs[64] = {
r31373r31374
12491249};
12501250
12511251const char *const wpc_s_state::outputs_fs[54] = {
1252   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1253   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1254   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1255   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1256   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1252   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1253   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1254   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1255   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1256   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
12571257   "s:Coin meter",
12581258   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
12591259   "g:", "g:", "g:", "g:", "g:"
r31373r31374
12611261
12621262static INPUT_PORTS_START( fs )
12631263   PORT_START("SW.0")
1264    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1265    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1266    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1267    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1268    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1269    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1270    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1271    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1264   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1265   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1266   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1267   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1268   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1269   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1270   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1271   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
12721272
12731273   PORT_START("SW.1")
1274    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1275    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1276    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1277    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1278    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1279    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1280    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1281    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1274   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1275   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1276   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1277   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1278   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1279   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1280   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1281   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
12821282
12831283   PORT_START("SW.2")
1284    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1285    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1286    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1287    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1288    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1289    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1290    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1291    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
1284   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1285   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1286   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1287   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1288   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1289   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1290   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1291   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
12921292
12931293   PORT_START("SW.3")
1294    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1295    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1296    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1297    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1298    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1299    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1300    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1301    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
1294   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1295   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1296   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1297   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1298   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1299   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1300   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1301   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
13021302
13031303   PORT_START("SW.4")
1304    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1305    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1306    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1307    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1308    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1309    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1310    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1311    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
1304   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1305   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1306   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1307   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1308   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1309   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1310   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1311   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
13121312
13131313   PORT_START("SW.5")
1314    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1315    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1316    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1317    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1318    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1319    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1320    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1321    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1314   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1315   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1316   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1317   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1318   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1319   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1320   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1321   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
13221322
13231323   PORT_START("SW.6")
1324    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1325    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1326    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1327    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1328    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1329    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1330    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1331    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
1324   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1325   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1326   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1327   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1328   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1329   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1330   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1331   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
13321332
13331333   PORT_START("SW.7")
1334    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1334   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
13351335
13361336   PORT_START("DOOR")
1337    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1338    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1339    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1340    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1341    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1342    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1343    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1344    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1337   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1338   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1339   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1340   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1341   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1342   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1343   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1344   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
13451345
13461346   PORT_START("DSW")
13471347   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
13521352   PORT_DIPSETTING(   0xec, "Spain")
13531353
13541354   PORT_START("FLIPPERS")
1355    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1356    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1357    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1358    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1359    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1360    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1361    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1362    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1355   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1356   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1357   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1358   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1359   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1360   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1361   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1362   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
13631363INPUT_PORTS_END
13641364
13651365const char *const wpc_s_state::lamps_ts[64] = {
r31373r31374
13741374};
13751375
13761376const char *const wpc_s_state::outputs_ts[54] = {
1377   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1378   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1379   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1380   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1381   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1377   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1378   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1379   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1380   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1381   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
13821382   "s:Coin meter",
13831383   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
13841384   "g:", "g:", "g:", "g:", "g:"
r31373r31374
13861386
13871387static INPUT_PORTS_START( ts )
13881388   PORT_START("SW.0")
1389    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1390    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1391    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1392    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1393    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1394    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1395    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1396    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1389   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1390   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1391   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1392   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1393   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1394   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1395   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1396   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
13971397
13981398   PORT_START("SW.1")
1399    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1400    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1401    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1402    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1403    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1404    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1405    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1406    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1399   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1400   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1401   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1402   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1403   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1404   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1405   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1406   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
14071407
14081408   PORT_START("SW.2")
1409    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1410    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1411    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1412    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1413    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1414    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1415    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1416    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
1409   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1410   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1411   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1412   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1413   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1414   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1415   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1416   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
14171417
14181418   PORT_START("SW.3")
1419    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1420    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1421    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1422    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1423    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1424    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1425    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1426    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
1419   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1420   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1421   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1422   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1423   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1424   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1425   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1426   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
14271427
14281428   PORT_START("SW.4")
1429    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1430    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1431    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1432    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1433    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1434    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1435    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1436    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
1429   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1430   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1431   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1432   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1433   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1434   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1435   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1436   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
14371437
14381438   PORT_START("SW.5")
1439    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1440    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1441    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1442    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1443    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1444    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1445    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1446    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1439   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1440   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1441   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1442   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1443   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1444   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1445   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1446   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
14471447
14481448   PORT_START("SW.6")
1449    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1450    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1451    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1452    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1453    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1454    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1455    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1456    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
1449   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1450   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1451   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1452   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1453   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1454   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1455   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1456   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
14571457
14581458   PORT_START("SW.7")
1459    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1459   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
14601460
14611461   PORT_START("DOOR")
1462    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1463    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1464    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1465    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1466    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1467    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1468    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1469    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1462   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1463   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1464   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1465   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1466   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1467   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1468   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1469   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
14701470
14711471   PORT_START("DSW")
14721472   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
14771477   PORT_DIPSETTING(   0xec, "Spain")
14781478
14791479   PORT_START("FLIPPERS")
1480    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1481    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1482    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1483    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1484    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1485    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1486    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1487    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1480   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1481   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1482   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1483   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1484   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1485   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1486   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1487   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
14881488INPUT_PORTS_END
14891489
14901490const char *const wpc_s_state::lamps_tom[64] = {
r31373r31374
14991499};
15001500
15011501const char *const wpc_s_state::outputs_tom[54] = {
1502   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1503   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1504   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1505   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1506   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1502   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1503   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1504   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1505   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1506   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
15071507   "s:Coin meter",
15081508   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
15091509   "g:", "g:", "g:", "g:", "g:"
r31373r31374
15111511
15121512static INPUT_PORTS_START( tom )
15131513   PORT_START("SW.0")
1514    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1515    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1516    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1517    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1518    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1519    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1520    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1521    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1514   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1515   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1516   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1517   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1518   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1519   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1520   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1521   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
15221522
15231523   PORT_START("SW.1")
1524    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1525    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1526    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1527    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1528    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1529    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1530    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1531    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1524   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1525   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1526   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1527   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1528   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1529   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1530   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1531   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
15321532
15331533   PORT_START("SW.2")
1534    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1535    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1536    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1537    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1538    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1539    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1540    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1541    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
1534   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1535   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1536   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1537   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1538   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1539   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1540   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1541   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
15421542
15431543   PORT_START("SW.3")
1544    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1545    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1546    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1547    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1548    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1549    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1550    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1551    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
1544   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1545   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1546   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1547   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1548   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1549   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1550   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1551   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
15521552
15531553   PORT_START("SW.4")
1554    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1555    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1556    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1557    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1558    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1559    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1560    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1561    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
1554   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1555   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1556   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1557   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1558   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1559   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1560   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1561   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
15621562
15631563   PORT_START("SW.5")
1564    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1565    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1566    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1567    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1568    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1569    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1570    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1571    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1564   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1565   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1566   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1567   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1568   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1569   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1570   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1571   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
15721572
15731573   PORT_START("SW.6")
1574    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1575    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1576    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1577    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1578    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1579    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1580    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1581    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
1574   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1575   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1576   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1577   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1578   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1579   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1580   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1581   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
15821582
15831583   PORT_START("SW.7")
1584    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1584   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
15851585
15861586   PORT_START("DOOR")
1587    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1588    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1589    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1590    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1591    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1592    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1593    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1594    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1587   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1588   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1589   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1590   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1591   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1592   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1593   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1594   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
15951595
15961596   PORT_START("DSW")
15971597   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
16021602   PORT_DIPSETTING(   0xec, "Spain")
16031603
16041604   PORT_START("FLIPPERS")
1605    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1606    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1607    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1608    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1609    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1610    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1611    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1612    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1605   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1606   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1607   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1608   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1609   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1610   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1611   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1612   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
16131613INPUT_PORTS_END
16141614
16151615const char *const wpc_s_state::lamps_wd[64] = {
r31373r31374
16241624};
16251625
16261626const char *const wpc_s_state::outputs_wd[54] = {
1627   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1628   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1629   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1630   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1631   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1627   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1628   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1629   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1630   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1631   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
16321632   "s:Coin meter",
16331633   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
16341634   "g:", "g:", "g:", "g:", "g:"
r31373r31374
16361636
16371637static INPUT_PORTS_START( wd )
16381638   PORT_START("SW.0")
1639    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1640    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1641    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1642    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1643    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1644    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1645    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1646    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1639   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1640   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1641   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1642   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1643   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1644   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1645   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1646   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
16471647
16481648   PORT_START("SW.1")
1649    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1650    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1651    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1652    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1653    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1654    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1655    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1656    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1649   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1650   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1651   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1652   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1653   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1654   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1655   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1656   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
16571657
16581658   PORT_START("SW.2")
1659    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1660    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1661    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1662    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1663    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1664    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1665    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1666    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
1659   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1660   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1661   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1662   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1663   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1664   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1665   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1666   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
16671667
16681668   PORT_START("SW.3")
1669    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1670    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1671    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1672    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1673    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1674    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1675    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1676    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
1669   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1670   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1671   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1672   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1673   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1674   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1675   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1676   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
16771677
16781678   PORT_START("SW.4")
1679    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1680    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1681    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1682    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1683    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1684    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1685    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1686    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
1679   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1680   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1681   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1682   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1683   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1684   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1685   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1686   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
16871687
16881688   PORT_START("SW.5")
1689    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1690    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1691    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1692    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1693    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1694    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1695    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1696    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1689   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1690   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1691   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1692   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1693   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1694   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1695   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1696   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
16971697
16981698   PORT_START("SW.6")
1699    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1700    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1701    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1702    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1703    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1704    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1705    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1706    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
1699   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1700   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1701   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1702   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1703   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1704   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1705   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1706   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
17071707
17081708   PORT_START("SW.7")
1709    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1709   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
17101710
17111711   PORT_START("DOOR")
1712    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1713    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1714    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1715    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1716    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1717    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1718    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1719    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1712   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1713   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1714   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1715   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1716   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1717   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1718   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1719   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
17201720
17211721   PORT_START("DSW")
17221722   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
17271727   PORT_DIPSETTING(   0xec, "Spain")
17281728
17291729   PORT_START("FLIPPERS")
1730    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1731    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1732    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1733    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1734    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1735    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1736    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1737    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1730   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1731   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1732   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1733   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1734   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1735   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1736   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1737   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
17381738INPUT_PORTS_END
17391739
17401740const char *const wpc_s_state::lamps_wcs[64] = {
r31373r31374
17491749};
17501750
17511751const char *const wpc_s_state::outputs_wcs[54] = {
1752   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1753   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1754   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1755   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1756   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1752   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1753   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1754   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1755   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
1756   "s:", "s:", "s:", "s:", "s:", "s:", "s:", "s:",
17571757   "s:Coin meter",
17581758   NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
17591759   "g:", "g:", "g:", "g:", "g:"
r31373r31374
17611761
17621762static INPUT_PORTS_START( wcs )
17631763   PORT_START("SW.0")
1764    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1765    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1766    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1767    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1768    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1769    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1770    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1771    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1764   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1765   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1766   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1767   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1768   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1769   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1770   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1771   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
17721772
17731773   PORT_START("SW.1")
1774    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1775    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1776    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1777    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1778    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1779    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1780    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1781    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1774   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1775   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1776   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1777   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1778   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1779   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1780   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1781   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
17821782
17831783   PORT_START("SW.2")
1784    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1785    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1786    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1787    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1788    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1789    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1790    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1791    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
1784   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1785   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1786   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1787   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1788   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1789   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1790   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1791   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
17921792
17931793   PORT_START("SW.3")
1794    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1795    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1796    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1797    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1798    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1799    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1800    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1801    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
1794   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1795   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1796   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1797   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1798   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1799   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1800   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1801   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
18021802
18031803   PORT_START("SW.4")
1804    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1805    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1806    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1807    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1808    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1809    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1810    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1811    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
1804   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1805   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1806   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1807   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1808   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1809   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1810   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1811   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
18121812
18131813   PORT_START("SW.5")
1814    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1815    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1816    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1817    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1818    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1819    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1820    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1821    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1814   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1815   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1816   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1817   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1818   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1819   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1820   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1821   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
18221822
18231823   PORT_START("SW.6")
1824    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1825    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1826    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1827    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1828    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1829    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1830    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1831    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
1824   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1825   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1826   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1827   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1828   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1829   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1830   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1831   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
18321832
18331833   PORT_START("SW.7")
1834    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1834   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
18351835
18361836   PORT_START("DOOR")
1837    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1838    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1839    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1840    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1841    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1842    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1843    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1844    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1837   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1838   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1839   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1840   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1841   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1842   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1843   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1844   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
18451845
18461846   PORT_START("DSW")
18471847   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
18521852   PORT_DIPSETTING(   0xec, "Spain")
18531853
18541854   PORT_START("FLIPPERS")
1855    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1856    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1857    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1858    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1859    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1860    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1861    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1862    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1855   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1856   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1857   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1858   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1859   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1860   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1861   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1862   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
18631863INPUT_PORTS_END
18641864
18651865static INPUT_PORTS_START( tfs )
18661866   PORT_START("SW.0")
1867    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1868    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1869    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1870    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1871    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1872    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1873    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1874    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1867   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1868   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1869   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1870   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1871   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1872   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1873   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1874   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
18751875
18761876   PORT_START("SW.1")
1877    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1878    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1879    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1880    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1881    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1882    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1883    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1884    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1877   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1878   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1879   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1880   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1881   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1882   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1883   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1884   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
18851885
18861886   PORT_START("SW.2")
1887    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1888    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1889    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1890    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1891    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1892    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1893    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1894    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
1887   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1888   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1889   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1890   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1891   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1892   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1893   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1894   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
18951895
18961896   PORT_START("SW.3")
1897    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1898    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1899    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1900    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1901    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1902    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1903    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1904    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
1897   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
1898   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
1899   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
1900   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
1901   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
1902   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
1903   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
1904   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
19051905
19061906   PORT_START("SW.4")
1907    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1908    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1909    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1910    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1911    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1912    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1913    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1914    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
1907   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1908   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1909   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1910   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1911   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1912   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
1913   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
1914   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
19151915
19161916   PORT_START("SW.5")
1917    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1918    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1919    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1920    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1921    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1922    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1923    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1924    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1917   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1918   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1919   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1920   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1921   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1922   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
1923   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
1924   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
19251925
19261926   PORT_START("SW.6")
1927    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1928    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1929    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1930    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1931    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1932    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1933    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1934    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
1927   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1928   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1929   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1930   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1931   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
1932   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
1933   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
1934   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
19351935
19361936   PORT_START("SW.7")
1937    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1937   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
19381938
19391939   PORT_START("DOOR")
1940    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1941    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1942    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1943    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1944    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1945    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1946    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1947    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1940   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1941   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1942   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1943   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1944   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1945   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1946   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1947   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
19481948
19491949   PORT_START("DSW")
19501950   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
19551955   PORT_DIPSETTING(   0xec, "Spain")
19561956
19571957   PORT_START("FLIPPERS")
1958    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1959    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1960    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1961    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1962    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1963    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1964    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1965    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1958   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1959   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1960   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1961   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1962   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1963   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1964   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1965   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
19661966INPUT_PORTS_END
19671967
19681968static MACHINE_CONFIG_START( wpc_s, wpc_s_state )
r31373r31374
24002400/*-----------------
24012401/  The Shadow
24022402/------------------*/
2403ROM_START(ts_lh6)   
2403ROM_START(ts_lh6)
24042404   ROM_REGION(0x80000, "maincpu", 0)
24052405   ROM_LOAD("shad_h6.rom", 0x00000, 0x080000, CRC(0a72268d) SHA1(97836afc23c4160bca462f14c115b17e58fe5a48))
24062406   ROM_REGION16_LE(0x1000000, "dcs", ROMREGION_ERASEFF)
trunk/src/mame/drivers/midzeus.c
r31373r31374
11041104
11051105   /* sound hardware */
11061106   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)
1107     
1107
11081108   MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0)
1109   MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_STANDARD)   
1110   MCFG_MIDWAY_SERIAL_PIC2_YEAR_OFFS(94)   
1109   MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_STANDARD)
1110   MCFG_MIDWAY_SERIAL_PIC2_YEAR_OFFS(94)
11111111MACHINE_CONFIG_END
11121112
11131113static MACHINE_CONFIG_DERIVED( mk4, midzeus )
r31373r31374
11291129static MACHINE_CONFIG_DERIVED( invasn, midzeus )
11301130   MCFG_CPU_ADD("pic", PIC16C57, 8000000)  /* ? */
11311131   MCFG_CPU_IO_MAP(pic_io_map)
1132   
1132
11331133   MCFG_DEVICE_MODIFY("ioasic")
11341134   MCFG_MIDWAY_IOASIC_UPPER(468/* or 488 */)
11351135MACHINE_CONFIG_END
r31373r31374
11571157   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)
11581158
11591159   MCFG_M48T35_ADD( "m48t35" )
1160   
1160
11611161   MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0)
11621162   MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_STANDARD)
11631163   MCFG_MIDWAY_SERIAL_PIC2_YEAR_OFFS(99)
r31373r31374
15271527 *
15281528 *************************************/
15291529
1530GAME(  1997, mk4,      0,        mk4,       mk4,      midzeus_state, mk4,      ROT0, "Midway", "Mortal Kombat 4 (version 3.0)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
1531GAME(  1997, mk4a,     mk4,      mk4,        mk4,      midzeus_state, mk4,      ROT0, "Midway", "Mortal Kombat 4 (version 2.1)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
1532GAME(  1997, mk4b,     mk4,      mk4,        mk4,      midzeus_state, mk4,      ROT0, "Midway", "Mortal Kombat 4 (version 1.0)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
1530GAME(  1997, mk4,      0,        mk4,      mk4,      midzeus_state, mk4,      ROT0, "Midway", "Mortal Kombat 4 (version 3.0)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
1531GAME(  1997, mk4a,     mk4,      mk4,      mk4,      midzeus_state, mk4,      ROT0, "Midway", "Mortal Kombat 4 (version 2.1)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
1532GAME(  1997, mk4b,     mk4,      mk4,      mk4,      midzeus_state, mk4,      ROT0, "Midway", "Mortal Kombat 4 (version 1.0)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
15331533GAME(  1999, invasnab, 0,        invasn,   invasn,   midzeus_state, invasn,   ROT0, "Midway", "Invasion - The Abductors (version 5.0)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
15341534GAME(  1999, invasnab4,invasnab, invasn,   invasn,   midzeus_state, invasn,   ROT0, "Midway", "Invasion - The Abductors (version 4.0)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
15351535GAME(  1999, invasnab3,invasnab, invasn,   invasn,   midzeus_state, invasn,   ROT0, "Midway", "Invasion - The Abductors (version 3.0)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/norautp.c
r31373r31374
12281228
12291229   //MCFG_DEVICE_ADD("ppi8255_2", I8255, 0)
12301230   /* (c0-c3) Group A Mode 2 (5-lines handshacked bidirectional port)
1231     Group B Mode 0, output;  (see below for lines PC0-PC2) */
1232   //MCFG_I8255_IN_PORTA_CB(READ8(norautp_state, vram_data_r))   // VRAM data read
1233   //MCFG_I8255_OUT_PORTA_CB(WRITE8(norautp_state, vram_data_w))   // VRAM data write
1234   //MCFG_I8255_OUT_PORTB_CB(WRITE8(norautp_state, vram_addr_w))   // VRAM address write
1231    Group B Mode 0, output;  (see below for lines PC0-PC2) */
1232   //MCFG_I8255_IN_PORTA_CB(READ8(norautp_state, vram_data_r)) // VRAM data read
1233   //MCFG_I8255_OUT_PORTA_CB(WRITE8(norautp_state, vram_data_w))   // VRAM data write
1234   //MCFG_I8255_OUT_PORTB_CB(WRITE8(norautp_state, vram_addr_w))   // VRAM address write
12351235   //MCFG_I8255_IN_PORTC_CB(READ8(norautp_state, ppi2_portc_r))
12361236   //MCFG_I8255_OUT_PORTC_CB(WRITE8(norautp_state, ppi2_portc_w))
12371237   /*  PPI-2 is configured as mixed mode2 and mode0 output.
1238     It means that port A should be bidirectional and port B just as output.
1239     Port C as hshk regs, and P0-P2 as input (norautp, norautjp) or output (other sets). */
1238    It means that port A should be bidirectional and port B just as output.
1239    Port C as hshk regs, and P0-P2 as input (norautp, norautjp) or output (other sets). */
12401240
12411241   /* video hardware */
12421242   MCFG_SCREEN_ADD("screen", RASTER)
r31373r31374
34383438
34393439/*
34403440ROM_START( pkii_dm )
3441   ROM_REGION( 0x10000, "maincpu", 0 ) // no stack, call's RET go to PC=0
3442   ROM_LOAD( "12.u12", 0x0000, 0x1000, CRC(048e70d8) SHA1(f0eb16ba68455638de2ce68f51f305a13d0df287) )
3443   ROM_LOAD( "13.u18", 0x1000, 0x1000, CRC(06cf6789) SHA1(587d883c399348b518e3be4d1dc2581824055328) )
3441    ROM_REGION( 0x10000, "maincpu", 0 ) // no stack, call's RET go to PC=0
3442    ROM_LOAD( "12.u12", 0x0000, 0x1000, CRC(048e70d8) SHA1(f0eb16ba68455638de2ce68f51f305a13d0df287) )
3443    ROM_LOAD( "13.u18", 0x1000, 0x1000, CRC(06cf6789) SHA1(587d883c399348b518e3be4d1dc2581824055328) )
34443444
3445   ROM_REGION( 0x1000,  "gfx", 0 )
3446   ROM_FILL(                 0x0000, 0x0800, 0xff )
3447   ROM_LOAD( "cgw-f506.u31", 0x0800, 0x0800, CRC(412fc492) SHA1(094ea0ffd0c22274cfe164f07c009ffe022331fd) )
3445    ROM_REGION( 0x1000,  "gfx", 0 )
3446    ROM_FILL(                 0x0000, 0x0800, 0xff )
3447    ROM_LOAD( "cgw-f506.u31", 0x0800, 0x0800, CRC(412fc492) SHA1(094ea0ffd0c22274cfe164f07c009ffe022331fd) )
34483448
3449   ROM_REGION( 0x0200,  "proms", 0 )
3450   ROM_LOAD( "63s141n.u51",  0x0000, 0x0100, CRC(88302127) SHA1(aed1273974917673405f1234ab64e6f8b3856c34) )
3449    ROM_REGION( 0x0200,  "proms", 0 )
3450    ROM_LOAD( "63s141n.u51",  0x0000, 0x0100, CRC(88302127) SHA1(aed1273974917673405f1234ab64e6f8b3856c34) )
34513451ROM_END
34523452*/
34533453
trunk/src/mame/drivers/88games.c
r31373r31374
380380   ROM_LOAD32_BYTE( "861a09.b", 0x040002, 0x10000, CRC(4917158d) SHA1(b53da3f29c9aeb59933dc3a8214cc1314e21000b) )
381381   ROM_LOAD32_BYTE( "861a09.d", 0x040003, 0x10000, CRC(2bb3282c) SHA1(6ca54948a02c91543b7e595641b0edc2564f83ff) )
382382
383   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
383   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
384384   ROM_LOAD32_BYTE( "861a05.a", 0x000000, 0x10000, CRC(cedc19d0) SHA1(6eb2a292d574dee06e214e61c0e08fa233ac68e8) )
385385   ROM_LOAD32_BYTE( "861a05.e", 0x000001, 0x10000, CRC(725af3fc) SHA1(98ac364db4b2c5682a299f4d2a288ebc8a303b1f) )
386386   ROM_LOAD32_BYTE( "861a06.a", 0x000002, 0x10000, CRC(85e2e30e) SHA1(11010727db8c71650c5b9df5340f9bc412435d11) )
r31373r31374
398398   ROM_LOAD32_BYTE( "861a06.d", 0x0c0002, 0x10000, CRC(bc70ab39) SHA1(a6fa0502ceb6862e7b1e4815326e268fd6511881) )
399399   ROM_LOAD32_BYTE( "861a06.h", 0x0c0003, 0x10000, CRC(d906b79b) SHA1(905814ce708d80fd4d1a398f60faa0bc680fccaf) )
400400
401   ROM_REGION( 0x040000, "k051316", 0 )   /* zoom/rotate */
401   ROM_REGION( 0x040000, "k051316", 0 )    /* zoom/rotate */
402402   ROM_LOAD( "861a04.a", 0x000000, 0x10000, CRC(092a8b15) SHA1(d98a81bfa4bba73805f0236f8a80da130fcb378d) )
403403   ROM_LOAD( "861a04.b", 0x010000, 0x10000, CRC(75744b56) SHA1(5133d8f6622796ed6b9e6a0d0f1df28f00331fc7) )
404404   ROM_LOAD( "861a04.c", 0x020000, 0x10000, CRC(a00021c5) SHA1(f73f88af33387d73b4262e8652507e699926fabe) )
r31373r31374
434434   ROM_LOAD32_BYTE( "861a09.b", 0x040002, 0x10000, CRC(4917158d) SHA1(b53da3f29c9aeb59933dc3a8214cc1314e21000b) )
435435   ROM_LOAD32_BYTE( "861a09.d", 0x040003, 0x10000, CRC(2bb3282c) SHA1(6ca54948a02c91543b7e595641b0edc2564f83ff) )
436436
437   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
437   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
438438   ROM_LOAD32_BYTE( "861a05.a", 0x000000, 0x10000, CRC(cedc19d0) SHA1(6eb2a292d574dee06e214e61c0e08fa233ac68e8) )
439439   ROM_LOAD32_BYTE( "861a05.e", 0x000001, 0x10000, CRC(725af3fc) SHA1(98ac364db4b2c5682a299f4d2a288ebc8a303b1f) )
440440   ROM_LOAD32_BYTE( "861a06.a", 0x000002, 0x10000, CRC(85e2e30e) SHA1(11010727db8c71650c5b9df5340f9bc412435d11) )
r31373r31374
452452   ROM_LOAD32_BYTE( "861a06.d", 0x0c0002, 0x10000, CRC(bc70ab39) SHA1(a6fa0502ceb6862e7b1e4815326e268fd6511881) )
453453   ROM_LOAD32_BYTE( "861a06.h", 0x0c0003, 0x10000, CRC(d906b79b) SHA1(905814ce708d80fd4d1a398f60faa0bc680fccaf) )
454454
455   ROM_REGION( 0x040000, "k051316", 0 )   /* zoom/rotate */
455   ROM_REGION( 0x040000, "k051316", 0 )    /* zoom/rotate */
456456   ROM_LOAD( "861a04.a", 0x000000, 0x10000, CRC(092a8b15) SHA1(d98a81bfa4bba73805f0236f8a80da130fcb378d) )
457457   ROM_LOAD( "861a04.b", 0x010000, 0x10000, CRC(75744b56) SHA1(5133d8f6622796ed6b9e6a0d0f1df28f00331fc7) )
458458   ROM_LOAD( "861a04.c", 0x020000, 0x10000, CRC(a00021c5) SHA1(f73f88af33387d73b4262e8652507e699926fabe) )
r31373r31374
488488   ROM_LOAD32_BYTE( "861a09.b", 0x040002, 0x10000, CRC(4917158d) SHA1(b53da3f29c9aeb59933dc3a8214cc1314e21000b) )
489489   ROM_LOAD32_BYTE( "861a09.d", 0x040003, 0x10000, CRC(2bb3282c) SHA1(6ca54948a02c91543b7e595641b0edc2564f83ff) )
490490
491   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
491   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
492492   ROM_LOAD32_BYTE( "861a05.a", 0x000000, 0x10000, CRC(cedc19d0) SHA1(6eb2a292d574dee06e214e61c0e08fa233ac68e8) )
493493   ROM_LOAD32_BYTE( "861a05.e", 0x000001, 0x10000, CRC(725af3fc) SHA1(98ac364db4b2c5682a299f4d2a288ebc8a303b1f) )
494494   ROM_LOAD32_BYTE( "861a06.a", 0x000002, 0x10000, CRC(85e2e30e) SHA1(11010727db8c71650c5b9df5340f9bc412435d11) )
r31373r31374
506506   ROM_LOAD32_BYTE( "861a06.d", 0x0c0002, 0x10000, CRC(bc70ab39) SHA1(a6fa0502ceb6862e7b1e4815326e268fd6511881) )
507507   ROM_LOAD32_BYTE( "861a06.h", 0x0c0003, 0x10000, CRC(d906b79b) SHA1(905814ce708d80fd4d1a398f60faa0bc680fccaf) )
508508
509   ROM_REGION( 0x040000, "k051316", 0 )   /* zoom/rotate */
509   ROM_REGION( 0x040000, "k051316", 0 )    /* zoom/rotate */
510510   ROM_LOAD( "861a04.a", 0x000000, 0x10000, CRC(092a8b15) SHA1(d98a81bfa4bba73805f0236f8a80da130fcb378d) )
511511   ROM_LOAD( "861a04.b", 0x010000, 0x10000, CRC(75744b56) SHA1(5133d8f6622796ed6b9e6a0d0f1df28f00331fc7) )
512512   ROM_LOAD( "861a04.c", 0x020000, 0x10000, CRC(a00021c5) SHA1(f73f88af33387d73b4262e8652507e699926fabe) )
trunk/src/mame/drivers/neogeo.c
r31373r31374
805805   if (ACCESSING_BITS_0_7)
806806   {
807807      if (m_memcard->present() != -1)
808          m_memcard->write(space, offset, data);
808            m_memcard->write(space, offset, data);
809809   }
810810}
811811
r31373r31374
851851void neogeo_state::neogeo_main_cpu_banking_init()
852852{
853853   /* create vector banks */
854//   m_bank_vectors->configure_entry(1, m_region_maincpu->base());
855//   m_bank_vectors->configure_entry(0, memregion("mainbios")->base());
856//   m_bank_vectors->set_entry(0);
854//  m_bank_vectors->configure_entry(1, m_region_maincpu->base());
855//  m_bank_vectors->configure_entry(0, memregion("mainbios")->base());
856//  m_bank_vectors->set_entry(0);
857857   m_use_cart_vectors = 0;
858858
859859   if (m_type != NEOGEO_CD)
r31373r31374
894894      m_bank_audio_main->configure_entry(0, memregion("audiobios")->base());
895895   else /* on hardware with no SM1 ROM, the cart ROM is always enabled */
896896      m_bank_audio_main->configure_entry(0, memregion("audiocpu")->base());
897   
897
898898   m_bank_audio_main->set_entry(m_use_cart_audio);
899899
900900   /* audio banking */
r31373r31374
904904   m_bank_audio_cart[3] = membank("audio_8000");
905905
906906   address_mask = (memregion("audiocpu")->bytes() - 0x10000 - 1) & 0x3ffff;
907   
908907
908
909909   for (region = 0; region < 4; region++)
910910   {
911911      for (bank = 0xff; bank >= 0; bank--)
r31373r31374
11171117   m_cartslots[3] = m_cartslot4;
11181118   m_cartslots[4] = m_cartslot5;
11191119   m_cartslots[5] = m_cartslot6;
1120   
11211120
1121
11221122   m_sprgen->set_screen(m_screen);
11231123   m_sprgen->set_sprite_region(m_region_sprites->base(), m_region_sprites->bytes());
11241124   m_sprgen->set_fixed_regions(m_region_fixed->base(), m_region_fixed->bytes(), m_region_fixedbios);
1125   
1125
11261126}
11271127
11281128
r31373r31374
11381138   if (slot != m_currentslot)
11391139   {
11401140      m_currentslot = slot;
1141     
1141
11421142      address_space &space = m_maincpu->space(AS_PROGRAM);
11431143
11441144      // unmap old handlers, some carts will have installed overlays on them, we need them to be cleared
r31373r31374
11631163      ym->reset();
11641164
11651165      m_cartslots[m_currentslot]->setup_memory_banks(machine()); // setup basic pointers
1166     
1166
11671167      ym->reset(); // reset it again to get the new pointers
11681168
11691169      // these could have changed, ensure the pointers are valid
r31373r31374
11751175
11761176      m_cartslots[m_currentslot]->activate_cart(machine(), m_maincpu, m_region_maincpu->base(), m_region_maincpu->bytes(), m_cartslots[m_currentslot]->get_fixed_base(), m_cartslots[m_currentslot]->get_fixed_size());
11771177      //memcpy((UINT8*)m_cartslots[m_currentslot]->get_rom_base(),m_region_maincpu->base(), m_region_maincpu->bytes()); // hack- copy back any mods activate made (eh cthd2003)c
1178     
1178
11791179      neogeo_audio_cpu_banking_init(0); // should probably be responsibility of the cart
11801180      m_audiocpu->reset(); // or some games like svc have no sounnd if in higher slots?
11811181
r31373r31374
12831283   AM_RANGE(0x000000, 0x00007f) AM_READ(neogeo_slot_rom_low_bectors_r)
12841284   AM_RANGE(0x000080, 0x0fffff) AM_READ(neogeo_slot_rom_low_r)
12851285   AM_RANGE(0x200000, 0x2fffff) AM_ROMBANK("cartridge")
1286//   AM_RANGE(0x2ffff0, 0x2fffff) AM_WRITE(main_cpu_bank_select_w)
1286//  AM_RANGE(0x2ffff0, 0x2fffff) AM_WRITE(main_cpu_bank_select_w)
12871287   AM_IMPORT_FROM( neogeo_main_map )
12881288ADDRESS_MAP_END
12891289
r31373r31374
14011401
14021402static INPUT_PORTS_START( neogeo_6slot )
14031403   PORT_INCLUDE( neogeo )
1404   
1404
14051405   PORT_MODIFY("TEST")
14061406   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SPECIAL )
14071407INPUT_PORTS_END
r31373r31374
14441444   MCFG_PALETTE_ADD_INIT_BLACK("palette", 4096*2*2)
14451445
14461446   MCFG_DEVICE_ADD("spritegen", NEOGEO_SPRITE_OPTIMZIED, 0)
1447   
1447
14481448   /* audio hardware */
14491449   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
14501450
r31373r31374
15161516
15171517/*    YEAR  NAME        PARENT    COMPAT    MACHINE   INPUT     INIT    */
15181518CONS( 1990, neogeo,     0,        0,        mvs,      neogeo_6slot,   neogeo_state, mvs,  "SNK", "Neo-Geo", GAME_IS_BIOS_ROOT | GAME_SUPPORTS_SAVE )
1519
trunk/src/mame/drivers/gcpinbal.c
r31373r31374
3232
3333  - Reset the game while pressing START1 to enter the "test mode"
3434
35 
35
3636***************************************************************************/
3737
3838#include "emu.h"
trunk/src/mame/drivers/supercrd.c
r31373r31374
435435   MCFG_VIDEO_START_OVERRIDE(supercrd_state, supercrd)
436436
437437//  MCFG_MC6845_ADD("crtc", MC6845, "screen", MASTER_CLOCK/8)
438//   MCFG_MC6845_SHOW_BORDER_AREA(false)
439//   MCFG_MC6845_CHAR_WIDTH(4)
438//  MCFG_MC6845_SHOW_BORDER_AREA(false)
439//  MCFG_MC6845_CHAR_WIDTH(4)
440440
441441   /* sound hardware */
442442   MCFG_SPEAKER_STANDARD_MONO("mono")
trunk/src/mame/drivers/dreamwld.c
r31373r31374
560560   PORT_DIPNAME( 0x7000, 0x7000, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW1:5,6,7")
561561   PORT_DIPSETTING(      0x2000, "Level 1" )
562562   PORT_DIPSETTING(      0x1000, "Level 2" )
563    PORT_DIPSETTING(      0x0000, "Level 3" )
563   PORT_DIPSETTING(      0x0000, "Level 3" )
564564   PORT_DIPSETTING(      0x7000, "Level 4" )
565565   PORT_DIPSETTING(      0x6000, "Level 5" )
566566   PORT_DIPSETTING(      0x5000, "Level 6" )
trunk/src/mame/drivers/taito_b.c
r31373r31374
21452145
21462146   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_16MHz/2)  /* 8 MHz */
21472147   MCFG_YM2610_IRQ_HANDLER(WRITELINE(taitob_state, irqhandler))
2148   
2148
21492149   MCFG_SOUND_ROUTE(0, "mono", 0.25)
21502150   MCFG_SOUND_ROUTE(1, "mono", 1.0)
21512151   MCFG_SOUND_ROUTE(2, "mono", 1.0)
r31373r31374
22642264
22652265   MCFG_SOUND_ADD("ymsnd", YM2610, XTAL_16MHz/2)   /* verified on pcb */
22662266   MCFG_YM2610_IRQ_HANDLER(WRITELINE(taitob_state, irqhandler))
2267   
2267
22682268   MCFG_SOUND_ROUTE(0, "mono", 0.25)
22692269   MCFG_SOUND_ROUTE(1, "mono", 1.0)
22702270   MCFG_SOUND_ROUTE(2, "mono", 1.0)
trunk/src/mame/drivers/turbo.c
r31373r31374
850850   MCFG_I8255_OUT_PORTC_CB(WRITE8(turbo_state, turbo_ppi3c_w))
851851
852852   MCFG_DEVICE_ADD("i8279", I8279, MASTER_CLOCK/4)    // unknown clock
853   MCFG_I8279_OUT_SL_CB(WRITE8(turbo_state, scanlines_w))     // scan SL lines
853   MCFG_I8279_OUT_SL_CB(WRITE8(turbo_state, scanlines_w))    // scan SL lines
854854   MCFG_I8279_OUT_DISP_CB(WRITE8(turbo_state, digit_w))      // display A&B
855855   MCFG_I8279_IN_RL_CB(IOPORT("DSW1"))                       // kbd RL lines
856   
856
857857   /* video hardware */
858858   MCFG_GFXDECODE_ADD("gfxdecode", "palette", turbo)
859859   MCFG_PALETTE_ADD("palette", 256)
r31373r31374
890890   MCFG_I8255_OUT_PORTC_CB(WRITE8(turbo_state, subroc3d_sound_c_w))
891891
892892   MCFG_DEVICE_ADD("i8279", I8279, MASTER_CLOCK/4)    // unknown clock
893   MCFG_I8279_OUT_SL_CB(WRITE8(turbo_state, scanlines_w))     // scan SL lines
893   MCFG_I8279_OUT_SL_CB(WRITE8(turbo_state, scanlines_w))    // scan SL lines
894894   MCFG_I8279_OUT_DISP_CB(WRITE8(turbo_state, digit_w))      // display A&B
895895   MCFG_I8279_IN_RL_CB(IOPORT("DSW1"))                       // kbd RL lines
896896
r31373r31374
937937   MCFG_I8255_OUT_PORTC_CB(WRITE8(turbo_state, buckrog_ppi1c_w))
938938
939939   MCFG_DEVICE_ADD("i8279", I8279, MASTER_CLOCK/4)    // unknown clock
940   MCFG_I8279_OUT_SL_CB(WRITE8(turbo_state, scanlines_w))     // scan SL lines
940   MCFG_I8279_OUT_SL_CB(WRITE8(turbo_state, scanlines_w))    // scan SL lines
941941   MCFG_I8279_OUT_DISP_CB(WRITE8(turbo_state, digit_w))      // display A&B
942942   MCFG_I8279_IN_RL_CB(IOPORT("DSW1"))                       // kbd RL lines
943943
trunk/src/mame/drivers/rohga.c
r31373r31374
773773      case 0x6000: return 0xf0 | 0xcc;
774774      case 0x2000: return 0;//0xf0|0xcc; /* Perhaps 0xf0|0xcc|0xaa (Sprite under bottom layer) */
775775   }
776   
776
777777   return 0;
778778}
779779
r31373r31374
787787   UINT16 colour = ((col >> 9) & 0xf) << 2;
788788   if (col & 0x8000)
789789      colour++;
790   
790
791791   return colour;
792792}
793793
r31373r31374
11241124
11251125   MCFG_DEVICE_ADD("spritegen1", DECO_SPRITE, 0)
11261126   MCFG_DECO_SPRITE_PRIORITY_CB(rohga_state, rohga_pri_callback)
1127   MCFG_DECO_SPRITE_COLOUR_CB(rohga_state, schmeisr_col_callback)   // wire mods on pcb...
1127   MCFG_DECO_SPRITE_COLOUR_CB(rohga_state, schmeisr_col_callback)  // wire mods on pcb...
11281128   MCFG_DECO_SPRITE_GFX_REGION(3)
11291129   MCFG_DECO_SPRITE_GFXDECODE("gfxdecode")
11301130   MCFG_DECO_SPRITE_PALETTE("palette")
trunk/src/mame/drivers/bfm_sc45_helper.c
r31373r31374
141141   if ((rom[0] != 0x48e7) || (rom[1] != 0x3020) || (rom[2] != 0x322f) || (rom[3] != 0x0010) || (rom[4] != 0x227c))
142142      return false;
143143
144    if ((rom[7] != 0x4242) || (rom[8] != 0x2449) || (rom[9] != 0x3639))
144   if ((rom[7] != 0x4242) || (rom[8] != 0x2449) || (rom[9] != 0x3639))
145145      return false;
146146
147147   return true;
r31373r31374
175175
176176      if (found==true)
177177      {
178
179178         startblock = (rom[i + 5] << 16) | rom[i + 6];
180179         endblock = (rom[i + 10] << 16) | rom[i + 11];
181180         sc45helperlog("------------ INPUTS -----------------\n");
r31373r31374
189188               UINT16 portpos = rom[j + 0];
190189               int port = (portpos & 0x1f);
191190               int pos = (portpos >> 5);
192               
191
193192               UINT16 unk2 = rom[j + 1];
194193               UINT32 stringaddr = (rom[j + 2] << 16) | rom[j + 3];
195194
r31373r31374
208207                  {
209208                     tempstring.cat(chr);
210209                  }
211                     
210
212211               }
213212
214213               tempstring.trimspace();
r31373r31374
232231               }
233232               //else
234233               //{
235               //   printf("invalid port position?\n");
234               //  printf("invalid port position?\n");
236235               //}
237               
238236
239               
237
238
240239               sc45helperlog("%s", tempstring.cstr());
241240
242241               sc45helperlog("\n");
r31373r31374
298297   int buttons_used = 1;
299298
300299   printf("INPUT_PORTS_START( %s ) // this structure is generated\n", machine.system().name);
301   printf("   PORT_INCLUDE( sc4_base )\n");
300   printf("    PORT_INCLUDE( sc4_base )\n");
302301
303302   for (int i = 0; i < 32; i++)
304303   {
r31373r31374
310309         {
311310            if (thisportused == 0)
312311            {
313               printf("   PORT_MODIFY(\"IN-%d\")\n", i);
312               printf("    PORT_MODIFY(\"IN-%d\")\n", i);
314313               thisportused = 1;
315314            }
316315
317316            if (ignoreports[i][j] > 0)
318317            {
319               printf("   PORT_BIT( 0x%04x, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_%d_%d ) PORT_NAME(\"%s\")\n", 1 << j, i,j/*ignoreports[i][j]*/, sc4inputs[i][j].name.cstr());
318               printf("    PORT_BIT( 0x%04x, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_%d_%d ) PORT_NAME(\"%s\")\n", 1 << j, i,j/*ignoreports[i][j]*/, sc4inputs[i][j].name.cstr());
320319               buttons_used++;
321320            }
322321            else if (ignoreports[i][j] == -3)
323322            {
324               printf("   // 0x%04x - \"%s\" // standard input (motherboard)\n", 1 << j, sc4inputs[i][j].name.cstr());
323               printf("    // 0x%04x - \"%s\" // standard input (motherboard)\n", 1 << j, sc4inputs[i][j].name.cstr());
325324            }
326325            else if (ignoreports[i][j] == -2)
327326            {
328               printf("   // 0x%04x - \"%s\" // standard input (expected here)\n", 1 << j, sc4inputs[i][j].name.cstr());
327               printf("    // 0x%04x - \"%s\" // standard input (expected here)\n", 1 << j, sc4inputs[i][j].name.cstr());
329328            }
330329            else if (ignoreports[i][j] == -1)
331330            {
332               printf("   // 0x%04x - \"%s\" // unexpected here\n", 1 << j, sc4inputs[i][j].name.cstr());
331               printf("    // 0x%04x - \"%s\" // unexpected here\n", 1 << j, sc4inputs[i][j].name.cstr());
333332            }
334333            else if (ignoreports[i][j] == -4)
335334            {
336               printf("   // 0x%04x - \"%s\" // known extended input, mapping not understood\n", 1 << j, sc4inputs[i][j].name.cstr());
335               printf("    // 0x%04x - \"%s\" // known extended input, mapping not understood\n", 1 << j, sc4inputs[i][j].name.cstr());
337336            }
338337            else if (ignoreports[i][j] == -5)
339338            {
340               printf("   // 0x%04x - \"%s\" // known extended input, usually 'top up'\n", 1 << j, sc4inputs[i][j].name.cstr());
339               printf("    // 0x%04x - \"%s\" // known extended input, usually 'top up'\n", 1 << j, sc4inputs[i][j].name.cstr());
341340            }
342341            else if (ignoreports[i][j] == -6)
343342            {
344               printf("   // 0x%04x - \"%s\" // known extended input, usually 'hopper low'\n", 1 << j, sc4inputs[i][j].name.cstr());
343               printf("    // 0x%04x - \"%s\" // known extended input, usually 'hopper low'\n", 1 << j, sc4inputs[i][j].name.cstr());
345344            }
346345            else if (ignoreports[i][j] == -7)
347346            {
348               printf("   // 0x%04x - \"%s\" // known extended input, usually 'hopper fit'\n", 1 << j, sc4inputs[i][j].name.cstr());
347               printf("    // 0x%04x - \"%s\" // known extended input, usually 'hopper fit'\n", 1 << j, sc4inputs[i][j].name.cstr());
349348            }
350349            else if (ignoreports[i][j] == -8)
351350            {
352               printf("   // 0x%04x - \"%s\" // known extended(?) input, sometimes 'top up'\n", 1 << j, sc4inputs[i][j].name.cstr());
351               printf("    // 0x%04x - \"%s\" // known extended(?) input, sometimes 'top up'\n", 1 << j, sc4inputs[i][j].name.cstr());
353352            }
354353            else if (ignoreports[i][j] == -9)
355354            {
356               printf("   // 0x%04x - \"%s\" // known extended(?) input, sometimes 'hop hi'\n", 1 << j, sc4inputs[i][j].name.cstr());
355               printf("    // 0x%04x - \"%s\" // known extended(?) input, sometimes 'hop hi'\n", 1 << j, sc4inputs[i][j].name.cstr());
357356            }
358357            else if (ignoreports[i][j] == -10)
359358            {
360               printf("   // 0x%04x - \"%s\" // known extended(?) input, sometimes 'hop top'\n", 1 << j, sc4inputs[i][j].name.cstr());
359               printf("    // 0x%04x - \"%s\" // known extended(?) input, sometimes 'hop top'\n", 1 << j, sc4inputs[i][j].name.cstr());
361360            }
362361            buttons_used++;
363362         }
r31373r31374
404403
405404int find_lamp_strings(running_machine &machine)
406405{
407
408406   int startblock = -1;
409407   int endblock = -1;
410408
r31373r31374
428426
429427   if (startblock == -1)
430428      return 0;
431   
432429
433430
431
434432   for (int y = 0; y < 16; y++)
435433   {
436434      for (int x = 0; x < 16; x++)
r31373r31374
463461   UINT16 *rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base();
464462   UINT8 *rom8 = machine.root_device().memregion( "maincpu" )->base();
465463
466//   sc45helperlog("------------ LAMPS -----------------\n");
464//  sc45helperlog("------------ LAMPS -----------------\n");
467465
468466   if (endblock > startblock)
469467   {
r31373r31374
476474         UINT32 stringaddr = (rom[j + 1] << 16) | rom[j + 2];
477475
478476         //sc45helperlog("(row %02d, col %02d, unused %02x) addr %08x  ", row,col, (portpos&0xff00)>>8, stringaddr);
479           
477
480478         astring tempstring;
481479
482480         for (int k = stringaddr; k < stringaddr + 10; k++)
r31373r31374
491489            {
492490               tempstring.cat(chr);
493491            }
494                     
492
495493         }
496494
497495         if (lamps[row][col].used == false)
r31373r31374
538536      for (int x = 0; x < 6; x++)
539537      {
540538         sc45helperlog("<element name=\"inputlabel%d-%d\"><text string=\"%s\"><color red=\"1.0\" green=\"1.0\" blue=\"1.0\" /></text></element>\n", realy,x,sc4inputs[realy][x].name.cstr());
541   
539
542540      }
543541   }
544542   sc45helperlog("\n");
r31373r31374
606604
607605   // try to find some specific named elements and move them around
608606   d = 0;
609   
607
610608   for (int reel = 0; reel < 8; reel++)
611609   {
612610      char tempname[32];
613611      sprintf(tempname, "reel%d ", reel+1);
614   
615   
612
613
616614      for (int pos = 0; pos < 3; pos++)
617615      {
618616         char tempname2[32];
r31373r31374
626624         {
627625            for (int x = 0; x < 16; x++)
628626            {
629
630627               if (!strcmp(tempname2, lamps[y][x].lampname_alt.cstr()))
631628               {
632629                  //sc45helperlog("%s found\n", tempname2);
r31373r31374
637634                  lamps[y][x].width = 50;
638635                  lamps[y][x].height = 17;
639636                  lamps[y][x].lamptypename = "reellamp";
640                 
641637
638
642639               }
643640               else
644641               {
r31373r31374
669666      set_clickable_temp(machine, "cash bust", 8, 0x04);
670667
671668      // no 'refill' lamp?
672     
673669
670
674671   }
675672
676673
r31373r31374
692689      }
693690   }
694691
695   // print out a simple matrix of some of the most common inputs,
692   // print out a simple matrix of some of the most common inputs,
696693   d = 0;
697694   for (int y = 0; y < 7; y++)
698695   {
r31373r31374
777774
778775   return 0;
779776}
780     
781777
778
782779int find_reel_strings(running_machine &machine)
783780{
784781   int startblock = -1;
r31373r31374
787784   dynamic_array<int> reelsizes;
788785
789786   // these are for sc4dnd ONLY, need to work out how the code calculates them
790   
787
791788   // this list is 4 * 16 symbols for the regular reels, 12 symbols for the number spin, and 2 groups of 16 depending on jackpot/stake keys used for the prize reel
792789   // code that points at these is likely to be complex because it's conditional on the game code / mode..
793790   if (!strcmp(machine.system().name, "sc4dnd"))
r31373r31374
841838
842839   if (startblock == -1)
843840      return 0;
844   
845841
846842
847843
848844
845
849846   UINT16 *rom = (UINT16*)machine.root_device().memregion( "maincpu" )->base();
850847   UINT8 *rom8 = machine.root_device().memregion( "maincpu" )->base();
851848
r31373r31374
868865         if (current_symbols == 0)
869866         {
870867            int shifted = ((0x10000 / 16) * 11 ) + 692;
871         //   sc45helperlog("REEL %d\n", which_reel+1);
868         //  sc45helperlog("REEL %d\n", which_reel+1);
872869            sc45helperlog("<element name=\"SteppersReel%d\" defstate=\"0\">\n", which_reel+1);
873870            sc45helperlog("<reel stateoffset=\"%d\" symbollist=\"", shifted);
874871         }
875         
872
876873         UINT32 stringaddr = (rom[j + 0] << 16) | rom[j + 1];
877874         stringaddr &= 0xfffff;
878875
r31373r31374
880877            continue;
881878
882879         //sc45helperlog("addr %08x  ", stringaddr);
883         
880
884881         astring tempstring;
885882
886883         for (int k = stringaddr; k < stringaddr + 10; k++)
r31373r31374
895892            {
896893               tempstring.cat(chr);
897894            }
898                     
895
899896         }
900897
901898         tempstring.trimspace();
r31373r31374
908905         }
909906
910907         sc45helperlog("%s", tempstring.cstr());
911     
912908
913909
910
914911         //sc45helperlog("\n");
915912
916913         current_symbols++;
trunk/src/mame/drivers/rpunch.c
r31373r31374
122122 *  Machine initialization
123123 *
124124 *************************************/
125
125
126126void rpunch_state::machine_start()
127127{
128128   save_item(NAME(m_sound_data));
r31373r31374
749749   ROM_LOAD( "sps_07.bin", 0x20000, 0x10000, CRC(904b7709) SHA1(9b66a565cd599928b666baad9f97c50f35ffcc37) )
750750   ROM_LOAD( "sps_08.bin", 0x30000, 0x10000, CRC(5430ffac) SHA1(163311d96f2f7e1ecb0901d0be73ac357b01bf6a) )
751751   ROM_LOAD( "sps_09.bin", 0x40000, 0x10000, CRC(414a6278) SHA1(baa9dc9ab0dd3c5f27c128de23053edcddf45ad0) )
752//   ROM_LOAD( "a09.bin",    0x50000, 0x08000, CRC(dd92dfe1) SHA1(08c956e11d567a215ec3cdaf6ef75fa9a886513a) ) // not on this set?
752//  ROM_LOAD( "a09.bin",    0x50000, 0x08000, CRC(dd92dfe1) SHA1(08c956e11d567a215ec3cdaf6ef75fa9a886513a) ) // not on this set?
753753
754754   ROM_REGION( 0x80000, "sprites", ROMREGION_ERASEFF )
755755   ROM_LOAD16_BYTE( "sps_20.bin", 0x00000, 0x10000, CRC(c9e7206d) SHA1(af5b2f49387a3b46c6693f4782aa0e587f17ab25) )
trunk/src/mame/drivers/funworld.c
r31373r31374
27182718   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
27192719
27202720   PORT_START("DSW")
2721   PORT_DIPNAME( 0x01, 0x01, "Test Mode" )            PORT_DIPLOCATION("SW1:8")
2721   PORT_DIPNAME( 0x01, 0x01, "Test Mode" )             PORT_DIPLOCATION("SW1:8")
27222722   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
27232723   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2724   PORT_DIPNAME( 0x02, 0x02, "Royal Flush" )         PORT_DIPLOCATION("SW1:7")
2724   PORT_DIPNAME( 0x02, 0x02, "Royal Flush" )           PORT_DIPLOCATION("SW1:7")
27252725   PORT_DIPSETTING(    0x02, DEF_STR( Yes ) )
27262726   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
2727   PORT_DIPNAME( 0x04, 0x04, "5 of a Kind" )         PORT_DIPLOCATION("SW1:6")
2727   PORT_DIPNAME( 0x04, 0x04, "5 of a Kind" )           PORT_DIPLOCATION("SW1:6")
27282728   PORT_DIPSETTING(    0x04, DEF_STR( Yes ) )
27292729   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
2730   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:5,4")
2730   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Coinage ) )      PORT_DIPLOCATION("SW1:5,4")
27312731   PORT_DIPSETTING(    0x08, "1C-10C" )
27322732   PORT_DIPSETTING(    0x10, "1C-1C" )
27332733   PORT_DIPSETTING(    0x18, "1C-2C" )
27342734   PORT_DIPSETTING(    0x00, "1C-5C" )
2735   PORT_DIPNAME( 0x60, 0x60, "Payment Type" )         PORT_DIPLOCATION("SW1:3,2")
2735   PORT_DIPNAME( 0x60, 0x60, "Payment Type" )          PORT_DIPLOCATION("SW1:3,2")
27362736   PORT_DIPSETTING(    0x00, "Ticket + Hopper" )
27372737   PORT_DIPSETTING(    0x20, "Ticket" )
27382738   PORT_DIPSETTING(    0x40, "Hopper" )
27392739   PORT_DIPSETTING(    0x60, "Ticket + Hopper" )
2740   PORT_DIPNAME( 0x80, 0x80, "Pagamenti (Payment)" )   PORT_DIPLOCATION("SW1:1")
2740   PORT_DIPNAME( 0x80, 0x80, "Pagamenti (Payment)" )   PORT_DIPLOCATION("SW1:1")
27412741   PORT_DIPSETTING(    0x80, "Pagamenti (Payment) A" )
27422742   PORT_DIPSETTING(    0x00, "Pagamenti (Payment) B" )
27432743INPUT_PORTS_END
r31373r31374
62186218
62196219static UINT8 rcdino4_add[] =
62206220{
6221/*      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f*/
6222/*0*/   1, 9, 9, 9, 9, 2, 9, 9, 1, 2, 1, 9, 9, 3, 9, 9,
6223/*1*/   2, 2, 9, 9, 9, 9, 9, 9, 1, 9, 1, 9, 9, 9, 9, 9,
6224/*2*/   3, 9, 9, 9, 9, 2, 2, 9, 1, 2, 1, 9, 9, 3, 3, 9,
6225/*3*/   2, 9, 9, 9, 9, 9, 9, 9, 1, 9, 1, 9, 9, 3, 9, 9,
6226/*4*/   1, 9, 9, 9, 9, 2, 9, 9, 1, 2, 1, 9, 3, 3, 9, 9,
6227/*5*/   9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 9, 9, 9, 9, 9,
6228/*6*/   1, 9, 9, 9, 2, 2, 9, 9, 1, 2, 1, 9, 3, 3, 3, 9,
6229/*7*/   9, 2, 9, 9, 9, 9, 9, 9, 9, 3, 1, 9, 9, 3, 9, 9,
6230/*8*/   2, 9, 9, 9, 2, 2, 2, 9, 1, 9, 1, 9, 9, 3, 3, 9,
6231/*9*/   2, 2, 9, 9, 9, 2, 9, 9, 1, 3, 9, 9, 3, 3, 3, 9,
6232/*a*/   2, 9, 2, 9, 2, 2, 2, 9, 1, 2, 1, 9, 9, 3, 3, 2,
6233/*b*/   2, 2, 9, 9, 9, 2, 9, 9, 9, 3, 9, 9, 9, 3, 9, 9,
6234/*c*/   2, 9, 9, 9, 2, 2, 2, 9, 1, 2, 1, 9, 3, 3, 3, 9,
6235/*d*/   2, 9, 9, 9, 9, 9, 9, 9, 1, 9, 1, 9, 9, 3, 9, 9,
6236/*e*/   2, 9, 9, 9, 2, 9, 2, 9, 1, 2, 1, 9, 3, 9, 3, 9,
6237/*f*/   2, 9, 9, 9, 9, 2, 9, 9, 1, 3, 1, 9, 9, 3, 9, 9
6221/*      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f*/
6222/*0*/   1, 9, 9, 9, 9, 2, 9, 9, 1, 2, 1, 9, 9, 3, 9, 9,
6223/*1*/   2, 2, 9, 9, 9, 9, 9, 9, 1, 9, 1, 9, 9, 9, 9, 9,
6224/*2*/   3, 9, 9, 9, 9, 2, 2, 9, 1, 2, 1, 9, 9, 3, 3, 9,
6225/*3*/   2, 9, 9, 9, 9, 9, 9, 9, 1, 9, 1, 9, 9, 3, 9, 9,
6226/*4*/   1, 9, 9, 9, 9, 2, 9, 9, 1, 2, 1, 9, 3, 3, 9, 9,
6227/*5*/   9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 9, 9, 9, 9, 9,
6228/*6*/   1, 9, 9, 9, 2, 2, 9, 9, 1, 2, 1, 9, 3, 3, 3, 9,
6229/*7*/   9, 2, 9, 9, 9, 9, 9, 9, 9, 3, 1, 9, 9, 3, 9, 9,
6230/*8*/   2, 9, 9, 9, 2, 2, 2, 9, 1, 9, 1, 9, 9, 3, 3, 9,
6231/*9*/   2, 2, 9, 9, 9, 2, 9, 9, 1, 3, 9, 9, 3, 3, 3, 9,
6232/*a*/   2, 9, 2, 9, 2, 2, 2, 9, 1, 2, 1, 9, 9, 3, 3, 2,
6233/*b*/   2, 2, 9, 9, 9, 2, 9, 9, 9, 3, 9, 9, 9, 3, 9, 9,
6234/*c*/   2, 9, 9, 9, 2, 2, 2, 9, 1, 2, 1, 9, 3, 3, 3, 9,
6235/*d*/   2, 9, 9, 9, 9, 9, 9, 9, 1, 9, 1, 9, 9, 3, 9, 9,
6236/*e*/   2, 9, 9, 9, 2, 9, 2, 9, 1, 2, 1, 9, 3, 9, 3, 9,
6237/*f*/   2, 9, 9, 9, 9, 2, 9, 9, 1, 3, 1, 9, 9, 3, 9, 9
62386238};
62396239
62406240static UINT8 rcdino4_keys40[] =
62416241{
6242/*   40    41    42    43    44    45    46    47    48    49    4a    4b    4c    4d*/
6242/*  40    41    42    43    44    45    46    47    48    49    4a    4b    4c    4d*/
62436243   0x36, 0x54, 0x47, 0x6b, 0xce, 0x95, 0xa2, 0x66, 0x3a, 0x46, 0x53, 0xd7, 0xc4, 0xa4,
6244/*   4e    4f*/
6244/*  4e    4f*/
62456245   0x00, 0x00,
6246/*   50*/
6246/*  50*/
62476247   0x56
62486248};
62496249
62506250static UINT8 rcdino4_keys80[] =
62516251{
6252/*   81    82    83    84    85 */
6253    0xb8, 0x32, 0x1c, 0x23, 0xe2,
6254/*   86    87    88    89    8a    8b    8c    8d    8e    8f    90    91*/
6252/*  81    82    83    84    85 */
6253   0xb8, 0x32, 0x1c, 0x23, 0xe2,
6254/*  86    87    88    89    8a    8b    8c    8d    8e    8f    90    91*/
62556255   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6256/*   92    93    94    95    96    97 */
6256/*  92    93    94    95    96    97 */
62576257   0x4c, 0x00, 0x3d, 0x00, 0xd9, 0x16,
6258/*   98    99    9a    9b    9c    9d    9e    9f    a0    a1    a2    a3*/
6258/*  98    99    9a    9b    9c    9d    9e    9f    a0    a1    a2    a3*/
62596259   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6260/*   a4    a5    a6*/
6260/*  a4    a5    a6*/
62616261   0x5e, 0x73, 0x69,
6262/*   a7    a8    a9*/
6262/*  a7    a8    a9*/
62636263   0x00, 0x00, 0x00,
6264/*   aa*/
6264/*  aa*/
62656265   0xa6,
6266/*   ab    ac    ad    ae    af*/
6266/*  ab    ac    ad    ae    af*/
62676267   0x00, 0x00, 0x00, 0x00, 0x00,
6268/*   b0    b1*/
6268/*  b0    b1*/
62696269   0xc3, 0x40,
6270/*   b2    b3    b4    b5    b6    b7    b8    b9    ba    bb    bc    bd    be    bf    c0    c1    c2*/
6270/*  b2    b3    b4    b5    b6    b7    b8    b9    ba    bb    bc    bd    be    bf    c0    c1    c2*/
62716271   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6272/*   c3    c4    c5*/
6272/*  c3    c4    c5*/
62736273   0x92, 0xb7, 0x24,
6274/*   c6    c7    c8    c9*/
6274/*  c6    c7    c8    c9*/
62756275   0x00, 0x00, 0x00, 0x00,
6276/*   ca*/
6276/*  ca*/
62776277   0x62,
6278/*   cb    cc    cd    ce    cf*/
6278/*  cb    cc    cd    ce    cf*/
62796279   0x00, 0x00, 0x00, 0x00, 0x00,
6280/*   d0*/
6280/*  d0*/
62816281   0x84,
6282/*   d1*/
6282/*  d1*/
62836283   0x00,
6284/*   d2*/
6284/*  d2*/
62856285   0xaa,
6286/*   d3    d4    d5*/
6286/*  d3    d4    d5*/
62876287   0x00, 0x00, 0x00,
6288/*   d6*/
6288/*  d6*/
62896289   0xea,
6290/*   d7    d8    d9    da    db    dc    dd    de    df*/
6290/*  d7    d8    d9    da    db    dc    dd    de    df*/
62916291   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6292/*   e0*/
6292/*  e0*/
62936293   0x17,
6294/*   e1    e2    e3*/
6294/*  e1    e2    e3*/
62956295   0x00, 0x00, 0x00,
6296/*   e4*/
6296/*  e4*/
62976297   0xc0,
6298/*   e5    e6    e7    e8    e9    ea    eb    ec    ed    ee    ef    f0    f1    f2    f3    f4    f5    f6    f7*/
6298/*  e5    e6    e7    e8    e9    ea    eb    ec    ed    ee    ef    f0    f1    f2    f3    f4    f5    f6    f7*/
62996299   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6300/*   f8    f9    fa    fb    fc    fd    fe*/
6300/*  f8    f9    fa    fb    fc    fd    fe*/
63016301   0x06, 0x1e, 0x28, 0x5a, 0xcf, 0x79, 0x11
63026302};
63036303
r31373r31374
63686368         add = rcdino4_add[c];
63696369
63706370         if (((i == 0x81)
6371           && (j >= 0xa3) && (j <= 0xb1) /* text string */
6372             )
6373          || ((i == 0x82)
6374           && (j >= 0x35) && (j <= 0x53) /* table of addresses */
6375             )
6376          || ((i == 0x85)
6377           && (j >= 0x7e) && (j <= 0x8d) /* '0'-'9', 'A'-'F' */
6378             )
6379          || ((i == 0x94)
6380           && (((j >= 0x4a) && (j <= 0x86)) /* zeroes */
6381             || ((j >= 0xbf) && (j <= 0xc1)) /* set of masks */
6382              )
6383             )
6384          || ((i == 0x96)
6385           && (j >= 0x39) && (j <= 0x3e) /* set of masks */
6386             )
6387          || ((i == 0xa6)
6388           && (j >= 0x30) && (j <= 0x32) /* set of masks */
6389             )
6390          || ((i == 0xaa)
6391           && (j >= 0xf2) /* table of addresses */
6392             )
6393          || ((i == 0xc3)
6394           && (j >= 0x70) && (j <= 0xaf) /* set of masks */
6395             )
6396          || ((i == 0xc4)
6397           && (j >= 0xdc) /* zeroes and things */
6398             )
6399          || ((i == 0xd0)
6400           && (j >= 0xd2) /* text and zeroes */
6401             )
6402          || ((i == 0xd2)
6403           && ((j <= 0x2f) /* text and zeroes */
6404            || ((j >= 0x84) && (j <= 0xaf)) /* text and zeroes */
6405              )
6406             )
6407          || (add == 9)
6408            )
6371            && (j >= 0xa3) && (j <= 0xb1) /* text string */
6372            )
6373            || ((i == 0x82)
6374            && (j >= 0x35) && (j <= 0x53) /* table of addresses */
6375            )
6376            || ((i == 0x85)
6377            && (j >= 0x7e) && (j <= 0x8d) /* '0'-'9', 'A'-'F' */
6378            )
6379            || ((i == 0x94)
6380            && (((j >= 0x4a) && (j <= 0x86)) /* zeroes */
6381            || ((j >= 0xbf) && (j <= 0xc1)) /* set of masks */
6382               )
6383            )
6384            || ((i == 0x96)
6385            && (j >= 0x39) && (j <= 0x3e) /* set of masks */
6386            )
6387            || ((i == 0xa6)
6388            && (j >= 0x30) && (j <= 0x32) /* set of masks */
6389            )
6390            || ((i == 0xaa)
6391            && (j >= 0xf2) /* table of addresses */
6392            )
6393            || ((i == 0xc3)
6394            && (j >= 0x70) && (j <= 0xaf) /* set of masks */
6395            )
6396            || ((i == 0xc4)
6397            && (j >= 0xdc) /* zeroes and things */
6398            )
6399            || ((i == 0xd0)
6400            && (j >= 0xd2) /* text and zeroes */
6401            )
6402            || ((i == 0xd2)
6403            && ((j <= 0x2f) /* text and zeroes */
6404            || ((j >= 0x84) && (j <= 0xaf)) /* text and zeroes */
6405               )
6406            )
6407            || (add == 9)
6408            )
64096409         {
64106410            ++j;
64116411         }
r31373r31374
64216421      do {} while (!rcdino4_keys80[++i - 0x81]);
64226422
64236423      if ((i == 0xa4)
6424       || (i == 0xb0)
6425       || (i == 0xf8)
6426         )
6424         || (i == 0xb0)
6425         || (i == 0xf8)
6426         )
64276427      {
64286428         j = 0; /* re-align offset after skipping some pages */
64296429      }
trunk/src/mame/drivers/naughtyb.c
r31373r31374
429429   MCFG_TMS36XX_TYPE(TMS3615)
430430   MCFG_TMS36XX_DECAY_TIMES(0.15, 0.20, 0, 0, 0, 0)
431431   // NOTE: it's unknown if the TMS3615 mixes more than one voice internally.
432   // A wav taken from Pop Flamer sounds like there are at least no 'odd'
432   // A wav taken from Pop Flamer sounds like there are at least no 'odd'
433433   // harmonics (5 1/3' and 2 2/3')
434434   MCFG_SOUND_ROUTE(0, "mono", 0.60)
435435
r31373r31374
466466   MCFG_TMS36XX_TYPE(TMS3615)
467467   MCFG_TMS36XX_DECAY_TIMES(0.15, 0.20, 0, 0, 0, 0)
468468   // NOTE: it's unknown if the TMS3615 mixes more than one voice internally.
469   // A wav taken from Pop Flamer sounds like there are at least no 'odd'
469   // A wav taken from Pop Flamer sounds like there are at least no 'odd'
470470   // harmonics (5 1/3' and 2 2/3')
471471   MCFG_SOUND_ROUTE(0, "mono", 0.60)
472472
trunk/src/mame/drivers/mpu4hw.c
r31373r31374
13301330   LOG_IC8(("%s: IC8 PIA write CB2 (alpha clock) %02X\n", machine().describe_context(), state & 0xFF));
13311331
13321332   // DM Data pin B
1333   
1333
13341334   m_vfd->sclk(!state);
13351335}
13361336
r31373r31374
26002600   MCFG_PTM6840_OUT1_CB(WRITE8(mpu4_state, ic2_o2_callback))
26012601   MCFG_PTM6840_OUT2_CB(WRITE8(mpu4_state, ic2_o3_callback))
26022602   MCFG_PTM6840_IRQ_CB(WRITELINE(mpu4_state, cpu0_irq))
2603   
2603
26042604   MCFG_DEVICE_ADD("pia_ic3", PIA6821, 0)
26052605   MCFG_PIA_WRITEPA_HANDLER(WRITE8(mpu4_state, pia_ic3_porta_w))
26062606   MCFG_PIA_WRITEPB_HANDLER(WRITE8(mpu4_state, pia_ic3_portb_w))
trunk/src/mame/drivers/de_3.c
r31373r31374
11261126GAME(1992,  trek_110,       trek_201,   de_3_dmd1,   de_3, de_3_state,   de_3,   ROT0,   "Data East",    "Star Trek 25th Anniversary (1.10)",                GAME_IS_SKELETON_MECHANICAL)
11271127GAME(1992,  trek_11a,       trek_201,   de_3_dmd1,   de_3, de_3_state,   de_3,   ROT0,   "Data East",    "Star Trek 25th Anniversary (1.10 Alpha Display)",  GAME_IS_SKELETON_MECHANICAL)
11281128GAME(1992,  stwr_104,       0,          de_3_dmd2,   de_3, de_3_state,   de_3,   ROT0,   "Data East",    "Star Wars (1.04)",             GAME_IS_SKELETON_MECHANICAL)
1129GAME(1992,  stwr_103,       stwr_104,   de_3_dmd2,   de_3, de_3_state,   de_3,   ROT0,   "Data East",    "Star Wars (1.03)",           GAME_IS_SKELETON_MECHANICAL)
1129GAME(1992,  stwr_103,       stwr_104,   de_3_dmd2,   de_3, de_3_state,   de_3,   ROT0,   "Data East",    "Star Wars (1.03)",             GAME_IS_SKELETON_MECHANICAL)
11301130GAME(1992,  stwr_g11,       stwr_104,   de_3_dmd2,   de_3, de_3_state,   de_3,   ROT0,   "Data East",    "Star Wars (1.01 Germany)",     GAME_IS_SKELETON_MECHANICAL)
11311131GAME(1992,  stwr_a14,       stwr_104,   de_3_dmd2,   de_3, de_3_state,   de_3,   ROT0,   "Data East",    "Star Wars (Display Rev.1.04)", GAME_IS_SKELETON_MECHANICAL)
11321132GAME(1992,  stwr_102,       stwr_104,   de_3_dmd2,   de_3, de_3_state,   de_3,   ROT0,   "Data East",    "Star Wars (1.02)",             GAME_IS_SKELETON_MECHANICAL)
trunk/src/mame/drivers/mpu4sw.c
r31373r31374
994994ROM_START( m4eaw__bz ) \
995995   ROM_REGION( 0x010000, "maincpu", 0 )
996996   ROM_LOAD( "everyones a winner v2-5p", 0x8000, 0x008000, CRC(eb8f2fc5) SHA1(0d3614bd5ff561d17bef0d1e620f2f812b8fed5b))
997   M4EAW_EXTRA_ROMS
998ROM_END
997   M4EAW_EXTRA_ROMS
998ROM_END
999999
10001000GAME(199?, m4eaw__bz, m4eaw ,mod4oki ,mpu4 , mpu4_state,m4_showstring ,ROT0,"Barcrest","Everyone's A Winner (Barcrest) (MPU4) (set 99)",GAME_FLAGS )
10011001
trunk/src/mame/drivers/mystwarr.c
r31373r31374
10201020   MCFG_DEVICE_ADD("k054338", K054338, 0)
10211021   MCFG_K054338_ALPHAINV(1)
10221022   MCFG_K054338_MIXER("k055555")
1023   
1023
10241024   MCFG_VIDEO_START_OVERRIDE(mystwarr_state, mystwarr)
10251025
10261026   /* sound hardware */
trunk/src/mame/drivers/triforce.c
r31373r31374
621621Peripheral String 0000000
622622Product Number    GDT-0004E
623623Version           V5.002
624Release Date      20031203
625 
626PIC16C621A-20/P (317-0362-COM)
624Release Date      20031203
625
626PIC16C621A-20/P (317-0362-COM)
627627Sticker: 253-5508-0362
628628*/
629629ROM_START( fzeroax )
r31373r31374
645645Product Number    GDT-0004C
646646Version           V3.000
647647Release Date      20030611
648 
649PIC16C621A-20/P (317-0362-COM)
648
649PIC16C621A-20/P (317-0362-COM)
650650Sticker: 253-5508-0362
651*/
651*/
652652ROM_START( fzeroaxc )
653653   TRIFORCE_BIOS
654654
r31373r31374
816816Product Number    GDT-0021
817817Version           V1.003
818818Release Date      20060131
819Manufacturer ID 
820Ring Code   
819Manufacturer ID
820Ring Code
821821BIN               BLL.BIN
822822KEY               ABFBD902FBD980E5
823823GDI Structure     3
r31373r31374
8258252   450 0 2352 track02.raw 0
8268263 45000 4 2352 track03.bin 0
827827
828Files Infos :
828Files Infos :
829829disc.gdi    - size         87 - md5 b3ecdf113fd42344dd84142679e4cb36 - sha1 9d50b816d3f69ad192f5986ab487769965c2e082
830830track01.bin - size     705600 - md5 0fa0aff28e75130cc9364e11755d0881 - sha1 647ff196eff7c220e1aa7829f87494d557c90be4
831831track02.raw - size    3179904 - md5 32a6bba6f49385515c6649bb78f8e9c4 - sha1 27c8184e6d40c48fe6466bfb4171969eaf6baab3
832832track03.bin - size 1185760800 - md5 8b67fe537a66fa849686df074531cb30 - sha1 153f638f5b67741687186835573ab485400f91bf
833833
834834ROM_START( vs42k6ex )
835   TRIFORCE_BIOS
835    TRIFORCE_BIOS
836836
837   DISK_REGION( "gdrom" )
838   DISK_IMAGE_READONLY( "gdt-0021", 0, NO_DUMP ) disc.gdi is missing from available romset, it is impossible to create CHD with CHDMAN
837    DISK_REGION( "gdrom" )
838    DISK_IMAGE_READONLY( "gdt-0021", 0, NO_DUMP ) disc.gdi is missing from available romset, it is impossible to create CHD with CHDMAN
839839
840   ROM_REGION( 0x50, "picreturn", ROMREGION_ERASE)
841   ROM_LOAD("gdt-0021.data", 0x00, 0x50, NO_DUMP )
840    ROM_REGION( 0x50, "picreturn", ROMREGION_ERASE)
841    ROM_LOAD("gdt-0021.data", 0x00, 0x50, NO_DUMP )
842842ROM_END
843843*/
844844
r31373r31374
848848Hardware       Tri-Force
849849Sec Key        253-5508-0567
850850Pic            317-0567-COM
851Ver            0001
851Ver            0001
852852Boot File      BRN.BIN
853853GD Unlock      70 1F 71 1F
854854DES Key        D96446469BDCE9C1
855855
856856ROM_START( tcfboxa )
857   TRIFORCE_BIOS
857    TRIFORCE_BIOS
858858
859   DISK_REGION( "gdrom" )
860   DISK_IMAGE_READONLY( "gdt-0022", 0, NO_DUMP ) disc.gdi is missing from available romset, it is impossible to create CHD with CHDMAN
859    DISK_REGION( "gdrom" )
860    DISK_IMAGE_READONLY( "gdt-0022", 0, NO_DUMP ) disc.gdi is missing from available romset, it is impossible to create CHD with CHDMAN
861861
862   ROM_REGION( 0x50, "picreturn", ROMREGION_ERASE)
863   ROM_LOAD("317-0567-com.data", 0x00, 0x50, NO_DUMP )
862    ROM_REGION( 0x50, "picreturn", ROMREGION_ERASE)
863    ROM_LOAD("317-0567-com.data", 0x00, 0x50, NO_DUMP )
864864ROM_END
865865*/
866866
r31373r31374
879879ROM_END
880880
881881/*
882
882
883883MK21 Ver.A
884884Number on ROM PCB  837-14343R4S0
885885Number on Actel ProAsic  315-6419B
886Number on Key Chip (PIC)  235-5509-5128
887 
888*/
886Number on Key Chip (PIC)  235-5509-5128
889887
888*/
889
890890ROM_START( mkartag2 )
891891   TRIFORCE_BIOS
892892
893893   ROM_REGION(0x21200000, "rom_board", 0)
894   ROM_LOAD( "ic9_mx29lv400cttc.bin", 0x00000000, 0x0080000, CRC(2bb9f1fe) SHA1(935511d93a0ab06436b0674bef90c790c100e0b1) )
895   ROM_LOAD( "ic1_k9f1208u0b.bin",    0x01000000, 0x4200000, CRC(e52f17ef) SHA1(1e007d3136cacb89c396b8261e3978956cc21bdd) )
896   ROM_LOAD( "ic2_k9f1208u0b.bin",    0x04200000, 0x4200000, CRC(8a6a2649) SHA1(fd4318e7fb5020c499e06fdb1996b8d40161b674) )
897   ROM_LOAD( "ic3_k9f1208u0b.bin",    0x08400000, 0x4200000, CRC(8fd44a29) SHA1(9392bc4da6541960a83e9c7b3ab4f36bc5564fb7) )
898   ROM_LOAD( "ic4_k9f1208u0b.bin",    0x0c600000, 0x4200000, CRC(ae3fb198) SHA1(c9c0beb9f6875dbf7ce015454a59481524ef3ef6) )
899   ROM_LOAD( "ic5_k9f1208u0b.bin",    0x10800000, 0x4200000, CRC(e9208514) SHA1(ad0ed3e681cd78a61d7ad3af83db20e364bb47fd) )
900   ROM_LOAD( "ic6_k9f1208u0b.bin",    0x14c00000, 0x4200000, CRC(7363697c) SHA1(997c96d0b41774a24a2e0427a703bc295e784187) )
901   ROM_LOAD( "ic7_k9f1208u0b.bin",    0x18e00000, 0x4200000, CRC(407da1d2) SHA1(c185ebd2f3d8654d8fd394c56ac9bfff7e49f125) )
902   ROM_LOAD( "ic8_k9f1208u0b.bin",    0x1d000000, 0x4200000, CRC(9ab76062) SHA1(36a6317c646da5cf682d46ca438ce05e600bc354) )
894   ROM_LOAD( "ic9_mx29lv400cttc.bin", 0x00000000, 0x0080000, CRC(2bb9f1fe) SHA1(935511d93a0ab06436b0674bef90c790c100e0b1) )
895   ROM_LOAD( "ic1_k9f1208u0b.bin",    0x01000000, 0x4200000, CRC(e52f17ef) SHA1(1e007d3136cacb89c396b8261e3978956cc21bdd) )
896   ROM_LOAD( "ic2_k9f1208u0b.bin",    0x04200000, 0x4200000, CRC(8a6a2649) SHA1(fd4318e7fb5020c499e06fdb1996b8d40161b674) )
897   ROM_LOAD( "ic3_k9f1208u0b.bin",    0x08400000, 0x4200000, CRC(8fd44a29) SHA1(9392bc4da6541960a83e9c7b3ab4f36bc5564fb7) )
898   ROM_LOAD( "ic4_k9f1208u0b.bin",    0x0c600000, 0x4200000, CRC(ae3fb198) SHA1(c9c0beb9f6875dbf7ce015454a59481524ef3ef6) )
899   ROM_LOAD( "ic5_k9f1208u0b.bin",    0x10800000, 0x4200000, CRC(e9208514) SHA1(ad0ed3e681cd78a61d7ad3af83db20e364bb47fd) )
900   ROM_LOAD( "ic6_k9f1208u0b.bin",    0x14c00000, 0x4200000, CRC(7363697c) SHA1(997c96d0b41774a24a2e0427a703bc295e784187) )
901   ROM_LOAD( "ic7_k9f1208u0b.bin",    0x18e00000, 0x4200000, CRC(407da1d2) SHA1(c185ebd2f3d8654d8fd394c56ac9bfff7e49f125) )
902   ROM_LOAD( "ic8_k9f1208u0b.bin",    0x1d000000, 0x4200000, CRC(9ab76062) SHA1(36a6317c646da5cf682d46ca438ce05e600bc354) )
903903ROM_END
904904
905905ROM_START( mkartag2a )
906906   TRIFORCE_BIOS
907907
908908   ROM_REGION(0x21200000, "rom_board", 0)
909   ROM_LOAD( "ic9_mx29lv400cttc(__alt).bin", 0x00000000, 0x0080000, CRC(ff854fd0) SHA1(0e42aff9a60aacd200b7a29d4d180abdab6a732e) )
910   ROM_LOAD( "ic1_k9f1208u0b(__alt).bin",    0x01000000, 0x4200000, CRC(c5624816) SHA1(d6f2a2ff9e9e14d857a0ec810521c378ba1fabd5) )
911   ROM_LOAD( "ic2_k9f1208u0b(__alt).bin",    0x04200000, 0x4200000, CRC(44e59a1f) SHA1(68a8c1178a33e23446980ec84486bc614f830dad) )
912   ROM_LOAD( "ic3_k9f1208u0b(__alt).bin",    0x08400000, 0x4200000, CRC(6688e7f9) SHA1(7d1e60806c02fd765dd0981e790a698a29050aae) )
913   ROM_LOAD( "ic4_k9f1208u0b(__alt).bin",    0x0c600000, 0x4200000, CRC(e043eac2) SHA1(0108d940a852ff03e919170957f2bca2c1a88a03) )
914   ROM_LOAD( "ic5_k9f1208u0b(__alt).bin",    0x10800000, 0x4200000, CRC(20882926) SHA1(c802de32ca24bf4e9fbabf47fed23a91b3d614ac) )
915   ROM_LOAD( "ic6_k9f1208u0b(__alt).bin",    0x14c00000, 0x4200000, CRC(14171ba4) SHA1(3ddace539cd8a4b53a1ef03238e8404db7dcd85e) )
916   ROM_LOAD( "ic7_k9f1208u0b(__alt).bin",    0x18e00000, 0x4200000, CRC(bd0199df) SHA1(aafb171e9f5a4c8dc2ef55ba344a0eb310c63467) )
917   ROM_LOAD( "ic8_k9f1208u0b(__alt).bin",    0x1d000000, 0x4200000, CRC(8ad6c7ae) SHA1(749b99a944f62aefb895a622c029656c69b3c736) )
909   ROM_LOAD( "ic9_mx29lv400cttc(__alt).bin", 0x00000000, 0x0080000, CRC(ff854fd0) SHA1(0e42aff9a60aacd200b7a29d4d180abdab6a732e) )
910   ROM_LOAD( "ic1_k9f1208u0b(__alt).bin",    0x01000000, 0x4200000, CRC(c5624816) SHA1(d6f2a2ff9e9e14d857a0ec810521c378ba1fabd5) )
911   ROM_LOAD( "ic2_k9f1208u0b(__alt).bin",    0x04200000, 0x4200000, CRC(44e59a1f) SHA1(68a8c1178a33e23446980ec84486bc614f830dad) )
912   ROM_LOAD( "ic3_k9f1208u0b(__alt).bin",    0x08400000, 0x4200000, CRC(6688e7f9) SHA1(7d1e60806c02fd765dd0981e790a698a29050aae) )
913   ROM_LOAD( "ic4_k9f1208u0b(__alt).bin",    0x0c600000, 0x4200000, CRC(e043eac2) SHA1(0108d940a852ff03e919170957f2bca2c1a88a03) )
914   ROM_LOAD( "ic5_k9f1208u0b(__alt).bin",    0x10800000, 0x4200000, CRC(20882926) SHA1(c802de32ca24bf4e9fbabf47fed23a91b3d614ac) )
915   ROM_LOAD( "ic6_k9f1208u0b(__alt).bin",    0x14c00000, 0x4200000, CRC(14171ba4) SHA1(3ddace539cd8a4b53a1ef03238e8404db7dcd85e) )
916   ROM_LOAD( "ic7_k9f1208u0b(__alt).bin",    0x18e00000, 0x4200000, CRC(bd0199df) SHA1(aafb171e9f5a4c8dc2ef55ba344a0eb310c63467) )
917   ROM_LOAD( "ic8_k9f1208u0b(__alt).bin",    0x1d000000, 0x4200000, CRC(8ad6c7ae) SHA1(749b99a944f62aefb895a622c029656c69b3c736) )
918918ROM_END
919919
920920/* Main board */
trunk/src/mame/drivers/zr107.c
r31373r31374
815815
816816   MCFG_DEVICE_ADD("adc0838", ADC0838, 0)
817817   MCFG_ADC083X_INPUT_CB(zr107_state, adc0838_callback)
818   
818
819819   MCFG_DEVICE_ADD("konppc", KONPPC, 0)
820820   MCFG_KONPPC_CGBOARD_NUMBER(1)
821821   MCFG_KONPPC_CGBOARD_TYPE(CGBOARD_TYPE_ZR107)
r31373r31374
897897
898898   MCFG_DEVICE_ADD("adc0838", ADC0838, 0)
899899   MCFG_ADC083X_INPUT_CB(zr107_state, adc0838_callback)
900   
900
901901   MCFG_DEVICE_ADD("konppc", KONPPC, 0)
902902   MCFG_KONPPC_CGBOARD_NUMBER(1)
903903   MCFG_KONPPC_CGBOARD_TYPE(CGBOARD_TYPE_GTICLUB)
trunk/src/mame/drivers/parodius.c
r31373r31374
221221{
222222   if (data & 0xf0)
223223      logerror("%04x: setlines %02x\n", machine().device("maincpu")->safe_pc(), data);
224   
224
225225   membank("bank1")->set_entry((data & 0x0f) ^ 0x0f);
226226}
227227
r31373r31374
234234   MCFG_KONAMICPU_LINE_CB(WRITE8(parodius_state, banking_callback))
235235
236236   MCFG_CPU_ADD("audiocpu", Z80, 3579545)
237   MCFG_CPU_PROGRAM_MAP(parodius_sound_map)   /* NMIs are triggered by the 053260 */
237   MCFG_CPU_PROGRAM_MAP(parodius_sound_map)    /* NMIs are triggered by the 053260 */
238238
239239   MCFG_DEVICE_ADD("bank0000", ADDRESS_MAP_BANK, 0)
240240   MCFG_DEVICE_PROGRAM_MAP(bank0000_map)
trunk/src/mame/drivers/re900.c
r31373r31374
379379
380380   /* video hardware */
381381   MCFG_DEVICE_ADD( "tms9128", TMS9128, XTAL_10_738635MHz / 2 )   /* TMS9128NL on the board */
382    MCFG_TMS9928A_VRAM_SIZE(0x4000)
382   MCFG_TMS9928A_VRAM_SIZE(0x4000)
383383   MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(re900_state, vdp_interrupt))
384384   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
385385   MCFG_SCREEN_UPDATE_DEVICE( "tms9128", tms9128_device, screen_update )
trunk/src/mame/drivers/midxunit.c
r31373r31374
278278   MCFG_SCREEN_UPDATE_DEVICE("maincpu", tms34010_device, tms340x0_ind16)
279279   MCFG_SCREEN_PALETTE("palette")
280280   MCFG_VIDEO_START_OVERRIDE(midxunit_state,midxunit)
281   
281
282282   MCFG_DEVICE_ADD("serial_pic", MIDWAY_SERIAL_PIC, 0)
283283   /* serial prefixes 419, 420 */
284284   MCFG_MIDWAY_SERIAL_PIC_UPPER(419);
trunk/src/mame/drivers/chihiro.c
r31373r31374
449449      UINT32 gpdsp_sgblocks;
450450      UINT32 gpdsp_address;
451451      UINT32 epdsp_sgaddress; // encoder processor scatter-gather
452      UINT32 epdsp_sgblocks;
452      UINT32 epdsp_sgblocks;
453453      UINT32 unknown_sgaddress;
454454      UINT32 unknown_sgblocks;
455455      int voice_number;
r31373r31374
33453345   // Vertex program (shader)
33463346   if (maddress == 0x1e94) {
33473347      /*if (data == 2)
3348         logerror("Enabled vertex program\n");
3348          logerror("Enabled vertex program\n");
33493349      else if (data == 4)
3350         logerror("Enabled fixed function pipeline\n");
3350          logerror("Enabled fixed function pipeline\n");
33513351      else if (data == 6)
3352         logerror("Enabled both fixed function pipeline and vertex program ?\n");
3352          logerror("Enabled both fixed function pipeline and vertex program ?\n");
33533353      else
3354         logerror("Unknown value %d to method 0x1e94\n",data);*/
3354          logerror("Unknown value %d to method 0x1e94\n",data);*/
33553355      vertex_pipeline = data & 6;
33563356      countlen--;
33573357   }
r31373r31374
53735373Product Number    GDX-0001
53745374Version           V1.004
53755375Release Date      20021029
5376Manufacturer ID   
5377TOC   DISC
5376Manufacturer ID
5377TOC DISC
53785378Track        Start Sector  End Sector  Track Size
53795379track01.bin           150         599     1058400
53805380track02.raw           750        2101     3179904
r31373r31374
54055405Product Number    GDX-0002B
54065406Version           V3.000
54075407Release Date      20030224
5408Manufacturer ID   
5409TOC   DISC
5408Manufacturer ID
5409TOC DISC
54105410Track        Start Sector  End Sector  Track Size
54115411track01.bin           150         599     1058400
54125412track02.raw           750        2101     3179904
r31373r31374
54855485Product Number    GDX-0006G
54865486Version           V8.000
54875487Release Date      20050202
5488Manufacturer ID   
5489TOC   DISC
5488Manufacturer ID
5489TOC DISC
54905490Track        Start Sector  End Sector  Track Size
54915491track01.bin           150         599     1058400
5492track02.raw 750   2101   3179904
5493track03.bin   45150   549299   1185760800
5492track02.raw 750 2101    3179904
5493track03.bin 45150   549299  1185760800
54945494*/
54955495ROM_START( mj2 )
54965496   CHIHIRO_BIOS
r31373r31374
56275627Product Number    GDX-0024A
56285628Version           V2.000
56295629Release Date      20090331
5630Manufacturer ID   
5631TOC   DISC
5630Manufacturer ID
5631TOC DISC
56325632Track        Start Sector  End Sector  Track Size
56335633track01.bin           150        8740    20206032
56345634track02.raw          8891       10242     3179904
trunk/src/mame/drivers/capcom.c
r31373r31374
289289   ROM_REGION(0x20000, "cpu2", 0)
290290   ROM_LOAD("u24_v11.bin", 0x0000, 0x2000, CRC(d46212f4) SHA1(50f1279d995b597c468805b323e0252800b28274))
291291   ROM_REGION(0x500000, "sound1", 0)
292    ROM_LOAD("u15_v10.bin",  0       ,  0x80000, CRC(a77c884c) SHA1(10e7e242876fe197f582f1574ed47c4682b87db5))
292   ROM_LOAD("u15_v10.bin",  0       ,  0x80000, CRC(a77c884c) SHA1(10e7e242876fe197f582f1574ed47c4682b87db5))
293293   ROM_LOAD("u19_v10.bin",  0x100000,  0x80000, CRC(550c1c52) SHA1(f97cceb552a6bffe55c85fc01120ad99d3b7f19b))
294294   ROM_LOAD("u30_v10.bin",  0x200000,  0x80000, CRC(44a2edb9) SHA1(c14b00e07cc873ef99ec629fbdeda72e9e69ac47))
295295   ROM_LOAD("u32_v10.bin",  0x300000,  0x80000, CRC(73ee0ecc) SHA1(48aed6f76c0b506bd39430c7f1ea8735db99b8e3))
296   ROM_LOAD("u34_v10.bin",  0x400000,  0x80000, CRC(cd5ea236) SHA1(dded158bc2f8443d2e69834cde87e81661ca7c53))   
296   ROM_LOAD("u34_v10.bin",  0x400000,  0x80000, CRC(cd5ea236) SHA1(dded158bc2f8443d2e69834cde87e81661ca7c53))
297297ROM_END
298298
299299GAME(1996,  abv106,     0,      capcom, capcom, capcom_state,   capcom, ROT0,   "Capcom",       "Airborne",                     GAME_IS_SKELETON_MECHANICAL)
trunk/src/mame/drivers/segas16b.c
r31373r31374
38893889
38903890   ROM_REGION( 0x2000, "maincpu:key", 0 ) // decryption key
38913891   // reconstructed key; some of the RNG-independent bits could be incorrect
3892    ROM_LOAD( "317-0065.key", 0x0000, 0x2000, BAD_DUMP CRC(9e0f619d) SHA1(b0392e84d1c9af681dc9bb2ca3636e7cc41a605b) )
3892   ROM_LOAD( "317-0065.key", 0x0000, 0x2000, BAD_DUMP CRC(9e0f619d) SHA1(b0392e84d1c9af681dc9bb2ca3636e7cc41a605b) )
38933893
38943894   ROM_REGION( 0x60000, "gfx1", 0 ) // tiles
38953895   ROM_LOAD( "opr-11674.a14", 0x00000, 0x20000, CRC(a57a66d5) SHA1(5103583d48997abad12a0c5fee26431c486ced52) )
trunk/src/mame/drivers/pcxt.c
r31373r31374
741741   MCFG_ISA_OUT_DRQ1_CB(DEVWRITELINE("dma8237_1", am9517a_device, dreq1_w))
742742   MCFG_ISA_OUT_DRQ2_CB(DEVWRITELINE("dma8237_1", am9517a_device, dreq2_w))
743743   MCFG_ISA_OUT_DRQ3_CB(DEVWRITELINE("dma8237_1", am9517a_device, dreq3_w))
744   
744
745745   /*Sound Hardware*/
746746   MCFG_SPEAKER_STANDARD_MONO("mono")
747747
trunk/src/mame/drivers/astrof.c
r31373r31374
11611161   ROM_LOAD( "c.bin",  0xe400, 0x0400, CRC(0101ab24) SHA1(90e99001ef6890fbc76b4f58cc54df12dfa79e2e) )
11621162   ROM_LOAD( "b(__acombat3).bin",  0xe800, 0x0400, CRC(4b847950) SHA1(49de63ac72dff22b962fc7b8d7b1c97939072b4a) ) // b.bin
11631163   ROM_LOAD( "a(__acombat3).bin",  0xec00, 0x0400, CRC(7eb7969b) SHA1(1aaf7af67b544d01a66a1f3d0eda8d42d2c5bb5d) ) // a.bin
1164    ROM_LOAD( "j.bin",  0xf000, 0x0400, CRC(a7e2b47e) SHA1(97eda53dfc7f1914f7df36c13747d1d824b62734) )
1164   ROM_LOAD( "j.bin",  0xf000, 0x0400, CRC(a7e2b47e) SHA1(97eda53dfc7f1914f7df36c13747d1d824b62734) )
11651165   ROM_LOAD( "h.bin",  0xf400, 0x0400, CRC(261ca943) SHA1(17136843f74d2236a5f81f2261b166c02dde138d) )
11661166   ROM_LOAD( "f.bin",  0xf800, 0x0400, CRC(6ce39b64) SHA1(ba99ddc2d1208afd3f27a9749dac1faca645bbdc) )
11671167   ROM_LOAD( "e.bin",  0xfc00, 0x0400, CRC(2acae469) SHA1(80019bc645a9919f9ec455452ea3e588d61a563f) )
trunk/src/mame/drivers/mrgame.c
r31373r31374
123123   AM_RANGE(0x5000, 0x50ff) AM_MIRROR(0x0700) AM_RAM AM_SHARE("objectram")
124124   AM_RANGE(0x6800, 0x6807) AM_MIRROR(0x07f8) AM_WRITE(video_ctrl_w)
125125   AM_RANGE(0x7000, 0x77ff) AM_READNOP //AFR - looks like a watchdog
126   AM_RANGE(0x8100, 0x8103) AM_MIRROR(0x7efc) AM_DEVREADWRITE("ppi", i8255_device, read, write)
126   AM_RANGE(0x8100, 0x8103) AM_MIRROR(0x7efc) AM_DEVREADWRITE("ppi", i8255_device, read, write)
127127ADDRESS_MAP_END
128128
129129static ADDRESS_MAP_START( audio1_map, AS_PROGRAM, 8, mrgame_state )
r31373r31374
373373   const UINT8 *color_prom = machine().root_device().memregion("proms")->base();
374374
375375   /* compute the color output resistor weights */
376   compute_resistor_weights(0,   255, -1.0,
376   compute_resistor_weights(0, 255, -1.0,
377377         3, &resistances[0], rweights, 0, 0,
378378         3, &resistances[0], gweights, 0, 0,
379379         2, &resistances[1], bweights, 0, 0);
trunk/src/mame/drivers/bnstars.c
r31373r31374
13271327   MCFG_CPU_ADD("maincpu", V70, 20000000) // 20MHz
13281328   MCFG_CPU_PROGRAM_MAP(bnstars_map)
13291329   MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(ms32_state,irq_callback)
1330   
1331   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", bnstars_state, ms32_interrupt, "lscreen", 0, 1)   
13321330
1331   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", bnstars_state, ms32_interrupt, "lscreen", 0, 1)
1332
13331333   MCFG_CPU_ADD("audiocpu", Z80, 4000000)
13341334   MCFG_CPU_PROGRAM_MAP(bnstars_sound_map)
13351335
trunk/src/mame/drivers/williams.c
r31373r31374
17351735   /* basic machine hardware */
17361736   MCFG_CPU_MODIFY("maincpu")
17371737   MCFG_CPU_PROGRAM_MAP(williams2_d000_rom_map)
1738   
1738
17391739   MCFG_WILLIAMS_CVSD_SOUND_ADD("cvsd")
17401740   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
17411741
trunk/src/mame/drivers/crimfght.c
r31373r31374
241241   }
242242   else
243243      m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x0000, 0x03ff, "bank1");                             /* RAM */
244   
244
245245   /* bit 6 = enable char ROM reading through the video RAM */
246246   m_k052109->set_rmrd_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE);
247247
r31373r31374
314314   ROM_LOAD32_WORD( "821k06.k13", 0x000000, 0x040000, CRC(a1eadb24) SHA1(ca305b904b34e03918ad07281fda86ad63caa44f) )
315315   ROM_LOAD32_WORD( "821k07.k19", 0x000002, 0x040000, CRC(060019fa) SHA1(c3bca007aaa5f1c534d2a75fe4f96d01a740dd58) )
316316
317   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
317   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
318318   ROM_LOAD32_WORD( "821k04.k2",  0x000000, 0x080000, CRC(00e0291b) SHA1(39d5db6cf36826e47cdf5308eff9bfa8afc82050) )
319319   ROM_LOAD32_WORD( "821k05.k8",  0x000002, 0x080000, CRC(e09ea05d) SHA1(50ac9a2117ce63fe774c48d769ec445a83f1269e) )
320320
r31373r31374
337337   ROM_LOAD32_WORD( "821k06.k13", 0x000000, 0x040000, CRC(a1eadb24) SHA1(ca305b904b34e03918ad07281fda86ad63caa44f) )
338338   ROM_LOAD32_WORD( "821k07.k19", 0x000002, 0x040000, CRC(060019fa) SHA1(c3bca007aaa5f1c534d2a75fe4f96d01a740dd58) )
339339
340   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
340   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
341341   ROM_LOAD32_WORD( "821k04.k2",  0x000000, 0x080000, CRC(00e0291b) SHA1(39d5db6cf36826e47cdf5308eff9bfa8afc82050) )  /* sprites */
342342   ROM_LOAD32_WORD( "821k05.k8",  0x000002, 0x080000, CRC(e09ea05d) SHA1(50ac9a2117ce63fe774c48d769ec445a83f1269e) )
343343
r31373r31374
360360   ROM_LOAD32_WORD( "821k06.k13", 0x000000, 0x040000, CRC(a1eadb24) SHA1(ca305b904b34e03918ad07281fda86ad63caa44f) )
361361   ROM_LOAD32_WORD( "821k07.k19", 0x000002, 0x040000, CRC(060019fa) SHA1(c3bca007aaa5f1c534d2a75fe4f96d01a740dd58) )
362362
363   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
363   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
364364   ROM_LOAD32_WORD( "821k04.k2",  0x000000, 0x080000, CRC(00e0291b) SHA1(39d5db6cf36826e47cdf5308eff9bfa8afc82050) )  /* sprites */
365365   ROM_LOAD32_WORD( "821k05.k8",  0x000002, 0x080000, CRC(e09ea05d) SHA1(50ac9a2117ce63fe774c48d769ec445a83f1269e) )
366366
trunk/src/mame/drivers/wyvernf0.c
r31373r31374
66
77Typical Taito mid-80s hardware but with dual video outputs.
88
9Sound board:   Z80, 2 x YM2149, OKI M5232
10CPU board:      Z80, ROM and RAM, 68705P5 MCU (protected)
11OBJ board:      ROMs and RAM
12Video board:   ROMs and RAM, 4 x Fujitsu MB112S146 (also used on arkanoid, lkage)
9Sound board:    Z80, 2 x YM2149, OKI M5232
10CPU board:      Z80, ROM and RAM, 68705P5 MCU (protected)
11OBJ board:      ROMs and RAM
12Video board:    ROMs and RAM, 4 x Fujitsu MB112S146 (also used on arkanoid, lkage)
1313
1414The rest is just common logic, there's no custom chips.
1515
r31373r31374
9999
100100    Video
101101
102   Note:   if MAME_DEBUG is defined, pressing Z with:
102    Note:   if MAME_DEBUG is defined, pressing Z with:
103103
104               Q       Shows the background tilemap
105               W       Shows the foreground tilemap
106               A       Shows the background sprites
107               S       Shows the foreground sprites
104                    Q       Shows the background tilemap
105                    W       Shows the foreground tilemap
106                    A       Shows the background sprites
107                    S       Shows the foreground sprites
108108
109         Keys can be used together!
109            Keys can be used together!
110110
111111***************************************************************************/
112112
r31373r31374
191191      int sx, sy, code, color;
192192
193193      sx = sprram[offs + 3] - ((sprram[offs + 2] & 0x80) << 1);
194      sy = 256 - 8 - sprram[offs + 0] - 23;   // center player sprite: 256 - 8 - 0x71 + dy = 256/2-32/2 -> dy = -23
194      sy = 256 - 8 - sprram[offs + 0] - 23;   // center player sprite: 256 - 8 - 0x71 + dy = 256/2-32/2 -> dy = -23
195195
196      int flipx = sprram[offs + 2] & 0x40;   // maybe
196      int flipx = sprram[offs + 2] & 0x40;    // maybe
197197      int flipy = sprram[offs + 1] & 0x80;
198198
199199      if (flip_screen_x())
r31373r31374
262262   bitmap.fill(0, cliprect);
263263
264264   // background monitor
265   if (layers_ctrl & 1)   m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
266   if (layers_ctrl & 4)   draw_sprites(bitmap, cliprect, false);
265   if (layers_ctrl & 1)    m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
266   if (layers_ctrl & 4)    draw_sprites(bitmap, cliprect, false);
267267
268268   // foreground monitor
269   if (layers_ctrl & 8)   draw_sprites(bitmap, cliprect, true);
270   if (layers_ctrl & 2)   m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
269   if (layers_ctrl & 8)    draw_sprites(bitmap, cliprect, true);
270   if (layers_ctrl & 2)    m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
271271
272272   return 0;
273273}
r31373r31374
283283   int result = 0;
284284
285285   if ((m_mcu_val & 0x73) == 0x73)
286      result = 0x42;   // at boot
286      result = 0x42;  // at boot
287287
288288   return result;
289289}
r31373r31374
404404
405405   AM_RANGE(0xd800, 0xdbff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
406406
407   AM_RANGE(0xdc00, 0xdc00) AM_WRITENOP   // irq ack?
407   AM_RANGE(0xdc00, 0xdc00) AM_WRITENOP    // irq ack?
408408ADDRESS_MAP_END
409409
410410static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, wyvernf0_state )
r31373r31374
431431***************************************************************************/
432432
433433static INPUT_PORTS_START( wyvernf0 )
434   PORT_START("DSW1")   // d600 -> 800c
434   PORT_START("DSW1")  // d600 -> 800c
435435   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )
436436   PORT_DIPSETTING(    0x00, "?? 0" )
437437   PORT_DIPSETTING(    0x01, "?? 1" )
r31373r31374
453453   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
454454   PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
455455
456   PORT_START("DSW2")   // d601 -> 800d
456   PORT_START("DSW2")  // d601 -> 800d
457457   PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) )
458458   PORT_DIPSETTING(    0x0f, DEF_STR( 9C_1C ) )
459459   PORT_DIPSETTING(    0x0e, DEF_STR( 8C_1C ) )
r31373r31374
489489   PORT_DIPSETTING(    0x60, DEF_STR( 1C_7C ) )
490490   PORT_DIPSETTING(    0x70, DEF_STR( 1C_8C ) )
491491
492   PORT_START("DSW3")    // d602 -> 800e
492   PORT_START("DSW3") // d602 -> 800e
493493   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Unknown ) )
494494   PORT_DIPSETTING(    0x00, "0" )
495495   PORT_DIPSETTING(    0x01, "1" )
496496   PORT_DIPSETTING(    0x02, "2" )
497497   PORT_DIPSETTING(    0x03, "3" )
498   PORT_DIPUNKNOWN( 0x04, 0x04 )   // *
498   PORT_DIPUNKNOWN( 0x04, 0x04 )   // *
499499   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) ) /* Music at every other title screen */
500500   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
501501   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r31373r31374
512512   PORT_DIPSETTING(    0x00, "1" )
513513   PORT_DIPSETTING(    0x80, "2" )
514514
515   PORT_START("SYSTEM")   // d603 -> 800f / 8023
515   PORT_START("SYSTEM")    // d603 -> 800f / 8023
516516   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1         )
517517   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2         )
518518   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1       )
r31373r31374
522522   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN         )
523523   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN         )
524524
525   PORT_START("JOY1")   // d604 -> 8010 / 8024
525   PORT_START("JOY1")  // d604 -> 8010 / 8024
526526   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
527527   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
528528   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  ) PORT_PLAYER(1)
r31373r31374
532532   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
533533   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
534534
535   PORT_START("FIRE1")   // d605 -> 8011 / 8025
535   PORT_START("FIRE1") // d605 -> 8011 / 8025
536536   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
537537   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
538538   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
r31373r31374
542542   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
543543   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
544544
545   PORT_START("JOY2")   // d606 -> 8012 / 8026
545   PORT_START("JOY2")  // d606 -> 8012 / 8026
546546   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
547547   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
548548   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  ) PORT_PLAYER(2)
r31373r31374
552552   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
553553   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
554554
555   PORT_START("FIRE2")   // d607 -> 8013 / 8027
555   PORT_START("FIRE2") // d607 -> 8013 / 8027
556556   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
557557   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
558558   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN        )
r31373r31374
633633   MCFG_CPU_PROGRAM_MAP(sound_map)
634634   MCFG_CPU_PERIODIC_INT_DRIVER(wyvernf0_state, irq0_line_hold, 60*2)  // IRQ generated by ??? (drives music tempo), NMI by main cpu
635635
636//   MCFG_CPU_ADD("mcu", M68705, 4000000) // ?
637//   MCFG_CPU_PROGRAM_MAP(mcu_map)
636//  MCFG_CPU_ADD("mcu", M68705, 4000000) // ?
637//  MCFG_CPU_PROGRAM_MAP(mcu_map)
638638
639//   MCFG_QUANTUM_TIME(attotime::from_hz(6000)) // 100 CPU slices per second to synchronize between the MCU and the main CPU
639//  MCFG_QUANTUM_TIME(attotime::from_hz(6000)) // 100 CPU slices per second to synchronize between the MCU and the main CPU
640640
641641   MCFG_MACHINE_START_OVERRIDE(wyvernf0_state,wyvernf0)
642642   MCFG_MACHINE_RESET_OVERRIDE(wyvernf0_state,wyvernf0)
r31373r31374
669669   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
670670
671671   // music
672   MCFG_SOUND_ADD("msm", MSM5232, 2000000)   // ?
672   MCFG_SOUND_ADD("msm", MSM5232, 2000000) // ?
673673   MCFG_MSM5232_SET_CAPACITORS(0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6, 0.39e-6) /* default 0.39 uF capacitors (not verified) */
674674   MCFG_SOUND_ROUTE(0, "mono", 1.0)    // pin 28  2'-1
675675   MCFG_SOUND_ROUTE(1, "mono", 1.0)    // pin 29  4'-1
trunk/src/mame/drivers/lucky74.c
r31373r31374
14651465
14661466   MCFG_NVRAM_ADD_0FILL("nvram")
14671467
1468   // Each 82C255 behaves like 2x 8255 (in mode 0). Since MAME doesn't support it yet, I replaced
1468   // Each 82C255 behaves like 2x 8255 (in mode 0). Since MAME doesn't support it yet, I replaced
14691469   // both 82C255 with 4x 8255...
14701470   MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0)
14711471   MCFG_I8255_IN_PORTA_CB(IOPORT("IN0"))
trunk/src/mame/drivers/blktiger.c
r31373r31374
600600   UINT8 *src = memregion("audiocpu")->base();
601601   int len = 0x8000;
602602   dynamic_buffer buffer(len);
603   
603
604604   for (int i = 0; i < len; i++)
605605   {
606606      int addr;
607     
607
608608      addr = BITSWAP16(i, 15,14,13,12,11,10,9,8, 3,4,5,6, 7,2,1,0);
609609      buffer[i] = src[addr];
610610
trunk/src/mame/drivers/coinmstr.c
r31373r31374
821821INPUT_PORTS_END
822822
823823static INPUT_PORTS_START( supnudg2 )    /* need to find the button 'B' to be playable */
824        PORT_INCLUDE ( trailblz )
824      PORT_INCLUDE ( trailblz )
825825
826826   PORT_MODIFY("PIA0.A")
827827   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )  PORT_NAME("1 Pound (5 credits)")    // coin x 5
trunk/src/mame/drivers/magicard.c
r31373r31374
512512         UINT8 vdisp;
513513         vdisp = m_screen->vpos() < 256;
514514
515             return (m_pcab_vregs[offset] & 0xff7f) | vdisp<<7; //TODO
515         return (m_pcab_vregs[offset] & 0xff7f) | vdisp<<7; //TODO
516516      }
517517   }
518518
trunk/src/mame/drivers/nbmj9195.c
r31373r31374
148148         & ioport("KEY3")->read() & ioport("KEY4")->read());
149149      break;
150150   }
151   
151
152152   return 0xff;
153153}
154154
r31373r31374
27962796   MCFG_TMPZ84C011_PORTB_WRITE_CB(WRITE8(nbmj9195_state, soundcpu_dac1_w)) \
27972797   MCFG_TMPZ84C011_PORTC_WRITE_CB(WRITE8(nbmj9195_state, soundcpu_dac2_w)) \
27982798   MCFG_TMPZ84C011_PORTD_READ_CB(READ8(nbmj9195_state, soundcpu_portd_r)) \
2799   MCFG_TMPZ84C011_PORTE_WRITE_CB(WRITE8(nbmj9195_state, soundcpu_porte_w)) \
2800
2799   MCFG_TMPZ84C011_PORTE_WRITE_CB(WRITE8(nbmj9195_state, soundcpu_porte_w))
28012800#define MSCOUTM_TMZ84C011_SOUND_PORTS \
28022801   MCFG_TMPZ84C011_PORTA_WRITE_CB(WRITE8(nbmj9195_state, soundcpu_porta_w)) \
28032802   MCFG_TMPZ84C011_PORTB_WRITE_CB(WRITE8(nbmj9195_state, soundcpu_dac2_w)) \
r31373r31374
28122811   MCFG_TMPZ84C011_PORTB_READ_CB(READ8(nbmj9195_state, mscoutm_cpu_portb_r)) \
28132812   MCFG_TMPZ84C011_PORTC_READ_CB(READ8(nbmj9195_state, mscoutm_cpu_portc_r)) \
28142813   MCFG_TMPZ84C011_PORTD_WRITE_CB(WRITE8(nbmj9195_state, mscoutm_cpu_portd_w)) \
2815   MCFG_TMPZ84C011_PORTE_WRITE_CB(WRITE8(nbmj9195_state, mscoutm_cpu_porte_w)) \
2814   MCFG_TMPZ84C011_PORTE_WRITE_CB(WRITE8(nbmj9195_state, mscoutm_cpu_porte_w))
28162815
2817
28182816#define OTHERS_TMZ84C011_MAIN_PORTS \
28192817   MCFG_TMPZ84C011_PORTA_READ_CB(READ8(nbmj9195_state, others_cpu_porta_r)) \
28202818   MCFG_TMPZ84C011_PORTB_READ_CB(READ8(nbmj9195_state, others_cpu_portb_r)) \
28212819   MCFG_TMPZ84C011_PORTC_READ_CB(READ8(nbmj9195_state, others_cpu_portc_r)) \
28222820   MCFG_TMPZ84C011_PORTC_WRITE_CB(WRITE8(nbmj9195_state, others_cpu_portc_w)) \
28232821   MCFG_TMPZ84C011_PORTD_WRITE_CB(WRITE8(nbmj9195_state, others_cpu_portd_w)) \
2824   MCFG_TMPZ84C011_PORTE_WRITE_CB(WRITE8(nbmj9195_state, others_cpu_porte_w)) \
2822   MCFG_TMPZ84C011_PORTE_WRITE_CB(WRITE8(nbmj9195_state, others_cpu_porte_w))
28252823
2826
28272824static MACHINE_CONFIG_START( NBMJDRV1_base, nbmj9195_state )
28282825
28292826   /* basic machine hardware */
trunk/src/mame/drivers/tatsumi.c
r31373r31374
491491   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
492492
493493   PORT_START("DSW") /* Verified by Manual & in Game service menu */
494   PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( Game_Time ) )   PORT_DIPLOCATION("SW-1:1,2")
494   PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( Game_Time ) )    PORT_DIPLOCATION("SW-1:1,2")
495495   PORT_DIPSETTING(      0x0003, "Shortest" )
496496   PORT_DIPSETTING(      0x0002, "Short" )
497497   PORT_DIPSETTING(      0x0000, DEF_STR( Medium ) )
498498   PORT_DIPSETTING(      0x0001, "Long" )
499   PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW-1:3,4")
499   PORT_DIPNAME( 0x000c, 0x0000, DEF_STR( Difficulty ) )   PORT_DIPLOCATION("SW-1:3,4")
500500   PORT_DIPSETTING(      0x0004, DEF_STR( Easy ) )
501501   PORT_DIPSETTING(      0x0000, DEF_STR( Medium ) )
502502   PORT_DIPSETTING(      0x0008, DEF_STR( Hard ) )
503503   PORT_DIPSETTING(      0x000c, DEF_STR( Hardest ) )
504   PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Demo_Sounds ) )   PORT_DIPLOCATION("SW-1:5")
504   PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Demo_Sounds ) )  PORT_DIPLOCATION("SW-1:5")
505505   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
506506   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
507   PORT_DIPNAME( 0x0020, 0x0000, DEF_STR( Language ) )   PORT_DIPLOCATION("SW-1:6")
507   PORT_DIPNAME( 0x0020, 0x0000, DEF_STR( Language ) ) PORT_DIPLOCATION("SW-1:6")
508508   PORT_DIPSETTING(      0x0020, DEF_STR( Japanese ) )
509509   PORT_DIPSETTING(      0x0000, DEF_STR( English ) )
510   PORT_DIPNAME( 0x0040, 0x0000, "Stage 5 Continue" )   PORT_DIPLOCATION("SW-1:7")
510   PORT_DIPNAME( 0x0040, 0x0000, "Stage 5 Continue" )  PORT_DIPLOCATION("SW-1:7")
511511   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
512512   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
513   PORT_DIPNAME( 0x0080, 0x0000, "Output Mode" )      PORT_DIPLOCATION("SW-1:8")
513   PORT_DIPNAME( 0x0080, 0x0000, "Output Mode" )       PORT_DIPLOCATION("SW-1:8")
514514   PORT_DIPSETTING(      0x0000, "A (Light)" )
515515   PORT_DIPSETTING(      0x0080, "B (Vibration)" )
516   PORT_DIPNAME( 0x0700, 0x0000, DEF_STR( Coin_A ) )   PORT_DIPLOCATION("SW-2:1,2,3")
516   PORT_DIPNAME( 0x0700, 0x0000, DEF_STR( Coin_A ) )   PORT_DIPLOCATION("SW-2:1,2,3")
517517   PORT_DIPSETTING(      0x0600, DEF_STR( 6C_1C ) )
518518   PORT_DIPSETTING(      0x0500, DEF_STR( 5C_1C ) )
519519   PORT_DIPSETTING(      0x0400, DEF_STR( 4C_1C ) )
r31373r31374
522522   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
523523   PORT_DIPSETTING(      0x0100, DEF_STR( 1C_2C ) )
524524   PORT_DIPSETTING(      0x0700, DEF_STR( Free_Play ) )
525   PORT_DIPNAME( 0x3800, 0x0000, DEF_STR( Coin_B ) )   PORT_DIPLOCATION("SW-2:4,5,6")
525   PORT_DIPNAME( 0x3800, 0x0000, DEF_STR( Coin_B ) )   PORT_DIPLOCATION("SW-2:4,5,6")
526526   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
527527   PORT_DIPSETTING(      0x0800, DEF_STR( 1C_2C ) )
528528   PORT_DIPSETTING(      0x1000, DEF_STR( 1C_3C ) )
r31373r31374
531531   PORT_DIPSETTING(      0x2800, DEF_STR( 1C_6C ) )
532532   PORT_DIPSETTING(      0x3000, DEF_STR( 1C_7C ) )
533533   PORT_DIPSETTING(      0x3800, DEF_STR( Free_Play ) )
534   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) )   PORT_DIPLOCATION("SW-2:7") /* Manual only shows nothing for this one */
534   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) )  PORT_DIPLOCATION("SW-2:7") /* Manual only shows nothing for this one */
535535   PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
536536   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
537   PORT_DIPNAME( 0x8000, 0x8000, "Hardware Test Mode" )   PORT_DIPLOCATION("SW-2:8") /* Manual only shows nothing for this one */
537   PORT_DIPNAME( 0x8000, 0x8000, "Hardware Test Mode" )    PORT_DIPLOCATION("SW-2:8") /* Manual only shows nothing for this one */
538538   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
539539   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
540540INPUT_PORTS_END
trunk/src/mame/drivers/csplayh5.c
r31373r31374
6060   DECLARE_READ16_MEMBER(test_r);
6161   DECLARE_READ8_MEMBER(csplayh5_sound_r);
6262   DECLARE_WRITE8_MEMBER(csplayh5_soundclr_w);
63   
63
6464   DECLARE_READ8_MEMBER(soundcpu_portd_r);
6565   DECLARE_WRITE8_MEMBER(soundcpu_porta_w);
6666   DECLARE_WRITE8_MEMBER(soundcpu_dac2_w);
r31373r31374
460460   MCFG_CPU_ADD("maincpu",M68000,16000000) /* TMP68301-16 */
461461   MCFG_CPU_PROGRAM_MAP(csplayh5_map)
462462   MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback)
463   
463
464464   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", csplayh5_state, csplayh5_irq, "screen", 0, 1)
465465
466466   MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)
trunk/src/mame/drivers/1942.c
r31373r31374
8484
8585   SOLVER(Solver, 48000)
8686   ANALOG_INPUT(V5, 5)
87    PARAM(Solver.ACCURACY, 1e-6)
88    PARAM(Solver.GS_LOOPS, 6)
89    PARAM(Solver.SOR_FACTOR, 1.0)
90    //PARAM(Solver.DYNAMIC_TS, 1)
91    //PARAM(Solver.LTE, 5e-8)
87   PARAM(Solver.ACCURACY, 1e-6)
88   PARAM(Solver.GS_LOOPS, 6)
89   PARAM(Solver.SOR_FACTOR, 1.0)
90   //PARAM(Solver.DYNAMIC_TS, 1)
91   //PARAM(Solver.LTE, 5e-8)
9292
9393   /* AY 8910 internal resistors */
9494
r31373r31374
143143
144144   NET_C(CC6.1, VR.2)
145145   NET_C(CC6.2, R1.1)
146    CAP(CC3, 220e-6)
147    NET_C(R1.2, CC3.1)
148    NET_C(CC3.2, GND)
146   CAP(CC3, 220e-6)
147   NET_C(R1.2, CC3.1)
148   NET_C(CC3.2, GND)
149149
150150NETLIST_END()
151151
r31373r31374
556556
557557   MCFG_SOUND_ADD("ay1", AY8910, AUDIO_CLOCK)  /* 1.5 MHz */
558558   MCFG_AY8910_OUTPUT_TYPE(AY8910_RESISTOR_OUTPUT)
559    MCFG_AY8910_RES_LOADS(10000.0, 10000.0, 10000.0)
560   
559   MCFG_AY8910_RES_LOADS(10000.0, 10000.0, 10000.0)
560
561561   MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 0)
562562   MCFG_SOUND_ROUTE_EX(1, "snd_nl", 1.0, 1)
563563   MCFG_SOUND_ROUTE_EX(2, "snd_nl", 1.0, 2)
564564
565565   MCFG_SOUND_ADD("ay2", AY8910, AUDIO_CLOCK)  /* 1.5 MHz */
566566   MCFG_AY8910_OUTPUT_TYPE(AY8910_RESISTOR_OUTPUT)
567    MCFG_AY8910_RES_LOADS(10000.0, 10000.0, 10000.0)
568   
567   MCFG_AY8910_RES_LOADS(10000.0, 10000.0, 10000.0)
568
569569   MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 3)
570570   MCFG_SOUND_ROUTE_EX(1, "snd_nl", 1.0, 4)
571571   MCFG_SOUND_ROUTE_EX(2, "snd_nl", 1.0, 5)
572572
573573   /* NETLIST configuration using internal AY8910 resistor values */
574574
575    /* Minimize resampling between ay8910 and netlist */
575   /* Minimize resampling between ay8910 and netlist */
576576   MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, AUDIO_CLOCK / 8 / 2)
577577   MCFG_NETLIST_SETUP(nl_1942)
578578   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 5.0)
r31373r31374
921921GAME( 1984, 1942,     0,    1942, 1942, _1942_state, 1942, ROT270, "Capcom", "1942 (Revision B)", GAME_SUPPORTS_SAVE )
922922GAME( 1984, 1942a,    1942, 1942, 1942, _1942_state, 1942, ROT270, "Capcom", "1942 (Revision A)", GAME_SUPPORTS_SAVE )
923923GAME( 1984, 1942abl,  1942, 1942, 1942, _1942_state, 1942, ROT270, "bootleg", "1942 (Revision A, bootleg)", GAME_SUPPORTS_SAVE ) // data is the same as 1942a set, different rom format
924GAME( 198?, 1942h,    1942, 1942, 1942, _1942_state, 1942, ROT270, "hack (Two Bit Score?)", "42", GAME_SUPPORTS_SAVE )
924GAME( 198?, 1942h,    1942, 1942, 1942, _1942_state, 1942, ROT270, "hack (Two Bit Score?)", "42", GAME_SUPPORTS_SAVE )
925925GAME( 1984, 1942b,    1942, 1942, 1942, _1942_state, 1942, ROT270, "Capcom", "1942 (First Version)", GAME_SUPPORTS_SAVE )
926926GAME( 1985, 1942w,    1942, 1942, 1942, _1942_state, 1942, ROT270, "Capcom (Williams Electronics license)", "1942 (Williams Electronics license)", GAME_SUPPORTS_SAVE ) /* Based on 1942 (Revision B) */
927927GAME( 1984, 1942p,    1942, 1942p,1942p,_1942_state, 1942, ROT270, "Capcom", "1942 (prototype)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/dbz.c
r31373r31374
350350
351351   MCFG_DEVICE_ADD("k053246", K053246, 0)
352352   MCFG_K053246_CB(dbz_state, sprite_callback)
353   MCFG_K053246_CONFIG("gfx2", 3, NORMAL_PLANE_ORDER, -87, 32)   // or -52, 16?
353   MCFG_K053246_CONFIG("gfx2", 3, NORMAL_PLANE_ORDER, -87, 32) // or -52, 16?
354354   MCFG_K053246_GFXDECODE("gfxdecode")
355355   MCFG_K053246_PALETTE("palette")
356356
trunk/src/mame/drivers/phoenix.c
r31373r31374
472472   MCFG_TMS36XX_TYPE(TMS3615)
473473   MCFG_TMS36XX_DECAY_TIMES(0.33, 0.33, 0, 0.33, 0, 0.33)
474474   // NOTE: it's unknown if the TMS3615 mixes more than one voice internally.
475   // A wav taken from Pop Flamer sounds like there are at least no 'odd'
475   // A wav taken from Pop Flamer sounds like there are at least no 'odd'
476476   // harmonics (5 1/3' and 2 2/3')
477477   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
478478
r31373r31374
11441144   ROM_LOAD( "9 2716.bin",     0x0000, 0x0800, CRC(85866607) SHA1(cd240bd056f761b2f9e2142049434f02cae3e315) )
11451145   ROM_LOAD( "10 2716.bin",    0x0800, 0x0800, CRC(a841d511) SHA1(8349008ab1d8ef08775b54170c37deb1d391fffc) )
11461146
1147   ROM_REGION( 0x0200, "proms", 0 ) // not present in dump, assuming to be the same, matches screenshots, note reverse order to most sets, same as pleiadsb2.
1147   ROM_REGION( 0x0200, "proms", 0 ) // not present in dump, assuming to be the same, matches screenshots, note reverse order to most sets, same as pleiadsb2.
11481148   ROM_LOAD( "7611-5.26",    0x0000, 0x0100, CRC(7a1bcb1e) SHA1(bdfab316ea26e2063879e7aa78b6ae2b55eb95c8) )   /* palette low bits */
11491149   ROM_LOAD( "7611-5.33",    0x0100, 0x0100, CRC(e38eeb83) SHA1(252880d80425b2e697146e76efdc6cb9f3ba0378) )   /* palette high bits */
11501150ROM_END
trunk/src/mame/drivers/play_5.c
r31373r31374
216216   ROM_LOAD("fldrcpu2.rom", 0x2000, 0x2000, CRC(6ff2b276) SHA1(040b614f0b0587521ef5550b5587b94a7f3f178b))
217217   ROM_RELOAD(0x6000, 0x2000)
218218   ROM_RELOAD(0xa000, 0x2000)
219   ROM_RELOAD(0xe000, 0x2000)   
219   ROM_RELOAD(0xe000, 0x2000)
220220   ROM_REGION(0x10000, "cpu2", 0)
221221   ROM_LOAD("fdsndu3.rom", 0x0000, 0x2000, NO_DUMP)
222222   ROM_RELOAD(0x4000, 0x2000)
r31373r31374
244244   ROM_LOAD("skflcpu2.rom", 0x2000, 0x2000, CRC(ffc497aa) SHA1(3e88539ae1688322b9268f502d8ca41cffb28df3))
245245   ROM_RELOAD(0x6000, 0x2000)
246246   ROM_RELOAD(0xa000, 0x2000)
247   ROM_RELOAD(0xe000, 0x2000)   
247   ROM_RELOAD(0xe000, 0x2000)
248248   ROM_REGION(0x10000, "cpu2", 0)
249249   ROM_LOAD("sfsndu3.rom", 0x0000, 0x2000, NO_DUMP)
250250   ROM_RELOAD(0x4000, 0x2000)
trunk/src/mame/drivers/ecoinf2.c
r31373r31374
527527   MCFG_I8255_OUT_PORTC_CB(WRITE8(ecoinf2_state, ppi8255_ic24_write_c_inhibits))
528528
529529   MCFG_DEVICE_ADD("ic22_inpt", I8255, 0)
530   MCFG_I8255_IN_PORTA_CB(READ8(ecoinf2_state, ppi8255_ic22_read_a_levels))   // manual says level switches
530   MCFG_I8255_IN_PORTA_CB(READ8(ecoinf2_state, ppi8255_ic22_read_a_levels))    // manual says level switches
531531   MCFG_I8255_IN_PORTB_CB(READ8(ecoinf2_state, ppi8255_ic22_read_b_coins))
532   MCFG_I8255_IN_PORTC_CB(READ8(ecoinf2_state, ppi8255_ic22_read_c_misc))   // 0x20 appears to be meter power
532   MCFG_I8255_IN_PORTC_CB(READ8(ecoinf2_state, ppi8255_ic22_read_c_misc))  // 0x20 appears to be meter power
533533
534534   MCFG_DEVICE_ADD("ic23_reel", I8255, 0)
535535   MCFG_I8255_OUT_PORTA_CB(WRITE8(ecoinf2_state, ppi8255_ic23_write_a_reel01))
536536   MCFG_I8255_OUT_PORTB_CB(WRITE8(ecoinf2_state, ppi8255_ic23_write_b_reel23))
537   MCFG_I8255_IN_PORTC_CB(READ8(ecoinf2_state, ppi8255_ic23_read_c_key))   // optos and keys
537   MCFG_I8255_IN_PORTC_CB(READ8(ecoinf2_state, ppi8255_ic23_read_c_key))   // optos and keys
538538
539539   MCFG_DEVICE_ADD("ic13_leds", I8255, 0)
540540   MCFG_I8255_OUT_PORTA_CB(WRITE8(ecoinf2_state, ppi8255_ic13_write_a_strobedat0))
trunk/src/mame/drivers/vectrex.c
r31373r31374
135135   ROM_SYSTEM_BIOS(1, "bios1", "exec rom intl 284001-1")
136136   ROMX_LOAD("exec_rom_intl_284001-1.bin", 0xe000, 0x2000, CRC(6d2bd167) SHA1(77a220d5d98846b606dff608f7b5d00183ec3bab), ROM_BIOS(2) )
137137
138//   The following fastboots are listed here for reference and documentation
139//   ROM_SYSTEM_BIOS(2, "bios2", "us-fastboot hack")
140//   ROMX_LOAD("us-fastboot.bin", 0xe000, 0x2000, CRa6e4dac4) SHA1(e0900be6d6858b985fd7f0999d864b2fceaf01a1), ROM_BIOS(3) )
141//   ROM_SYSTEM_BIOS(3, "bios3", "intl-fastboot hack")
142//   ROMX_LOAD("intl-fastboot.bin", 0xe000, 0x2000, CRC(71dcf0f4) SHA1(2a257c5111f5cee841bd14acaa9df6496aaf3d8b), ROM_BIOS(4) )
138//  The following fastboots are listed here for reference and documentation
139//  ROM_SYSTEM_BIOS(2, "bios2", "us-fastboot hack")
140//  ROMX_LOAD("us-fastboot.bin", 0xe000, 0x2000, CRa6e4dac4) SHA1(e0900be6d6858b985fd7f0999d864b2fceaf01a1), ROM_BIOS(3) )
141//  ROM_SYSTEM_BIOS(3, "bios3", "intl-fastboot hack")
142//  ROMX_LOAD("intl-fastboot.bin", 0xe000, 0x2000, CRC(71dcf0f4) SHA1(2a257c5111f5cee841bd14acaa9df6496aaf3d8b), ROM_BIOS(4) )
143143
144144ROM_END
145145
trunk/src/mame/drivers/darkseal.c
r31373r31374
246246
247247   MCFG_DEVICE_ADD("tilegen1", DECO16IC, 0)
248248   MCFG_DECO16IC_SPLIT(0)
249   MCFG_DECO16IC_WIDTH12(3)    // both these tilemaps need to be twice the y size of usual!
249   MCFG_DECO16IC_WIDTH12(3)    // both these tilemaps need to be twice the y size of usual!
250250   MCFG_DECO16IC_PF1_TRANS_MASK(0x0f)
251251   MCFG_DECO16IC_PF2_TRANS_MASK(0x0f)
252252   MCFG_DECO16IC_PF1_COL_BANK(0x00)
trunk/src/mame/drivers/icecold.c
r31373r31374
352352
353353   MCFG_DEVICE_ADD("i8279", I8279, XTAL_6MHz/4)
354354   MCFG_I8279_OUT_IRQ_CB(DEVWRITELINE("pia0", pia6821_device, cb1_w)) // irq
355   MCFG_I8279_OUT_SL_CB(WRITE8(icecold_state, scanlines_w))       // scan SL lines
355   MCFG_I8279_OUT_SL_CB(WRITE8(icecold_state, scanlines_w))        // scan SL lines
356356   MCFG_I8279_OUT_DISP_CB(WRITE8(icecold_state, digit_w))         // display A&B
357   MCFG_I8279_IN_RL_CB(READ8(icecold_state, kbd_r))               // kbd RL lines
358   
357   MCFG_I8279_IN_RL_CB(READ8(icecold_state, kbd_r))                // kbd RL lines
358
359359   // 30Hz signal from CH-C of ay0
360360   MCFG_TIMER_DRIVER_ADD_PERIODIC("sint_timer", icecold_state, icecold_sint_timer, attotime::from_hz(30))
361361
trunk/src/mame/drivers/spy.c
r31373r31374
499499   MCFG_CPU_VBLANK_INT_DRIVER("screen", spy_state,  spy_interrupt)
500500
501501   MCFG_CPU_ADD("audiocpu", Z80, 3579545)
502   MCFG_CPU_PROGRAM_MAP(spy_sound_map)   /* nmi by the sound chip */
502   MCFG_CPU_PROGRAM_MAP(spy_sound_map) /* nmi by the sound chip */
503503
504504   /* video hardware */
505505   MCFG_SCREEN_ADD("screen", RASTER)
r31373r31374
562562   ROM_LOAD32_WORD( "857b09.bin",   0x00000, 0x40000, CRC(b8780966) SHA1(6c255f1e4d1398fa9010a1ae0f5172dc524df109) )
563563   ROM_LOAD32_WORD( "857b08.bin",   0x00002, 0x40000, CRC(3e4d8d50) SHA1(70f45a725bf1e9d15285ffb6b280945f7ce7faf0) )
564564
565   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
565   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
566566   ROM_LOAD32_WORD( "857b06.bin",   0x00000, 0x80000, CRC(7b515fb1) SHA1(3830649d47964940023760b76e2bf94bb9163f23) )
567567   ROM_LOAD32_WORD( "857b05.bin",   0x00002, 0x80000, CRC(27b0f73b) SHA1(6b6a3da11c3005e3a62e6280818c18ae2ea31800) )
568568
r31373r31374
589589   ROM_LOAD32_WORD( "857b09.bin",   0x00000, 0x40000, CRC(b8780966) SHA1(6c255f1e4d1398fa9010a1ae0f5172dc524df109) )
590590   ROM_LOAD32_WORD( "857b08.bin",   0x00002, 0x40000, CRC(3e4d8d50) SHA1(70f45a725bf1e9d15285ffb6b280945f7ce7faf0) )
591591
592   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
593   ROM_LOAD32_WORD( "857b06.bin",   0x00000, 0x80000, CRC(7b515fb1) SHA1(3830649d47964940023760b76e2bf94bb9163f23) ) 
592   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
593   ROM_LOAD32_WORD( "857b06.bin",   0x00000, 0x80000, CRC(7b515fb1) SHA1(3830649d47964940023760b76e2bf94bb9163f23) )
594594   ROM_LOAD32_WORD( "857b05.bin",   0x00002, 0x80000, CRC(27b0f73b) SHA1(6b6a3da11c3005e3a62e6280818c18ae2ea31800) )
595595
596596   ROM_REGION( 0x0200, "proms", 0 )
trunk/src/mame/drivers/bagman.c
r31373r31374
443443   MCFG_TMSPROM_STOP_BIT(7)        /* bit # of stop */
444444   MCFG_TMSPROM_PDC_CB(DEVWRITELINE("tms", tms5110_device, pdc_w))        /* tms pdc func */
445445   MCFG_TMSPROM_CTL_CB(DEVWRITE8("tms", tms5110_device, ctl_w))      /* tms ctl func */
446   
446
447447   /* sound hardware */
448448   MCFG_SPEAKER_STANDARD_MONO("mono")
449449
trunk/src/mame/drivers/taito_l.c
r31373r31374
18611861   MCFG_CPU_ADD("maincpu", Z80, XTAL_13_33056MHz/2)    /* verified freq on pin122 of TC0090LVC cpu */
18621862   MCFG_CPU_PROGRAM_MAP(kurikint_map)
18631863   MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(taitol_state,irq_callback)
1864   
1864
18651865   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", taitol_state, vbl_interrupt, "screen", 0, 1)
18661866
18671867   MCFG_CPU_ADD("audiocpu", Z80, XTAL_12MHz/3)        /* verified on pcb */
trunk/src/mame/drivers/chanbara.c
r31373r31374
409409
410410   MCFG_SOUND_ADD("ymsnd", YM2203, 12000000/8)
411411   MCFG_YM2203_IRQ_HANDLER(WRITELINE(chanbara_state, sound_irq))
412   
413   
412
413
414414   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(chanbara_state, chanbara_ay_out_0_w))
415415   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(chanbara_state, chanbara_ay_out_1_w))
416416   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
trunk/src/mame/drivers/gstriker.c
r31373r31374
272272
273273static ADDRESS_MAP_START( gstriker_map, AS_PROGRAM, 16, gstriker_state )
274274   AM_RANGE(0x000000, 0x0fffff) AM_ROM
275   AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device,  vram_r, vram_w )
275   AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device,  vram_r, vram_w )
276276   AM_RANGE(0x140000, 0x141fff) AM_RAM AM_SHARE("cg10103_m_vram")
277   AM_RANGE(0x180000, 0x180fff) AM_DEVREADWRITE("texttilemap", vs920a_text_tilemap_device,  vram_r, vram_w )
278   AM_RANGE(0x181000, 0x181fff) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device,  line_r, line_w )
277   AM_RANGE(0x180000, 0x180fff) AM_DEVREADWRITE("texttilemap", vs920a_text_tilemap_device,  vram_r, vram_w )
278   AM_RANGE(0x181000, 0x181fff) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device,  line_r, line_w )
279279   AM_RANGE(0x1c0000, 0x1c0fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_MIRROR(0x00f000)
280280
281   AM_RANGE(0x200000, 0x20000f) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device,  regs_r, regs_w )
281   AM_RANGE(0x200000, 0x20000f) AM_DEVREADWRITE("zoomtilemap", mb60553_zooming_tilemap_device,  regs_r, regs_w )
282282   AM_RANGE(0x200040, 0x20005f) AM_RAM AM_SHARE("mixerregs1")
283283   AM_RANGE(0x200060, 0x20007f) AM_RAM AM_SHARE("mixerregs2")
284284   AM_RANGE(0x200080, 0x200081) AM_READ_PORT("P1")
r31373r31374
523523   MCFG_CPU_IO_MAP(sound_io_map)
524524
525525   MCFG_SCREEN_ADD("screen", RASTER)
526//   MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
526//  MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
527527   MCFG_SCREEN_REFRESH_RATE(60)
528528   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(5000) /* hand-tuned, it needs a bit */)
529529   MCFG_SCREEN_SIZE(64*8, 64*8)
trunk/src/mame/drivers/mpu4vid.c
r31373r31374
537537   {
538538      UINT16 col = pal.clut[pal.addr >> 1];
539539
540/*      if ((pal.addr & 1) == 0)
541         return col & 0xff;
542      else
543         return col >> 8;
544         */
545         
540/*      if ((pal.addr & 1) == 0)
541            return col & 0xff;
542        else
543            return col >> 8;
544            */
545
546546   return col;
547547   }
548548   else
r31373r31374
604604         break;
605605      }
606606
607      default:
607      default:
608608      {
609609         popmessage("Bt471: Unhandled write access (offset:%x, data:%x)", offset, data);
610610      }
trunk/src/mame/drivers/chqflag.c
r31373r31374
367367   ROM_REGION( 0x10000, "audiocpu", 0 )    /* 64k for the SOUND CPU */
368368   ROM_LOAD( "717e01",     0x000000, 0x008000, CRC(966b8ba8) SHA1(ab7448cb61fa5922b1d8ae5f0d0f42d734ed4f93) )
369369
370   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
370   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
371371   ROM_LOAD32_WORD( "717e04",     0x000000, 0x080000, CRC(1a50a1cc) SHA1(bc16fab84c637ed124e37b115ddc0149560b727d) )
372372   ROM_LOAD32_WORD( "717e05",     0x000002, 0x080000, CRC(46ccb506) SHA1(3ed1f54744fc5cdc0f48e42f250c366267a8199a) )
373373
374   ROM_REGION( 0x020000, "k051316_1", 0 )      /* zoom/rotate */
374   ROM_REGION( 0x020000, "k051316_1", 0 )      /* zoom/rotate */
375375   ROM_LOAD( "717e06.n16",     0x000000, 0x020000, CRC(1ec26c7a) SHA1(05b5b522c5ebf5d0a71a7fc39ec9382008ef33c8) )
376376
377   ROM_REGION( 0x100000, "k051316_2", 0 )      /* zoom/rotate */
377   ROM_REGION( 0x100000, "k051316_2", 0 )      /* zoom/rotate */
378378   ROM_LOAD( "717e07.l20",     0x000000, 0x040000, CRC(b9a565a8) SHA1(a11782f7336e5ad58a4c6ea81f2eeac35d5e7d0a) )
379379   ROM_LOAD( "717e08.l22",     0x040000, 0x040000, CRC(b68a212e) SHA1(b2bd121a43552c3ade528ac763a0df40c3e648e0) )
380380   ROM_LOAD( "717e11.n20",     0x080000, 0x040000, CRC(ebb171ec) SHA1(d65d4a6b169ce03e4427b2a397484634f938236b) )
r31373r31374
397397   ROM_REGION( 0x10000, "audiocpu", 0 )    /* 64k for the SOUND CPU */
398398   ROM_LOAD( "717e01",     0x000000, 0x008000, CRC(966b8ba8) SHA1(ab7448cb61fa5922b1d8ae5f0d0f42d734ed4f93) )
399399
400   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
400   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
401401   ROM_LOAD32_WORD( "717e04",     0x000000, 0x080000, CRC(1a50a1cc) SHA1(bc16fab84c637ed124e37b115ddc0149560b727d) )
402402   ROM_LOAD32_WORD( "717e05",     0x000002, 0x080000, CRC(46ccb506) SHA1(3ed1f54744fc5cdc0f48e42f250c366267a8199a) )
403403
404   ROM_REGION( 0x020000, "k051316_1", 0 )      /* zoom/rotate */
404   ROM_REGION( 0x020000, "k051316_1", 0 )      /* zoom/rotate */
405405   ROM_LOAD( "717e06.n16",     0x000000, 0x020000, CRC(1ec26c7a) SHA1(05b5b522c5ebf5d0a71a7fc39ec9382008ef33c8) )
406406
407   ROM_REGION( 0x100000, "k051316_2", 0 )      /* zoom/rotate */
407   ROM_REGION( 0x100000, "k051316_2", 0 )      /* zoom/rotate */
408408   ROM_LOAD( "717e07.l20",     0x000000, 0x040000, CRC(b9a565a8) SHA1(a11782f7336e5ad58a4c6ea81f2eeac35d5e7d0a) )
409409   ROM_LOAD( "717e08.l22",     0x040000, 0x040000, CRC(b68a212e) SHA1(b2bd121a43552c3ade528ac763a0df40c3e648e0) )
410410   ROM_LOAD( "717e11.n20",     0x080000, 0x040000, CRC(ebb171ec) SHA1(d65d4a6b169ce03e4427b2a397484634f938236b) )
trunk/src/mame/drivers/amaticmg.c
r31373r31374
835835   MCFG_I8255_IN_PORTB_CB(IOPORT("SW1"))
836836   MCFG_I8255_OUT_PORTC_CB(WRITE8(amaticmg_state, out_c_w))
837837
838//   MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0)
838//  MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0)
839839
840840   /* video hardware */
841841   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mame/drivers/scramble.c
r31373r31374
15731573   /* sound hardware */
15741574   MCFG_SOUND_MODIFY("8910.1")
15751575   MCFG_SOUND_CLOCK(18432000/12) // triple punch/knock out ay clock is 1.535MHz, derived from main cpu xtal; verified on hardware
1576   
1577   
1576
1577
15781578   MCFG_SOUND_ROUTES_RESET()
15791579   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
15801580
trunk/src/mame/drivers/atari_s1.c
r31373r31374
322322
323323#if 0
324324*-------------------------------------------------------------------
325 The Atarians (working bootleg)
325   The Atarians (working bootleg)
326326Game modified to work in emulation from original set (atarians)
327327-------------------------------------------------------------------*/
328328ROM_START(atarianb)
329329   ROM_REGION(0x10000, "maincpu", 0)
330330   ROM_LOAD("atarianb.e00", 0x7000, 0x0800, CRC(74fc86e4) SHA1(135d75e5c03feae0929fa84caa3c802353cdd94e))
331     ROM_LOAD("atarian.e0", 0x7800, 0x0800, CRC(45cb0427) SHA1(e286930ca36bdd0f79acefd142d2a5431fa8005b))
331   ROM_LOAD("atarian.e0", 0x7800, 0x0800, CRC(45cb0427) SHA1(e286930ca36bdd0f79acefd142d2a5431fa8005b))
332332
333333   ROM_REGION(0x1000, "sound1", 0)
334334   ROM_LOAD("82s130.bin", 0x0000, 0x0200, CRC(da1f77b4) SHA1(b21fdc1c6f196c320ec5404013d672c35f95890b))
trunk/src/mame/drivers/playmark.c
r31373r31374
107107{
108108   if (ACCESSING_BITS_0_7)
109109   {
110//      if (data & 0x80) logerror("PC$%06x Writing unknown bits %02x to the Coin/EEPROM port\n", space.device().safe_pcbase(), data);
110//      if (data & 0x80) logerror("PC$%06x Writing unknown bits %02x to the Coin/EEPROM port\n", space.device().safe_pcbase(), data);
111111
112112      if (data) {
113113         if ((m_dispenser_latch & 0x80) == 0) m_dispenser_latch = 0;
r31373r31374
122122      }
123123      machine().device<ticket_dispenser_device>("ticket")->write(space, 0, (data & 0x08) ? 0x80 : 0);
124124
125      coin_counter_w(machine(), 0, data & 0x20);      /* Coin In counter - transistor driven */
126      coin_counter_w(machine(), 1, data & 0x40);      /* Token/Ticket Out counter - transistor driven */
125      coin_counter_w(machine(), 0, data & 0x20);      /* Coin In counter - transistor driven */
126      coin_counter_w(machine(), 1, data & 0x40);      /* Token/Ticket Out counter - transistor driven */
127127
128128      m_eeprom->cs_write((data & 1) ? ASSERT_LINE : CLEAR_LINE);
129129      m_eeprom->di_write((data & 4) >> 2);
r31373r31374
135135{
136136   if (ACCESSING_BITS_0_7)
137137   {
138//      if (data & 0x87) logerror("PC$%06x Writing unknown bits %02x to the Coin/EEPROM port\n", space.device().safe_pcbase(), data);
138//      if (data & 0x87) logerror("PC$%06x Writing unknown bits %02x to the Coin/EEPROM port\n", space.device().safe_pcbase(), data);
139139
140140      if (data) {
141141         if ((m_dispenser_latch & 0x80) == 0) m_dispenser_latch = 0;
r31373r31374
150150      }
151151      machine().device<ticket_dispenser_device>("ticket")->write(space, 0, (data & 0x08) ? 0x80 : 0);
152152
153      coin_counter_w(machine(), 0, data & 0x20);      /* Coin In counter - transistor driven */
154      coin_counter_w(machine(), 1, data & 0x40);      /* Token/Ticket Out counter - transistor driven */
153      coin_counter_w(machine(), 0, data & 0x20);      /* Coin In counter - transistor driven */
154      coin_counter_w(machine(), 1, data & 0x40);      /* Token/Ticket Out counter - transistor driven */
155155   }
156156}
157157
r31373r31374
165165{
166166   if (ACCESSING_BITS_0_7)
167167   {
168//      logerror("PC$%06x 68K Writing sound command %02x to OKI\n",space.device().safe_pcbase(), data);
168//      logerror("PC$%06x 68K Writing sound command %02x to OKI\n",space.device().safe_pcbase(), data);
169169
170170      m_snd_command = (data & 0xff);
171171      m_snd_flag = 1;
r31373r31374
180180   if ((m_oki_control & 0x38) == 0x30)
181181   {
182182      data = m_snd_command;
183//      logerror("PC$%03x PortB reading %02x from the 68K\n", space.device().safe_pcbase(), data);
183//      logerror("PC$%03x PortB reading %02x from the 68K\n", space.device().safe_pcbase(), data);
184184   }
185185   else if ((m_oki_control & 0x38) == 0x28)
186186   {
187187      data = (m_oki->read(space, 0) & 0x0f);
188//      logerror("PC$%03x PortB reading %02x from the OKI status port\n", space.device().safe_pcbase(), data);
188//      logerror("PC$%03x PortB reading %02x from the OKI status port\n", space.device().safe_pcbase(), data);
189189   }
190190
191191   return data;
r31373r31374
241241
242242   if ((data & 0x38) == 0x18)
243243   {
244//      logerror("PC$%03x Writing %02x to OKI1, PortC=%02x, Code=%02x\n",space.device().safe_pcbase(),m_oki_command,m_oki_control,m_snd_command);
244//      logerror("PC$%03x Writing %02x to OKI1, PortC=%02x, Code=%02x\n",space.device().safe_pcbase(),m_oki_command,m_oki_control,m_snd_command);
245245      m_oki->write(space, 0, m_oki_command);
246246   }
247247}
r31373r31374
252252
253253   if (m_old_oki_bank != (data & 3))
254254   {
255//      logerror("PC$%03x Writing %02x to PortC (OKI bank select bits). Previous bank was %02x\n",space.device().safe_pcbase(),(data&3),m_old_oki_bank);
255//      logerror("PC$%03x Writing %02x to PortC (OKI bank select bits). Previous bank was %02x\n",space.device().safe_pcbase(),(data&3),m_old_oki_bank);
256256
257257      m_old_oki_bank = data & 3;
258258
r31373r31374
266266
267267   if ((data & 0x38) == 0x18)
268268   {
269//      logerror("PC$%03x Writing %02x to OKI1, PortC=%02x, Code=%02x\n",space.device().safe_pcbase(),m_oki_command,m_oki_control,m_snd_command);
269//      logerror("PC$%03x Writing %02x to OKI1, PortC=%02x, Code=%02x\n",space.device().safe_pcbase(),m_oki_command,m_oki_control,m_snd_command);
270270      m_oki->write(space, 0, m_oki_command);
271271   }
272272}
r31373r31374
338338   AM_RANGE(0x710018, 0x710019) AM_READ_PORT("P3")
339339   AM_RANGE(0x71001a, 0x71001b) AM_READ_PORT("P4")
340340//  AM_RANGE(0x71001c, 0x71001d) AM_READ(playmark_snd_status???)
341//   AM_RANGE(0x71001e, 0x71001f) AM_WRITE(playmark_snd_command_w)
341//  AM_RANGE(0x71001e, 0x71001f) AM_WRITE(playmark_snd_command_w)
342342   AM_RANGE(0x780000, 0x780fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
343343   AM_RANGE(0xff0000, 0xffffff) AM_RAM
344344ADDRESS_MAP_END
r31373r31374
384384   AM_RANGE(0x300016, 0x300017) AM_WRITE(hrdtimes_coin_w)
385385   AM_RANGE(0x30001a, 0x30001b) AM_READ_PORT("DSW2")
386386   AM_RANGE(0x30001c, 0x30001d) AM_READ_PORT("DSW1")
387//   AM_RANGE(0x30001e, 0x30001f) AM_WRITE(playmark_snd_command_w)
387//  AM_RANGE(0x30001e, 0x30001f) AM_WRITE(playmark_snd_command_w)
388388   AM_RANGE(0x304000, 0x304001) AM_WRITENOP        /* watchdog? irq ack? */
389389ADDRESS_MAP_END
390390
r31373r31374
438438ADDRESS_MAP_END
439439
440440static ADDRESS_MAP_START( hrdtimes_sound_io_map, AS_IO, 8, playmark_state )
441   AM_RANGE(0x00, 0x00) AM_NOP      /* AM_WRITE(playmark_oki_banking_w)  Banking data output but not wired. Port 2 (Port C) is wired to the OKI banking instead */
441   AM_RANGE(0x00, 0x00) AM_NOP     /* AM_WRITE(playmark_oki_banking_w)  Banking data output but not wired. Port 2 (Port C) is wired to the OKI banking instead */
442442   AM_RANGE(0x01, 0x01) AM_READWRITE(playmark_snd_command_r, playmark_oki_w)
443443   AM_RANGE(0x02, 0x02) AM_READWRITE(playmark_snd_flag_r, hrdtimes_snd_control_w)
444444   AM_RANGE(PIC16C5x_T0, PIC16C5x_T0) AM_READ(PIC16C5X_T0_clk_r)
r31373r31374
904904
905905   PORT_START("DISPENSER")
906906   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
907   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )   // Wired to Token dispenser connector, but doesn't seem to affect anything.
907   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )    // Wired to Token dispenser connector, but doesn't seem to affect anything.
908908   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Token Dispenser Empty") PORT_CODE(KEYCODE_N)
909909   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("token",  ticket_dispenser_device, line_r)
910910   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Ticket Dispenser Empty") PORT_CODE(KEYCODE_T)
r31373r31374
19221922   ROM_COPY( "oki", 0x00000, 0x20000, 0x20000 )
19231923   ROM_COPY( "oki", 0x00000, 0x40000, 0x20000 )
19241924
1925   ROM_REGION( 0x8000, "plds", 0 )      /* These were read protected */
1925   ROM_REGION( 0x8000, "plds", 0 )     /* These were read protected */
19261926   ROM_LOAD( "palce16v8h-25-pc4_u58.jed",   0x0000, 0xb89,  BAD_DUMP CRC(ba88c1da) SHA1(9b55e96eee44a467bdfbf760137ccb2fb3afedf0) )
19271927   ROM_LOAD( "palce16v8h-25-pc4_u182.jed",  0x0000, 0xb89,  BAD_DUMP CRC(ba88c1da) SHA1(9b55e96eee44a467bdfbf760137ccb2fb3afedf0) )
19281928   ROM_LOAD( "palce16v8h-25-pc4_jamma.jed", 0x0000, 0xb89,  BAD_DUMP CRC(ba88c1da) SHA1(9b55e96eee44a467bdfbf760137ccb2fb3afedf0) )  // On the Jamma Expansion board
r31373r31374
19531953   ROM_LOAD16_BYTE( "28.u40",       0x040001, 0x10000, CRC(40e65ed1) SHA1(bc75eb816c58eb0f983bb0eaee854c54e306e1da) )
19541954   ROM_CONTINUE(                    0x060001, 0x10000 )
19551955
1956   ROM_REGION( 0x80000, "gfx2", 0 )   /* Sprites */
1956   ROM_REGION( 0x80000, "gfx2", 0 )    /* Sprites */
19571957   ROM_LOAD16_BYTE( "26.u86",       0x00000, 0x20000, CRC(d3ee7d82) SHA1(b0b3df19d60430e7a9fa29fdfff2183a32986d2d) )
19581958   ROM_LOAD16_BYTE( "30.u85",       0x00001, 0x20000, CRC(4b8a9558) SHA1(9f0f2d8f50f21cf188ad778c3a0a68ec23380b23) )
19591959   ROM_LOAD16_BYTE( "25.u84",       0x40000, 0x20000, CRC(e1ab5cf5) SHA1(f76d00537cfd6f09439e44071875bf021622fd07) )
trunk/src/mame/drivers/8080bw.c
r31373r31374
33403340   ROM_LOAD( "emag_si.e",    0x1800, 0x0400, CRC(c4e80586) SHA1(3d427d5a2eea3c911ec7bd055e06e6747ce5e84d) )
33413341   ROM_LOAD( "emag_si.f",    0x1c00, 0x0400, CRC(077f5ef2) SHA1(625de6839073ac4c904f949efc1b2e0afea5d676) )
33423342ROM_END
3343   
3343
33443344ROM_START( tst_invd )
33453345   ROM_REGION( 0x10000, "maincpu", 0 )
33463346   ROM_LOAD( "test.h",       0x0000, 0x0800, CRC(f86a2eea) SHA1(4a72ff01f3e6d16bbe9bf7f123cd98895bfbed9a) )   /*  The Test ROM */
trunk/src/mame/drivers/tempest.c
r31373r31374
300300      m_avg(*this, "avg"),
301301      m_rom(*this, "maincpu"),
302302      m_knob_p1(*this, TEMPEST_KNOB_P1_TAG),
303        m_knob_p2(*this, TEMPEST_KNOB_P2_TAG),
304        m_buttons_p1(*this, TEMPEST_BUTTONS_P1_TAG),
305        m_buttons_p2(*this, TEMPEST_BUTTONS_P2_TAG),
306        m_in1(*this, "IN1/DSW0"),
307        m_in2(*this, "IN2")
308    { }
303      m_knob_p2(*this, TEMPEST_KNOB_P2_TAG),
304      m_buttons_p1(*this, TEMPEST_BUTTONS_P1_TAG),
305      m_buttons_p2(*this, TEMPEST_BUTTONS_P2_TAG),
306      m_in1(*this, "IN1/DSW0"),
307      m_in2(*this, "IN2")
308   { }
309309
310310   required_device<cpu_device> m_maincpu;
311311   required_device<mathbox_device> m_mathbox;
r31373r31374
313313   required_memory_region m_rom;
314314
315315   required_ioport m_knob_p1;
316    required_ioport m_knob_p2;
317    required_ioport m_buttons_p1;
318    required_ioport m_buttons_p2;
319    required_ioport m_in1;
320    required_ioport m_in2;
316   required_ioport m_knob_p2;
317   required_ioport m_buttons_p1;
318   required_ioport m_buttons_p2;
319   required_ioport m_in1;
320   required_ioport m_in2;
321321
322    UINT8 m_player_select;
322   UINT8 m_player_select;
323323   DECLARE_WRITE8_MEMBER(wdclr_w);
324324   DECLARE_WRITE8_MEMBER(tempest_led_w);
325325   DECLARE_WRITE8_MEMBER(tempest_coin_w);
r31373r31374
329329   DECLARE_READ8_MEMBER(input_port_1_bit_r);
330330   DECLARE_READ8_MEMBER(input_port_2_bit_r);
331331
332    DECLARE_READ8_MEMBER(rom_ae1f_r);
332   DECLARE_READ8_MEMBER(rom_ae1f_r);
333333
334    virtual void machine_start();
334   virtual void machine_start();
335335};
336336
337337
r31373r31374
365365
366366CUSTOM_INPUT_MEMBER(tempest_state::tempest_buttons_r)
367367{
368    return (m_player_select == 0) ? m_buttons_p1->read() : m_buttons_p2->read();
368   return (m_player_select == 0) ? m_buttons_p1->read() : m_buttons_p2->read();
369369}
370370
371371
r31373r31374
428428   machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
429429   machine().scheduler().abort_timeslice();
430430
431    const UINT8 *rom = m_rom->base();
432    return rom[0xae1f];
431   const UINT8 *rom = m_rom->base();
432   return rom[0xae1f];
433433}
434434
435435
r31373r31374
454454   AM_RANGE(0x60c0, 0x60cf) AM_DEVREADWRITE("pokey1", pokey_device, read, write)
455455   AM_RANGE(0x60d0, 0x60df) AM_DEVREADWRITE("pokey2", pokey_device, read, write)
456456   AM_RANGE(0x60e0, 0x60e0) AM_WRITE(tempest_led_w)
457    AM_RANGE(0xae1f, 0xae1f) AM_READ(rom_ae1f_r)
458    AM_RANGE(0x9000, 0xdfff) AM_ROM
457   AM_RANGE(0xae1f, 0xae1f) AM_READ(rom_ae1f_r)
458   AM_RANGE(0x9000, 0xdfff) AM_ROM
459459   AM_RANGE(0xf000, 0xffff) AM_ROM /* for the reset / interrupt vectors */
460460ADDRESS_MAP_END
461461
trunk/src/mame/drivers/quakeat.c
r31373r31374
110110
111111void quakeat_state::machine_start()
112112{
113
114113}
115114/*************************************************************/
116115
trunk/src/mame/drivers/maygayv1.c
r31373r31374
512512WRITE8_MEMBER( maygayv1_state::lamp_data_w )
513513{
514514   //The two A/B ports are merged back into one, to make one row of 8 lamps.
515   
515
516516   if (m_old_lamp_strobe != m_lamp_strobe)
517517   {
518518      // Because of the nature of the lamping circuit, there is an element of persistance
r31373r31374
525525      }
526526      m_old_lamp_strobe = m_lamp_strobe;
527527   }
528   
528
529529}
530530
531531READ8_MEMBER( maygayv1_state::kbd_r )
r31373r31374
897897   MCFG_MC68681_A_TX_CALLBACK(WRITELINE(maygayv1_state, duart_txa))
898898
899899   MCFG_DEVICE_ADD("i8279", I8279, MASTER_CLOCK/4)    // unknown clock
900   MCFG_I8279_OUT_SL_CB(WRITE8(maygayv1_state, strobe_w))      // scan SL lines
901   MCFG_I8279_OUT_DISP_CB(WRITE8(maygayv1_state, lamp_data_w))   // display A&B
902   MCFG_I8279_IN_RL_CB(READ8(maygayv1_state, kbd_r))               // kbd RL lines
903   
900   MCFG_I8279_OUT_SL_CB(WRITE8(maygayv1_state, strobe_w))      // scan SL lines
901   MCFG_I8279_OUT_DISP_CB(WRITE8(maygayv1_state, lamp_data_w)) // display A&B
902   MCFG_I8279_IN_RL_CB(READ8(maygayv1_state, kbd_r))                   // kbd RL lines
903
904904   MCFG_SPEAKER_STANDARD_MONO("mono")
905905
906906   MCFG_SOUND_ADD("ymsnd",YM2413, MASTER_CLOCK / 4)
trunk/src/mame/drivers/surpratk.c
r31373r31374
156156
157157WRITE8_MEMBER( surpratk_state::banking_callback )
158158{
159//   logerror("%04x: setlines %02x\n", machine().device("maincpu")->safe_pc(), data);
159//  logerror("%04x: setlines %02x\n", machine().device("maincpu")->safe_pc(), data);
160160   membank("bank1")->set_entry(data & 0x1f);
161161}
162162
trunk/src/mame/drivers/itech32.c
r31373r31374
16661666   MCFG_SCREEN_ADD("screen", RASTER)
16671667   MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
16681668   MCFG_SCREEN_RAW_PARAMS(VIDEO_CLOCK, 508, 0, 384, 262, 0, 240) // most games configure the screen this way
1669//   MCFG_SCREEN_RAW_PARAMS(VIDEO_CLOCK, 508, 0, 384, 286, 0, 256) // sftm, wcbowl and shufshot configure it this way
1669//  MCFG_SCREEN_RAW_PARAMS(VIDEO_CLOCK, 508, 0, 384, 286, 0, 256) // sftm, wcbowl and shufshot configure it this way
16701670   MCFG_SCREEN_UPDATE_DRIVER(itech32_state, screen_update_itech32)
16711671   MCFG_SCREEN_PALETTE("palette")
16721672
trunk/src/mame/drivers/jpmmps.c
r31373r31374
163163   MCFG_DEVICE_ADD("ppi8255_ic21", I8255, 0)
164164
165165   MCFG_DEVICE_ADD("ppi8255_ic22", I8255, 0)
166   MCFG_I8255_OUT_PORTB_CB(WRITE8(jpmmps_state, jpmmps_psg_buf_w))   // SN chip data
167   MCFG_I8255_OUT_PORTC_CB(WRITE8(jpmmps_state, jpmmps_ic22_portc_w))   // C3 is last meter, C2 latches in data
166   MCFG_I8255_OUT_PORTB_CB(WRITE8(jpmmps_state, jpmmps_psg_buf_w)) // SN chip data
167   MCFG_I8255_OUT_PORTC_CB(WRITE8(jpmmps_state, jpmmps_ic22_portc_w))  // C3 is last meter, C2 latches in data
168168
169169   MCFG_DEVICE_ADD("ppi8255_ic25", I8255, 0)
170170
trunk/src/mame/drivers/fireball.c
r31373r31374
11/***********************************************************************************
2 
3   fireball.c
4 
5   Mechanical game where you have a gun shooting rubber balls.
62
7   some pics here
8   http://www.schausteller.de/anzeigenmarkt/euro-ball-66634.html
3    fireball.c
94
10   TODO
11   -NEVER sends store command to Eeprom so all change are lost
5    Mechanical game where you have a gun shooting rubber balls.
126
7    some pics here
8    http://www.schausteller.de/anzeigenmarkt/euro-ball-66634.html
9
10    TODO
11    -NEVER sends store command to Eeprom so all change are lost
12
1313************************************************************************************/
1414
1515#include "emu.h"
r31373r31374
2020#include "machine/eepromser.h"
2121
2222/****************************
23*    LOG defines          *
23*    LOG defines            *
2424****************************/
2525
2626#define LOG_DISPLAY 0
2727#define LOG_DISPLAY2 0
2828#define LOG_INPUT 0
29#define LOG_AY8912 0
29#define LOG_AY8912 0
3030#define LOG_P1 0
3131#define LOG_P3 0
3232#define LOG_OUTPUT 0
3333
3434/****************************
35*    Clock defines          *
35*    Clock defines          *
3636****************************/
3737#define CPU_CLK  XTAL_11_0592MHz
3838#define AY_CLK  XTAL_11_0592MHz/8
r31373r31374
7676   required_device<cpu_device> m_maincpu;
7777   required_device<ay8912_device> m_ay;
7878   required_device<eeprom_serial_x24c44_device> m_eeprom;
79   
79
8080   // driver_device overrides
8181   virtual void machine_reset();
8282
r31373r31374
101101
102102WRITE8_MEMBER(fireball_state::io_00_w)
103103{
104
105104   m_display_data= m_display_data&0x7f;
106105   if (LOG_DISPLAY)
107106      logerror("write to 0x00 IO %02X, m_display_data= %01X\n",data,m_display_data);
108   
107
109108   switch (data&0x0f)
110109   {
111      case 1:   output_set_digit_value(2, m_display_data);
110      case 1: output_set_digit_value(2, m_display_data);
112111            break;
113      case 2:   output_set_digit_value(1, m_display_data);
112      case 2: output_set_digit_value(1, m_display_data);
114113            break;
115      case 4:   output_set_digit_value(4, m_display_data);
114      case 4: output_set_digit_value(4, m_display_data);
116115            break;
117      case 8:   output_set_digit_value(3, m_display_data);
116      case 8: output_set_digit_value(3, m_display_data);
118117            break;
119118   }
120119
121   
120
122121   if (LOG_OUTPUT)
123      logerror("write to 0x00 IO (X11-X11A) %02X\n",data&0xf0);   
124   
122      logerror("write to 0x00 IO (X11-X11A) %02X\n",data&0xf0);
123
125124   output_set_value("Hopper1", BIT(data, 4));
126125   output_set_value("Hopper2", BIT(data, 5));
127126   output_set_value("Hopper3", BIT(data, 6));
r31373r31374
141140WRITE8_MEMBER(fireball_state::io_02_w)
142141{
143142   if (LOG_OUTPUT)
144      logerror("write to 0x00 IO (X7-X9) %02X\n",data);   
143      logerror("write to 0x00 IO (X7-X9) %02X\n",data);
145144
146145   output_set_value("GameOver", BIT(data, 0));
147146   output_set_value("Title", BIT(data, 1));
r31373r31374
154153}
155154
156155READ8_MEMBER(fireball_state::io_04_r)
157{   //contraves per mod prog
156{   //contraves per mod prog
158157   UINT8 tmp=0;
159158
160159   tmp=ioport("X10-12")->read();
161160
162161   if (LOG_INPUT)
163162      logerror("return %02X from 0x04\n",tmp);
164   return tmp;   
163   return tmp;
165164}
166165
167166WRITE8_MEMBER(fireball_state::io_04_w)
r31373r31374
189188      logerror("write to 0x06 data =%02X\n",data);
190189
191190   to_ay_data= data;
192
191
193192   if (LOG_DISPLAY2)
194193      logerror("On board display write %02X\n",UINT8(~(data&0xff)));
195   
194
196195   output_set_digit_value(7, UINT8(~(data&0xff)));
197196}
198197
199 
200 READ8_MEMBER(fireball_state::p1_r)
201 {
198
199   READ8_MEMBER(fireball_state::p1_r)
200   {
202201   UINT8 tmp=0;
203202   tmp=(m_p1_data&0xfe)|(m_eeprom->do_read());
204203   if (LOG_P1)
205204      logerror("readP1 port data %02X\n",tmp&0x01);
206205   return tmp;
207 }
208 
209 WRITE8_MEMBER(fireball_state::p1_w)
210 {
206   }
207
208   WRITE8_MEMBER(fireball_state::p1_w)
209   {
211210   //eeprom x24c44/ay8912/system stuff...
212211   //bit0 goes to eeprom pin 3 and 4  (0x01) Data_in and Data_out
213   //bit1 goes to eeprom pin 1 (0x02)      CE Hi active
214   //bit2 goes to eeprom pin 2 (0x04)      SK Clock
215   //bit3 goes to dis/thr input of a ne555 that somehow reset the 8031...       TODO
216   //bit4 goes to ay8912 pin bc1   (0x10)
212   //bit1 goes to eeprom pin 1 (0x02)      CE Hi active
213   //bit2 goes to eeprom pin 2 (0x04)      SK Clock
214   //bit3 goes to dis/thr input of a ne555 that somehow reset the 8031...      TODO
215   //bit4 goes to ay8912 pin bc1   (0x10)
217216   //bit5 goes to ay8912 pin bdir (0x20)
218   //bit6 goes to                                               TODO
219   //bit7 goes to                                               TODO
217   //bit6 goes to                                                              TODO
218   //bit7 goes to                                                              TODO
220219
221220   if (LOG_AY8912){
222221      if(( data&0x30) !=  (m_p1_data&0x30)){
223222         logerror("write ay8910 controll bc1= %02X bdir= %02X\n",data&0x10, data&0x20);
224223      }
225224   }
226
225
227226   m_eeprom->di_write(data & 0x01);
228227   m_eeprom->clk_write((data & 0x04) ? ASSERT_LINE : CLEAR_LINE);
229228   m_eeprom->cs_write((data & 0x02) ? ASSERT_LINE : CLEAR_LINE);
r31373r31374
236235
237236   //AY 3-8912 data write/read
238237
239   if (data & 0x20){   //bdir
238   if (data & 0x20){   //bdir
240239      //write to ay8912
241240      if (LOG_AY8912)
242241         logerror("write to 0x06 bdir=1\n");
r31373r31374
248247         if (LOG_AY8912)
249248            logerror("AY8912 address latch write=%02X\n",to_ay_data);
250249      }else{
251         //data_w   
250         //data_w
252251         if (LOG_AY8912)
253252            logerror("write to 0x06 bc1=0\n");
254253         m_ay->data_w(space,0,to_ay_data );
r31373r31374
259258      if (LOG_AY8912)
260259         logerror("write to 0x06 bdir=0\n");
261260      ay_data=m_ay->data_r(space,0);
262   }   
263   
261   }
262
264263   m_p1_data=data;
265264}
266265
267 
268 READ8_MEMBER(fireball_state::p3_r)
269 {
266
267   READ8_MEMBER(fireball_state::p3_r)
268   {
270269   UINT8 ret = 0xfb | ((int_data&1)<<2);
271270   if (LOG_P3)
272271      logerror("read P3 port data = %02X\n",ret);
273272   return ret;
274 }
275 
273   }
274
276275WRITE8_MEMBER(fireball_state::p3_w)
277 {
276   {
278277   if (LOG_P3)
279278      logerror("write to P3 port data=%02X\n",data);
280   
279
281280   m_p3_data=data;
282281}
283
282
284283/*************************
285284* Memory Map Information *
286285*************************/
287
286
288287static ADDRESS_MAP_START( fireball_map, AS_PROGRAM, 8, fireball_state )
289288   AM_RANGE(0x0000, 0x1fff) AM_ROM
290289ADDRESS_MAP_END
291290
292291static ADDRESS_MAP_START( fireball_io_map, AS_IO, 8, fireball_state )
293 
292
294293   AM_RANGE(0x00, 0x01)AM_READWRITE(io_00_r,io_00_w)
295294   AM_RANGE(0x02, 0x03)AM_READWRITE(io_02_r,io_02_w)
296295   AM_RANGE(0x04, 0x05)AM_READWRITE(io_04_r,io_04_w)
297     AM_RANGE(0x06, 0x07)AM_READWRITE(io_06_r,io_06_w)
298   
296   AM_RANGE(0x06, 0x07)AM_READWRITE(io_06_r,io_06_w)
297
299298   //internal port
300299   AM_RANGE(MCS51_PORT_P1, MCS51_PORT_P1) AM_READWRITE(p1_r, p1_w)
301300   AM_RANGE(MCS51_PORT_P3, MCS51_PORT_P3) AM_READWRITE(p3_r, p3_w)
r31373r31374
321320   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_I) PORT_NAME("800 Points")
322321
323322   PORT_START("X6-8")
324   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_A) PORT_NAME("Empty Hopper A")   //activeLow to fool the game code...
323   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_A) PORT_NAME("Empty Hopper A") //activeLow to fool the game code...
325324   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_S) PORT_NAME("Empty Hopper B")//at least one hopper must be full
326325   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_D) PORT_NAME("Empty Hopper C")
327326   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 )
r31373r31374
330329   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_X) PORT_NAME("Confirm Value")
331330   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_CODE(KEYCODE_C) PORT_NAME("All Options Default value")
332331
333   PORT_START("X10-12")               
332   PORT_START("X10-12")
334333   PORT_DIPNAME( 0xff, 0x00, "Programming Value" )
335   PORT_DIPSETTING(    0x00, "00" )   //0
336   PORT_DIPSETTING(    0x01, "01" )   
334   PORT_DIPSETTING(    0x00, "00" )    //0
335   PORT_DIPSETTING(    0x01, "01" )
337336   PORT_DIPSETTING(    0x02, "02" )
338337   PORT_DIPSETTING(    0x03, "03" )
339338   PORT_DIPSETTING(    0x04, "04" )
r31373r31374
342341   PORT_DIPSETTING(    0x07, "07" )
343342   PORT_DIPSETTING(    0x08, "08" )
344343   PORT_DIPSETTING(    0x09, "09" )
345   PORT_DIPSETTING(    0x10, "10" )   //10
344   PORT_DIPSETTING(    0x10, "10" )    //10
346345   PORT_DIPSETTING(    0x11, "11" )
347346   PORT_DIPSETTING(    0x12, "12" )
348347   PORT_DIPSETTING(    0x13, "13" )
r31373r31374
352351   PORT_DIPSETTING(    0x17, "17" )
353352   PORT_DIPSETTING(    0x18, "18" )
354353   PORT_DIPSETTING(    0x19, "19" )
355   PORT_DIPSETTING(    0x20, "20" )   //20
354   PORT_DIPSETTING(    0x20, "20" )    //20
356355   PORT_DIPSETTING(    0x21, "21" )
357356   PORT_DIPSETTING(    0x22, "22" )
358357   PORT_DIPSETTING(    0x23, "23" )
r31373r31374
362361   PORT_DIPSETTING(    0x27, "27" )
363362   PORT_DIPSETTING(    0x28, "28" )
364363   PORT_DIPSETTING(    0x29, "29" )
365   PORT_DIPSETTING(    0x30, "30" )   //30
364   PORT_DIPSETTING(    0x30, "30" )    //30
366365   PORT_DIPSETTING(    0x31, "31" )
367366   PORT_DIPSETTING(    0x32, "32" )
368367   PORT_DIPSETTING(    0x33, "33" )
r31373r31374
372371   PORT_DIPSETTING(    0x37, "37" )
373372   PORT_DIPSETTING(    0x38, "38" )
374373   PORT_DIPSETTING(    0x39, "39" )
375   PORT_DIPSETTING(    0x40, "40" )   //40
374   PORT_DIPSETTING(    0x40, "40" )    //40
376375   PORT_DIPSETTING(    0x41, "41" )
377376   PORT_DIPSETTING(    0x42, "42" )
378377   PORT_DIPSETTING(    0x43, "43" )
r31373r31374
382381   PORT_DIPSETTING(    0x47, "47" )
383382   PORT_DIPSETTING(    0x48, "48" )
384383   PORT_DIPSETTING(    0x49, "49" )
385   PORT_DIPSETTING(    0x50, "50" )   //50
384   PORT_DIPSETTING(    0x50, "50" )    //50
386385   PORT_DIPSETTING(    0x51, "51" )
387386   PORT_DIPSETTING(    0x52, "52" )
388387   PORT_DIPSETTING(    0x53, "53" )
r31373r31374
392391   PORT_DIPSETTING(    0x57, "57" )
393392   PORT_DIPSETTING(    0x58, "58" )
394393   PORT_DIPSETTING(    0x59, "59" )
395   PORT_DIPSETTING(    0x60, "60" )   //60
394   PORT_DIPSETTING(    0x60, "60" )    //60
396395   PORT_DIPSETTING(    0x61, "61" )
397396   PORT_DIPSETTING(    0x62, "62" )
398397   PORT_DIPSETTING(    0x63, "63" )
r31373r31374
402401   PORT_DIPSETTING(    0x67, "67" )
403402   PORT_DIPSETTING(    0x68, "68" )
404403   PORT_DIPSETTING(    0x69, "69" )
405   PORT_DIPSETTING(    0x70, "70" )   //70
404   PORT_DIPSETTING(    0x70, "70" )    //70
406405   PORT_DIPSETTING(    0x71, "71" )
407406   PORT_DIPSETTING(    0x72, "72" )
408   PORT_DIPSETTING(    0x73, "73" )   
407   PORT_DIPSETTING(    0x73, "73" )
409408   PORT_DIPSETTING(    0x74, "74" )
410409   PORT_DIPSETTING(    0x75, "75" )
411410   PORT_DIPSETTING(    0x76, "76" )
412411   PORT_DIPSETTING(    0x77, "77" )
413412   PORT_DIPSETTING(    0x78, "78" )
414413   PORT_DIPSETTING(    0x79, "79" )
415   PORT_DIPSETTING(    0x80, "80" )   //80   
414   PORT_DIPSETTING(    0x80, "80" )    //80
416415   PORT_DIPSETTING(    0x81, "81" )
417416   PORT_DIPSETTING(    0x82, "82" )
418417   PORT_DIPSETTING(    0x83, "83" )
r31373r31374
422421   PORT_DIPSETTING(    0x87, "87" )
423422   PORT_DIPSETTING(    0x88, "88" )
424423   PORT_DIPSETTING(    0x89, "89" )
425   PORT_DIPSETTING(    0x90, "90" )   //90
424   PORT_DIPSETTING(    0x90, "90" )    //90
426425   PORT_DIPSETTING(    0x91, "91" )
427426   PORT_DIPSETTING(    0x92, "92" )
428   PORT_DIPSETTING(    0x93, "93" )   
427   PORT_DIPSETTING(    0x93, "93" )
429428   PORT_DIPSETTING(    0x94, "94" )
430429   PORT_DIPSETTING(    0x95, "95" )
431430   PORT_DIPSETTING(    0x96, "96" )
r31373r31374
436435INPUT_PORTS_END
437436
438437/******************************
439*   machine reset           *
438*   machine reset             *
440439******************************/
441440
442441void fireball_state::machine_reset()
r31373r31374
444443   int_timing=1;
445444   output_set_digit_value(5, 0x3f);
446445   output_set_digit_value(6, 0x3f);
447   
446
448447   output_set_value("Hopper1", 0);
449448   output_set_value("Hopper2", 0);
450449   output_set_value("Hopper3", 0);
r31373r31374
469468   if (int_timing==1){
470469      //logerror("INT set\n");
471470      m_maincpu->set_input_line(MCS51_INT0_LINE, ASSERT_LINE);
472      int_data=1;
471         int_data=1;
473472   }
474473   if (int_timing==2){
475474      //logerror("INT clear\n");
476475      m_maincpu->set_input_line(MCS51_INT0_LINE, CLEAR_LINE);
477476      int_data=0;
478   }   
477   }
479478   if (int_timing==5){
480479      int_timing=0;
481   }   
480   }
482481   int_timing++;
483482}
484483
r31373r31374
490489
491490static MACHINE_CONFIG_START( fireball, fireball_state )
492491   /* basic machine hardware */
493   MCFG_CPU_ADD("maincpu", I8031, CPU_CLK)   //
492   MCFG_CPU_ADD("maincpu", I8031, CPU_CLK) //
494493   MCFG_CPU_PROGRAM_MAP(fireball_map)
495494   MCFG_CPU_IO_MAP(fireball_io_map)
496   MCFG_TIMER_DRIVER_ADD_PERIODIC("int_0", fireball_state, int_0, attotime::from_hz(555))   //9ms from scope reading 111Hz take care of this in the handler
495   MCFG_TIMER_DRIVER_ADD_PERIODIC("int_0", fireball_state, int_0, attotime::from_hz(555))  //9ms from scope reading 111Hz take care of this in the handler
497496
498497   MCFG_EEPROM_SERIAL_X24C44_ADD("eeprom")
499   
498
500499   /* sound hardware */
501500   MCFG_SPEAKER_STANDARD_MONO("mono")
502501   MCFG_SOUND_ADD("aysnd", AY8912, AY_CLK)
503502   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
504   
503
505504   /* Video */
506505   MCFG_DEFAULT_LAYOUT(layout_fireball)
507506MACHINE_CONFIG_END
r31373r31374
514513ROM_START(fireball)
515514   ROM_REGION(0x10000, "maincpu", 0)
516515   ROM_LOAD("euroball-89-07-13-c026.bin", 0x0000, 0x2000, CRC(cab3fc1c) SHA1(bcf0d17e26f2d9f5e20bda258728c989ea138702))
517   
516
518517   ROM_REGION( 0x20, "eeprom", 0 ) // default eeprom must have some specific value at 0x03 at least
519   ROM_LOAD( "fireball.nv", 0x0000, 0x020, CRC(1d0f5f0f) SHA1(8e68fcd8782f39ed3b1df6162db9be83cb3335e4) )   //default setting
518   ROM_LOAD( "fireball.nv", 0x0000, 0x020, CRC(1d0f5f0f) SHA1(8e68fcd8782f39ed3b1df6162db9be83cb3335e4) )  //default setting
520519ROM_END
521520
522521/*************************
523522*      Game Drivers      *
524523*************************/
525/*     YEAR  NAME      PARENT      MACHINE   INPUT     STATE          INIT     ROT       COMPANY     FULLNAME    FLAGS*/
526GAME( 1989, fireball, 0,         fireball, fireball, driver_device, 0,       ROT0,    "Valco",    "Fireball", GAME_MECHANICAL ) //1989 by rom name
527
528
524/*    YEAR  NAME      PARENT     MACHINE   INPUT     STATE          INIT    ROT     COMPANY     FULLNAME    FLAGS*/
525GAME( 1989, fireball, 0,         fireball, fireball, driver_device, 0,      ROT0,   "Valco",    "Fireball", GAME_MECHANICAL ) //1989 by rom name
trunk/src/mame/drivers/gticlub.c
r31373r31374
260260      m_k001006_2(*this, "k001006_2"),
261261      m_generic_paletteram_32(*this, "paletteram"),
262262      m_konppc(*this, "konppc") { }
263     
263
264264   // TODO: Needs verification on real hardware
265265   static const int m_sound_timer_usec = 2400;
266266
r31373r31374
995995   MCFG_RF5C400_ADD("rfsnd", XTAL_33_8688MHz/2)
996996   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
997997   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
998   
998
999999   MCFG_DEVICE_ADD("konppc", KONPPC, 0)
10001000   MCFG_KONPPC_CGBOARD_NUMBER(1)
10011001   MCFG_KONPPC_CGBOARD_TYPE(CGBOARD_TYPE_GTICLUB)
r31373r31374
10741074   MCFG_VOODOO_SCREEN_TAG("lscreen")
10751075   MCFG_VOODOO_CPU_TAG("dsp")
10761076   MCFG_VOODOO_VBLANK_CB(WRITELINE(gticlub_state,voodoo_vblank_0))
1077   
1077
10781078   MCFG_DEVICE_ADD("voodoo1", VOODOO_1, STD_VOODOO_1_CLOCK)
10791079   MCFG_VOODOO_FBMEM(2)
10801080   MCFG_VOODOO_TMUMEM(2,2)
r31373r31374
11331133   MCFG_RF5C400_ADD("rfsnd", XTAL_33_8688MHz/2)
11341134   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
11351135   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
1136   
1136
11371137   MCFG_DEVICE_ADD("konppc", KONPPC, 0)
11381138   MCFG_KONPPC_CGBOARD_NUMBER(2)
11391139   MCFG_KONPPC_CGBOARD_TYPE(CGBOARD_TYPE_HANGPLT)
trunk/src/mame/drivers/skylncr.c
r31373r31374
174174   required_device<gfxdecode_device> m_gfxdecode;
175175   required_device<palette_device> m_palette;
176176   optional_shared_ptr<UINT8> m_generic_paletteram_8;
177   optional_shared_ptr<UINT8> m_generic_paletteram2_8;   
177   optional_shared_ptr<UINT8> m_generic_paletteram2_8;
178178};
179179
180180
r31373r31374
205205TILE_GET_INFO_MEMBER(skylncr_state::get_reel_1_tile_info)
206206{
207207   UINT16 code = m_reeltiles_1_ram[ tile_index ] + (m_reeltileshigh_1_ram[ tile_index ] << 8);
208   int pal = (code & 0x8000) >> 15;     
208   int pal = (code & 0x8000) >> 15;
209209   SET_TILE_INFO_MEMBER(1, code&0x7fff, pal^1, TILE_FLIPYX( 0 ));
210210}
211211
r31373r31374
611611      RGN_FRAC(1,2)+8*1, 8*1,
612612      RGN_FRAC(1,2)+8*0, 8*0,
613613      RGN_FRAC(1,2)+8*3, 8*3,
614      RGN_FRAC(1,2)+8*2, 8*2
614      RGN_FRAC(1,2)+8*2, 8*2
615615   },
616616   {
617617      STEP16(0,8*4),
r31373r31374
634634static GFXDECODE_START( neraidou )
635635   GFXDECODE_ENTRY( "gfx1", 0, layout8x8x8_alt,    0, 2 )
636636   GFXDECODE_ENTRY( "gfx2", 0, layout8x32x8_alt2,  0, 2 )
637//   GFXDECODE_ENTRY( "gfx2", 0, layout8x32x8_alt,   0x100, 1 )
637//  GFXDECODE_ENTRY( "gfx2", 0, layout8x32x8_alt,   0x100, 1 )
638638GFXDECODE_END
639639
640640static GFXDECODE_START( sstar97 )
r31373r31374
834834   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT )
835835
836836   PORT_START("DSW1")  /* $02 (PPI0 port C) */
837   PORT_DIPNAME( 0x11, 0x11, "Butterfly Max Mul" )      PORT_DIPLOCATION("DSW-A:!4,!5")
837   PORT_DIPNAME( 0x11, 0x11, "Butterfly Max Mul" )     PORT_DIPLOCATION("DSW-A:!4,!5")
838838   PORT_DIPSETTING(    0x11, "5" )
839839   PORT_DIPSETTING(    0x01, "7" )
840840   PORT_DIPSETTING(    0x10, "8" )
841841   PORT_DIPSETTING(    0x00, "12" )
842   PORT_DIPNAME( 0x0e, 0x00, "Main Win Rate" )         PORT_DIPLOCATION("DSW-A:!6,!7,!8")
842   PORT_DIPNAME( 0x0e, 0x00, "Main Win Rate" )         PORT_DIPLOCATION("DSW-A:!6,!7,!8")
843843   PORT_DIPSETTING(    0x0e, "55%" )
844844   PORT_DIPSETTING(    0x0c, "60%" )
845845   PORT_DIPSETTING(    0x0a, "65%" )
r31373r31374
848848   PORT_DIPSETTING(    0x04, "80%" )
849849   PORT_DIPSETTING(    0x02, "85%" )
850850   PORT_DIPSETTING(    0x00, "90%" )
851   PORT_DIPNAME( 0x20, 0x00, "Reels Speed" )         PORT_DIPLOCATION("DSW-A:!3")
851   PORT_DIPNAME( 0x20, 0x00, "Reels Speed" )           PORT_DIPLOCATION("DSW-A:!3")
852852   PORT_DIPSETTING(    0x20, "Slow" )
853853   PORT_DIPSETTING(    0x00, "Fast" )
854   PORT_DIPNAME( 0x40, 0x00, "Bonus Score" )         PORT_DIPLOCATION("DSW-A:!2")
854   PORT_DIPNAME( 0x40, 0x00, "Bonus Score" )           PORT_DIPLOCATION("DSW-A:!2")
855855   PORT_DIPSETTING(    0x40, "24" )
856856   PORT_DIPSETTING(    0x00, "32" )
857   PORT_DIPNAME( 0x80, 0x00, "Key Out" )            PORT_DIPLOCATION("DSW-A:!1")
857   PORT_DIPNAME( 0x80, 0x00, "Key Out" )               PORT_DIPLOCATION("DSW-A:!1")
858858   PORT_DIPSETTING(    0x00, "x1" )
859859   PORT_DIPSETTING(    0x80, "x100" )
860860
861861   PORT_START("DSW2")  /* $10 (PPI1 port A) */
862   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )      PORT_DIPLOCATION("DSW-B:1")
862   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )      PORT_DIPLOCATION("DSW-B:1")
863863   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
864864   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
865   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("DSW-B:2")
865   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("DSW-B:2")
866866   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
867867   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
868   PORT_DIPNAME( 0x04, 0x04, "Double-Up" )            PORT_DIPLOCATION("DSW-B:3")
868   PORT_DIPNAME( 0x04, 0x04, "Double-Up" )             PORT_DIPLOCATION("DSW-B:3")
869869   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
870870   PORT_DIPSETTING(    0x04, DEF_STR( Yes ) )
871   PORT_DIPNAME( 0x18, 0x18, "Refund Coin Limit" )      PORT_DIPLOCATION("DSW-B:4,5")
871   PORT_DIPNAME( 0x18, 0x18, "Refund Coin Limit" )     PORT_DIPLOCATION("DSW-B:4,5")
872872   PORT_DIPSETTING(    0x00, "0" )
873873   PORT_DIPSETTING(    0x18, "1000" )
874874   PORT_DIPSETTING(    0x10, "2000" )
875875   PORT_DIPSETTING(    0x08, "5000" )
876   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("DSW-B:6")
876   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("DSW-B:6")
877877   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
878878   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
879   PORT_DIPNAME( 0xc0, 0xc0, "Butterfly Win Rate" )   PORT_DIPLOCATION("DSW-B:7,8")
879   PORT_DIPNAME( 0xc0, 0xc0, "Butterfly Win Rate" )    PORT_DIPLOCATION("DSW-B:7,8")
880880   PORT_DIPSETTING(    0xc0, "15%" )
881881   PORT_DIPSETTING(    0x80, "20%" )
882882   PORT_DIPSETTING(    0x40, "25%" )
883883   PORT_DIPSETTING(    0x00, "30%" )
884884
885885   PORT_START("DSW3")  /* AY8910 port A */
886   PORT_DIPNAME( 0x07, 0x07, "Coinage A, B & C" )      PORT_DIPLOCATION("DSW-D:1,2,3")
886   PORT_DIPNAME( 0x07, 0x07, "Coinage A, B & C" )      PORT_DIPLOCATION("DSW-D:1,2,3")
887887   PORT_DIPSETTING(    0x00, "1 Coin / 1 Credit" )
888888   PORT_DIPSETTING(    0x01, "1 Coin / 5 Credits" )
889889   PORT_DIPSETTING(    0x02, "1 Coin / 10 Credits" )
r31373r31374
892892   PORT_DIPSETTING(    0x05, "1 Coin / 40 Credits" )
893893   PORT_DIPSETTING(    0x06, "1 Coin / 50 Credits" )
894894   PORT_DIPSETTING(    0x07, "1 Coin / 100 Credit" )
895   PORT_DIPNAME( 0x18, 0x00, "Credit Limit" )         PORT_DIPLOCATION("DSW-D:4,5")
895   PORT_DIPNAME( 0x18, 0x00, "Credit Limit" )          PORT_DIPLOCATION("DSW-D:4,5")
896896   PORT_DIPSETTING(    0x00, "120000" )
897897   PORT_DIPSETTING(    0x08, "100000" )
898898   PORT_DIPSETTING(    0x10, "80000" )
899899   PORT_DIPSETTING(    0x18, "50000" )
900   PORT_DIPNAME( 0x20, 0x20, "Max Win Bonus" )         PORT_DIPLOCATION("DSW-D:6")
900   PORT_DIPNAME( 0x20, 0x20, "Max Win Bonus" )         PORT_DIPLOCATION("DSW-D:6")
901901   PORT_DIPSETTING(    0x20, "10000" )
902902   PORT_DIPSETTING(    0x00, "20000" )
903   PORT_DIPNAME( 0xc0, 0xc0, "Minimum Bet" )         PORT_DIPLOCATION("DSW-D:7,8")
903   PORT_DIPNAME( 0xc0, 0xc0, "Minimum Bet" )           PORT_DIPLOCATION("DSW-D:7,8")
904904   PORT_DIPSETTING(    0xc0, "8" )
905905   PORT_DIPSETTING(    0x80, "16" )
906906   PORT_DIPSETTING(    0x40, "32" )
907907   PORT_DIPSETTING(    0x00, "64" )
908908
909909   PORT_START("DSW4")  /* AY8910 port B */
910   PORT_DIPNAME( 0x07, 0x07, "Remote Credits" )         PORT_DIPLOCATION("DSW-C:1,2,3")
910   PORT_DIPNAME( 0x07, 0x07, "Remote Credits" )            PORT_DIPLOCATION("DSW-C:1,2,3")
911911   PORT_DIPSETTING(    0x00, "1 Pulse / 100 Credits" )
912912   PORT_DIPSETTING(    0x01, "1 Pulse / 110 Credits" )
913913   PORT_DIPSETTING(    0x02, "1 Pulse / 120 Credits" )
r31373r31374
916916   PORT_DIPSETTING(    0x05, "1 Pulse / 400 Credits" )
917917   PORT_DIPSETTING(    0x06, "1 Pulse / 500 Credits" )
918918   PORT_DIPSETTING(    0x07, "1 Pulse / 1000 Credits" )
919   PORT_DIPNAME( 0x18, 0x18, "High Bet Limit" )         PORT_DIPLOCATION("DSW-C:4,5")
919   PORT_DIPNAME( 0x18, 0x18, "High Bet Limit" )            PORT_DIPLOCATION("DSW-C:4,5")
920920   PORT_DIPSETTING(    0x18, "32" )
921921   PORT_DIPSETTING(    0x10, "50" )
922922   PORT_DIPSETTING(    0x08, "72" )
923923   PORT_DIPSETTING(    0x00, "96" )
924   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )         PORT_DIPLOCATION("DSW-C:6")
924   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )          PORT_DIPLOCATION("DSW-C:6")
925925   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
926926   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
927   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )         PORT_DIPLOCATION("DSW-C:7")
927   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )          PORT_DIPLOCATION("DSW-C:7")
928928   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
929929   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
930   PORT_DIPNAME( 0x80, 0x00, "Coin Lock" )               PORT_DIPLOCATION("DSW-C:8")
930   PORT_DIPNAME( 0x80, 0x00, "Coin Lock" )                 PORT_DIPLOCATION("DSW-C:8")
931931   PORT_DIPSETTING(    0x80, "Locked" )
932932   PORT_DIPSETTING(    0x00, "Normal" )
933933INPUT_PORTS_END
r31373r31374
976976   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT )
977977
978978   PORT_START("DSW1")  /* $02 (PPI0 port C) */
979   PORT_DIPNAME( 0x01, 0x01, "Hardware Type (could be inverted)" )   // leave it off, otherwise the game works bad and resets
979   PORT_DIPNAME( 0x01, 0x01, "Hardware Type (could be inverted)" ) // leave it off, otherwise the game works bad and resets
980980   PORT_DIPSETTING(    0x01, "Rolla" )
981981   PORT_DIPSETTING(    0x00, "Sky" )
982982   PORT_DIPNAME( 0x0e, 0x0e, "Main Game Percentage" )
r31373r31374
11201120   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT )
11211121
11221122   PORT_START("DSW1")  /* $02 (PPI0 port C) */
1123   PORT_DIPNAME( 0x01, 0x01, "Hardware Type (could be inverted)" )   // leave it off, otherwise the game works bad and resets
1123   PORT_DIPNAME( 0x01, 0x01, "Hardware Type (could be inverted)" ) // leave it off, otherwise the game works bad and resets
11241124   PORT_DIPSETTING(    0x01, "Rolla" )
11251125   PORT_DIPSETTING(    0x00, "Sky" )
11261126   PORT_DIPNAME( 0x0e, 0x0e, "Main Game Percentage" )
r31373r31374
11611161   PORT_DIPNAME( 0x10, 0x00, "Title" )
11621162   PORT_DIPSETTING(    0x10, "Petalouda (Greek for Butterfly)" )
11631163   PORT_DIPSETTING(    0x00, "Gallag" )
1164   PORT_DIPNAME( 0x20, 0x20, "Alt GFX Decode (For different HW)" )      // could be a mix with 08 'Rolla GFX'
1164   PORT_DIPNAME( 0x20, 0x20, "Alt GFX Decode (For different HW)" )     // could be a mix with 08 'Rolla GFX'
11651165   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
11661166   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
11671167   PORT_DIPNAME( 0xc0, 0xc0, "Butterfly Win Rate" )
r31373r31374
15021502   ROM_LOAD16_BYTE( "mb.u35", 0x40001, 0x20000, CRC(fdaa2288) SHA1(199323c2bd2af0d9b1d254a330670e2845f21dd9) )
15031503
15041504   ROM_REGION( 0x80000, "gfx2", 0 )
1505   ROM_LOAD16_BYTE( "mb.u52", 0x00000, 0x20000, CRC(15051537) SHA1(086c38c05c605f297a7bc470eb51763a7648e72c) )   // identical to butterfly.
1506   ROM_LOAD16_BYTE( "mb.u54", 0x00001, 0x20000, CRC(8e34d029) SHA1(ae316f2f34768938a07d62db110ce59d2751abaa) )   // identical to butterfly.
1507   ROM_LOAD16_BYTE( "mb.u56", 0x40000, 0x20000, CRC(21ca47f8) SHA1(b192be06a2eb817776309580dc64fd76772a8d50) )   // this one is straight fixed for reel tiles 6C-DF.
1508   ROM_LOAD16_BYTE( "mb.u58", 0x40001, 0x20000, CRC(21ca47f8) SHA1(b192be06a2eb817776309580dc64fd76772a8d50) )   // identical to butterfly.
1505   ROM_LOAD16_BYTE( "mb.u52", 0x00000, 0x20000, CRC(15051537) SHA1(086c38c05c605f297a7bc470eb51763a7648e72c) ) // identical to butterfly.
1506   ROM_LOAD16_BYTE( "mb.u54", 0x00001, 0x20000, CRC(8e34d029) SHA1(ae316f2f34768938a07d62db110ce59d2751abaa) ) // identical to butterfly.
1507   ROM_LOAD16_BYTE( "mb.u56", 0x40000, 0x20000, CRC(21ca47f8) SHA1(b192be06a2eb817776309580dc64fd76772a8d50) ) // this one is straight fixed for reel tiles 6C-DF.
1508   ROM_LOAD16_BYTE( "mb.u58", 0x40001, 0x20000, CRC(21ca47f8) SHA1(b192be06a2eb817776309580dc64fd76772a8d50) ) // identical to butterfly.
15091509ROM_END
15101510
15111511ROM_START( gallag50 )
trunk/src/mame/drivers/bfm_sc4.c
r31373r31374
2347723477
2347823478
2347923479INPUT_PORTS_START( sc4pstat ) // this structure is generated
23480        PORT_INCLUDE( sc4_base )
23481        PORT_MODIFY("IN-1")
23482        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
23483        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
23484        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
23485        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
23486        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
23487        PORT_MODIFY("IN-2")
23488        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
23489        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23490        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23491        PORT_MODIFY("IN-8")
23492        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("up")
23493        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("right")
23494        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("down")
23495        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("left")
23496        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("cash")
23497        PORT_MODIFY("IN-9")
23498        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nudge")
23499        PORT_MODIFY("IN-16")
23500        // 0x0001 - "dil  1" // standard input (motherboard)
23501        // 0x0002 - "dil  2" // standard input (motherboard)
23502        // 0x0004 - "dil  3" // standard input (motherboard)
23503        // 0x0008 - "dil  4" // standard input (motherboard)
23504        // 0x0010 - "dil  5" // standard input (motherboard)
23505        // 0x0100 - "topup" // known extended input, usually 'top up'
23506        PORT_MODIFY("IN-17")
23507        // 0x0001 - "dil  6" // standard input (motherboard)
23508        // 0x0002 - "dil  7" // standard input (motherboard)
23509        // 0x0004 - "dil  8" // standard input (motherboard)
23510        // 0x0008 - "dil  9" // standard input (motherboard)
23511        // 0x0010 - "dil 10" // standard input (motherboard)
23512        PORT_MODIFY("IN-18")
23513        // 0x0001 - "dil 11" // standard input (motherboard)
23514        // 0x0002 - "dil 12" // standard input (motherboard)
23515        // 0x0004 - "dil 13" // standard input (motherboard)
23516        // 0x0008 - "dil 14" // standard input (motherboard)
23517        // 0x0010 - "dil 15" // standard input (motherboard)
23518        PORT_MODIFY("IN-19")
23519        // 0x0001 - "dil 16" // standard input (motherboard)
23520        PORT_MODIFY("IN-20")
23521        // 0x0001 - "test" // standard input (motherboard)
23522        // 0x0002 - "lock" // standard input (expected here)
23523        // 0x0004 - "topdor" // standard input (expected here)
23524        // 0x0008 - "botdor" // standard input (expected here)
23525        // 0x0010 - "hopdmp" // standard input (expected here)
23480      PORT_INCLUDE( sc4_base )
23481      PORT_MODIFY("IN-1")
23482      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
23483      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
23484      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
23485      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
23486      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
23487      PORT_MODIFY("IN-2")
23488      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
23489      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23490      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23491      PORT_MODIFY("IN-8")
23492      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("up")
23493      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("right")
23494      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("down")
23495      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("left")
23496      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("cash")
23497      PORT_MODIFY("IN-9")
23498      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nudge")
23499      PORT_MODIFY("IN-16")
23500      // 0x0001 - "dil  1" // standard input (motherboard)
23501      // 0x0002 - "dil  2" // standard input (motherboard)
23502      // 0x0004 - "dil  3" // standard input (motherboard)
23503      // 0x0008 - "dil  4" // standard input (motherboard)
23504      // 0x0010 - "dil  5" // standard input (motherboard)
23505      // 0x0100 - "topup" // known extended input, usually 'top up'
23506      PORT_MODIFY("IN-17")
23507      // 0x0001 - "dil  6" // standard input (motherboard)
23508      // 0x0002 - "dil  7" // standard input (motherboard)
23509      // 0x0004 - "dil  8" // standard input (motherboard)
23510      // 0x0008 - "dil  9" // standard input (motherboard)
23511      // 0x0010 - "dil 10" // standard input (motherboard)
23512      PORT_MODIFY("IN-18")
23513      // 0x0001 - "dil 11" // standard input (motherboard)
23514      // 0x0002 - "dil 12" // standard input (motherboard)
23515      // 0x0004 - "dil 13" // standard input (motherboard)
23516      // 0x0008 - "dil 14" // standard input (motherboard)
23517      // 0x0010 - "dil 15" // standard input (motherboard)
23518      PORT_MODIFY("IN-19")
23519      // 0x0001 - "dil 16" // standard input (motherboard)
23520      PORT_MODIFY("IN-20")
23521      // 0x0001 - "test" // standard input (motherboard)
23522      // 0x0002 - "lock" // standard input (expected here)
23523      // 0x0004 - "topdor" // standard input (expected here)
23524      // 0x0008 - "botdor" // standard input (expected here)
23525      // 0x0010 - "hopdmp" // standard input (expected here)
2352623526INPUT_PORTS_END
2352723527
2352823528// can't get past 'read meters'
r31373r31374
2357123571}
2357223572
2357323573INPUT_PORTS_START( sc4cvani ) // this structure is generated
23574        PORT_INCLUDE( sc4_base )
23575        PORT_MODIFY("IN-1")
23576        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
23577        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("exchge")
23578        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
23579        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
23580        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
23581        PORT_MODIFY("IN-2")
23582        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("collet")
23583        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23584        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23585        PORT_MODIFY("IN-8")
23586        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("low r")
23587        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("low l")
23588        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("high l")
23589        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("high r")
23590        PORT_MODIFY("IN-16")
23591        // 0x0001 - "dil  1" // standard input (motherboard)
23592        // 0x0002 - "dil  2" // standard input (motherboard)
23593        // 0x0004 - "dil  3" // standard input (motherboard)
23594        // 0x0008 - "dil  4" // standard input (motherboard)
23595        // 0x0010 - "dil  5" // standard input (motherboard)
23596        // 0x0100 - "topup" // known extended input, usually 'top up'
23597        PORT_MODIFY("IN-17")
23598        // 0x0001 - "dil  6" // standard input (motherboard)
23599        // 0x0002 - "dil  7" // standard input (motherboard)
23600        // 0x0004 - "dil  8" // standard input (motherboard)
23601        // 0x0008 - "dil  9" // standard input (motherboard)
23602        // 0x0010 - "dil 10" // standard input (motherboard)
23603        PORT_MODIFY("IN-18")
23604        // 0x0001 - "dil 11" // standard input (motherboard)
23605        // 0x0002 - "dil 12" // standard input (motherboard)
23606        // 0x0004 - "dil 13" // standard input (motherboard)
23607        // 0x0008 - "dil 14" // standard input (motherboard)
23608        // 0x0010 - "dil 15" // standard input (motherboard)
23609        PORT_MODIFY("IN-19")
23610        // 0x0001 - "dil 16" // standard input (motherboard)
23611        PORT_MODIFY("IN-20")
23612        // 0x0001 - "test" // standard input (motherboard)
23613        // 0x0002 - "lock" // standard input (expected here)
23614        // 0x0004 - "topdor" // standard input (expected here)
23615        // 0x0008 - "botdor" // standard input (expected here)
23616        // 0x0010 - "hopdmp" // standard input (expected here)
23574      PORT_INCLUDE( sc4_base )
23575      PORT_MODIFY("IN-1")
23576      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
23577      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("exchge")
23578      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
23579      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
23580      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
23581      PORT_MODIFY("IN-2")
23582      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("collet")
23583      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23584      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23585      PORT_MODIFY("IN-8")
23586      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("low r")
23587      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("low l")
23588      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("high l")
23589      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("high r")
23590      PORT_MODIFY("IN-16")
23591      // 0x0001 - "dil  1" // standard input (motherboard)
23592      // 0x0002 - "dil  2" // standard input (motherboard)
23593      // 0x0004 - "dil  3" // standard input (motherboard)
23594      // 0x0008 - "dil  4" // standard input (motherboard)
23595      // 0x0010 - "dil  5" // standard input (motherboard)
23596      // 0x0100 - "topup" // known extended input, usually 'top up'
23597      PORT_MODIFY("IN-17")
23598      // 0x0001 - "dil  6" // standard input (motherboard)
23599      // 0x0002 - "dil  7" // standard input (motherboard)
23600      // 0x0004 - "dil  8" // standard input (motherboard)
23601      // 0x0008 - "dil  9" // standard input (motherboard)
23602      // 0x0010 - "dil 10" // standard input (motherboard)
23603      PORT_MODIFY("IN-18")
23604      // 0x0001 - "dil 11" // standard input (motherboard)
23605      // 0x0002 - "dil 12" // standard input (motherboard)
23606      // 0x0004 - "dil 13" // standard input (motherboard)
23607      // 0x0008 - "dil 14" // standard input (motherboard)
23608      // 0x0010 - "dil 15" // standard input (motherboard)
23609      PORT_MODIFY("IN-19")
23610      // 0x0001 - "dil 16" // standard input (motherboard)
23611      PORT_MODIFY("IN-20")
23612      // 0x0001 - "test" // standard input (motherboard)
23613      // 0x0002 - "lock" // standard input (expected here)
23614      // 0x0004 - "topdor" // standard input (expected here)
23615      // 0x0008 - "botdor" // standard input (expected here)
23616      // 0x0010 - "hopdmp" // standard input (expected here)
2361723617INPUT_PORTS_END
2361823618
2361923619// PR2052 CASHLVANIA         VANIASND           CASH'!'VANIA
r31373r31374
2365123651}
2365223652
2365323653INPUT_PORTS_START( sc4cvclb ) // this structure is generated
23654        PORT_INCLUDE( sc4_base )
23655        PORT_MODIFY("IN-1")
23656        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
23657        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
23658        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
23659        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
23660        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
23661        PORT_MODIFY("IN-2")
23662        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
23663        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stop")
23664        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23665        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23666        PORT_MODIFY("IN-8")
23667        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("high l")
23668        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("high r")
23669        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nudges")
23670        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("low r")
23671        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("low l")
23672        PORT_MODIFY("IN-9")
23673        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("igor")
23674        PORT_MODIFY("IN-16")
23675        // 0x0001 - "dil  1" // standard input (motherboard)
23676        // 0x0002 - "dil  2" // standard input (motherboard)
23677        // 0x0004 - "dil  3" // standard input (motherboard)
23678        // 0x0008 - "dil  4" // standard input (motherboard)
23679        // 0x0010 - "dil  5" // standard input (motherboard)
23680        // 0x0100 - "topup" // known extended input, usually 'top up'
23681        PORT_MODIFY("IN-17")
23682        // 0x0001 - "dil  6" // standard input (motherboard)
23683        // 0x0002 - "dil  7" // standard input (motherboard)
23684        // 0x0004 - "dil  8" // standard input (motherboard)
23685        // 0x0008 - "dil  9" // standard input (motherboard)
23686        // 0x0010 - "dil 10" // standard input (motherboard)
23687        PORT_MODIFY("IN-18")
23688        // 0x0001 - "dil 11" // standard input (motherboard)
23689        // 0x0002 - "dil 12" // standard input (motherboard)
23690        // 0x0004 - "dil 13" // standard input (motherboard)
23691        // 0x0008 - "dil 14" // standard input (motherboard)
23692        // 0x0010 - "dil 15" // standard input (motherboard)
23693        PORT_MODIFY("IN-19")
23694        // 0x0001 - "dil 16" // standard input (motherboard)
23695        PORT_MODIFY("IN-20")
23696        // 0x0001 - "test" // standard input (motherboard)
23697        // 0x0002 - "lock" // standard input (expected here)
23698        // 0x0004 - "topdor" // standard input (expected here)
23699        // 0x0008 - "botdor" // standard input (expected here)
23700        // 0x0010 - "hopdmp" // standard input (expected here)
23654      PORT_INCLUDE( sc4_base )
23655      PORT_MODIFY("IN-1")
23656      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
23657      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
23658      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
23659      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
23660      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
23661      PORT_MODIFY("IN-2")
23662      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
23663      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stop")
23664      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23665      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23666      PORT_MODIFY("IN-8")
23667      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("high l")
23668      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("high r")
23669      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nudges")
23670      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("low r")
23671      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("low l")
23672      PORT_MODIFY("IN-9")
23673      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("igor")
23674      PORT_MODIFY("IN-16")
23675      // 0x0001 - "dil  1" // standard input (motherboard)
23676      // 0x0002 - "dil  2" // standard input (motherboard)
23677      // 0x0004 - "dil  3" // standard input (motherboard)
23678      // 0x0008 - "dil  4" // standard input (motherboard)
23679      // 0x0010 - "dil  5" // standard input (motherboard)
23680      // 0x0100 - "topup" // known extended input, usually 'top up'
23681      PORT_MODIFY("IN-17")
23682      // 0x0001 - "dil  6" // standard input (motherboard)
23683      // 0x0002 - "dil  7" // standard input (motherboard)
23684      // 0x0004 - "dil  8" // standard input (motherboard)
23685      // 0x0008 - "dil  9" // standard input (motherboard)
23686      // 0x0010 - "dil 10" // standard input (motherboard)
23687      PORT_MODIFY("IN-18")
23688      // 0x0001 - "dil 11" // standard input (motherboard)
23689      // 0x0002 - "dil 12" // standard input (motherboard)
23690      // 0x0004 - "dil 13" // standard input (motherboard)
23691      // 0x0008 - "dil 14" // standard input (motherboard)
23692      // 0x0010 - "dil 15" // standard input (motherboard)
23693      PORT_MODIFY("IN-19")
23694      // 0x0001 - "dil 16" // standard input (motherboard)
23695      PORT_MODIFY("IN-20")
23696      // 0x0001 - "test" // standard input (motherboard)
23697      // 0x0002 - "lock" // standard input (expected here)
23698      // 0x0004 - "topdor" // standard input (expected here)
23699      // 0x0008 - "botdor" // standard input (expected here)
23700      // 0x0010 - "hopdmp" // standard input (expected here)
2370123701INPUT_PORTS_END
2370223702
2370323703// PRXXXX CLUBCASHLVANIA V1.0         CLUBVANIASND         CLUB  CASH!VANIA
r31373r31374
2373723737
2373823738// inputs are from sc4gcclbl, the earlier(?) sets don't appear to have the structure filled in
2373923739INPUT_PORTS_START( sc4gcclbl ) // this structure is generated
23740        PORT_INCLUDE( sc4_base )
23741        PORT_MODIFY("IN-1")
23742        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
23743        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
23744        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
23745        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
23746        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stake1")
23747        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
23748        PORT_MODIFY("IN-2")
23749        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake2")
23750        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stake3")
23751        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23752        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23753        PORT_MODIFY("IN-3")
23754        // 0x0004 - "stk 4" // standard input (expected here)
23755        // 0x0008 - "stk 3" // standard input (expected here)
23756        // 0x0010 - "stk 2" // standard input (expected here)
23757        PORT_MODIFY("IN-4")
23758        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
23759        PORT_MODIFY("IN-5")
23760        // 0x0001 - "priz4" // standard input (expected here)
23761        // 0x0002 - "priz3" // standard input (expected here)
23762        // 0x0004 - "priz2" // standard input (expected here)
23763        // 0x0008 - "priz1" // standard input (expected here)
23764        PORT_MODIFY("IN-16")
23765        // 0x0001 - "dil 1" // standard input (motherboard)
23766        // 0x0002 - "dil 2" // standard input (motherboard)
23767        // 0x0004 - "dil 3" // standard input (motherboard)
23768        // 0x0008 - "dil 4" // standard input (motherboard)
23769        // 0x0010 - "dil 5" // standard input (motherboard)
23770        // 0x0100 - "top up" // known extended input, usually 'top up'
23771        PORT_MODIFY("IN-17")
23772        // 0x0001 - "dil 6" // standard input (motherboard)
23773        // 0x0002 - "dil 7" // standard input (motherboard)
23774        // 0x0004 - "dil 8" // standard input (motherboard)
23775        // 0x0008 - "dil 9" // standard input (motherboard)
23776        // 0x0010 - "dil10" // standard input (motherboard)
23777        PORT_MODIFY("IN-18")
23778        // 0x0001 - "dil11" // standard input (motherboard)
23779        // 0x0002 - "dil12" // standard input (motherboard)
23780        // 0x0004 - "dil13" // standard input (motherboard)
23781        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
23782        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
23783        PORT_MODIFY("IN-19")
23784        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
23785        PORT_MODIFY("IN-20")
23786        // 0x0001 - "grnbut" // standard input (motherboard)
23787        // 0x0004 - "botdor" // standard input (expected here)
23788        // 0x0008 - "hopdmp" // standard input (expected here)
23789        // 0x0010 - "topdor" // standard input (expected here)
23740      PORT_INCLUDE( sc4_base )
23741      PORT_MODIFY("IN-1")
23742      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
23743      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
23744      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
23745      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
23746      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stake1")
23747      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
23748      PORT_MODIFY("IN-2")
23749      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake2")
23750      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stake3")
23751      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23752      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23753      PORT_MODIFY("IN-3")
23754      // 0x0004 - "stk 4" // standard input (expected here)
23755      // 0x0008 - "stk 3" // standard input (expected here)
23756      // 0x0010 - "stk 2" // standard input (expected here)
23757      PORT_MODIFY("IN-4")
23758      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
23759      PORT_MODIFY("IN-5")
23760      // 0x0001 - "priz4" // standard input (expected here)
23761      // 0x0002 - "priz3" // standard input (expected here)
23762      // 0x0004 - "priz2" // standard input (expected here)
23763      // 0x0008 - "priz1" // standard input (expected here)
23764      PORT_MODIFY("IN-16")
23765      // 0x0001 - "dil 1" // standard input (motherboard)
23766      // 0x0002 - "dil 2" // standard input (motherboard)
23767      // 0x0004 - "dil 3" // standard input (motherboard)
23768      // 0x0008 - "dil 4" // standard input (motherboard)
23769      // 0x0010 - "dil 5" // standard input (motherboard)
23770      // 0x0100 - "top up" // known extended input, usually 'top up'
23771      PORT_MODIFY("IN-17")
23772      // 0x0001 - "dil 6" // standard input (motherboard)
23773      // 0x0002 - "dil 7" // standard input (motherboard)
23774      // 0x0004 - "dil 8" // standard input (motherboard)
23775      // 0x0008 - "dil 9" // standard input (motherboard)
23776      // 0x0010 - "dil10" // standard input (motherboard)
23777      PORT_MODIFY("IN-18")
23778      // 0x0001 - "dil11" // standard input (motherboard)
23779      // 0x0002 - "dil12" // standard input (motherboard)
23780      // 0x0004 - "dil13" // standard input (motherboard)
23781      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
23782      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
23783      PORT_MODIFY("IN-19")
23784      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
23785      PORT_MODIFY("IN-20")
23786      // 0x0001 - "grnbut" // standard input (motherboard)
23787      // 0x0004 - "botdor" // standard input (expected here)
23788      // 0x0008 - "hopdmp" // standard input (expected here)
23789      // 0x0010 - "topdor" // standard input (expected here)
2379023790INPUT_PORTS_END
2379123791
2379223792// this was marked (and has the header) GRAND CASINO, and was paired with some (bad dumps) of 'Grand Casino' sound roms, but it actually
r31373r31374
2383223832}
2383323833
2383423834INPUT_PORTS_START( sc4botn ) // this structure is generated
23835        PORT_INCLUDE( sc4_base )
23836        PORT_MODIFY("IN-1")
23837        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
23838        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
23839        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
23840        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
23841        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exchge")
23842        PORT_MODIFY("IN-2")
23843        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
23844        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23845        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23846        PORT_MODIFY("IN-8")
23847        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
23848        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("spins")
23849        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c pot")
23850        PORT_MODIFY("IN-16")
23851        // 0x0001 - "dil  1" // standard input (motherboard)
23852        // 0x0002 - "dil  2" // standard input (motherboard)
23853        // 0x0004 - "dil  3" // standard input (motherboard)
23854        // 0x0008 - "dil  4" // standard input (motherboard)
23855        // 0x0010 - "dil  5" // standard input (motherboard)
23856        // 0x0100 - "topup" // known extended input, usually 'top up'
23857        PORT_MODIFY("IN-17")
23858        // 0x0001 - "dil  6" // standard input (motherboard)
23859        // 0x0002 - "dil  7" // standard input (motherboard)
23860        // 0x0004 - "dil  8" // standard input (motherboard)
23861        // 0x0008 - "dil  9" // standard input (motherboard)
23862        // 0x0010 - "dil 10" // standard input (motherboard)
23863        PORT_MODIFY("IN-18")
23864        // 0x0001 - "dil 11" // standard input (motherboard)
23865        // 0x0002 - "dil 12" // standard input (motherboard)
23866        // 0x0004 - "dil 13" // standard input (motherboard)
23867        // 0x0008 - "dil 14" // standard input (motherboard)
23868        // 0x0010 - "dil 15" // standard input (motherboard)
23869        PORT_MODIFY("IN-19")
23870        // 0x0001 - "dil 16" // standard input (motherboard)
23871        PORT_MODIFY("IN-20")
23872        // 0x0001 - "test" // standard input (motherboard)
23873        // 0x0002 - "lock" // standard input (expected here)
23874        // 0x0004 - "topdor" // standard input (expected here)
23875        // 0x0008 - "botdor" // standard input (expected here)
23876        // 0x0010 - "hopdmp" // standard input (expected here)
23835      PORT_INCLUDE( sc4_base )
23836      PORT_MODIFY("IN-1")
23837      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
23838      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
23839      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
23840      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
23841      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exchge")
23842      PORT_MODIFY("IN-2")
23843      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
23844      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23845      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23846      PORT_MODIFY("IN-8")
23847      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
23848      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("spins")
23849      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c pot")
23850      PORT_MODIFY("IN-16")
23851      // 0x0001 - "dil  1" // standard input (motherboard)
23852      // 0x0002 - "dil  2" // standard input (motherboard)
23853      // 0x0004 - "dil  3" // standard input (motherboard)
23854      // 0x0008 - "dil  4" // standard input (motherboard)
23855      // 0x0010 - "dil  5" // standard input (motherboard)
23856      // 0x0100 - "topup" // known extended input, usually 'top up'
23857      PORT_MODIFY("IN-17")
23858      // 0x0001 - "dil  6" // standard input (motherboard)
23859      // 0x0002 - "dil  7" // standard input (motherboard)
23860      // 0x0004 - "dil  8" // standard input (motherboard)
23861      // 0x0008 - "dil  9" // standard input (motherboard)
23862      // 0x0010 - "dil 10" // standard input (motherboard)
23863      PORT_MODIFY("IN-18")
23864      // 0x0001 - "dil 11" // standard input (motherboard)
23865      // 0x0002 - "dil 12" // standard input (motherboard)
23866      // 0x0004 - "dil 13" // standard input (motherboard)
23867      // 0x0008 - "dil 14" // standard input (motherboard)
23868      // 0x0010 - "dil 15" // standard input (motherboard)
23869      PORT_MODIFY("IN-19")
23870      // 0x0001 - "dil 16" // standard input (motherboard)
23871      PORT_MODIFY("IN-20")
23872      // 0x0001 - "test" // standard input (motherboard)
23873      // 0x0002 - "lock" // standard input (expected here)
23874      // 0x0004 - "topdor" // standard input (expected here)
23875      // 0x0008 - "botdor" // standard input (expected here)
23876      // 0x0010 - "hopdmp" // standard input (expected here)
2387723877INPUT_PORTS_END
2387823878
2387923879// PR2538 BACK OF THE NET V011         BACKOFTHENETSND         BACK OF THE NET
r31373r31374
2390423904}
2390523905
2390623906INPUT_PORTS_START( sc4bbclb ) // this structure is generated
23907        PORT_INCLUDE( sc4_base )
23908        PORT_MODIFY("IN-1")
23909        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
23910        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
23911        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
23912        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
23913        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
23914        PORT_MODIFY("IN-2")
23915        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
23916        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23917        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23918        PORT_MODIFY("IN-8")
23919        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
23920        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("qps")
23921        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spin")
23922        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
23923        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("nudges")
23924        PORT_MODIFY("IN-16")
23925        // 0x0001 - "dil  1" // standard input (motherboard)
23926        // 0x0002 - "dil  2" // standard input (motherboard)
23927        // 0x0004 - "dil  3" // standard input (motherboard)
23928        // 0x0008 - "dil  4" // standard input (motherboard)
23929        // 0x0010 - "dil  5" // standard input (motherboard)
23930        // 0x0100 - "topup" // known extended input, usually 'top up'
23931        PORT_MODIFY("IN-17")
23932        // 0x0001 - "dil  6" // standard input (motherboard)
23933        // 0x0002 - "dil  7" // standard input (motherboard)
23934        // 0x0004 - "dil  8" // standard input (motherboard)
23935        // 0x0008 - "dil  9" // standard input (motherboard)
23936        // 0x0010 - "dil 10" // standard input (motherboard)
23937        PORT_MODIFY("IN-18")
23938        // 0x0001 - "dil 11" // standard input (motherboard)
23939        // 0x0002 - "dil 12" // standard input (motherboard)
23940        // 0x0004 - "dil 13" // standard input (motherboard)
23941        // 0x0008 - "dil 14" // standard input (motherboard)
23942        // 0x0010 - "dil 15" // standard input (motherboard)
23943        PORT_MODIFY("IN-19")
23944        // 0x0001 - "dil 16" // standard input (motherboard)
23945        PORT_MODIFY("IN-20")
23946        // 0x0001 - "test" // standard input (motherboard)
23947        // 0x0002 - "lock" // standard input (expected here)
23948        // 0x0004 - "topdor" // standard input (expected here)
23949        // 0x0008 - "botdor" // standard input (expected here)
23950        // 0x0010 - "hopdmp" // standard input (expected here)
23907      PORT_INCLUDE( sc4_base )
23908      PORT_MODIFY("IN-1")
23909      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
23910      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
23911      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
23912      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
23913      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
23914      PORT_MODIFY("IN-2")
23915      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
23916      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23917      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23918      PORT_MODIFY("IN-8")
23919      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
23920      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("qps")
23921      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spin")
23922      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
23923      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("nudges")
23924      PORT_MODIFY("IN-16")
23925      // 0x0001 - "dil  1" // standard input (motherboard)
23926      // 0x0002 - "dil  2" // standard input (motherboard)
23927      // 0x0004 - "dil  3" // standard input (motherboard)
23928      // 0x0008 - "dil  4" // standard input (motherboard)
23929      // 0x0010 - "dil  5" // standard input (motherboard)
23930      // 0x0100 - "topup" // known extended input, usually 'top up'
23931      PORT_MODIFY("IN-17")
23932      // 0x0001 - "dil  6" // standard input (motherboard)
23933      // 0x0002 - "dil  7" // standard input (motherboard)
23934      // 0x0004 - "dil  8" // standard input (motherboard)
23935      // 0x0008 - "dil  9" // standard input (motherboard)
23936      // 0x0010 - "dil 10" // standard input (motherboard)
23937      PORT_MODIFY("IN-18")
23938      // 0x0001 - "dil 11" // standard input (motherboard)
23939      // 0x0002 - "dil 12" // standard input (motherboard)
23940      // 0x0004 - "dil 13" // standard input (motherboard)
23941      // 0x0008 - "dil 14" // standard input (motherboard)
23942      // 0x0010 - "dil 15" // standard input (motherboard)
23943      PORT_MODIFY("IN-19")
23944      // 0x0001 - "dil 16" // standard input (motherboard)
23945      PORT_MODIFY("IN-20")
23946      // 0x0001 - "test" // standard input (motherboard)
23947      // 0x0002 - "lock" // standard input (expected here)
23948      // 0x0004 - "topdor" // standard input (expected here)
23949      // 0x0008 - "botdor" // standard input (expected here)
23950      // 0x0010 - "hopdmp" // standard input (expected here)
2395123951INPUT_PORTS_END
2395223952
2395323953// doesn't play
r31373r31374
2397923979}
2398023980
2398123981INPUT_PORTS_START( sc4captn ) // this structure is generated
23982        PORT_INCLUDE( sc4_base )
23983        PORT_MODIFY("IN-1")
23984        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
23985        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
23986        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
23987        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
23988        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
23989        PORT_MODIFY("IN-2")
23990        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
23991        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23992        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23993        PORT_MODIFY("IN-4")
23994        // 0x0010 - "topup" // known extended(?) input, sometimes 'top up'
23995        PORT_MODIFY("IN-8")
23996        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkndge")
23997        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk ko")
23998        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("featre OR tkfeat")
23999        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("cash OR tkcash")
24000        PORT_MODIFY("IN-16")
24001        // 0x0001 - "dil  1" // standard input (motherboard)
24002        // 0x0002 - "dil  2" // standard input (motherboard)
24003        // 0x0004 - "dil  3" // standard input (motherboard)
24004        // 0x0008 - "dil  4" // standard input (motherboard)
24005        // 0x0010 - "dil  5" // standard input (motherboard)
24006        PORT_MODIFY("IN-17")
24007        // 0x0001 - "dil  6" // standard input (motherboard)
24008        // 0x0002 - "dil  7" // standard input (motherboard)
24009        // 0x0004 - "dil  8" // standard input (motherboard)
24010        // 0x0008 - "dil  9" // standard input (motherboard)
24011        // 0x0010 - "dil 10" // standard input (motherboard)
24012        PORT_MODIFY("IN-18")
24013        // 0x0001 - "dil 11" // standard input (motherboard)
24014        // 0x0002 - "dil 12" // standard input (motherboard)
24015        // 0x0004 - "dil 13" // standard input (motherboard)
24016        // 0x0008 - "dil 14" // standard input (motherboard)
24017        // 0x0010 - "dil 15" // standard input (motherboard)
24018        PORT_MODIFY("IN-19")
24019        // 0x0001 - "dil 16" // standard input (motherboard)
24020        PORT_MODIFY("IN-20")
24021        // 0x0001 - "test" // standard input (motherboard)
24022        // 0x0002 - "lock" // standard input (expected here)
24023        // 0x0004 - "topdor" // standard input (expected here)
24024        // 0x0008 - "botdor" // standard input (expected here)
24025        // 0x0010 - "hopdmp" // standard input (expected here)
23982      PORT_INCLUDE( sc4_base )
23983      PORT_MODIFY("IN-1")
23984      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
23985      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
23986      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
23987      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
23988      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
23989      PORT_MODIFY("IN-2")
23990      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
23991      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
23992      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
23993      PORT_MODIFY("IN-4")
23994      // 0x0010 - "topup" // known extended(?) input, sometimes 'top up'
23995      PORT_MODIFY("IN-8")
23996      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkndge")
23997      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk ko")
23998      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("featre OR tkfeat")
23999      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("cash OR tkcash")
24000      PORT_MODIFY("IN-16")
24001      // 0x0001 - "dil  1" // standard input (motherboard)
24002      // 0x0002 - "dil  2" // standard input (motherboard)
24003      // 0x0004 - "dil  3" // standard input (motherboard)
24004      // 0x0008 - "dil  4" // standard input (motherboard)
24005      // 0x0010 - "dil  5" // standard input (motherboard)
24006      PORT_MODIFY("IN-17")
24007      // 0x0001 - "dil  6" // standard input (motherboard)
24008      // 0x0002 - "dil  7" // standard input (motherboard)
24009      // 0x0004 - "dil  8" // standard input (motherboard)
24010      // 0x0008 - "dil  9" // standard input (motherboard)
24011      // 0x0010 - "dil 10" // standard input (motherboard)
24012      PORT_MODIFY("IN-18")
24013      // 0x0001 - "dil 11" // standard input (motherboard)
24014      // 0x0002 - "dil 12" // standard input (motherboard)
24015      // 0x0004 - "dil 13" // standard input (motherboard)
24016      // 0x0008 - "dil 14" // standard input (motherboard)
24017      // 0x0010 - "dil 15" // standard input (motherboard)
24018      PORT_MODIFY("IN-19")
24019      // 0x0001 - "dil 16" // standard input (motherboard)
24020      PORT_MODIFY("IN-20")
24021      // 0x0001 - "test" // standard input (motherboard)
24022      // 0x0002 - "lock" // standard input (expected here)
24023      // 0x0004 - "topdor" // standard input (expected here)
24024      // 0x0008 - "botdor" // standard input (expected here)
24025      // 0x0010 - "hopdmp" // standard input (expected here)
2402624026INPUT_PORTS_END
2402724027
2402824028// PR2013 CAPTAIN CASH         CCASH SOUNDS           CAPTAIN  CASH
r31373r31374
2405224052}
2405324053
2405424054INPUT_PORTS_START( sc4cmous ) // this structure is generated
24055        PORT_INCLUDE( sc4_base )
24056        PORT_MODIFY("IN-1")
24057        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
24058        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24059        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24060        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24061        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("transf")
24062        PORT_MODIFY("IN-2")
24063        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24064        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24065        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24066        PORT_MODIFY("IN-8")
24067        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
24068        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c pot")
24069        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spins")
24070        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nudge")
24071        PORT_MODIFY("IN-16")
24072        // 0x0001 - "dil  1" // standard input (motherboard)
24073        // 0x0002 - "dil  2" // standard input (motherboard)
24074        // 0x0004 - "dil  3" // standard input (motherboard)
24075        // 0x0008 - "dil  4" // standard input (motherboard)
24076        // 0x0010 - "dil  5" // standard input (motherboard)
24077        // 0x0100 - "topup" // known extended input, usually 'top up'
24078        PORT_MODIFY("IN-17")
24079        // 0x0001 - "dil  6" // standard input (motherboard)
24080        // 0x0002 - "dil  7" // standard input (motherboard)
24081        // 0x0004 - "dil  8" // standard input (motherboard)
24082        // 0x0008 - "dil  9" // standard input (motherboard)
24083        // 0x0010 - "dil 10" // standard input (motherboard)
24084        PORT_MODIFY("IN-18")
24085        // 0x0001 - "dil 11" // standard input (motherboard)
24086        // 0x0002 - "dil 12" // standard input (motherboard)
24087        // 0x0004 - "dil 13" // standard input (motherboard)
24088        // 0x0008 - "dil 14" // standard input (motherboard)
24089        // 0x0010 - "dil 15" // standard input (motherboard)
24090        PORT_MODIFY("IN-19")
24091        // 0x0001 - "dil 16" // standard input (motherboard)
24092        PORT_MODIFY("IN-20")
24093        // 0x0001 - "test" // standard input (motherboard)
24094        // 0x0002 - "lock" // standard input (expected here)
24095        // 0x0004 - "topdor" // standard input (expected here)
24096        // 0x0008 - "botdor" // standard input (expected here)
24097        // 0x0010 - "hopdmp" // standard input (expected here)
24055      PORT_INCLUDE( sc4_base )
24056      PORT_MODIFY("IN-1")
24057      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
24058      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24059      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24060      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24061      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("transf")
24062      PORT_MODIFY("IN-2")
24063      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24064      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24065      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24066      PORT_MODIFY("IN-8")
24067      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
24068      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c pot")
24069      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spins")
24070      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nudge")
24071      PORT_MODIFY("IN-16")
24072      // 0x0001 - "dil  1" // standard input (motherboard)
24073      // 0x0002 - "dil  2" // standard input (motherboard)
24074      // 0x0004 - "dil  3" // standard input (motherboard)
24075      // 0x0008 - "dil  4" // standard input (motherboard)
24076      // 0x0010 - "dil  5" // standard input (motherboard)
24077      // 0x0100 - "topup" // known extended input, usually 'top up'
24078      PORT_MODIFY("IN-17")
24079      // 0x0001 - "dil  6" // standard input (motherboard)
24080      // 0x0002 - "dil  7" // standard input (motherboard)
24081      // 0x0004 - "dil  8" // standard input (motherboard)
24082      // 0x0008 - "dil  9" // standard input (motherboard)
24083      // 0x0010 - "dil 10" // standard input (motherboard)
24084      PORT_MODIFY("IN-18")
24085      // 0x0001 - "dil 11" // standard input (motherboard)
24086      // 0x0002 - "dil 12" // standard input (motherboard)
24087      // 0x0004 - "dil 13" // standard input (motherboard)
24088      // 0x0008 - "dil 14" // standard input (motherboard)
24089      // 0x0010 - "dil 15" // standard input (motherboard)
24090      PORT_MODIFY("IN-19")
24091      // 0x0001 - "dil 16" // standard input (motherboard)
24092      PORT_MODIFY("IN-20")
24093      // 0x0001 - "test" // standard input (motherboard)
24094      // 0x0002 - "lock" // standard input (expected here)
24095      // 0x0004 - "topdor" // standard input (expected here)
24096      // 0x0008 - "botdor" // standard input (expected here)
24097      // 0x0010 - "hopdmp" // standard input (expected here)
2409824098INPUT_PORTS_END
2409924099
2410024100// PR2534 CASH AND MOUSE V041         CASHANDMOUSESND          CASH AND MOUSE
r31373r31374
2412824128}
2412924129
2413024130INPUT_PORTS_START( sc4cad ) // this structure is generated
24131        PORT_INCLUDE( sc4_base )
24132        PORT_MODIFY("IN-1")
24133        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24134        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24135        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24136        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24137        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
24138        PORT_MODIFY("IN-2")
24139        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24140        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24141        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24142        PORT_MODIFY("IN-8")
24143        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
24144        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c pot")
24145        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("dice")
24146        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nudge")
24147        PORT_MODIFY("IN-16")
24148        // 0x0001 - "dil  1" // standard input (motherboard)
24149        // 0x0002 - "dil  2" // standard input (motherboard)
24150        // 0x0004 - "dil  3" // standard input (motherboard)
24151        // 0x0008 - "dil  4" // standard input (motherboard)
24152        // 0x0010 - "dil  5" // standard input (motherboard)
24153        // 0x0100 - "topup" // known extended input, usually 'top up'
24154        PORT_MODIFY("IN-17")
24155        // 0x0001 - "dil  6" // standard input (motherboard)
24156        // 0x0002 - "dil  7" // standard input (motherboard)
24157        // 0x0004 - "dil  8" // standard input (motherboard)
24158        // 0x0008 - "dil  9" // standard input (motherboard)
24159        // 0x0010 - "dil 10" // standard input (motherboard)
24160        PORT_MODIFY("IN-18")
24161        // 0x0001 - "dil 11" // standard input (motherboard)
24162        // 0x0002 - "dil 12" // standard input (motherboard)
24163        // 0x0004 - "dil 13" // standard input (motherboard)
24164        // 0x0008 - "dil 14" // standard input (motherboard)
24165        // 0x0010 - "dil 15" // standard input (motherboard)
24166        PORT_MODIFY("IN-19")
24167        // 0x0001 - "dil 16" // standard input (motherboard)
24168        PORT_MODIFY("IN-20")
24169        // 0x0001 - "test" // standard input (motherboard)
24170        // 0x0002 - "lock" // standard input (expected here)
24171        // 0x0004 - "topdor" // standard input (expected here)
24172        // 0x0008 - "botdor" // standard input (expected here)
24173        // 0x0010 - "hopdmp" // standard input (expected here)
24131      PORT_INCLUDE( sc4_base )
24132      PORT_MODIFY("IN-1")
24133      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24134      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24135      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24136      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24137      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
24138      PORT_MODIFY("IN-2")
24139      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24140      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24141      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24142      PORT_MODIFY("IN-8")
24143      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
24144      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c pot")
24145      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("dice")
24146      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nudge")
24147      PORT_MODIFY("IN-16")
24148      // 0x0001 - "dil  1" // standard input (motherboard)
24149      // 0x0002 - "dil  2" // standard input (motherboard)
24150      // 0x0004 - "dil  3" // standard input (motherboard)
24151      // 0x0008 - "dil  4" // standard input (motherboard)
24152      // 0x0010 - "dil  5" // standard input (motherboard)
24153      // 0x0100 - "topup" // known extended input, usually 'top up'
24154      PORT_MODIFY("IN-17")
24155      // 0x0001 - "dil  6" // standard input (motherboard)
24156      // 0x0002 - "dil  7" // standard input (motherboard)
24157      // 0x0004 - "dil  8" // standard input (motherboard)
24158      // 0x0008 - "dil  9" // standard input (motherboard)
24159      // 0x0010 - "dil 10" // standard input (motherboard)
24160      PORT_MODIFY("IN-18")
24161      // 0x0001 - "dil 11" // standard input (motherboard)
24162      // 0x0002 - "dil 12" // standard input (motherboard)
24163      // 0x0004 - "dil 13" // standard input (motherboard)
24164      // 0x0008 - "dil 14" // standard input (motherboard)
24165      // 0x0010 - "dil 15" // standard input (motherboard)
24166      PORT_MODIFY("IN-19")
24167      // 0x0001 - "dil 16" // standard input (motherboard)
24168      PORT_MODIFY("IN-20")
24169      // 0x0001 - "test" // standard input (motherboard)
24170      // 0x0002 - "lock" // standard input (expected here)
24171      // 0x0004 - "topdor" // standard input (expected here)
24172      // 0x0008 - "botdor" // standard input (expected here)
24173      // 0x0010 - "hopdmp" // standard input (expected here)
2417424174INPUT_PORTS_END
2417524175
2417624176// PR2528 CASH ADDER  V1.0         CASHADDERSND            CASH ADDER
r31373r31374
2421724217}
2421824218
2421924219INPUT_PORTS_START( sc4cadcl ) // this structure is generated
24220        PORT_INCLUDE( sc4_base )
24221        PORT_MODIFY("IN-1")
24222        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24223        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24224        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24225        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24226        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
24227        PORT_MODIFY("IN-2")
24228        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24229        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
24230        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24231        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24232        PORT_MODIFY("IN-8")
24233        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudge")
24234        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("qps")
24235        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spin")
24236        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("cash")
24237        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("cpot")
24238        PORT_MODIFY("IN-16")
24239        // 0x0001 - "dil  1" // standard input (motherboard)
24240        // 0x0002 - "dil  2" // standard input (motherboard)
24241        // 0x0004 - "dil  3" // standard input (motherboard)
24242        // 0x0008 - "dil  4" // standard input (motherboard)
24243        // 0x0010 - "dil  5" // standard input (motherboard)
24244        // 0x0100 - "topup" // known extended input, usually 'top up'
24245        PORT_MODIFY("IN-17")
24246        // 0x0001 - "dil  6" // standard input (motherboard)
24247        // 0x0002 - "dil  7" // standard input (motherboard)
24248        // 0x0004 - "dil  8" // standard input (motherboard)
24249        // 0x0008 - "dil  9" // standard input (motherboard)
24250        // 0x0010 - "dil 10" // standard input (motherboard)
24251        PORT_MODIFY("IN-18")
24252        // 0x0001 - "dil 11" // standard input (motherboard)
24253        // 0x0002 - "dil 12" // standard input (motherboard)
24254        // 0x0004 - "dil 13" // standard input (motherboard)
24255        // 0x0008 - "dil 14" // standard input (motherboard)
24256        // 0x0010 - "dil 15" // standard input (motherboard)
24257        PORT_MODIFY("IN-19")
24258        // 0x0001 - "dil 16" // standard input (motherboard)
24259        PORT_MODIFY("IN-20")
24260        // 0x0001 - "test" // standard input (motherboard)
24261        // 0x0002 - "lock" // standard input (expected here)
24262        // 0x0004 - "topdor" // standard input (expected here)
24263        // 0x0008 - "botdor" // standard input (expected here)
24264        // 0x0010 - "hopdmp" // standard input (expected here)
24220      PORT_INCLUDE( sc4_base )
24221      PORT_MODIFY("IN-1")
24222      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24223      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24224      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24225      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24226      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
24227      PORT_MODIFY("IN-2")
24228      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24229      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
24230      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24231      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24232      PORT_MODIFY("IN-8")
24233      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudge")
24234      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("qps")
24235      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spin")
24236      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("cash")
24237      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("cpot")
24238      PORT_MODIFY("IN-16")
24239      // 0x0001 - "dil  1" // standard input (motherboard)
24240      // 0x0002 - "dil  2" // standard input (motherboard)
24241      // 0x0004 - "dil  3" // standard input (motherboard)
24242      // 0x0008 - "dil  4" // standard input (motherboard)
24243      // 0x0010 - "dil  5" // standard input (motherboard)
24244      // 0x0100 - "topup" // known extended input, usually 'top up'
24245      PORT_MODIFY("IN-17")
24246      // 0x0001 - "dil  6" // standard input (motherboard)
24247      // 0x0002 - "dil  7" // standard input (motherboard)
24248      // 0x0004 - "dil  8" // standard input (motherboard)
24249      // 0x0008 - "dil  9" // standard input (motherboard)
24250      // 0x0010 - "dil 10" // standard input (motherboard)
24251      PORT_MODIFY("IN-18")
24252      // 0x0001 - "dil 11" // standard input (motherboard)
24253      // 0x0002 - "dil 12" // standard input (motherboard)
24254      // 0x0004 - "dil 13" // standard input (motherboard)
24255      // 0x0008 - "dil 14" // standard input (motherboard)
24256      // 0x0010 - "dil 15" // standard input (motherboard)
24257      PORT_MODIFY("IN-19")
24258      // 0x0001 - "dil 16" // standard input (motherboard)
24259      PORT_MODIFY("IN-20")
24260      // 0x0001 - "test" // standard input (motherboard)
24261      // 0x0002 - "lock" // standard input (expected here)
24262      // 0x0004 - "topdor" // standard input (expected here)
24263      // 0x0008 - "botdor" // standard input (expected here)
24264      // 0x0010 - "hopdmp" // standard input (expected here)
2426524265INPUT_PORTS_END
2426624266
2426724267// PRXXXX QPS155 CLUB CASH ADDER Version 411         CLUBCASHADDERSND         CLUB  CASH ADDER
r31373r31374
2428524285}
2428624286
2428724287INPUT_PORTS_START( sc4cr ) // this structure is generated
24288        PORT_INCLUDE( sc4_base )
24289        PORT_MODIFY("IN-1")
24290        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24291        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24292        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24293        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24294        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
24295        PORT_MODIFY("IN-2")
24296        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24297        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24298        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24299        PORT_MODIFY("IN-8")
24300        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("up")
24301        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("right")
24302        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("down")
24303        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("left")
24304        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("cash")
24305        PORT_MODIFY("IN-9")
24306        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nudge")
24307        PORT_MODIFY("IN-16")
24308        // 0x0001 - "dil  1" // standard input (motherboard)
24309        // 0x0002 - "dil  2" // standard input (motherboard)
24310        // 0x0004 - "dil  3" // standard input (motherboard)
24311        // 0x0008 - "dil  4" // standard input (motherboard)
24312        // 0x0010 - "dil  5" // standard input (motherboard)
24313        // 0x0100 - "topup" // known extended input, usually 'top up'
24314        PORT_MODIFY("IN-17")
24315        // 0x0001 - "dil  6" // standard input (motherboard)
24316        // 0x0002 - "dil  7" // standard input (motherboard)
24317        // 0x0004 - "dil  8" // standard input (motherboard)
24318        // 0x0008 - "dil  9" // standard input (motherboard)
24319        // 0x0010 - "dil 10" // standard input (motherboard)
24320        PORT_MODIFY("IN-18")
24321        // 0x0001 - "dil 11" // standard input (motherboard)
24322        // 0x0002 - "dil 12" // standard input (motherboard)
24323        // 0x0004 - "dil 13" // standard input (motherboard)
24324        // 0x0008 - "dil 14" // standard input (motherboard)
24325        // 0x0010 - "dil 15" // standard input (motherboard)
24326        PORT_MODIFY("IN-19")
24327        // 0x0001 - "dil 16" // standard input (motherboard)
24328        PORT_MODIFY("IN-20")
24329        // 0x0001 - "test" // standard input (motherboard)
24330        // 0x0002 - "lock" // standard input (expected here)
24331        // 0x0004 - "topdor" // standard input (expected here)
24332        // 0x0008 - "botdor" // standard input (expected here)
24333        // 0x0010 - "hopdmp" // standard input (expected here)
24288      PORT_INCLUDE( sc4_base )
24289      PORT_MODIFY("IN-1")
24290      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24291      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24292      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24293      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24294      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
24295      PORT_MODIFY("IN-2")
24296      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24297      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24298      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24299      PORT_MODIFY("IN-8")
24300      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("up")
24301      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("right")
24302      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("down")
24303      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("left")
24304      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("cash")
24305      PORT_MODIFY("IN-9")
24306      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nudge")
24307      PORT_MODIFY("IN-16")
24308      // 0x0001 - "dil  1" // standard input (motherboard)
24309      // 0x0002 - "dil  2" // standard input (motherboard)
24310      // 0x0004 - "dil  3" // standard input (motherboard)
24311      // 0x0008 - "dil  4" // standard input (motherboard)
24312      // 0x0010 - "dil  5" // standard input (motherboard)
24313      // 0x0100 - "topup" // known extended input, usually 'top up'
24314      PORT_MODIFY("IN-17")
24315      // 0x0001 - "dil  6" // standard input (motherboard)
24316      // 0x0002 - "dil  7" // standard input (motherboard)
24317      // 0x0004 - "dil  8" // standard input (motherboard)
24318      // 0x0008 - "dil  9" // standard input (motherboard)
24319      // 0x0010 - "dil 10" // standard input (motherboard)
24320      PORT_MODIFY("IN-18")
24321      // 0x0001 - "dil 11" // standard input (motherboard)
24322      // 0x0002 - "dil 12" // standard input (motherboard)
24323      // 0x0004 - "dil 13" // standard input (motherboard)
24324      // 0x0008 - "dil 14" // standard input (motherboard)
24325      // 0x0010 - "dil 15" // standard input (motherboard)
24326      PORT_MODIFY("IN-19")
24327      // 0x0001 - "dil 16" // standard input (motherboard)
24328      PORT_MODIFY("IN-20")
24329      // 0x0001 - "test" // standard input (motherboard)
24330      // 0x0002 - "lock" // standard input (expected here)
24331      // 0x0004 - "topdor" // standard input (expected here)
24332      // 0x0008 - "botdor" // standard input (expected here)
24333      // 0x0010 - "hopdmp" // standard input (expected here)
2433424334INPUT_PORTS_END
2433524335
2433624336
r31373r31374
2436924369}
2437024370
2437124371INPUT_PORTS_START( sc4crcl ) // this structure is generated
24372        PORT_INCLUDE( sc4_base )
24373        PORT_MODIFY("IN-1")
24374        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24375        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24376        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24377        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24378        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
24379        PORT_MODIFY("IN-2")
24380        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24381        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stop")
24382        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24383        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24384        PORT_MODIFY("IN-8")
24385        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("up")
24386        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("right")
24387        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("down")
24388        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("left")
24389        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("igor")
24390        PORT_MODIFY("IN-16")
24391        // 0x0001 - "dil  1" // standard input (motherboard)
24392        // 0x0002 - "dil  2" // standard input (motherboard)
24393        // 0x0004 - "dil  3" // standard input (motherboard)
24394        // 0x0008 - "dil  4" // standard input (motherboard)
24395        // 0x0010 - "dil  5" // standard input (motherboard)
24396        // 0x0100 - "topup" // known extended input, usually 'top up'
24397        PORT_MODIFY("IN-17")
24398        // 0x0001 - "dil  6" // standard input (motherboard)
24399        // 0x0002 - "dil  7" // standard input (motherboard)
24400        // 0x0004 - "dil  8" // standard input (motherboard)
24401        // 0x0008 - "dil  9" // standard input (motherboard)
24402        // 0x0010 - "dil 10" // standard input (motherboard)
24403        PORT_MODIFY("IN-18")
24404        // 0x0001 - "dil 11" // standard input (motherboard)
24405        // 0x0002 - "dil 12" // standard input (motherboard)
24406        // 0x0004 - "dil 13" // standard input (motherboard)
24407        // 0x0008 - "dil 14" // standard input (motherboard)
24408        // 0x0010 - "dil 15" // standard input (motherboard)
24409        PORT_MODIFY("IN-19")
24410        // 0x0001 - "dil 16" // standard input (motherboard)
24411        PORT_MODIFY("IN-20")
24412        // 0x0001 - "test" // standard input (motherboard)
24413        // 0x0002 - "lock" // standard input (expected here)
24414        // 0x0004 - "topdor" // standard input (expected here)
24415        // 0x0008 - "botdor" // standard input (expected here)
24416        // 0x0010 - "hopdmp" // standard input (expected here)
24372      PORT_INCLUDE( sc4_base )
24373      PORT_MODIFY("IN-1")
24374      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24375      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24376      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24377      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24378      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
24379      PORT_MODIFY("IN-2")
24380      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24381      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stop")
24382      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24383      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24384      PORT_MODIFY("IN-8")
24385      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("up")
24386      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("right")
24387      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("down")
24388      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("left")
24389      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("igor")
24390      PORT_MODIFY("IN-16")
24391      // 0x0001 - "dil  1" // standard input (motherboard)
24392      // 0x0002 - "dil  2" // standard input (motherboard)
24393      // 0x0004 - "dil  3" // standard input (motherboard)
24394      // 0x0008 - "dil  4" // standard input (motherboard)
24395      // 0x0010 - "dil  5" // standard input (motherboard)
24396      // 0x0100 - "topup" // known extended input, usually 'top up'
24397      PORT_MODIFY("IN-17")
24398      // 0x0001 - "dil  6" // standard input (motherboard)
24399      // 0x0002 - "dil  7" // standard input (motherboard)
24400      // 0x0004 - "dil  8" // standard input (motherboard)
24401      // 0x0008 - "dil  9" // standard input (motherboard)
24402      // 0x0010 - "dil 10" // standard input (motherboard)
24403      PORT_MODIFY("IN-18")
24404      // 0x0001 - "dil 11" // standard input (motherboard)
24405      // 0x0002 - "dil 12" // standard input (motherboard)
24406      // 0x0004 - "dil 13" // standard input (motherboard)
24407      // 0x0008 - "dil 14" // standard input (motherboard)
24408      // 0x0010 - "dil 15" // standard input (motherboard)
24409      PORT_MODIFY("IN-19")
24410      // 0x0001 - "dil 16" // standard input (motherboard)
24411      PORT_MODIFY("IN-20")
24412      // 0x0001 - "test" // standard input (motherboard)
24413      // 0x0002 - "lock" // standard input (expected here)
24414      // 0x0004 - "topdor" // standard input (expected here)
24415      // 0x0008 - "botdor" // standard input (expected here)
24416      // 0x0010 - "hopdmp" // standard input (expected here)
2441724417INPUT_PORTS_END
2441824418
2441924419// PR????  CLUB CASHRAKER V1.0         CLUBRAKERSND          CLUB CASHRAKER
r31373r31374
2444524445}
2444624446
2444724447INPUT_PORTS_START( sc4cashm ) // this structure is generated
24448        PORT_INCLUDE( sc4_base )
24449        PORT_MODIFY("IN-1")
24450        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24451        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24452        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24453        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24454        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("take")
24455        PORT_MODIFY("IN-2")
24456        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24457        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24458        PORT_MODIFY("IN-8")
24459        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
24460        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("blast")
24461        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("feat")
24462        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("topbrd")
24463        PORT_MODIFY("IN-16")
24464        // 0x0001 - "dil 1" // standard input (motherboard)
24465        // 0x0002 - "dil 2" // standard input (motherboard)
24466        // 0x0004 - "dil 3" // standard input (motherboard)
24467        // 0x0008 - "dil 4" // standard input (motherboard)
24468        // 0x0010 - "dil 5" // standard input (motherboard)
24469        PORT_MODIFY("IN-17")
24470        // 0x0001 - "dil 6" // standard input (motherboard)
24471        // 0x0002 - "dil 7" // standard input (motherboard)
24472        // 0x0004 - "dil 8" // standard input (motherboard)
24473        // 0x0008 - "dil 9" // standard input (motherboard)
24474        // 0x0010 - "dil 10" // standard input (motherboard)
24475        PORT_MODIFY("IN-18")
24476        // 0x0001 - "dil 11" // standard input (motherboard)
24477        // 0x0002 - "dil 12" // standard input (motherboard)
24478        // 0x0004 - "dil 13" // standard input (motherboard)
24479        // 0x0008 - "dil 14" // standard input (motherboard)
24480        // 0x0010 - "dil 15" // standard input (motherboard)
24481        PORT_MODIFY("IN-19")
24482        // 0x0001 - "dil 16" // standard input (motherboard)
24483        PORT_MODIFY("IN-20")
24484        // 0x0001 - "testsw" // standard input (motherboard)
24448      PORT_INCLUDE( sc4_base )
24449      PORT_MODIFY("IN-1")
24450      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24451      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24452      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24453      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24454      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("take")
24455      PORT_MODIFY("IN-2")
24456      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24457      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24458      PORT_MODIFY("IN-8")
24459      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
24460      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("blast")
24461      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("feat")
24462      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("topbrd")
24463      PORT_MODIFY("IN-16")
24464      // 0x0001 - "dil 1" // standard input (motherboard)
24465      // 0x0002 - "dil 2" // standard input (motherboard)
24466      // 0x0004 - "dil 3" // standard input (motherboard)
24467      // 0x0008 - "dil 4" // standard input (motherboard)
24468      // 0x0010 - "dil 5" // standard input (motherboard)
24469      PORT_MODIFY("IN-17")
24470      // 0x0001 - "dil 6" // standard input (motherboard)
24471      // 0x0002 - "dil 7" // standard input (motherboard)
24472      // 0x0004 - "dil 8" // standard input (motherboard)
24473      // 0x0008 - "dil 9" // standard input (motherboard)
24474      // 0x0010 - "dil 10" // standard input (motherboard)
24475      PORT_MODIFY("IN-18")
24476      // 0x0001 - "dil 11" // standard input (motherboard)
24477      // 0x0002 - "dil 12" // standard input (motherboard)
24478      // 0x0004 - "dil 13" // standard input (motherboard)
24479      // 0x0008 - "dil 14" // standard input (motherboard)
24480      // 0x0010 - "dil 15" // standard input (motherboard)
24481      PORT_MODIFY("IN-19")
24482      // 0x0001 - "dil 16" // standard input (motherboard)
24483      PORT_MODIFY("IN-20")
24484      // 0x0001 - "testsw" // standard input (motherboard)
2448524485INPUT_PORTS_END
2448624486
2448724487// PR2008 CASHANOVA         CASH SOUNDS
r31373r31374
2452924529
2453024530// the topbox sets contain no input defs
2453124531INPUT_PORTS_START( sc4ckxg ) // this structure is generated
24532        PORT_INCLUDE( sc4_base )
24533        PORT_MODIFY("IN-1")
24534        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24535        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
24536        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
24537        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
24538        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("trnsfr")
24539        PORT_MODIFY("IN-2")
24540        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autply")
24541        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
24542        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24543        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24544        PORT_MODIFY("IN-3")
24545        // 0x0004 - "stk 4" // standard input (expected here)
24546        // 0x0008 - "stk 3" // standard input (expected here)
24547        // 0x0010 - "stk 2" // standard input (expected here)
24548        PORT_MODIFY("IN-4")
24549        // 0x0008 - "top up" // unexpected here
24550        PORT_MODIFY("IN-5")
24551        // 0x0001 - "priz4" // standard input (expected here)
24552        // 0x0002 - "priz3" // standard input (expected here)
24553        // 0x0004 - "priz2" // standard input (expected here)
24554        // 0x0008 - "priz1" // standard input (expected here)
24555        PORT_MODIFY("IN-6")
24556        // 0x0001 - "perc1" // standard input (expected here)
24557        // 0x0002 - "perc2" // standard input (expected here)
24558        // 0x0004 - "perc3" // standard input (expected here)
24559        // 0x0008 - "perc4" // standard input (expected here)
24560        PORT_MODIFY("IN-16")
24561        // 0x0001 - "dil 1" // standard input (motherboard)
24562        // 0x0002 - "dil 2" // standard input (motherboard)
24563        // 0x0004 - "dil 3" // standard input (motherboard)
24564        // 0x0008 - "dil 4" // standard input (motherboard)
24565        // 0x0010 - "dil 5" // standard input (motherboard)
24566        PORT_MODIFY("IN-17")
24567        // 0x0001 - "dil 6" // standard input (motherboard)
24568        // 0x0002 - "dil 7" // standard input (motherboard)
24569        // 0x0004 - "dil 8" // standard input (motherboard)
24570        // 0x0008 - "dil 9" // standard input (motherboard)
24571        // 0x0010 - "dil10" // standard input (motherboard)
24572        PORT_MODIFY("IN-18")
24573        // 0x0001 - "dil11" // standard input (motherboard)
24574        // 0x0002 - "dil12" // standard input (motherboard)
24575        // 0x0004 - "dil13" // standard input (motherboard)
24576        // 0x0008 - "dil14" // standard input (motherboard)
24577        // 0x0010 - "dil15" // standard input (motherboard)
24578        PORT_MODIFY("IN-19")
24579        // 0x0001 - "dil16" // standard input (motherboard)
24580        PORT_MODIFY("IN-20")
24581        // 0x0001 - "grnbut" // standard input (motherboard)
24582        // 0x0002 - "cshdor" // standard input (expected here)
24583        // 0x0004 - "serdor" // standard input (expected here)
24584        // 0x0008 - "hopdmp" // standard input (expected here)
24585        // 0x0010 - "serdor" // standard input (expected here)
24532      PORT_INCLUDE( sc4_base )
24533      PORT_MODIFY("IN-1")
24534      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24535      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
24536      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
24537      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
24538      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("trnsfr")
24539      PORT_MODIFY("IN-2")
24540      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autply")
24541      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
24542      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24543      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24544      PORT_MODIFY("IN-3")
24545      // 0x0004 - "stk 4" // standard input (expected here)
24546      // 0x0008 - "stk 3" // standard input (expected here)
24547      // 0x0010 - "stk 2" // standard input (expected here)
24548      PORT_MODIFY("IN-4")
24549      // 0x0008 - "top up" // unexpected here
24550      PORT_MODIFY("IN-5")
24551      // 0x0001 - "priz4" // standard input (expected here)
24552      // 0x0002 - "priz3" // standard input (expected here)
24553      // 0x0004 - "priz2" // standard input (expected here)
24554      // 0x0008 - "priz1" // standard input (expected here)
24555      PORT_MODIFY("IN-6")
24556      // 0x0001 - "perc1" // standard input (expected here)
24557      // 0x0002 - "perc2" // standard input (expected here)
24558      // 0x0004 - "perc3" // standard input (expected here)
24559      // 0x0008 - "perc4" // standard input (expected here)
24560      PORT_MODIFY("IN-16")
24561      // 0x0001 - "dil 1" // standard input (motherboard)
24562      // 0x0002 - "dil 2" // standard input (motherboard)
24563      // 0x0004 - "dil 3" // standard input (motherboard)
24564      // 0x0008 - "dil 4" // standard input (motherboard)
24565      // 0x0010 - "dil 5" // standard input (motherboard)
24566      PORT_MODIFY("IN-17")
24567      // 0x0001 - "dil 6" // standard input (motherboard)
24568      // 0x0002 - "dil 7" // standard input (motherboard)
24569      // 0x0004 - "dil 8" // standard input (motherboard)
24570      // 0x0008 - "dil 9" // standard input (motherboard)
24571      // 0x0010 - "dil10" // standard input (motherboard)
24572      PORT_MODIFY("IN-18")
24573      // 0x0001 - "dil11" // standard input (motherboard)
24574      // 0x0002 - "dil12" // standard input (motherboard)
24575      // 0x0004 - "dil13" // standard input (motherboard)
24576      // 0x0008 - "dil14" // standard input (motherboard)
24577      // 0x0010 - "dil15" // standard input (motherboard)
24578      PORT_MODIFY("IN-19")
24579      // 0x0001 - "dil16" // standard input (motherboard)
24580      PORT_MODIFY("IN-20")
24581      // 0x0001 - "grnbut" // standard input (motherboard)
24582      // 0x0002 - "cshdor" // standard input (expected here)
24583      // 0x0004 - "serdor" // standard input (expected here)
24584      // 0x0008 - "hopdmp" // standard input (expected here)
24585      // 0x0010 - "serdor" // standard input (expected here)
2458624586INPUT_PORTS_END
2458724587
2458824588// this seems to need all the units connected to function
r31373r31374
2461524615}
2461624616
2461724617INPUT_PORTS_START( sc4chick ) // this structure is generated
24618        PORT_INCLUDE( sc4_base )
24619        PORT_MODIFY("IN-1")
24620        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("hold 1")
24621        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 2")
24622        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 3")
24623        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("cancel")
24624        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("auto")
24625        PORT_MODIFY("IN-2")
24626        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
24627        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24628        PORT_MODIFY("IN-4")
24629        // 0x0008 - "refloa" // unexpected here
24630        PORT_MODIFY("IN-16")
24631        // 0x0001 - "dil sw" // standard input (motherboard)
24632        // 0x0002 - "dil sw" // standard input (motherboard)
24633        // 0x0004 - "dil sw" // standard input (motherboard)
24634        // 0x0008 - "dil sw" // standard input (motherboard)
24635        // 0x0010 - "dil sw" // standard input (motherboard)
24636        PORT_MODIFY("IN-17")
24637        // 0x0001 - "dil sw" // standard input (motherboard)
24638        // 0x0002 - "dil sw" // standard input (motherboard)
24639        // 0x0004 - "dil sw" // standard input (motherboard)
24640        // 0x0008 - "dil sw" // standard input (motherboard)
24641        // 0x0010 - "dil sw" // standard input (motherboard)
24642        PORT_MODIFY("IN-18")
24643        // 0x0001 - "dil sw" // standard input (motherboard)
24644        // 0x0002 - "dil sw" // standard input (motherboard)
24645        // 0x0004 - "dil sw" // standard input (motherboard)
24646        // 0x0008 - "dil sw" // standard input (motherboard)
24647        // 0x0010 - "dil sw" // standard input (motherboard)
24648        PORT_MODIFY("IN-19")
24649        // 0x0001 - "dil sw" // standard input (motherboard)
24650        PORT_MODIFY("IN-20")
24651        // 0x0001 - "green" // standard input (motherboard)
24652        // 0x0002 - "cash d" // standard input (expected here)
24653        // 0x0004 - "top do" // standard input (expected here)
24654        // 0x0008 - "dump" // standard input (expected here)
24618      PORT_INCLUDE( sc4_base )
24619      PORT_MODIFY("IN-1")
24620      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("hold 1")
24621      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 2")
24622      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 3")
24623      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("cancel")
24624      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("auto")
24625      PORT_MODIFY("IN-2")
24626      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
24627      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24628      PORT_MODIFY("IN-4")
24629      // 0x0008 - "refloa" // unexpected here
24630      PORT_MODIFY("IN-16")
24631      // 0x0001 - "dil sw" // standard input (motherboard)
24632      // 0x0002 - "dil sw" // standard input (motherboard)
24633      // 0x0004 - "dil sw" // standard input (motherboard)
24634      // 0x0008 - "dil sw" // standard input (motherboard)
24635      // 0x0010 - "dil sw" // standard input (motherboard)
24636      PORT_MODIFY("IN-17")
24637      // 0x0001 - "dil sw" // standard input (motherboard)
24638      // 0x0002 - "dil sw" // standard input (motherboard)
24639      // 0x0004 - "dil sw" // standard input (motherboard)
24640      // 0x0008 - "dil sw" // standard input (motherboard)
24641      // 0x0010 - "dil sw" // standard input (motherboard)
24642      PORT_MODIFY("IN-18")
24643      // 0x0001 - "dil sw" // standard input (motherboard)
24644      // 0x0002 - "dil sw" // standard input (motherboard)
24645      // 0x0004 - "dil sw" // standard input (motherboard)
24646      // 0x0008 - "dil sw" // standard input (motherboard)
24647      // 0x0010 - "dil sw" // standard input (motherboard)
24648      PORT_MODIFY("IN-19")
24649      // 0x0001 - "dil sw" // standard input (motherboard)
24650      PORT_MODIFY("IN-20")
24651      // 0x0001 - "green" // standard input (motherboard)
24652      // 0x0002 - "cash d" // standard input (expected here)
24653      // 0x0004 - "top do" // standard input (expected here)
24654      // 0x0008 - "dump" // standard input (expected here)
2465524655INPUT_PORTS_END
2465624656
2465724657// PR7060CASINO CHICKEN DALES         TTTWO SOUNDS         CHICKEN DALES
r31373r31374
2467524675}
2467624676
2467724677INPUT_PORTS_START( sc4ccogs ) // this structure is generated
24678        PORT_INCLUDE( sc4_base )
24679        PORT_MODIFY("IN-1")
24680        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24681        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24682        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24683        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24684        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
24685        PORT_MODIFY("IN-2")
24686        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24687        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24688        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24689        PORT_MODIFY("IN-8")
24690        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
24691        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("green")
24692        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("blue")
24693        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("red")
24694        PORT_MODIFY("IN-16")
24695        // 0x0001 - "dil  1" // standard input (motherboard)
24696        // 0x0002 - "dil  2" // standard input (motherboard)
24697        // 0x0004 - "dil  3" // standard input (motherboard)
24698        // 0x0008 - "dil  4" // standard input (motherboard)
24699        // 0x0010 - "dil  5" // standard input (motherboard)
24700        // 0x0100 - "topup" // known extended input, usually 'top up'
24701        PORT_MODIFY("IN-17")
24702        // 0x0001 - "dil  6" // standard input (motherboard)
24703        // 0x0002 - "dil  7" // standard input (motherboard)
24704        // 0x0004 - "dil  8" // standard input (motherboard)
24705        // 0x0008 - "dil  9" // standard input (motherboard)
24706        // 0x0010 - "dil 10" // standard input (motherboard)
24707        PORT_MODIFY("IN-18")
24708        // 0x0001 - "dil 11" // standard input (motherboard)
24709        // 0x0002 - "dil 12" // standard input (motherboard)
24710        // 0x0004 - "dil 13" // standard input (motherboard)
24711        // 0x0008 - "dil 14" // standard input (motherboard)
24712        // 0x0010 - "dil 15" // standard input (motherboard)
24713        PORT_MODIFY("IN-19")
24714        // 0x0001 - "dil 16" // standard input (motherboard)
24715        PORT_MODIFY("IN-20")
24716        // 0x0001 - "test" // standard input (motherboard)
24717        // 0x0002 - "lock" // standard input (expected here)
24718        // 0x0004 - "topdor" // standard input (expected here)
24719        // 0x0008 - "botdor" // standard input (expected here)
24720        // 0x0010 - "hopdmp" // standard input (expected here)
24678      PORT_INCLUDE( sc4_base )
24679      PORT_MODIFY("IN-1")
24680      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24681      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24682      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24683      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24684      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
24685      PORT_MODIFY("IN-2")
24686      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
24687      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24688      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24689      PORT_MODIFY("IN-8")
24690      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
24691      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("green")
24692      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("blue")
24693      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("red")
24694      PORT_MODIFY("IN-16")
24695      // 0x0001 - "dil  1" // standard input (motherboard)
24696      // 0x0002 - "dil  2" // standard input (motherboard)
24697      // 0x0004 - "dil  3" // standard input (motherboard)
24698      // 0x0008 - "dil  4" // standard input (motherboard)
24699      // 0x0010 - "dil  5" // standard input (motherboard)
24700      // 0x0100 - "topup" // known extended input, usually 'top up'
24701      PORT_MODIFY("IN-17")
24702      // 0x0001 - "dil  6" // standard input (motherboard)
24703      // 0x0002 - "dil  7" // standard input (motherboard)
24704      // 0x0004 - "dil  8" // standard input (motherboard)
24705      // 0x0008 - "dil  9" // standard input (motherboard)
24706      // 0x0010 - "dil 10" // standard input (motherboard)
24707      PORT_MODIFY("IN-18")
24708      // 0x0001 - "dil 11" // standard input (motherboard)
24709      // 0x0002 - "dil 12" // standard input (motherboard)
24710      // 0x0004 - "dil 13" // standard input (motherboard)
24711      // 0x0008 - "dil 14" // standard input (motherboard)
24712      // 0x0010 - "dil 15" // standard input (motherboard)
24713      PORT_MODIFY("IN-19")
24714      // 0x0001 - "dil 16" // standard input (motherboard)
24715      PORT_MODIFY("IN-20")
24716      // 0x0001 - "test" // standard input (motherboard)
24717      // 0x0002 - "lock" // standard input (expected here)
24718      // 0x0004 - "topdor" // standard input (expected here)
24719      // 0x0008 - "botdor" // standard input (expected here)
24720      // 0x0010 - "hopdmp" // standard input (expected here)
2472124721INPUT_PORTS_END
2472224722
2472324723// PR2522 CLEVERCOGS V1.0         CLEVERCOGSSND           CLEVER  COGS
r31373r31374
2475124751}
2475224752
2475324753INPUT_PORTS_START( sc4cclime ) // this structure is generated
24754        PORT_INCLUDE( sc4_base )
24755        PORT_MODIFY("IN-1")
24756        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24757        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
24758        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
24759        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
24760        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
24761        PORT_MODIFY("IN-2")
24762        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
24763        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
24764        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24765        PORT_MODIFY("IN-3")
24766        // 0x0004 - "stk 4" // standard input (expected here)
24767        // 0x0008 - "stk 3" // standard input (expected here)
24768        // 0x0010 - "stk 2" // standard input (expected here)
24769        PORT_MODIFY("IN-4")
24770        // 0x0002 - "hop hi" // known extended(?) input, sometimes 'hop hi'
24771        // 0x0008 - "hoptop" // known extended(?) input, sometimes 'hop top'
24772        // 0x0100 - "hop lo" // known extended input, usually 'hopper low'
24773        PORT_MODIFY("IN-5")
24774        // 0x0001 - "priz4" // standard input (expected here)
24775        // 0x0002 - "priz3" // standard input (expected here)
24776        // 0x0004 - "priz2" // standard input (expected here)
24777        // 0x0008 - "priz1" // standard input (expected here)
24778        PORT_MODIFY("IN-6")
24779        // 0x0001 - "perc1" // standard input (expected here)
24780        // 0x0002 - "perc2" // standard input (expected here)
24781        // 0x0004 - "perc3" // standard input (expected here)
24782        // 0x0008 - "perc4" // standard input (expected here)
24783        PORT_MODIFY("IN-16")
24784        // 0x0001 - "dil sw" // standard input (motherboard)
24785        // 0x0002 - "dil sw" // standard input (motherboard)
24786        // 0x0004 - "dil sw" // standard input (motherboard)
24787        // 0x0008 - "dil sw" // standard input (motherboard)
24788        // 0x0010 - "dil sw" // standard input (motherboard)
24789        PORT_MODIFY("IN-17")
24790        // 0x0001 - "dil sw" // standard input (motherboard)
24791        // 0x0002 - "dil sw" // standard input (motherboard)
24792        // 0x0004 - "dil sw" // standard input (motherboard)
24793        // 0x0008 - "dil sw" // standard input (motherboard)
24794        // 0x0010 - "dil sw" // standard input (motherboard)
24795        PORT_MODIFY("IN-18")
24796        // 0x0001 - "dil sw" // standard input (motherboard)
24797        // 0x0002 - "dil sw" // standard input (motherboard)
24798        // 0x0004 - "dil sw" // standard input (motherboard)
24799        // 0x0008 - "dil sw" // standard input (motherboard)
24800        // 0x0010 - "dil sw" // standard input (motherboard)
24801        PORT_MODIFY("IN-19")
24802        // 0x0001 - "dil sw" // standard input (motherboard)
24803        PORT_MODIFY("IN-20")
24804        // 0x0001 - "grn bu" // standard input (motherboard)
24805        // 0x0002 - "botdor" // standard input (expected here)
24806        // 0x0004 - "topdor" // standard input (expected here)
24807        // 0x0008 - "hopdum" // standard input (expected here)
24754      PORT_INCLUDE( sc4_base )
24755      PORT_MODIFY("IN-1")
24756      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24757      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
24758      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
24759      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
24760      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
24761      PORT_MODIFY("IN-2")
24762      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
24763      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
24764      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24765      PORT_MODIFY("IN-3")
24766      // 0x0004 - "stk 4" // standard input (expected here)
24767      // 0x0008 - "stk 3" // standard input (expected here)
24768      // 0x0010 - "stk 2" // standard input (expected here)
24769      PORT_MODIFY("IN-4")
24770      // 0x0002 - "hop hi" // known extended(?) input, sometimes 'hop hi'
24771      // 0x0008 - "hoptop" // known extended(?) input, sometimes 'hop top'
24772      // 0x0100 - "hop lo" // known extended input, usually 'hopper low'
24773      PORT_MODIFY("IN-5")
24774      // 0x0001 - "priz4" // standard input (expected here)
24775      // 0x0002 - "priz3" // standard input (expected here)
24776      // 0x0004 - "priz2" // standard input (expected here)
24777      // 0x0008 - "priz1" // standard input (expected here)
24778      PORT_MODIFY("IN-6")
24779      // 0x0001 - "perc1" // standard input (expected here)
24780      // 0x0002 - "perc2" // standard input (expected here)
24781      // 0x0004 - "perc3" // standard input (expected here)
24782      // 0x0008 - "perc4" // standard input (expected here)
24783      PORT_MODIFY("IN-16")
24784      // 0x0001 - "dil sw" // standard input (motherboard)
24785      // 0x0002 - "dil sw" // standard input (motherboard)
24786      // 0x0004 - "dil sw" // standard input (motherboard)
24787      // 0x0008 - "dil sw" // standard input (motherboard)
24788      // 0x0010 - "dil sw" // standard input (motherboard)
24789      PORT_MODIFY("IN-17")
24790      // 0x0001 - "dil sw" // standard input (motherboard)
24791      // 0x0002 - "dil sw" // standard input (motherboard)
24792      // 0x0004 - "dil sw" // standard input (motherboard)
24793      // 0x0008 - "dil sw" // standard input (motherboard)
24794      // 0x0010 - "dil sw" // standard input (motherboard)
24795      PORT_MODIFY("IN-18")
24796      // 0x0001 - "dil sw" // standard input (motherboard)
24797      // 0x0002 - "dil sw" // standard input (motherboard)
24798      // 0x0004 - "dil sw" // standard input (motherboard)
24799      // 0x0008 - "dil sw" // standard input (motherboard)
24800      // 0x0010 - "dil sw" // standard input (motherboard)
24801      PORT_MODIFY("IN-19")
24802      // 0x0001 - "dil sw" // standard input (motherboard)
24803      PORT_MODIFY("IN-20")
24804      // 0x0001 - "grn bu" // standard input (motherboard)
24805      // 0x0002 - "botdor" // standard input (expected here)
24806      // 0x0004 - "topdor" // standard input (expected here)
24807      // 0x0008 - "hopdum" // standard input (expected here)
2480824808INPUT_PORTS_END
2480924809
2481024810// PR1129 CASINO CRAZY CLIMBER         PR1129 CRAZY CLIMBER SOUNDS11
r31373r31374
2486924869// Crazy Fruits sets are a bit strange compared to others..
2487024870// sc4cfqpsc, sc4cfqpse, sc4cfqpsf, sc4cfqpsg, sc4cfqpsh, sc4cfqpsi are the only sets to specify inputs, and they use port 7 which is VERY unusual
2487124871INPUT_PORTS_START( sc4cfqpsf ) // this structure is generated
24872        PORT_INCLUDE( sc4_base )
24873        PORT_MODIFY("IN-1")
24874        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24875        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24876        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24877        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24878        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stop")
24879        PORT_MODIFY("IN-2")
24880        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchan")
24881        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24882        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24883        PORT_MODIFY("IN-7")
24884        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_0 ) PORT_NAME("take s")
24885        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_1 ) PORT_NAME("take n")
24886        PORT_MODIFY("IN-8")
24887        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("banana")
24888        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("qps bu")
24889        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take c")
24890        PORT_MODIFY("IN-16")
24891        // 0x0001 - "dil sw" // standard input (motherboard)
24892        // 0x0002 - "dil sw" // standard input (motherboard)
24893        // 0x0004 - "dil sw" // standard input (motherboard)
24894        // 0x0008 - "dil sw" // standard input (motherboard)
24895        // 0x0010 - "dil sw" // standard input (motherboard)
24896        // 0x0100 - "topup" // known extended input, usually 'top up'
24897        PORT_MODIFY("IN-17")
24898        // 0x0001 - "dil sw" // standard input (motherboard)
24899        // 0x0002 - "dil sw" // standard input (motherboard)
24900        // 0x0004 - "dil sw" // standard input (motherboard)
24901        // 0x0008 - "dil sw" // standard input (motherboard)
24902        // 0x0010 - "dil sw" // standard input (motherboard)
24903        PORT_MODIFY("IN-18")
24904        // 0x0001 - "dil sw" // standard input (motherboard)
24905        // 0x0002 - "dil sw" // standard input (motherboard)
24906        // 0x0004 - "dil sw" // standard input (motherboard)
24907        // 0x0008 - "dil sw" // standard input (motherboard)
24908        // 0x0010 - "dil sw" // standard input (motherboard)
24909        PORT_MODIFY("IN-19")
24910        // 0x0001 - "dil sw" // standard input (motherboard)
24911        PORT_MODIFY("IN-20")
24912        // 0x0001 - "test" // standard input (motherboard)
24913        // 0x0002 - "lock" // standard input (expected here)
24914        // 0x0004 - "topdor" // standard input (expected here)
24915        // 0x0008 - "botdor" // standard input (expected here)
24916        // 0x0010 - "hopdmp" // standard input (expected here)
24872      PORT_INCLUDE( sc4_base )
24873      PORT_MODIFY("IN-1")
24874      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24875      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
24876      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
24877      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
24878      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stop")
24879      PORT_MODIFY("IN-2")
24880      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchan")
24881      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
24882      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24883      PORT_MODIFY("IN-7")
24884      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_0 ) PORT_NAME("take s")
24885      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_1 ) PORT_NAME("take n")
24886      PORT_MODIFY("IN-8")
24887      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("banana")
24888      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("qps bu")
24889      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take c")
24890      PORT_MODIFY("IN-16")
24891      // 0x0001 - "dil sw" // standard input (motherboard)
24892      // 0x0002 - "dil sw" // standard input (motherboard)
24893      // 0x0004 - "dil sw" // standard input (motherboard)
24894      // 0x0008 - "dil sw" // standard input (motherboard)
24895      // 0x0010 - "dil sw" // standard input (motherboard)
24896      // 0x0100 - "topup" // known extended input, usually 'top up'
24897      PORT_MODIFY("IN-17")
24898      // 0x0001 - "dil sw" // standard input (motherboard)
24899      // 0x0002 - "dil sw" // standard input (motherboard)
24900      // 0x0004 - "dil sw" // standard input (motherboard)
24901      // 0x0008 - "dil sw" // standard input (motherboard)
24902      // 0x0010 - "dil sw" // standard input (motherboard)
24903      PORT_MODIFY("IN-18")
24904      // 0x0001 - "dil sw" // standard input (motherboard)
24905      // 0x0002 - "dil sw" // standard input (motherboard)
24906      // 0x0004 - "dil sw" // standard input (motherboard)
24907      // 0x0008 - "dil sw" // standard input (motherboard)
24908      // 0x0010 - "dil sw" // standard input (motherboard)
24909      PORT_MODIFY("IN-19")
24910      // 0x0001 - "dil sw" // standard input (motherboard)
24911      PORT_MODIFY("IN-20")
24912      // 0x0001 - "test" // standard input (motherboard)
24913      // 0x0002 - "lock" // standard input (expected here)
24914      // 0x0004 - "topdor" // standard input (expected here)
24915      // 0x0008 - "botdor" // standard input (expected here)
24916      // 0x0010 - "hopdmp" // standard input (expected here)
2491724917INPUT_PORTS_END
2491824918
2491924919// PR6813 CRAZY FRUITS         PR6813 CRAZY FRUITS SOUNDS11
r31373r31374
2497624976}
2497724977
2497824978INPUT_PORTS_START( sc4crzkyi ) // this structure is generated
24979        PORT_INCLUDE( sc4_base )
24980        PORT_MODIFY("IN-1")
24981        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24982        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
24983        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
24984        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
24985        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
24986        PORT_MODIFY("IN-2")
24987        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
24988        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
24989        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24990        PORT_MODIFY("IN-3")
24991        // 0x0004 - "stk 4" // standard input (expected here)
24992        // 0x0008 - "stk 3" // standard input (expected here)
24993        // 0x0010 - "stk 2" // standard input (expected here)
24994        PORT_MODIFY("IN-4")
24995        // 0x0002 - "hop hi" // known extended(?) input, sometimes 'hop hi'
24996        // 0x0008 - "hop to" // known extended(?) input, sometimes 'hop top'
24997        // 0x0100 - "hop lo" // known extended input, usually 'hopper low'
24998        PORT_MODIFY("IN-5")
24999        // 0x0001 - "priz4" // standard input (expected here)
25000        // 0x0002 - "priz3" // standard input (expected here)
25001        // 0x0004 - "priz2" // standard input (expected here)
25002        // 0x0008 - "priz1" // standard input (expected here)
25003        PORT_MODIFY("IN-6")
25004        // 0x0001 - "perc1" // standard input (expected here)
25005        // 0x0002 - "perc2" // standard input (expected here)
25006        // 0x0004 - "perc3" // standard input (expected here)
25007        // 0x0008 - "perc4" // standard input (expected here)
25008        PORT_MODIFY("IN-16")
25009        // 0x0001 - "dil  1" // standard input (motherboard)
25010        // 0x0002 - "dil  2" // standard input (motherboard)
25011        // 0x0004 - "dil  3" // standard input (motherboard)
25012        // 0x0008 - "dil  4" // standard input (motherboard)
25013        // 0x0010 - "dil  5" // standard input (motherboard)
25014        PORT_MODIFY("IN-17")
25015        // 0x0001 - "dil  6" // standard input (motherboard)
25016        // 0x0002 - "dil  7" // standard input (motherboard)
25017        // 0x0004 - "dil  8" // standard input (motherboard)
25018        // 0x0008 - "dil  9" // standard input (motherboard)
25019        // 0x0010 - "dil 10" // standard input (motherboard)
25020        PORT_MODIFY("IN-18")
25021        // 0x0001 - "dil 11" // standard input (motherboard)
25022        // 0x0002 - "dil 12" // standard input (motherboard)
25023        // 0x0004 - "dil 13" // standard input (motherboard)
25024        // 0x0008 - "dil 14" // standard input (motherboard)
25025        // 0x0010 - "dil 15" // standard input (motherboard)
25026        PORT_MODIFY("IN-19")
25027        // 0x0001 - "dil 16" // standard input (motherboard)
25028        PORT_MODIFY("IN-20")
25029        // 0x0001 - "green" // standard input (motherboard)
25030        // 0x0002 - "botdor" // standard input (expected here)
25031        // 0x0004 - "topdor" // standard input (expected here)
25032        // 0x0008 - "hopper" // standard input (expected here)
24979      PORT_INCLUDE( sc4_base )
24980      PORT_MODIFY("IN-1")
24981      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
24982      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
24983      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
24984      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
24985      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
24986      PORT_MODIFY("IN-2")
24987      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
24988      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
24989      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
24990      PORT_MODIFY("IN-3")
24991      // 0x0004 - "stk 4" // standard input (expected here)
24992      // 0x0008 - "stk 3" // standard input (expected here)
24993      // 0x0010 - "stk 2" // standard input (expected here)
24994      PORT_MODIFY("IN-4")
24995      // 0x0002 - "hop hi" // known extended(?) input, sometimes 'hop hi'
24996      // 0x0008 - "hop to" // known extended(?) input, sometimes 'hop top'
24997      // 0x0100 - "hop lo" // known extended input, usually 'hopper low'
24998      PORT_MODIFY("IN-5")
24999      // 0x0001 - "priz4" // standard input (expected here)
25000      // 0x0002 - "priz3" // standard input (expected here)
25001      // 0x0004 - "priz2" // standard input (expected here)
25002      // 0x0008 - "priz1" // standard input (expected here)
25003      PORT_MODIFY("IN-6")
25004      // 0x0001 - "perc1" // standard input (expected here)
25005      // 0x0002 - "perc2" // standard input (expected here)
25006      // 0x0004 - "perc3" // standard input (expected here)
25007      // 0x0008 - "perc4" // standard input (expected here)
25008      PORT_MODIFY("IN-16")
25009      // 0x0001 - "dil  1" // standard input (motherboard)
25010      // 0x0002 - "dil  2" // standard input (motherboard)
25011      // 0x0004 - "dil  3" // standard input (motherboard)
25012      // 0x0008 - "dil  4" // standard input (motherboard)
25013      // 0x0010 - "dil  5" // standard input (motherboard)
25014      PORT_MODIFY("IN-17")
25015      // 0x0001 - "dil  6" // standard input (motherboard)
25016      // 0x0002 - "dil  7" // standard input (motherboard)
25017      // 0x0004 - "dil  8" // standard input (motherboard)
25018      // 0x0008 - "dil  9" // standard input (motherboard)
25019      // 0x0010 - "dil 10" // standard input (motherboard)
25020      PORT_MODIFY("IN-18")
25021      // 0x0001 - "dil 11" // standard input (motherboard)
25022      // 0x0002 - "dil 12" // standard input (motherboard)
25023      // 0x0004 - "dil 13" // standard input (motherboard)
25024      // 0x0008 - "dil 14" // standard input (motherboard)
25025      // 0x0010 - "dil 15" // standard input (motherboard)
25026      PORT_MODIFY("IN-19")
25027      // 0x0001 - "dil 16" // standard input (motherboard)
25028      PORT_MODIFY("IN-20")
25029      // 0x0001 - "green" // standard input (motherboard)
25030      // 0x0002 - "botdor" // standard input (expected here)
25031      // 0x0004 - "topdor" // standard input (expected here)
25032      // 0x0008 - "hopper" // standard input (expected here)
2503325033INPUT_PORTS_END
2503425034
2503525035// PR1128 CASINO CRAZY KEYS         PR1128 CRAZY KEYS SOUNDS11
r31373r31374
2507825078}
2507925079
2508025080INPUT_PORTS_START( sc4deepi ) // this structure is generated
25081        PORT_INCLUDE( sc4_base )
25082        PORT_MODIFY("IN-1")
25083        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25084        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
25085        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
25086        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
25087        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
25088        PORT_MODIFY("IN-2")
25089        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
25090        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25091        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25092        PORT_MODIFY("IN-8")
25093        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("use")
25094        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tke my")
25095        PORT_MODIFY("IN-16")
25096        // 0x0001 - "dil  1" // standard input (motherboard)
25097        // 0x0002 - "dil  2" // standard input (motherboard)
25098        // 0x0004 - "dil  3" // standard input (motherboard)
25099        // 0x0008 - "dil  4" // standard input (motherboard)
25100        // 0x0010 - "dil  5" // standard input (motherboard)
25101        // 0x0100 - "top up" // known extended input, usually 'top up'
25102        PORT_MODIFY("IN-17")
25103        // 0x0001 - "dil  6" // standard input (motherboard)
25104        // 0x0002 - "dil  7" // standard input (motherboard)
25105        // 0x0004 - "dil  8" // standard input (motherboard)
25106        // 0x0008 - "dil  9" // standard input (motherboard)
25107        // 0x0010 - "dil 10" // standard input (motherboard)
25108        PORT_MODIFY("IN-18")
25109        // 0x0001 - "dil 11" // standard input (motherboard)
25110        // 0x0002 - "dil 12" // standard input (motherboard)
25111        // 0x0004 - "dil 13" // standard input (motherboard)
25112        // 0x0008 - "dil 14" // standard input (motherboard)
25113        // 0x0010 - "dil 15" // standard input (motherboard)
25114        PORT_MODIFY("IN-19")
25115        // 0x0001 - "dil 16" // standard input (motherboard)
25116        PORT_MODIFY("IN-20")
25117        // 0x0001 - "testsw" // standard input (motherboard)
25118        // 0x0002 - "dor lk" // standard input (expected here)
25119        // 0x0004 - "tp dor" // standard input (expected here)
25120        // 0x0008 - "csh bx" // standard input (expected here)
25121        // 0x0010 - "deflt" // standard input (expected here)
25081      PORT_INCLUDE( sc4_base )
25082      PORT_MODIFY("IN-1")
25083      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25084      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
25085      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
25086      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
25087      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
25088      PORT_MODIFY("IN-2")
25089      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
25090      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25091      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25092      PORT_MODIFY("IN-8")
25093      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("use")
25094      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tke my")
25095      PORT_MODIFY("IN-16")
25096      // 0x0001 - "dil  1" // standard input (motherboard)
25097      // 0x0002 - "dil  2" // standard input (motherboard)
25098      // 0x0004 - "dil  3" // standard input (motherboard)
25099      // 0x0008 - "dil  4" // standard input (motherboard)
25100      // 0x0010 - "dil  5" // standard input (motherboard)
25101      // 0x0100 - "top up" // known extended input, usually 'top up'
25102      PORT_MODIFY("IN-17")
25103      // 0x0001 - "dil  6" // standard input (motherboard)
25104      // 0x0002 - "dil  7" // standard input (motherboard)
25105      // 0x0004 - "dil  8" // standard input (motherboard)
25106      // 0x0008 - "dil  9" // standard input (motherboard)
25107      // 0x0010 - "dil 10" // standard input (motherboard)
25108      PORT_MODIFY("IN-18")
25109      // 0x0001 - "dil 11" // standard input (motherboard)
25110      // 0x0002 - "dil 12" // standard input (motherboard)
25111      // 0x0004 - "dil 13" // standard input (motherboard)
25112      // 0x0008 - "dil 14" // standard input (motherboard)
25113      // 0x0010 - "dil 15" // standard input (motherboard)
25114      PORT_MODIFY("IN-19")
25115      // 0x0001 - "dil 16" // standard input (motherboard)
25116      PORT_MODIFY("IN-20")
25117      // 0x0001 - "testsw" // standard input (motherboard)
25118      // 0x0002 - "dor lk" // standard input (expected here)
25119      // 0x0004 - "tp dor" // standard input (expected here)
25120      // 0x0008 - "csh bx" // standard input (expected here)
25121      // 0x0010 - "deflt" // standard input (expected here)
2512225122INPUT_PORTS_END
2512325123
2512425124// PR2099 DEEP IMPACT         DIMP SOUNDS         DEEP IMPACT
r31373r31374
2514625146}
2514725147
2514825148INPUT_PORTS_START( sc4dblfr ) // this structure is generated
25149        PORT_INCLUDE( sc4_base )
25150        PORT_MODIFY("IN-1")
25151        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("collec OR cancel")
25152        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
25153        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
25154        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
25155        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("streak")
25156        PORT_MODIFY("IN-2")
25157        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
25158        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
25159        PORT_MODIFY("IN-16")
25160        // 0x0001 - "dil sw" // standard input (motherboard)
25161        // 0x0002 - "dil sw" // standard input (motherboard)
25162        // 0x0004 - "dil sw" // standard input (motherboard)
25163        // 0x0008 - "dil sw" // standard input (motherboard)
25164        // 0x0010 - "dil sw" // standard input (motherboard)
25165        PORT_MODIFY("IN-17")
25166        // 0x0001 - "dil sw" // standard input (motherboard)
25167        // 0x0002 - "dil sw" // standard input (motherboard)
25168        // 0x0004 - "dil sw" // standard input (motherboard)
25169        // 0x0008 - "dil sw" // standard input (motherboard)
25170        // 0x0010 - "dil sw" // standard input (motherboard)
25171        PORT_MODIFY("IN-18")
25172        // 0x0001 - "dil sw" // standard input (motherboard)
25173        // 0x0002 - "dil sw" // standard input (motherboard)
25174        // 0x0004 - "dil sw" // standard input (motherboard)
25175        // 0x0008 - "dil sw" // standard input (motherboard)
25176        // 0x0010 - "dil sw" // standard input (motherboard)
25177        PORT_MODIFY("IN-19")
25178        // 0x0001 - "dil sw" // standard input (motherboard)
25179        PORT_MODIFY("IN-20")
25180        // 0x0001 - "green" // standard input (motherboard)
25149      PORT_INCLUDE( sc4_base )
25150      PORT_MODIFY("IN-1")
25151      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("collec OR cancel")
25152      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
25153      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
25154      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
25155      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("streak")
25156      PORT_MODIFY("IN-2")
25157      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
25158      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
25159      PORT_MODIFY("IN-16")
25160      // 0x0001 - "dil sw" // standard input (motherboard)
25161      // 0x0002 - "dil sw" // standard input (motherboard)
25162      // 0x0004 - "dil sw" // standard input (motherboard)
25163      // 0x0008 - "dil sw" // standard input (motherboard)
25164      // 0x0010 - "dil sw" // standard input (motherboard)
25165      PORT_MODIFY("IN-17")
25166      // 0x0001 - "dil sw" // standard input (motherboard)
25167      // 0x0002 - "dil sw" // standard input (motherboard)
25168      // 0x0004 - "dil sw" // standard input (motherboard)
25169      // 0x0008 - "dil sw" // standard input (motherboard)
25170      // 0x0010 - "dil sw" // standard input (motherboard)
25171      PORT_MODIFY("IN-18")
25172      // 0x0001 - "dil sw" // standard input (motherboard)
25173      // 0x0002 - "dil sw" // standard input (motherboard)
25174      // 0x0004 - "dil sw" // standard input (motherboard)
25175      // 0x0008 - "dil sw" // standard input (motherboard)
25176      // 0x0010 - "dil sw" // standard input (motherboard)
25177      PORT_MODIFY("IN-19")
25178      // 0x0001 - "dil sw" // standard input (motherboard)
25179      PORT_MODIFY("IN-20")
25180      // 0x0001 - "green" // standard input (motherboard)
2518125181INPUT_PORTS_END
2518225182
2518325183// PR7060 DOUBLE FRENZY         DFRZYSND
r31373r31374
2520625206}
2520725207
2520825208INPUT_PORTS_START( sc4darw ) // this structure is generated
25209        PORT_INCLUDE( sc4_base )
25210        PORT_MODIFY("IN-1")
25211        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25212        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
25213        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
25214        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
25215        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
25216        PORT_MODIFY("IN-2")
25217        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("mixed")
25218        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25219        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25220        PORT_MODIFY("IN-8")
25221        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
25222        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("rshoot")
25223        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("bshoot")
25224        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nudge")
25225        PORT_MODIFY("IN-16")
25226        // 0x0001 - "dil  1" // standard input (motherboard)
25227        // 0x0002 - "dil  2" // standard input (motherboard)
25228        // 0x0004 - "dil  3" // standard input (motherboard)
25229        // 0x0008 - "dil  4" // standard input (motherboard)
25230        // 0x0010 - "dil  5" // standard input (motherboard)
25231        // 0x0100 - "topup" // known extended input, usually 'top up'
25232        PORT_MODIFY("IN-17")
25233        // 0x0001 - "dil  6" // standard input (motherboard)
25234        // 0x0002 - "dil  7" // standard input (motherboard)
25235        // 0x0004 - "dil  8" // standard input (motherboard)
25236        // 0x0008 - "dil  9" // standard input (motherboard)
25237        // 0x0010 - "dil 10" // standard input (motherboard)
25238        PORT_MODIFY("IN-18")
25239        // 0x0001 - "dil 11" // standard input (motherboard)
25240        // 0x0002 - "dil 12" // standard input (motherboard)
25241        // 0x0004 - "dil 13" // standard input (motherboard)
25242        // 0x0008 - "dil 14" // standard input (motherboard)
25243        // 0x0010 - "dil 15" // standard input (motherboard)
25244        PORT_MODIFY("IN-19")
25245        // 0x0001 - "dil 16" // standard input (motherboard)
25246        PORT_MODIFY("IN-20")
25247        // 0x0001 - "test" // standard input (motherboard)
25248        // 0x0002 - "lock" // standard input (expected here)
25249        // 0x0004 - "topdor" // standard input (expected here)
25250        // 0x0008 - "botdor" // standard input (expected here)
25251        // 0x0010 - "hopdmp" // standard input (expected here)
25209      PORT_INCLUDE( sc4_base )
25210      PORT_MODIFY("IN-1")
25211      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25212      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
25213      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
25214      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
25215      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
25216      PORT_MODIFY("IN-2")
25217      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("mixed")
25218      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25219      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25220      PORT_MODIFY("IN-8")
25221      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
25222      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("rshoot")
25223      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("bshoot")
25224      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nudge")
25225      PORT_MODIFY("IN-16")
25226      // 0x0001 - "dil  1" // standard input (motherboard)
25227      // 0x0002 - "dil  2" // standard input (motherboard)
25228      // 0x0004 - "dil  3" // standard input (motherboard)
25229      // 0x0008 - "dil  4" // standard input (motherboard)
25230      // 0x0010 - "dil  5" // standard input (motherboard)
25231      // 0x0100 - "topup" // known extended input, usually 'top up'
25232      PORT_MODIFY("IN-17")
25233      // 0x0001 - "dil  6" // standard input (motherboard)
25234      // 0x0002 - "dil  7" // standard input (motherboard)
25235      // 0x0004 - "dil  8" // standard input (motherboard)
25236      // 0x0008 - "dil  9" // standard input (motherboard)
25237      // 0x0010 - "dil 10" // standard input (motherboard)
25238      PORT_MODIFY("IN-18")
25239      // 0x0001 - "dil 11" // standard input (motherboard)
25240      // 0x0002 - "dil 12" // standard input (motherboard)
25241      // 0x0004 - "dil 13" // standard input (motherboard)
25242      // 0x0008 - "dil 14" // standard input (motherboard)
25243      // 0x0010 - "dil 15" // standard input (motherboard)
25244      PORT_MODIFY("IN-19")
25245      // 0x0001 - "dil 16" // standard input (motherboard)
25246      PORT_MODIFY("IN-20")
25247      // 0x0001 - "test" // standard input (motherboard)
25248      // 0x0002 - "lock" // standard input (expected here)
25249      // 0x0004 - "topdor" // standard input (expected here)
25250      // 0x0008 - "botdor" // standard input (expected here)
25251      // 0x0010 - "hopdmp" // standard input (expected here)
2525225252INPUT_PORTS_END
2525325253
2525425254//  PR2026 DOUGH AND ARROW         DOUGHSND         DOUGH AND ARROW
r31373r31374
2527425274}
2527525275
2527625276INPUT_PORTS_START( sc4duckq ) // this structure is generated
25277        PORT_INCLUDE( sc4_base )
25278        PORT_MODIFY("IN-1")
25279        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25280        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collet")
25281        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
25282        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
25283        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
25284        PORT_MODIFY("IN-2")
25285        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("shuffl")
25286        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25287        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25288        PORT_MODIFY("IN-8")
25289        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("autnud")
25290        PORT_MODIFY("IN-16")
25291        // 0x0001 - "dil  1" // standard input (motherboard)
25292        // 0x0002 - "dil  2" // standard input (motherboard)
25293        // 0x0004 - "dil  3" // standard input (motherboard)
25294        // 0x0008 - "dil  4" // standard input (motherboard)
25295        // 0x0010 - "dil  5" // standard input (motherboard)
25296        // 0x0100 - "topup" // known extended input, usually 'top up'
25297        PORT_MODIFY("IN-17")
25298        // 0x0001 - "dil  6" // standard input (motherboard)
25299        // 0x0002 - "dil  7" // standard input (motherboard)
25300        // 0x0004 - "dil  8" // standard input (motherboard)
25301        // 0x0008 - "dil  9" // standard input (motherboard)
25302        // 0x0010 - "dil 10" // standard input (motherboard)
25303        PORT_MODIFY("IN-18")
25304        // 0x0001 - "dil 11" // standard input (motherboard)
25305        // 0x0002 - "dil 12" // standard input (motherboard)
25306        // 0x0004 - "dil 13" // standard input (motherboard)
25307        // 0x0008 - "dil 14" // standard input (motherboard)
25308        // 0x0010 - "dil 15" // standard input (motherboard)
25309        PORT_MODIFY("IN-19")
25310        // 0x0001 - "dil 16" // standard input (motherboard)
25311        PORT_MODIFY("IN-20")
25312        // 0x0001 - "test" // standard input (motherboard)
25313        // 0x0002 - "lock" // standard input (expected here)
25314        // 0x0004 - "topdor" // standard input (expected here)
25315        // 0x0008 - "botdor" // standard input (expected here)
25316        // 0x0010 - "hopdmp" // standard input (expected here)
25277      PORT_INCLUDE( sc4_base )
25278      PORT_MODIFY("IN-1")
25279      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25280      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collet")
25281      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
25282      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
25283      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
25284      PORT_MODIFY("IN-2")
25285      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("shuffl")
25286      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25287      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25288      PORT_MODIFY("IN-8")
25289      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("autnud")
25290      PORT_MODIFY("IN-16")
25291      // 0x0001 - "dil  1" // standard input (motherboard)
25292      // 0x0002 - "dil  2" // standard input (motherboard)
25293      // 0x0004 - "dil  3" // standard input (motherboard)
25294      // 0x0008 - "dil  4" // standard input (motherboard)
25295      // 0x0010 - "dil  5" // standard input (motherboard)
25296      // 0x0100 - "topup" // known extended input, usually 'top up'
25297      PORT_MODIFY("IN-17")
25298      // 0x0001 - "dil  6" // standard input (motherboard)
25299      // 0x0002 - "dil  7" // standard input (motherboard)
25300      // 0x0004 - "dil  8" // standard input (motherboard)
25301      // 0x0008 - "dil  9" // standard input (motherboard)
25302      // 0x0010 - "dil 10" // standard input (motherboard)
25303      PORT_MODIFY("IN-18")
25304      // 0x0001 - "dil 11" // standard input (motherboard)
25305      // 0x0002 - "dil 12" // standard input (motherboard)
25306      // 0x0004 - "dil 13" // standard input (motherboard)
25307      // 0x0008 - "dil 14" // standard input (motherboard)
25308      // 0x0010 - "dil 15" // standard input (motherboard)
25309      PORT_MODIFY("IN-19")
25310      // 0x0001 - "dil 16" // standard input (motherboard)
25311      PORT_MODIFY("IN-20")
25312      // 0x0001 - "test" // standard input (motherboard)
25313      // 0x0002 - "lock" // standard input (expected here)
25314      // 0x0004 - "topdor" // standard input (expected here)
25315      // 0x0008 - "botdor" // standard input (expected here)
25316      // 0x0010 - "hopdmp" // standard input (expected here)
2531725317INPUT_PORTS_END
2531825318
2531925319// PR2519 THEDUCKSOFHAZZARD V1.0         DUCKSOFHAZZARDSND         DUCKS OF HAZZARD
r31373r31374
2533725337}
2533825338
2533925339INPUT_PORTS_START( sc4eascs ) // this structure is generated
25340        PORT_INCLUDE( sc4_base )
25341        PORT_MODIFY("IN-1")
25342        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("hold 1")
25343        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 2")
25344        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 3")
25345        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("cancel")
25346        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("autopl")
25347        PORT_MODIFY("IN-2")
25348        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
25349        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25350        PORT_MODIFY("IN-3")
25351        // 0x0004 - "stk 4" // standard input (expected here)
25352        // 0x0008 - "stk 3" // standard input (expected here)
25353        // 0x0010 - "stk 2" // standard input (expected here)
25354        PORT_MODIFY("IN-4")
25355        // 0x0002 - "hop hi" // known extended(?) input, sometimes 'hop hi'
25356        // 0x0008 - "htopup" // known extended(?) input, sometimes 'hop top'
25357        // 0x0100 - "hop lo" // known extended input, usually 'hopper low'
25358        PORT_MODIFY("IN-5")
25359        // 0x0001 - "priz4" // standard input (expected here)
25360        // 0x0002 - "priz3" // standard input (expected here)
25361        // 0x0004 - "priz2" // standard input (expected here)
25362        // 0x0008 - "priz1" // standard input (expected here)
25363        PORT_MODIFY("IN-6")
25364        // 0x0001 - "perc1" // standard input (expected here)
25365        // 0x0002 - "perc2" // standard input (expected here)
25366        // 0x0004 - "perc3" // standard input (expected here)
25367        // 0x0008 - "perc4" // standard input (expected here)
25368        PORT_MODIFY("IN-16")
25369        // 0x0001 - "dil 1" // standard input (motherboard)
25370        // 0x0002 - "dil 2" // standard input (motherboard)
25371        // 0x0004 - "dil 3" // standard input (motherboard)
25372        // 0x0008 - "dil 4" // standard input (motherboard)
25373        // 0x0010 - "dil 5" // standard input (motherboard)
25374        PORT_MODIFY("IN-17")
25375        // 0x0001 - "dil 6" // standard input (motherboard)
25376        // 0x0002 - "dil 7" // standard input (motherboard)
25377        // 0x0004 - "dil 8" // standard input (motherboard)
25378        // 0x0008 - "dil 9" // standard input (motherboard)
25379        // 0x0010 - "dil10" // standard input (motherboard)
25380        PORT_MODIFY("IN-18")
25381        // 0x0001 - "dil11" // standard input (motherboard)
25382        // 0x0002 - "dil12" // standard input (motherboard)
25383        // 0x0004 - "dil13" // standard input (motherboard)
25384        // 0x0008 - "dil14" // standard input (motherboard)
25385        // 0x0010 - "dil15" // standard input (motherboard)
25386        PORT_MODIFY("IN-19")
25387        // 0x0001 - "dil16" // standard input (motherboard)
25388        PORT_MODIFY("IN-20")
25389        // 0x0001 - "grnbut" // standard input (motherboard)
25390        // 0x0002 - "cshdor" // standard input (expected here)
25391        // 0x0004 - "frt do" // standard input (expected here)
25392        // 0x0008 - "hopdmp" // standard input (expected here)
25393        // 0x0010 - "serdor" // standard input (expected here)
25340      PORT_INCLUDE( sc4_base )
25341      PORT_MODIFY("IN-1")
25342      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("hold 1")
25343      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 2")
25344      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 3")
25345      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("cancel")
25346      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("autopl")
25347      PORT_MODIFY("IN-2")
25348      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
25349      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25350      PORT_MODIFY("IN-3")
25351      // 0x0004 - "stk 4" // standard input (expected here)
25352      // 0x0008 - "stk 3" // standard input (expected here)
25353      // 0x0010 - "stk 2" // standard input (expected here)
25354      PORT_MODIFY("IN-4")
25355      // 0x0002 - "hop hi" // known extended(?) input, sometimes 'hop hi'
25356      // 0x0008 - "htopup" // known extended(?) input, sometimes 'hop top'
25357      // 0x0100 - "hop lo" // known extended input, usually 'hopper low'
25358      PORT_MODIFY("IN-5")
25359      // 0x0001 - "priz4" // standard input (expected here)
25360      // 0x0002 - "priz3" // standard input (expected here)
25361      // 0x0004 - "priz2" // standard input (expected here)
25362      // 0x0008 - "priz1" // standard input (expected here)
25363      PORT_MODIFY("IN-6")
25364      // 0x0001 - "perc1" // standard input (expected here)
25365      // 0x0002 - "perc2" // standard input (expected here)
25366      // 0x0004 - "perc3" // standard input (expected here)
25367      // 0x0008 - "perc4" // standard input (expected here)
25368      PORT_MODIFY("IN-16")
25369      // 0x0001 - "dil 1" // standard input (motherboard)
25370      // 0x0002 - "dil 2" // standard input (motherboard)
25371      // 0x0004 - "dil 3" // standard input (motherboard)
25372      // 0x0008 - "dil 4" // standard input (motherboard)
25373      // 0x0010 - "dil 5" // standard input (motherboard)
25374      PORT_MODIFY("IN-17")
25375      // 0x0001 - "dil 6" // standard input (motherboard)
25376      // 0x0002 - "dil 7" // standard input (motherboard)
25377      // 0x0004 - "dil 8" // standard input (motherboard)
25378      // 0x0008 - "dil 9" // standard input (motherboard)
25379      // 0x0010 - "dil10" // standard input (motherboard)
25380      PORT_MODIFY("IN-18")
25381      // 0x0001 - "dil11" // standard input (motherboard)
25382      // 0x0002 - "dil12" // standard input (motherboard)
25383      // 0x0004 - "dil13" // standard input (motherboard)
25384      // 0x0008 - "dil14" // standard input (motherboard)
25385      // 0x0010 - "dil15" // standard input (motherboard)
25386      PORT_MODIFY("IN-19")
25387      // 0x0001 - "dil16" // standard input (motherboard)
25388      PORT_MODIFY("IN-20")
25389      // 0x0001 - "grnbut" // standard input (motherboard)
25390      // 0x0002 - "cshdor" // standard input (expected here)
25391      // 0x0004 - "frt do" // standard input (expected here)
25392      // 0x0008 - "hopdmp" // standard input (expected here)
25393      // 0x0010 - "serdor" // standard input (expected here)
2539425394INPUT_PORTS_END
2539525395
2539625396// PR1326 CASINO EASY STREAK         PR1326 EASY STREAK SOUNDS11  (actually expects PR1326_CAS_EASY_STREAK_SOUNDS11 ? )
r31373r31374
2542425424}
2542525425
2542625426INPUT_PORTS_START( sc4fastf ) // this structure is generated
25427        PORT_INCLUDE( sc4_base )
25428        PORT_MODIFY("IN-1")
25429        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25430        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
25431        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
25432        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
25433        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
25434        PORT_MODIFY("IN-2")
25435        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("collct")
25436        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ft exc")
25437        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25438        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25439        PORT_MODIFY("IN-8")
25440        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("kos lo")
25441        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("ndg lo")
25442        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spn lo")
25443        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("kos hi")
25444        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("ndg hi")
25445        PORT_MODIFY("IN-9")
25446        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("spn hi")
25447        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("stop")
25448        PORT_MODIFY("IN-16")
25449        // 0x0001 - "dil  1" // standard input (motherboard)
25450        // 0x0002 - "dil  2" // standard input (motherboard)
25451        // 0x0004 - "dil  3" // standard input (motherboard)
25452        // 0x0008 - "dil  4" // standard input (motherboard)
25453        // 0x0010 - "dil  5" // standard input (motherboard)
25454        // 0x0100 - "top up" // known extended input, usually 'top up'
25455        PORT_MODIFY("IN-17")
25456        // 0x0001 - "dil  6" // standard input (motherboard)
25457        // 0x0002 - "dil  7" // standard input (motherboard)
25458        // 0x0004 - "dil  8" // standard input (motherboard)
25459        // 0x0008 - "dil  9" // standard input (motherboard)
25460        // 0x0010 - "dil 10" // standard input (motherboard)
25461        PORT_MODIFY("IN-18")
25462        // 0x0001 - "dil 11" // standard input (motherboard)
25463        // 0x0002 - "dil 12" // standard input (motherboard)
25464        // 0x0004 - "dil 13" // standard input (motherboard)
25465        // 0x0008 - "dil 14" // standard input (motherboard)
25466        // 0x0010 - "dil 15" // standard input (motherboard)
25467        PORT_MODIFY("IN-19")
25468        // 0x0001 - "dil 16" // standard input (motherboard)
25469        PORT_MODIFY("IN-20")
25470        // 0x0001 - "testsw" // standard input (motherboard)
25471        // 0x0002 - "dor lk" // standard input (expected here)
25472        // 0x0004 - "tp dor" // standard input (expected here)
25473        // 0x0008 - "csh bx" // standard input (expected here)
25474        // 0x0010 - "deflt" // standard input (expected here)
25427      PORT_INCLUDE( sc4_base )
25428      PORT_MODIFY("IN-1")
25429      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25430      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
25431      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
25432      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
25433      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
25434      PORT_MODIFY("IN-2")
25435      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("collct")
25436      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ft exc")
25437      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25438      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25439      PORT_MODIFY("IN-8")
25440      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("kos lo")
25441      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("ndg lo")
25442      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spn lo")
25443      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("kos hi")
25444      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("ndg hi")
25445      PORT_MODIFY("IN-9")
25446      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("spn hi")
25447      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("stop")
25448      PORT_MODIFY("IN-16")
25449      // 0x0001 - "dil  1" // standard input (motherboard)
25450      // 0x0002 - "dil  2" // standard input (motherboard)
25451      // 0x0004 - "dil  3" // standard input (motherboard)
25452      // 0x0008 - "dil  4" // standard input (motherboard)
25453      // 0x0010 - "dil  5" // standard input (motherboard)
25454      // 0x0100 - "top up" // known extended input, usually 'top up'
25455      PORT_MODIFY("IN-17")
25456      // 0x0001 - "dil  6" // standard input (motherboard)
25457      // 0x0002 - "dil  7" // standard input (motherboard)
25458      // 0x0004 - "dil  8" // standard input (motherboard)
25459      // 0x0008 - "dil  9" // standard input (motherboard)
25460      // 0x0010 - "dil 10" // standard input (motherboard)
25461      PORT_MODIFY("IN-18")
25462      // 0x0001 - "dil 11" // standard input (motherboard)
25463      // 0x0002 - "dil 12" // standard input (motherboard)
25464      // 0x0004 - "dil 13" // standard input (motherboard)
25465      // 0x0008 - "dil 14" // standard input (motherboard)
25466      // 0x0010 - "dil 15" // standard input (motherboard)
25467      PORT_MODIFY("IN-19")
25468      // 0x0001 - "dil 16" // standard input (motherboard)
25469      PORT_MODIFY("IN-20")
25470      // 0x0001 - "testsw" // standard input (motherboard)
25471      // 0x0002 - "dor lk" // standard input (expected here)
25472      // 0x0004 - "tp dor" // standard input (expected here)
25473      // 0x0008 - "csh bx" // standard input (expected here)
25474      // 0x0010 - "deflt" // standard input (expected here)
2547525475INPUT_PORTS_END
2547625476
2547725477// PR2071 FAST 'N' FURIOUS         FNF SOUNDS         FAST 'N' FURIOUS
r31373r31374
2549725497}
2549825498
2549925499INPUT_PORTS_START( sc4ffru ) // this structure is generated
25500        PORT_INCLUDE( sc4_base )
25501        PORT_MODIFY("IN-1")
25502        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25503        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
25504        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
25505        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
25506        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
25507        PORT_MODIFY("IN-2")
25508        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
25509        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25510        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25511        PORT_MODIFY("IN-4")
25512        // 0x0010 - "topup" // known extended(?) input, sometimes 'top up'
25513        PORT_MODIFY("IN-8")
25514        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("csh ko")
25515        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("bonus")
25516        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
25517        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("featre")
25518        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("fet ko")
25519        PORT_MODIFY("IN-16")
25520        // 0x0001 - "dil  1" // standard input (motherboard)
25521        // 0x0002 - "dil  2" // standard input (motherboard)
25522        // 0x0004 - "dil  3" // standard input (motherboard)
25523        // 0x0008 - "dil  4" // standard input (motherboard)
25524        // 0x0010 - "dil  5" // standard input (motherboard)
25525        PORT_MODIFY("IN-17")
25526        // 0x0001 - "dil  6" // standard input (motherboard)
25527        // 0x0002 - "dil  7" // standard input (motherboard)
25528        // 0x0004 - "dil  8" // standard input (motherboard)
25529        // 0x0008 - "dil  9" // standard input (motherboard)
25530        // 0x0010 - "dil 10" // standard input (motherboard)
25531        PORT_MODIFY("IN-18")
25532        // 0x0001 - "dil 11" // standard input (motherboard)
25533        // 0x0002 - "dil 12" // standard input (motherboard)
25534        // 0x0004 - "dil 13" // standard input (motherboard)
25535        // 0x0008 - "dil 14" // standard input (motherboard)
25536        // 0x0010 - "dil 15" // standard input (motherboard)
25537        PORT_MODIFY("IN-19")
25538        // 0x0001 - "dil 16" // standard input (motherboard)
25539        PORT_MODIFY("IN-20")
25540        // 0x0001 - "test" // standard input (motherboard)
25541        // 0x0002 - "lock" // standard input (expected here)
25542        // 0x0004 - "topdor" // standard input (expected here)
25543        // 0x0008 - "botdor" // standard input (expected here)
25544        // 0x0010 - "hopdmp" // standard input (expected here)
25500      PORT_INCLUDE( sc4_base )
25501      PORT_MODIFY("IN-1")
25502      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25503      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
25504      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
25505      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
25506      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
25507      PORT_MODIFY("IN-2")
25508      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
25509      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25510      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25511      PORT_MODIFY("IN-4")
25512      // 0x0010 - "topup" // known extended(?) input, sometimes 'top up'
25513      PORT_MODIFY("IN-8")
25514      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("csh ko")
25515      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("bonus")
25516      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
25517      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("featre")
25518      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("fet ko")
25519      PORT_MODIFY("IN-16")
25520      // 0x0001 - "dil  1" // standard input (motherboard)
25521      // 0x0002 - "dil  2" // standard input (motherboard)
25522      // 0x0004 - "dil  3" // standard input (motherboard)
25523      // 0x0008 - "dil  4" // standard input (motherboard)
25524      // 0x0010 - "dil  5" // standard input (motherboard)
25525      PORT_MODIFY("IN-17")
25526      // 0x0001 - "dil  6" // standard input (motherboard)
25527      // 0x0002 - "dil  7" // standard input (motherboard)
25528      // 0x0004 - "dil  8" // standard input (motherboard)
25529      // 0x0008 - "dil  9" // standard input (motherboard)
25530      // 0x0010 - "dil 10" // standard input (motherboard)
25531      PORT_MODIFY("IN-18")
25532      // 0x0001 - "dil 11" // standard input (motherboard)
25533      // 0x0002 - "dil 12" // standard input (motherboard)
25534      // 0x0004 - "dil 13" // standard input (motherboard)
25535      // 0x0008 - "dil 14" // standard input (motherboard)
25536      // 0x0010 - "dil 15" // standard input (motherboard)
25537      PORT_MODIFY("IN-19")
25538      // 0x0001 - "dil 16" // standard input (motherboard)
25539      PORT_MODIFY("IN-20")
25540      // 0x0001 - "test" // standard input (motherboard)
25541      // 0x0002 - "lock" // standard input (expected here)
25542      // 0x0004 - "topdor" // standard input (expected here)
25543      // 0x0008 - "botdor" // standard input (expected here)
25544      // 0x0010 - "hopdmp" // standard input (expected here)
2554525545INPUT_PORTS_END
2554625546
2554725547// PR7070 FAST FRUIT         FFRUIT SOUNDS            FAST FRUIT
r31373r31374
2557025570}
2557125571
2557225572INPUT_PORTS_START( sc4fire ) // this structure is generated
25573        PORT_INCLUDE( sc4_base )
25574        PORT_MODIFY("IN-1")
25575        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25576        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
25577        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
25578        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
25579        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
25580        PORT_MODIFY("IN-2")
25581        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
25582        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25583        PORT_MODIFY("IN-8")
25584        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
25585        PORT_MODIFY("IN-16")
25586        // 0x0001 - "dil  1" // standard input (motherboard)
25587        // 0x0002 - "dil  2" // standard input (motherboard)
25588        // 0x0004 - "dil  3" // standard input (motherboard)
25589        // 0x0008 - "dil  4" // standard input (motherboard)
25590        // 0x0010 - "dil  5" // standard input (motherboard)
25591        // 0x0100 - "top up" // known extended input, usually 'top up'
25592        PORT_MODIFY("IN-17")
25593        // 0x0001 - "dil  6" // standard input (motherboard)
25594        // 0x0002 - "dil  7" // standard input (motherboard)
25595        // 0x0004 - "dil  8" // standard input (motherboard)
25596        // 0x0008 - "dil  9" // standard input (motherboard)
25597        // 0x0010 - "dil 10" // standard input (motherboard)
25598        PORT_MODIFY("IN-18")
25599        // 0x0001 - "dil 11" // standard input (motherboard)
25600        // 0x0002 - "dil 12" // standard input (motherboard)
25601        // 0x0004 - "dil 13" // standard input (motherboard)
25602        // 0x0008 - "dil 14" // standard input (motherboard)
25603        // 0x0010 - "dil 15" // standard input (motherboard)
25604        PORT_MODIFY("IN-19")
25605        // 0x0001 - "dil 16" // standard input (motherboard)
25606        PORT_MODIFY("IN-20")
25607        // 0x0001 - "testsw" // standard input (motherboard)
25608        // 0x0002 - "dor lk" // standard input (expected here)
25609        // 0x0004 - "tp dor" // standard input (expected here)
25610        // 0x0008 - "csh bx" // standard input (expected here)
25611        // 0x0010 - "deflt" // standard input (expected here)
25573      PORT_INCLUDE( sc4_base )
25574      PORT_MODIFY("IN-1")
25575      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25576      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
25577      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
25578      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
25579      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
25580      PORT_MODIFY("IN-2")
25581      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
25582      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25583      PORT_MODIFY("IN-8")
25584      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
25585      PORT_MODIFY("IN-16")
25586      // 0x0001 - "dil  1" // standard input (motherboard)
25587      // 0x0002 - "dil  2" // standard input (motherboard)
25588      // 0x0004 - "dil  3" // standard input (motherboard)
25589      // 0x0008 - "dil  4" // standard input (motherboard)
25590      // 0x0010 - "dil  5" // standard input (motherboard)
25591      // 0x0100 - "top up" // known extended input, usually 'top up'
25592      PORT_MODIFY("IN-17")
25593      // 0x0001 - "dil  6" // standard input (motherboard)
25594      // 0x0002 - "dil  7" // standard input (motherboard)
25595      // 0x0004 - "dil  8" // standard input (motherboard)
25596      // 0x0008 - "dil  9" // standard input (motherboard)
25597      // 0x0010 - "dil 10" // standard input (motherboard)
25598      PORT_MODIFY("IN-18")
25599      // 0x0001 - "dil 11" // standard input (motherboard)
25600      // 0x0002 - "dil 12" // standard input (motherboard)
25601      // 0x0004 - "dil 13" // standard input (motherboard)
25602      // 0x0008 - "dil 14" // standard input (motherboard)
25603      // 0x0010 - "dil 15" // standard input (motherboard)
25604      PORT_MODIFY("IN-19")
25605      // 0x0001 - "dil 16" // standard input (motherboard)
25606      PORT_MODIFY("IN-20")
25607      // 0x0001 - "testsw" // standard input (motherboard)
25608      // 0x0002 - "dor lk" // standard input (expected here)
25609      // 0x0004 - "tp dor" // standard input (expected here)
25610      // 0x0008 - "csh bx" // standard input (expected here)
25611      // 0x0010 - "deflt" // standard input (expected here)
2561225612INPUT_PORTS_END
2561325613
2561425614// PR2082 FIRE POWER         FPOW SOUNDS         FIRE POWER
r31373r31374
2563325633}
2563425634
2563525635INPUT_PORTS_START( sc4frenz ) // this structure is generated
25636        PORT_INCLUDE( sc4_base )
25637        PORT_MODIFY("IN-1")
25638        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25639        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
25640        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
25641        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
25642        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
25643        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
25644        PORT_MODIFY("IN-2")
25645        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
25646        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25647        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25648        PORT_MODIFY("IN-3")
25649        // 0x0004 - "stk 4" // standard input (expected here)
25650        // 0x0008 - "stk 3" // standard input (expected here)
25651        // 0x0010 - "stk 2" // standard input (expected here)
25652        PORT_MODIFY("IN-5")
25653        // 0x0001 - "priz4" // standard input (expected here)
25654        // 0x0002 - "priz3" // standard input (expected here)
25655        // 0x0004 - "priz2" // standard input (expected here)
25656        // 0x0008 - "priz1" // standard input (expected here)
25657        PORT_MODIFY("IN-6")
25658        // 0x0001 - "perc1" // standard input (expected here)
25659        // 0x0002 - "perc2" // standard input (expected here)
25660        // 0x0004 - "perc3" // standard input (expected here)
25661        // 0x0008 - "perc4" // standard input (expected here)
25662        PORT_MODIFY("IN-8")
25663        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("boost")
25664        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("no lse")
25665        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("ch num")
25666        PORT_MODIFY("IN-16")
25667        // 0x0001 - "dil 1" // standard input (motherboard)
25668        // 0x0002 - "dil 2" // standard input (motherboard)
25669        // 0x0004 - "dil 3" // standard input (motherboard)
25670        // 0x0008 - "dil 4" // standard input (motherboard)
25671        // 0x0010 - "dil 5" // standard input (motherboard)
25672        // 0x0100 - "top up" // known extended input, usually 'top up'
25673        PORT_MODIFY("IN-17")
25674        // 0x0001 - "dil 6" // standard input (motherboard)
25675        // 0x0002 - "dil 7" // standard input (motherboard)
25676        // 0x0004 - "dil 8" // standard input (motherboard)
25677        // 0x0008 - "dil 9" // standard input (motherboard)
25678        // 0x0010 - "dil10" // standard input (motherboard)
25679        PORT_MODIFY("IN-18")
25680        // 0x0001 - "dil11" // standard input (motherboard)
25681        // 0x0002 - "dil12" // standard input (motherboard)
25682        // 0x0004 - "dil13" // standard input (motherboard)
25683        // 0x0008 - "dil14" // standard input (motherboard)
25684        // 0x0010 - "dil15" // standard input (motherboard)
25685        PORT_MODIFY("IN-19")
25686        // 0x0001 - "dil16" // standard input (motherboard)
25687        PORT_MODIFY("IN-20")
25688        // 0x0001 - "grnbut" // standard input (motherboard)
25689        // 0x0002 - "dorlok" // standard input (expected here)
25690        // 0x0004 - "topdor" // standard input (expected here)
25691        // 0x0008 - "botdor" // standard input (expected here)
25692        // 0x0010 - "hopdmp" // standard input (expected here)
25636      PORT_INCLUDE( sc4_base )
25637      PORT_MODIFY("IN-1")
25638      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25639      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
25640      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
25641      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
25642      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
25643      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
25644      PORT_MODIFY("IN-2")
25645      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
25646      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25647      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25648      PORT_MODIFY("IN-3")
25649      // 0x0004 - "stk 4" // standard input (expected here)
25650      // 0x0008 - "stk 3" // standard input (expected here)
25651      // 0x0010 - "stk 2" // standard input (expected here)
25652      PORT_MODIFY("IN-5")
25653      // 0x0001 - "priz4" // standard input (expected here)
25654      // 0x0002 - "priz3" // standard input (expected here)
25655      // 0x0004 - "priz2" // standard input (expected here)
25656      // 0x0008 - "priz1" // standard input (expected here)
25657      PORT_MODIFY("IN-6")
25658      // 0x0001 - "perc1" // standard input (expected here)
25659      // 0x0002 - "perc2" // standard input (expected here)
25660      // 0x0004 - "perc3" // standard input (expected here)
25661      // 0x0008 - "perc4" // standard input (expected here)
25662      PORT_MODIFY("IN-8")
25663      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("boost")
25664      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("no lse")
25665      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("ch num")
25666      PORT_MODIFY("IN-16")
25667      // 0x0001 - "dil 1" // standard input (motherboard)
25668      // 0x0002 - "dil 2" // standard input (motherboard)
25669      // 0x0004 - "dil 3" // standard input (motherboard)
25670      // 0x0008 - "dil 4" // standard input (motherboard)
25671      // 0x0010 - "dil 5" // standard input (motherboard)
25672      // 0x0100 - "top up" // known extended input, usually 'top up'
25673      PORT_MODIFY("IN-17")
25674      // 0x0001 - "dil 6" // standard input (motherboard)
25675      // 0x0002 - "dil 7" // standard input (motherboard)
25676      // 0x0004 - "dil 8" // standard input (motherboard)
25677      // 0x0008 - "dil 9" // standard input (motherboard)
25678      // 0x0010 - "dil10" // standard input (motherboard)
25679      PORT_MODIFY("IN-18")
25680      // 0x0001 - "dil11" // standard input (motherboard)
25681      // 0x0002 - "dil12" // standard input (motherboard)
25682      // 0x0004 - "dil13" // standard input (motherboard)
25683      // 0x0008 - "dil14" // standard input (motherboard)
25684      // 0x0010 - "dil15" // standard input (motherboard)
25685      PORT_MODIFY("IN-19")
25686      // 0x0001 - "dil16" // standard input (motherboard)
25687      PORT_MODIFY("IN-20")
25688      // 0x0001 - "grnbut" // standard input (motherboard)
25689      // 0x0002 - "dorlok" // standard input (expected here)
25690      // 0x0004 - "topdor" // standard input (expected here)
25691      // 0x0008 - "botdor" // standard input (expected here)
25692      // 0x0010 - "hopdmp" // standard input (expected here)
2569325693INPUT_PORTS_END
2569425694
2569525695// PR1101 FRUIT FRENZY         PR1101 FRUIT FRENZY SOUNDS11
r31373r31374
2571725717}
2571825718
2571925719INPUT_PORTS_START( sc4ftopi ) // this structure is generated
25720        PORT_INCLUDE( sc4_base )
25721        PORT_MODIFY("IN-1")
25722        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25723        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
25724        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
25725        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
25726        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
25727        PORT_MODIFY("IN-2")
25728        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
25729        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25730        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25731        PORT_MODIFY("IN-8")
25732        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
25733        PORT_MODIFY("IN-9")
25734        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nudge")
25735        PORT_MODIFY("IN-16")
25736        // 0x0001 - "dil  1" // standard input (motherboard)
25737        // 0x0002 - "dil  2" // standard input (motherboard)
25738        // 0x0004 - "dil  3" // standard input (motherboard)
25739        // 0x0008 - "dil  4" // standard input (motherboard)
25740        // 0x0010 - "dil  5" // standard input (motherboard)
25741        // 0x0100 - "topup" // known extended input, usually 'top up'
25742        PORT_MODIFY("IN-17")
25743        // 0x0001 - "dil  6" // standard input (motherboard)
25744        // 0x0002 - "dil  7" // standard input (motherboard)
25745        // 0x0004 - "dil  8" // standard input (motherboard)
25746        // 0x0008 - "dil  9" // standard input (motherboard)
25747        // 0x0010 - "dil 10" // standard input (motherboard)
25748        PORT_MODIFY("IN-18")
25749        // 0x0001 - "dil 11" // standard input (motherboard)
25750        // 0x0002 - "dil 12" // standard input (motherboard)
25751        // 0x0004 - "dil 13" // standard input (motherboard)
25752        // 0x0008 - "dil 14" // standard input (motherboard)
25753        // 0x0010 - "dil 15" // standard input (motherboard)
25754        PORT_MODIFY("IN-19")
25755        // 0x0001 - "dil 16" // standard input (motherboard)
25756        PORT_MODIFY("IN-20")
25757        // 0x0001 - "test" // standard input (motherboard)
25758        // 0x0002 - "lock" // standard input (expected here)
25759        // 0x0004 - "topdor" // standard input (expected here)
25760        // 0x0008 - "botdor" // standard input (expected here)
25761        // 0x0010 - "hopdmp" // standard input (expected here)
25720      PORT_INCLUDE( sc4_base )
25721      PORT_MODIFY("IN-1")
25722      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
25723      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
25724      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
25725      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
25726      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
25727      PORT_MODIFY("IN-2")
25728      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
25729      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25730      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25731      PORT_MODIFY("IN-8")
25732      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
25733      PORT_MODIFY("IN-9")
25734      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nudge")
25735      PORT_MODIFY("IN-16")
25736      // 0x0001 - "dil  1" // standard input (motherboard)
25737      // 0x0002 - "dil  2" // standard input (motherboard)
25738      // 0x0004 - "dil  3" // standard input (motherboard)
25739      // 0x0008 - "dil  4" // standard input (motherboard)
25740      // 0x0010 - "dil  5" // standard input (motherboard)
25741      // 0x0100 - "topup" // known extended input, usually 'top up'
25742      PORT_MODIFY("IN-17")
25743      // 0x0001 - "dil  6" // standard input (motherboard)
25744      // 0x0002 - "dil  7" // standard input (motherboard)
25745      // 0x0004 - "dil  8" // standard input (motherboard)
25746      // 0x0008 - "dil  9" // standard input (motherboard)
25747      // 0x0010 - "dil 10" // standard input (motherboard)
25748      PORT_MODIFY("IN-18")
25749      // 0x0001 - "dil 11" // standard input (motherboard)
25750      // 0x0002 - "dil 12" // standard input (motherboard)
25751      // 0x0004 - "dil 13" // standard input (motherboard)
25752      // 0x0008 - "dil 14" // standard input (motherboard)
25753      // 0x0010 - "dil 15" // standard input (motherboard)
25754      PORT_MODIFY("IN-19")
25755      // 0x0001 - "dil 16" // standard input (motherboard)
25756      PORT_MODIFY("IN-20")
25757      // 0x0001 - "test" // standard input (motherboard)
25758      // 0x0002 - "lock" // standard input (expected here)
25759      // 0x0004 - "topdor" // standard input (expected here)
25760      // 0x0008 - "botdor" // standard input (expected here)
25761      // 0x0010 - "hopdmp" // standard input (expected here)
2576225762INPUT_PORTS_END
2576325763
2576425764// PR2027 FRUITOPIA         FRUITOPIASND             FRUITOPIA
r31373r31374
2579325793}
2579425794
2579525795INPUT_PORTS_START( sc4fullt ) // this structure is generated
25796        PORT_INCLUDE( sc4_base )
25797        PORT_MODIFY("IN-1")
25798        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
25799        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
25800        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
25801        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
25802        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("transf")
25803        PORT_MODIFY("IN-2")
25804        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
25805        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25806        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25807        PORT_MODIFY("IN-8")
25808        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
25809        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c pot")
25810        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("wserie")
25811        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spin")
25812        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("nudge")
25813        PORT_MODIFY("IN-16")
25814        // 0x0001 - "dil  1" // standard input (motherboard)
25815        // 0x0002 - "dil  2" // standard input (motherboard)
25816        // 0x0004 - "dil  3" // standard input (motherboard)
25817        // 0x0008 - "dil  4" // standard input (motherboard)
25818        // 0x0010 - "dil  5" // standard input (motherboard)
25819        // 0x0100 - "topup" // known extended input, usually 'top up'
25820        PORT_MODIFY("IN-17")
25821        // 0x0001 - "dil  6" // standard input (motherboard)
25822        // 0x0002 - "dil  7" // standard input (motherboard)
25823        // 0x0004 - "dil  8" // standard input (motherboard)
25824        // 0x0008 - "dil  9" // standard input (motherboard)
25825        // 0x0010 - "dil 10" // standard input (motherboard)
25826        PORT_MODIFY("IN-18")
25827        // 0x0001 - "dil 11" // standard input (motherboard)
25828        // 0x0002 - "dil 12" // standard input (motherboard)
25829        // 0x0004 - "dil 13" // standard input (motherboard)
25830        // 0x0008 - "dil 14" // standard input (motherboard)
25831        // 0x0010 - "dil 15" // standard input (motherboard)
25832        PORT_MODIFY("IN-19")
25833        // 0x0001 - "dil 16" // standard input (motherboard)
25834        PORT_MODIFY("IN-20")
25835        // 0x0001 - "test" // standard input (motherboard)
25836        // 0x0002 - "lock" // standard input (expected here)
25837        // 0x0004 - "topdor" // standard input (expected here)
25838        // 0x0008 - "botdor" // standard input (expected here)
25839        // 0x0010 - "hopdmp" // standard input (expected here)
25796      PORT_INCLUDE( sc4_base )
25797      PORT_MODIFY("IN-1")
25798      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
25799      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
25800      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
25801      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
25802      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("transf")
25803      PORT_MODIFY("IN-2")
25804      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
25805      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25806      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25807      PORT_MODIFY("IN-8")
25808      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
25809      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c pot")
25810      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("wserie")
25811      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spin")
25812      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("nudge")
25813      PORT_MODIFY("IN-16")
25814      // 0x0001 - "dil  1" // standard input (motherboard)
25815      // 0x0002 - "dil  2" // standard input (motherboard)
25816      // 0x0004 - "dil  3" // standard input (motherboard)
25817      // 0x0008 - "dil  4" // standard input (motherboard)
25818      // 0x0010 - "dil  5" // standard input (motherboard)
25819      // 0x0100 - "topup" // known extended input, usually 'top up'
25820      PORT_MODIFY("IN-17")
25821      // 0x0001 - "dil  6" // standard input (motherboard)
25822      // 0x0002 - "dil  7" // standard input (motherboard)
25823      // 0x0004 - "dil  8" // standard input (motherboard)
25824      // 0x0008 - "dil  9" // standard input (motherboard)
25825      // 0x0010 - "dil 10" // standard input (motherboard)
25826      PORT_MODIFY("IN-18")
25827      // 0x0001 - "dil 11" // standard input (motherboard)
25828      // 0x0002 - "dil 12" // standard input (motherboard)
25829      // 0x0004 - "dil 13" // standard input (motherboard)
25830      // 0x0008 - "dil 14" // standard input (motherboard)
25831      // 0x0010 - "dil 15" // standard input (motherboard)
25832      PORT_MODIFY("IN-19")
25833      // 0x0001 - "dil 16" // standard input (motherboard)
25834      PORT_MODIFY("IN-20")
25835      // 0x0001 - "test" // standard input (motherboard)
25836      // 0x0002 - "lock" // standard input (expected here)
25837      // 0x0004 - "topdor" // standard input (expected here)
25838      // 0x0008 - "botdor" // standard input (expected here)
25839      // 0x0010 - "hopdmp" // standard input (expected here)
2584025840INPUT_PORTS_END
2584125841
2584225842// PR2537 FULL THROTTLE 011         FULLTHROTTLESND          FULL  THROTTLE
r31373r31374
2587325873}
2587425874
2587525875INPUT_PORTS_START( sc4ziggy ) // this structure is generated
25876        PORT_INCLUDE( sc4_base )
25877        PORT_MODIFY("IN-1")
25878        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
25879        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
25880        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
25881        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
25882        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
25883        PORT_MODIFY("IN-2")
25884        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
25885        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
25886        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25887        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
25888        PORT_MODIFY("IN-8")
25889        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("f lo")
25890        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
25891        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c lo")
25892        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
25893        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c hi")
25894        PORT_MODIFY("IN-9")
25895        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
25896        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("f hi")
25897        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("step")
25898        PORT_MODIFY("IN-16")
25899        // 0x0001 - "dil 1" // standard input (motherboard)
25900        // 0x0002 - "dil 2" // standard input (motherboard)
25901        // 0x0004 - "dil 3" // standard input (motherboard)
25902        // 0x0008 - "dil 4" // standard input (motherboard)
25903        // 0x0010 - "dil 5" // standard input (motherboard)
25904        // 0x0100 - "topup" // known extended input, usually 'top up'
25905        PORT_MODIFY("IN-17")
25906        // 0x0001 - "dil 6" // standard input (motherboard)
25907        // 0x0002 - "dil 7" // standard input (motherboard)
25908        // 0x0004 - "dil 8" // standard input (motherboard)
25909        // 0x0008 - "dil 9" // standard input (motherboard)
25910        // 0x0010 - "dil10" // standard input (motherboard)
25911        PORT_MODIFY("IN-18")
25912        // 0x0001 - "dil11" // standard input (motherboard)
25913        // 0x0002 - "dil12" // standard input (motherboard)
25914        // 0x0004 - "dil13" // standard input (motherboard)
25915        // 0x0008 - "dil14" // standard input (motherboard)
25916        // 0x0010 - "dil15" // standard input (motherboard)
25917        PORT_MODIFY("IN-19")
25918        // 0x0001 - "dil16" // standard input (motherboard)
25919        PORT_MODIFY("IN-20")
25920        // 0x0001 - "test" // standard input (motherboard)
25921        // 0x0002 - "dorlk" // standard input (expected here)
25922        // 0x0004 - "tpdor" // standard input (expected here)
25923        // 0x0008 - "cshbx" // standard input (expected here)
25924        // 0x0010 - "deflt" // standard input (expected here)
25876      PORT_INCLUDE( sc4_base )
25877      PORT_MODIFY("IN-1")
25878      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
25879      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
25880      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
25881      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
25882      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
25883      PORT_MODIFY("IN-2")
25884      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
25885      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
25886      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
25887      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
25888      PORT_MODIFY("IN-8")
25889      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("f lo")
25890      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
25891      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c lo")
25892      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
25893      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c hi")
25894      PORT_MODIFY("IN-9")
25895      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
25896      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("f hi")
25897      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("step")
25898      PORT_MODIFY("IN-16")
25899      // 0x0001 - "dil 1" // standard input (motherboard)
25900      // 0x0002 - "dil 2" // standard input (motherboard)
25901      // 0x0004 - "dil 3" // standard input (motherboard)
25902      // 0x0008 - "dil 4" // standard input (motherboard)
25903      // 0x0010 - "dil 5" // standard input (motherboard)
25904      // 0x0100 - "topup" // known extended input, usually 'top up'
25905      PORT_MODIFY("IN-17")
25906      // 0x0001 - "dil 6" // standard input (motherboard)
25907      // 0x0002 - "dil 7" // standard input (motherboard)
25908      // 0x0004 - "dil 8" // standard input (motherboard)
25909      // 0x0008 - "dil 9" // standard input (motherboard)
25910      // 0x0010 - "dil10" // standard input (motherboard)
25911      PORT_MODIFY("IN-18")
25912      // 0x0001 - "dil11" // standard input (motherboard)
25913      // 0x0002 - "dil12" // standard input (motherboard)
25914      // 0x0004 - "dil13" // standard input (motherboard)
25915      // 0x0008 - "dil14" // standard input (motherboard)
25916      // 0x0010 - "dil15" // standard input (motherboard)
25917      PORT_MODIFY("IN-19")
25918      // 0x0001 - "dil16" // standard input (motherboard)
25919      PORT_MODIFY("IN-20")
25920      // 0x0001 - "test" // standard input (motherboard)
25921      // 0x0002 - "dorlk" // standard input (expected here)
25922      // 0x0004 - "tpdor" // standard input (expected here)
25923      // 0x0008 - "cshbx" // standard input (expected here)
25924      // 0x0010 - "deflt" // standard input (expected here)
2592525925INPUT_PORTS_END
2592625926
2592725927// PR2162 GETTIN' ZIGGY         ZIGY SOUNDS         GETTIN' ZIGGY
r31373r31374
2595125951}
2595225952
2595325953INPUT_PORTS_START( sc4gldcl ) // this structure is generated
25954        PORT_INCLUDE( sc4_base )
25955        PORT_MODIFY("IN-1")
25956        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
25957        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
25958        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
25959        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
25960        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
25961        PORT_MODIFY("IN-2")
25962        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
25963        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
25964        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25965        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
25966        PORT_MODIFY("IN-3")
25967        // 0x0004 - "stk 4" // standard input (expected here)
25968        // 0x0008 - "stk 3" // standard input (expected here)
25969        // 0x0010 - "stk 2" // standard input (expected here)
25970        PORT_MODIFY("IN-4")
25971        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
25972        PORT_MODIFY("IN-5")
25973        // 0x0001 - "priz4" // standard input (expected here)
25974        // 0x0002 - "priz3" // standard input (expected here)
25975        // 0x0004 - "priz2" // standard input (expected here)
25976        // 0x0008 - "priz1" // standard input (expected here)
25977        PORT_MODIFY("IN-8")
25978        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk cas")
25979        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk spi")
25980        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk nud")
25981        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk cpo")
25982        PORT_MODIFY("IN-16")
25983        // 0x0001 - "dil 1" // standard input (motherboard)
25984        // 0x0002 - "dil 2" // standard input (motherboard)
25985        // 0x0004 - "dil 3" // standard input (motherboard)
25986        // 0x0008 - "dil 4" // standard input (motherboard)
25987        // 0x0010 - "dil 5" // standard input (motherboard)
25988        // 0x0100 - "top up" // known extended input, usually 'top up'
25989        PORT_MODIFY("IN-17")
25990        // 0x0001 - "dil 6" // standard input (motherboard)
25991        // 0x0002 - "dil 7" // standard input (motherboard)
25992        // 0x0004 - "dil 8" // standard input (motherboard)
25993        // 0x0008 - "dil 9" // standard input (motherboard)
25994        // 0x0010 - "dil10" // standard input (motherboard)
25995        PORT_MODIFY("IN-18")
25996        // 0x0001 - "dil11" // standard input (motherboard)
25997        // 0x0002 - "dil12" // standard input (motherboard)
25998        // 0x0004 - "dil13" // standard input (motherboard)
25999        // 0x0008 - "dil14" // standard input (motherboard)
26000        // 0x0010 - "dil15" // standard input (motherboard)
26001        PORT_MODIFY("IN-19")
26002        // 0x0001 - "dil16" // standard input (motherboard)
26003        PORT_MODIFY("IN-20")
26004        // 0x0001 - "grnbut" // standard input (motherboard)
26005        // 0x0002 - "dorlok" // standard input (expected here)
26006        // 0x0004 - "topdor" // standard input (expected here)
26007        // 0x0008 - "botdor" // standard input (expected here)
26008        // 0x0010 - "hopdmp" // standard input (expected here)
25954      PORT_INCLUDE( sc4_base )
25955      PORT_MODIFY("IN-1")
25956      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
25957      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
25958      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
25959      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
25960      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
25961      PORT_MODIFY("IN-2")
25962      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
25963      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
25964      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
25965      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
25966      PORT_MODIFY("IN-3")
25967      // 0x0004 - "stk 4" // standard input (expected here)
25968      // 0x0008 - "stk 3" // standard input (expected here)
25969      // 0x0010 - "stk 2" // standard input (expected here)
25970      PORT_MODIFY("IN-4")
25971      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
25972      PORT_MODIFY("IN-5")
25973      // 0x0001 - "priz4" // standard input (expected here)
25974      // 0x0002 - "priz3" // standard input (expected here)
25975      // 0x0004 - "priz2" // standard input (expected here)
25976      // 0x0008 - "priz1" // standard input (expected here)
25977      PORT_MODIFY("IN-8")
25978      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk cas")
25979      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk spi")
25980      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk nud")
25981      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk cpo")
25982      PORT_MODIFY("IN-16")
25983      // 0x0001 - "dil 1" // standard input (motherboard)
25984      // 0x0002 - "dil 2" // standard input (motherboard)
25985      // 0x0004 - "dil 3" // standard input (motherboard)
25986      // 0x0008 - "dil 4" // standard input (motherboard)
25987      // 0x0010 - "dil 5" // standard input (motherboard)
25988      // 0x0100 - "top up" // known extended input, usually 'top up'
25989      PORT_MODIFY("IN-17")
25990      // 0x0001 - "dil 6" // standard input (motherboard)
25991      // 0x0002 - "dil 7" // standard input (motherboard)
25992      // 0x0004 - "dil 8" // standard input (motherboard)
25993      // 0x0008 - "dil 9" // standard input (motherboard)
25994      // 0x0010 - "dil10" // standard input (motherboard)
25995      PORT_MODIFY("IN-18")
25996      // 0x0001 - "dil11" // standard input (motherboard)
25997      // 0x0002 - "dil12" // standard input (motherboard)
25998      // 0x0004 - "dil13" // standard input (motherboard)
25999      // 0x0008 - "dil14" // standard input (motherboard)
26000      // 0x0010 - "dil15" // standard input (motherboard)
26001      PORT_MODIFY("IN-19")
26002      // 0x0001 - "dil16" // standard input (motherboard)
26003      PORT_MODIFY("IN-20")
26004      // 0x0001 - "grnbut" // standard input (motherboard)
26005      // 0x0002 - "dorlok" // standard input (expected here)
26006      // 0x0004 - "topdor" // standard input (expected here)
26007      // 0x0008 - "botdor" // standard input (expected here)
26008      // 0x0010 - "hopdmp" // standard input (expected here)
2600926009INPUT_PORTS_END
2601026010
2601126011// PR2292 CLUB GLADIATOR         CLUB GLADIATOR  CLUB  CLUB GLAD SOUNDS         CLUB GLADIATOR
r31373r31374
2605026050}
2605126051
2605226052INPUT_PORTS_START( sc4ghost ) // this structure is generated
26053        PORT_INCLUDE( sc4_base )
26054        PORT_MODIFY("IN-1")
26055        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("hold 1")
26056        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 2")
26057        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 3")
26058        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("cancel")
26059        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("autply")
26060        PORT_MODIFY("IN-2")
26061        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
26062        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26063        PORT_MODIFY("IN-3")
26064        // 0x0004 - "stk 4" // standard input (expected here)
26065        // 0x0008 - "stk 3" // standard input (expected here)
26066        // 0x0010 - "stk 2" // standard input (expected here)
26067        PORT_MODIFY("IN-5")
26068        // 0x0001 - "priz4" // standard input (expected here)
26069        // 0x0002 - "priz3" // standard input (expected here)
26070        // 0x0004 - "priz2" // standard input (expected here)
26071        // 0x0008 - "priz1" // standard input (expected here)
26072        PORT_MODIFY("IN-6")
26073        // 0x0001 - "perc1" // standard input (expected here)
26074        // 0x0002 - "perc2" // standard input (expected here)
26075        // 0x0004 - "perc3" // standard input (expected here)
26076        // 0x0008 - "perc4" // standard input (expected here)
26077        PORT_MODIFY("IN-16")
26078        // 0x0001 - "dil 1" // standard input (motherboard)
26079        // 0x0002 - "dil 2" // standard input (motherboard)
26080        // 0x0004 - "dil 3" // standard input (motherboard)
26081        // 0x0008 - "dil 4" // standard input (motherboard)
26082        // 0x0010 - "dil 5" // standard input (motherboard)
26083        PORT_MODIFY("IN-17")
26084        // 0x0001 - "dil 6" // standard input (motherboard)
26085        // 0x0002 - "dil 7" // standard input (motherboard)
26086        // 0x0004 - "dil 8" // standard input (motherboard)
26087        // 0x0008 - "dil 9" // standard input (motherboard)
26088        // 0x0010 - "dil10" // standard input (motherboard)
26089        PORT_MODIFY("IN-18")
26090        // 0x0001 - "dil11" // standard input (motherboard)
26091        // 0x0002 - "dil12 OR doorlk" // standard input (motherboard)
26092        // 0x0004 - "dil13" // standard input (motherboard)
26093        // 0x0008 - "dil14" // standard input (motherboard)
26094        // 0x0010 - "dil15" // standard input (motherboard)
26095        PORT_MODIFY("IN-19")
26096        // 0x0001 - "dil16" // standard input (motherboard)
26097        PORT_MODIFY("IN-20")
26098        // 0x0001 - "grnbut" // standard input (motherboard)
26099        // 0x0004 - "cshdor" // standard input (expected here)
26100        // 0x0008 - "hopdmp" // standard input (expected here)
26101        // 0x0010 - "serdor" // standard input (expected here)
26053      PORT_INCLUDE( sc4_base )
26054      PORT_MODIFY("IN-1")
26055      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("hold 1")
26056      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 2")
26057      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 3")
26058      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("cancel")
26059      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("autply")
26060      PORT_MODIFY("IN-2")
26061      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
26062      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26063      PORT_MODIFY("IN-3")
26064      // 0x0004 - "stk 4" // standard input (expected here)
26065      // 0x0008 - "stk 3" // standard input (expected here)
26066      // 0x0010 - "stk 2" // standard input (expected here)
26067      PORT_MODIFY("IN-5")
26068      // 0x0001 - "priz4" // standard input (expected here)
26069      // 0x0002 - "priz3" // standard input (expected here)
26070      // 0x0004 - "priz2" // standard input (expected here)
26071      // 0x0008 - "priz1" // standard input (expected here)
26072      PORT_MODIFY("IN-6")
26073      // 0x0001 - "perc1" // standard input (expected here)
26074      // 0x0002 - "perc2" // standard input (expected here)
26075      // 0x0004 - "perc3" // standard input (expected here)
26076      // 0x0008 - "perc4" // standard input (expected here)
26077      PORT_MODIFY("IN-16")
26078      // 0x0001 - "dil 1" // standard input (motherboard)
26079      // 0x0002 - "dil 2" // standard input (motherboard)
26080      // 0x0004 - "dil 3" // standard input (motherboard)
26081      // 0x0008 - "dil 4" // standard input (motherboard)
26082      // 0x0010 - "dil 5" // standard input (motherboard)
26083      PORT_MODIFY("IN-17")
26084      // 0x0001 - "dil 6" // standard input (motherboard)
26085      // 0x0002 - "dil 7" // standard input (motherboard)
26086      // 0x0004 - "dil 8" // standard input (motherboard)
26087      // 0x0008 - "dil 9" // standard input (motherboard)
26088      // 0x0010 - "dil10" // standard input (motherboard)
26089      PORT_MODIFY("IN-18")
26090      // 0x0001 - "dil11" // standard input (motherboard)
26091      // 0x0002 - "dil12 OR doorlk" // standard input (motherboard)
26092      // 0x0004 - "dil13" // standard input (motherboard)
26093      // 0x0008 - "dil14" // standard input (motherboard)
26094      // 0x0010 - "dil15" // standard input (motherboard)
26095      PORT_MODIFY("IN-19")
26096      // 0x0001 - "dil16" // standard input (motherboard)
26097      PORT_MODIFY("IN-20")
26098      // 0x0001 - "grnbut" // standard input (motherboard)
26099      // 0x0004 - "cshdor" // standard input (expected here)
26100      // 0x0008 - "hopdmp" // standard input (expected here)
26101      // 0x0010 - "serdor" // standard input (expected here)
2610226102INPUT_PORTS_END
2610326103
2610426104// PR7090 GOLDEN GHOST         GOLDEN GHOST  MAZ GHOST SOUNDS         GOLDEN GHOST
r31373r31374
2613726137}
2613826138
2613926139INPUT_PORTS_START( sc4ggrid ) // this structure is generated
26140        PORT_INCLUDE( sc4_base )
26141        PORT_MODIFY("IN-1")
26142        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26143        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
26144        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
26145        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
26146        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
26147        PORT_MODIFY("IN-2")
26148        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
26149        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26150        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26151        PORT_MODIFY("IN-8")
26152        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("right")
26153        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("up")
26154        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
26155        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nudge")
26156        PORT_MODIFY("IN-16")
26157        // 0x0001 - "dil  1" // standard input (motherboard)
26158        // 0x0002 - "dil  2" // standard input (motherboard)
26159        // 0x0004 - "dil  3" // standard input (motherboard)
26160        // 0x0008 - "dil  4" // standard input (motherboard)
26161        // 0x0010 - "dil  5" // standard input (motherboard)
26162        // 0x0100 - "topup" // known extended input, usually 'top up'
26163        PORT_MODIFY("IN-17")
26164        // 0x0001 - "dil  6" // standard input (motherboard)
26165        // 0x0002 - "dil  7" // standard input (motherboard)
26166        // 0x0004 - "dil  8" // standard input (motherboard)
26167        // 0x0008 - "dil  9" // standard input (motherboard)
26168        // 0x0010 - "dil 10" // standard input (motherboard)
26169        PORT_MODIFY("IN-18")
26170        // 0x0001 - "dil 11" // standard input (motherboard)
26171        // 0x0002 - "dil 12" // standard input (motherboard)
26172        // 0x0004 - "dil 13" // standard input (motherboard)
26173        // 0x0008 - "dil 14" // standard input (motherboard)
26174        // 0x0010 - "dil 15" // standard input (motherboard)
26175        PORT_MODIFY("IN-19")
26176        // 0x0001 - "dil 16" // standard input (motherboard)
26177        PORT_MODIFY("IN-20")
26178        // 0x0001 - "test" // standard input (motherboard)
26179        // 0x0002 - "lock" // standard input (expected here)
26180        // 0x0004 - "topdor" // standard input (expected here)
26181        // 0x0008 - "botdor" // standard input (expected here)
26182        // 0x0010 - "hopdmp" // standard input (expected here)
26140      PORT_INCLUDE( sc4_base )
26141      PORT_MODIFY("IN-1")
26142      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26143      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
26144      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
26145      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
26146      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
26147      PORT_MODIFY("IN-2")
26148      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
26149      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26150      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26151      PORT_MODIFY("IN-8")
26152      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("right")
26153      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("up")
26154      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
26155      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nudge")
26156      PORT_MODIFY("IN-16")
26157      // 0x0001 - "dil  1" // standard input (motherboard)
26158      // 0x0002 - "dil  2" // standard input (motherboard)
26159      // 0x0004 - "dil  3" // standard input (motherboard)
26160      // 0x0008 - "dil  4" // standard input (motherboard)
26161      // 0x0010 - "dil  5" // standard input (motherboard)
26162      // 0x0100 - "topup" // known extended input, usually 'top up'
26163      PORT_MODIFY("IN-17")
26164      // 0x0001 - "dil  6" // standard input (motherboard)
26165      // 0x0002 - "dil  7" // standard input (motherboard)
26166      // 0x0004 - "dil  8" // standard input (motherboard)
26167      // 0x0008 - "dil  9" // standard input (motherboard)
26168      // 0x0010 - "dil 10" // standard input (motherboard)
26169      PORT_MODIFY("IN-18")
26170      // 0x0001 - "dil 11" // standard input (motherboard)
26171      // 0x0002 - "dil 12" // standard input (motherboard)
26172      // 0x0004 - "dil 13" // standard input (motherboard)
26173      // 0x0008 - "dil 14" // standard input (motherboard)
26174      // 0x0010 - "dil 15" // standard input (motherboard)
26175      PORT_MODIFY("IN-19")
26176      // 0x0001 - "dil 16" // standard input (motherboard)
26177      PORT_MODIFY("IN-20")
26178      // 0x0001 - "test" // standard input (motherboard)
26179      // 0x0002 - "lock" // standard input (expected here)
26180      // 0x0004 - "topdor" // standard input (expected here)
26181      // 0x0008 - "botdor" // standard input (expected here)
26182      // 0x0010 - "hopdmp" // standard input (expected here)
2618326183INPUT_PORTS_END
2618426184
2618526185// PR2518 GOLDEN GRID V1.0         GOLDENGRIDSND           GOLDEN  GRID
r31373r31374
2622726227}
2622826228
2622926229INPUT_PORTS_START( sc4ggcl ) // this structure is generated
26230        PORT_INCLUDE( sc4_base )
26231        PORT_MODIFY("IN-1")
26232        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26233        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
26234        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
26235        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
26236        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
26237        PORT_MODIFY("IN-2")
26238        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
26239        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26240        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26241        PORT_MODIFY("IN-8")
26242        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudge")
26243        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("qps")
26244        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("right")
26245        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("up")
26246        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("cash")
26247        PORT_MODIFY("IN-16")
26248        // 0x0001 - "dil  1" // standard input (motherboard)
26249        // 0x0002 - "dil  2" // standard input (motherboard)
26250        // 0x0004 - "dil  3" // standard input (motherboard)
26251        // 0x0008 - "dil  4" // standard input (motherboard)
26252        // 0x0010 - "dil  5" // standard input (motherboard)
26253        // 0x0100 - "topup" // known extended input, usually 'top up'
26254        PORT_MODIFY("IN-17")
26255        // 0x0001 - "dil  6" // standard input (motherboard)
26256        // 0x0002 - "dil  7" // standard input (motherboard)
26257        // 0x0004 - "dil  8" // standard input (motherboard)
26258        // 0x0008 - "dil  9" // standard input (motherboard)
26259        // 0x0010 - "dil 10" // standard input (motherboard)
26260        PORT_MODIFY("IN-18")
26261        // 0x0001 - "dil 11" // standard input (motherboard)
26262        // 0x0002 - "dil 12" // standard input (motherboard)
26263        // 0x0004 - "dil 13" // standard input (motherboard)
26264        // 0x0008 - "dil 14" // standard input (motherboard)
26265        // 0x0010 - "dil 15" // standard input (motherboard)
26266        PORT_MODIFY("IN-19")
26267        // 0x0001 - "dil 16" // standard input (motherboard)
26268        PORT_MODIFY("IN-20")
26269        // 0x0001 - "test" // standard input (motherboard)
26270        // 0x0002 - "lock" // standard input (expected here)
26271        // 0x0004 - "topdor" // standard input (expected here)
26272        // 0x0008 - "botdor" // standard input (expected here)
26273        // 0x0010 - "hopdmp" // standard input (expected here)
26230      PORT_INCLUDE( sc4_base )
26231      PORT_MODIFY("IN-1")
26232      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26233      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
26234      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
26235      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
26236      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
26237      PORT_MODIFY("IN-2")
26238      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
26239      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26240      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26241      PORT_MODIFY("IN-8")
26242      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudge")
26243      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("qps")
26244      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("right")
26245      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("up")
26246      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("cash")
26247      PORT_MODIFY("IN-16")
26248      // 0x0001 - "dil  1" // standard input (motherboard)
26249      // 0x0002 - "dil  2" // standard input (motherboard)
26250      // 0x0004 - "dil  3" // standard input (motherboard)
26251      // 0x0008 - "dil  4" // standard input (motherboard)
26252      // 0x0010 - "dil  5" // standard input (motherboard)
26253      // 0x0100 - "topup" // known extended input, usually 'top up'
26254      PORT_MODIFY("IN-17")
26255      // 0x0001 - "dil  6" // standard input (motherboard)
26256      // 0x0002 - "dil  7" // standard input (motherboard)
26257      // 0x0004 - "dil  8" // standard input (motherboard)
26258      // 0x0008 - "dil  9" // standard input (motherboard)
26259      // 0x0010 - "dil 10" // standard input (motherboard)
26260      PORT_MODIFY("IN-18")
26261      // 0x0001 - "dil 11" // standard input (motherboard)
26262      // 0x0002 - "dil 12" // standard input (motherboard)
26263      // 0x0004 - "dil 13" // standard input (motherboard)
26264      // 0x0008 - "dil 14" // standard input (motherboard)
26265      // 0x0010 - "dil 15" // standard input (motherboard)
26266      PORT_MODIFY("IN-19")
26267      // 0x0001 - "dil 16" // standard input (motherboard)
26268      PORT_MODIFY("IN-20")
26269      // 0x0001 - "test" // standard input (motherboard)
26270      // 0x0002 - "lock" // standard input (expected here)
26271      // 0x0004 - "topdor" // standard input (expected here)
26272      // 0x0008 - "botdor" // standard input (expected here)
26273      // 0x0010 - "hopdmp" // standard input (expected here)
2627426274INPUT_PORTS_END
2627526275
2627626276// PR????  CLUB GOLDEN GRID V1.0         CLUBGOLDENGRIDSND         CLUB GOLDEN GRID
r31373r31374
2630126301}
2630226302
2630326303INPUT_PORTS_START( sc4goldw ) // this structure is generated
26304        PORT_INCLUDE( sc4_base )
26305        PORT_MODIFY("IN-1")
26306        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26307        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
26308        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
26309        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
26310        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("bell")
26311        // 0x0100 - "pndlow" // known extended input, usually 'hopper fit'
26312        PORT_MODIFY("IN-2")
26313        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26314        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26315        // 0x0100 - "10plow" // unexpected here
26316        PORT_MODIFY("IN-3")
26317        // 0x0004 - "stk 4" // standard input (expected here)
26318        // 0x0008 - "stk 3" // standard input (expected here)
26319        // 0x0010 - "stk 2" // standard input (expected here)
26320        PORT_MODIFY("IN-5")
26321        // 0x0001 - "priz4" // standard input (expected here)
26322        // 0x0002 - "priz3" // standard input (expected here)
26323        // 0x0004 - "priz2" // standard input (expected here)
26324        // 0x0008 - "priz1" // standard input (expected here)
26325        PORT_MODIFY("IN-6")
26326        // 0x0001 - "perc1" // standard input (expected here)
26327        // 0x0002 - "perc2" // standard input (expected here)
26328        // 0x0004 - "perc3" // standard input (expected here)
26329        // 0x0008 - "perc4" // standard input (expected here)
26330        PORT_MODIFY("IN-16")
26331        // 0x0001 - "dil 1" // standard input (motherboard)
26332        // 0x0002 - "dil 2" // standard input (motherboard)
26333        // 0x0004 - "dil 3" // standard input (motherboard)
26334        // 0x0008 - "dil 4" // standard input (motherboard)
26335        // 0x0010 - "dil 5" // standard input (motherboard)
26336        // 0x0100 - "htopup" // known extended input, usually 'top up'
26337        PORT_MODIFY("IN-17")
26338        // 0x0001 - "dil 6" // standard input (motherboard)
26339        // 0x0002 - "dil 7" // standard input (motherboard)
26340        // 0x0004 - "dil 8" // standard input (motherboard)
26341        // 0x0008 - "dil 9" // standard input (motherboard)
26342        // 0x0010 - "dil 10" // standard input (motherboard)
26343        PORT_MODIFY("IN-18")
26344        // 0x0001 - "dil 11" // standard input (motherboard)
26345        // 0x0002 - "dil 12" // standard input (motherboard)
26346        // 0x0004 - "dil 13" // standard input (motherboard)
26347        // 0x0008 - "dil 14" // standard input (motherboard)
26348        // 0x0010 - "dil 15" // standard input (motherboard)
26349        PORT_MODIFY("IN-19")
26350        // 0x0001 - "dil 16" // standard input (motherboard)
26351        PORT_MODIFY("IN-20")
26352        // 0x0001 - "grnbut" // standard input (motherboard)
26353        // 0x0002 - "dorlok" // standard input (expected here)
26354        // 0x0004 - "serdor" // standard input (expected here)
26355        // 0x0008 - "cshdor" // standard input (expected here)
26356        // 0x0010 - "hopdmp" // standard input (expected here)
26304      PORT_INCLUDE( sc4_base )
26305      PORT_MODIFY("IN-1")
26306      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26307      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
26308      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
26309      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
26310      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("bell")
26311      // 0x0100 - "pndlow" // known extended input, usually 'hopper fit'
26312      PORT_MODIFY("IN-2")
26313      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26314      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26315      // 0x0100 - "10plow" // unexpected here
26316      PORT_MODIFY("IN-3")
26317      // 0x0004 - "stk 4" // standard input (expected here)
26318      // 0x0008 - "stk 3" // standard input (expected here)
26319      // 0x0010 - "stk 2" // standard input (expected here)
26320      PORT_MODIFY("IN-5")
26321      // 0x0001 - "priz4" // standard input (expected here)
26322      // 0x0002 - "priz3" // standard input (expected here)
26323      // 0x0004 - "priz2" // standard input (expected here)
26324      // 0x0008 - "priz1" // standard input (expected here)
26325      PORT_MODIFY("IN-6")
26326      // 0x0001 - "perc1" // standard input (expected here)
26327      // 0x0002 - "perc2" // standard input (expected here)
26328      // 0x0004 - "perc3" // standard input (expected here)
26329      // 0x0008 - "perc4" // standard input (expected here)
26330      PORT_MODIFY("IN-16")
26331      // 0x0001 - "dil 1" // standard input (motherboard)
26332      // 0x0002 - "dil 2" // standard input (motherboard)
26333      // 0x0004 - "dil 3" // standard input (motherboard)
26334      // 0x0008 - "dil 4" // standard input (motherboard)
26335      // 0x0010 - "dil 5" // standard input (motherboard)
26336      // 0x0100 - "htopup" // known extended input, usually 'top up'
26337      PORT_MODIFY("IN-17")
26338      // 0x0001 - "dil 6" // standard input (motherboard)
26339      // 0x0002 - "dil 7" // standard input (motherboard)
26340      // 0x0004 - "dil 8" // standard input (motherboard)
26341      // 0x0008 - "dil 9" // standard input (motherboard)
26342      // 0x0010 - "dil 10" // standard input (motherboard)
26343      PORT_MODIFY("IN-18")
26344      // 0x0001 - "dil 11" // standard input (motherboard)
26345      // 0x0002 - "dil 12" // standard input (motherboard)
26346      // 0x0004 - "dil 13" // standard input (motherboard)
26347      // 0x0008 - "dil 14" // standard input (motherboard)
26348      // 0x0010 - "dil 15" // standard input (motherboard)
26349      PORT_MODIFY("IN-19")
26350      // 0x0001 - "dil 16" // standard input (motherboard)
26351      PORT_MODIFY("IN-20")
26352      // 0x0001 - "grnbut" // standard input (motherboard)
26353      // 0x0002 - "dorlok" // standard input (expected here)
26354      // 0x0004 - "serdor" // standard input (expected here)
26355      // 0x0008 - "cshdor" // standard input (expected here)
26356      // 0x0010 - "hopdmp" // standard input (expected here)
2635726357INPUT_PORTS_END
2635826358
2635926359INPUT_PORTS_START( sc4goldwd ) // this structure is generated
26360        PORT_INCLUDE( sc4_base )
26361        PORT_MODIFY("IN-1")
26362        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26363        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
26364        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
26365        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
26366        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("bell")
26367        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("pndlow OR 10plow")
26368        PORT_MODIFY("IN-2")
26369        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
26370        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
26371        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26372        PORT_MODIFY("IN-3")
26373        // 0x0004 - "stk 4" // standard input (expected here)
26374        // 0x0008 - "stk 3" // standard input (expected here)
26375        // 0x0010 - "stk 2" // standard input (expected here)
26376        PORT_MODIFY("IN-4")
26377        // 0x0008 - "htopup" // known extended(?) input, sometimes 'hop top'
26378        PORT_MODIFY("IN-5")
26379        // 0x0001 - "priz4" // standard input (expected here)
26380        // 0x0002 - "priz3" // standard input (expected here)
26381        // 0x0004 - "priz2" // standard input (expected here)
26382        // 0x0008 - "priz1" // standard input (expected here)
26383        PORT_MODIFY("IN-6")
26384        // 0x0001 - "perc1" // standard input (expected here)
26385        // 0x0002 - "perc2" // standard input (expected here)
26386        // 0x0004 - "perc3" // standard input (expected here)
26387        // 0x0008 - "perc4" // standard input (expected here)
26388        PORT_MODIFY("IN-16")
26389        // 0x0001 - "dil 1" // standard input (motherboard)
26390        // 0x0002 - "dil 2" // standard input (motherboard)
26391        // 0x0004 - "dil 3" // standard input (motherboard)
26392        // 0x0008 - "dil 4" // standard input (motherboard)
26393        // 0x0010 - "dil 5" // standard input (motherboard)
26394        PORT_MODIFY("IN-17")
26395        // 0x0001 - "dil 6" // standard input (motherboard)
26396        // 0x0002 - "dil 7" // standard input (motherboard)
26397        // 0x0004 - "dil 8" // standard input (motherboard)
26398        // 0x0008 - "dil 9" // standard input (motherboard)
26399        // 0x0010 - "dil 10" // standard input (motherboard)
26400        PORT_MODIFY("IN-18")
26401        // 0x0001 - "dil 11" // standard input (motherboard)
26402        // 0x0002 - "dil 12" // standard input (motherboard)
26403        // 0x0004 - "dil 13" // standard input (motherboard)
26404        // 0x0008 - "dil 14" // standard input (motherboard)
26405        // 0x0010 - "dil 15" // standard input (motherboard)
26406        PORT_MODIFY("IN-19")
26407        // 0x0001 - "dil 16" // standard input (motherboard)
26408        PORT_MODIFY("IN-20")
26409        // 0x0001 - "grnbut" // standard input (motherboard)
26410        // 0x0002 - "cshdor" // standard input (expected here)
26411        // 0x0004 - "serdor" // standard input (expected here)
26412        // 0x0008 - "hopdmp" // standard input (expected here)
26360      PORT_INCLUDE( sc4_base )
26361      PORT_MODIFY("IN-1")
26362      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26363      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
26364      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
26365      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
26366      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("bell")
26367      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("pndlow OR 10plow")
26368      PORT_MODIFY("IN-2")
26369      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
26370      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
26371      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26372      PORT_MODIFY("IN-3")
26373      // 0x0004 - "stk 4" // standard input (expected here)
26374      // 0x0008 - "stk 3" // standard input (expected here)
26375      // 0x0010 - "stk 2" // standard input (expected here)
26376      PORT_MODIFY("IN-4")
26377      // 0x0008 - "htopup" // known extended(?) input, sometimes 'hop top'
26378      PORT_MODIFY("IN-5")
26379      // 0x0001 - "priz4" // standard input (expected here)
26380      // 0x0002 - "priz3" // standard input (expected here)
26381      // 0x0004 - "priz2" // standard input (expected here)
26382      // 0x0008 - "priz1" // standard input (expected here)
26383      PORT_MODIFY("IN-6")
26384      // 0x0001 - "perc1" // standard input (expected here)
26385      // 0x0002 - "perc2" // standard input (expected here)
26386      // 0x0004 - "perc3" // standard input (expected here)
26387      // 0x0008 - "perc4" // standard input (expected here)
26388      PORT_MODIFY("IN-16")
26389      // 0x0001 - "dil 1" // standard input (motherboard)
26390      // 0x0002 - "dil 2" // standard input (motherboard)
26391      // 0x0004 - "dil 3" // standard input (motherboard)
26392      // 0x0008 - "dil 4" // standard input (motherboard)
26393      // 0x0010 - "dil 5" // standard input (motherboard)
26394      PORT_MODIFY("IN-17")
26395      // 0x0001 - "dil 6" // standard input (motherboard)
26396      // 0x0002 - "dil 7" // standard input (motherboard)
26397      // 0x0004 - "dil 8" // standard input (motherboard)
26398      // 0x0008 - "dil 9" // standard input (motherboard)
26399      // 0x0010 - "dil 10" // standard input (motherboard)
26400      PORT_MODIFY("IN-18")
26401      // 0x0001 - "dil 11" // standard input (motherboard)
26402      // 0x0002 - "dil 12" // standard input (motherboard)
26403      // 0x0004 - "dil 13" // standard input (motherboard)
26404      // 0x0008 - "dil 14" // standard input (motherboard)
26405      // 0x0010 - "dil 15" // standard input (motherboard)
26406      PORT_MODIFY("IN-19")
26407      // 0x0001 - "dil 16" // standard input (motherboard)
26408      PORT_MODIFY("IN-20")
26409      // 0x0001 - "grnbut" // standard input (motherboard)
26410      // 0x0002 - "cshdor" // standard input (expected here)
26411      // 0x0004 - "serdor" // standard input (expected here)
26412      // 0x0008 - "hopdmp" // standard input (expected here)
2641326413INPUT_PORTS_END
2641426414
2641526415
r31373r31374
2642626426GAMEL( 200?, sc4goldwg   ,sc4goldw,  sc4, sc4goldwd, sc4_state, sc4, ROT0, "BFM","Golden Winner (Bellfruit) (Scorpion 4) (set 8)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
2642726427
2642826428INPUT_PORTS_START( sc4ggdlx ) // this structure is generated
26429        PORT_INCLUDE( sc4_base )
26430        PORT_MODIFY("IN-1")
26431        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
26432        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
26433        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
26434        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
26435        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
26436        PORT_MODIFY("IN-2")
26437        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto")
26438        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26439        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26440        PORT_MODIFY("IN-16")
26441        // 0x0001 - "dil sw" // standard input (motherboard)
26442        // 0x0002 - "dil sw" // standard input (motherboard)
26443        // 0x0004 - "dil sw" // standard input (motherboard)
26444        // 0x0008 - "dil sw" // standard input (motherboard)
26445        // 0x0010 - "dil sw" // standard input (motherboard)
26446        // 0x0100 - "topup" // known extended input, usually 'top up'
26447        PORT_MODIFY("IN-17")
26448        // 0x0001 - "dil sw" // standard input (motherboard)
26449        // 0x0002 - "dil sw" // standard input (motherboard)
26450        // 0x0004 - "dil sw" // standard input (motherboard)
26451        // 0x0008 - "dil sw" // standard input (motherboard)
26452        // 0x0010 - "dil sw" // standard input (motherboard)
26453        PORT_MODIFY("IN-18")
26454        // 0x0001 - "dil sw" // standard input (motherboard)
26455        // 0x0002 - "dil sw" // standard input (motherboard)
26456        // 0x0004 - "dil sw" // standard input (motherboard)
26457        // 0x0008 - "dil sw" // standard input (motherboard)
26458        // 0x0010 - "dil sw" // standard input (motherboard)
26459        PORT_MODIFY("IN-19")
26460        // 0x0001 - "dil sw" // standard input (motherboard)
26461        PORT_MODIFY("IN-20")
26462        // 0x0001 - "green OR test" // standard input (motherboard)
26463        // 0x0002 - "dorlk" // standard input (expected here)
26464        // 0x0004 - "tpdor" // standard input (expected here)
26465        // 0x0008 - "cshbx" // standard input (expected here)
26466        // 0x0010 - "deflt" // standard input (expected here)
26429      PORT_INCLUDE( sc4_base )
26430      PORT_MODIFY("IN-1")
26431      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
26432      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
26433      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
26434      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
26435      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
26436      PORT_MODIFY("IN-2")
26437      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto")
26438      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26439      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26440      PORT_MODIFY("IN-16")
26441      // 0x0001 - "dil sw" // standard input (motherboard)
26442      // 0x0002 - "dil sw" // standard input (motherboard)
26443      // 0x0004 - "dil sw" // standard input (motherboard)
26444      // 0x0008 - "dil sw" // standard input (motherboard)
26445      // 0x0010 - "dil sw" // standard input (motherboard)
26446      // 0x0100 - "topup" // known extended input, usually 'top up'
26447      PORT_MODIFY("IN-17")
26448      // 0x0001 - "dil sw" // standard input (motherboard)
26449      // 0x0002 - "dil sw" // standard input (motherboard)
26450      // 0x0004 - "dil sw" // standard input (motherboard)
26451      // 0x0008 - "dil sw" // standard input (motherboard)
26452      // 0x0010 - "dil sw" // standard input (motherboard)
26453      PORT_MODIFY("IN-18")
26454      // 0x0001 - "dil sw" // standard input (motherboard)
26455      // 0x0002 - "dil sw" // standard input (motherboard)
26456      // 0x0004 - "dil sw" // standard input (motherboard)
26457      // 0x0008 - "dil sw" // standard input (motherboard)
26458      // 0x0010 - "dil sw" // standard input (motherboard)
26459      PORT_MODIFY("IN-19")
26460      // 0x0001 - "dil sw" // standard input (motherboard)
26461      PORT_MODIFY("IN-20")
26462      // 0x0001 - "green OR test" // standard input (motherboard)
26463      // 0x0002 - "dorlk" // standard input (expected here)
26464      // 0x0004 - "tpdor" // standard input (expected here)
26465      // 0x0008 - "cshbx" // standard input (expected here)
26466      // 0x0010 - "deflt" // standard input (expected here)
2646726467INPUT_PORTS_END
2646826468
2646926469
r31373r31374
2650126501}
2650226502
2650326503INPUT_PORTS_START( sc4greed ) // this structure is generated
26504        PORT_INCLUDE( sc4_base )
26505        PORT_MODIFY("IN-1")
26506        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26507        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
26508        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
26509        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
26510        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
26511        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
26512        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
26513        PORT_MODIFY("IN-2")
26514        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
26515        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26516        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26517        PORT_MODIFY("IN-3")
26518        // 0x0004 - "stk 4" // standard input (expected here)
26519        // 0x0008 - "stk 3" // standard input (expected here)
26520        // 0x0010 - "stk 2" // standard input (expected here)
26521        PORT_MODIFY("IN-5")
26522        // 0x0001 - "priz4" // standard input (expected here)
26523        // 0x0002 - "priz3" // standard input (expected here)
26524        // 0x0004 - "priz2" // standard input (expected here)
26525        // 0x0008 - "priz1" // standard input (expected here)
26526        PORT_MODIFY("IN-6")
26527        // 0x0001 - "perc1" // standard input (expected here)
26528        // 0x0002 - "perc2" // standard input (expected here)
26529        // 0x0004 - "perc3" // standard input (expected here)
26530        // 0x0008 - "perc4" // standard input (expected here)
26531        PORT_MODIFY("IN-8")
26532        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk not")
26533        PORT_MODIFY("IN-16")
26534        // 0x0001 - "dil 1" // standard input (motherboard)
26535        // 0x0002 - "dil 2" // standard input (motherboard)
26536        // 0x0004 - "dil 3" // standard input (motherboard)
26537        // 0x0008 - "dil 4" // standard input (motherboard)
26538        // 0x0010 - "dil 5" // standard input (motherboard)
26539        // 0x0100 - "top up" // known extended input, usually 'top up'
26540        PORT_MODIFY("IN-17")
26541        // 0x0001 - "dil 6" // standard input (motherboard)
26542        // 0x0002 - "dil 7" // standard input (motherboard)
26543        // 0x0004 - "dil 8" // standard input (motherboard)
26544        // 0x0008 - "dil 9" // standard input (motherboard)
26545        // 0x0010 - "dil 10" // standard input (motherboard)
26546        PORT_MODIFY("IN-18")
26547        // 0x0001 - "dil 11" // standard input (motherboard)
26548        // 0x0002 - "dil 12" // standard input (motherboard)
26549        // 0x0004 - "dil 13" // standard input (motherboard)
26550        // 0x0008 - "dil 14" // standard input (motherboard)
26551        // 0x0010 - "dil 15" // standard input (motherboard)
26552        PORT_MODIFY("IN-19")
26553        // 0x0001 - "dil 16" // standard input (motherboard)
26554        PORT_MODIFY("IN-20")
26555        // 0x0001 - "grnbut" // standard input (motherboard)
26556        // 0x0002 - "dorlok" // standard input (expected here)
26557        // 0x0004 - "serdor" // standard input (expected here)
26558        // 0x0008 - "cshdor" // standard input (expected here)
26559        // 0x0010 - "hopdmp" // standard input (expected here)
26504      PORT_INCLUDE( sc4_base )
26505      PORT_MODIFY("IN-1")
26506      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26507      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
26508      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
26509      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
26510      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
26511      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
26512      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
26513      PORT_MODIFY("IN-2")
26514      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
26515      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26516      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26517      PORT_MODIFY("IN-3")
26518      // 0x0004 - "stk 4" // standard input (expected here)
26519      // 0x0008 - "stk 3" // standard input (expected here)
26520      // 0x0010 - "stk 2" // standard input (expected here)
26521      PORT_MODIFY("IN-5")
26522      // 0x0001 - "priz4" // standard input (expected here)
26523      // 0x0002 - "priz3" // standard input (expected here)
26524      // 0x0004 - "priz2" // standard input (expected here)
26525      // 0x0008 - "priz1" // standard input (expected here)
26526      PORT_MODIFY("IN-6")
26527      // 0x0001 - "perc1" // standard input (expected here)
26528      // 0x0002 - "perc2" // standard input (expected here)
26529      // 0x0004 - "perc3" // standard input (expected here)
26530      // 0x0008 - "perc4" // standard input (expected here)
26531      PORT_MODIFY("IN-8")
26532      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk not")
26533      PORT_MODIFY("IN-16")
26534      // 0x0001 - "dil 1" // standard input (motherboard)
26535      // 0x0002 - "dil 2" // standard input (motherboard)
26536      // 0x0004 - "dil 3" // standard input (motherboard)
26537      // 0x0008 - "dil 4" // standard input (motherboard)
26538      // 0x0010 - "dil 5" // standard input (motherboard)
26539      // 0x0100 - "top up" // known extended input, usually 'top up'
26540      PORT_MODIFY("IN-17")
26541      // 0x0001 - "dil 6" // standard input (motherboard)
26542      // 0x0002 - "dil 7" // standard input (motherboard)
26543      // 0x0004 - "dil 8" // standard input (motherboard)
26544      // 0x0008 - "dil 9" // standard input (motherboard)
26545      // 0x0010 - "dil 10" // standard input (motherboard)
26546      PORT_MODIFY("IN-18")
26547      // 0x0001 - "dil 11" // standard input (motherboard)
26548      // 0x0002 - "dil 12" // standard input (motherboard)
26549      // 0x0004 - "dil 13" // standard input (motherboard)
26550      // 0x0008 - "dil 14" // standard input (motherboard)
26551      // 0x0010 - "dil 15" // standard input (motherboard)
26552      PORT_MODIFY("IN-19")
26553      // 0x0001 - "dil 16" // standard input (motherboard)
26554      PORT_MODIFY("IN-20")
26555      // 0x0001 - "grnbut" // standard input (motherboard)
26556      // 0x0002 - "dorlok" // standard input (expected here)
26557      // 0x0004 - "serdor" // standard input (expected here)
26558      // 0x0008 - "cshdor" // standard input (expected here)
26559      // 0x0010 - "hopdmp" // standard input (expected here)
2656026560INPUT_PORTS_END
2656126561
2656226562// PR1401 AWP GREEDY GONZALEZ         PR1401 GREEDY GONZ SOUNDS11
r31373r31374
2658026580}
2658126581
2658226582INPUT_PORTS_START( sc4hf ) // this structure is generated
26583        PORT_INCLUDE( sc4_base )
26584        PORT_MODIFY("IN-1")
26585        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26586        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
26587        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
26588        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
26589        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
26590        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
26591        PORT_MODIFY("IN-2")
26592        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
26593        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26594        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26595        PORT_MODIFY("IN-3")
26596        // 0x0004 - "stk 4" // standard input (expected here)
26597        // 0x0008 - "stk 3" // standard input (expected here)
26598        // 0x0010 - "stk 2" // standard input (expected here)
26599        PORT_MODIFY("IN-5")
26600        // 0x0001 - "priz4" // standard input (expected here)
26601        // 0x0002 - "priz3" // standard input (expected here)
26602        // 0x0004 - "priz2" // standard input (expected here)
26603        // 0x0008 - "priz1" // standard input (expected here)
26604        PORT_MODIFY("IN-6")
26605        // 0x0001 - "perc1" // standard input (expected here)
26606        // 0x0002 - "perc2" // standard input (expected here)
26607        // 0x0004 - "perc3" // standard input (expected here)
26608        // 0x0008 - "perc4" // standard input (expected here)
26609        PORT_MODIFY("IN-16")
26610        // 0x0001 - "dil 1" // standard input (motherboard)
26611        // 0x0002 - "dil 2" // standard input (motherboard)
26612        // 0x0004 - "dil 3" // standard input (motherboard)
26613        // 0x0008 - "dil 4" // standard input (motherboard)
26614        // 0x0010 - "dil 5" // standard input (motherboard)
26615        // 0x0100 - "top up" // known extended input, usually 'top up'
26616        PORT_MODIFY("IN-17")
26617        // 0x0001 - "dil 6" // standard input (motherboard)
26618        // 0x0002 - "dil 7" // standard input (motherboard)
26619        // 0x0004 - "dil 8" // standard input (motherboard)
26620        // 0x0008 - "dil 9" // standard input (motherboard)
26621        // 0x0010 - "dil10" // standard input (motherboard)
26622        PORT_MODIFY("IN-18")
26623        // 0x0001 - "dil11" // standard input (motherboard)
26624        // 0x0002 - "dil12" // standard input (motherboard)
26625        // 0x0004 - "dil13" // standard input (motherboard)
26626        // 0x0008 - "dil14" // standard input (motherboard)
26627        // 0x0010 - "dil15" // standard input (motherboard)
26628        PORT_MODIFY("IN-19")
26629        // 0x0001 - "dil16" // standard input (motherboard)
26630        PORT_MODIFY("IN-20")
26631        // 0x0001 - "grnbut" // standard input (motherboard)
26632        // 0x0002 - "dorlok" // standard input (expected here)
26633        // 0x0004 - "topdor" // standard input (expected here)
26634        // 0x0008 - "botdor" // standard input (expected here)
26635        // 0x0010 - "hopdmp" // standard input (expected here)
26583      PORT_INCLUDE( sc4_base )
26584      PORT_MODIFY("IN-1")
26585      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26586      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
26587      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
26588      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
26589      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
26590      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
26591      PORT_MODIFY("IN-2")
26592      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
26593      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26594      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26595      PORT_MODIFY("IN-3")
26596      // 0x0004 - "stk 4" // standard input (expected here)
26597      // 0x0008 - "stk 3" // standard input (expected here)
26598      // 0x0010 - "stk 2" // standard input (expected here)
26599      PORT_MODIFY("IN-5")
26600      // 0x0001 - "priz4" // standard input (expected here)
26601      // 0x0002 - "priz3" // standard input (expected here)
26602      // 0x0004 - "priz2" // standard input (expected here)
26603      // 0x0008 - "priz1" // standard input (expected here)
26604      PORT_MODIFY("IN-6")
26605      // 0x0001 - "perc1" // standard input (expected here)
26606      // 0x0002 - "perc2" // standard input (expected here)
26607      // 0x0004 - "perc3" // standard input (expected here)
26608      // 0x0008 - "perc4" // standard input (expected here)
26609      PORT_MODIFY("IN-16")
26610      // 0x0001 - "dil 1" // standard input (motherboard)
26611      // 0x0002 - "dil 2" // standard input (motherboard)
26612      // 0x0004 - "dil 3" // standard input (motherboard)
26613      // 0x0008 - "dil 4" // standard input (motherboard)
26614      // 0x0010 - "dil 5" // standard input (motherboard)
26615      // 0x0100 - "top up" // known extended input, usually 'top up'
26616      PORT_MODIFY("IN-17")
26617      // 0x0001 - "dil 6" // standard input (motherboard)
26618      // 0x0002 - "dil 7" // standard input (motherboard)
26619      // 0x0004 - "dil 8" // standard input (motherboard)
26620      // 0x0008 - "dil 9" // standard input (motherboard)
26621      // 0x0010 - "dil10" // standard input (motherboard)
26622      PORT_MODIFY("IN-18")
26623      // 0x0001 - "dil11" // standard input (motherboard)
26624      // 0x0002 - "dil12" // standard input (motherboard)
26625      // 0x0004 - "dil13" // standard input (motherboard)
26626      // 0x0008 - "dil14" // standard input (motherboard)
26627      // 0x0010 - "dil15" // standard input (motherboard)
26628      PORT_MODIFY("IN-19")
26629      // 0x0001 - "dil16" // standard input (motherboard)
26630      PORT_MODIFY("IN-20")
26631      // 0x0001 - "grnbut" // standard input (motherboard)
26632      // 0x0002 - "dorlok" // standard input (expected here)
26633      // 0x0004 - "topdor" // standard input (expected here)
26634      // 0x0008 - "botdor" // standard input (expected here)
26635      // 0x0010 - "hopdmp" // standard input (expected here)
2663626636INPUT_PORTS_END
2663726637
2663826638//PR1011 HAPPY FRUITS         PR1011 HAPPY FRUITS SOUNDS11
r31373r31374
2666326663}
2666426664
2666526665INPUT_PORTS_START( sc4himi ) // this structure is generated
26666        PORT_INCLUDE( sc4_base )
26667        PORT_MODIFY("IN-1")
26668        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26669        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
26670        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
26671        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
26672        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
26673        PORT_MODIFY("IN-2")
26674        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
26675        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26676        PORT_MODIFY("IN-8")
26677        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
26678        PORT_MODIFY("IN-16")
26679        // 0x0001 - "dil  1" // standard input (motherboard)
26680        // 0x0002 - "dil  2" // standard input (motherboard)
26681        // 0x0004 - "dil  3" // standard input (motherboard)
26682        // 0x0008 - "dil  4" // standard input (motherboard)
26683        // 0x0010 - "dil  5" // standard input (motherboard)
26684        // 0x0100 - "top up" // known extended input, usually 'top up'
26685        PORT_MODIFY("IN-17")
26686        // 0x0001 - "dil  6" // standard input (motherboard)
26687        // 0x0002 - "dil  7" // standard input (motherboard)
26688        // 0x0004 - "dil  8" // standard input (motherboard)
26689        // 0x0008 - "dil  9" // standard input (motherboard)
26690        // 0x0010 - "dil 10" // standard input (motherboard)
26691        PORT_MODIFY("IN-18")
26692        // 0x0001 - "dil 11" // standard input (motherboard)
26693        // 0x0002 - "dil 12" // standard input (motherboard)
26694        // 0x0004 - "dil 13" // standard input (motherboard)
26695        // 0x0008 - "dil 14" // standard input (motherboard)
26696        // 0x0010 - "dil 15" // standard input (motherboard)
26697        PORT_MODIFY("IN-19")
26698        // 0x0001 - "dil 16" // standard input (motherboard)
26699        PORT_MODIFY("IN-20")
26700        // 0x0001 - "testsw" // standard input (motherboard)
26701        // 0x0002 - "dor lk" // standard input (expected here)
26702        // 0x0004 - "tp dor" // standard input (expected here)
26703        // 0x0008 - "csh bx" // standard input (expected here)
26704        // 0x0010 - "deflt" // standard input (expected here)
26666      PORT_INCLUDE( sc4_base )
26667      PORT_MODIFY("IN-1")
26668      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26669      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
26670      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
26671      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
26672      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
26673      PORT_MODIFY("IN-2")
26674      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
26675      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26676      PORT_MODIFY("IN-8")
26677      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
26678      PORT_MODIFY("IN-16")
26679      // 0x0001 - "dil  1" // standard input (motherboard)
26680      // 0x0002 - "dil  2" // standard input (motherboard)
26681      // 0x0004 - "dil  3" // standard input (motherboard)
26682      // 0x0008 - "dil  4" // standard input (motherboard)
26683      // 0x0010 - "dil  5" // standard input (motherboard)
26684      // 0x0100 - "top up" // known extended input, usually 'top up'
26685      PORT_MODIFY("IN-17")
26686      // 0x0001 - "dil  6" // standard input (motherboard)
26687      // 0x0002 - "dil  7" // standard input (motherboard)
26688      // 0x0004 - "dil  8" // standard input (motherboard)
26689      // 0x0008 - "dil  9" // standard input (motherboard)
26690      // 0x0010 - "dil 10" // standard input (motherboard)
26691      PORT_MODIFY("IN-18")
26692      // 0x0001 - "dil 11" // standard input (motherboard)
26693      // 0x0002 - "dil 12" // standard input (motherboard)
26694      // 0x0004 - "dil 13" // standard input (motherboard)
26695      // 0x0008 - "dil 14" // standard input (motherboard)
26696      // 0x0010 - "dil 15" // standard input (motherboard)
26697      PORT_MODIFY("IN-19")
26698      // 0x0001 - "dil 16" // standard input (motherboard)
26699      PORT_MODIFY("IN-20")
26700      // 0x0001 - "testsw" // standard input (motherboard)
26701      // 0x0002 - "dor lk" // standard input (expected here)
26702      // 0x0004 - "tp dor" // standard input (expected here)
26703      // 0x0008 - "csh bx" // standard input (expected here)
26704      // 0x0010 - "deflt" // standard input (expected here)
2670526705INPUT_PORTS_END
2670626706
2670726707// PR2999 HIGH 'N' MIGHTY         MITY SOUNDS         HIGH 'N' MIGHTY
r31373r31374
2673626736}
2673726737
2673826738INPUT_PORTS_START( sc4hi5 ) // this structure is generated
26739        PORT_INCLUDE( sc4_base )
26740        PORT_MODIFY("IN-1")
26741        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26742        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
26743        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
26744        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
26745        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
26746        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
26747        PORT_MODIFY("IN-2")
26748        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("coll")
26749        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26750        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26751        PORT_MODIFY("IN-4")
26752        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
26753        PORT_MODIFY("IN-5")
26754        // 0x0001 - "pzkey1" // standard input (expected here)
26755        // 0x0002 - "pzkey2" // standard input (expected here)
26756        // 0x0004 - "pzkey3" // standard input (expected here)
26757        // 0x0008 - "pzkey4" // standard input (expected here)
26758        PORT_MODIFY("IN-6")
26759        // 0x0001 - "pckey1" // standard input (expected here)
26760        // 0x0002 - "pckey2" // standard input (expected here)
26761        // 0x0004 - "pckey3" // standard input (expected here)
26762        // 0x0008 - "pckey4" // standard input (expected here)
26763        PORT_MODIFY("IN-8")
26764        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("feat")
26765        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("spins")
26766        PORT_MODIFY("IN-16")
26767        // 0x0001 - "dil  1" // standard input (motherboard)
26768        // 0x0002 - "dil  2" // standard input (motherboard)
26769        // 0x0004 - "dil  3" // standard input (motherboard)
26770        // 0x0008 - "dil  4" // standard input (motherboard)
26771        // 0x0010 - "dil  5" // standard input (motherboard)
26772        // 0x0100 - "htopup" // known extended input, usually 'top up'
26773        PORT_MODIFY("IN-17")
26774        // 0x0001 - "dil  6" // standard input (motherboard)
26775        // 0x0002 - "dil  7" // standard input (motherboard)
26776        // 0x0004 - "dil  8" // standard input (motherboard)
26777        // 0x0008 - "dil  9" // standard input (motherboard)
26778        // 0x0010 - "dil 10" // standard input (motherboard)
26779        PORT_MODIFY("IN-18")
26780        // 0x0001 - "dil 11" // standard input (motherboard)
26781        // 0x0002 - "dil 12" // standard input (motherboard)
26782        // 0x0004 - "dil 13" // standard input (motherboard)
26783        // 0x0008 - "dil 14" // standard input (motherboard)
26784        // 0x0010 - "dil 15" // standard input (motherboard)
26785        PORT_MODIFY("IN-19")
26786        // 0x0001 - "dil 16" // standard input (motherboard)
26787        PORT_MODIFY("IN-20")
26788        // 0x0001 - "green" // standard input (motherboard)
26789        // 0x0002 - "dorlok" // standard input (expected here)
26790        // 0x0004 - "serdor" // standard input (expected here)
26791        // 0x0008 - "cshdor" // standard input (expected here)
26792        // 0x0010 - "hopdmp" // standard input (expected here)
26739      PORT_INCLUDE( sc4_base )
26740      PORT_MODIFY("IN-1")
26741      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26742      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
26743      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
26744      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
26745      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
26746      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
26747      PORT_MODIFY("IN-2")
26748      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("coll")
26749      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26750      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26751      PORT_MODIFY("IN-4")
26752      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
26753      PORT_MODIFY("IN-5")
26754      // 0x0001 - "pzkey1" // standard input (expected here)
26755      // 0x0002 - "pzkey2" // standard input (expected here)
26756      // 0x0004 - "pzkey3" // standard input (expected here)
26757      // 0x0008 - "pzkey4" // standard input (expected here)
26758      PORT_MODIFY("IN-6")
26759      // 0x0001 - "pckey1" // standard input (expected here)
26760      // 0x0002 - "pckey2" // standard input (expected here)
26761      // 0x0004 - "pckey3" // standard input (expected here)
26762      // 0x0008 - "pckey4" // standard input (expected here)
26763      PORT_MODIFY("IN-8")
26764      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("feat")
26765      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("spins")
26766      PORT_MODIFY("IN-16")
26767      // 0x0001 - "dil  1" // standard input (motherboard)
26768      // 0x0002 - "dil  2" // standard input (motherboard)
26769      // 0x0004 - "dil  3" // standard input (motherboard)
26770      // 0x0008 - "dil  4" // standard input (motherboard)
26771      // 0x0010 - "dil  5" // standard input (motherboard)
26772      // 0x0100 - "htopup" // known extended input, usually 'top up'
26773      PORT_MODIFY("IN-17")
26774      // 0x0001 - "dil  6" // standard input (motherboard)
26775      // 0x0002 - "dil  7" // standard input (motherboard)
26776      // 0x0004 - "dil  8" // standard input (motherboard)
26777      // 0x0008 - "dil  9" // standard input (motherboard)
26778      // 0x0010 - "dil 10" // standard input (motherboard)
26779      PORT_MODIFY("IN-18")
26780      // 0x0001 - "dil 11" // standard input (motherboard)
26781      // 0x0002 - "dil 12" // standard input (motherboard)
26782      // 0x0004 - "dil 13" // standard input (motherboard)
26783      // 0x0008 - "dil 14" // standard input (motherboard)
26784      // 0x0010 - "dil 15" // standard input (motherboard)
26785      PORT_MODIFY("IN-19")
26786      // 0x0001 - "dil 16" // standard input (motherboard)
26787      PORT_MODIFY("IN-20")
26788      // 0x0001 - "green" // standard input (motherboard)
26789      // 0x0002 - "dorlok" // standard input (expected here)
26790      // 0x0004 - "serdor" // standard input (expected here)
26791      // 0x0008 - "cshdor" // standard input (expected here)
26792      // 0x0010 - "hopdmp" // standard input (expected here)
2679326793INPUT_PORTS_END
2679426794
2679526795// PR1003 HIGH FIVE         PR1003 HIGH FIVE SOUNDS11
r31373r31374
2681926819}
2682026820
2682126821INPUT_PORTS_START( sc4sprng ) // this structure is generated
26822        PORT_INCLUDE( sc4_base )
26823        PORT_MODIFY("IN-1")
26824        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26825        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold")
26826        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("holdhi")
26827        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("holdlo")
26828        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stop")
26829        PORT_MODIFY("IN-2")
26830        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("xchnge")
26831        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26832        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26833        PORT_MODIFY("IN-8")
26834        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("feat")
26835        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("blasts")
26836        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
26837        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("prize")
26838        PORT_MODIFY("IN-16")
26839        // 0x0001 - "dil  1" // standard input (motherboard)
26840        // 0x0002 - "dil  2" // standard input (motherboard)
26841        // 0x0004 - "dil  3" // standard input (motherboard)
26842        // 0x0008 - "dil  4" // standard input (motherboard)
26843        // 0x0010 - "dil  5" // standard input (motherboard)
26844        // 0x0100 - "top up" // known extended input, usually 'top up'
26845        PORT_MODIFY("IN-17")
26846        // 0x0001 - "dil  6" // standard input (motherboard)
26847        // 0x0002 - "dil  7" // standard input (motherboard)
26848        // 0x0004 - "dil  8" // standard input (motherboard)
26849        // 0x0008 - "dil  9" // standard input (motherboard)
26850        // 0x0010 - "dil 10" // standard input (motherboard)
26851        PORT_MODIFY("IN-18")
26852        // 0x0001 - "dil 11" // standard input (motherboard)
26853        // 0x0002 - "dil 12" // standard input (motherboard)
26854        // 0x0004 - "dil 13" // standard input (motherboard)
26855        // 0x0008 - "dil 14" // standard input (motherboard)
26856        // 0x0010 - "dil 15" // standard input (motherboard)
26857        PORT_MODIFY("IN-19")
26858        // 0x0001 - "dil 16" // standard input (motherboard)
26859        PORT_MODIFY("IN-20")
26860        // 0x0001 - "testsw" // standard input (motherboard)
26861        // 0x0002 - "dor lk" // standard input (expected here)
26862        // 0x0004 - "tp dor" // standard input (expected here)
26863        // 0x0008 - "csh bx" // standard input (expected here)
26864        // 0x0010 - "deflt" // standard input (expected here)
26822      PORT_INCLUDE( sc4_base )
26823      PORT_MODIFY("IN-1")
26824      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26825      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold")
26826      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("holdhi")
26827      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("holdlo")
26828      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stop")
26829      PORT_MODIFY("IN-2")
26830      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("xchnge")
26831      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26832      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26833      PORT_MODIFY("IN-8")
26834      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("feat")
26835      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("blasts")
26836      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
26837      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("prize")
26838      PORT_MODIFY("IN-16")
26839      // 0x0001 - "dil  1" // standard input (motherboard)
26840      // 0x0002 - "dil  2" // standard input (motherboard)
26841      // 0x0004 - "dil  3" // standard input (motherboard)
26842      // 0x0008 - "dil  4" // standard input (motherboard)
26843      // 0x0010 - "dil  5" // standard input (motherboard)
26844      // 0x0100 - "top up" // known extended input, usually 'top up'
26845      PORT_MODIFY("IN-17")
26846      // 0x0001 - "dil  6" // standard input (motherboard)
26847      // 0x0002 - "dil  7" // standard input (motherboard)
26848      // 0x0004 - "dil  8" // standard input (motherboard)
26849      // 0x0008 - "dil  9" // standard input (motherboard)
26850      // 0x0010 - "dil 10" // standard input (motherboard)
26851      PORT_MODIFY("IN-18")
26852      // 0x0001 - "dil 11" // standard input (motherboard)
26853      // 0x0002 - "dil 12" // standard input (motherboard)
26854      // 0x0004 - "dil 13" // standard input (motherboard)
26855      // 0x0008 - "dil 14" // standard input (motherboard)
26856      // 0x0010 - "dil 15" // standard input (motherboard)
26857      PORT_MODIFY("IN-19")
26858      // 0x0001 - "dil 16" // standard input (motherboard)
26859      PORT_MODIFY("IN-20")
26860      // 0x0001 - "testsw" // standard input (motherboard)
26861      // 0x0002 - "dor lk" // standard input (expected here)
26862      // 0x0004 - "tp dor" // standard input (expected here)
26863      // 0x0008 - "csh bx" // standard input (expected here)
26864      // 0x0010 - "deflt" // standard input (expected here)
2686526865INPUT_PORTS_END
2686626866
2686726867//  PR2066 HIGHLY SPRUNG         HIGH SOUNDS          HIGHLY SPRUNG
r31373r31374
2688526885}
2688626886
2688726887INPUT_PORTS_START( sc4hilo ) // this structure is generated
26888        PORT_INCLUDE( sc4_base )
26889        PORT_MODIFY("IN-1")
26890        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26891        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
26892        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
26893        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
26894        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
26895        PORT_MODIFY("IN-2")
26896        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
26897        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26898        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26899        PORT_MODIFY("IN-3")
26900        // 0x0004 - "stk 4" // standard input (expected here)
26901        // 0x0008 - "stk 3" // standard input (expected here)
26902        // 0x0010 - "stk 2" // standard input (expected here)
26903        PORT_MODIFY("IN-4")
26904        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
26905        // 0x0004 - "hpunit" // unexpected here
26906        // 0x0010 - "htopup" // known extended(?) input, sometimes 'top up'
26907        PORT_MODIFY("IN-5")
26908        // 0x0001 - "pzkey4" // standard input (expected here)
26909        // 0x0002 - "pzkey3" // standard input (expected here)
26910        // 0x0004 - "pzkey2" // standard input (expected here)
26911        // 0x0008 - "pzkey1" // standard input (expected here)
26912        PORT_MODIFY("IN-6")
26913        // 0x0001 - "pckey1" // standard input (expected here)
26914        // 0x0002 - "pckey2" // standard input (expected here)
26915        // 0x0004 - "pckey3" // standard input (expected here)
26916        // 0x0008 - "pckey4" // standard input (expected here)
26917        PORT_MODIFY("IN-8")
26918        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
26919        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
26920        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk fet")
26921        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi nud")
26922        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi csh")
26923        PORT_MODIFY("IN-9")
26924        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hi fet")
26925        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("lo nud")
26926        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("lo csh")
26927        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("lo fet")
26928        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("tk brc")
26929        PORT_MODIFY("IN-16")
26930        // 0x0001 - "dil 1" // standard input (motherboard)
26931        // 0x0002 - "dil 2" // standard input (motherboard)
26932        // 0x0004 - "dil 3" // standard input (motherboard)
26933        // 0x0008 - "dil 4" // standard input (motherboard)
26934        // 0x0010 - "dil 5" // standard input (motherboard)
26935        PORT_MODIFY("IN-17")
26936        // 0x0001 - "dil 6" // standard input (motherboard)
26937        // 0x0002 - "dil 7" // standard input (motherboard)
26938        // 0x0004 - "dil 8" // standard input (motherboard)
26939        // 0x0008 - "dil 9" // standard input (motherboard)
26940        // 0x0010 - "dil10" // standard input (motherboard)
26941        PORT_MODIFY("IN-18")
26942        // 0x0001 - "dil11" // standard input (motherboard)
26943        // 0x0002 - "dil12" // standard input (motherboard)
26944        // 0x0004 - "dil13" // standard input (motherboard)
26945        // 0x0008 - "dil14" // standard input (motherboard)
26946        // 0x0010 - "dil15" // standard input (motherboard)
26947        PORT_MODIFY("IN-19")
26948        // 0x0001 - "dil16" // standard input (motherboard)
26949        PORT_MODIFY("IN-20")
26950        // 0x0001 - "green" // standard input (motherboard)
26951        // 0x0002 - "dorlok" // standard input (expected here)
26952        // 0x0004 - "serdor" // standard input (expected here)
26953        // 0x0008 - "cshdor" // standard input (expected here)
26954        // 0x0010 - "hopdmp" // standard input (expected here)
26888      PORT_INCLUDE( sc4_base )
26889      PORT_MODIFY("IN-1")
26890      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26891      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
26892      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
26893      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
26894      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
26895      PORT_MODIFY("IN-2")
26896      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
26897      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
26898      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
26899      PORT_MODIFY("IN-3")
26900      // 0x0004 - "stk 4" // standard input (expected here)
26901      // 0x0008 - "stk 3" // standard input (expected here)
26902      // 0x0010 - "stk 2" // standard input (expected here)
26903      PORT_MODIFY("IN-4")
26904      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
26905      // 0x0004 - "hpunit" // unexpected here
26906      // 0x0010 - "htopup" // known extended(?) input, sometimes 'top up'
26907      PORT_MODIFY("IN-5")
26908      // 0x0001 - "pzkey4" // standard input (expected here)
26909      // 0x0002 - "pzkey3" // standard input (expected here)
26910      // 0x0004 - "pzkey2" // standard input (expected here)
26911      // 0x0008 - "pzkey1" // standard input (expected here)
26912      PORT_MODIFY("IN-6")
26913      // 0x0001 - "pckey1" // standard input (expected here)
26914      // 0x0002 - "pckey2" // standard input (expected here)
26915      // 0x0004 - "pckey3" // standard input (expected here)
26916      // 0x0008 - "pckey4" // standard input (expected here)
26917      PORT_MODIFY("IN-8")
26918      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
26919      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
26920      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk fet")
26921      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi nud")
26922      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi csh")
26923      PORT_MODIFY("IN-9")
26924      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hi fet")
26925      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("lo nud")
26926      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("lo csh")
26927      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("lo fet")
26928      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("tk brc")
26929      PORT_MODIFY("IN-16")
26930      // 0x0001 - "dil 1" // standard input (motherboard)
26931      // 0x0002 - "dil 2" // standard input (motherboard)
26932      // 0x0004 - "dil 3" // standard input (motherboard)
26933      // 0x0008 - "dil 4" // standard input (motherboard)
26934      // 0x0010 - "dil 5" // standard input (motherboard)
26935      PORT_MODIFY("IN-17")
26936      // 0x0001 - "dil 6" // standard input (motherboard)
26937      // 0x0002 - "dil 7" // standard input (motherboard)
26938      // 0x0004 - "dil 8" // standard input (motherboard)
26939      // 0x0008 - "dil 9" // standard input (motherboard)
26940      // 0x0010 - "dil10" // standard input (motherboard)
26941      PORT_MODIFY("IN-18")
26942      // 0x0001 - "dil11" // standard input (motherboard)
26943      // 0x0002 - "dil12" // standard input (motherboard)
26944      // 0x0004 - "dil13" // standard input (motherboard)
26945      // 0x0008 - "dil14" // standard input (motherboard)
26946      // 0x0010 - "dil15" // standard input (motherboard)
26947      PORT_MODIFY("IN-19")
26948      // 0x0001 - "dil16" // standard input (motherboard)
26949      PORT_MODIFY("IN-20")
26950      // 0x0001 - "green" // standard input (motherboard)
26951      // 0x0002 - "dorlok" // standard input (expected here)
26952      // 0x0004 - "serdor" // standard input (expected here)
26953      // 0x0008 - "cshdor" // standard input (expected here)
26954      // 0x0010 - "hopdmp" // standard input (expected here)
2695526955INPUT_PORTS_END
2695626956
2695726957// PR1013 HILOWATHA         PR1013 HILOWATHA SOUNDS11
r31373r31374
2698626986}
2698726987
2698826988INPUT_PORTS_START( sc4hitsh ) // this structure is generated
26989        PORT_INCLUDE( sc4_base )
26990        PORT_MODIFY("IN-1")
26991        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26992        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
26993        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
26994        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
26995        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
26996        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
26997        PORT_MODIFY("IN-2")
26998        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
26999        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27000        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27001        PORT_MODIFY("IN-3")
27002        // 0x0004 - "stk 4" // standard input (expected here)
27003        // 0x0008 - "stk 3" // standard input (expected here)
27004        // 0x0010 - "stk 2" // standard input (expected here)
27005        PORT_MODIFY("IN-5")
27006        // 0x0001 - "priz4" // standard input (expected here)
27007        // 0x0002 - "priz3" // standard input (expected here)
27008        // 0x0004 - "priz2" // standard input (expected here)
27009        // 0x0008 - "priz1" // standard input (expected here)
27010        PORT_MODIFY("IN-6")
27011        // 0x0001 - "perc1" // standard input (expected here)
27012        // 0x0002 - "perc2" // standard input (expected here)
27013        // 0x0004 - "perc3" // standard input (expected here)
27014        // 0x0008 - "perc4" // standard input (expected here)
27015        PORT_MODIFY("IN-8")
27016        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk sht")
27017        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("col rd")
27018        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk nud")
27019        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("blu lo")
27020        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("red lo")
27021        PORT_MODIFY("IN-9")
27022        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("gre lo")
27023        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("tk stp")
27024        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("col bl")
27025        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("blu hi")
27026        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("red hi")
27027        PORT_MODIFY("IN-10")
27028        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_0 ) PORT_NAME("gre hi")
27029        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_1 ) PORT_NAME("col gr")
27030        PORT_MODIFY("IN-16")
27031        // 0x0001 - "dil  1" // standard input (motherboard)
27032        // 0x0002 - "dil  2" // standard input (motherboard)
27033        // 0x0004 - "dil  3" // standard input (motherboard)
27034        // 0x0008 - "dil  4" // standard input (motherboard)
27035        // 0x0010 - "dil  5" // standard input (motherboard)
27036        // 0x0100 - "top up" // known extended input, usually 'top up'
27037        PORT_MODIFY("IN-17")
27038        // 0x0001 - "dil  6" // standard input (motherboard)
27039        // 0x0002 - "dil  7" // standard input (motherboard)
27040        // 0x0004 - "dil  8" // standard input (motherboard)
27041        // 0x0008 - "dil  9" // standard input (motherboard)
27042        // 0x0010 - "dil 10" // standard input (motherboard)
27043        PORT_MODIFY("IN-18")
27044        // 0x0001 - "dil 11" // standard input (motherboard)
27045        // 0x0002 - "dil 12" // standard input (motherboard)
27046        // 0x0004 - "dil 13" // standard input (motherboard)
27047        // 0x0008 - "dil 14" // standard input (motherboard)
27048        // 0x0010 - "dil 15" // standard input (motherboard)
27049        PORT_MODIFY("IN-19")
27050        // 0x0001 - "dil 16" // standard input (motherboard)
27051        PORT_MODIFY("IN-20")
27052        // 0x0001 - "grnbut" // standard input (motherboard)
27053        // 0x0002 - "dorlok" // standard input (expected here)
27054        // 0x0004 - "topdor" // standard input (expected here)
27055        // 0x0008 - "botdor" // standard input (expected here)
27056        // 0x0010 - "hopdmp OR hopdmp" // standard input (expected here)
26989      PORT_INCLUDE( sc4_base )
26990      PORT_MODIFY("IN-1")
26991      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
26992      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
26993      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
26994      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
26995      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
26996      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
26997      PORT_MODIFY("IN-2")
26998      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
26999      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27000      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27001      PORT_MODIFY("IN-3")
27002      // 0x0004 - "stk 4" // standard input (expected here)
27003      // 0x0008 - "stk 3" // standard input (expected here)
27004      // 0x0010 - "stk 2" // standard input (expected here)
27005      PORT_MODIFY("IN-5")
27006      // 0x0001 - "priz4" // standard input (expected here)
27007      // 0x0002 - "priz3" // standard input (expected here)
27008      // 0x0004 - "priz2" // standard input (expected here)
27009      // 0x0008 - "priz1" // standard input (expected here)
27010      PORT_MODIFY("IN-6")
27011      // 0x0001 - "perc1" // standard input (expected here)
27012      // 0x0002 - "perc2" // standard input (expected here)
27013      // 0x0004 - "perc3" // standard input (expected here)
27014      // 0x0008 - "perc4" // standard input (expected here)
27015      PORT_MODIFY("IN-8")
27016      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk sht")
27017      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("col rd")
27018      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk nud")
27019      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("blu lo")
27020      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("red lo")
27021      PORT_MODIFY("IN-9")
27022      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("gre lo")
27023      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("tk stp")
27024      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("col bl")
27025      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("blu hi")
27026      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("red hi")
27027      PORT_MODIFY("IN-10")
27028      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_0 ) PORT_NAME("gre hi")
27029      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_1 ) PORT_NAME("col gr")
27030      PORT_MODIFY("IN-16")
27031      // 0x0001 - "dil  1" // standard input (motherboard)
27032      // 0x0002 - "dil  2" // standard input (motherboard)
27033      // 0x0004 - "dil  3" // standard input (motherboard)
27034      // 0x0008 - "dil  4" // standard input (motherboard)
27035      // 0x0010 - "dil  5" // standard input (motherboard)
27036      // 0x0100 - "top up" // known extended input, usually 'top up'
27037      PORT_MODIFY("IN-17")
27038      // 0x0001 - "dil  6" // standard input (motherboard)
27039      // 0x0002 - "dil  7" // standard input (motherboard)
27040      // 0x0004 - "dil  8" // standard input (motherboard)
27041      // 0x0008 - "dil  9" // standard input (motherboard)
27042      // 0x0010 - "dil 10" // standard input (motherboard)
27043      PORT_MODIFY("IN-18")
27044      // 0x0001 - "dil 11" // standard input (motherboard)
27045      // 0x0002 - "dil 12" // standard input (motherboard)
27046      // 0x0004 - "dil 13" // standard input (motherboard)
27047      // 0x0008 - "dil 14" // standard input (motherboard)
27048      // 0x0010 - "dil 15" // standard input (motherboard)
27049      PORT_MODIFY("IN-19")
27050      // 0x0001 - "dil 16" // standard input (motherboard)
27051      PORT_MODIFY("IN-20")
27052      // 0x0001 - "grnbut" // standard input (motherboard)
27053      // 0x0002 - "dorlok" // standard input (expected here)
27054      // 0x0004 - "topdor" // standard input (expected here)
27055      // 0x0008 - "botdor" // standard input (expected here)
27056      // 0x0010 - "hopdmp OR hopdmp" // standard input (expected here)
2705727057INPUT_PORTS_END
2705827058
2705927059// PR1112 HIT SHOT         PR1112 HIT SHOT SOUNDS11
r31373r31374
2708127081}
2708227082
2708327083INPUT_PORTS_START( sc4h6cl ) // this structure is generated
27084        PORT_INCLUDE( sc4_base )
27085        PORT_MODIFY("IN-1")
27086        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
27087        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27088        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
27089        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
27090        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stake1")
27091        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
27092        PORT_MODIFY("IN-2")
27093        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake2")
27094        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stake3")
27095        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("trnsfr")
27096        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27097        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
27098        PORT_MODIFY("IN-3")
27099        // 0x0004 - "stk 4" // standard input (expected here)
27100        // 0x0008 - "stk 3" // standard input (expected here)
27101        // 0x0010 - "stk 2" // standard input (expected here)
27102        PORT_MODIFY("IN-4")
27103        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
27104        PORT_MODIFY("IN-5")
27105        // 0x0001 - "priz4" // standard input (expected here)
27106        // 0x0002 - "priz3" // standard input (expected here)
27107        // 0x0004 - "priz2" // standard input (expected here)
27108        // 0x0008 - "priz1" // standard input (expected here)
27109        PORT_MODIFY("IN-6")
27110        // 0x0001 - "perc1" // standard input (expected here)
27111        // 0x0002 - "perc2" // standard input (expected here)
27112        // 0x0004 - "perc3" // standard input (expected here)
27113        // 0x0008 - "perc4" // standard input (expected here)
27114        PORT_MODIFY("IN-16")
27115        // 0x0001 - "dil 1" // standard input (motherboard)
27116        // 0x0002 - "dil 2" // standard input (motherboard)
27117        // 0x0004 - "dil 3" // standard input (motherboard)
27118        // 0x0008 - "dil 4" // standard input (motherboard)
27119        // 0x0010 - "dil 5" // standard input (motherboard)
27120        // 0x0100 - "top up" // known extended input, usually 'top up'
27121        PORT_MODIFY("IN-17")
27122        // 0x0001 - "dil 6" // standard input (motherboard)
27123        // 0x0002 - "dil 7" // standard input (motherboard)
27124        // 0x0004 - "dil 8" // standard input (motherboard)
27125        // 0x0008 - "dil 9" // standard input (motherboard)
27126        // 0x0010 - "dil10" // standard input (motherboard)
27127        PORT_MODIFY("IN-18")
27128        // 0x0001 - "dil11" // standard input (motherboard)
27129        // 0x0002 - "dil12" // standard input (motherboard)
27130        // 0x0004 - "dil13" // standard input (motherboard)
27131        // 0x0008 - "dil14" // standard input (motherboard)
27132        // 0x0010 - "dil15" // standard input (motherboard)
27133        PORT_MODIFY("IN-19")
27134        // 0x0001 - "dil16" // standard input (motherboard)
27135        PORT_MODIFY("IN-20")
27136        // 0x0001 - "grnbut" // standard input (motherboard)
27137        // 0x0002 - "dorlok" // standard input (expected here)
27138        // 0x0004 - "topdor" // standard input (expected here)
27139        // 0x0008 - "botdor" // standard input (expected here)
27140        // 0x0010 - "hopdmp" // standard input (expected here)
27084      PORT_INCLUDE( sc4_base )
27085      PORT_MODIFY("IN-1")
27086      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
27087      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27088      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
27089      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
27090      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stake1")
27091      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
27092      PORT_MODIFY("IN-2")
27093      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake2")
27094      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stake3")
27095      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("trnsfr")
27096      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27097      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
27098      PORT_MODIFY("IN-3")
27099      // 0x0004 - "stk 4" // standard input (expected here)
27100      // 0x0008 - "stk 3" // standard input (expected here)
27101      // 0x0010 - "stk 2" // standard input (expected here)
27102      PORT_MODIFY("IN-4")
27103      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
27104      PORT_MODIFY("IN-5")
27105      // 0x0001 - "priz4" // standard input (expected here)
27106      // 0x0002 - "priz3" // standard input (expected here)
27107      // 0x0004 - "priz2" // standard input (expected here)
27108      // 0x0008 - "priz1" // standard input (expected here)
27109      PORT_MODIFY("IN-6")
27110      // 0x0001 - "perc1" // standard input (expected here)
27111      // 0x0002 - "perc2" // standard input (expected here)
27112      // 0x0004 - "perc3" // standard input (expected here)
27113      // 0x0008 - "perc4" // standard input (expected here)
27114      PORT_MODIFY("IN-16")
27115      // 0x0001 - "dil 1" // standard input (motherboard)
27116      // 0x0002 - "dil 2" // standard input (motherboard)
27117      // 0x0004 - "dil 3" // standard input (motherboard)
27118      // 0x0008 - "dil 4" // standard input (motherboard)
27119      // 0x0010 - "dil 5" // standard input (motherboard)
27120      // 0x0100 - "top up" // known extended input, usually 'top up'
27121      PORT_MODIFY("IN-17")
27122      // 0x0001 - "dil 6" // standard input (motherboard)
27123      // 0x0002 - "dil 7" // standard input (motherboard)
27124      // 0x0004 - "dil 8" // standard input (motherboard)
27125      // 0x0008 - "dil 9" // standard input (motherboard)
27126      // 0x0010 - "dil10" // standard input (motherboard)
27127      PORT_MODIFY("IN-18")
27128      // 0x0001 - "dil11" // standard input (motherboard)
27129      // 0x0002 - "dil12" // standard input (motherboard)
27130      // 0x0004 - "dil13" // standard input (motherboard)
27131      // 0x0008 - "dil14" // standard input (motherboard)
27132      // 0x0010 - "dil15" // standard input (motherboard)
27133      PORT_MODIFY("IN-19")
27134      // 0x0001 - "dil16" // standard input (motherboard)
27135      PORT_MODIFY("IN-20")
27136      // 0x0001 - "grnbut" // standard input (motherboard)
27137      // 0x0002 - "dorlok" // standard input (expected here)
27138      // 0x0004 - "topdor" // standard input (expected here)
27139      // 0x0008 - "botdor" // standard input (expected here)
27140      // 0x0010 - "hopdmp" // standard input (expected here)
2714127141INPUT_PORTS_END
2714227142
2714327143//  PR1759 CLUB HOT SIX         HOT SIX CLUB  PR1759 HOSX SOUNDS11
r31373r31374
2716427164}
2716527165
2716627166INPUT_PORTS_START( sc4ijclb ) // this structure is generated
27167        PORT_INCLUDE( sc4_base )
27168        PORT_MODIFY("IN-1")
27169        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
27170        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27171        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
27172        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
27173        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
27174        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
27175        PORT_MODIFY("IN-2")
27176        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
27177        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
27178        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27179        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27180        PORT_MODIFY("IN-3")
27181        // 0x0004 - "stk 4" // standard input (expected here)
27182        // 0x0008 - "stk 3" // standard input (expected here)
27183        // 0x0010 - "stk 2" // standard input (expected here)
27184        PORT_MODIFY("IN-5")
27185        // 0x0001 - "priz4" // standard input (expected here)
27186        // 0x0002 - "priz3" // standard input (expected here)
27187        // 0x0004 - "priz2" // standard input (expected here)
27188        // 0x0008 - "priz1" // standard input (expected here)
27189        PORT_MODIFY("IN-8")
27190        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
27191        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk spi")
27192        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk cpo")
27193        PORT_MODIFY("IN-16")
27194        // 0x0001 - "dil 1" // standard input (motherboard)
27195        // 0x0002 - "dil 2" // standard input (motherboard)
27196        // 0x0004 - "dil 3" // standard input (motherboard)
27197        // 0x0008 - "dil 4" // standard input (motherboard)
27198        // 0x0010 - "dil 5" // standard input (motherboard)
27199        // 0x0100 - "top up" // known extended input, usually 'top up'
27200        PORT_MODIFY("IN-17")
27201        // 0x0001 - "dil 6" // standard input (motherboard)
27202        // 0x0002 - "dil 7" // standard input (motherboard)
27203        // 0x0004 - "dil 8" // standard input (motherboard)
27204        // 0x0008 - "dil 9" // standard input (motherboard)
27205        // 0x0010 - "dil10" // standard input (motherboard)
27206        PORT_MODIFY("IN-18")
27207        // 0x0001 - "dil11" // standard input (motherboard)
27208        // 0x0002 - "dil12" // standard input (motherboard)
27209        // 0x0004 - "dil13" // standard input (motherboard)
27210        // 0x0008 - "dil14" // standard input (motherboard)
27211        // 0x0010 - "dil15" // standard input (motherboard)
27212        PORT_MODIFY("IN-19")
27213        // 0x0001 - "dil16" // standard input (motherboard)
27214        PORT_MODIFY("IN-20")
27215        // 0x0001 - "grnbut" // standard input (motherboard)
27216        // 0x0002 - "dorlok" // standard input (expected here)
27217        // 0x0004 - "topdor" // standard input (expected here)
27218        // 0x0008 - "botdor" // standard input (expected here)
27219        // 0x0010 - "hopdmp" // standard input (expected here)
27167      PORT_INCLUDE( sc4_base )
27168      PORT_MODIFY("IN-1")
27169      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
27170      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27171      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
27172      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
27173      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
27174      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
27175      PORT_MODIFY("IN-2")
27176      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
27177      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
27178      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27179      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27180      PORT_MODIFY("IN-3")
27181      // 0x0004 - "stk 4" // standard input (expected here)
27182      // 0x0008 - "stk 3" // standard input (expected here)
27183      // 0x0010 - "stk 2" // standard input (expected here)
27184      PORT_MODIFY("IN-5")
27185      // 0x0001 - "priz4" // standard input (expected here)
27186      // 0x0002 - "priz3" // standard input (expected here)
27187      // 0x0004 - "priz2" // standard input (expected here)
27188      // 0x0008 - "priz1" // standard input (expected here)
27189      PORT_MODIFY("IN-8")
27190      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
27191      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk spi")
27192      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk cpo")
27193      PORT_MODIFY("IN-16")
27194      // 0x0001 - "dil 1" // standard input (motherboard)
27195      // 0x0002 - "dil 2" // standard input (motherboard)
27196      // 0x0004 - "dil 3" // standard input (motherboard)
27197      // 0x0008 - "dil 4" // standard input (motherboard)
27198      // 0x0010 - "dil 5" // standard input (motherboard)
27199      // 0x0100 - "top up" // known extended input, usually 'top up'
27200      PORT_MODIFY("IN-17")
27201      // 0x0001 - "dil 6" // standard input (motherboard)
27202      // 0x0002 - "dil 7" // standard input (motherboard)
27203      // 0x0004 - "dil 8" // standard input (motherboard)
27204      // 0x0008 - "dil 9" // standard input (motherboard)
27205      // 0x0010 - "dil10" // standard input (motherboard)
27206      PORT_MODIFY("IN-18")
27207      // 0x0001 - "dil11" // standard input (motherboard)
27208      // 0x0002 - "dil12" // standard input (motherboard)
27209      // 0x0004 - "dil13" // standard input (motherboard)
27210      // 0x0008 - "dil14" // standard input (motherboard)
27211      // 0x0010 - "dil15" // standard input (motherboard)
27212      PORT_MODIFY("IN-19")
27213      // 0x0001 - "dil16" // standard input (motherboard)
27214      PORT_MODIFY("IN-20")
27215      // 0x0001 - "grnbut" // standard input (motherboard)
27216      // 0x0002 - "dorlok" // standard input (expected here)
27217      // 0x0004 - "topdor" // standard input (expected here)
27218      // 0x0008 - "botdor" // standard input (expected here)
27219      // 0x0010 - "hopdmp" // standard input (expected here)
2722027220INPUT_PORTS_END
2722127221
2722227222// PR2403 CLUB ITALIAN JOB         CLUB ITALIAN JOB  CLUB  CLUB ITJB SOUNDS
r31373r31374
2723927239}
2724027240
2724127241INPUT_PORTS_START( sc4jack ) // this structure is generated
27242        PORT_INCLUDE( sc4_base )
27243        PORT_MODIFY("IN-1")
27244        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
27245        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colect")
27246        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
27247        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
27248        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
27249        PORT_MODIFY("IN-2")
27250        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
27251        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27252        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27253        PORT_MODIFY("IN-8")
27254        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tke ft")
27255        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tke ng")
27256        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("shoot")
27257        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("csh pt")
27258        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("colect")
27259        PORT_MODIFY("IN-16")
27260        // 0x0001 - "dil  1" // standard input (motherboard)
27261        // 0x0002 - "dil  2" // standard input (motherboard)
27262        // 0x0004 - "dil  3" // standard input (motherboard)
27263        // 0x0008 - "dil  4" // standard input (motherboard)
27264        // 0x0010 - "dil  5" // standard input (motherboard)
27265        // 0x0100 - "top up" // known extended input, usually 'top up'
27266        PORT_MODIFY("IN-17")
27267        // 0x0001 - "dil  6" // standard input (motherboard)
27268        // 0x0002 - "dil  7" // standard input (motherboard)
27269        // 0x0004 - "dil  8" // standard input (motherboard)
27270        // 0x0008 - "dil  9" // standard input (motherboard)
27271        // 0x0010 - "dil 10" // standard input (motherboard)
27272        PORT_MODIFY("IN-18")
27273        // 0x0001 - "dil 11" // standard input (motherboard)
27274        // 0x0002 - "dil 12" // standard input (motherboard)
27275        // 0x0004 - "dil 13" // standard input (motherboard)
27276        // 0x0008 - "dil 14" // standard input (motherboard)
27277        // 0x0010 - "dil 15" // standard input (motherboard)
27278        PORT_MODIFY("IN-19")
27279        // 0x0001 - "dil 16" // standard input (motherboard)
27280        PORT_MODIFY("IN-20")
27281        // 0x0001 - "testsw" // standard input (motherboard)
27282        // 0x0002 - "dor lk" // standard input (expected here)
27283        // 0x0004 - "tp dor" // standard input (expected here)
27284        // 0x0008 - "csh bx" // standard input (expected here)
27285        // 0x0010 - "deflt" // standard input (expected here)
27242      PORT_INCLUDE( sc4_base )
27243      PORT_MODIFY("IN-1")
27244      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
27245      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colect")
27246      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
27247      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
27248      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
27249      PORT_MODIFY("IN-2")
27250      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
27251      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27252      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27253      PORT_MODIFY("IN-8")
27254      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tke ft")
27255      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tke ng")
27256      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("shoot")
27257      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("csh pt")
27258      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("colect")
27259      PORT_MODIFY("IN-16")
27260      // 0x0001 - "dil  1" // standard input (motherboard)
27261      // 0x0002 - "dil  2" // standard input (motherboard)
27262      // 0x0004 - "dil  3" // standard input (motherboard)
27263      // 0x0008 - "dil  4" // standard input (motherboard)
27264      // 0x0010 - "dil  5" // standard input (motherboard)
27265      // 0x0100 - "top up" // known extended input, usually 'top up'
27266      PORT_MODIFY("IN-17")
27267      // 0x0001 - "dil  6" // standard input (motherboard)
27268      // 0x0002 - "dil  7" // standard input (motherboard)
27269      // 0x0004 - "dil  8" // standard input (motherboard)
27270      // 0x0008 - "dil  9" // standard input (motherboard)
27271      // 0x0010 - "dil 10" // standard input (motherboard)
27272      PORT_MODIFY("IN-18")
27273      // 0x0001 - "dil 11" // standard input (motherboard)
27274      // 0x0002 - "dil 12" // standard input (motherboard)
27275      // 0x0004 - "dil 13" // standard input (motherboard)
27276      // 0x0008 - "dil 14" // standard input (motherboard)
27277      // 0x0010 - "dil 15" // standard input (motherboard)
27278      PORT_MODIFY("IN-19")
27279      // 0x0001 - "dil 16" // standard input (motherboard)
27280      PORT_MODIFY("IN-20")
27281      // 0x0001 - "testsw" // standard input (motherboard)
27282      // 0x0002 - "dor lk" // standard input (expected here)
27283      // 0x0004 - "tp dor" // standard input (expected here)
27284      // 0x0008 - "csh bx" // standard input (expected here)
27285      // 0x0010 - "deflt" // standard input (expected here)
2728627286INPUT_PORTS_END
2728727287
2728827288// PR2078 JACK THE KIPPER         JKIP SOUNDS         JACK THE KIPPER
r31373r31374
2731327313}
2731427314
2731527315INPUT_PORTS_START( sc4jjunc ) // this structure is generated
27316        PORT_INCLUDE( sc4_base )
27317        PORT_MODIFY("IN-1")
27318        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
27319        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27320        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
27321        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
27322        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
27323        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
27324        PORT_MODIFY("IN-2")
27325        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
27326        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27327        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27328        PORT_MODIFY("IN-3")
27329        // 0x0004 - "stk 4" // standard input (expected here)
27330        // 0x0008 - "stk 3" // standard input (expected here)
27331        // 0x0010 - "stk 2" // standard input (expected here)
27332        PORT_MODIFY("IN-5")
27333        // 0x0001 - "priz4" // standard input (expected here)
27334        // 0x0002 - "priz3" // standard input (expected here)
27335        // 0x0004 - "priz2" // standard input (expected here)
27336        // 0x0008 - "priz1" // standard input (expected here)
27337        PORT_MODIFY("IN-6")
27338        // 0x0001 - "perc1" // standard input (expected here)
27339        // 0x0002 - "perc2" // standard input (expected here)
27340        // 0x0004 - "perc3" // standard input (expected here)
27341        // 0x0008 - "perc4" // standard input (expected here)
27342        PORT_MODIFY("IN-8")
27343        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fea")
27344        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht")
27345        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk haz")
27346        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk nud")
27347        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk ss")
27348        PORT_MODIFY("IN-16")
27349        // 0x0001 - "dil 1" // standard input (motherboard)
27350        // 0x0002 - "dil 2" // standard input (motherboard)
27351        // 0x0004 - "dil 3" // standard input (motherboard)
27352        // 0x0008 - "dil 4" // standard input (motherboard)
27353        // 0x0010 - "dil 5" // standard input (motherboard)
27354        // 0x0100 - "top up" // known extended input, usually 'top up'
27355        PORT_MODIFY("IN-17")
27356        // 0x0001 - "dil 6" // standard input (motherboard)
27357        // 0x0002 - "dil 7" // standard input (motherboard)
27358        // 0x0004 - "dil 8" // standard input (motherboard)
27359        // 0x0008 - "dil 9" // standard input (motherboard)
27360        // 0x0010 - "dil10" // standard input (motherboard)
27361        PORT_MODIFY("IN-18")
27362        // 0x0001 - "dil11" // standard input (motherboard)
27363        // 0x0002 - "dil12" // standard input (motherboard)
27364        // 0x0004 - "dil13" // standard input (motherboard)
27365        // 0x0008 - "dil14" // standard input (motherboard)
27366        // 0x0010 - "dil15" // standard input (motherboard)
27367        PORT_MODIFY("IN-19")
27368        // 0x0001 - "dil16" // standard input (motherboard)
27369        PORT_MODIFY("IN-20")
27370        // 0x0001 - "grnbut" // standard input (motherboard)
27371        // 0x0002 - "dorlok" // standard input (expected here)
27372        // 0x0004 - "topdor" // standard input (expected here)
27373        // 0x0008 - "botdor" // standard input (expected here)
27374        // 0x0010 - "hopdmp" // standard input (expected here)
27316      PORT_INCLUDE( sc4_base )
27317      PORT_MODIFY("IN-1")
27318      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
27319      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27320      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
27321      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
27322      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
27323      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
27324      PORT_MODIFY("IN-2")
27325      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
27326      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27327      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27328      PORT_MODIFY("IN-3")
27329      // 0x0004 - "stk 4" // standard input (expected here)
27330      // 0x0008 - "stk 3" // standard input (expected here)
27331      // 0x0010 - "stk 2" // standard input (expected here)
27332      PORT_MODIFY("IN-5")
27333      // 0x0001 - "priz4" // standard input (expected here)
27334      // 0x0002 - "priz3" // standard input (expected here)
27335      // 0x0004 - "priz2" // standard input (expected here)
27336      // 0x0008 - "priz1" // standard input (expected here)
27337      PORT_MODIFY("IN-6")
27338      // 0x0001 - "perc1" // standard input (expected here)
27339      // 0x0002 - "perc2" // standard input (expected here)
27340      // 0x0004 - "perc3" // standard input (expected here)
27341      // 0x0008 - "perc4" // standard input (expected here)
27342      PORT_MODIFY("IN-8")
27343      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fea")
27344      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht")
27345      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk haz")
27346      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk nud")
27347      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk ss")
27348      PORT_MODIFY("IN-16")
27349      // 0x0001 - "dil 1" // standard input (motherboard)
27350      // 0x0002 - "dil 2" // standard input (motherboard)
27351      // 0x0004 - "dil 3" // standard input (motherboard)
27352      // 0x0008 - "dil 4" // standard input (motherboard)
27353      // 0x0010 - "dil 5" // standard input (motherboard)
27354      // 0x0100 - "top up" // known extended input, usually 'top up'
27355      PORT_MODIFY("IN-17")
27356      // 0x0001 - "dil 6" // standard input (motherboard)
27357      // 0x0002 - "dil 7" // standard input (motherboard)
27358      // 0x0004 - "dil 8" // standard input (motherboard)
27359      // 0x0008 - "dil 9" // standard input (motherboard)
27360      // 0x0010 - "dil10" // standard input (motherboard)
27361      PORT_MODIFY("IN-18")
27362      // 0x0001 - "dil11" // standard input (motherboard)
27363      // 0x0002 - "dil12" // standard input (motherboard)
27364      // 0x0004 - "dil13" // standard input (motherboard)
27365      // 0x0008 - "dil14" // standard input (motherboard)
27366      // 0x0010 - "dil15" // standard input (motherboard)
27367      PORT_MODIFY("IN-19")
27368      // 0x0001 - "dil16" // standard input (motherboard)
27369      PORT_MODIFY("IN-20")
27370      // 0x0001 - "grnbut" // standard input (motherboard)
27371      // 0x0002 - "dorlok" // standard input (expected here)
27372      // 0x0004 - "topdor" // standard input (expected here)
27373      // 0x0008 - "botdor" // standard input (expected here)
27374      // 0x0010 - "hopdmp" // standard input (expected here)
2737527375INPUT_PORTS_END
2737627376
2737727377// PR1304 JACKPOT JUNCTION         PR1304 JACKPOT JUNCTION SOUNDS11
r31373r31374
2741127411}
2741227412
2741327413INPUT_PORTS_START( sc4jjucl ) // this structure is generated
27414        PORT_INCLUDE( sc4_base )
27415        PORT_MODIFY("IN-1")
27416        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
27417        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27418        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
27419        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
27420        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
27421        PORT_MODIFY("IN-2")
27422        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
27423        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
27424        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
27425        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27426        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
27427        PORT_MODIFY("IN-3")
27428        // 0x0004 - "stk 4" // standard input (expected here)
27429        // 0x0008 - "stk 3" // standard input (expected here)
27430        // 0x0010 - "stk 2" // standard input (expected here)
27431        PORT_MODIFY("IN-4")
27432        // 0x0001 - "hop2lo" // unexpected here
27433        // 0x0002 - "hop1lo OR hop lo" // known extended(?) input, sometimes 'hop hi'
27434        PORT_MODIFY("IN-5")
27435        // 0x0001 - "priz4" // standard input (expected here)
27436        // 0x0002 - "priz3" // standard input (expected here)
27437        // 0x0004 - "priz2" // standard input (expected here)
27438        // 0x0008 - "priz1" // standard input (expected here)
27439        PORT_MODIFY("IN-8")
27440        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fet")
27441        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nudges")
27442        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("blasts")
27443        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shots")
27444        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk haz")
27445        PORT_MODIFY("IN-16")
27446        // 0x0001 - "dil 1" // standard input (motherboard)
27447        // 0x0002 - "dil 2" // standard input (motherboard)
27448        // 0x0004 - "dil 3" // standard input (motherboard)
27449        // 0x0008 - "dil 4" // standard input (motherboard)
27450        // 0x0010 - "dil 5" // standard input (motherboard)
27451        // 0x0100 - "top up" // known extended input, usually 'top up'
27452        PORT_MODIFY("IN-17")
27453        // 0x0001 - "dil 6" // standard input (motherboard)
27454        // 0x0002 - "dil 7" // standard input (motherboard)
27455        // 0x0004 - "dil 8" // standard input (motherboard)
27456        // 0x0008 - "dil 9" // standard input (motherboard)
27457        // 0x0010 - "dil10" // standard input (motherboard)
27458        PORT_MODIFY("IN-18")
27459        // 0x0001 - "dil11" // standard input (motherboard)
27460        // 0x0002 - "dil12" // standard input (motherboard)
27461        // 0x0004 - "dil13" // standard input (motherboard)
27462        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
27463        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
27464        PORT_MODIFY("IN-19")
27465        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
27466        PORT_MODIFY("IN-20")
27467        // 0x0001 - "grnbut" // standard input (motherboard)
27468        // 0x0002 - "dorlok" // standard input (expected here)
27469        // 0x0004 - "topdor" // standard input (expected here)
27470        // 0x0008 - "botdor" // standard input (expected here)
27471        // 0x0010 - "hopdmp" // standard input (expected here)
27414      PORT_INCLUDE( sc4_base )
27415      PORT_MODIFY("IN-1")
27416      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
27417      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27418      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
27419      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
27420      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
27421      PORT_MODIFY("IN-2")
27422      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
27423      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
27424      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
27425      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27426      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
27427      PORT_MODIFY("IN-3")
27428      // 0x0004 - "stk 4" // standard input (expected here)
27429      // 0x0008 - "stk 3" // standard input (expected here)
27430      // 0x0010 - "stk 2" // standard input (expected here)
27431      PORT_MODIFY("IN-4")
27432      // 0x0001 - "hop2lo" // unexpected here
27433      // 0x0002 - "hop1lo OR hop lo" // known extended(?) input, sometimes 'hop hi'
27434      PORT_MODIFY("IN-5")
27435      // 0x0001 - "priz4" // standard input (expected here)
27436      // 0x0002 - "priz3" // standard input (expected here)
27437      // 0x0004 - "priz2" // standard input (expected here)
27438      // 0x0008 - "priz1" // standard input (expected here)
27439      PORT_MODIFY("IN-8")
27440      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fet")
27441      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nudges")
27442      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("blasts")
27443      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shots")
27444      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk haz")
27445      PORT_MODIFY("IN-16")
27446      // 0x0001 - "dil 1" // standard input (motherboard)
27447      // 0x0002 - "dil 2" // standard input (motherboard)
27448      // 0x0004 - "dil 3" // standard input (motherboard)
27449      // 0x0008 - "dil 4" // standard input (motherboard)
27450      // 0x0010 - "dil 5" // standard input (motherboard)
27451      // 0x0100 - "top up" // known extended input, usually 'top up'
27452      PORT_MODIFY("IN-17")
27453      // 0x0001 - "dil 6" // standard input (motherboard)
27454      // 0x0002 - "dil 7" // standard input (motherboard)
27455      // 0x0004 - "dil 8" // standard input (motherboard)
27456      // 0x0008 - "dil 9" // standard input (motherboard)
27457      // 0x0010 - "dil10" // standard input (motherboard)
27458      PORT_MODIFY("IN-18")
27459      // 0x0001 - "dil11" // standard input (motherboard)
27460      // 0x0002 - "dil12" // standard input (motherboard)
27461      // 0x0004 - "dil13" // standard input (motherboard)
27462      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
27463      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
27464      PORT_MODIFY("IN-19")
27465      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
27466      PORT_MODIFY("IN-20")
27467      // 0x0001 - "grnbut" // standard input (motherboard)
27468      // 0x0002 - "dorlok" // standard input (expected here)
27469      // 0x0004 - "topdor" // standard input (expected here)
27470      // 0x0008 - "botdor" // standard input (expected here)
27471      // 0x0010 - "hopdmp" // standard input (expected here)
2747227472INPUT_PORTS_END
2747327473
2747427474// REEL7 ERR 27  (where does reel 7 connect?!)
r31373r31374
2750127501
2750227502
2750327503INPUT_PORTS_START( sc4jolly ) // this structure is generated
27504        PORT_INCLUDE( sc4_base )
27505        PORT_MODIFY("IN-1")
27506        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
27507        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27508        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
27509        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
27510        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exchge")
27511        PORT_MODIFY("IN-2")
27512        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("nudge")
27513        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27514        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27515        PORT_MODIFY("IN-8")
27516        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("hi 1")
27517        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("hi 2")
27518        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi 3")
27519        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lo 3")
27520        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lo 2")
27521        PORT_MODIFY("IN-9")
27522        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("lo 1")
27523        PORT_MODIFY("IN-16")
27524        // 0x0001 - "dil  1" // standard input (motherboard)
27525        // 0x0002 - "dil  2" // standard input (motherboard)
27526        // 0x0004 - "dil  3" // standard input (motherboard)
27527        // 0x0008 - "dil  4" // standard input (motherboard)
27528        // 0x0010 - "dil  5" // standard input (motherboard)
27529        // 0x0100 - "topup" // known extended input, usually 'top up'
27530        PORT_MODIFY("IN-17")
27531        // 0x0001 - "dil  6" // standard input (motherboard)
27532        // 0x0002 - "dil  7" // standard input (motherboard)
27533        // 0x0004 - "dil  8" // standard input (motherboard)
27534        // 0x0008 - "dil  9" // standard input (motherboard)
27535        // 0x0010 - "dil 10" // standard input (motherboard)
27536        PORT_MODIFY("IN-18")
27537        // 0x0001 - "dil 11" // standard input (motherboard)
27538        // 0x0002 - "dil 12" // standard input (motherboard)
27539        // 0x0004 - "dil 13" // standard input (motherboard)
27540        // 0x0008 - "dil 14" // standard input (motherboard)
27541        // 0x0010 - "dil 15" // standard input (motherboard)
27542        PORT_MODIFY("IN-19")
27543        // 0x0001 - "dil 16" // standard input (motherboard)
27544        PORT_MODIFY("IN-20")
27545        // 0x0001 - "test" // standard input (motherboard)
27546        // 0x0002 - "lock" // standard input (expected here)
27547        // 0x0004 - "topdor" // standard input (expected here)
27548        // 0x0008 - "botdor" // standard input (expected here)
27549        // 0x0010 - "hopdmp" // standard input (expected here)
27504      PORT_INCLUDE( sc4_base )
27505      PORT_MODIFY("IN-1")
27506      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
27507      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27508      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
27509      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
27510      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exchge")
27511      PORT_MODIFY("IN-2")
27512      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("nudge")
27513      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27514      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27515      PORT_MODIFY("IN-8")
27516      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("hi 1")
27517      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("hi 2")
27518      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi 3")
27519      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lo 3")
27520      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lo 2")
27521      PORT_MODIFY("IN-9")
27522      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("lo 1")
27523      PORT_MODIFY("IN-16")
27524      // 0x0001 - "dil  1" // standard input (motherboard)
27525      // 0x0002 - "dil  2" // standard input (motherboard)
27526      // 0x0004 - "dil  3" // standard input (motherboard)
27527      // 0x0008 - "dil  4" // standard input (motherboard)
27528      // 0x0010 - "dil  5" // standard input (motherboard)
27529      // 0x0100 - "topup" // known extended input, usually 'top up'
27530      PORT_MODIFY("IN-17")
27531      // 0x0001 - "dil  6" // standard input (motherboard)
27532      // 0x0002 - "dil  7" // standard input (motherboard)
27533      // 0x0004 - "dil  8" // standard input (motherboard)
27534      // 0x0008 - "dil  9" // standard input (motherboard)
27535      // 0x0010 - "dil 10" // standard input (motherboard)
27536      PORT_MODIFY("IN-18")
27537      // 0x0001 - "dil 11" // standard input (motherboard)
27538      // 0x0002 - "dil 12" // standard input (motherboard)
27539      // 0x0004 - "dil 13" // standard input (motherboard)
27540      // 0x0008 - "dil 14" // standard input (motherboard)
27541      // 0x0010 - "dil 15" // standard input (motherboard)
27542      PORT_MODIFY("IN-19")
27543      // 0x0001 - "dil 16" // standard input (motherboard)
27544      PORT_MODIFY("IN-20")
27545      // 0x0001 - "test" // standard input (motherboard)
27546      // 0x0002 - "lock" // standard input (expected here)
27547      // 0x0004 - "topdor" // standard input (expected here)
27548      // 0x0008 - "botdor" // standard input (expected here)
27549      // 0x0010 - "hopdmp" // standard input (expected here)
2755027550INPUT_PORTS_END
2755127551
2755227552// PR2054 JOLLY JOUSTINGV2.0         JJOLLSND          JOLLY JOUSTING
r31373r31374
2757827578
2757927579
2758027580INPUT_PORTS_START( sc4juicy ) // this structure is generated
27581        PORT_INCLUDE( sc4_base )
27582        PORT_MODIFY("IN-1")
27583        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
27584        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27585        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
27586        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
27587        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
27588        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
27589        PORT_MODIFY("IN-2")
27590        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
27591        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
27592        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27593        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27594        PORT_MODIFY("IN-4")
27595        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
27596        PORT_MODIFY("IN-16")
27597        // 0x0001 - "dil 1" // standard input (motherboard)
27598        // 0x0002 - "dil 2" // standard input (motherboard)
27599        // 0x0004 - "dil 3" // standard input (motherboard)
27600        // 0x0008 - "dil 4" // standard input (motherboard)
27601        // 0x0010 - "dil 5" // standard input (motherboard)
27602        // 0x0100 - "top up" // known extended input, usually 'top up'
27603        PORT_MODIFY("IN-17")
27604        // 0x0001 - "dil 6" // standard input (motherboard)
27605        // 0x0002 - "dil 7" // standard input (motherboard)
27606        // 0x0004 - "dil 8" // standard input (motherboard)
27607        // 0x0008 - "dil 9" // standard input (motherboard)
27608        // 0x0010 - "dil10" // standard input (motherboard)
27609        PORT_MODIFY("IN-18")
27610        // 0x0001 - "dil11" // standard input (motherboard)
27611        // 0x0002 - "dil12" // standard input (motherboard)
27612        // 0x0004 - "dil13" // standard input (motherboard)
27613        // 0x0008 - "dil14" // standard input (motherboard)
27614        // 0x0010 - "dil15" // standard input (motherboard)
27615        PORT_MODIFY("IN-19")
27616        // 0x0001 - "dil16" // standard input (motherboard)
27617        PORT_MODIFY("IN-20")
27618        // 0x0001 - "grnbut" // standard input (motherboard)
27619        // 0x0002 - "dorlok" // standard input (expected here)
27620        // 0x0004 - "topdor" // standard input (expected here)
27621        // 0x0008 - "botdor" // standard input (expected here)
27622        // 0x0010 - "hopdmp" // standard input (expected here)
27581      PORT_INCLUDE( sc4_base )
27582      PORT_MODIFY("IN-1")
27583      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
27584      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27585      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
27586      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
27587      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
27588      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
27589      PORT_MODIFY("IN-2")
27590      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
27591      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
27592      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27593      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27594      PORT_MODIFY("IN-4")
27595      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
27596      PORT_MODIFY("IN-16")
27597      // 0x0001 - "dil 1" // standard input (motherboard)
27598      // 0x0002 - "dil 2" // standard input (motherboard)
27599      // 0x0004 - "dil 3" // standard input (motherboard)
27600      // 0x0008 - "dil 4" // standard input (motherboard)
27601      // 0x0010 - "dil 5" // standard input (motherboard)
27602      // 0x0100 - "top up" // known extended input, usually 'top up'
27603      PORT_MODIFY("IN-17")
27604      // 0x0001 - "dil 6" // standard input (motherboard)
27605      // 0x0002 - "dil 7" // standard input (motherboard)
27606      // 0x0004 - "dil 8" // standard input (motherboard)
27607      // 0x0008 - "dil 9" // standard input (motherboard)
27608      // 0x0010 - "dil10" // standard input (motherboard)
27609      PORT_MODIFY("IN-18")
27610      // 0x0001 - "dil11" // standard input (motherboard)
27611      // 0x0002 - "dil12" // standard input (motherboard)
27612      // 0x0004 - "dil13" // standard input (motherboard)
27613      // 0x0008 - "dil14" // standard input (motherboard)
27614      // 0x0010 - "dil15" // standard input (motherboard)
27615      PORT_MODIFY("IN-19")
27616      // 0x0001 - "dil16" // standard input (motherboard)
27617      PORT_MODIFY("IN-20")
27618      // 0x0001 - "grnbut" // standard input (motherboard)
27619      // 0x0002 - "dorlok" // standard input (expected here)
27620      // 0x0004 - "topdor" // standard input (expected here)
27621      // 0x0008 - "botdor" // standard input (expected here)
27622      // 0x0010 - "hopdmp" // standard input (expected here)
2762327623INPUT_PORTS_END
2762427624
2762527625// PR1136 JUICY JACKPOTS 65% FERRY         PR1136 JUICY JACKPOTS SOUNDS11
r31373r31374
2765627656}
2765727657
2765827658INPUT_PORTS_START( sc4kalei ) // this structure is generated
27659        PORT_INCLUDE( sc4_base )
27660        PORT_MODIFY("IN-1")
27661        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
27662        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
27663        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
27664        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
27665        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
27666        PORT_MODIFY("IN-2")
27667        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
27668        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27669        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27670        PORT_MODIFY("IN-8")
27671        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudge")
27672        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
27673        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c pot")
27674        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shot")
27675        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("streak")
27676        PORT_MODIFY("IN-16")
27677        // 0x0001 - "dil  1" // standard input (motherboard)
27678        // 0x0002 - "dil  2" // standard input (motherboard)
27679        // 0x0004 - "dil  3" // standard input (motherboard)
27680        // 0x0008 - "dil  4" // standard input (motherboard)
27681        // 0x0010 - "dil  5" // standard input (motherboard)
27682        // 0x0100 - "topup" // known extended input, usually 'top up'
27683        PORT_MODIFY("IN-17")
27684        // 0x0001 - "dil  6" // standard input (motherboard)
27685        // 0x0002 - "dil  7" // standard input (motherboard)
27686        // 0x0004 - "dil  8" // standard input (motherboard)
27687        // 0x0008 - "dil  9" // standard input (motherboard)
27688        // 0x0010 - "dil 10" // standard input (motherboard)
27689        PORT_MODIFY("IN-18")
27690        // 0x0001 - "dil 11" // standard input (motherboard)
27691        // 0x0002 - "dil 12" // standard input (motherboard)
27692        // 0x0004 - "dil 13" // standard input (motherboard)
27693        // 0x0008 - "dil 14" // standard input (motherboard)
27694        // 0x0010 - "dil 15" // standard input (motherboard)
27695        PORT_MODIFY("IN-19")
27696        // 0x0001 - "dil 16" // standard input (motherboard)
27697        PORT_MODIFY("IN-20")
27698        // 0x0001 - "test" // standard input (motherboard)
27699        // 0x0002 - "lock" // standard input (expected here)
27700        // 0x0004 - "topdor" // standard input (expected here)
27701        // 0x0008 - "botdor" // standard input (expected here)
27702        // 0x0010 - "hopdmp" // standard input (expected here)
27659      PORT_INCLUDE( sc4_base )
27660      PORT_MODIFY("IN-1")
27661      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
27662      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
27663      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
27664      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
27665      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
27666      PORT_MODIFY("IN-2")
27667      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
27668      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27669      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27670      PORT_MODIFY("IN-8")
27671      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudge")
27672      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
27673      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c pot")
27674      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shot")
27675      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("streak")
27676      PORT_MODIFY("IN-16")
27677      // 0x0001 - "dil  1" // standard input (motherboard)
27678      // 0x0002 - "dil  2" // standard input (motherboard)
27679      // 0x0004 - "dil  3" // standard input (motherboard)
27680      // 0x0008 - "dil  4" // standard input (motherboard)
27681      // 0x0010 - "dil  5" // standard input (motherboard)
27682      // 0x0100 - "topup" // known extended input, usually 'top up'
27683      PORT_MODIFY("IN-17")
27684      // 0x0001 - "dil  6" // standard input (motherboard)
27685      // 0x0002 - "dil  7" // standard input (motherboard)
27686      // 0x0004 - "dil  8" // standard input (motherboard)
27687      // 0x0008 - "dil  9" // standard input (motherboard)
27688      // 0x0010 - "dil 10" // standard input (motherboard)
27689      PORT_MODIFY("IN-18")
27690      // 0x0001 - "dil 11" // standard input (motherboard)
27691      // 0x0002 - "dil 12" // standard input (motherboard)
27692      // 0x0004 - "dil 13" // standard input (motherboard)
27693      // 0x0008 - "dil 14" // standard input (motherboard)
27694      // 0x0010 - "dil 15" // standard input (motherboard)
27695      PORT_MODIFY("IN-19")
27696      // 0x0001 - "dil 16" // standard input (motherboard)
27697      PORT_MODIFY("IN-20")
27698      // 0x0001 - "test" // standard input (motherboard)
27699      // 0x0002 - "lock" // standard input (expected here)
27700      // 0x0004 - "topdor" // standard input (expected here)
27701      // 0x0008 - "botdor" // standard input (expected here)
27702      // 0x0010 - "hopdmp" // standard input (expected here)
2770327703INPUT_PORTS_END
2770427704
2770527705// PR2538 KALEIDOSCOPE 011         KALEIDOSCOPESND           KALEIDOSCOPE
r31373r31374
2772927729}
2773027730
2773127731INPUT_PORTS_START( sc4lir ) // this structure is generated
27732        PORT_INCLUDE( sc4_base )
27733        PORT_MODIFY("IN-1")
27734        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
27735        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
27736        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
27737        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
27738        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
27739        PORT_MODIFY("IN-2")
27740        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
27741        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27742        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27743        PORT_MODIFY("IN-8")
27744        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk dic")
27745        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk thr")
27746        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bon")
27747        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk csh")
27748        PORT_MODIFY("IN-16")
27749        // 0x0001 - "dils 1" // standard input (motherboard)
27750        // 0x0002 - "dils 2" // standard input (motherboard)
27751        // 0x0004 - "dils 3" // standard input (motherboard)
27752        // 0x0008 - "dils 4" // standard input (motherboard)
27753        // 0x0010 - "dils 5" // standard input (motherboard)
27754        PORT_MODIFY("IN-17")
27755        // 0x0001 - "dils 6" // standard input (motherboard)
27756        // 0x0002 - "dils 7" // standard input (motherboard)
27757        // 0x0004 - "dils 8" // standard input (motherboard)
27758        // 0x0008 - "dils 9" // standard input (motherboard)
27759        // 0x0010 - "dils10" // standard input (motherboard)
27760        PORT_MODIFY("IN-18")
27761        // 0x0001 - "dils11" // standard input (motherboard)
27762        // 0x0002 - "dils12" // standard input (motherboard)
27763        // 0x0004 - "dils13" // standard input (motherboard)
27764        // 0x0008 - "dils14" // standard input (motherboard)
27765        // 0x0010 - "dils15" // standard input (motherboard)
27766        PORT_MODIFY("IN-19")
27767        // 0x0001 - "dils16" // standard input (motherboard)
27768        PORT_MODIFY("IN-20")
27769        // 0x0001 - "grnbut" // standard input (motherboard)
27770        // 0x0002 - "dorlok" // standard input (expected here)
27771        // 0x0004 - "topdor" // standard input (expected here)
27772        // 0x0008 - "botdor" // standard input (expected here)
27732      PORT_INCLUDE( sc4_base )
27733      PORT_MODIFY("IN-1")
27734      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
27735      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
27736      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
27737      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
27738      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
27739      PORT_MODIFY("IN-2")
27740      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
27741      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27742      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27743      PORT_MODIFY("IN-8")
27744      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk dic")
27745      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk thr")
27746      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bon")
27747      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk csh")
27748      PORT_MODIFY("IN-16")
27749      // 0x0001 - "dils 1" // standard input (motherboard)
27750      // 0x0002 - "dils 2" // standard input (motherboard)
27751      // 0x0004 - "dils 3" // standard input (motherboard)
27752      // 0x0008 - "dils 4" // standard input (motherboard)
27753      // 0x0010 - "dils 5" // standard input (motherboard)
27754      PORT_MODIFY("IN-17")
27755      // 0x0001 - "dils 6" // standard input (motherboard)
27756      // 0x0002 - "dils 7" // standard input (motherboard)
27757      // 0x0004 - "dils 8" // standard input (motherboard)
27758      // 0x0008 - "dils 9" // standard input (motherboard)
27759      // 0x0010 - "dils10" // standard input (motherboard)
27760      PORT_MODIFY("IN-18")
27761      // 0x0001 - "dils11" // standard input (motherboard)
27762      // 0x0002 - "dils12" // standard input (motherboard)
27763      // 0x0004 - "dils13" // standard input (motherboard)
27764      // 0x0008 - "dils14" // standard input (motherboard)
27765      // 0x0010 - "dils15" // standard input (motherboard)
27766      PORT_MODIFY("IN-19")
27767      // 0x0001 - "dils16" // standard input (motherboard)
27768      PORT_MODIFY("IN-20")
27769      // 0x0001 - "grnbut" // standard input (motherboard)
27770      // 0x0002 - "dorlok" // standard input (expected here)
27771      // 0x0004 - "topdor" // standard input (expected here)
27772      // 0x0008 - "botdor" // standard input (expected here)
2777327773INPUT_PORTS_END
2777427774
2777527775// PR1001  LET IT ROLL         PR1001 LETITROLL SOUNDS11
r31373r31374
2780227802}
2780327803
2780427804INPUT_PORTS_START( sc4ldvcl ) // this structure is generated
27805        PORT_INCLUDE( sc4_base )
27806        PORT_MODIFY("IN-1")
27807        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
27808        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27809        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
27810        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
27811        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
27812        PORT_MODIFY("IN-2")
27813        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
27814        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
27815        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("xfer")
27816        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27817        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
27818        PORT_MODIFY("IN-3")
27819        // 0x0004 - "stk 4" // standard input (expected here)
27820        // 0x0008 - "stk 3" // standard input (expected here)
27821        // 0x0010 - "stk 2" // standard input (expected here)
27822        PORT_MODIFY("IN-4")
27823        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
27824        PORT_MODIFY("IN-5")
27825        // 0x0001 - "priz4" // standard input (expected here)
27826        // 0x0002 - "priz3" // standard input (expected here)
27827        // 0x0004 - "priz2" // standard input (expected here)
27828        // 0x0008 - "priz1" // standard input (expected here)
27829        PORT_MODIFY("IN-8")
27830        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
27831        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("mov up")
27832        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("pick")
27833        PORT_MODIFY("IN-16")
27834        // 0x0001 - "dil 1" // standard input (motherboard)
27835        // 0x0002 - "dil 2" // standard input (motherboard)
27836        // 0x0004 - "dil 3" // standard input (motherboard)
27837        // 0x0008 - "dil 4" // standard input (motherboard)
27838        // 0x0010 - "dil 5" // standard input (motherboard)
27839        // 0x0100 - "top up" // known extended input, usually 'top up'
27840        PORT_MODIFY("IN-17")
27841        // 0x0001 - "dil 6" // standard input (motherboard)
27842        // 0x0002 - "dil 7" // standard input (motherboard)
27843        // 0x0004 - "dil 8" // standard input (motherboard)
27844        // 0x0008 - "dil 9" // standard input (motherboard)
27845        // 0x0010 - "dil10" // standard input (motherboard)
27846        PORT_MODIFY("IN-18")
27847        // 0x0001 - "dil11" // standard input (motherboard)
27848        // 0x0002 - "dil12" // standard input (motherboard)
27849        // 0x0004 - "dil13" // standard input (motherboard)
27850        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
27851        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
27852        PORT_MODIFY("IN-19")
27853        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
27854        PORT_MODIFY("IN-20")
27855        // 0x0001 - "grnbut" // standard input (motherboard)
27856        // 0x0002 - "dorlok" // standard input (expected here)
27857        // 0x0004 - "topdor" // standard input (expected here)
27858        // 0x0008 - "botdor" // standard input (expected here)
27859        // 0x0010 - "hopdmp" // standard input (expected here)
27805      PORT_INCLUDE( sc4_base )
27806      PORT_MODIFY("IN-1")
27807      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
27808      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27809      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
27810      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
27811      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
27812      PORT_MODIFY("IN-2")
27813      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
27814      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
27815      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("xfer")
27816      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27817      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
27818      PORT_MODIFY("IN-3")
27819      // 0x0004 - "stk 4" // standard input (expected here)
27820      // 0x0008 - "stk 3" // standard input (expected here)
27821      // 0x0010 - "stk 2" // standard input (expected here)
27822      PORT_MODIFY("IN-4")
27823      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
27824      PORT_MODIFY("IN-5")
27825      // 0x0001 - "priz4" // standard input (expected here)
27826      // 0x0002 - "priz3" // standard input (expected here)
27827      // 0x0004 - "priz2" // standard input (expected here)
27828      // 0x0008 - "priz1" // standard input (expected here)
27829      PORT_MODIFY("IN-8")
27830      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
27831      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("mov up")
27832      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("pick")
27833      PORT_MODIFY("IN-16")
27834      // 0x0001 - "dil 1" // standard input (motherboard)
27835      // 0x0002 - "dil 2" // standard input (motherboard)
27836      // 0x0004 - "dil 3" // standard input (motherboard)
27837      // 0x0008 - "dil 4" // standard input (motherboard)
27838      // 0x0010 - "dil 5" // standard input (motherboard)
27839      // 0x0100 - "top up" // known extended input, usually 'top up'
27840      PORT_MODIFY("IN-17")
27841      // 0x0001 - "dil 6" // standard input (motherboard)
27842      // 0x0002 - "dil 7" // standard input (motherboard)
27843      // 0x0004 - "dil 8" // standard input (motherboard)
27844      // 0x0008 - "dil 9" // standard input (motherboard)
27845      // 0x0010 - "dil10" // standard input (motherboard)
27846      PORT_MODIFY("IN-18")
27847      // 0x0001 - "dil11" // standard input (motherboard)
27848      // 0x0002 - "dil12" // standard input (motherboard)
27849      // 0x0004 - "dil13" // standard input (motherboard)
27850      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
27851      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
27852      PORT_MODIFY("IN-19")
27853      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
27854      PORT_MODIFY("IN-20")
27855      // 0x0001 - "grnbut" // standard input (motherboard)
27856      // 0x0002 - "dorlok" // standard input (expected here)
27857      // 0x0004 - "topdor" // standard input (expected here)
27858      // 0x0008 - "botdor" // standard input (expected here)
27859      // 0x0010 - "hopdmp" // standard input (expected here)
2786027860INPUT_PORTS_END
2786127861
2786227862// PR2421 LITTLEDEVIL         CLUB LITTLEDEVIL  CLUB  CLILDEV SOUNDS         CLUB LITTLEDEVIL
r31373r31374
2787927879}
2788027880
2788127881INPUT_PORTS_START( sc4lockb ) // this structure is generated
27882        PORT_INCLUDE( sc4_base )
27883        PORT_MODIFY("IN-1")
27884        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
27885        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
27886        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
27887        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
27888        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
27889        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
27890        PORT_MODIFY("IN-2")
27891        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
27892        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27893        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27894        PORT_MODIFY("IN-3")
27895        // 0x0004 - "stk 4" // standard input (expected here)
27896        // 0x0008 - "stk 3" // standard input (expected here)
27897        // 0x0010 - "stk 2" // standard input (expected here)
27898        PORT_MODIFY("IN-4")
27899        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
27900        PORT_MODIFY("IN-5")
27901        // 0x0001 - "priz4" // standard input (expected here)
27902        // 0x0002 - "priz3" // standard input (expected here)
27903        // 0x0004 - "priz2" // standard input (expected here)
27904        // 0x0008 - "priz1" // standard input (expected here)
27905        PORT_MODIFY("IN-6")
27906        // 0x0001 - "perc1" // standard input (expected here)
27907        // 0x0002 - "perc2" // standard input (expected here)
27908        // 0x0004 - "perc3" // standard input (expected here)
27909        // 0x0008 - "perc4" // standard input (expected here)
27910        PORT_MODIFY("IN-8")
27911        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
27912        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
27913        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("shoot")
27914        PORT_MODIFY("IN-16")
27915        // 0x0001 - "dil 1" // standard input (motherboard)
27916        // 0x0002 - "dil 2" // standard input (motherboard)
27917        // 0x0004 - "dil 3" // standard input (motherboard)
27918        // 0x0008 - "dil 4" // standard input (motherboard)
27919        // 0x0010 - "dil 5" // standard input (motherboard)
27920        // 0x0100 - "htopup" // known extended input, usually 'top up'
27921        PORT_MODIFY("IN-17")
27922        // 0x0001 - "dil 6" // standard input (motherboard)
27923        // 0x0002 - "dil 7" // standard input (motherboard)
27924        // 0x0004 - "dil 8" // standard input (motherboard)
27925        // 0x0008 - "dil 9" // standard input (motherboard)
27926        // 0x0010 - "dil 10" // standard input (motherboard)
27927        PORT_MODIFY("IN-18")
27928        // 0x0001 - "dil 11" // standard input (motherboard)
27929        // 0x0002 - "dil 12" // standard input (motherboard)
27930        // 0x0004 - "dil 13" // standard input (motherboard)
27931        // 0x0008 - "dil 14" // standard input (motherboard)
27932        // 0x0010 - "dil 15" // standard input (motherboard)
27933        PORT_MODIFY("IN-19")
27934        // 0x0001 - "dil 16" // standard input (motherboard)
27935        PORT_MODIFY("IN-20")
27936        // 0x0001 - "grnbut" // standard input (motherboard)
27937        // 0x0002 - "dorlok" // standard input (expected here)
27938        // 0x0004 - "serdor" // standard input (expected here)
27939        // 0x0008 - "cshdor" // standard input (expected here)
27940        // 0x0010 - "hopdmp" // standard input (expected here)
27882      PORT_INCLUDE( sc4_base )
27883      PORT_MODIFY("IN-1")
27884      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
27885      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
27886      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
27887      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
27888      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
27889      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
27890      PORT_MODIFY("IN-2")
27891      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
27892      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27893      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27894      PORT_MODIFY("IN-3")
27895      // 0x0004 - "stk 4" // standard input (expected here)
27896      // 0x0008 - "stk 3" // standard input (expected here)
27897      // 0x0010 - "stk 2" // standard input (expected here)
27898      PORT_MODIFY("IN-4")
27899      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
27900      PORT_MODIFY("IN-5")
27901      // 0x0001 - "priz4" // standard input (expected here)
27902      // 0x0002 - "priz3" // standard input (expected here)
27903      // 0x0004 - "priz2" // standard input (expected here)
27904      // 0x0008 - "priz1" // standard input (expected here)
27905      PORT_MODIFY("IN-6")
27906      // 0x0001 - "perc1" // standard input (expected here)
27907      // 0x0002 - "perc2" // standard input (expected here)
27908      // 0x0004 - "perc3" // standard input (expected here)
27909      // 0x0008 - "perc4" // standard input (expected here)
27910      PORT_MODIFY("IN-8")
27911      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
27912      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
27913      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("shoot")
27914      PORT_MODIFY("IN-16")
27915      // 0x0001 - "dil 1" // standard input (motherboard)
27916      // 0x0002 - "dil 2" // standard input (motherboard)
27917      // 0x0004 - "dil 3" // standard input (motherboard)
27918      // 0x0008 - "dil 4" // standard input (motherboard)
27919      // 0x0010 - "dil 5" // standard input (motherboard)
27920      // 0x0100 - "htopup" // known extended input, usually 'top up'
27921      PORT_MODIFY("IN-17")
27922      // 0x0001 - "dil 6" // standard input (motherboard)
27923      // 0x0002 - "dil 7" // standard input (motherboard)
27924      // 0x0004 - "dil 8" // standard input (motherboard)
27925      // 0x0008 - "dil 9" // standard input (motherboard)
27926      // 0x0010 - "dil 10" // standard input (motherboard)
27927      PORT_MODIFY("IN-18")
27928      // 0x0001 - "dil 11" // standard input (motherboard)
27929      // 0x0002 - "dil 12" // standard input (motherboard)
27930      // 0x0004 - "dil 13" // standard input (motherboard)
27931      // 0x0008 - "dil 14" // standard input (motherboard)
27932      // 0x0010 - "dil 15" // standard input (motherboard)
27933      PORT_MODIFY("IN-19")
27934      // 0x0001 - "dil 16" // standard input (motherboard)
27935      PORT_MODIFY("IN-20")
27936      // 0x0001 - "grnbut" // standard input (motherboard)
27937      // 0x0002 - "dorlok" // standard input (expected here)
27938      // 0x0004 - "serdor" // standard input (expected here)
27939      // 0x0008 - "cshdor" // standard input (expected here)
27940      // 0x0010 - "hopdmp" // standard input (expected here)
2794127941INPUT_PORTS_END
2794227942
2794327943// PR1108 LOCKBUSTER         PR1108 LOCKBUSTER SOUNDS11
r31373r31374
2797327973}
2797427974
2797527975INPUT_PORTS_START( sc4lkbcl ) // this structure is generated
27976        PORT_INCLUDE( sc4_base )
27977        PORT_MODIFY("IN-1")
27978        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
27979        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27980        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
27981        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
27982        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
27983        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
27984        PORT_MODIFY("IN-2")
27985        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
27986        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
27987        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27988        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27989        PORT_MODIFY("IN-3")
27990        // 0x0004 - "stk 4" // standard input (expected here)
27991        // 0x0008 - "stk 3" // standard input (expected here)
27992        // 0x0010 - "stk 2" // standard input (expected here)
27993        PORT_MODIFY("IN-4")
27994        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
27995        PORT_MODIFY("IN-5")
27996        // 0x0001 - "priz4" // standard input (expected here)
27997        // 0x0002 - "priz3" // standard input (expected here)
27998        // 0x0004 - "priz2" // standard input (expected here)
27999        // 0x0008 - "priz1" // standard input (expected here)
28000        PORT_MODIFY("IN-8")
28001        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("t.cash")
28002        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
28003        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("shoot")
28004        PORT_MODIFY("IN-16")
28005        // 0x0001 - "dil 1" // standard input (motherboard)
28006        // 0x0002 - "dil 2" // standard input (motherboard)
28007        // 0x0004 - "dil 3" // standard input (motherboard)
28008        // 0x0008 - "dil 4" // standard input (motherboard)
28009        // 0x0010 - "dil 5" // standard input (motherboard)
28010        // 0x0100 - "top up" // known extended input, usually 'top up'
28011        PORT_MODIFY("IN-17")
28012        // 0x0001 - "dil 6" // standard input (motherboard)
28013        // 0x0002 - "dil 7" // standard input (motherboard)
28014        // 0x0004 - "dil 8" // standard input (motherboard)
28015        // 0x0008 - "dil 9" // standard input (motherboard)
28016        // 0x0010 - "dil10" // standard input (motherboard)
28017        PORT_MODIFY("IN-18")
28018        // 0x0001 - "dil11" // standard input (motherboard)
28019        // 0x0002 - "dil12" // standard input (motherboard)
28020        // 0x0004 - "dil13" // standard input (motherboard)
28021        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
28022        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
28023        PORT_MODIFY("IN-19")
28024        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
28025        PORT_MODIFY("IN-20")
28026        // 0x0001 - "grnbut" // standard input (motherboard)
28027        // 0x0002 - "dorlok" // standard input (expected here)
28028        // 0x0004 - "topdor" // standard input (expected here)
28029        // 0x0008 - "botdor" // standard input (expected here)
28030        // 0x0010 - "hopdmp" // standard input (expected here)
27976      PORT_INCLUDE( sc4_base )
27977      PORT_MODIFY("IN-1")
27978      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
27979      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
27980      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
27981      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
27982      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
27983      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
27984      PORT_MODIFY("IN-2")
27985      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
27986      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
27987      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
27988      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
27989      PORT_MODIFY("IN-3")
27990      // 0x0004 - "stk 4" // standard input (expected here)
27991      // 0x0008 - "stk 3" // standard input (expected here)
27992      // 0x0010 - "stk 2" // standard input (expected here)
27993      PORT_MODIFY("IN-4")
27994      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
27995      PORT_MODIFY("IN-5")
27996      // 0x0001 - "priz4" // standard input (expected here)
27997      // 0x0002 - "priz3" // standard input (expected here)
27998      // 0x0004 - "priz2" // standard input (expected here)
27999      // 0x0008 - "priz1" // standard input (expected here)
28000      PORT_MODIFY("IN-8")
28001      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("t.cash")
28002      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
28003      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("shoot")
28004      PORT_MODIFY("IN-16")
28005      // 0x0001 - "dil 1" // standard input (motherboard)
28006      // 0x0002 - "dil 2" // standard input (motherboard)
28007      // 0x0004 - "dil 3" // standard input (motherboard)
28008      // 0x0008 - "dil 4" // standard input (motherboard)
28009      // 0x0010 - "dil 5" // standard input (motherboard)
28010      // 0x0100 - "top up" // known extended input, usually 'top up'
28011      PORT_MODIFY("IN-17")
28012      // 0x0001 - "dil 6" // standard input (motherboard)
28013      // 0x0002 - "dil 7" // standard input (motherboard)
28014      // 0x0004 - "dil 8" // standard input (motherboard)
28015      // 0x0008 - "dil 9" // standard input (motherboard)
28016      // 0x0010 - "dil10" // standard input (motherboard)
28017      PORT_MODIFY("IN-18")
28018      // 0x0001 - "dil11" // standard input (motherboard)
28019      // 0x0002 - "dil12" // standard input (motherboard)
28020      // 0x0004 - "dil13" // standard input (motherboard)
28021      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
28022      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
28023      PORT_MODIFY("IN-19")
28024      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
28025      PORT_MODIFY("IN-20")
28026      // 0x0001 - "grnbut" // standard input (motherboard)
28027      // 0x0002 - "dorlok" // standard input (expected here)
28028      // 0x0004 - "topdor" // standard input (expected here)
28029      // 0x0008 - "botdor" // standard input (expected here)
28030      // 0x0010 - "hopdmp" // standard input (expected here)
2803128031INPUT_PORTS_END
2803228032
2803328033// PR1321 CLUB LOCKBUSTER         PR1321 CLUB LOCKBUSTER SOUNDS11
r31373r31374
2806328063}
2806428064
2806528065INPUT_PORTS_START( sc4lotrf ) // this structure is generated
28066        PORT_INCLUDE( sc4_base )
28067        PORT_MODIFY("IN-1")
28068        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28069        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
28070        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
28071        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
28072        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
28073        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
28074        PORT_MODIFY("IN-2")
28075        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("shuffl")
28076        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28077        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28078        PORT_MODIFY("IN-3")
28079        // 0x0004 - "stk 4" // standard input (expected here)
28080        // 0x0008 - "stk 3" // standard input (expected here)
28081        // 0x0010 - "stk 2" // standard input (expected here)
28082        PORT_MODIFY("IN-4")
28083        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
28084        PORT_MODIFY("IN-5")
28085        // 0x0001 - "priz4" // standard input (expected here)
28086        // 0x0002 - "priz3" // standard input (expected here)
28087        // 0x0004 - "priz2" // standard input (expected here)
28088        // 0x0008 - "priz1" // standard input (expected here)
28089        PORT_MODIFY("IN-6")
28090        // 0x0001 - "perc1" // standard input (expected here)
28091        // 0x0002 - "perc2" // standard input (expected here)
28092        // 0x0004 - "perc3" // standard input (expected here)
28093        // 0x0008 - "perc4" // standard input (expected here)
28094        PORT_MODIFY("IN-8")
28095        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("auto n")
28096        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk fet")
28097        PORT_MODIFY("IN-16")
28098        // 0x0001 - "dil 1" // standard input (motherboard)
28099        // 0x0002 - "dil 2" // standard input (motherboard)
28100        // 0x0004 - "dil 3" // standard input (motherboard)
28101        // 0x0008 - "dil 4" // standard input (motherboard)
28102        // 0x0010 - "dil 5" // standard input (motherboard)
28103        // 0x0100 - "htopup" // known extended input, usually 'top up'
28104        PORT_MODIFY("IN-17")
28105        // 0x0001 - "dil 6" // standard input (motherboard)
28106        // 0x0002 - "dil 7" // standard input (motherboard)
28107        // 0x0004 - "dil 8" // standard input (motherboard)
28108        // 0x0008 - "dil 9" // standard input (motherboard)
28109        // 0x0010 - "dil 10" // standard input (motherboard)
28110        PORT_MODIFY("IN-18")
28111        // 0x0001 - "dil 11" // standard input (motherboard)
28112        // 0x0002 - "dil 12" // standard input (motherboard)
28113        // 0x0004 - "dil 13" // standard input (motherboard)
28114        // 0x0008 - "dil 14" // standard input (motherboard)
28115        // 0x0010 - "dil 15" // standard input (motherboard)
28116        PORT_MODIFY("IN-19")
28117        // 0x0001 - "dil 16" // standard input (motherboard)
28118        PORT_MODIFY("IN-20")
28119        // 0x0001 - "grnbut" // standard input (motherboard)
28120        // 0x0002 - "dorlok" // standard input (expected here)
28121        // 0x0004 - "serdor" // standard input (expected here)
28122        // 0x0008 - "cshdor" // standard input (expected here)
28123        // 0x0010 - "hopdmp" // standard input (expected here)
28066      PORT_INCLUDE( sc4_base )
28067      PORT_MODIFY("IN-1")
28068      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28069      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
28070      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
28071      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
28072      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
28073      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
28074      PORT_MODIFY("IN-2")
28075      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("shuffl")
28076      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28077      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28078      PORT_MODIFY("IN-3")
28079      // 0x0004 - "stk 4" // standard input (expected here)
28080      // 0x0008 - "stk 3" // standard input (expected here)
28081      // 0x0010 - "stk 2" // standard input (expected here)
28082      PORT_MODIFY("IN-4")
28083      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
28084      PORT_MODIFY("IN-5")
28085      // 0x0001 - "priz4" // standard input (expected here)
28086      // 0x0002 - "priz3" // standard input (expected here)
28087      // 0x0004 - "priz2" // standard input (expected here)
28088      // 0x0008 - "priz1" // standard input (expected here)
28089      PORT_MODIFY("IN-6")
28090      // 0x0001 - "perc1" // standard input (expected here)
28091      // 0x0002 - "perc2" // standard input (expected here)
28092      // 0x0004 - "perc3" // standard input (expected here)
28093      // 0x0008 - "perc4" // standard input (expected here)
28094      PORT_MODIFY("IN-8")
28095      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("auto n")
28096      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk fet")
28097      PORT_MODIFY("IN-16")
28098      // 0x0001 - "dil 1" // standard input (motherboard)
28099      // 0x0002 - "dil 2" // standard input (motherboard)
28100      // 0x0004 - "dil 3" // standard input (motherboard)
28101      // 0x0008 - "dil 4" // standard input (motherboard)
28102      // 0x0010 - "dil 5" // standard input (motherboard)
28103      // 0x0100 - "htopup" // known extended input, usually 'top up'
28104      PORT_MODIFY("IN-17")
28105      // 0x0001 - "dil 6" // standard input (motherboard)
28106      // 0x0002 - "dil 7" // standard input (motherboard)
28107      // 0x0004 - "dil 8" // standard input (motherboard)
28108      // 0x0008 - "dil 9" // standard input (motherboard)
28109      // 0x0010 - "dil 10" // standard input (motherboard)
28110      PORT_MODIFY("IN-18")
28111      // 0x0001 - "dil 11" // standard input (motherboard)
28112      // 0x0002 - "dil 12" // standard input (motherboard)
28113      // 0x0004 - "dil 13" // standard input (motherboard)
28114      // 0x0008 - "dil 14" // standard input (motherboard)
28115      // 0x0010 - "dil 15" // standard input (motherboard)
28116      PORT_MODIFY("IN-19")
28117      // 0x0001 - "dil 16" // standard input (motherboard)
28118      PORT_MODIFY("IN-20")
28119      // 0x0001 - "grnbut" // standard input (motherboard)
28120      // 0x0002 - "dorlok" // standard input (expected here)
28121      // 0x0004 - "serdor" // standard input (expected here)
28122      // 0x0008 - "cshdor" // standard input (expected here)
28123      // 0x0010 - "hopdmp" // standard input (expected here)
2812428124INPUT_PORTS_END
2812528125
2812628126// PR1115 LORD OF THE RINGS         PR1115 L O T RINGS SOUNDS11
r31373r31374
2816028160}
2816128161
2816228162INPUT_PORTS_START( sc4lotr2 ) // this structure is generated
28163        PORT_INCLUDE( sc4_base )
28164        PORT_MODIFY("IN-1")
28165        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28166        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
28167        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
28168        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
28169        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
28170        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
28171        PORT_MODIFY("IN-2")
28172        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
28173        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28174        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28175        PORT_MODIFY("IN-3")
28176        // 0x0004 - "stk 4" // standard input (expected here)
28177        // 0x0008 - "stk 3" // standard input (expected here)
28178        // 0x0010 - "stk 2" // standard input (expected here)
28179        PORT_MODIFY("IN-4")
28180        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
28181        PORT_MODIFY("IN-5")
28182        // 0x0001 - "priz4" // standard input (expected here)
28183        // 0x0002 - "priz3" // standard input (expected here)
28184        // 0x0004 - "priz2" // standard input (expected here)
28185        // 0x0008 - "priz1" // standard input (expected here)
28186        PORT_MODIFY("IN-6")
28187        // 0x0001 - "perc1" // standard input (expected here)
28188        // 0x0002 - "perc2" // standard input (expected here)
28189        // 0x0004 - "perc3" // standard input (expected here)
28190        // 0x0008 - "perc4" // standard input (expected here)
28191        PORT_MODIFY("IN-8")
28192        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
28193        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shoot")
28194        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spins")
28195        PORT_MODIFY("IN-16")
28196        // 0x0001 - "dil1" // standard input (motherboard)
28197        // 0x0002 - "dil2" // standard input (motherboard)
28198        // 0x0004 - "dil3" // standard input (motherboard)
28199        // 0x0008 - "dil4" // standard input (motherboard)
28200        // 0x0010 - "dil5" // standard input (motherboard)
28201        // 0x0100 - "htopup" // known extended input, usually 'top up'
28202        PORT_MODIFY("IN-17")
28203        // 0x0001 - "dil6" // standard input (motherboard)
28204        // 0x0002 - "dil7" // standard input (motherboard)
28205        // 0x0004 - "dil8" // standard input (motherboard)
28206        // 0x0008 - "dil9" // standard input (motherboard)
28207        // 0x0010 - "dil10" // standard input (motherboard)
28208        PORT_MODIFY("IN-18")
28209        // 0x0001 - "dil11" // standard input (motherboard)
28210        // 0x0002 - "dil12" // standard input (motherboard)
28211        // 0x0004 - "dil13" // standard input (motherboard)
28212        // 0x0008 - "dil14" // standard input (motherboard)
28213        // 0x0010 - "dil15" // standard input (motherboard)
28214        PORT_MODIFY("IN-19")
28215        // 0x0001 - "dil16" // standard input (motherboard)
28216        PORT_MODIFY("IN-20")
28217        // 0x0001 - "grnbut" // standard input (motherboard)
28218        // 0x0002 - "dorlok" // standard input (expected here)
28219        // 0x0004 - "serdor" // standard input (expected here)
28220        // 0x0008 - "cshdor" // standard input (expected here)
28221        // 0x0010 - "hopdmp" // standard input (expected here)
28163      PORT_INCLUDE( sc4_base )
28164      PORT_MODIFY("IN-1")
28165      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28166      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
28167      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
28168      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
28169      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
28170      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
28171      PORT_MODIFY("IN-2")
28172      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
28173      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28174      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28175      PORT_MODIFY("IN-3")
28176      // 0x0004 - "stk 4" // standard input (expected here)
28177      // 0x0008 - "stk 3" // standard input (expected here)
28178      // 0x0010 - "stk 2" // standard input (expected here)
28179      PORT_MODIFY("IN-4")
28180      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
28181      PORT_MODIFY("IN-5")
28182      // 0x0001 - "priz4" // standard input (expected here)
28183      // 0x0002 - "priz3" // standard input (expected here)
28184      // 0x0004 - "priz2" // standard input (expected here)
28185      // 0x0008 - "priz1" // standard input (expected here)
28186      PORT_MODIFY("IN-6")
28187      // 0x0001 - "perc1" // standard input (expected here)
28188      // 0x0002 - "perc2" // standard input (expected here)
28189      // 0x0004 - "perc3" // standard input (expected here)
28190      // 0x0008 - "perc4" // standard input (expected here)
28191      PORT_MODIFY("IN-8")
28192      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
28193      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shoot")
28194      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spins")
28195      PORT_MODIFY("IN-16")
28196      // 0x0001 - "dil1" // standard input (motherboard)
28197      // 0x0002 - "dil2" // standard input (motherboard)
28198      // 0x0004 - "dil3" // standard input (motherboard)
28199      // 0x0008 - "dil4" // standard input (motherboard)
28200      // 0x0010 - "dil5" // standard input (motherboard)
28201      // 0x0100 - "htopup" // known extended input, usually 'top up'
28202      PORT_MODIFY("IN-17")
28203      // 0x0001 - "dil6" // standard input (motherboard)
28204      // 0x0002 - "dil7" // standard input (motherboard)
28205      // 0x0004 - "dil8" // standard input (motherboard)
28206      // 0x0008 - "dil9" // standard input (motherboard)
28207      // 0x0010 - "dil10" // standard input (motherboard)
28208      PORT_MODIFY("IN-18")
28209      // 0x0001 - "dil11" // standard input (motherboard)
28210      // 0x0002 - "dil12" // standard input (motherboard)
28211      // 0x0004 - "dil13" // standard input (motherboard)
28212      // 0x0008 - "dil14" // standard input (motherboard)
28213      // 0x0010 - "dil15" // standard input (motherboard)
28214      PORT_MODIFY("IN-19")
28215      // 0x0001 - "dil16" // standard input (motherboard)
28216      PORT_MODIFY("IN-20")
28217      // 0x0001 - "grnbut" // standard input (motherboard)
28218      // 0x0002 - "dorlok" // standard input (expected here)
28219      // 0x0004 - "serdor" // standard input (expected here)
28220      // 0x0008 - "cshdor" // standard input (expected here)
28221      // 0x0010 - "hopdmp" // standard input (expected here)
2822228222INPUT_PORTS_END
2822328223
2822428224
r31373r31374
2826228262}
2826328263
2826428264INPUT_PORTS_START( sc4ltr2c ) // this structure is generated
28265        PORT_INCLUDE( sc4_base )
28266        PORT_MODIFY("IN-1")
28267        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
28268        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
28269        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
28270        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
28271        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
28272        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
28273        PORT_MODIFY("IN-2")
28274        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
28275        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
28276        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28277        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28278        PORT_MODIFY("IN-3")
28279        // 0x0004 - "stk 4" // standard input (expected here)
28280        // 0x0008 - "stk 3" // standard input (expected here)
28281        // 0x0010 - "stk 2" // standard input (expected here)
28282        PORT_MODIFY("IN-4")
28283        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
28284        PORT_MODIFY("IN-5")
28285        // 0x0001 - "priz4" // standard input (expected here)
28286        // 0x0002 - "priz3" // standard input (expected here)
28287        // 0x0004 - "priz2" // standard input (expected here)
28288        // 0x0008 - "priz1" // standard input (expected here)
28289        PORT_MODIFY("IN-8")
28290        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
28291        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shoot")
28292        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("sspins")
28293        PORT_MODIFY("IN-16")
28294        // 0x0001 - "dil 1" // standard input (motherboard)
28295        // 0x0002 - "dil 2" // standard input (motherboard)
28296        // 0x0004 - "dil 3" // standard input (motherboard)
28297        // 0x0008 - "dil 4" // standard input (motherboard)
28298        // 0x0010 - "dil 5" // standard input (motherboard)
28299        // 0x0100 - "top up" // known extended input, usually 'top up'
28300        PORT_MODIFY("IN-17")
28301        // 0x0001 - "dil 6" // standard input (motherboard)
28302        // 0x0002 - "dil 7" // standard input (motherboard)
28303        // 0x0004 - "dil 8" // standard input (motherboard)
28304        // 0x0008 - "dil 9" // standard input (motherboard)
28305        // 0x0010 - "dil10" // standard input (motherboard)
28306        PORT_MODIFY("IN-18")
28307        // 0x0001 - "dil11" // standard input (motherboard)
28308        // 0x0002 - "dil12" // standard input (motherboard)
28309        // 0x0004 - "dil13" // standard input (motherboard)
28310        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
28311        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
28312        PORT_MODIFY("IN-19")
28313        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
28314        PORT_MODIFY("IN-20")
28315        // 0x0001 - "grnbut" // standard input (motherboard)
28316        // 0x0002 - "dorlok" // standard input (expected here)
28317        // 0x0004 - "topdor" // standard input (expected here)
28318        // 0x0008 - "botdor" // standard input (expected here)
28319        // 0x0010 - "hopdmp" // standard input (expected here)
28265      PORT_INCLUDE( sc4_base )
28266      PORT_MODIFY("IN-1")
28267      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
28268      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
28269      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
28270      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
28271      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
28272      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
28273      PORT_MODIFY("IN-2")
28274      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
28275      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
28276      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28277      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28278      PORT_MODIFY("IN-3")
28279      // 0x0004 - "stk 4" // standard input (expected here)
28280      // 0x0008 - "stk 3" // standard input (expected here)
28281      // 0x0010 - "stk 2" // standard input (expected here)
28282      PORT_MODIFY("IN-4")
28283      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
28284      PORT_MODIFY("IN-5")
28285      // 0x0001 - "priz4" // standard input (expected here)
28286      // 0x0002 - "priz3" // standard input (expected here)
28287      // 0x0004 - "priz2" // standard input (expected here)
28288      // 0x0008 - "priz1" // standard input (expected here)
28289      PORT_MODIFY("IN-8")
28290      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
28291      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shoot")
28292      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("sspins")
28293      PORT_MODIFY("IN-16")
28294      // 0x0001 - "dil 1" // standard input (motherboard)
28295      // 0x0002 - "dil 2" // standard input (motherboard)
28296      // 0x0004 - "dil 3" // standard input (motherboard)
28297      // 0x0008 - "dil 4" // standard input (motherboard)
28298      // 0x0010 - "dil 5" // standard input (motherboard)
28299      // 0x0100 - "top up" // known extended input, usually 'top up'
28300      PORT_MODIFY("IN-17")
28301      // 0x0001 - "dil 6" // standard input (motherboard)
28302      // 0x0002 - "dil 7" // standard input (motherboard)
28303      // 0x0004 - "dil 8" // standard input (motherboard)
28304      // 0x0008 - "dil 9" // standard input (motherboard)
28305      // 0x0010 - "dil10" // standard input (motherboard)
28306      PORT_MODIFY("IN-18")
28307      // 0x0001 - "dil11" // standard input (motherboard)
28308      // 0x0002 - "dil12" // standard input (motherboard)
28309      // 0x0004 - "dil13" // standard input (motherboard)
28310      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
28311      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
28312      PORT_MODIFY("IN-19")
28313      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
28314      PORT_MODIFY("IN-20")
28315      // 0x0001 - "grnbut" // standard input (motherboard)
28316      // 0x0002 - "dorlok" // standard input (expected here)
28317      // 0x0004 - "topdor" // standard input (expected here)
28318      // 0x0008 - "botdor" // standard input (expected here)
28319      // 0x0010 - "hopdmp" // standard input (expected here)
2832028320INPUT_PORTS_END
2832128321
2832228322// PR1420 CLUB LOTR TWO TOWERS         PR1420 CLUB TWOTOWERS SOUNDS11
r31373r31374
2835128351}
2835228352
2835328353INPUT_PORTS_START( sc4magic ) // this structure is generated
28354        PORT_INCLUDE( sc4_base )
28355        PORT_MODIFY("IN-1")
28356        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28357        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
28358        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
28359        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
28360        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
28361        PORT_MODIFY("IN-2")
28362        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
28363        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28364        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28365        PORT_MODIFY("IN-8")
28366        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
28367        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nudges")
28368        PORT_MODIFY("IN-16")
28369        // 0x0001 - "dil  1" // standard input (motherboard)
28370        // 0x0002 - "dil  2" // standard input (motherboard)
28371        // 0x0004 - "dil  3" // standard input (motherboard)
28372        // 0x0008 - "dil  4" // standard input (motherboard)
28373        // 0x0010 - "dil  5" // standard input (motherboard)
28374        // 0x0100 - "topup" // known extended input, usually 'top up'
28375        PORT_MODIFY("IN-17")
28376        // 0x0001 - "dil  6" // standard input (motherboard)
28377        // 0x0002 - "dil  7" // standard input (motherboard)
28378        // 0x0004 - "dil  8" // standard input (motherboard)
28379        // 0x0008 - "dil  9" // standard input (motherboard)
28380        // 0x0010 - "dil 10" // standard input (motherboard)
28381        PORT_MODIFY("IN-18")
28382        // 0x0001 - "dil 11" // standard input (motherboard)
28383        // 0x0002 - "dil 12" // standard input (motherboard)
28384        // 0x0004 - "dil 13" // standard input (motherboard)
28385        // 0x0008 - "dil 14" // standard input (motherboard)
28386        // 0x0010 - "dil 15" // standard input (motherboard)
28387        PORT_MODIFY("IN-19")
28388        // 0x0001 - "dil 16" // standard input (motherboard)
28389        PORT_MODIFY("IN-20")
28390        // 0x0001 - "test" // standard input (motherboard)
28391        // 0x0002 - "lock" // standard input (expected here)
28392        // 0x0004 - "topdor" // standard input (expected here)
28393        // 0x0008 - "botdor" // standard input (expected here)
28394        // 0x0010 - "hopdmp" // standard input (expected here)
28354      PORT_INCLUDE( sc4_base )
28355      PORT_MODIFY("IN-1")
28356      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28357      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
28358      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
28359      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
28360      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
28361      PORT_MODIFY("IN-2")
28362      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
28363      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28364      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28365      PORT_MODIFY("IN-8")
28366      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
28367      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nudges")
28368      PORT_MODIFY("IN-16")
28369      // 0x0001 - "dil  1" // standard input (motherboard)
28370      // 0x0002 - "dil  2" // standard input (motherboard)
28371      // 0x0004 - "dil  3" // standard input (motherboard)
28372      // 0x0008 - "dil  4" // standard input (motherboard)
28373      // 0x0010 - "dil  5" // standard input (motherboard)
28374      // 0x0100 - "topup" // known extended input, usually 'top up'
28375      PORT_MODIFY("IN-17")
28376      // 0x0001 - "dil  6" // standard input (motherboard)
28377      // 0x0002 - "dil  7" // standard input (motherboard)
28378      // 0x0004 - "dil  8" // standard input (motherboard)
28379      // 0x0008 - "dil  9" // standard input (motherboard)
28380      // 0x0010 - "dil 10" // standard input (motherboard)
28381      PORT_MODIFY("IN-18")
28382      // 0x0001 - "dil 11" // standard input (motherboard)
28383      // 0x0002 - "dil 12" // standard input (motherboard)
28384      // 0x0004 - "dil 13" // standard input (motherboard)
28385      // 0x0008 - "dil 14" // standard input (motherboard)
28386      // 0x0010 - "dil 15" // standard input (motherboard)
28387      PORT_MODIFY("IN-19")
28388      // 0x0001 - "dil 16" // standard input (motherboard)
28389      PORT_MODIFY("IN-20")
28390      // 0x0001 - "test" // standard input (motherboard)
28391      // 0x0002 - "lock" // standard input (expected here)
28392      // 0x0004 - "topdor" // standard input (expected here)
28393      // 0x0008 - "botdor" // standard input (expected here)
28394      // 0x0010 - "hopdmp" // standard input (expected here)
2839528395INPUT_PORTS_END
2839628396
2839728397// PR2520 MAGIC POUND ABOUT V1.0         MAGICPOUNDABOUTSND         MAGIC POUNDABOUT
r31373r31374
2841728417}
2841828418
2841928419INPUT_PORTS_START( sc4maxim ) // this structure is generated
28420        PORT_INCLUDE( sc4_base )
28421        PORT_MODIFY("IN-1")
28422        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28423        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
28424        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
28425        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
28426        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
28427        PORT_MODIFY("IN-2")
28428        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("excnge")
28429        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28430        PORT_MODIFY("IN-4")
28431        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
28432        PORT_MODIFY("IN-8")
28433        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk bon")
28434        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
28435        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk fet")
28436        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk spk")
28437        PORT_MODIFY("IN-16")
28438        // 0x0001 - "dil  1" // standard input (motherboard)
28439        // 0x0002 - "dil  2" // standard input (motherboard)
28440        // 0x0004 - "dil  3" // standard input (motherboard)
28441        // 0x0008 - "dil  4" // standard input (motherboard)
28442        // 0x0010 - "dil  5" // standard input (motherboard)
28443        PORT_MODIFY("IN-17")
28444        // 0x0001 - "dil  6" // standard input (motherboard)
28445        // 0x0002 - "dil  7" // standard input (motherboard)
28446        // 0x0004 - "dil  8" // standard input (motherboard)
28447        // 0x0008 - "dil  9" // standard input (motherboard)
28448        // 0x0010 - "dil 10" // standard input (motherboard)
28449        PORT_MODIFY("IN-18")
28450        // 0x0001 - "dil 11" // standard input (motherboard)
28451        // 0x0002 - "dil 12" // standard input (motherboard)
28452        // 0x0004 - "dil 13" // standard input (motherboard)
28453        // 0x0008 - "dil 14" // standard input (motherboard)
28454        // 0x0010 - "dil 15" // standard input (motherboard)
28455        PORT_MODIFY("IN-19")
28456        // 0x0001 - "dil 16" // standard input (motherboard)
28457        PORT_MODIFY("IN-20")
28458        // 0x0001 - "testsw" // standard input (motherboard)
28459        // 0x0002 - "dor lk" // standard input (expected here)
28460        // 0x0004 - "tp dor" // standard input (expected here)
28461        // 0x0008 - "csh bx" // standard input (expected here)
28462        // 0x0010 - "deflt" // standard input (expected here)
28420      PORT_INCLUDE( sc4_base )
28421      PORT_MODIFY("IN-1")
28422      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28423      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
28424      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
28425      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
28426      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
28427      PORT_MODIFY("IN-2")
28428      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("excnge")
28429      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28430      PORT_MODIFY("IN-4")
28431      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
28432      PORT_MODIFY("IN-8")
28433      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk bon")
28434      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
28435      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk fet")
28436      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk spk")
28437      PORT_MODIFY("IN-16")
28438      // 0x0001 - "dil  1" // standard input (motherboard)
28439      // 0x0002 - "dil  2" // standard input (motherboard)
28440      // 0x0004 - "dil  3" // standard input (motherboard)
28441      // 0x0008 - "dil  4" // standard input (motherboard)
28442      // 0x0010 - "dil  5" // standard input (motherboard)
28443      PORT_MODIFY("IN-17")
28444      // 0x0001 - "dil  6" // standard input (motherboard)
28445      // 0x0002 - "dil  7" // standard input (motherboard)
28446      // 0x0004 - "dil  8" // standard input (motherboard)
28447      // 0x0008 - "dil  9" // standard input (motherboard)
28448      // 0x0010 - "dil 10" // standard input (motherboard)
28449      PORT_MODIFY("IN-18")
28450      // 0x0001 - "dil 11" // standard input (motherboard)
28451      // 0x0002 - "dil 12" // standard input (motherboard)
28452      // 0x0004 - "dil 13" // standard input (motherboard)
28453      // 0x0008 - "dil 14" // standard input (motherboard)
28454      // 0x0010 - "dil 15" // standard input (motherboard)
28455      PORT_MODIFY("IN-19")
28456      // 0x0001 - "dil 16" // standard input (motherboard)
28457      PORT_MODIFY("IN-20")
28458      // 0x0001 - "testsw" // standard input (motherboard)
28459      // 0x0002 - "dor lk" // standard input (expected here)
28460      // 0x0004 - "tp dor" // standard input (expected here)
28461      // 0x0008 - "csh bx" // standard input (expected here)
28462      // 0x0010 - "deflt" // standard input (expected here)
2846328463INPUT_PORTS_END
2846428464
2846528465// PR2019 MAXIMUS CASH         MAX SOUNDS           MAXIMUS CASH
r31373r31374
2849028490}
2849128491
2849228492INPUT_PORTS_START( sc4monob ) // this structure is generated
28493        PORT_INCLUDE( sc4_base )
28494        PORT_MODIFY("IN-1")
28495        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28496        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
28497        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
28498        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
28499        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
28500        PORT_MODIFY("IN-2")
28501        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
28502        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28503        PORT_MODIFY("IN-8")
28504        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
28505        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk cas")
28506        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("blast")
28507        PORT_MODIFY("IN-16")
28508        // 0x0001 - "dil  1" // standard input (motherboard)
28509        // 0x0002 - "dil  2" // standard input (motherboard)
28510        // 0x0004 - "dil  3" // standard input (motherboard)
28511        // 0x0008 - "dil  4" // standard input (motherboard)
28512        // 0x0010 - "dil  5" // standard input (motherboard)
28513        // 0x0100 - "top up" // known extended input, usually 'top up'
28514        PORT_MODIFY("IN-17")
28515        // 0x0001 - "dil  6" // standard input (motherboard)
28516        // 0x0002 - "dil  7" // standard input (motherboard)
28517        // 0x0004 - "dil  8" // standard input (motherboard)
28518        // 0x0008 - "dil  9" // standard input (motherboard)
28519        // 0x0010 - "dil 10" // standard input (motherboard)
28520        PORT_MODIFY("IN-18")
28521        // 0x0001 - "dil 11" // standard input (motherboard)
28522        // 0x0002 - "dil 12" // standard input (motherboard)
28523        // 0x0004 - "dil 13" // standard input (motherboard)
28524        // 0x0008 - "dil 14" // standard input (motherboard)
28525        // 0x0010 - "dil 15" // standard input (motherboard)
28526        PORT_MODIFY("IN-19")
28527        // 0x0001 - "dil 16" // standard input (motherboard)
28528        PORT_MODIFY("IN-20")
28529        // 0x0001 - "testsw" // standard input (motherboard)
28530        // 0x0002 - "dor lk" // standard input (expected here)
28531        // 0x0004 - "tp dor" // standard input (expected here)
28532        // 0x0008 - "csh bx" // standard input (expected here)
28533        // 0x0010 - "deflt" // standard input (expected here)
28493      PORT_INCLUDE( sc4_base )
28494      PORT_MODIFY("IN-1")
28495      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28496      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
28497      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
28498      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
28499      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
28500      PORT_MODIFY("IN-2")
28501      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
28502      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28503      PORT_MODIFY("IN-8")
28504      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
28505      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk cas")
28506      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("blast")
28507      PORT_MODIFY("IN-16")
28508      // 0x0001 - "dil  1" // standard input (motherboard)
28509      // 0x0002 - "dil  2" // standard input (motherboard)
28510      // 0x0004 - "dil  3" // standard input (motherboard)
28511      // 0x0008 - "dil  4" // standard input (motherboard)
28512      // 0x0010 - "dil  5" // standard input (motherboard)
28513      // 0x0100 - "top up" // known extended input, usually 'top up'
28514      PORT_MODIFY("IN-17")
28515      // 0x0001 - "dil  6" // standard input (motherboard)
28516      // 0x0002 - "dil  7" // standard input (motherboard)
28517      // 0x0004 - "dil  8" // standard input (motherboard)
28518      // 0x0008 - "dil  9" // standard input (motherboard)
28519      // 0x0010 - "dil 10" // standard input (motherboard)
28520      PORT_MODIFY("IN-18")
28521      // 0x0001 - "dil 11" // standard input (motherboard)
28522      // 0x0002 - "dil 12" // standard input (motherboard)
28523      // 0x0004 - "dil 13" // standard input (motherboard)
28524      // 0x0008 - "dil 14" // standard input (motherboard)
28525      // 0x0010 - "dil 15" // standard input (motherboard)
28526      PORT_MODIFY("IN-19")
28527      // 0x0001 - "dil 16" // standard input (motherboard)
28528      PORT_MODIFY("IN-20")
28529      // 0x0001 - "testsw" // standard input (motherboard)
28530      // 0x0002 - "dor lk" // standard input (expected here)
28531      // 0x0004 - "tp dor" // standard input (expected here)
28532      // 0x0008 - "csh bx" // standard input (expected here)
28533      // 0x0010 - "deflt" // standard input (expected here)
2853428534INPUT_PORTS_END
2853528535
2853628536// PR2121 MONOPOLY         MPLY SOUNDS         MONOPOLY
r31373r31374
2856928569}
2857028570
2857128571INPUT_PORTS_START( sc4mondx ) // this structure is generated
28572       PORT_INCLUDE( sc4_base )
28573       PORT_MODIFY("IN-1")
28574       PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
28575       PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
28576       PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
28577       PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
28578       PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
28579       PORT_MODIFY("IN-2")
28580       PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto")
28581       PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28582       PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28583       PORT_MODIFY("IN-16")
28584       // 0x0001 - "dil sw" // standard input (motherboard)
28585       // 0x0002 - "dil sw" // standard input (motherboard)
28586       // 0x0004 - "dil sw" // standard input (motherboard)
28587       // 0x0008 - "dil sw" // standard input (motherboard)
28588       // 0x0010 - "dil sw" // standard input (motherboard)
28589       // 0x0100 - "topup" // known extended input, usually 'top up'
28590       PORT_MODIFY("IN-17")
28591       // 0x0001 - "dil sw" // standard input (motherboard)
28592       // 0x0002 - "dil sw" // standard input (motherboard)
28593       // 0x0004 - "dil sw" // standard input (motherboard)
28594       // 0x0008 - "dil sw" // standard input (motherboard)
28595       // 0x0010 - "dil sw" // standard input (motherboard)
28596       PORT_MODIFY("IN-18")
28597       // 0x0001 - "dil sw" // standard input (motherboard)
28598       // 0x0002 - "dil sw" // standard input (motherboard)
28599       // 0x0004 - "dil sw" // standard input (motherboard)
28600       // 0x0008 - "dil sw" // standard input (motherboard)
28601       // 0x0010 - "dil sw" // standard input (motherboard)
28602       PORT_MODIFY("IN-19")
28603       // 0x0001 - "dil sw" // standard input (motherboard)
28604       PORT_MODIFY("IN-20")
28605       // 0x0001 - "test" // standard input (motherboard)
28606       // 0x0002 - "dorlk" // standard input (expected here)
28607       // 0x0004 - "tpdor" // standard input (expected here)
28608       // 0x0008 - "cshbx" // standard input (expected here)
28609       // 0x0010 - "deflt" // standard input (expected here)
28572      PORT_INCLUDE( sc4_base )
28573      PORT_MODIFY("IN-1")
28574      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
28575      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
28576      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
28577      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
28578      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
28579      PORT_MODIFY("IN-2")
28580      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto")
28581      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28582      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28583      PORT_MODIFY("IN-16")
28584      // 0x0001 - "dil sw" // standard input (motherboard)
28585      // 0x0002 - "dil sw" // standard input (motherboard)
28586      // 0x0004 - "dil sw" // standard input (motherboard)
28587      // 0x0008 - "dil sw" // standard input (motherboard)
28588      // 0x0010 - "dil sw" // standard input (motherboard)
28589      // 0x0100 - "topup" // known extended input, usually 'top up'
28590      PORT_MODIFY("IN-17")
28591      // 0x0001 - "dil sw" // standard input (motherboard)
28592      // 0x0002 - "dil sw" // standard input (motherboard)
28593      // 0x0004 - "dil sw" // standard input (motherboard)
28594      // 0x0008 - "dil sw" // standard input (motherboard)
28595      // 0x0010 - "dil sw" // standard input (motherboard)
28596      PORT_MODIFY("IN-18")
28597      // 0x0001 - "dil sw" // standard input (motherboard)
28598      // 0x0002 - "dil sw" // standard input (motherboard)
28599      // 0x0004 - "dil sw" // standard input (motherboard)
28600      // 0x0008 - "dil sw" // standard input (motherboard)
28601      // 0x0010 - "dil sw" // standard input (motherboard)
28602      PORT_MODIFY("IN-19")
28603      // 0x0001 - "dil sw" // standard input (motherboard)
28604      PORT_MODIFY("IN-20")
28605      // 0x0001 - "test" // standard input (motherboard)
28606      // 0x0002 - "dorlk" // standard input (expected here)
28607      // 0x0004 - "tpdor" // standard input (expected here)
28608      // 0x0008 - "cshbx" // standard input (expected here)
28609      // 0x0010 - "deflt" // standard input (expected here)
2861028610INPUT_PORTS_END
2861128611
2861228612// So which Top Box roms should thse use? Why do some play without one?
r31373r31374
2863028630
2863128631
2863228632INPUT_PORTS_START( sc4mont ) // this structure is generated
28633        PORT_INCLUDE( sc4_base )
28634        PORT_MODIFY("IN-1")
28635        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28636        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
28637        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
28638        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
28639        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("streak")
28640        PORT_MODIFY("IN-2")
28641        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto")
28642        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
28643        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28644        PORT_MODIFY("IN-4")
28645        // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
28646        PORT_MODIFY("IN-16")
28647        // 0x0001 - "dil  1" // standard input (motherboard)
28648        // 0x0002 - "dil  2" // standard input (motherboard)
28649        // 0x0004 - "dil  3" // standard input (motherboard)
28650        // 0x0008 - "dil  4" // standard input (motherboard)
28651        // 0x0010 - "dil  5" // standard input (motherboard)
28652        PORT_MODIFY("IN-17")
28653        // 0x0001 - "dil  6" // standard input (motherboard)
28654        // 0x0002 - "dil  7" // standard input (motherboard)
28655        // 0x0004 - "dil  8" // standard input (motherboard)
28656        // 0x0008 - "dil  9" // standard input (motherboard)
28657        // 0x0010 - "dil 10" // standard input (motherboard)
28658        PORT_MODIFY("IN-18")
28659        // 0x0001 - "dil 11" // standard input (motherboard)
28660        // 0x0002 - "dil 12" // standard input (motherboard)
28661        // 0x0004 - "dil 13" // standard input (motherboard)
28662        // 0x0008 - "dil 14" // standard input (motherboard)
28663        // 0x0010 - "dil 15" // standard input (motherboard)
28664        PORT_MODIFY("IN-19")
28665        // 0x0001 - "dil 16" // standard input (motherboard)
28666        PORT_MODIFY("IN-20")
28667        // 0x0001 - "test" // standard input (motherboard)
28668        // 0x0002 - "botdor" // standard input (expected here)
28669        // 0x0004 - "topdor" // standard input (expected here)
28670        // 0x0008 - "hopdmp" // standard input (expected here)
28671        // 0x0010 - "topdor" // standard input (expected here)
28633      PORT_INCLUDE( sc4_base )
28634      PORT_MODIFY("IN-1")
28635      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28636      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
28637      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
28638      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
28639      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("streak")
28640      PORT_MODIFY("IN-2")
28641      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto")
28642      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
28643      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28644      PORT_MODIFY("IN-4")
28645      // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
28646      PORT_MODIFY("IN-16")
28647      // 0x0001 - "dil  1" // standard input (motherboard)
28648      // 0x0002 - "dil  2" // standard input (motherboard)
28649      // 0x0004 - "dil  3" // standard input (motherboard)
28650      // 0x0008 - "dil  4" // standard input (motherboard)
28651      // 0x0010 - "dil  5" // standard input (motherboard)
28652      PORT_MODIFY("IN-17")
28653      // 0x0001 - "dil  6" // standard input (motherboard)
28654      // 0x0002 - "dil  7" // standard input (motherboard)
28655      // 0x0004 - "dil  8" // standard input (motherboard)
28656      // 0x0008 - "dil  9" // standard input (motherboard)
28657      // 0x0010 - "dil 10" // standard input (motherboard)
28658      PORT_MODIFY("IN-18")
28659      // 0x0001 - "dil 11" // standard input (motherboard)
28660      // 0x0002 - "dil 12" // standard input (motherboard)
28661      // 0x0004 - "dil 13" // standard input (motherboard)
28662      // 0x0008 - "dil 14" // standard input (motherboard)
28663      // 0x0010 - "dil 15" // standard input (motherboard)
28664      PORT_MODIFY("IN-19")
28665      // 0x0001 - "dil 16" // standard input (motherboard)
28666      PORT_MODIFY("IN-20")
28667      // 0x0001 - "test" // standard input (motherboard)
28668      // 0x0002 - "botdor" // standard input (expected here)
28669      // 0x0004 - "topdor" // standard input (expected here)
28670      // 0x0008 - "hopdmp" // standard input (expected here)
28671      // 0x0010 - "topdor" // standard input (expected here)
2867228672INPUT_PORTS_END
2867328673
2867428674
r31373r31374
2871928719}
2872028720
2872128721INPUT_PORTS_START( sc4mou ) // this structure is generated
28722        PORT_INCLUDE( sc4_base )
28723        PORT_MODIFY("IN-1")
28724        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28725        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
28726        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
28727        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
28728        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
28729        PORT_MODIFY("IN-2")
28730        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
28731        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28732        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28733        PORT_MODIFY("IN-8")
28734        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
28735        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("hi l")
28736        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lo l")
28737        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("change")
28738        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lo r")
28739        PORT_MODIFY("IN-9")
28740        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hi r")
28741        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("nudge")
28742        PORT_MODIFY("IN-16")
28743        // 0x0001 - "dil  1" // standard input (motherboard)
28744        // 0x0002 - "dil  2" // standard input (motherboard)
28745        // 0x0004 - "dil  3" // standard input (motherboard)
28746        // 0x0008 - "dil  4" // standard input (motherboard)
28747        // 0x0010 - "dil  5" // standard input (motherboard)
28748        // 0x0100 - "topup" // known extended input, usually 'top up'
28749        PORT_MODIFY("IN-17")
28750        // 0x0001 - "dil  6" // standard input (motherboard)
28751        // 0x0002 - "dil  7" // standard input (motherboard)
28752        // 0x0004 - "dil  8" // standard input (motherboard)
28753        // 0x0008 - "dil  9" // standard input (motherboard)
28754        // 0x0010 - "dil 10" // standard input (motherboard)
28755        PORT_MODIFY("IN-18")
28756        // 0x0001 - "dil 11" // standard input (motherboard)
28757        // 0x0002 - "dil 12" // standard input (motherboard)
28758        // 0x0004 - "dil 13" // standard input (motherboard)
28759        // 0x0008 - "dil 14" // standard input (motherboard)
28760        // 0x0010 - "dil 15" // standard input (motherboard)
28761        PORT_MODIFY("IN-19")
28762        // 0x0001 - "dil 16" // standard input (motherboard)
28763        PORT_MODIFY("IN-20")
28764        // 0x0001 - "test" // standard input (motherboard)
28765        // 0x0002 - "lock" // standard input (expected here)
28766        // 0x0004 - "topdor" // standard input (expected here)
28767        // 0x0008 - "botdor" // standard input (expected here)
28768        // 0x0010 - "hopdmp" // standard input (expected here)
28722      PORT_INCLUDE( sc4_base )
28723      PORT_MODIFY("IN-1")
28724      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28725      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
28726      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
28727      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
28728      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
28729      PORT_MODIFY("IN-2")
28730      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
28731      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28732      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28733      PORT_MODIFY("IN-8")
28734      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
28735      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("hi l")
28736      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lo l")
28737      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("change")
28738      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lo r")
28739      PORT_MODIFY("IN-9")
28740      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hi r")
28741      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("nudge")
28742      PORT_MODIFY("IN-16")
28743      // 0x0001 - "dil  1" // standard input (motherboard)
28744      // 0x0002 - "dil  2" // standard input (motherboard)
28745      // 0x0004 - "dil  3" // standard input (motherboard)
28746      // 0x0008 - "dil  4" // standard input (motherboard)
28747      // 0x0010 - "dil  5" // standard input (motherboard)
28748      // 0x0100 - "topup" // known extended input, usually 'top up'
28749      PORT_MODIFY("IN-17")
28750      // 0x0001 - "dil  6" // standard input (motherboard)
28751      // 0x0002 - "dil  7" // standard input (motherboard)
28752      // 0x0004 - "dil  8" // standard input (motherboard)
28753      // 0x0008 - "dil  9" // standard input (motherboard)
28754      // 0x0010 - "dil 10" // standard input (motherboard)
28755      PORT_MODIFY("IN-18")
28756      // 0x0001 - "dil 11" // standard input (motherboard)
28757      // 0x0002 - "dil 12" // standard input (motherboard)
28758      // 0x0004 - "dil 13" // standard input (motherboard)
28759      // 0x0008 - "dil 14" // standard input (motherboard)
28760      // 0x0010 - "dil 15" // standard input (motherboard)
28761      PORT_MODIFY("IN-19")
28762      // 0x0001 - "dil 16" // standard input (motherboard)
28763      PORT_MODIFY("IN-20")
28764      // 0x0001 - "test" // standard input (motherboard)
28765      // 0x0002 - "lock" // standard input (expected here)
28766      // 0x0004 - "topdor" // standard input (expected here)
28767      // 0x0008 - "botdor" // standard input (expected here)
28768      // 0x0010 - "hopdmp" // standard input (expected here)
2876928769INPUT_PORTS_END
2877028770
2877128771// PR2523 MOVE ON UP V1.0         MOVEONUPSND            MOVE ON UP
r31373r31374
2879028790}
2879128791
2879228792INPUT_PORTS_START( sc4nmtj ) // this structure is generated
28793        PORT_INCLUDE( sc4_base )
28794        PORT_MODIFY("IN-1")
28795        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
28796        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
28797        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
28798        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
28799        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
28800        PORT_MODIFY("IN-2")
28801        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
28802        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
28803        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28804        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28805        PORT_MODIFY("IN-8")
28806        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
28807        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
28808        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
28809        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
28810        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
28811        PORT_MODIFY("IN-9")
28812        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
28813        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
28814        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
28815        PORT_MODIFY("IN-16")
28816        // 0x0001 - "dil 1" // standard input (motherboard)
28817        // 0x0002 - "dil 2" // standard input (motherboard)
28818        // 0x0004 - "dil 3" // standard input (motherboard)
28819        // 0x0008 - "dil 4" // standard input (motherboard)
28820        // 0x0010 - "dil 5" // standard input (motherboard)
28821        // 0x0100 - "topup" // known extended input, usually 'top up'
28822        PORT_MODIFY("IN-17")
28823        // 0x0001 - "dil 6" // standard input (motherboard)
28824        // 0x0002 - "dil 7" // standard input (motherboard)
28825        // 0x0004 - "dil 8" // standard input (motherboard)
28826        // 0x0008 - "dil 9" // standard input (motherboard)
28827        // 0x0010 - "dil10" // standard input (motherboard)
28828        PORT_MODIFY("IN-18")
28829        // 0x0001 - "dil11" // standard input (motherboard)
28830        // 0x0002 - "dil12" // standard input (motherboard)
28831        // 0x0004 - "dil13" // standard input (motherboard)
28832        // 0x0008 - "dil14" // standard input (motherboard)
28833        // 0x0010 - "dil15" // standard input (motherboard)
28834        PORT_MODIFY("IN-19")
28835        // 0x0001 - "dil16" // standard input (motherboard)
28836        PORT_MODIFY("IN-20")
28837        // 0x0001 - "test" // standard input (motherboard)
28838        // 0x0002 - "dorlk" // standard input (expected here)
28839        // 0x0004 - "tpdor" // standard input (expected here)
28840        // 0x0008 - "cshbx" // standard input (expected here)
28841        // 0x0010 - "deflt" // standard input (expected here)
28793      PORT_INCLUDE( sc4_base )
28794      PORT_MODIFY("IN-1")
28795      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
28796      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
28797      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
28798      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
28799      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
28800      PORT_MODIFY("IN-2")
28801      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
28802      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
28803      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28804      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28805      PORT_MODIFY("IN-8")
28806      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
28807      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
28808      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
28809      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
28810      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
28811      PORT_MODIFY("IN-9")
28812      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
28813      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
28814      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
28815      PORT_MODIFY("IN-16")
28816      // 0x0001 - "dil 1" // standard input (motherboard)
28817      // 0x0002 - "dil 2" // standard input (motherboard)
28818      // 0x0004 - "dil 3" // standard input (motherboard)
28819      // 0x0008 - "dil 4" // standard input (motherboard)
28820      // 0x0010 - "dil 5" // standard input (motherboard)
28821      // 0x0100 - "topup" // known extended input, usually 'top up'
28822      PORT_MODIFY("IN-17")
28823      // 0x0001 - "dil 6" // standard input (motherboard)
28824      // 0x0002 - "dil 7" // standard input (motherboard)
28825      // 0x0004 - "dil 8" // standard input (motherboard)
28826      // 0x0008 - "dil 9" // standard input (motherboard)
28827      // 0x0010 - "dil10" // standard input (motherboard)
28828      PORT_MODIFY("IN-18")
28829      // 0x0001 - "dil11" // standard input (motherboard)
28830      // 0x0002 - "dil12" // standard input (motherboard)
28831      // 0x0004 - "dil13" // standard input (motherboard)
28832      // 0x0008 - "dil14" // standard input (motherboard)
28833      // 0x0010 - "dil15" // standard input (motherboard)
28834      PORT_MODIFY("IN-19")
28835      // 0x0001 - "dil16" // standard input (motherboard)
28836      PORT_MODIFY("IN-20")
28837      // 0x0001 - "test" // standard input (motherboard)
28838      // 0x0002 - "dorlk" // standard input (expected here)
28839      // 0x0004 - "tpdor" // standard input (expected here)
28840      // 0x0008 - "cshbx" // standard input (expected here)
28841      // 0x0010 - "deflt" // standard input (expected here)
2884228842INPUT_PORTS_END
2884328843
2884428844// PR2171 NEVER MIND JPS         NMTJ SOUNDS         NEVER MIND JPS
r31373r31374
2886528865}
2886628866
2886728867INPUT_PORTS_START( sc4oyf ) // this structure is generated
28868        PORT_INCLUDE( sc4_base )
28869        PORT_MODIFY("IN-1")
28870        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28871        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
28872        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
28873        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
28874        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("st/col")
28875        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
28876        PORT_MODIFY("IN-2")
28877        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
28878        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28879        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28880        PORT_MODIFY("IN-3")
28881        // 0x0004 - "stk 4" // standard input (expected here)
28882        // 0x0008 - "stk 3" // standard input (expected here)
28883        // 0x0010 - "stk 2" // standard input (expected here)
28884        PORT_MODIFY("IN-4")
28885        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
28886        PORT_MODIFY("IN-5")
28887        // 0x0001 - "priz4" // standard input (expected here)
28888        // 0x0002 - "priz3" // standard input (expected here)
28889        // 0x0004 - "priz2" // standard input (expected here)
28890        // 0x0008 - "priz1" // standard input (expected here)
28891        PORT_MODIFY("IN-6")
28892        // 0x0001 - "perc1" // standard input (expected here)
28893        // 0x0002 - "perc2" // standard input (expected here)
28894        // 0x0004 - "perc3" // standard input (expected here)
28895        // 0x0008 - "perc4" // standard input (expected here)
28896        PORT_MODIFY("IN-8")
28897        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
28898        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("coll")
28899        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nudges")
28900        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("notes")
28901        PORT_MODIFY("IN-16")
28902        // 0x0001 - "dil 1" // standard input (motherboard)
28903        // 0x0002 - "dil 2" // standard input (motherboard)
28904        // 0x0004 - "dil 3" // standard input (motherboard)
28905        // 0x0008 - "dil 4" // standard input (motherboard)
28906        // 0x0010 - "dil 5" // standard input (motherboard)
28907        // 0x0100 - "htopup" // known extended input, usually 'top up'
28908        PORT_MODIFY("IN-17")
28909        // 0x0001 - "dil 6" // standard input (motherboard)
28910        // 0x0002 - "dil 7" // standard input (motherboard)
28911        // 0x0004 - "dil 8" // standard input (motherboard)
28912        // 0x0008 - "dil 9" // standard input (motherboard)
28913        // 0x0010 - "dil 10" // standard input (motherboard)
28914        PORT_MODIFY("IN-18")
28915        // 0x0001 - "dil 11" // standard input (motherboard)
28916        // 0x0002 - "dil 12" // standard input (motherboard)
28917        // 0x0004 - "dil 13" // standard input (motherboard)
28918        // 0x0008 - "dil 14" // standard input (motherboard)
28919        // 0x0010 - "dil 15" // standard input (motherboard)
28920        PORT_MODIFY("IN-19")
28921        // 0x0001 - "dil 16" // standard input (motherboard)
28922        PORT_MODIFY("IN-20")
28923        // 0x0001 - "grnbut" // standard input (motherboard)
28924        // 0x0002 - "dorlok" // standard input (expected here)
28925        // 0x0004 - "serdor" // standard input (expected here)
28926        // 0x0008 - "cshdor" // standard input (expected here)
28927        // 0x0010 - "hopdmp" // standard input (expected here)
28868      PORT_INCLUDE( sc4_base )
28869      PORT_MODIFY("IN-1")
28870      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28871      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
28872      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
28873      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
28874      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("st/col")
28875      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
28876      PORT_MODIFY("IN-2")
28877      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
28878      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28879      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28880      PORT_MODIFY("IN-3")
28881      // 0x0004 - "stk 4" // standard input (expected here)
28882      // 0x0008 - "stk 3" // standard input (expected here)
28883      // 0x0010 - "stk 2" // standard input (expected here)
28884      PORT_MODIFY("IN-4")
28885      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
28886      PORT_MODIFY("IN-5")
28887      // 0x0001 - "priz4" // standard input (expected here)
28888      // 0x0002 - "priz3" // standard input (expected here)
28889      // 0x0004 - "priz2" // standard input (expected here)
28890      // 0x0008 - "priz1" // standard input (expected here)
28891      PORT_MODIFY("IN-6")
28892      // 0x0001 - "perc1" // standard input (expected here)
28893      // 0x0002 - "perc2" // standard input (expected here)
28894      // 0x0004 - "perc3" // standard input (expected here)
28895      // 0x0008 - "perc4" // standard input (expected here)
28896      PORT_MODIFY("IN-8")
28897      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
28898      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("coll")
28899      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nudges")
28900      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("notes")
28901      PORT_MODIFY("IN-16")
28902      // 0x0001 - "dil 1" // standard input (motherboard)
28903      // 0x0002 - "dil 2" // standard input (motherboard)
28904      // 0x0004 - "dil 3" // standard input (motherboard)
28905      // 0x0008 - "dil 4" // standard input (motherboard)
28906      // 0x0010 - "dil 5" // standard input (motherboard)
28907      // 0x0100 - "htopup" // known extended input, usually 'top up'
28908      PORT_MODIFY("IN-17")
28909      // 0x0001 - "dil 6" // standard input (motherboard)
28910      // 0x0002 - "dil 7" // standard input (motherboard)
28911      // 0x0004 - "dil 8" // standard input (motherboard)
28912      // 0x0008 - "dil 9" // standard input (motherboard)
28913      // 0x0010 - "dil 10" // standard input (motherboard)
28914      PORT_MODIFY("IN-18")
28915      // 0x0001 - "dil 11" // standard input (motherboard)
28916      // 0x0002 - "dil 12" // standard input (motherboard)
28917      // 0x0004 - "dil 13" // standard input (motherboard)
28918      // 0x0008 - "dil 14" // standard input (motherboard)
28919      // 0x0010 - "dil 15" // standard input (motherboard)
28920      PORT_MODIFY("IN-19")
28921      // 0x0001 - "dil 16" // standard input (motherboard)
28922      PORT_MODIFY("IN-20")
28923      // 0x0001 - "grnbut" // standard input (motherboard)
28924      // 0x0002 - "dorlok" // standard input (expected here)
28925      // 0x0004 - "serdor" // standard input (expected here)
28926      // 0x0008 - "cshdor" // standard input (expected here)
28927      // 0x0010 - "hopdmp" // standard input (expected here)
2892828928INPUT_PORTS_END
2892928929
2893028930// PR1310 AWP OFF YOUR FACE         PR1310 OFF YOUR FACE SOUNDS11
r31373r31374
2894928949}
2895028950
2895128951INPUT_PORTS_START( sc4opses ) // this structure is generated
28952        PORT_INCLUDE( sc4_base )
28953        PORT_MODIFY("IN-1")
28954        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28955        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
28956        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
28957        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
28958        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
28959        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
28960        PORT_MODIFY("IN-2")
28961        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
28962        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28963        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28964        PORT_MODIFY("IN-3")
28965        // 0x0004 - "stk 4" // standard input (expected here)
28966        // 0x0008 - "stk 3" // standard input (expected here)
28967        // 0x0010 - "stk 2" // standard input (expected here)
28968        PORT_MODIFY("IN-5")
28969        // 0x0001 - "priz4" // standard input (expected here)
28970        // 0x0002 - "priz3" // standard input (expected here)
28971        // 0x0004 - "priz2" // standard input (expected here)
28972        // 0x0008 - "priz1" // standard input (expected here)
28973        PORT_MODIFY("IN-6")
28974        // 0x0001 - "perc1" // standard input (expected here)
28975        // 0x0002 - "perc2" // standard input (expected here)
28976        // 0x0004 - "perc3" // standard input (expected here)
28977        // 0x0008 - "perc4" // standard input (expected here)
28978        PORT_MODIFY("IN-8")
28979        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fea")
28980        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk nud")
28981        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk ss")
28982        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk sht")
28983        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk haz")
28984        PORT_MODIFY("IN-16")
28985        // 0x0001 - "dil 1" // standard input (motherboard)
28986        // 0x0002 - "dil 2" // standard input (motherboard)
28987        // 0x0004 - "dil 3" // standard input (motherboard)
28988        // 0x0008 - "dil 4" // standard input (motherboard)
28989        // 0x0010 - "dil 5" // standard input (motherboard)
28990        // 0x0100 - "top up" // known extended input, usually 'top up'
28991        PORT_MODIFY("IN-17")
28992        // 0x0001 - "dil 6" // standard input (motherboard)
28993        // 0x0002 - "dil 7" // standard input (motherboard)
28994        // 0x0004 - "dil 8" // standard input (motherboard)
28995        // 0x0008 - "dil 9" // standard input (motherboard)
28996        // 0x0010 - "dil10" // standard input (motherboard)
28997        PORT_MODIFY("IN-18")
28998        // 0x0001 - "dil11" // standard input (motherboard)
28999        // 0x0002 - "dil12" // standard input (motherboard)
29000        // 0x0004 - "dil13" // standard input (motherboard)
29001        // 0x0008 - "dil14" // standard input (motherboard)
29002        // 0x0010 - "dil15" // standard input (motherboard)
29003        PORT_MODIFY("IN-19")
29004        // 0x0001 - "dil16" // standard input (motherboard)
29005        PORT_MODIFY("IN-20")
29006        // 0x0001 - "grnbut" // standard input (motherboard)
29007        // 0x0002 - "dorlok" // standard input (expected here)
29008        // 0x0004 - "topdor" // standard input (expected here)
29009        // 0x0008 - "botdor" // standard input (expected here)
29010        // 0x0010 - "hopdmp" // standard input (expected here)
28952      PORT_INCLUDE( sc4_base )
28953      PORT_MODIFY("IN-1")
28954      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
28955      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
28956      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
28957      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
28958      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
28959      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
28960      PORT_MODIFY("IN-2")
28961      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
28962      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
28963      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
28964      PORT_MODIFY("IN-3")
28965      // 0x0004 - "stk 4" // standard input (expected here)
28966      // 0x0008 - "stk 3" // standard input (expected here)
28967      // 0x0010 - "stk 2" // standard input (expected here)
28968      PORT_MODIFY("IN-5")
28969      // 0x0001 - "priz4" // standard input (expected here)
28970      // 0x0002 - "priz3" // standard input (expected here)
28971      // 0x0004 - "priz2" // standard input (expected here)
28972      // 0x0008 - "priz1" // standard input (expected here)
28973      PORT_MODIFY("IN-6")
28974      // 0x0001 - "perc1" // standard input (expected here)
28975      // 0x0002 - "perc2" // standard input (expected here)
28976      // 0x0004 - "perc3" // standard input (expected here)
28977      // 0x0008 - "perc4" // standard input (expected here)
28978      PORT_MODIFY("IN-8")
28979      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fea")
28980      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk nud")
28981      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk ss")
28982      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk sht")
28983      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk haz")
28984      PORT_MODIFY("IN-16")
28985      // 0x0001 - "dil 1" // standard input (motherboard)
28986      // 0x0002 - "dil 2" // standard input (motherboard)
28987      // 0x0004 - "dil 3" // standard input (motherboard)
28988      // 0x0008 - "dil 4" // standard input (motherboard)
28989      // 0x0010 - "dil 5" // standard input (motherboard)
28990      // 0x0100 - "top up" // known extended input, usually 'top up'
28991      PORT_MODIFY("IN-17")
28992      // 0x0001 - "dil 6" // standard input (motherboard)
28993      // 0x0002 - "dil 7" // standard input (motherboard)
28994      // 0x0004 - "dil 8" // standard input (motherboard)
28995      // 0x0008 - "dil 9" // standard input (motherboard)
28996      // 0x0010 - "dil10" // standard input (motherboard)
28997      PORT_MODIFY("IN-18")
28998      // 0x0001 - "dil11" // standard input (motherboard)
28999      // 0x0002 - "dil12" // standard input (motherboard)
29000      // 0x0004 - "dil13" // standard input (motherboard)
29001      // 0x0008 - "dil14" // standard input (motherboard)
29002      // 0x0010 - "dil15" // standard input (motherboard)
29003      PORT_MODIFY("IN-19")
29004      // 0x0001 - "dil16" // standard input (motherboard)
29005      PORT_MODIFY("IN-20")
29006      // 0x0001 - "grnbut" // standard input (motherboard)
29007      // 0x0002 - "dorlok" // standard input (expected here)
29008      // 0x0004 - "topdor" // standard input (expected here)
29009      // 0x0008 - "botdor" // standard input (expected here)
29010      // 0x0010 - "hopdmp" // standard input (expected here)
2901129011INPUT_PORTS_END
2901229012
2901329013// PR1106 OPEN SESAME         PR1106 OPEN SESAME SOUNDS11
r31373r31374
2903229032}
2903329033
2903429034INPUT_PORTS_START( sc4paccl ) // this structure is generated
29035        PORT_INCLUDE( sc4_base )
29036        PORT_MODIFY("IN-1")
29037        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("hold1")
29038        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold2")
29039        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold3")
29040        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold4")
29041        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
29042        PORT_MODIFY("IN-2")
29043        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
29044        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
29045        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29046        PORT_MODIFY("IN-7")
29047        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_0 ) PORT_NAME("tk nud")
29048        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_1 ) PORT_NAME("tk sht")
29049        PORT_MODIFY("IN-8")
29050        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk met")
29051        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
29052        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("mickey")
29053        PORT_MODIFY("IN-16")
29054        // 0x0001 - "dil  1" // standard input (motherboard)
29055        // 0x0002 - "dil  2" // standard input (motherboard)
29056        // 0x0004 - "dil  3" // standard input (motherboard)
29057        // 0x0008 - "dil  4" // standard input (motherboard)
29058        // 0x0010 - "dil  5" // standard input (motherboard)
29059        // 0x0100 - "top up" // known extended input, usually 'top up'
29060        PORT_MODIFY("IN-17")
29061        // 0x0001 - "dil  6" // standard input (motherboard)
29062        // 0x0002 - "dil  7" // standard input (motherboard)
29063        // 0x0004 - "dil  8" // standard input (motherboard)
29064        // 0x0008 - "dil  9" // standard input (motherboard)
29065        // 0x0010 - "dil 10" // standard input (motherboard)
29066        PORT_MODIFY("IN-18")
29067        // 0x0001 - "dil 11" // standard input (motherboard)
29068        // 0x0002 - "dil 12" // standard input (motherboard)
29069        // 0x0004 - "dil 13" // standard input (motherboard)
29070        // 0x0008 - "dil 14" // standard input (motherboard)
29071        // 0x0010 - "dil 15" // standard input (motherboard)
29072        PORT_MODIFY("IN-19")
29073        // 0x0001 - "dil 16" // standard input (motherboard)
29074        PORT_MODIFY("IN-20")
29075        // 0x0001 - "testsw" // standard input (motherboard)
29076        // 0x0002 - "dor lk" // standard input (expected here)
29077        // 0x0004 - "tp dor" // standard input (expected here)
29078        // 0x0008 - "csh bx" // standard input (expected here)
29079        // 0x0010 - "deflt" // standard input (expected here)
29035      PORT_INCLUDE( sc4_base )
29036      PORT_MODIFY("IN-1")
29037      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("hold1")
29038      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold2")
29039      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold3")
29040      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold4")
29041      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
29042      PORT_MODIFY("IN-2")
29043      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
29044      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
29045      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29046      PORT_MODIFY("IN-7")
29047      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_0 ) PORT_NAME("tk nud")
29048      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_1 ) PORT_NAME("tk sht")
29049      PORT_MODIFY("IN-8")
29050      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk met")
29051      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
29052      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("mickey")
29053      PORT_MODIFY("IN-16")
29054      // 0x0001 - "dil  1" // standard input (motherboard)
29055      // 0x0002 - "dil  2" // standard input (motherboard)
29056      // 0x0004 - "dil  3" // standard input (motherboard)
29057      // 0x0008 - "dil  4" // standard input (motherboard)
29058      // 0x0010 - "dil  5" // standard input (motherboard)
29059      // 0x0100 - "top up" // known extended input, usually 'top up'
29060      PORT_MODIFY("IN-17")
29061      // 0x0001 - "dil  6" // standard input (motherboard)
29062      // 0x0002 - "dil  7" // standard input (motherboard)
29063      // 0x0004 - "dil  8" // standard input (motherboard)
29064      // 0x0008 - "dil  9" // standard input (motherboard)
29065      // 0x0010 - "dil 10" // standard input (motherboard)
29066      PORT_MODIFY("IN-18")
29067      // 0x0001 - "dil 11" // standard input (motherboard)
29068      // 0x0002 - "dil 12" // standard input (motherboard)
29069      // 0x0004 - "dil 13" // standard input (motherboard)
29070      // 0x0008 - "dil 14" // standard input (motherboard)
29071      // 0x0010 - "dil 15" // standard input (motherboard)
29072      PORT_MODIFY("IN-19")
29073      // 0x0001 - "dil 16" // standard input (motherboard)
29074      PORT_MODIFY("IN-20")
29075      // 0x0001 - "testsw" // standard input (motherboard)
29076      // 0x0002 - "dor lk" // standard input (expected here)
29077      // 0x0004 - "tp dor" // standard input (expected here)
29078      // 0x0008 - "csh bx" // standard input (expected here)
29079      // 0x0010 - "deflt" // standard input (expected here)
2908029080INPUT_PORTS_END
2908129081
2908229082// PR2018 PACMAN CLUB         CLUB PACMAN SOUNDS         PACMAN C L U B
r31373r31374
2910229102}
2910329103
2910429104INPUT_PORTS_START( sc4pmani ) // this structure is generated
29105        PORT_INCLUDE( sc4_base )
29106        PORT_MODIFY("IN-1")
29107        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29108        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
29109        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
29110        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
29111        PORT_MODIFY("IN-2")
29112        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("excnge")
29113        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29114        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("coll")
29115        PORT_MODIFY("IN-8")
29116        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("higher")
29117        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lower")
29118        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk prz")
29119        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fet")
29120        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
29121        PORT_MODIFY("IN-16")
29122        // 0x0001 - "dil  1" // standard input (motherboard)
29123        // 0x0002 - "dil  2" // standard input (motherboard)
29124        // 0x0004 - "dil  3" // standard input (motherboard)
29125        // 0x0008 - "dil  4" // standard input (motherboard)
29126        // 0x0010 - "dil  5" // standard input (motherboard)
29127        // 0x0100 - "top up" // known extended input, usually 'top up'
29128        PORT_MODIFY("IN-17")
29129        // 0x0001 - "dil  6" // standard input (motherboard)
29130        // 0x0002 - "dil  7" // standard input (motherboard)
29131        // 0x0004 - "dil  8" // standard input (motherboard)
29132        // 0x0008 - "dil  9" // standard input (motherboard)
29133        // 0x0010 - "dil 10" // standard input (motherboard)
29134        PORT_MODIFY("IN-18")
29135        // 0x0001 - "dil 11" // standard input (motherboard)
29136        // 0x0002 - "dil 12" // standard input (motherboard)
29137        // 0x0004 - "dil 13" // standard input (motherboard)
29138        // 0x0008 - "dil 14" // standard input (motherboard)
29139        // 0x0010 - "dil 15" // standard input (motherboard)
29140        PORT_MODIFY("IN-19")
29141        // 0x0001 - "dil 16" // standard input (motherboard)
29142        PORT_MODIFY("IN-20")
29143        // 0x0001 - "testsw" // standard input (motherboard)
29144        // 0x0002 - "dor lk" // standard input (expected here)
29145        // 0x0004 - "tp dor" // standard input (expected here)
29146        // 0x0008 - "csh bx" // standard input (expected here)
29147        // 0x0010 - "deflt" // standard input (expected here)
29105      PORT_INCLUDE( sc4_base )
29106      PORT_MODIFY("IN-1")
29107      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29108      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
29109      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
29110      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
29111      PORT_MODIFY("IN-2")
29112      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("excnge")
29113      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29114      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("coll")
29115      PORT_MODIFY("IN-8")
29116      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("higher")
29117      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lower")
29118      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk prz")
29119      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fet")
29120      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
29121      PORT_MODIFY("IN-16")
29122      // 0x0001 - "dil  1" // standard input (motherboard)
29123      // 0x0002 - "dil  2" // standard input (motherboard)
29124      // 0x0004 - "dil  3" // standard input (motherboard)
29125      // 0x0008 - "dil  4" // standard input (motherboard)
29126      // 0x0010 - "dil  5" // standard input (motherboard)
29127      // 0x0100 - "top up" // known extended input, usually 'top up'
29128      PORT_MODIFY("IN-17")
29129      // 0x0001 - "dil  6" // standard input (motherboard)
29130      // 0x0002 - "dil  7" // standard input (motherboard)
29131      // 0x0004 - "dil  8" // standard input (motherboard)
29132      // 0x0008 - "dil  9" // standard input (motherboard)
29133      // 0x0010 - "dil 10" // standard input (motherboard)
29134      PORT_MODIFY("IN-18")
29135      // 0x0001 - "dil 11" // standard input (motherboard)
29136      // 0x0002 - "dil 12" // standard input (motherboard)
29137      // 0x0004 - "dil 13" // standard input (motherboard)
29138      // 0x0008 - "dil 14" // standard input (motherboard)
29139      // 0x0010 - "dil 15" // standard input (motherboard)
29140      PORT_MODIFY("IN-19")
29141      // 0x0001 - "dil 16" // standard input (motherboard)
29142      PORT_MODIFY("IN-20")
29143      // 0x0001 - "testsw" // standard input (motherboard)
29144      // 0x0002 - "dor lk" // standard input (expected here)
29145      // 0x0004 - "tp dor" // standard input (expected here)
29146      // 0x0008 - "csh bx" // standard input (expected here)
29147      // 0x0010 - "deflt" // standard input (expected here)
2914829148INPUT_PORTS_END
2914929149
2915029150// REEL 4 ERR 24
r31373r31374
2917029170}
2917129171
2917229172INPUT_PORTS_START( sc4pgold ) // this structure is generated
29173        PORT_INCLUDE( sc4_base )
29174        PORT_MODIFY("IN-1")
29175        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29176        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29177        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29178        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29179        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
29180        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
29181        PORT_MODIFY("IN-2")
29182        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
29183        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29184        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29185        PORT_MODIFY("IN-3")
29186        // 0x0004 - "stk 4" // standard input (expected here)
29187        // 0x0008 - "stk 3" // standard input (expected here)
29188        // 0x0010 - "stk 2" // standard input (expected here)
29189        PORT_MODIFY("IN-5")
29190        // 0x0001 - "priz4" // standard input (expected here)
29191        // 0x0002 - "priz3" // standard input (expected here)
29192        // 0x0004 - "priz2" // standard input (expected here)
29193        // 0x0008 - "priz1" // standard input (expected here)
29194        PORT_MODIFY("IN-6")
29195        // 0x0001 - "perc1" // standard input (expected here)
29196        // 0x0002 - "perc2" // standard input (expected here)
29197        // 0x0004 - "perc3" // standard input (expected here)
29198        // 0x0008 - "perc4" // standard input (expected here)
29199        PORT_MODIFY("IN-8")
29200        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk eye")
29201        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht")
29202        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bon")
29203        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("high")
29204        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("low")
29205        PORT_MODIFY("IN-16")
29206        // 0x0001 - "dil 1" // standard input (motherboard)
29207        // 0x0002 - "dil 2" // standard input (motherboard)
29208        // 0x0004 - "dil 3" // standard input (motherboard)
29209        // 0x0008 - "dil 4" // standard input (motherboard)
29210        // 0x0010 - "dil 5" // standard input (motherboard)
29211        // 0x0100 - "top up" // known extended input, usually 'top up'
29212        PORT_MODIFY("IN-17")
29213        // 0x0001 - "dil 6" // standard input (motherboard)
29214        // 0x0002 - "dil 7" // standard input (motherboard)
29215        // 0x0004 - "dil 8" // standard input (motherboard)
29216        // 0x0008 - "dil 9" // standard input (motherboard)
29217        // 0x0010 - "dil10" // standard input (motherboard)
29218        PORT_MODIFY("IN-18")
29219        // 0x0001 - "dil11" // standard input (motherboard)
29220        // 0x0002 - "dil12" // standard input (motherboard)
29221        // 0x0004 - "dil13" // standard input (motherboard)
29222        // 0x0008 - "dil14" // standard input (motherboard)
29223        // 0x0010 - "dil15" // standard input (motherboard)
29224        PORT_MODIFY("IN-19")
29225        // 0x0001 - "dil16" // standard input (motherboard)
29226        PORT_MODIFY("IN-20")
29227        // 0x0001 - "grnbut" // standard input (motherboard)
29228        // 0x0002 - "dorlok" // standard input (expected here)
29229        // 0x0004 - "topdor" // standard input (expected here)
29230        // 0x0008 - "botdor" // standard input (expected here)
29231        // 0x0010 - "hopdmp" // standard input (expected here)
29173      PORT_INCLUDE( sc4_base )
29174      PORT_MODIFY("IN-1")
29175      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29176      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29177      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29178      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29179      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
29180      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
29181      PORT_MODIFY("IN-2")
29182      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
29183      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29184      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29185      PORT_MODIFY("IN-3")
29186      // 0x0004 - "stk 4" // standard input (expected here)
29187      // 0x0008 - "stk 3" // standard input (expected here)
29188      // 0x0010 - "stk 2" // standard input (expected here)
29189      PORT_MODIFY("IN-5")
29190      // 0x0001 - "priz4" // standard input (expected here)
29191      // 0x0002 - "priz3" // standard input (expected here)
29192      // 0x0004 - "priz2" // standard input (expected here)
29193      // 0x0008 - "priz1" // standard input (expected here)
29194      PORT_MODIFY("IN-6")
29195      // 0x0001 - "perc1" // standard input (expected here)
29196      // 0x0002 - "perc2" // standard input (expected here)
29197      // 0x0004 - "perc3" // standard input (expected here)
29198      // 0x0008 - "perc4" // standard input (expected here)
29199      PORT_MODIFY("IN-8")
29200      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk eye")
29201      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht")
29202      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bon")
29203      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("high")
29204      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("low")
29205      PORT_MODIFY("IN-16")
29206      // 0x0001 - "dil 1" // standard input (motherboard)
29207      // 0x0002 - "dil 2" // standard input (motherboard)
29208      // 0x0004 - "dil 3" // standard input (motherboard)
29209      // 0x0008 - "dil 4" // standard input (motherboard)
29210      // 0x0010 - "dil 5" // standard input (motherboard)
29211      // 0x0100 - "top up" // known extended input, usually 'top up'
29212      PORT_MODIFY("IN-17")
29213      // 0x0001 - "dil 6" // standard input (motherboard)
29214      // 0x0002 - "dil 7" // standard input (motherboard)
29215      // 0x0004 - "dil 8" // standard input (motherboard)
29216      // 0x0008 - "dil 9" // standard input (motherboard)
29217      // 0x0010 - "dil10" // standard input (motherboard)
29218      PORT_MODIFY("IN-18")
29219      // 0x0001 - "dil11" // standard input (motherboard)
29220      // 0x0002 - "dil12" // standard input (motherboard)
29221      // 0x0004 - "dil13" // standard input (motherboard)
29222      // 0x0008 - "dil14" // standard input (motherboard)
29223      // 0x0010 - "dil15" // standard input (motherboard)
29224      PORT_MODIFY("IN-19")
29225      // 0x0001 - "dil16" // standard input (motherboard)
29226      PORT_MODIFY("IN-20")
29227      // 0x0001 - "grnbut" // standard input (motherboard)
29228      // 0x0002 - "dorlok" // standard input (expected here)
29229      // 0x0004 - "topdor" // standard input (expected here)
29230      // 0x0008 - "botdor" // standard input (expected here)
29231      // 0x0010 - "hopdmp" // standard input (expected here)
2923229232INPUT_PORTS_END
2923329233
2923429234// PR1012 PHARAOH'S GOLD         PR1012 PHARAOHS GOLD SOUNDS11
r31373r31374
2925829258}
2925929259
2926029260INPUT_PORTS_START( sc4ppclb ) // this structure is generated
29261        PORT_INCLUDE( sc4_base )
29262        PORT_MODIFY("IN-1")
29263        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29264        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29265        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29266        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29267        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
29268        PORT_MODIFY("IN-2")
29269        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
29270        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
29271        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29272        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29273        PORT_MODIFY("IN-8")
29274        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
29275        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nudge")
29276        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spin p")
29277        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spin c")
29278        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c pot")
29279        PORT_MODIFY("IN-16")
29280        // 0x0001 - "dil  1" // standard input (motherboard)
29281        // 0x0002 - "dil  2" // standard input (motherboard)
29282        // 0x0004 - "dil  3" // standard input (motherboard)
29283        // 0x0008 - "dil  4" // standard input (motherboard)
29284        // 0x0010 - "dil  5" // standard input (motherboard)
29285        // 0x0100 - "topup" // known extended input, usually 'top up'
29286        PORT_MODIFY("IN-17")
29287        // 0x0001 - "dil  6" // standard input (motherboard)
29288        // 0x0002 - "dil  7" // standard input (motherboard)
29289        // 0x0004 - "dil  8" // standard input (motherboard)
29290        // 0x0008 - "dil  9" // standard input (motherboard)
29291        // 0x0010 - "dil 10" // standard input (motherboard)
29292        PORT_MODIFY("IN-18")
29293        // 0x0001 - "dil 11" // standard input (motherboard)
29294        // 0x0002 - "dil 12" // standard input (motherboard)
29295        // 0x0004 - "dil 13" // standard input (motherboard)
29296        // 0x0008 - "dil 14" // standard input (motherboard)
29297        // 0x0010 - "dil 15" // standard input (motherboard)
29298        PORT_MODIFY("IN-19")
29299        // 0x0001 - "dil 16" // standard input (motherboard)
29300        PORT_MODIFY("IN-20")
29301        // 0x0001 - "test" // standard input (motherboard)
29302        // 0x0002 - "lock" // standard input (expected here)
29303        // 0x0004 - "topdor" // standard input (expected here)
29304        // 0x0008 - "botdor" // standard input (expected here)
29305        // 0x0010 - "hopdmp" // standard input (expected here)
29261      PORT_INCLUDE( sc4_base )
29262      PORT_MODIFY("IN-1")
29263      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29264      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29265      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29266      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29267      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
29268      PORT_MODIFY("IN-2")
29269      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
29270      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
29271      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29272      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29273      PORT_MODIFY("IN-8")
29274      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
29275      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nudge")
29276      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spin p")
29277      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spin c")
29278      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c pot")
29279      PORT_MODIFY("IN-16")
29280      // 0x0001 - "dil  1" // standard input (motherboard)
29281      // 0x0002 - "dil  2" // standard input (motherboard)
29282      // 0x0004 - "dil  3" // standard input (motherboard)
29283      // 0x0008 - "dil  4" // standard input (motherboard)
29284      // 0x0010 - "dil  5" // standard input (motherboard)
29285      // 0x0100 - "topup" // known extended input, usually 'top up'
29286      PORT_MODIFY("IN-17")
29287      // 0x0001 - "dil  6" // standard input (motherboard)
29288      // 0x0002 - "dil  7" // standard input (motherboard)
29289      // 0x0004 - "dil  8" // standard input (motherboard)
29290      // 0x0008 - "dil  9" // standard input (motherboard)
29291      // 0x0010 - "dil 10" // standard input (motherboard)
29292      PORT_MODIFY("IN-18")
29293      // 0x0001 - "dil 11" // standard input (motherboard)
29294      // 0x0002 - "dil 12" // standard input (motherboard)
29295      // 0x0004 - "dil 13" // standard input (motherboard)
29296      // 0x0008 - "dil 14" // standard input (motherboard)
29297      // 0x0010 - "dil 15" // standard input (motherboard)
29298      PORT_MODIFY("IN-19")
29299      // 0x0001 - "dil 16" // standard input (motherboard)
29300      PORT_MODIFY("IN-20")
29301      // 0x0001 - "test" // standard input (motherboard)
29302      // 0x0002 - "lock" // standard input (expected here)
29303      // 0x0004 - "topdor" // standard input (expected here)
29304      // 0x0008 - "botdor" // standard input (expected here)
29305      // 0x0010 - "hopdmp" // standard input (expected here)
2930629306INPUT_PORTS_END
2930729307
2930829308// PR2236 CLUB PINK PANTHER 411         CLUBPINKPANTHERSND         CLUB PINKPANTHER
r31373r31374
2932929329}
2933029330
2933129331INPUT_PORTS_START( sc4pipe ) // this structure is generated
29332        PORT_INCLUDE( sc4_base )
29333        PORT_MODIFY("IN-1")
29334        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
29335        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
29336        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
29337        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
29338        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
29339        PORT_MODIFY("IN-2")
29340        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
29341        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29342        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
29343        PORT_MODIFY("IN-8")
29344        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkecs")
29345        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cshhi")
29346        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cshlo")
29347        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("fetlo")
29348        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("fethi")
29349        PORT_MODIFY("IN-16")
29350        // 0x0001 - "dil 1" // standard input (motherboard)
29351        // 0x0002 - "dil 2" // standard input (motherboard)
29352        // 0x0004 - "dil 3" // standard input (motherboard)
29353        // 0x0008 - "dil 4" // standard input (motherboard)
29354        // 0x0010 - "dil 5" // standard input (motherboard)
29355        // 0x0100 - "topup" // known extended input, usually 'top up'
29356        PORT_MODIFY("IN-17")
29357        // 0x0001 - "dil 6" // standard input (motherboard)
29358        // 0x0002 - "dil 7" // standard input (motherboard)
29359        // 0x0004 - "dil 8" // standard input (motherboard)
29360        // 0x0008 - "dil 9" // standard input (motherboard)
29361        // 0x0010 - "dil10" // standard input (motherboard)
29362        PORT_MODIFY("IN-18")
29363        // 0x0001 - "dil11" // standard input (motherboard)
29364        // 0x0002 - "dil12" // standard input (motherboard)
29365        // 0x0004 - "dil13" // standard input (motherboard)
29366        // 0x0008 - "dil14" // standard input (motherboard)
29367        // 0x0010 - "dil15" // standard input (motherboard)
29368        PORT_MODIFY("IN-19")
29369        // 0x0001 - "dil16" // standard input (motherboard)
29370        PORT_MODIFY("IN-20")
29371        // 0x0001 - "test" // standard input (motherboard)
29372        // 0x0002 - "dorlk" // standard input (expected here)
29373        // 0x0004 - "tpdor" // standard input (expected here)
29374        // 0x0008 - "cshbx" // standard input (expected here)
29375        // 0x0010 - "deflt" // standard input (expected here)
29332      PORT_INCLUDE( sc4_base )
29333      PORT_MODIFY("IN-1")
29334      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
29335      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
29336      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
29337      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
29338      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
29339      PORT_MODIFY("IN-2")
29340      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
29341      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29342      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
29343      PORT_MODIFY("IN-8")
29344      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkecs")
29345      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cshhi")
29346      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cshlo")
29347      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("fetlo")
29348      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("fethi")
29349      PORT_MODIFY("IN-16")
29350      // 0x0001 - "dil 1" // standard input (motherboard)
29351      // 0x0002 - "dil 2" // standard input (motherboard)
29352      // 0x0004 - "dil 3" // standard input (motherboard)
29353      // 0x0008 - "dil 4" // standard input (motherboard)
29354      // 0x0010 - "dil 5" // standard input (motherboard)
29355      // 0x0100 - "topup" // known extended input, usually 'top up'
29356      PORT_MODIFY("IN-17")
29357      // 0x0001 - "dil 6" // standard input (motherboard)
29358      // 0x0002 - "dil 7" // standard input (motherboard)
29359      // 0x0004 - "dil 8" // standard input (motherboard)
29360      // 0x0008 - "dil 9" // standard input (motherboard)
29361      // 0x0010 - "dil10" // standard input (motherboard)
29362      PORT_MODIFY("IN-18")
29363      // 0x0001 - "dil11" // standard input (motherboard)
29364      // 0x0002 - "dil12" // standard input (motherboard)
29365      // 0x0004 - "dil13" // standard input (motherboard)
29366      // 0x0008 - "dil14" // standard input (motherboard)
29367      // 0x0010 - "dil15" // standard input (motherboard)
29368      PORT_MODIFY("IN-19")
29369      // 0x0001 - "dil16" // standard input (motherboard)
29370      PORT_MODIFY("IN-20")
29371      // 0x0001 - "test" // standard input (motherboard)
29372      // 0x0002 - "dorlk" // standard input (expected here)
29373      // 0x0004 - "tpdor" // standard input (expected here)
29374      // 0x0008 - "cshbx" // standard input (expected here)
29375      // 0x0010 - "deflt" // standard input (expected here)
2937629376INPUT_PORTS_END
2937729377
2937829378// PR2110 PIPING HOT         PIPE SOUNDS         PIPING HOT
r31373r31374
2939629396}
2939729397
2939829398INPUT_PORTS_START( sc4plumb ) // this structure is generated
29399        PORT_INCLUDE( sc4_base )
29400        PORT_MODIFY("IN-1")
29401        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29402        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29403        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29404        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29405        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
29406        PORT_MODIFY("IN-2")
29407        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
29408        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29409        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29410        PORT_MODIFY("IN-8")
29411        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudge")
29412        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
29413        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spin")
29414        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c pot")
29415        PORT_MODIFY("IN-16")
29416        // 0x0001 - "dil  1" // standard input (motherboard)
29417        // 0x0002 - "dil  2" // standard input (motherboard)
29418        // 0x0004 - "dil  3" // standard input (motherboard)
29419        // 0x0008 - "dil  4" // standard input (motherboard)
29420        // 0x0010 - "dil  5" // standard input (motherboard)
29421        // 0x0100 - "topup" // known extended input, usually 'top up'
29422        PORT_MODIFY("IN-17")
29423        // 0x0001 - "dil  6" // standard input (motherboard)
29424        // 0x0002 - "dil  7" // standard input (motherboard)
29425        // 0x0004 - "dil  8" // standard input (motherboard)
29426        // 0x0008 - "dil  9" // standard input (motherboard)
29427        // 0x0010 - "dil 10" // standard input (motherboard)
29428        PORT_MODIFY("IN-18")
29429        // 0x0001 - "dil 11" // standard input (motherboard)
29430        // 0x0002 - "dil 12" // standard input (motherboard)
29431        // 0x0004 - "dil 13" // standard input (motherboard)
29432        // 0x0008 - "dil 14" // standard input (motherboard)
29433        // 0x0010 - "dil 15" // standard input (motherboard)
29434        PORT_MODIFY("IN-19")
29435        // 0x0001 - "dil 16" // standard input (motherboard)
29436        PORT_MODIFY("IN-20")
29437        // 0x0001 - "test" // standard input (motherboard)
29438        // 0x0002 - "lock" // standard input (expected here)
29439        // 0x0004 - "topdor" // standard input (expected here)
29440        // 0x0008 - "botdor" // standard input (expected here)
29441        // 0x0010 - "hopdmp" // standard input (expected here)
29399      PORT_INCLUDE( sc4_base )
29400      PORT_MODIFY("IN-1")
29401      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29402      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29403      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29404      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29405      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
29406      PORT_MODIFY("IN-2")
29407      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
29408      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29409      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29410      PORT_MODIFY("IN-8")
29411      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudge")
29412      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
29413      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spin")
29414      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c pot")
29415      PORT_MODIFY("IN-16")
29416      // 0x0001 - "dil  1" // standard input (motherboard)
29417      // 0x0002 - "dil  2" // standard input (motherboard)
29418      // 0x0004 - "dil  3" // standard input (motherboard)
29419      // 0x0008 - "dil  4" // standard input (motherboard)
29420      // 0x0010 - "dil  5" // standard input (motherboard)
29421      // 0x0100 - "topup" // known extended input, usually 'top up'
29422      PORT_MODIFY("IN-17")
29423      // 0x0001 - "dil  6" // standard input (motherboard)
29424      // 0x0002 - "dil  7" // standard input (motherboard)
29425      // 0x0004 - "dil  8" // standard input (motherboard)
29426      // 0x0008 - "dil  9" // standard input (motherboard)
29427      // 0x0010 - "dil 10" // standard input (motherboard)
29428      PORT_MODIFY("IN-18")
29429      // 0x0001 - "dil 11" // standard input (motherboard)
29430      // 0x0002 - "dil 12" // standard input (motherboard)
29431      // 0x0004 - "dil 13" // standard input (motherboard)
29432      // 0x0008 - "dil 14" // standard input (motherboard)
29433      // 0x0010 - "dil 15" // standard input (motherboard)
29434      PORT_MODIFY("IN-19")
29435      // 0x0001 - "dil 16" // standard input (motherboard)
29436      PORT_MODIFY("IN-20")
29437      // 0x0001 - "test" // standard input (motherboard)
29438      // 0x0002 - "lock" // standard input (expected here)
29439      // 0x0004 - "topdor" // standard input (expected here)
29440      // 0x0008 - "botdor" // standard input (expected here)
29441      // 0x0010 - "hopdmp" // standard input (expected here)
2944229442INPUT_PORTS_END
2944329443
2944429444//  QPS142 CLUB PLUMB CRAZY  413         CLUBPLUMBCRAZYSND         CLUB PLUMB CRAZY
r31373r31374
2946929469}
2947029470
2947129471INPUT_PORTS_START( sc4polic ) // this structure is generated
29472        PORT_INCLUDE( sc4_base )
29473        PORT_MODIFY("IN-1")
29474        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29475        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29476        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29477        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29478        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
29479        PORT_MODIFY("IN-2")
29480        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
29481        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29482        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29483        PORT_MODIFY("IN-16")
29484        // 0x0001 - "dil  1" // standard input (motherboard)
29485        // 0x0002 - "dil  2" // standard input (motherboard)
29486        // 0x0004 - "dil  3" // standard input (motherboard)
29487        // 0x0008 - "dil  4" // standard input (motherboard)
29488        // 0x0010 - "dil  5" // standard input (motherboard)
29489        // 0x0100 - "topup" // known extended input, usually 'top up'
29490        PORT_MODIFY("IN-17")
29491        // 0x0001 - "dil  6" // standard input (motherboard)
29492        // 0x0002 - "dil  7" // standard input (motherboard)
29493        // 0x0004 - "dil  8" // standard input (motherboard)
29494        // 0x0008 - "dil  9" // standard input (motherboard)
29495        // 0x0010 - "dil 10" // standard input (motherboard)
29496        PORT_MODIFY("IN-18")
29497        // 0x0001 - "dil 11" // standard input (motherboard)
29498        // 0x0002 - "dil 12" // standard input (motherboard)
29499        // 0x0004 - "dil 13" // standard input (motherboard)
29500        // 0x0008 - "dil 14" // standard input (motherboard)
29501        // 0x0010 - "dil 15" // standard input (motherboard)
29502        PORT_MODIFY("IN-19")
29503        // 0x0001 - "dil 16" // standard input (motherboard)
29504        PORT_MODIFY("IN-20")
29505        // 0x0001 - "test" // standard input (motherboard)
29506        // 0x0002 - "lock" // standard input (expected here)
29507        // 0x0004 - "topdor" // standard input (expected here)
29508        // 0x0008 - "botdor" // standard input (expected here)
29509        // 0x0010 - "hopdmp" // standard input (expected here)
29472      PORT_INCLUDE( sc4_base )
29473      PORT_MODIFY("IN-1")
29474      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29475      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29476      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29477      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29478      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
29479      PORT_MODIFY("IN-2")
29480      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
29481      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29482      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29483      PORT_MODIFY("IN-16")
29484      // 0x0001 - "dil  1" // standard input (motherboard)
29485      // 0x0002 - "dil  2" // standard input (motherboard)
29486      // 0x0004 - "dil  3" // standard input (motherboard)
29487      // 0x0008 - "dil  4" // standard input (motherboard)
29488      // 0x0010 - "dil  5" // standard input (motherboard)
29489      // 0x0100 - "topup" // known extended input, usually 'top up'
29490      PORT_MODIFY("IN-17")
29491      // 0x0001 - "dil  6" // standard input (motherboard)
29492      // 0x0002 - "dil  7" // standard input (motherboard)
29493      // 0x0004 - "dil  8" // standard input (motherboard)
29494      // 0x0008 - "dil  9" // standard input (motherboard)
29495      // 0x0010 - "dil 10" // standard input (motherboard)
29496      PORT_MODIFY("IN-18")
29497      // 0x0001 - "dil 11" // standard input (motherboard)
29498      // 0x0002 - "dil 12" // standard input (motherboard)
29499      // 0x0004 - "dil 13" // standard input (motherboard)
29500      // 0x0008 - "dil 14" // standard input (motherboard)
29501      // 0x0010 - "dil 15" // standard input (motherboard)
29502      PORT_MODIFY("IN-19")
29503      // 0x0001 - "dil 16" // standard input (motherboard)
29504      PORT_MODIFY("IN-20")
29505      // 0x0001 - "test" // standard input (motherboard)
29506      // 0x0002 - "lock" // standard input (expected here)
29507      // 0x0004 - "topdor" // standard input (expected here)
29508      // 0x0008 - "botdor" // standard input (expected here)
29509      // 0x0010 - "hopdmp" // standard input (expected here)
2951029510INPUT_PORTS_END
2951129511
2951229512// PR2514 POLICE SQUID V1.0          POLICESQUIDSND           POLICE SQUID
r31373r31374
2953429534}
2953529535
2953629536INPUT_PORTS_START( sc4potsh ) // this structure is generated
29537        PORT_INCLUDE( sc4_base )
29538        PORT_MODIFY("IN-1")
29539        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29540        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("trans")
29541        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
29542        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
29543        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
29544        PORT_MODIFY("IN-2")
29545        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
29546        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29547        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29548        PORT_MODIFY("IN-8")
29549        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
29550        PORT_MODIFY("IN-16")
29551        // 0x0001 - "dil  1" // standard input (motherboard)
29552        // 0x0002 - "dil  2" // standard input (motherboard)
29553        // 0x0004 - "dil  3" // standard input (motherboard)
29554        // 0x0008 - "dil  4" // standard input (motherboard)
29555        // 0x0010 - "dil  5" // standard input (motherboard)
29556        // 0x0100 - "topup" // known extended input, usually 'top up'
29557        PORT_MODIFY("IN-17")
29558        // 0x0001 - "dil  6" // standard input (motherboard)
29559        // 0x0002 - "dil  7" // standard input (motherboard)
29560        // 0x0004 - "dil  8" // standard input (motherboard)
29561        // 0x0008 - "dil  9" // standard input (motherboard)
29562        // 0x0010 - "dil 10" // standard input (motherboard)
29563        PORT_MODIFY("IN-18")
29564        // 0x0001 - "dil 11" // standard input (motherboard)
29565        // 0x0002 - "dil 12" // standard input (motherboard)
29566        // 0x0004 - "dil 13" // standard input (motherboard)
29567        // 0x0008 - "dil 14" // standard input (motherboard)
29568        // 0x0010 - "dil 15" // standard input (motherboard)
29569        PORT_MODIFY("IN-19")
29570        // 0x0001 - "dil 16" // standard input (motherboard)
29571        PORT_MODIFY("IN-20")
29572        // 0x0001 - "test" // standard input (motherboard)
29573        // 0x0002 - "lock" // standard input (expected here)
29574        // 0x0004 - "topdor" // standard input (expected here)
29575        // 0x0008 - "botdor" // standard input (expected here)
29576        // 0x0010 - "hopdmp" // standard input (expected here)
29537      PORT_INCLUDE( sc4_base )
29538      PORT_MODIFY("IN-1")
29539      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29540      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("trans")
29541      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
29542      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
29543      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
29544      PORT_MODIFY("IN-2")
29545      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
29546      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29547      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29548      PORT_MODIFY("IN-8")
29549      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
29550      PORT_MODIFY("IN-16")
29551      // 0x0001 - "dil  1" // standard input (motherboard)
29552      // 0x0002 - "dil  2" // standard input (motherboard)
29553      // 0x0004 - "dil  3" // standard input (motherboard)
29554      // 0x0008 - "dil  4" // standard input (motherboard)
29555      // 0x0010 - "dil  5" // standard input (motherboard)
29556      // 0x0100 - "topup" // known extended input, usually 'top up'
29557      PORT_MODIFY("IN-17")
29558      // 0x0001 - "dil  6" // standard input (motherboard)
29559      // 0x0002 - "dil  7" // standard input (motherboard)
29560      // 0x0004 - "dil  8" // standard input (motherboard)
29561      // 0x0008 - "dil  9" // standard input (motherboard)
29562      // 0x0010 - "dil 10" // standard input (motherboard)
29563      PORT_MODIFY("IN-18")
29564      // 0x0001 - "dil 11" // standard input (motherboard)
29565      // 0x0002 - "dil 12" // standard input (motherboard)
29566      // 0x0004 - "dil 13" // standard input (motherboard)
29567      // 0x0008 - "dil 14" // standard input (motherboard)
29568      // 0x0010 - "dil 15" // standard input (motherboard)
29569      PORT_MODIFY("IN-19")
29570      // 0x0001 - "dil 16" // standard input (motherboard)
29571      PORT_MODIFY("IN-20")
29572      // 0x0001 - "test" // standard input (motherboard)
29573      // 0x0002 - "lock" // standard input (expected here)
29574      // 0x0004 - "topdor" // standard input (expected here)
29575      // 0x0008 - "botdor" // standard input (expected here)
29576      // 0x0010 - "hopdmp" // standard input (expected here)
2957729577INPUT_PORTS_END
2957829578
2957929579// QPS143 POT SHOT V1.0         POTSHOTSND             POT SHOT
r31373r31374
2959829598}
2959929599
2960029600INPUT_PORTS_START( sc4pogbl ) // this structure is generated
29601        PORT_INCLUDE( sc4_base )
29602        PORT_MODIFY("IN-1")
29603        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29604        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29605        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29606        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29607        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
29608        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
29609        PORT_MODIFY("IN-2")
29610        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("collec")
29611        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stop")
29612        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("tra/ex")
29613        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29614        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
29615        PORT_MODIFY("IN-3")
29616        // 0x0004 - "stk 4" // standard input (expected here)
29617        // 0x0008 - "stk 3" // standard input (expected here)
29618        // 0x0010 - "stk 2" // standard input (expected here)
29619        PORT_MODIFY("IN-4")
29620        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
29621        PORT_MODIFY("IN-5")
29622        // 0x0001 - "priz4" // standard input (expected here)
29623        // 0x0002 - "priz3" // standard input (expected here)
29624        // 0x0004 - "priz2" // standard input (expected here)
29625        // 0x0008 - "priz1" // standard input (expected here)
29626        PORT_MODIFY("IN-16")
29627        // 0x0001 - "dil 1" // standard input (motherboard)
29628        // 0x0002 - "dil 2" // standard input (motherboard)
29629        // 0x0004 - "dil 3" // standard input (motherboard)
29630        // 0x0008 - "dil 4" // standard input (motherboard)
29631        // 0x0010 - "dil 5" // standard input (motherboard)
29632        // 0x0100 - "top up" // known extended input, usually 'top up'
29633        PORT_MODIFY("IN-17")
29634        // 0x0001 - "dil 6" // standard input (motherboard)
29635        // 0x0002 - "dil 7" // standard input (motherboard)
29636        // 0x0004 - "dil 8" // standard input (motherboard)
29637        // 0x0008 - "dil 9" // standard input (motherboard)
29638        // 0x0010 - "dil10" // standard input (motherboard)
29639        PORT_MODIFY("IN-18")
29640        // 0x0001 - "dil11" // standard input (motherboard)
29641        // 0x0002 - "dil12" // standard input (motherboard)
29642        // 0x0004 - "dil13" // standard input (motherboard)
29643        // 0x0008 - "dil14" // standard input (motherboard)
29644        // 0x0010 - "dil15" // standard input (motherboard)
29645        PORT_MODIFY("IN-19")
29646        // 0x0001 - "dil16" // standard input (motherboard)
29647        PORT_MODIFY("IN-20")
29648        // 0x0001 - "grnbut" // standard input (motherboard)
29649        // 0x0002 - "dorlok" // standard input (expected here)
29650        // 0x0004 - "topdor" // standard input (expected here)
29651        // 0x0008 - "botdor" // standard input (expected here)
29652        // 0x0010 - "hopdmp" // standard input (expected here)
29601      PORT_INCLUDE( sc4_base )
29602      PORT_MODIFY("IN-1")
29603      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29604      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29605      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29606      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29607      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
29608      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
29609      PORT_MODIFY("IN-2")
29610      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("collec")
29611      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stop")
29612      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("tra/ex")
29613      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29614      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
29615      PORT_MODIFY("IN-3")
29616      // 0x0004 - "stk 4" // standard input (expected here)
29617      // 0x0008 - "stk 3" // standard input (expected here)
29618      // 0x0010 - "stk 2" // standard input (expected here)
29619      PORT_MODIFY("IN-4")
29620      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
29621      PORT_MODIFY("IN-5")
29622      // 0x0001 - "priz4" // standard input (expected here)
29623      // 0x0002 - "priz3" // standard input (expected here)
29624      // 0x0004 - "priz2" // standard input (expected here)
29625      // 0x0008 - "priz1" // standard input (expected here)
29626      PORT_MODIFY("IN-16")
29627      // 0x0001 - "dil 1" // standard input (motherboard)
29628      // 0x0002 - "dil 2" // standard input (motherboard)
29629      // 0x0004 - "dil 3" // standard input (motherboard)
29630      // 0x0008 - "dil 4" // standard input (motherboard)
29631      // 0x0010 - "dil 5" // standard input (motherboard)
29632      // 0x0100 - "top up" // known extended input, usually 'top up'
29633      PORT_MODIFY("IN-17")
29634      // 0x0001 - "dil 6" // standard input (motherboard)
29635      // 0x0002 - "dil 7" // standard input (motherboard)
29636      // 0x0004 - "dil 8" // standard input (motherboard)
29637      // 0x0008 - "dil 9" // standard input (motherboard)
29638      // 0x0010 - "dil10" // standard input (motherboard)
29639      PORT_MODIFY("IN-18")
29640      // 0x0001 - "dil11" // standard input (motherboard)
29641      // 0x0002 - "dil12" // standard input (motherboard)
29642      // 0x0004 - "dil13" // standard input (motherboard)
29643      // 0x0008 - "dil14" // standard input (motherboard)
29644      // 0x0010 - "dil15" // standard input (motherboard)
29645      PORT_MODIFY("IN-19")
29646      // 0x0001 - "dil16" // standard input (motherboard)
29647      PORT_MODIFY("IN-20")
29648      // 0x0001 - "grnbut" // standard input (motherboard)
29649      // 0x0002 - "dorlok" // standard input (expected here)
29650      // 0x0004 - "topdor" // standard input (expected here)
29651      // 0x0008 - "botdor" // standard input (expected here)
29652      // 0x0010 - "hopdmp" // standard input (expected here)
2965329653INPUT_PORTS_END
2965429654
2965529655// PR3083 CLUB POTS OF GOLD         POTS OF GOLD  CLUB  PR3082 C POTS OF GOLD SOUNDS11      POTS OF GOLD
r31373r31374
2967729677}
2967829678
2967929679INPUT_PORTS_START( sc4pwrsg ) // this structure is generated
29680        PORT_INCLUDE( sc4_base )
29681        PORT_MODIFY("IN-1")
29682        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29683        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29684        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29685        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29686        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exchge")
29687        PORT_MODIFY("IN-2")
29688        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake")
29689        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29690        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29691        PORT_MODIFY("IN-8")
29692        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("step r")
29693        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step l")
29694        PORT_MODIFY("IN-16")
29695        // 0x0001 - "dil  1" // standard input (motherboard)
29696        // 0x0002 - "dil  2" // standard input (motherboard)
29697        // 0x0004 - "dil  3" // standard input (motherboard)
29698        // 0x0008 - "dil  4" // standard input (motherboard)
29699        // 0x0010 - "dil  5" // standard input (motherboard)
29700        // 0x0100 - "topup" // known extended input, usually 'top up'
29701        PORT_MODIFY("IN-17")
29702        // 0x0001 - "dil  6" // standard input (motherboard)
29703        // 0x0002 - "dil  7" // standard input (motherboard)
29704        // 0x0004 - "dil  8" // standard input (motherboard)
29705        // 0x0008 - "dil  9" // standard input (motherboard)
29706        // 0x0010 - "dil 10" // standard input (motherboard)
29707        PORT_MODIFY("IN-18")
29708        // 0x0001 - "dil 11" // standard input (motherboard)
29709        // 0x0002 - "dil 12" // standard input (motherboard)
29710        // 0x0004 - "dil 13" // standard input (motherboard)
29711        // 0x0008 - "dil 14" // standard input (motherboard)
29712        // 0x0010 - "dil 15" // standard input (motherboard)
29713        PORT_MODIFY("IN-19")
29714        // 0x0001 - "dil 16" // standard input (motherboard)
29715        PORT_MODIFY("IN-20")
29716        // 0x0001 - "test" // standard input (motherboard)
29717        // 0x0002 - "lock" // standard input (expected here)
29718        // 0x0004 - "topdor" // standard input (expected here)
29719        // 0x0008 - "botdor" // standard input (expected here)
29720        // 0x0010 - "hopdmp" // standard input (expected here)
29680      PORT_INCLUDE( sc4_base )
29681      PORT_MODIFY("IN-1")
29682      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29683      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29684      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29685      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29686      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exchge")
29687      PORT_MODIFY("IN-2")
29688      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake")
29689      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29690      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29691      PORT_MODIFY("IN-8")
29692      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("step r")
29693      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step l")
29694      PORT_MODIFY("IN-16")
29695      // 0x0001 - "dil  1" // standard input (motherboard)
29696      // 0x0002 - "dil  2" // standard input (motherboard)
29697      // 0x0004 - "dil  3" // standard input (motherboard)
29698      // 0x0008 - "dil  4" // standard input (motherboard)
29699      // 0x0010 - "dil  5" // standard input (motherboard)
29700      // 0x0100 - "topup" // known extended input, usually 'top up'
29701      PORT_MODIFY("IN-17")
29702      // 0x0001 - "dil  6" // standard input (motherboard)
29703      // 0x0002 - "dil  7" // standard input (motherboard)
29704      // 0x0004 - "dil  8" // standard input (motherboard)
29705      // 0x0008 - "dil  9" // standard input (motherboard)
29706      // 0x0010 - "dil 10" // standard input (motherboard)
29707      PORT_MODIFY("IN-18")
29708      // 0x0001 - "dil 11" // standard input (motherboard)
29709      // 0x0002 - "dil 12" // standard input (motherboard)
29710      // 0x0004 - "dil 13" // standard input (motherboard)
29711      // 0x0008 - "dil 14" // standard input (motherboard)
29712      // 0x0010 - "dil 15" // standard input (motherboard)
29713      PORT_MODIFY("IN-19")
29714      // 0x0001 - "dil 16" // standard input (motherboard)
29715      PORT_MODIFY("IN-20")
29716      // 0x0001 - "test" // standard input (motherboard)
29717      // 0x0002 - "lock" // standard input (expected here)
29718      // 0x0004 - "topdor" // standard input (expected here)
29719      // 0x0008 - "botdor" // standard input (expected here)
29720      // 0x0010 - "hopdmp" // standard input (expected here)
2972129721INPUT_PORTS_END
2972229722
2972329723// PR2053 POWERSURGE         SURGESND            POWERSURGE
r31373r31374
2974329743}
2974429744
2974529745INPUT_PORTS_START( sc4pir ) // this structure is generated
29746        PORT_INCLUDE( sc4_base )
29747        PORT_MODIFY("IN-1")
29748        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29749        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
29750        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
29751        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
29752        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
29753        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
29754        PORT_MODIFY("IN-2")
29755        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
29756        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29757        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29758        PORT_MODIFY("IN-3")
29759        // 0x0004 - "stk 4" // standard input (expected here)
29760        // 0x0008 - "stk 3" // standard input (expected here)
29761        // 0x0010 - "stk 2" // standard input (expected here)
29762        PORT_MODIFY("IN-4")
29763        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
29764        PORT_MODIFY("IN-5")
29765        // 0x0001 - "priz4" // standard input (expected here)
29766        // 0x0002 - "priz3" // standard input (expected here)
29767        // 0x0004 - "priz2" // standard input (expected here)
29768        // 0x0008 - "priz1" // standard input (expected here)
29769        PORT_MODIFY("IN-6")
29770        // 0x0001 - "perc1" // standard input (expected here)
29771        // 0x0002 - "perc2" // standard input (expected here)
29772        // 0x0004 - "perc3" // standard input (expected here)
29773        // 0x0008 - "perc4" // standard input (expected here)
29774        PORT_MODIFY("IN-8")
29775        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
29776        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
29777        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk csh")
29778        PORT_MODIFY("IN-16")
29779        // 0x0001 - "dil 1" // standard input (motherboard)
29780        // 0x0002 - "dil 2" // standard input (motherboard)
29781        // 0x0004 - "dil 3" // standard input (motherboard)
29782        // 0x0008 - "dil 4" // standard input (motherboard)
29783        // 0x0010 - "dil 5" // standard input (motherboard)
29784        // 0x0100 - "htopup" // known extended input, usually 'top up'
29785        PORT_MODIFY("IN-17")
29786        // 0x0001 - "dil 6" // standard input (motherboard)
29787        // 0x0002 - "dil 7" // standard input (motherboard)
29788        // 0x0004 - "dil 8" // standard input (motherboard)
29789        // 0x0008 - "dil 9" // standard input (motherboard)
29790        // 0x0010 - "dil 10" // standard input (motherboard)
29791        PORT_MODIFY("IN-18")
29792        // 0x0001 - "dil 11" // standard input (motherboard)
29793        // 0x0002 - "dil 12" // standard input (motherboard)
29794        // 0x0004 - "dil 13" // standard input (motherboard)
29795        // 0x0008 - "dil 14" // standard input (motherboard)
29796        // 0x0010 - "dil 15" // standard input (motherboard)
29797        PORT_MODIFY("IN-19")
29798        // 0x0001 - "dil 16" // standard input (motherboard)
29799        PORT_MODIFY("IN-20")
29800        // 0x0001 - "grnbut" // standard input (motherboard)
29801        // 0x0002 - "dorlok" // standard input (expected here)
29802        // 0x0004 - "serdor" // standard input (expected here)
29803        // 0x0008 - "cshdor" // standard input (expected here)
29804        // 0x0010 - "hopdmp" // standard input (expected here)
29746      PORT_INCLUDE( sc4_base )
29747      PORT_MODIFY("IN-1")
29748      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29749      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
29750      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
29751      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
29752      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
29753      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
29754      PORT_MODIFY("IN-2")
29755      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
29756      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29757      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29758      PORT_MODIFY("IN-3")
29759      // 0x0004 - "stk 4" // standard input (expected here)
29760      // 0x0008 - "stk 3" // standard input (expected here)
29761      // 0x0010 - "stk 2" // standard input (expected here)
29762      PORT_MODIFY("IN-4")
29763      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
29764      PORT_MODIFY("IN-5")
29765      // 0x0001 - "priz4" // standard input (expected here)
29766      // 0x0002 - "priz3" // standard input (expected here)
29767      // 0x0004 - "priz2" // standard input (expected here)
29768      // 0x0008 - "priz1" // standard input (expected here)
29769      PORT_MODIFY("IN-6")
29770      // 0x0001 - "perc1" // standard input (expected here)
29771      // 0x0002 - "perc2" // standard input (expected here)
29772      // 0x0004 - "perc3" // standard input (expected here)
29773      // 0x0008 - "perc4" // standard input (expected here)
29774      PORT_MODIFY("IN-8")
29775      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
29776      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
29777      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk csh")
29778      PORT_MODIFY("IN-16")
29779      // 0x0001 - "dil 1" // standard input (motherboard)
29780      // 0x0002 - "dil 2" // standard input (motherboard)
29781      // 0x0004 - "dil 3" // standard input (motherboard)
29782      // 0x0008 - "dil 4" // standard input (motherboard)
29783      // 0x0010 - "dil 5" // standard input (motherboard)
29784      // 0x0100 - "htopup" // known extended input, usually 'top up'
29785      PORT_MODIFY("IN-17")
29786      // 0x0001 - "dil 6" // standard input (motherboard)
29787      // 0x0002 - "dil 7" // standard input (motherboard)
29788      // 0x0004 - "dil 8" // standard input (motherboard)
29789      // 0x0008 - "dil 9" // standard input (motherboard)
29790      // 0x0010 - "dil 10" // standard input (motherboard)
29791      PORT_MODIFY("IN-18")
29792      // 0x0001 - "dil 11" // standard input (motherboard)
29793      // 0x0002 - "dil 12" // standard input (motherboard)
29794      // 0x0004 - "dil 13" // standard input (motherboard)
29795      // 0x0008 - "dil 14" // standard input (motherboard)
29796      // 0x0010 - "dil 15" // standard input (motherboard)
29797      PORT_MODIFY("IN-19")
29798      // 0x0001 - "dil 16" // standard input (motherboard)
29799      PORT_MODIFY("IN-20")
29800      // 0x0001 - "grnbut" // standard input (motherboard)
29801      // 0x0002 - "dorlok" // standard input (expected here)
29802      // 0x0004 - "serdor" // standard input (expected here)
29803      // 0x0008 - "cshdor" // standard input (expected here)
29804      // 0x0010 - "hopdmp" // standard input (expected here)
2980529805INPUT_PORTS_END
2980629806
2980729807// PR1303 THE PRIZE IS RIGHT         PR1303 T PRIZE I R SOUNDS11
r31373r31374
2983129831}
2983229832
2983329833INPUT_PORTS_START( sc4qmodo ) // this structure is generated
29834        PORT_INCLUDE( sc4_base )
29835        PORT_MODIFY("IN-1")
29836        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29837        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29838        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29839        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29840        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
29841        PORT_MODIFY("IN-2")
29842        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("excha")
29843        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stake")
29844        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29845        PORT_MODIFY("IN-7")
29846        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_0 ) PORT_NAME("bonus")
29847        PORT_MODIFY("IN-16")
29848        // 0x0001 - "dil 1" // standard input (motherboard)
29849        // 0x0002 - "dil 2" // standard input (motherboard)
29850        // 0x0004 - "dil 3" // standard input (motherboard)
29851        // 0x0008 - "dil 4" // standard input (motherboard)
29852        // 0x0010 - "dil 5" // standard input (motherboard)
29853        PORT_MODIFY("IN-17")
29854        // 0x0001 - "dil 6" // standard input (motherboard)
29855        // 0x0002 - "dil 7" // standard input (motherboard)
29856        // 0x0004 - "dil 8" // standard input (motherboard)
29857        // 0x0008 - "dil 9" // standard input (motherboard)
29858        // 0x0010 - "dil 10" // standard input (motherboard)
29859        PORT_MODIFY("IN-18")
29860        // 0x0001 - "dil 11" // standard input (motherboard)
29861        // 0x0002 - "dil 12" // standard input (motherboard)
29862        // 0x0004 - "dil 13" // standard input (motherboard)
29863        // 0x0008 - "dil 14" // standard input (motherboard)
29864        // 0x0010 - "dil 15" // standard input (motherboard)
29865        PORT_MODIFY("IN-19")
29866        // 0x0001 - "dil 16" // standard input (motherboard)
29867        PORT_MODIFY("IN-20")
29868        // 0x0001 - "green" // standard input (motherboard)
29834      PORT_INCLUDE( sc4_base )
29835      PORT_MODIFY("IN-1")
29836      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29837      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29838      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29839      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29840      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
29841      PORT_MODIFY("IN-2")
29842      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("excha")
29843      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stake")
29844      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29845      PORT_MODIFY("IN-7")
29846      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_0 ) PORT_NAME("bonus")
29847      PORT_MODIFY("IN-16")
29848      // 0x0001 - "dil 1" // standard input (motherboard)
29849      // 0x0002 - "dil 2" // standard input (motherboard)
29850      // 0x0004 - "dil 3" // standard input (motherboard)
29851      // 0x0008 - "dil 4" // standard input (motherboard)
29852      // 0x0010 - "dil 5" // standard input (motherboard)
29853      PORT_MODIFY("IN-17")
29854      // 0x0001 - "dil 6" // standard input (motherboard)
29855      // 0x0002 - "dil 7" // standard input (motherboard)
29856      // 0x0004 - "dil 8" // standard input (motherboard)
29857      // 0x0008 - "dil 9" // standard input (motherboard)
29858      // 0x0010 - "dil 10" // standard input (motherboard)
29859      PORT_MODIFY("IN-18")
29860      // 0x0001 - "dil 11" // standard input (motherboard)
29861      // 0x0002 - "dil 12" // standard input (motherboard)
29862      // 0x0004 - "dil 13" // standard input (motherboard)
29863      // 0x0008 - "dil 14" // standard input (motherboard)
29864      // 0x0010 - "dil 15" // standard input (motherboard)
29865      PORT_MODIFY("IN-19")
29866      // 0x0001 - "dil 16" // standard input (motherboard)
29867      PORT_MODIFY("IN-20")
29868      // 0x0001 - "green" // standard input (motherboard)
2986929869INPUT_PORTS_END
2987029870
2987129871// QUAZZI MO' DOUGH..........QUAZZSND.......  (no standard header)
r31373r31374
2989229892}
2989329893
2989429894INPUT_PORTS_START( sc4quidr ) // this structure is generated
29895        PORT_INCLUDE( sc4_base )
29896        PORT_MODIFY("IN-1")
29897        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29898        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29899        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29900        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29901        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
29902        PORT_MODIFY("IN-2")
29903        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
29904        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29905        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29906        PORT_MODIFY("IN-8")
29907        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nshoot")
29908        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shots")
29909        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cshoot")
29910        PORT_MODIFY("IN-16")
29911        // 0x0001 - "dil  1" // standard input (motherboard)
29912        // 0x0002 - "dil  2" // standard input (motherboard)
29913        // 0x0004 - "dil  3" // standard input (motherboard)
29914        // 0x0008 - "dil  4" // standard input (motherboard)
29915        // 0x0010 - "dil  5" // standard input (motherboard)
29916        // 0x0100 - "topup" // known extended input, usually 'top up'
29917        PORT_MODIFY("IN-17")
29918        // 0x0001 - "dil  6" // standard input (motherboard)
29919        // 0x0002 - "dil  7" // standard input (motherboard)
29920        // 0x0004 - "dil  8" // standard input (motherboard)
29921        // 0x0008 - "dil  9" // standard input (motherboard)
29922        // 0x0010 - "dil 10" // standard input (motherboard)
29923        PORT_MODIFY("IN-18")
29924        // 0x0001 - "dil 11" // standard input (motherboard)
29925        // 0x0002 - "dil 12" // standard input (motherboard)
29926        // 0x0004 - "dil 13" // standard input (motherboard)
29927        // 0x0008 - "dil 14" // standard input (motherboard)
29928        // 0x0010 - "dil 15" // standard input (motherboard)
29929        PORT_MODIFY("IN-19")
29930        // 0x0001 - "dil 16" // standard input (motherboard)
29931        PORT_MODIFY("IN-20")
29932        // 0x0001 - "test" // standard input (motherboard)
29933        // 0x0002 - "lock" // standard input (expected here)
29934        // 0x0004 - "topdor" // standard input (expected here)
29935        // 0x0008 - "botdor" // standard input (expected here)
29936        // 0x0010 - "hopdmp" // standard input (expected here)
29895      PORT_INCLUDE( sc4_base )
29896      PORT_MODIFY("IN-1")
29897      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
29898      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
29899      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
29900      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
29901      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
29902      PORT_MODIFY("IN-2")
29903      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
29904      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29905      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29906      PORT_MODIFY("IN-8")
29907      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nshoot")
29908      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shots")
29909      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cshoot")
29910      PORT_MODIFY("IN-16")
29911      // 0x0001 - "dil  1" // standard input (motherboard)
29912      // 0x0002 - "dil  2" // standard input (motherboard)
29913      // 0x0004 - "dil  3" // standard input (motherboard)
29914      // 0x0008 - "dil  4" // standard input (motherboard)
29915      // 0x0010 - "dil  5" // standard input (motherboard)
29916      // 0x0100 - "topup" // known extended input, usually 'top up'
29917      PORT_MODIFY("IN-17")
29918      // 0x0001 - "dil  6" // standard input (motherboard)
29919      // 0x0002 - "dil  7" // standard input (motherboard)
29920      // 0x0004 - "dil  8" // standard input (motherboard)
29921      // 0x0008 - "dil  9" // standard input (motherboard)
29922      // 0x0010 - "dil 10" // standard input (motherboard)
29923      PORT_MODIFY("IN-18")
29924      // 0x0001 - "dil 11" // standard input (motherboard)
29925      // 0x0002 - "dil 12" // standard input (motherboard)
29926      // 0x0004 - "dil 13" // standard input (motherboard)
29927      // 0x0008 - "dil 14" // standard input (motherboard)
29928      // 0x0010 - "dil 15" // standard input (motherboard)
29929      PORT_MODIFY("IN-19")
29930      // 0x0001 - "dil 16" // standard input (motherboard)
29931      PORT_MODIFY("IN-20")
29932      // 0x0001 - "test" // standard input (motherboard)
29933      // 0x0002 - "lock" // standard input (expected here)
29934      // 0x0004 - "topdor" // standard input (expected here)
29935      // 0x0008 - "botdor" // standard input (expected here)
29936      // 0x0010 - "hopdmp" // standard input (expected here)
2993729937INPUT_PORTS_END
2993829938
2993929939GAMEL( 200?, sc4quidr    ,0,         sc4, sc4quidr, sc4_state, sc4quidr, ROT0, "Qps","Quid Rock (Qps) (Scorpion 4) (set 1)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
r31373r31374
2995829958}
2995929959
2996029960INPUT_PORTS_START( sc4rdrag ) // this structure is generated
29961        PORT_INCLUDE( sc4_base )
29962        PORT_MODIFY("IN-1")
29963        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
29964        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
29965        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
29966        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
29967        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
29968        PORT_MODIFY("IN-2")
29969        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
29970        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29971        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29972        PORT_MODIFY("IN-8")
29973        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudge")
29974        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
29975        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spins")
29976        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c pot")
29977        PORT_MODIFY("IN-16")
29978        // 0x0001 - "dil  1" // standard input (motherboard)
29979        // 0x0002 - "dil  2" // standard input (motherboard)
29980        // 0x0004 - "dil  3" // standard input (motherboard)
29981        // 0x0008 - "dil  4" // standard input (motherboard)
29982        // 0x0010 - "dil  5" // standard input (motherboard)
29983        // 0x0100 - "topup" // known extended input, usually 'top up'
29984        PORT_MODIFY("IN-17")
29985        // 0x0001 - "dil  6" // standard input (motherboard)
29986        // 0x0002 - "dil  7" // standard input (motherboard)
29987        // 0x0004 - "dil  8" // standard input (motherboard)
29988        // 0x0008 - "dil  9" // standard input (motherboard)
29989        // 0x0010 - "dil 10" // standard input (motherboard)
29990        PORT_MODIFY("IN-18")
29991        // 0x0001 - "dil 11" // standard input (motherboard)
29992        // 0x0002 - "dil 12" // standard input (motherboard)
29993        // 0x0004 - "dil 13" // standard input (motherboard)
29994        // 0x0008 - "dil 14" // standard input (motherboard)
29995        // 0x0010 - "dil 15" // standard input (motherboard)
29996        PORT_MODIFY("IN-19")
29997        // 0x0001 - "dil 16" // standard input (motherboard)
29998        PORT_MODIFY("IN-20")
29999        // 0x0001 - "test" // standard input (motherboard)
30000        // 0x0002 - "lock" // standard input (expected here)
30001        // 0x0004 - "topdor" // standard input (expected here)
30002        // 0x0008 - "botdor" // standard input (expected here)
30003        // 0x0010 - "hopdmp" // standard input (expected here)
29961      PORT_INCLUDE( sc4_base )
29962      PORT_MODIFY("IN-1")
29963      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
29964      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
29965      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
29966      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
29967      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
29968      PORT_MODIFY("IN-2")
29969      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
29970      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
29971      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
29972      PORT_MODIFY("IN-8")
29973      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudge")
29974      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
29975      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spins")
29976      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c pot")
29977      PORT_MODIFY("IN-16")
29978      // 0x0001 - "dil  1" // standard input (motherboard)
29979      // 0x0002 - "dil  2" // standard input (motherboard)
29980      // 0x0004 - "dil  3" // standard input (motherboard)
29981      // 0x0008 - "dil  4" // standard input (motherboard)
29982      // 0x0010 - "dil  5" // standard input (motherboard)
29983      // 0x0100 - "topup" // known extended input, usually 'top up'
29984      PORT_MODIFY("IN-17")
29985      // 0x0001 - "dil  6" // standard input (motherboard)
29986      // 0x0002 - "dil  7" // standard input (motherboard)
29987      // 0x0004 - "dil  8" // standard input (motherboard)
29988      // 0x0008 - "dil  9" // standard input (motherboard)
29989      // 0x0010 - "dil 10" // standard input (motherboard)
29990      PORT_MODIFY("IN-18")
29991      // 0x0001 - "dil 11" // standard input (motherboard)
29992      // 0x0002 - "dil 12" // standard input (motherboard)
29993      // 0x0004 - "dil 13" // standard input (motherboard)
29994      // 0x0008 - "dil 14" // standard input (motherboard)
29995      // 0x0010 - "dil 15" // standard input (motherboard)
29996      PORT_MODIFY("IN-19")
29997      // 0x0001 - "dil 16" // standard input (motherboard)
29998      PORT_MODIFY("IN-20")
29999      // 0x0001 - "test" // standard input (motherboard)
30000      // 0x0002 - "lock" // standard input (expected here)
30001      // 0x0004 - "topdor" // standard input (expected here)
30002      // 0x0008 - "botdor" // standard input (expected here)
30003      // 0x0010 - "hopdmp" // standard input (expected here)
3000430004INPUT_PORTS_END
3000530005
3000630006// PR2542 RED DRAGON 011         REDDRAGONSND           RED   DRAGON
r31373r31374
3002830028}
3002930029
3003030030INPUT_PORTS_START( sc4rdrcl ) // this structure is generated
30031        PORT_INCLUDE( sc4_base )
30032        PORT_MODIFY("IN-1")
30033        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30034        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
30035        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
30036        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
30037        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
30038        PORT_MODIFY("IN-2")
30039        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
30040        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
30041        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30042        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30043        PORT_MODIFY("IN-8")
30044        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudge")
30045        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
30046        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spin")
30047        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c pot")
30048        PORT_MODIFY("IN-16")
30049        // 0x0001 - "dil  1" // standard input (motherboard)
30050        // 0x0002 - "dil  2" // standard input (motherboard)
30051        // 0x0004 - "dil  3" // standard input (motherboard)
30052        // 0x0008 - "dil  4" // standard input (motherboard)
30053        // 0x0010 - "dil  5" // standard input (motherboard)
30054        // 0x0100 - "topup" // known extended input, usually 'top up'
30055        PORT_MODIFY("IN-17")
30056        // 0x0001 - "dil  6" // standard input (motherboard)
30057        // 0x0002 - "dil  7" // standard input (motherboard)
30058        // 0x0004 - "dil  8" // standard input (motherboard)
30059        // 0x0008 - "dil  9" // standard input (motherboard)
30060        // 0x0010 - "dil 10" // standard input (motherboard)
30061        PORT_MODIFY("IN-18")
30062        // 0x0001 - "dil 11" // standard input (motherboard)
30063        // 0x0002 - "dil 12" // standard input (motherboard)
30064        // 0x0004 - "dil 13" // standard input (motherboard)
30065        // 0x0008 - "dil 14" // standard input (motherboard)
30066        // 0x0010 - "dil 15" // standard input (motherboard)
30067        PORT_MODIFY("IN-19")
30068        // 0x0001 - "dil 16" // standard input (motherboard)
30069        PORT_MODIFY("IN-20")
30070        // 0x0001 - "test" // standard input (motherboard)
30071        // 0x0002 - "lock" // standard input (expected here)
30072        // 0x0004 - "topdor" // standard input (expected here)
30073        // 0x0008 - "botdor" // standard input (expected here)
30074        // 0x0010 - "hopdmp" // standard input (expected here)
30031      PORT_INCLUDE( sc4_base )
30032      PORT_MODIFY("IN-1")
30033      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30034      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
30035      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
30036      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
30037      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
30038      PORT_MODIFY("IN-2")
30039      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
30040      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
30041      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30042      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30043      PORT_MODIFY("IN-8")
30044      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudge")
30045      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
30046      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spin")
30047      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c pot")
30048      PORT_MODIFY("IN-16")
30049      // 0x0001 - "dil  1" // standard input (motherboard)
30050      // 0x0002 - "dil  2" // standard input (motherboard)
30051      // 0x0004 - "dil  3" // standard input (motherboard)
30052      // 0x0008 - "dil  4" // standard input (motherboard)
30053      // 0x0010 - "dil  5" // standard input (motherboard)
30054      // 0x0100 - "topup" // known extended input, usually 'top up'
30055      PORT_MODIFY("IN-17")
30056      // 0x0001 - "dil  6" // standard input (motherboard)
30057      // 0x0002 - "dil  7" // standard input (motherboard)
30058      // 0x0004 - "dil  8" // standard input (motherboard)
30059      // 0x0008 - "dil  9" // standard input (motherboard)
30060      // 0x0010 - "dil 10" // standard input (motherboard)
30061      PORT_MODIFY("IN-18")
30062      // 0x0001 - "dil 11" // standard input (motherboard)
30063      // 0x0002 - "dil 12" // standard input (motherboard)
30064      // 0x0004 - "dil 13" // standard input (motherboard)
30065      // 0x0008 - "dil 14" // standard input (motherboard)
30066      // 0x0010 - "dil 15" // standard input (motherboard)
30067      PORT_MODIFY("IN-19")
30068      // 0x0001 - "dil 16" // standard input (motherboard)
30069      PORT_MODIFY("IN-20")
30070      // 0x0001 - "test" // standard input (motherboard)
30071      // 0x0002 - "lock" // standard input (expected here)
30072      // 0x0004 - "topdor" // standard input (expected here)
30073      // 0x0008 - "botdor" // standard input (expected here)
30074      // 0x0010 - "hopdmp" // standard input (expected here)
3007530075INPUT_PORTS_END
3007630076
3007730077// QPS160 CLUB RED DRAGON 411         CLUBREDDRAGONSND         CLUB RED DRAGON
r31373r31374
3009830098}
3009930099
3010030100INPUT_PORTS_START( sc4relcz ) // this structure is generated
30101        PORT_INCLUDE( sc4_base )
30102        PORT_MODIFY("IN-1")
30103        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30104        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
30105        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
30106        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
30107        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
30108        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
30109        PORT_MODIFY("IN-2")
30110        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
30111        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30112        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30113        PORT_MODIFY("IN-3")
30114        // 0x0004 - "stk 4" // standard input (expected here)
30115        // 0x0008 - "stk 3" // standard input (expected here)
30116        // 0x0010 - "stk 2" // standard input (expected here)
30117        PORT_MODIFY("IN-5")
30118        // 0x0001 - "priz4" // standard input (expected here)
30119        // 0x0002 - "priz3" // standard input (expected here)
30120        // 0x0004 - "priz2" // standard input (expected here)
30121        // 0x0008 - "priz1" // standard input (expected here)
30122        PORT_MODIFY("IN-6")
30123        // 0x0001 - "perc1" // standard input (expected here)
30124        // 0x0002 - "perc2" // standard input (expected here)
30125        // 0x0004 - "perc3" // standard input (expected here)
30126        // 0x0008 - "perc4" // standard input (expected here)
30127        PORT_MODIFY("IN-8")
30128        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk ko")
30129        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("t blst")
30130        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk csh")
30131        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi")
30132        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lo")
30133        PORT_MODIFY("IN-16")
30134        // 0x0001 - "dil 1" // standard input (motherboard)
30135        // 0x0002 - "dil 2" // standard input (motherboard)
30136        // 0x0004 - "dil 3" // standard input (motherboard)
30137        // 0x0008 - "dil 4" // standard input (motherboard)
30138        // 0x0010 - "dil 5" // standard input (motherboard)
30139        // 0x0100 - "top up" // known extended input, usually 'top up'
30140        PORT_MODIFY("IN-17")
30141        // 0x0001 - "dil 6" // standard input (motherboard)
30142        // 0x0002 - "dil 7" // standard input (motherboard)
30143        // 0x0004 - "dil 8" // standard input (motherboard)
30144        // 0x0008 - "dil 9" // standard input (motherboard)
30145        // 0x0010 - "dil10" // standard input (motherboard)
30146        PORT_MODIFY("IN-18")
30147        // 0x0001 - "dil11" // standard input (motherboard)
30148        // 0x0002 - "dil12" // standard input (motherboard)
30149        // 0x0004 - "dil13" // standard input (motherboard)
30150        // 0x0008 - "dil14" // standard input (motherboard)
30151        // 0x0010 - "dil15" // standard input (motherboard)
30152        PORT_MODIFY("IN-19")
30153        // 0x0001 - "dil16" // standard input (motherboard)
30154        PORT_MODIFY("IN-20")
30155        // 0x0001 - "grnbut" // standard input (motherboard)
30156        // 0x0002 - "dorlok" // standard input (expected here)
30157        // 0x0004 - "topdor" // standard input (expected here)
30158        // 0x0008 - "botdor" // standard input (expected here)
30159        // 0x0010 - "hopdmp" // standard input (expected here)
30101      PORT_INCLUDE( sc4_base )
30102      PORT_MODIFY("IN-1")
30103      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30104      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
30105      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
30106      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
30107      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
30108      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
30109      PORT_MODIFY("IN-2")
30110      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
30111      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30112      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30113      PORT_MODIFY("IN-3")
30114      // 0x0004 - "stk 4" // standard input (expected here)
30115      // 0x0008 - "stk 3" // standard input (expected here)
30116      // 0x0010 - "stk 2" // standard input (expected here)
30117      PORT_MODIFY("IN-5")
30118      // 0x0001 - "priz4" // standard input (expected here)
30119      // 0x0002 - "priz3" // standard input (expected here)
30120      // 0x0004 - "priz2" // standard input (expected here)
30121      // 0x0008 - "priz1" // standard input (expected here)
30122      PORT_MODIFY("IN-6")
30123      // 0x0001 - "perc1" // standard input (expected here)
30124      // 0x0002 - "perc2" // standard input (expected here)
30125      // 0x0004 - "perc3" // standard input (expected here)
30126      // 0x0008 - "perc4" // standard input (expected here)
30127      PORT_MODIFY("IN-8")
30128      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk ko")
30129      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("t blst")
30130      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk csh")
30131      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi")
30132      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lo")
30133      PORT_MODIFY("IN-16")
30134      // 0x0001 - "dil 1" // standard input (motherboard)
30135      // 0x0002 - "dil 2" // standard input (motherboard)
30136      // 0x0004 - "dil 3" // standard input (motherboard)
30137      // 0x0008 - "dil 4" // standard input (motherboard)
30138      // 0x0010 - "dil 5" // standard input (motherboard)
30139      // 0x0100 - "top up" // known extended input, usually 'top up'
30140      PORT_MODIFY("IN-17")
30141      // 0x0001 - "dil 6" // standard input (motherboard)
30142      // 0x0002 - "dil 7" // standard input (motherboard)
30143      // 0x0004 - "dil 8" // standard input (motherboard)
30144      // 0x0008 - "dil 9" // standard input (motherboard)
30145      // 0x0010 - "dil10" // standard input (motherboard)
30146      PORT_MODIFY("IN-18")
30147      // 0x0001 - "dil11" // standard input (motherboard)
30148      // 0x0002 - "dil12" // standard input (motherboard)
30149      // 0x0004 - "dil13" // standard input (motherboard)
30150      // 0x0008 - "dil14" // standard input (motherboard)
30151      // 0x0010 - "dil15" // standard input (motherboard)
30152      PORT_MODIFY("IN-19")
30153      // 0x0001 - "dil16" // standard input (motherboard)
30154      PORT_MODIFY("IN-20")
30155      // 0x0001 - "grnbut" // standard input (motherboard)
30156      // 0x0002 - "dorlok" // standard input (expected here)
30157      // 0x0004 - "topdor" // standard input (expected here)
30158      // 0x0008 - "botdor" // standard input (expected here)
30159      // 0x0010 - "hopdmp" // standard input (expected here)
3016030160INPUT_PORTS_END
3016130161
3016230162// PR1015 REELY CRAZY         PR1015 REELY CRAZY SOUNDS11
r31373r31374
3018330183}
3018430184
3018530185INPUT_PORTS_START( sc4rotc ) // this structure is generated
30186        PORT_INCLUDE( sc4_base )
30187        PORT_MODIFY("IN-1")
30188        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30189        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
30190        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
30191        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
30192        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
30193        PORT_MODIFY("IN-2")
30194        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
30195        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("xfer")
30196        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30197        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30198        PORT_MODIFY("IN-8")
30199        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
30200        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk cas")
30201        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("blast")
30202        PORT_MODIFY("IN-16")
30203        // 0x0001 - "dil  1" // standard input (motherboard)
30204        // 0x0002 - "dil  2" // standard input (motherboard)
30205        // 0x0004 - "dil  3" // standard input (motherboard)
30206        // 0x0008 - "dil  4" // standard input (motherboard)
30207        // 0x0010 - "dil  5" // standard input (motherboard)
30208        // 0x0100 - "top up" // known extended input, usually 'top up'
30209        PORT_MODIFY("IN-17")
30210        // 0x0001 - "dil  6" // standard input (motherboard)
30211        // 0x0002 - "dil  7" // standard input (motherboard)
30212        // 0x0004 - "dil  8" // standard input (motherboard)
30213        // 0x0008 - "dil  9" // standard input (motherboard)
30214        // 0x0010 - "dil 10" // standard input (motherboard)
30215        PORT_MODIFY("IN-18")
30216        // 0x0001 - "dil 11" // standard input (motherboard)
30217        // 0x0002 - "dil 12" // standard input (motherboard)
30218        // 0x0004 - "dil 13" // standard input (motherboard)
30219        // 0x0008 - "dil 14" // standard input (motherboard)
30220        // 0x0010 - "dil 15" // standard input (motherboard)
30221        PORT_MODIFY("IN-19")
30222        // 0x0001 - "dil 16" // standard input (motherboard)
30223        PORT_MODIFY("IN-20")
30224        // 0x0001 - "testsw" // standard input (motherboard)
30225        // 0x0002 - "dor lk" // standard input (expected here)
30226        // 0x0004 - "tp dor" // standard input (expected here)
30227        // 0x0008 - "csh bx" // standard input (expected here)
30228        // 0x0010 - "deflt" // standard input (expected here)
30186      PORT_INCLUDE( sc4_base )
30187      PORT_MODIFY("IN-1")
30188      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30189      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
30190      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
30191      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
30192      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
30193      PORT_MODIFY("IN-2")
30194      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
30195      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("xfer")
30196      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30197      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30198      PORT_MODIFY("IN-8")
30199      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
30200      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk cas")
30201      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("blast")
30202      PORT_MODIFY("IN-16")
30203      // 0x0001 - "dil  1" // standard input (motherboard)
30204      // 0x0002 - "dil  2" // standard input (motherboard)
30205      // 0x0004 - "dil  3" // standard input (motherboard)
30206      // 0x0008 - "dil  4" // standard input (motherboard)
30207      // 0x0010 - "dil  5" // standard input (motherboard)
30208      // 0x0100 - "top up" // known extended input, usually 'top up'
30209      PORT_MODIFY("IN-17")
30210      // 0x0001 - "dil  6" // standard input (motherboard)
30211      // 0x0002 - "dil  7" // standard input (motherboard)
30212      // 0x0004 - "dil  8" // standard input (motherboard)
30213      // 0x0008 - "dil  9" // standard input (motherboard)
30214      // 0x0010 - "dil 10" // standard input (motherboard)
30215      PORT_MODIFY("IN-18")
30216      // 0x0001 - "dil 11" // standard input (motherboard)
30217      // 0x0002 - "dil 12" // standard input (motherboard)
30218      // 0x0004 - "dil 13" // standard input (motherboard)
30219      // 0x0008 - "dil 14" // standard input (motherboard)
30220      // 0x0010 - "dil 15" // standard input (motherboard)
30221      PORT_MODIFY("IN-19")
30222      // 0x0001 - "dil 16" // standard input (motherboard)
30223      PORT_MODIFY("IN-20")
30224      // 0x0001 - "testsw" // standard input (motherboard)
30225      // 0x0002 - "dor lk" // standard input (expected here)
30226      // 0x0004 - "tp dor" // standard input (expected here)
30227      // 0x0008 - "csh bx" // standard input (expected here)
30228      // 0x0010 - "deflt" // standard input (expected here)
3022930229INPUT_PORTS_END
3023030230
3023130231// PR2132 RETURN OF THE COUNT         ROTC SOUNDS         THE COUNT
r31373r31374
3025930259}
3026030260
3026130261INPUT_PORTS_START( sc4rttt ) // this structure is generated
30262        PORT_INCLUDE( sc4_base )
30263        PORT_MODIFY("IN-1")
30264        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30265        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colect")
30266        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
30267        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
30268        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
30269        PORT_MODIFY("IN-2")
30270        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto")
30271        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30272        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30273        PORT_MODIFY("IN-8")
30274        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tke ft")
30275        PORT_MODIFY("IN-16")
30276        // 0x0001 - "dil  1" // standard input (motherboard)
30277        // 0x0002 - "dil  2" // standard input (motherboard)
30278        // 0x0004 - "dil  3" // standard input (motherboard)
30279        // 0x0008 - "dil  4" // standard input (motherboard)
30280        // 0x0010 - "dil  5" // standard input (motherboard)
30281        // 0x0100 - "top up" // known extended input, usually 'top up'
30282        PORT_MODIFY("IN-17")
30283        // 0x0001 - "dil  6" // standard input (motherboard)
30284        // 0x0002 - "dil  7" // standard input (motherboard)
30285        // 0x0004 - "dil  8" // standard input (motherboard)
30286        // 0x0008 - "dil  9" // standard input (motherboard)
30287        // 0x0010 - "dil 10" // standard input (motherboard)
30288        PORT_MODIFY("IN-18")
30289        // 0x0001 - "dil 11" // standard input (motherboard)
30290        // 0x0002 - "dil 12" // standard input (motherboard)
30291        // 0x0004 - "dil 13" // standard input (motherboard)
30292        // 0x0008 - "dil 14" // standard input (motherboard)
30293        // 0x0010 - "dil 15" // standard input (motherboard)
30294        PORT_MODIFY("IN-19")
30295        // 0x0001 - "dil 16" // standard input (motherboard)
30296        PORT_MODIFY("IN-20")
30297        // 0x0001 - "testsw" // standard input (motherboard)
30298        // 0x0002 - "dor lk" // standard input (expected here)
30299        // 0x0004 - "tp dor" // standard input (expected here)
30300        // 0x0008 - "csh bx" // standard input (expected here)
30301        // 0x0010 - "deflt" // standard input (expected here)
30262      PORT_INCLUDE( sc4_base )
30263      PORT_MODIFY("IN-1")
30264      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30265      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colect")
30266      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
30267      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
30268      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
30269      PORT_MODIFY("IN-2")
30270      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto")
30271      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30272      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30273      PORT_MODIFY("IN-8")
30274      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tke ft")
30275      PORT_MODIFY("IN-16")
30276      // 0x0001 - "dil  1" // standard input (motherboard)
30277      // 0x0002 - "dil  2" // standard input (motherboard)
30278      // 0x0004 - "dil  3" // standard input (motherboard)
30279      // 0x0008 - "dil  4" // standard input (motherboard)
30280      // 0x0010 - "dil  5" // standard input (motherboard)
30281      // 0x0100 - "top up" // known extended input, usually 'top up'
30282      PORT_MODIFY("IN-17")
30283      // 0x0001 - "dil  6" // standard input (motherboard)
30284      // 0x0002 - "dil  7" // standard input (motherboard)
30285      // 0x0004 - "dil  8" // standard input (motherboard)
30286      // 0x0008 - "dil  9" // standard input (motherboard)
30287      // 0x0010 - "dil 10" // standard input (motherboard)
30288      PORT_MODIFY("IN-18")
30289      // 0x0001 - "dil 11" // standard input (motherboard)
30290      // 0x0002 - "dil 12" // standard input (motherboard)
30291      // 0x0004 - "dil 13" // standard input (motherboard)
30292      // 0x0008 - "dil 14" // standard input (motherboard)
30293      // 0x0010 - "dil 15" // standard input (motherboard)
30294      PORT_MODIFY("IN-19")
30295      // 0x0001 - "dil 16" // standard input (motherboard)
30296      PORT_MODIFY("IN-20")
30297      // 0x0001 - "testsw" // standard input (motherboard)
30298      // 0x0002 - "dor lk" // standard input (expected here)
30299      // 0x0004 - "tp dor" // standard input (expected here)
30300      // 0x0008 - "csh bx" // standard input (expected here)
30301      // 0x0010 - "deflt" // standard input (expected here)
3030230302INPUT_PORTS_END
3030330303
3030430304// PR2089 RISE TO THE TOP         RISE SOUNDS         RISE TO THE TOP
r31373r31374
3032630326}
3032730327
3032830328INPUT_PORTS_START( sc4roksc ) // this structure is generated
30329        PORT_INCLUDE( sc4_base )
30330        PORT_MODIFY("IN-1")
30331        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30332        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collet")
30333        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
30334        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
30335        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
30336        PORT_MODIFY("IN-2")
30337        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
30338        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30339        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30340        PORT_MODIFY("IN-8")
30341        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("feat")
30342        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shot")
30343        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nudge")
30344        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("sushot")
30345        PORT_MODIFY("IN-16")
30346        // 0x0001 - "dil  1" // standard input (motherboard)
30347        // 0x0002 - "dil  2" // standard input (motherboard)
30348        // 0x0004 - "dil  3" // standard input (motherboard)
30349        // 0x0008 - "dil  4" // standard input (motherboard)
30350        // 0x0010 - "dil  5" // standard input (motherboard)
30351        // 0x0100 - "topup" // known extended input, usually 'top up'
30352        PORT_MODIFY("IN-17")
30353        // 0x0001 - "dil  6" // standard input (motherboard)
30354        // 0x0002 - "dil  7" // standard input (motherboard)
30355        // 0x0004 - "dil  8" // standard input (motherboard)
30356        // 0x0008 - "dil  9" // standard input (motherboard)
30357        // 0x0010 - "dil 10" // standard input (motherboard)
30358        PORT_MODIFY("IN-18")
30359        // 0x0001 - "dil 11" // standard input (motherboard)
30360        // 0x0002 - "dil 12" // standard input (motherboard)
30361        // 0x0004 - "dil 13" // standard input (motherboard)
30362        // 0x0008 - "dil 14" // standard input (motherboard)
30363        // 0x0010 - "dil 15" // standard input (motherboard)
30364        PORT_MODIFY("IN-19")
30365        // 0x0001 - "dil 16" // standard input (motherboard)
30366        PORT_MODIFY("IN-20")
30367        // 0x0001 - "test" // standard input (motherboard)
30368        // 0x0002 - "lock" // standard input (expected here)
30369        // 0x0004 - "topdor" // standard input (expected here)
30370        // 0x0008 - "botdor" // standard input (expected here)
30371        // 0x0010 - "hopdmp" // standard input (expected here)
30329      PORT_INCLUDE( sc4_base )
30330      PORT_MODIFY("IN-1")
30331      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30332      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collet")
30333      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
30334      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
30335      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
30336      PORT_MODIFY("IN-2")
30337      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
30338      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30339      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30340      PORT_MODIFY("IN-8")
30341      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("feat")
30342      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shot")
30343      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nudge")
30344      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("sushot")
30345      PORT_MODIFY("IN-16")
30346      // 0x0001 - "dil  1" // standard input (motherboard)
30347      // 0x0002 - "dil  2" // standard input (motherboard)
30348      // 0x0004 - "dil  3" // standard input (motherboard)
30349      // 0x0008 - "dil  4" // standard input (motherboard)
30350      // 0x0010 - "dil  5" // standard input (motherboard)
30351      // 0x0100 - "topup" // known extended input, usually 'top up'
30352      PORT_MODIFY("IN-17")
30353      // 0x0001 - "dil  6" // standard input (motherboard)
30354      // 0x0002 - "dil  7" // standard input (motherboard)
30355      // 0x0004 - "dil  8" // standard input (motherboard)
30356      // 0x0008 - "dil  9" // standard input (motherboard)
30357      // 0x0010 - "dil 10" // standard input (motherboard)
30358      PORT_MODIFY("IN-18")
30359      // 0x0001 - "dil 11" // standard input (motherboard)
30360      // 0x0002 - "dil 12" // standard input (motherboard)
30361      // 0x0004 - "dil 13" // standard input (motherboard)
30362      // 0x0008 - "dil 14" // standard input (motherboard)
30363      // 0x0010 - "dil 15" // standard input (motherboard)
30364      PORT_MODIFY("IN-19")
30365      // 0x0001 - "dil 16" // standard input (motherboard)
30366      PORT_MODIFY("IN-20")
30367      // 0x0001 - "test" // standard input (motherboard)
30368      // 0x0002 - "lock" // standard input (expected here)
30369      // 0x0004 - "topdor" // standard input (expected here)
30370      // 0x0008 - "botdor" // standard input (expected here)
30371      // 0x0010 - "hopdmp" // standard input (expected here)
3037230372INPUT_PORTS_END
3037330373
3037430374// PR2527 ROCKET SCIENCE V1.1         ROCKETSCIENCESND          ROCKET SCIENCE
r31373r31374
3039530395}
3039630396
3039730397INPUT_PORTS_START( sc4blast ) // this structure is generated
30398        PORT_INCLUDE( sc4_base )
30399        PORT_MODIFY("IN-1")
30400        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
30401        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
30402        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
30403        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
30404        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
30405        PORT_MODIFY("IN-2")
30406        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
30407        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30408        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30409        PORT_MODIFY("IN-8")
30410        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("feat")
30411        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shot")
30412        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nudge")
30413        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("sushot")
30414        PORT_MODIFY("IN-16")
30415        // 0x0001 - "dil  1" // standard input (motherboard)
30416        // 0x0002 - "dil  2" // standard input (motherboard)
30417        // 0x0004 - "dil  3" // standard input (motherboard)
30418        // 0x0008 - "dil  4" // standard input (motherboard)
30419        // 0x0010 - "dil  5" // standard input (motherboard)
30420        // 0x0100 - "topup" // known extended input, usually 'top up'
30421        PORT_MODIFY("IN-17")
30422        // 0x0001 - "dil  6" // standard input (motherboard)
30423        // 0x0002 - "dil  7" // standard input (motherboard)
30424        // 0x0004 - "dil  8" // standard input (motherboard)
30425        // 0x0008 - "dil  9" // standard input (motherboard)
30426        // 0x0010 - "dil 10" // standard input (motherboard)
30427        PORT_MODIFY("IN-18")
30428        // 0x0001 - "dil 11" // standard input (motherboard)
30429        // 0x0002 - "dil 12" // standard input (motherboard)
30430        // 0x0004 - "dil 13" // standard input (motherboard)
30431        // 0x0008 - "dil 14" // standard input (motherboard)
30432        // 0x0010 - "dil 15" // standard input (motherboard)
30433        PORT_MODIFY("IN-19")
30434        // 0x0001 - "dil 16" // standard input (motherboard)
30435        PORT_MODIFY("IN-20")
30436        // 0x0001 - "test" // standard input (motherboard)
30437        // 0x0002 - "lock" // standard input (expected here)
30438        // 0x0004 - "topdor" // standard input (expected here)
30439        // 0x0008 - "botdor" // standard input (expected here)
30440        // 0x0010 - "hopdmp" // standard input (expected here)
30398      PORT_INCLUDE( sc4_base )
30399      PORT_MODIFY("IN-1")
30400      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
30401      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
30402      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
30403      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
30404      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
30405      PORT_MODIFY("IN-2")
30406      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
30407      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30408      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30409      PORT_MODIFY("IN-8")
30410      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("feat")
30411      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shot")
30412      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nudge")
30413      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("sushot")
30414      PORT_MODIFY("IN-16")
30415      // 0x0001 - "dil  1" // standard input (motherboard)
30416      // 0x0002 - "dil  2" // standard input (motherboard)
30417      // 0x0004 - "dil  3" // standard input (motherboard)
30418      // 0x0008 - "dil  4" // standard input (motherboard)
30419      // 0x0010 - "dil  5" // standard input (motherboard)
30420      // 0x0100 - "topup" // known extended input, usually 'top up'
30421      PORT_MODIFY("IN-17")
30422      // 0x0001 - "dil  6" // standard input (motherboard)
30423      // 0x0002 - "dil  7" // standard input (motherboard)
30424      // 0x0004 - "dil  8" // standard input (motherboard)
30425      // 0x0008 - "dil  9" // standard input (motherboard)
30426      // 0x0010 - "dil 10" // standard input (motherboard)
30427      PORT_MODIFY("IN-18")
30428      // 0x0001 - "dil 11" // standard input (motherboard)
30429      // 0x0002 - "dil 12" // standard input (motherboard)
30430      // 0x0004 - "dil 13" // standard input (motherboard)
30431      // 0x0008 - "dil 14" // standard input (motherboard)
30432      // 0x0010 - "dil 15" // standard input (motherboard)
30433      PORT_MODIFY("IN-19")
30434      // 0x0001 - "dil 16" // standard input (motherboard)
30435      PORT_MODIFY("IN-20")
30436      // 0x0001 - "test" // standard input (motherboard)
30437      // 0x0002 - "lock" // standard input (expected here)
30438      // 0x0004 - "topdor" // standard input (expected here)
30439      // 0x0008 - "botdor" // standard input (expected here)
30440      // 0x0010 - "hopdmp" // standard input (expected here)
3044130441INPUT_PORTS_END
3044230442
3044330443// only starts 2nd time (requires valid ram?)
r31373r31374
3047030470}
3047130471
3047230472INPUT_PORTS_START( sc4rogds ) // this structure is generated
30473        PORT_INCLUDE( sc4_base )
30474        PORT_MODIFY("IN-1")
30475        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30476        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
30477        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
30478        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
30479        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
30480        PORT_MODIFY("IN-2")
30481        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
30482        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30483        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30484        PORT_MODIFY("IN-8")
30485        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("lo r")
30486        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lo l")
30487        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi l")
30488        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi r")
30489        PORT_MODIFY("IN-16")
30490        // 0x0001 - "dil  1" // standard input (motherboard)
30491        // 0x0002 - "dil  2" // standard input (motherboard)
30492        // 0x0004 - "dil  3" // standard input (motherboard)
30493        // 0x0008 - "dil  4" // standard input (motherboard)
30494        // 0x0010 - "dil  5" // standard input (motherboard)
30495        // 0x0100 - "topup" // known extended input, usually 'top up'
30496        PORT_MODIFY("IN-17")
30497        // 0x0001 - "dil  6" // standard input (motherboard)
30498        // 0x0002 - "dil  7" // standard input (motherboard)
30499        // 0x0004 - "dil  8" // standard input (motherboard)
30500        // 0x0008 - "dil  9" // standard input (motherboard)
30501        // 0x0010 - "dil 10" // standard input (motherboard)
30502        PORT_MODIFY("IN-18")
30503        // 0x0001 - "dil 11" // standard input (motherboard)
30504        // 0x0002 - "dil 12" // standard input (motherboard)
30505        // 0x0004 - "dil 13" // standard input (motherboard)
30506        // 0x0008 - "dil 14" // standard input (motherboard)
30507        // 0x0010 - "dil 15" // standard input (motherboard)
30508        PORT_MODIFY("IN-19")
30509        // 0x0001 - "dil 16" // standard input (motherboard)
30510        PORT_MODIFY("IN-20")
30511        // 0x0001 - "test" // standard input (motherboard)
30512        // 0x0002 - "lock" // standard input (expected here)
30513        // 0x0004 - "topdor" // standard input (expected here)
30514        // 0x0008 - "botdor" // standard input (expected here)
30515        // 0x0010 - "hopdmp" // standard input (expected here)
30473      PORT_INCLUDE( sc4_base )
30474      PORT_MODIFY("IN-1")
30475      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30476      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
30477      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
30478      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
30479      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
30480      PORT_MODIFY("IN-2")
30481      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
30482      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30483      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30484      PORT_MODIFY("IN-8")
30485      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("lo r")
30486      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lo l")
30487      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi l")
30488      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi r")
30489      PORT_MODIFY("IN-16")
30490      // 0x0001 - "dil  1" // standard input (motherboard)
30491      // 0x0002 - "dil  2" // standard input (motherboard)
30492      // 0x0004 - "dil  3" // standard input (motherboard)
30493      // 0x0008 - "dil  4" // standard input (motherboard)
30494      // 0x0010 - "dil  5" // standard input (motherboard)
30495      // 0x0100 - "topup" // known extended input, usually 'top up'
30496      PORT_MODIFY("IN-17")
30497      // 0x0001 - "dil  6" // standard input (motherboard)
30498      // 0x0002 - "dil  7" // standard input (motherboard)
30499      // 0x0004 - "dil  8" // standard input (motherboard)
30500      // 0x0008 - "dil  9" // standard input (motherboard)
30501      // 0x0010 - "dil 10" // standard input (motherboard)
30502      PORT_MODIFY("IN-18")
30503      // 0x0001 - "dil 11" // standard input (motherboard)
30504      // 0x0002 - "dil 12" // standard input (motherboard)
30505      // 0x0004 - "dil 13" // standard input (motherboard)
30506      // 0x0008 - "dil 14" // standard input (motherboard)
30507      // 0x0010 - "dil 15" // standard input (motherboard)
30508      PORT_MODIFY("IN-19")
30509      // 0x0001 - "dil 16" // standard input (motherboard)
30510      PORT_MODIFY("IN-20")
30511      // 0x0001 - "test" // standard input (motherboard)
30512      // 0x0002 - "lock" // standard input (expected here)
30513      // 0x0004 - "topdor" // standard input (expected here)
30514      // 0x0008 - "botdor" // standard input (expected here)
30515      // 0x0010 - "hopdmp" // standard input (expected here)
3051630516INPUT_PORTS_END
3051730517
3051830518
r31373r31374
3054730547}
3054830548
3054930549INPUT_PORTS_START( sc4rt ) // this structure is generated
30550        PORT_INCLUDE( sc4_base )
30551        PORT_MODIFY("IN-1")
30552        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30553        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
30554        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
30555        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
30556        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
30557        PORT_MODIFY("IN-2")
30558        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("collct")
30559        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ft exc")
30560        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30561        PORT_MODIFY("IN-8")
30562        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("csh lo")
30563        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("spn lo")
30564        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("ndg lo")
30565        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("ndg hi")
30566        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("spn hi")
30567        PORT_MODIFY("IN-9")
30568        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("csh hi")
30569        PORT_MODIFY("IN-16")
30570        // 0x0001 - "dil  1" // standard input (motherboard)
30571        // 0x0002 - "dil  2" // standard input (motherboard)
30572        // 0x0004 - "dil  3" // standard input (motherboard)
30573        // 0x0008 - "dil  4" // standard input (motherboard)
30574        // 0x0010 - "dil  5" // standard input (motherboard)
30575        // 0x0100 - "top up" // known extended input, usually 'top up'
30576        PORT_MODIFY("IN-17")
30577        // 0x0001 - "dil  6" // standard input (motherboard)
30578        // 0x0002 - "dil  7" // standard input (motherboard)
30579        // 0x0004 - "dil  8" // standard input (motherboard)
30580        // 0x0008 - "dil  9" // standard input (motherboard)
30581        // 0x0010 - "dil 10" // standard input (motherboard)
30582        PORT_MODIFY("IN-18")
30583        // 0x0001 - "dil 11" // standard input (motherboard)
30584        // 0x0002 - "dil 12" // standard input (motherboard)
30585        // 0x0004 - "dil 13" // standard input (motherboard)
30586        // 0x0008 - "dil 14" // standard input (motherboard)
30587        // 0x0010 - "dil 15" // standard input (motherboard)
30588        PORT_MODIFY("IN-19")
30589        // 0x0001 - "dil 16" // standard input (motherboard)
30590        PORT_MODIFY("IN-20")
30591        // 0x0001 - "testsw" // standard input (motherboard)
30592        // 0x0002 - "dor lk" // standard input (expected here)
30593        // 0x0004 - "tp dor" // standard input (expected here)
30594        // 0x0008 - "csh bx" // standard input (expected here)
30595        // 0x0010 - "deflt" // standard input (expected here)
30550      PORT_INCLUDE( sc4_base )
30551      PORT_MODIFY("IN-1")
30552      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30553      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
30554      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
30555      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
30556      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
30557      PORT_MODIFY("IN-2")
30558      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("collct")
30559      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ft exc")
30560      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30561      PORT_MODIFY("IN-8")
30562      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("csh lo")
30563      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("spn lo")
30564      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("ndg lo")
30565      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("ndg hi")
30566      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("spn hi")
30567      PORT_MODIFY("IN-9")
30568      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("csh hi")
30569      PORT_MODIFY("IN-16")
30570      // 0x0001 - "dil  1" // standard input (motherboard)
30571      // 0x0002 - "dil  2" // standard input (motherboard)
30572      // 0x0004 - "dil  3" // standard input (motherboard)
30573      // 0x0008 - "dil  4" // standard input (motherboard)
30574      // 0x0010 - "dil  5" // standard input (motherboard)
30575      // 0x0100 - "top up" // known extended input, usually 'top up'
30576      PORT_MODIFY("IN-17")
30577      // 0x0001 - "dil  6" // standard input (motherboard)
30578      // 0x0002 - "dil  7" // standard input (motherboard)
30579      // 0x0004 - "dil  8" // standard input (motherboard)
30580      // 0x0008 - "dil  9" // standard input (motherboard)
30581      // 0x0010 - "dil 10" // standard input (motherboard)
30582      PORT_MODIFY("IN-18")
30583      // 0x0001 - "dil 11" // standard input (motherboard)
30584      // 0x0002 - "dil 12" // standard input (motherboard)
30585      // 0x0004 - "dil 13" // standard input (motherboard)
30586      // 0x0008 - "dil 14" // standard input (motherboard)
30587      // 0x0010 - "dil 15" // standard input (motherboard)
30588      PORT_MODIFY("IN-19")
30589      // 0x0001 - "dil 16" // standard input (motherboard)
30590      PORT_MODIFY("IN-20")
30591      // 0x0001 - "testsw" // standard input (motherboard)
30592      // 0x0002 - "dor lk" // standard input (expected here)
30593      // 0x0004 - "tp dor" // standard input (expected here)
30594      // 0x0008 - "csh bx" // standard input (expected here)
30595      // 0x0010 - "deflt" // standard input (expected here)
3059630596INPUT_PORTS_END
3059730597
3059830598
r31373r31374
3062030620}
3062130621
3062230622INPUT_PORTS_START( sc4broll ) // this structure is generated
30623        PORT_INCLUDE( sc4_base )
30624        PORT_MODIFY("IN-1")
30625        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30626        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
30627        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
30628        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
30629        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
30630        PORT_MODIFY("IN-2")
30631        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("collct")
30632        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ft exc")
30633        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30634        PORT_MODIFY("IN-8")
30635        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("csh lo")
30636        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("spn lo")
30637        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("ndg lo")
30638        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("ndg hi")
30639        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("spn hi")
30640        PORT_MODIFY("IN-9")
30641        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("csh hi")
30642        PORT_MODIFY("IN-16")
30643        // 0x0001 - "dil  1" // standard input (motherboard)
30644        // 0x0002 - "dil  2" // standard input (motherboard)
30645        // 0x0004 - "dil  3" // standard input (motherboard)
30646        // 0x0008 - "dil  4" // standard input (motherboard)
30647        // 0x0010 - "dil  5" // standard input (motherboard)
30648        // 0x0100 - "top up" // known extended input, usually 'top up'
30649        PORT_MODIFY("IN-17")
30650        // 0x0001 - "dil  6" // standard input (motherboard)
30651        // 0x0002 - "dil  7" // standard input (motherboard)
30652        // 0x0004 - "dil  8" // standard input (motherboard)
30653        // 0x0008 - "dil  9" // standard input (motherboard)
30654        // 0x0010 - "dil 10" // standard input (motherboard)
30655        PORT_MODIFY("IN-18")
30656        // 0x0001 - "dil 11" // standard input (motherboard)
30657        // 0x0002 - "dil 12" // standard input (motherboard)
30658        // 0x0004 - "dil 13" // standard input (motherboard)
30659        // 0x0008 - "dil 14" // standard input (motherboard)
30660        // 0x0010 - "dil 15" // standard input (motherboard)
30661        PORT_MODIFY("IN-19")
30662        // 0x0001 - "dil 16" // standard input (motherboard)
30663        PORT_MODIFY("IN-20")
30664        // 0x0001 - "testsw" // standard input (motherboard)
30665        // 0x0002 - "dor lk" // standard input (expected here)
30666        // 0x0004 - "tp dor" // standard input (expected here)
30667        // 0x0008 - "csh bx" // standard input (expected here)
30668        // 0x0010 - "deflt" // standard input (expected here)
30623      PORT_INCLUDE( sc4_base )
30624      PORT_MODIFY("IN-1")
30625      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30626      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
30627      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
30628      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
30629      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
30630      PORT_MODIFY("IN-2")
30631      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("collct")
30632      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ft exc")
30633      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30634      PORT_MODIFY("IN-8")
30635      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("csh lo")
30636      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("spn lo")
30637      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("ndg lo")
30638      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("ndg hi")
30639      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("spn hi")
30640      PORT_MODIFY("IN-9")
30641      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("csh hi")
30642      PORT_MODIFY("IN-16")
30643      // 0x0001 - "dil  1" // standard input (motherboard)
30644      // 0x0002 - "dil  2" // standard input (motherboard)
30645      // 0x0004 - "dil  3" // standard input (motherboard)
30646      // 0x0008 - "dil  4" // standard input (motherboard)
30647      // 0x0010 - "dil  5" // standard input (motherboard)
30648      // 0x0100 - "top up" // known extended input, usually 'top up'
30649      PORT_MODIFY("IN-17")
30650      // 0x0001 - "dil  6" // standard input (motherboard)
30651      // 0x0002 - "dil  7" // standard input (motherboard)
30652      // 0x0004 - "dil  8" // standard input (motherboard)
30653      // 0x0008 - "dil  9" // standard input (motherboard)
30654      // 0x0010 - "dil 10" // standard input (motherboard)
30655      PORT_MODIFY("IN-18")
30656      // 0x0001 - "dil 11" // standard input (motherboard)
30657      // 0x0002 - "dil 12" // standard input (motherboard)
30658      // 0x0004 - "dil 13" // standard input (motherboard)
30659      // 0x0008 - "dil 14" // standard input (motherboard)
30660      // 0x0010 - "dil 15" // standard input (motherboard)
30661      PORT_MODIFY("IN-19")
30662      // 0x0001 - "dil 16" // standard input (motherboard)
30663      PORT_MODIFY("IN-20")
30664      // 0x0001 - "testsw" // standard input (motherboard)
30665      // 0x0002 - "dor lk" // standard input (expected here)
30666      // 0x0004 - "tp dor" // standard input (expected here)
30667      // 0x0008 - "csh bx" // standard input (expected here)
30668      // 0x0010 - "deflt" // standard input (expected here)
3066930669INPUT_PORTS_END
3067030670
3067130671// missing sound roms, doesn't play, same game code and sound ident as Rolling Thunder?
r31373r31374
3069430694}
3069530695
3069630696INPUT_PORTS_START( sc4rbank ) // this structure is generated
30697        PORT_INCLUDE( sc4_base )
30698        PORT_MODIFY("IN-1")
30699        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30700        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
30701        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
30702        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
30703        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
30704        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
30705        PORT_MODIFY("IN-2")
30706        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
30707        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30708        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30709        PORT_MODIFY("IN-3")
30710        // 0x0004 - "stk 4" // standard input (expected here)
30711        // 0x0008 - "stk 3" // standard input (expected here)
30712        // 0x0010 - "stk 2" // standard input (expected here)
30713        PORT_MODIFY("IN-5")
30714        // 0x0001 - "priz4" // standard input (expected here)
30715        // 0x0002 - "priz3" // standard input (expected here)
30716        // 0x0004 - "priz2" // standard input (expected here)
30717        // 0x0008 - "priz1" // standard input (expected here)
30718        PORT_MODIFY("IN-6")
30719        // 0x0001 - "perc1" // standard input (expected here)
30720        // 0x0002 - "perc2" // standard input (expected here)
30721        // 0x0004 - "perc3" // standard input (expected here)
30722        // 0x0008 - "perc4" // standard input (expected here)
30723        PORT_MODIFY("IN-8")
30724        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
30725        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht")
30726        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk fea")
30727        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk haz")
30728        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk ss")
30729        PORT_MODIFY("IN-16")
30730        // 0x0001 - "dil 1" // standard input (motherboard)
30731        // 0x0002 - "dil 2" // standard input (motherboard)
30732        // 0x0004 - "dil 3" // standard input (motherboard)
30733        // 0x0008 - "dil 4" // standard input (motherboard)
30734        // 0x0010 - "dil 5" // standard input (motherboard)
30735        // 0x0100 - "top up" // known extended input, usually 'top up'
30736        PORT_MODIFY("IN-17")
30737        // 0x0001 - "dil 6" // standard input (motherboard)
30738        // 0x0002 - "dil 7" // standard input (motherboard)
30739        // 0x0004 - "dil 8" // standard input (motherboard)
30740        // 0x0008 - "dil 9" // standard input (motherboard)
30741        // 0x0010 - "dil10" // standard input (motherboard)
30742        PORT_MODIFY("IN-18")
30743        // 0x0001 - "dil11" // standard input (motherboard)
30744        // 0x0002 - "dil12" // standard input (motherboard)
30745        // 0x0004 - "dil13" // standard input (motherboard)
30746        // 0x0008 - "dil14" // standard input (motherboard)
30747        // 0x0010 - "dil15" // standard input (motherboard)
30748        PORT_MODIFY("IN-19")
30749        // 0x0001 - "dil16" // standard input (motherboard)
30750        PORT_MODIFY("IN-20")
30751        // 0x0001 - "grnbut" // standard input (motherboard)
30752        // 0x0002 - "dorlok" // standard input (expected here)
30753        // 0x0004 - "topdor" // standard input (expected here)
30754        // 0x0008 - "botdor" // standard input (expected here)
30755        // 0x0010 - "hopdmp" // standard input (expected here)
30697      PORT_INCLUDE( sc4_base )
30698      PORT_MODIFY("IN-1")
30699      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30700      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
30701      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
30702      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
30703      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
30704      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
30705      PORT_MODIFY("IN-2")
30706      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
30707      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30708      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30709      PORT_MODIFY("IN-3")
30710      // 0x0004 - "stk 4" // standard input (expected here)
30711      // 0x0008 - "stk 3" // standard input (expected here)
30712      // 0x0010 - "stk 2" // standard input (expected here)
30713      PORT_MODIFY("IN-5")
30714      // 0x0001 - "priz4" // standard input (expected here)
30715      // 0x0002 - "priz3" // standard input (expected here)
30716      // 0x0004 - "priz2" // standard input (expected here)
30717      // 0x0008 - "priz1" // standard input (expected here)
30718      PORT_MODIFY("IN-6")
30719      // 0x0001 - "perc1" // standard input (expected here)
30720      // 0x0002 - "perc2" // standard input (expected here)
30721      // 0x0004 - "perc3" // standard input (expected here)
30722      // 0x0008 - "perc4" // standard input (expected here)
30723      PORT_MODIFY("IN-8")
30724      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
30725      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht")
30726      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk fea")
30727      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk haz")
30728      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk ss")
30729      PORT_MODIFY("IN-16")
30730      // 0x0001 - "dil 1" // standard input (motherboard)
30731      // 0x0002 - "dil 2" // standard input (motherboard)
30732      // 0x0004 - "dil 3" // standard input (motherboard)
30733      // 0x0008 - "dil 4" // standard input (motherboard)
30734      // 0x0010 - "dil 5" // standard input (motherboard)
30735      // 0x0100 - "top up" // known extended input, usually 'top up'
30736      PORT_MODIFY("IN-17")
30737      // 0x0001 - "dil 6" // standard input (motherboard)
30738      // 0x0002 - "dil 7" // standard input (motherboard)
30739      // 0x0004 - "dil 8" // standard input (motherboard)
30740      // 0x0008 - "dil 9" // standard input (motherboard)
30741      // 0x0010 - "dil10" // standard input (motherboard)
30742      PORT_MODIFY("IN-18")
30743      // 0x0001 - "dil11" // standard input (motherboard)
30744      // 0x0002 - "dil12" // standard input (motherboard)
30745      // 0x0004 - "dil13" // standard input (motherboard)
30746      // 0x0008 - "dil14" // standard input (motherboard)
30747      // 0x0010 - "dil15" // standard input (motherboard)
30748      PORT_MODIFY("IN-19")
30749      // 0x0001 - "dil16" // standard input (motherboard)
30750      PORT_MODIFY("IN-20")
30751      // 0x0001 - "grnbut" // standard input (motherboard)
30752      // 0x0002 - "dorlok" // standard input (expected here)
30753      // 0x0004 - "topdor" // standard input (expected here)
30754      // 0x0008 - "botdor" // standard input (expected here)
30755      // 0x0010 - "hopdmp" // standard input (expected here)
3075630756INPUT_PORTS_END
3075730757
3075830758// PR1111 ROYAL BANKER         PR1111 ROYLEBANKER SOUNDS11
r31373r31374
3077930779}
3078030780
3078130781INPUT_PORTS_START( sc4royle ) // this structure is generated
30782        PORT_INCLUDE( sc4_base )
30783        PORT_MODIFY("IN-1")
30784        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30785        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
30786        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
30787        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
30788        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
30789        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
30790        PORT_MODIFY("IN-2")
30791        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
30792        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30793        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30794        PORT_MODIFY("IN-3")
30795        // 0x0004 - "stk 4" // standard input (expected here)
30796        // 0x0008 - "stk 3" // standard input (expected here)
30797        // 0x0010 - "stk 2" // standard input (expected here)
30798        PORT_MODIFY("IN-4")
30799        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
30800        PORT_MODIFY("IN-5")
30801        // 0x0001 - "priz4" // standard input (expected here)
30802        // 0x0002 - "priz3" // standard input (expected here)
30803        // 0x0004 - "priz2" // standard input (expected here)
30804        // 0x0008 - "priz1" // standard input (expected here)
30805        PORT_MODIFY("IN-6")
30806        // 0x0001 - "perc1" // standard input (expected here)
30807        // 0x0002 - "perc2" // standard input (expected here)
30808        // 0x0004 - "perc3" // standard input (expected here)
30809        // 0x0008 - "perc4" // standard input (expected here)
30810        PORT_MODIFY("IN-8")
30811        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
30812        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
30813        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk fet")
30814        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi nud")
30815        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi csh")
30816        PORT_MODIFY("IN-9")
30817        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hi fet")
30818        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("lo nud")
30819        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("lo csh")
30820        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("lo fet")
30821        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("tk brc")
30822        PORT_MODIFY("IN-16")
30823        // 0x0001 - "dil 1" // standard input (motherboard)
30824        // 0x0002 - "dil 2" // standard input (motherboard)
30825        // 0x0004 - "dil 3" // standard input (motherboard)
30826        // 0x0008 - "dil 4" // standard input (motherboard)
30827        // 0x0010 - "dil 5" // standard input (motherboard)
30828        // 0x0100 - "htopup" // known extended input, usually 'top up'
30829        PORT_MODIFY("IN-17")
30830        // 0x0001 - "dil 6" // standard input (motherboard)
30831        // 0x0002 - "dil 7" // standard input (motherboard)
30832        // 0x0004 - "dil 8" // standard input (motherboard)
30833        // 0x0008 - "dil 9" // standard input (motherboard)
30834        // 0x0010 - "dil10" // standard input (motherboard)
30835        PORT_MODIFY("IN-18")
30836        // 0x0001 - "dil11" // standard input (motherboard)
30837        // 0x0002 - "dil12" // standard input (motherboard)
30838        // 0x0004 - "dil13" // standard input (motherboard)
30839        // 0x0008 - "dil14" // standard input (motherboard)
30840        // 0x0010 - "dil15" // standard input (motherboard)
30841        PORT_MODIFY("IN-19")
30842        // 0x0001 - "dil16" // standard input (motherboard)
30843        PORT_MODIFY("IN-20")
30844        // 0x0001 - "grnbut" // standard input (motherboard)
30845        // 0x0002 - "dorlok" // standard input (expected here)
30846        // 0x0004 - "serdor" // standard input (expected here)
30847        // 0x0008 - "cshdor" // standard input (expected here)
30848        // 0x0010 - "hopdmp" // standard input (expected here)
30782      PORT_INCLUDE( sc4_base )
30783      PORT_MODIFY("IN-1")
30784      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30785      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
30786      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
30787      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
30788      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
30789      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
30790      PORT_MODIFY("IN-2")
30791      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
30792      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30793      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30794      PORT_MODIFY("IN-3")
30795      // 0x0004 - "stk 4" // standard input (expected here)
30796      // 0x0008 - "stk 3" // standard input (expected here)
30797      // 0x0010 - "stk 2" // standard input (expected here)
30798      PORT_MODIFY("IN-4")
30799      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
30800      PORT_MODIFY("IN-5")
30801      // 0x0001 - "priz4" // standard input (expected here)
30802      // 0x0002 - "priz3" // standard input (expected here)
30803      // 0x0004 - "priz2" // standard input (expected here)
30804      // 0x0008 - "priz1" // standard input (expected here)
30805      PORT_MODIFY("IN-6")
30806      // 0x0001 - "perc1" // standard input (expected here)
30807      // 0x0002 - "perc2" // standard input (expected here)
30808      // 0x0004 - "perc3" // standard input (expected here)
30809      // 0x0008 - "perc4" // standard input (expected here)
30810      PORT_MODIFY("IN-8")
30811      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
30812      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
30813      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk fet")
30814      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi nud")
30815      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi csh")
30816      PORT_MODIFY("IN-9")
30817      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hi fet")
30818      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("lo nud")
30819      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("lo csh")
30820      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("lo fet")
30821      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("tk brc")
30822      PORT_MODIFY("IN-16")
30823      // 0x0001 - "dil 1" // standard input (motherboard)
30824      // 0x0002 - "dil 2" // standard input (motherboard)
30825      // 0x0004 - "dil 3" // standard input (motherboard)
30826      // 0x0008 - "dil 4" // standard input (motherboard)
30827      // 0x0010 - "dil 5" // standard input (motherboard)
30828      // 0x0100 - "htopup" // known extended input, usually 'top up'
30829      PORT_MODIFY("IN-17")
30830      // 0x0001 - "dil 6" // standard input (motherboard)
30831      // 0x0002 - "dil 7" // standard input (motherboard)
30832      // 0x0004 - "dil 8" // standard input (motherboard)
30833      // 0x0008 - "dil 9" // standard input (motherboard)
30834      // 0x0010 - "dil10" // standard input (motherboard)
30835      PORT_MODIFY("IN-18")
30836      // 0x0001 - "dil11" // standard input (motherboard)
30837      // 0x0002 - "dil12" // standard input (motherboard)
30838      // 0x0004 - "dil13" // standard input (motherboard)
30839      // 0x0008 - "dil14" // standard input (motherboard)
30840      // 0x0010 - "dil15" // standard input (motherboard)
30841      PORT_MODIFY("IN-19")
30842      // 0x0001 - "dil16" // standard input (motherboard)
30843      PORT_MODIFY("IN-20")
30844      // 0x0001 - "grnbut" // standard input (motherboard)
30845      // 0x0002 - "dorlok" // standard input (expected here)
30846      // 0x0004 - "serdor" // standard input (expected here)
30847      // 0x0008 - "cshdor" // standard input (expected here)
30848      // 0x0010 - "hopdmp" // standard input (expected here)
3084930849INPUT_PORTS_END
3085030850
3085130851// PR1102 ROYLEFAMILY         PR1102 ROYLEFAMILY SOUNDS11
r31373r31374
3088330883}
3088430884
3088530885INPUT_PORTS_START( sc4sidsp ) // this structure is generated
30886        PORT_INCLUDE( sc4_base )
30887        PORT_MODIFY("IN-1")
30888        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
30889        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
30890        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
30891        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
30892        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
30893        PORT_MODIFY("IN-2")
30894        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
30895        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30896        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30897        PORT_MODIFY("IN-8")
30898        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
30899        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shot")
30900        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkcsh")
30901        PORT_MODIFY("IN-16")
30902        // 0x0001 - "dil 1" // standard input (motherboard)
30903        // 0x0002 - "dil 2" // standard input (motherboard)
30904        // 0x0004 - "dil 3" // standard input (motherboard)
30905        // 0x0008 - "dil 4" // standard input (motherboard)
30906        // 0x0010 - "dil 5" // standard input (motherboard)
30907        // 0x0100 - "topup" // known extended input, usually 'top up'
30908        PORT_MODIFY("IN-17")
30909        // 0x0001 - "dil 6" // standard input (motherboard)
30910        // 0x0002 - "dil 7" // standard input (motherboard)
30911        // 0x0004 - "dil 8" // standard input (motherboard)
30912        // 0x0008 - "dil 9" // standard input (motherboard)
30913        // 0x0010 - "dil10" // standard input (motherboard)
30914        PORT_MODIFY("IN-18")
30915        // 0x0001 - "dil11" // standard input (motherboard)
30916        // 0x0002 - "dil12" // standard input (motherboard)
30917        // 0x0004 - "dil13" // standard input (motherboard)
30918        // 0x0008 - "dil14" // standard input (motherboard)
30919        // 0x0010 - "dil15" // standard input (motherboard)
30920        PORT_MODIFY("IN-19")
30921        // 0x0001 - "dil16" // standard input (motherboard)
30922        PORT_MODIFY("IN-20")
30923        // 0x0001 - "test" // standard input (motherboard)
30924        // 0x0002 - "dor lk" // standard input (expected here)
30925        // 0x0004 - "tp dor" // standard input (expected here)
30926        // 0x0008 - "csh bx" // standard input (expected here)
30927        // 0x0010 - "deflt" // standard input (expected here)
30886      PORT_INCLUDE( sc4_base )
30887      PORT_MODIFY("IN-1")
30888      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
30889      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
30890      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
30891      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
30892      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
30893      PORT_MODIFY("IN-2")
30894      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
30895      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30896      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30897      PORT_MODIFY("IN-8")
30898      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
30899      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shot")
30900      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkcsh")
30901      PORT_MODIFY("IN-16")
30902      // 0x0001 - "dil 1" // standard input (motherboard)
30903      // 0x0002 - "dil 2" // standard input (motherboard)
30904      // 0x0004 - "dil 3" // standard input (motherboard)
30905      // 0x0008 - "dil 4" // standard input (motherboard)
30906      // 0x0010 - "dil 5" // standard input (motherboard)
30907      // 0x0100 - "topup" // known extended input, usually 'top up'
30908      PORT_MODIFY("IN-17")
30909      // 0x0001 - "dil 6" // standard input (motherboard)
30910      // 0x0002 - "dil 7" // standard input (motherboard)
30911      // 0x0004 - "dil 8" // standard input (motherboard)
30912      // 0x0008 - "dil 9" // standard input (motherboard)
30913      // 0x0010 - "dil10" // standard input (motherboard)
30914      PORT_MODIFY("IN-18")
30915      // 0x0001 - "dil11" // standard input (motherboard)
30916      // 0x0002 - "dil12" // standard input (motherboard)
30917      // 0x0004 - "dil13" // standard input (motherboard)
30918      // 0x0008 - "dil14" // standard input (motherboard)
30919      // 0x0010 - "dil15" // standard input (motherboard)
30920      PORT_MODIFY("IN-19")
30921      // 0x0001 - "dil16" // standard input (motherboard)
30922      PORT_MODIFY("IN-20")
30923      // 0x0001 - "test" // standard input (motherboard)
30924      // 0x0002 - "dor lk" // standard input (expected here)
30925      // 0x0004 - "tp dor" // standard input (expected here)
30926      // 0x0008 - "csh bx" // standard input (expected here)
30927      // 0x0010 - "deflt" // standard input (expected here)
3092830928INPUT_PORTS_END
3092930929
3093030930//  PR2117 SIDE SPLITTER         SSPT SOUNDS         SIDE SPLITTER
r31373r31374
3095030950}
3095130951
3095230952INPUT_PORTS_START( sc4srr ) // this structure is generated
30953        PORT_INCLUDE( sc4_base )
30954        PORT_MODIFY("IN-1")
30955        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30956        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
30957        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
30958        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
30959        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
30960        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
30961        PORT_MODIFY("IN-2")
30962        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("shuffl")
30963        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30964        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30965        PORT_MODIFY("IN-3")
30966        // 0x0004 - "stk 4" // standard input (expected here)
30967        // 0x0008 - "stk 3" // standard input (expected here)
30968        // 0x0010 - "stk 2" // standard input (expected here)
30969        PORT_MODIFY("IN-4")
30970        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
30971        PORT_MODIFY("IN-5")
30972        // 0x0001 - "priz4" // standard input (expected here)
30973        // 0x0002 - "priz3" // standard input (expected here)
30974        // 0x0004 - "priz2" // standard input (expected here)
30975        // 0x0008 - "priz1" // standard input (expected here)
30976        PORT_MODIFY("IN-6")
30977        // 0x0001 - "perc1" // standard input (expected here)
30978        // 0x0002 - "perc2" // standard input (expected here)
30979        // 0x0004 - "perc3" // standard input (expected here)
30980        // 0x0008 - "perc4" // standard input (expected here)
30981        PORT_MODIFY("IN-8")
30982        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("auto n")
30983        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk fet")
30984        PORT_MODIFY("IN-16")
30985        // 0x0001 - "dil 1" // standard input (motherboard)
30986        // 0x0002 - "dil 2" // standard input (motherboard)
30987        // 0x0004 - "dil 3" // standard input (motherboard)
30988        // 0x0008 - "dil 4" // standard input (motherboard)
30989        // 0x0010 - "dil 5" // standard input (motherboard)
30990        // 0x0100 - "htopup" // known extended input, usually 'top up'
30991        PORT_MODIFY("IN-17")
30992        // 0x0001 - "dil 6" // standard input (motherboard)
30993        // 0x0002 - "dil 7" // standard input (motherboard)
30994        // 0x0004 - "dil 8" // standard input (motherboard)
30995        // 0x0008 - "dil 9" // standard input (motherboard)
30996        // 0x0010 - "dil 10" // standard input (motherboard)
30997        PORT_MODIFY("IN-18")
30998        // 0x0001 - "dil 11" // standard input (motherboard)
30999        // 0x0002 - "dil 12" // standard input (motherboard)
31000        // 0x0004 - "dil 13" // standard input (motherboard)
31001        // 0x0008 - "dil 14" // standard input (motherboard)
31002        // 0x0010 - "dil 15" // standard input (motherboard)
31003        PORT_MODIFY("IN-19")
31004        // 0x0001 - "dil 16" // standard input (motherboard)
31005        PORT_MODIFY("IN-20")
31006        // 0x0001 - "grnbut" // standard input (motherboard)
31007        // 0x0002 - "dorlok" // standard input (expected here)
31008        // 0x0004 - "serdor" // standard input (expected here)
31009        // 0x0008 - "cshdor" // standard input (expected here)
31010        // 0x0010 - "hopdmp" // standard input (expected here)
30953      PORT_INCLUDE( sc4_base )
30954      PORT_MODIFY("IN-1")
30955      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
30956      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
30957      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
30958      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
30959      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
30960      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
30961      PORT_MODIFY("IN-2")
30962      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("shuffl")
30963      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
30964      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
30965      PORT_MODIFY("IN-3")
30966      // 0x0004 - "stk 4" // standard input (expected here)
30967      // 0x0008 - "stk 3" // standard input (expected here)
30968      // 0x0010 - "stk 2" // standard input (expected here)
30969      PORT_MODIFY("IN-4")
30970      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
30971      PORT_MODIFY("IN-5")
30972      // 0x0001 - "priz4" // standard input (expected here)
30973      // 0x0002 - "priz3" // standard input (expected here)
30974      // 0x0004 - "priz2" // standard input (expected here)
30975      // 0x0008 - "priz1" // standard input (expected here)
30976      PORT_MODIFY("IN-6")
30977      // 0x0001 - "perc1" // standard input (expected here)
30978      // 0x0002 - "perc2" // standard input (expected here)
30979      // 0x0004 - "perc3" // standard input (expected here)
30980      // 0x0008 - "perc4" // standard input (expected here)
30981      PORT_MODIFY("IN-8")
30982      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("auto n")
30983      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk fet")
30984      PORT_MODIFY("IN-16")
30985      // 0x0001 - "dil 1" // standard input (motherboard)
30986      // 0x0002 - "dil 2" // standard input (motherboard)
30987      // 0x0004 - "dil 3" // standard input (motherboard)
30988      // 0x0008 - "dil 4" // standard input (motherboard)
30989      // 0x0010 - "dil 5" // standard input (motherboard)
30990      // 0x0100 - "htopup" // known extended input, usually 'top up'
30991      PORT_MODIFY("IN-17")
30992      // 0x0001 - "dil 6" // standard input (motherboard)
30993      // 0x0002 - "dil 7" // standard input (motherboard)
30994      // 0x0004 - "dil 8" // standard input (motherboard)
30995      // 0x0008 - "dil 9" // standard input (motherboard)
30996      // 0x0010 - "dil 10" // standard input (motherboard)
30997      PORT_MODIFY("IN-18")
30998      // 0x0001 - "dil 11" // standard input (motherboard)
30999      // 0x0002 - "dil 12" // standard input (motherboard)
31000      // 0x0004 - "dil 13" // standard input (motherboard)
31001      // 0x0008 - "dil 14" // standard input (motherboard)
31002      // 0x0010 - "dil 15" // standard input (motherboard)
31003      PORT_MODIFY("IN-19")
31004      // 0x0001 - "dil 16" // standard input (motherboard)
31005      PORT_MODIFY("IN-20")
31006      // 0x0001 - "grnbut" // standard input (motherboard)
31007      // 0x0002 - "dorlok" // standard input (expected here)
31008      // 0x0004 - "serdor" // standard input (expected here)
31009      // 0x0008 - "cshdor" // standard input (expected here)
31010      // 0x0010 - "hopdmp" // standard input (expected here)
3101131011INPUT_PORTS_END
3101231012
3101331013
r31373r31374
3104031040}
3104131041
3104231042INPUT_PORTS_START( sc4slc ) // this structure is generated
31043        PORT_INCLUDE( sc4_base )
31044        PORT_MODIFY("IN-1")
31045        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
31046        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31047        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31048        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31049        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
31050        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
31051        PORT_MODIFY("IN-2")
31052        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
31053        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
31054        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
31055        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31056        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
31057        PORT_MODIFY("IN-3")
31058        // 0x0004 - "stk 4" // standard input (expected here)
31059        // 0x0008 - "stk 3" // standard input (expected here)
31060        // 0x0010 - "stk 2" // standard input (expected here)
31061        PORT_MODIFY("IN-4")
31062        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
31063        PORT_MODIFY("IN-5")
31064        // 0x0001 - "priz4" // standard input (expected here)
31065        // 0x0002 - "priz3" // standard input (expected here)
31066        // 0x0004 - "priz2" // standard input (expected here)
31067        // 0x0008 - "priz1" // standard input (expected here)
31068        PORT_MODIFY("IN-8")
31069        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk win")
31070        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk nud")
31071        PORT_MODIFY("IN-16")
31072        // 0x0001 - "dil 1" // standard input (motherboard)
31073        // 0x0002 - "dil 2" // standard input (motherboard)
31074        // 0x0004 - "dil 3" // standard input (motherboard)
31075        // 0x0008 - "dil 4" // standard input (motherboard)
31076        // 0x0010 - "dil 5" // standard input (motherboard)
31077        // 0x0100 - "top up" // known extended input, usually 'top up'
31078        PORT_MODIFY("IN-17")
31079        // 0x0001 - "dil 6" // standard input (motherboard)
31080        // 0x0002 - "dil 7" // standard input (motherboard)
31081        // 0x0004 - "dil 8" // standard input (motherboard)
31082        // 0x0008 - "dil 9" // standard input (motherboard)
31083        // 0x0010 - "dil10" // standard input (motherboard)
31084        PORT_MODIFY("IN-18")
31085        // 0x0001 - "dil11" // standard input (motherboard)
31086        // 0x0002 - "dil12" // standard input (motherboard)
31087        // 0x0004 - "dil13" // standard input (motherboard)
31088        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
31089        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
31090        PORT_MODIFY("IN-19")
31091        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
31092        PORT_MODIFY("IN-20")
31093        // 0x0001 - "grnbut" // standard input (motherboard)
31094        // 0x0002 - "dorlok" // standard input (expected here)
31095        // 0x0004 - "topdor" // standard input (expected here)
31096        // 0x0008 - "botdor" // standard input (expected here)
31097        // 0x0010 - "hopdmp" // standard input (expected here)
31043      PORT_INCLUDE( sc4_base )
31044      PORT_MODIFY("IN-1")
31045      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
31046      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31047      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31048      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31049      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
31050      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
31051      PORT_MODIFY("IN-2")
31052      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
31053      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
31054      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
31055      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31056      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
31057      PORT_MODIFY("IN-3")
31058      // 0x0004 - "stk 4" // standard input (expected here)
31059      // 0x0008 - "stk 3" // standard input (expected here)
31060      // 0x0010 - "stk 2" // standard input (expected here)
31061      PORT_MODIFY("IN-4")
31062      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
31063      PORT_MODIFY("IN-5")
31064      // 0x0001 - "priz4" // standard input (expected here)
31065      // 0x0002 - "priz3" // standard input (expected here)
31066      // 0x0004 - "priz2" // standard input (expected here)
31067      // 0x0008 - "priz1" // standard input (expected here)
31068      PORT_MODIFY("IN-8")
31069      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk win")
31070      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk nud")
31071      PORT_MODIFY("IN-16")
31072      // 0x0001 - "dil 1" // standard input (motherboard)
31073      // 0x0002 - "dil 2" // standard input (motherboard)
31074      // 0x0004 - "dil 3" // standard input (motherboard)
31075      // 0x0008 - "dil 4" // standard input (motherboard)
31076      // 0x0010 - "dil 5" // standard input (motherboard)
31077      // 0x0100 - "top up" // known extended input, usually 'top up'
31078      PORT_MODIFY("IN-17")
31079      // 0x0001 - "dil 6" // standard input (motherboard)
31080      // 0x0002 - "dil 7" // standard input (motherboard)
31081      // 0x0004 - "dil 8" // standard input (motherboard)
31082      // 0x0008 - "dil 9" // standard input (motherboard)
31083      // 0x0010 - "dil10" // standard input (motherboard)
31084      PORT_MODIFY("IN-18")
31085      // 0x0001 - "dil11" // standard input (motherboard)
31086      // 0x0002 - "dil12" // standard input (motherboard)
31087      // 0x0004 - "dil13" // standard input (motherboard)
31088      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
31089      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
31090      PORT_MODIFY("IN-19")
31091      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
31092      PORT_MODIFY("IN-20")
31093      // 0x0001 - "grnbut" // standard input (motherboard)
31094      // 0x0002 - "dorlok" // standard input (expected here)
31095      // 0x0004 - "topdor" // standard input (expected here)
31096      // 0x0008 - "botdor" // standard input (expected here)
31097      // 0x0010 - "hopdmp" // standard input (expected here)
3109831098INPUT_PORTS_END
3109931099
3110031100// PR1423 CLUB SNAKES N LADDERS         PR1423 CSNK SOUNDS11         SNAKES N LADDERS
r31373r31374
3113331133}
3113431134
3113531135INPUT_PORTS_START( sc4solgl ) // this structure is generated
31136        PORT_INCLUDE( sc4_base )
31137        PORT_MODIFY("IN-1")
31138        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31139        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31140        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31141        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31142        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
31143        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
31144        PORT_MODIFY("IN-2")
31145        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
31146        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31147        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31148        PORT_MODIFY("IN-3")
31149        // 0x0004 - "stk 4" // standard input (expected here)
31150        // 0x0008 - "stk 3" // standard input (expected here)
31151        // 0x0010 - "stk 2" // standard input (expected here)
31152        PORT_MODIFY("IN-5")
31153        // 0x0001 - "priz4" // standard input (expected here)
31154        // 0x0002 - "priz3" // standard input (expected here)
31155        // 0x0004 - "priz2" // standard input (expected here)
31156        // 0x0008 - "priz1" // standard input (expected here)
31157        PORT_MODIFY("IN-6")
31158        // 0x0001 - "perc1" // standard input (expected here)
31159        // 0x0002 - "perc2" // standard input (expected here)
31160        // 0x0004 - "perc3" // standard input (expected here)
31161        // 0x0008 - "perc4" // standard input (expected here)
31162        PORT_MODIFY("IN-8")
31163        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk wsp")
31164        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("hi csh")
31165        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi fet")
31166        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk csh")
31167        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lo csh")
31168        PORT_MODIFY("IN-9")
31169        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("lo fet")
31170        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("tk fea")
31171        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("tk mat")
31172        PORT_MODIFY("IN-16")
31173        // 0x0001 - "dil 1" // standard input (motherboard)
31174        // 0x0002 - "dil 2" // standard input (motherboard)
31175        // 0x0004 - "dil 3" // standard input (motherboard)
31176        // 0x0008 - "dil 4" // standard input (motherboard)
31177        // 0x0010 - "dil 5" // standard input (motherboard)
31178        // 0x0100 - "top up" // known extended input, usually 'top up'
31179        PORT_MODIFY("IN-17")
31180        // 0x0001 - "dil 6" // standard input (motherboard)
31181        // 0x0002 - "dil 7" // standard input (motherboard)
31182        // 0x0004 - "dil 8" // standard input (motherboard)
31183        // 0x0008 - "dil 9" // standard input (motherboard)
31184        // 0x0010 - "dil10" // standard input (motherboard)
31185        PORT_MODIFY("IN-18")
31186        // 0x0001 - "dil11" // standard input (motherboard)
31187        // 0x0002 - "dil12" // standard input (motherboard)
31188        // 0x0004 - "dil13" // standard input (motherboard)
31189        // 0x0008 - "dil14" // standard input (motherboard)
31190        // 0x0010 - "dil15" // standard input (motherboard)
31191        PORT_MODIFY("IN-19")
31192        // 0x0001 - "dil16" // standard input (motherboard)
31193        PORT_MODIFY("IN-20")
31194        // 0x0001 - "grnbut" // standard input (motherboard)
31195        // 0x0002 - "dorlok" // standard input (expected here)
31196        // 0x0004 - "topdor" // standard input (expected here)
31197        // 0x0008 - "botdor" // standard input (expected here)
31198        // 0x0010 - "hopdmp" // standard input (expected here)
31136      PORT_INCLUDE( sc4_base )
31137      PORT_MODIFY("IN-1")
31138      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31139      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31140      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31141      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31142      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
31143      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
31144      PORT_MODIFY("IN-2")
31145      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
31146      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31147      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31148      PORT_MODIFY("IN-3")
31149      // 0x0004 - "stk 4" // standard input (expected here)
31150      // 0x0008 - "stk 3" // standard input (expected here)
31151      // 0x0010 - "stk 2" // standard input (expected here)
31152      PORT_MODIFY("IN-5")
31153      // 0x0001 - "priz4" // standard input (expected here)
31154      // 0x0002 - "priz3" // standard input (expected here)
31155      // 0x0004 - "priz2" // standard input (expected here)
31156      // 0x0008 - "priz1" // standard input (expected here)
31157      PORT_MODIFY("IN-6")
31158      // 0x0001 - "perc1" // standard input (expected here)
31159      // 0x0002 - "perc2" // standard input (expected here)
31160      // 0x0004 - "perc3" // standard input (expected here)
31161      // 0x0008 - "perc4" // standard input (expected here)
31162      PORT_MODIFY("IN-8")
31163      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk wsp")
31164      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("hi csh")
31165      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi fet")
31166      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk csh")
31167      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lo csh")
31168      PORT_MODIFY("IN-9")
31169      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("lo fet")
31170      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("tk fea")
31171      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("tk mat")
31172      PORT_MODIFY("IN-16")
31173      // 0x0001 - "dil 1" // standard input (motherboard)
31174      // 0x0002 - "dil 2" // standard input (motherboard)
31175      // 0x0004 - "dil 3" // standard input (motherboard)
31176      // 0x0008 - "dil 4" // standard input (motherboard)
31177      // 0x0010 - "dil 5" // standard input (motherboard)
31178      // 0x0100 - "top up" // known extended input, usually 'top up'
31179      PORT_MODIFY("IN-17")
31180      // 0x0001 - "dil 6" // standard input (motherboard)
31181      // 0x0002 - "dil 7" // standard input (motherboard)
31182      // 0x0004 - "dil 8" // standard input (motherboard)
31183      // 0x0008 - "dil 9" // standard input (motherboard)
31184      // 0x0010 - "dil10" // standard input (motherboard)
31185      PORT_MODIFY("IN-18")
31186      // 0x0001 - "dil11" // standard input (motherboard)
31187      // 0x0002 - "dil12" // standard input (motherboard)
31188      // 0x0004 - "dil13" // standard input (motherboard)
31189      // 0x0008 - "dil14" // standard input (motherboard)
31190      // 0x0010 - "dil15" // standard input (motherboard)
31191      PORT_MODIFY("IN-19")
31192      // 0x0001 - "dil16" // standard input (motherboard)
31193      PORT_MODIFY("IN-20")
31194      // 0x0001 - "grnbut" // standard input (motherboard)
31195      // 0x0002 - "dorlok" // standard input (expected here)
31196      // 0x0004 - "topdor" // standard input (expected here)
31197      // 0x0008 - "botdor" // standard input (expected here)
31198      // 0x0010 - "hopdmp" // standard input (expected here)
3119931199INPUT_PORTS_END
3120031200
3120131201// PR1010  SOLID GOLD         PR1010 SOLID GOLD SOUNDS11
r31373r31374
3122131221}
3122231222
3122331223INPUT_PORTS_START( sc4sace ) // this structure is generated
31224        PORT_INCLUDE( sc4_base )
31225        PORT_MODIFY("IN-1")
31226        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31227        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31228        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31229        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31230        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
31231        PORT_MODIFY("IN-2")
31232        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
31233        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31234        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31235        PORT_MODIFY("IN-8")
31236        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shots")
31237        PORT_MODIFY("IN-16")
31238        // 0x0001 - "dil  1" // standard input (motherboard)
31239        // 0x0002 - "dil  2" // standard input (motherboard)
31240        // 0x0004 - "dil  3" // standard input (motherboard)
31241        // 0x0008 - "dil  4" // standard input (motherboard)
31242        // 0x0010 - "dil  5" // standard input (motherboard)
31243        // 0x0100 - "topup" // known extended input, usually 'top up'
31244        PORT_MODIFY("IN-17")
31245        // 0x0001 - "dil  6" // standard input (motherboard)
31246        // 0x0002 - "dil  7" // standard input (motherboard)
31247        // 0x0004 - "dil  8" // standard input (motherboard)
31248        // 0x0008 - "dil  9" // standard input (motherboard)
31249        // 0x0010 - "dil 10" // standard input (motherboard)
31250        PORT_MODIFY("IN-18")
31251        // 0x0001 - "dil 11" // standard input (motherboard)
31252        // 0x0002 - "dil 12" // standard input (motherboard)
31253        // 0x0004 - "dil 13" // standard input (motherboard)
31254        // 0x0008 - "dil 14" // standard input (motherboard)
31255        // 0x0010 - "dil 15" // standard input (motherboard)
31256        PORT_MODIFY("IN-19")
31257        // 0x0001 - "dil 16" // standard input (motherboard)
31258        PORT_MODIFY("IN-20")
31259        // 0x0001 - "test" // standard input (motherboard)
31260        // 0x0002 - "lock" // standard input (expected here)
31261        // 0x0004 - "topdor" // standard input (expected here)
31262        // 0x0008 - "botdor" // standard input (expected here)
31263        // 0x0010 - "hopdmp" // standard input (expected here)
31224      PORT_INCLUDE( sc4_base )
31225      PORT_MODIFY("IN-1")
31226      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31227      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31228      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31229      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31230      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
31231      PORT_MODIFY("IN-2")
31232      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
31233      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31234      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31235      PORT_MODIFY("IN-8")
31236      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shots")
31237      PORT_MODIFY("IN-16")
31238      // 0x0001 - "dil  1" // standard input (motherboard)
31239      // 0x0002 - "dil  2" // standard input (motherboard)
31240      // 0x0004 - "dil  3" // standard input (motherboard)
31241      // 0x0008 - "dil  4" // standard input (motherboard)
31242      // 0x0010 - "dil  5" // standard input (motherboard)
31243      // 0x0100 - "topup" // known extended input, usually 'top up'
31244      PORT_MODIFY("IN-17")
31245      // 0x0001 - "dil  6" // standard input (motherboard)
31246      // 0x0002 - "dil  7" // standard input (motherboard)
31247      // 0x0004 - "dil  8" // standard input (motherboard)
31248      // 0x0008 - "dil  9" // standard input (motherboard)
31249      // 0x0010 - "dil 10" // standard input (motherboard)
31250      PORT_MODIFY("IN-18")
31251      // 0x0001 - "dil 11" // standard input (motherboard)
31252      // 0x0002 - "dil 12" // standard input (motherboard)
31253      // 0x0004 - "dil 13" // standard input (motherboard)
31254      // 0x0008 - "dil 14" // standard input (motherboard)
31255      // 0x0010 - "dil 15" // standard input (motherboard)
31256      PORT_MODIFY("IN-19")
31257      // 0x0001 - "dil 16" // standard input (motherboard)
31258      PORT_MODIFY("IN-20")
31259      // 0x0001 - "test" // standard input (motherboard)
31260      // 0x0002 - "lock" // standard input (expected here)
31261      // 0x0004 - "topdor" // standard input (expected here)
31262      // 0x0008 - "botdor" // standard input (expected here)
31263      // 0x0010 - "hopdmp" // standard input (expected here)
3126431264INPUT_PORTS_END
3126531265
3126631266
r31373r31374
3128631286}
3128731287
3128831288INPUT_PORTS_START( sc4sbust ) // this structure is generated
31289        PORT_INCLUDE( sc4_base )
31290        PORT_MODIFY("IN-1")
31291        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31292        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31293        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31294        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31295        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
31296        PORT_MODIFY("IN-2")
31297        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31298        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31299        PORT_MODIFY("IN-8")
31300        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("step f")
31301        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step b")
31302        PORT_MODIFY("IN-16")
31303        // 0x0001 - "dil  1" // standard input (motherboard)
31304        // 0x0002 - "dil  2" // standard input (motherboard)
31305        // 0x0004 - "dil  3" // standard input (motherboard)
31306        // 0x0008 - "dil  4" // standard input (motherboard)
31307        // 0x0010 - "dil  5" // standard input (motherboard)
31308        // 0x0100 - "topup" // known extended input, usually 'top up'
31309        PORT_MODIFY("IN-17")
31310        // 0x0001 - "dil  6" // standard input (motherboard)
31311        // 0x0002 - "dil  7" // standard input (motherboard)
31312        // 0x0004 - "dil  8" // standard input (motherboard)
31313        // 0x0008 - "dil  9" // standard input (motherboard)
31314        // 0x0010 - "dil 10" // standard input (motherboard)
31315        PORT_MODIFY("IN-18")
31316        // 0x0001 - "dil 11" // standard input (motherboard)
31317        // 0x0002 - "dil 12" // standard input (motherboard)
31318        // 0x0004 - "dil 13" // standard input (motherboard)
31319        // 0x0008 - "dil 14" // standard input (motherboard)
31320        // 0x0010 - "dil 15" // standard input (motherboard)
31321        PORT_MODIFY("IN-19")
31322        // 0x0001 - "dil 16" // standard input (motherboard)
31323        PORT_MODIFY("IN-20")
31324        // 0x0001 - "test" // standard input (motherboard)
31325        // 0x0002 - "lock" // standard input (expected here)
31326        // 0x0004 - "topdor" // standard input (expected here)
31327        // 0x0008 - "botdor" // standard input (expected here)
31328        // 0x0010 - "hopdmp" // standard input (expected here)
31289      PORT_INCLUDE( sc4_base )
31290      PORT_MODIFY("IN-1")
31291      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31292      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31293      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31294      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31295      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
31296      PORT_MODIFY("IN-2")
31297      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31298      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31299      PORT_MODIFY("IN-8")
31300      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("step f")
31301      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step b")
31302      PORT_MODIFY("IN-16")
31303      // 0x0001 - "dil  1" // standard input (motherboard)
31304      // 0x0002 - "dil  2" // standard input (motherboard)
31305      // 0x0004 - "dil  3" // standard input (motherboard)
31306      // 0x0008 - "dil  4" // standard input (motherboard)
31307      // 0x0010 - "dil  5" // standard input (motherboard)
31308      // 0x0100 - "topup" // known extended input, usually 'top up'
31309      PORT_MODIFY("IN-17")
31310      // 0x0001 - "dil  6" // standard input (motherboard)
31311      // 0x0002 - "dil  7" // standard input (motherboard)
31312      // 0x0004 - "dil  8" // standard input (motherboard)
31313      // 0x0008 - "dil  9" // standard input (motherboard)
31314      // 0x0010 - "dil 10" // standard input (motherboard)
31315      PORT_MODIFY("IN-18")
31316      // 0x0001 - "dil 11" // standard input (motherboard)
31317      // 0x0002 - "dil 12" // standard input (motherboard)
31318      // 0x0004 - "dil 13" // standard input (motherboard)
31319      // 0x0008 - "dil 14" // standard input (motherboard)
31320      // 0x0010 - "dil 15" // standard input (motherboard)
31321      PORT_MODIFY("IN-19")
31322      // 0x0001 - "dil 16" // standard input (motherboard)
31323      PORT_MODIFY("IN-20")
31324      // 0x0001 - "test" // standard input (motherboard)
31325      // 0x0002 - "lock" // standard input (expected here)
31326      // 0x0004 - "topdor" // standard input (expected here)
31327      // 0x0008 - "botdor" // standard input (expected here)
31328      // 0x0010 - "hopdmp" // standard input (expected here)
3132931329INPUT_PORTS_END
3133031330
3133131331//  PR2506 SPACEBUSTER         BUSTERSND            SPACEBUSTER
r31373r31374
3135131351}
3135231352
3135331353INPUT_PORTS_START( sc4stirc ) // this structure is generated
31354        PORT_INCLUDE( sc4_base )
31355        PORT_MODIFY("IN-1")
31356        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31357        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("excnge")
31358        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
31359        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
31360        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
31361        PORT_MODIFY("IN-2")
31362        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("coll")
31363        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31364        PORT_MODIFY("IN-4")
31365        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
31366        PORT_MODIFY("IN-8")
31367        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("higher")
31368        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lower")
31369        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk prz")
31370        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fet")
31371        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
31372        PORT_MODIFY("IN-16")
31373        // 0x0001 - "dil  1" // standard input (motherboard)
31374        // 0x0002 - "dil  2" // standard input (motherboard)
31375        // 0x0004 - "dil  3" // standard input (motherboard)
31376        // 0x0008 - "dil  4" // standard input (motherboard)
31377        // 0x0010 - "dil  5" // standard input (motherboard)
31378        PORT_MODIFY("IN-17")
31379        // 0x0001 - "dil  6" // standard input (motherboard)
31380        // 0x0002 - "dil  7" // standard input (motherboard)
31381        // 0x0004 - "dil  8" // standard input (motherboard)
31382        // 0x0008 - "dil  9" // standard input (motherboard)
31383        // 0x0010 - "dil 10" // standard input (motherboard)
31384        PORT_MODIFY("IN-18")
31385        // 0x0001 - "dil 11" // standard input (motherboard)
31386        // 0x0002 - "dil 12" // standard input (motherboard)
31387        // 0x0004 - "dil 13" // standard input (motherboard)
31388        // 0x0008 - "dil 14" // standard input (motherboard)
31389        // 0x0010 - "dil 15" // standard input (motherboard)
31390        PORT_MODIFY("IN-19")
31391        // 0x0001 - "dil 16" // standard input (motherboard)
31392        PORT_MODIFY("IN-20")
31393        // 0x0001 - "testsw" // standard input (motherboard)
31394        // 0x0002 - "dor lk" // standard input (expected here)
31395        // 0x0004 - "tp dor" // standard input (expected here)
31396        // 0x0008 - "csh bx" // standard input (expected here)
31397        // 0x0010 - "deflt" // standard input (expected here)
31354      PORT_INCLUDE( sc4_base )
31355      PORT_MODIFY("IN-1")
31356      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31357      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("excnge")
31358      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
31359      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
31360      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
31361      PORT_MODIFY("IN-2")
31362      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("coll")
31363      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31364      PORT_MODIFY("IN-4")
31365      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
31366      PORT_MODIFY("IN-8")
31367      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("higher")
31368      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lower")
31369      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk prz")
31370      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fet")
31371      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
31372      PORT_MODIFY("IN-16")
31373      // 0x0001 - "dil  1" // standard input (motherboard)
31374      // 0x0002 - "dil  2" // standard input (motherboard)
31375      // 0x0004 - "dil  3" // standard input (motherboard)
31376      // 0x0008 - "dil  4" // standard input (motherboard)
31377      // 0x0010 - "dil  5" // standard input (motherboard)
31378      PORT_MODIFY("IN-17")
31379      // 0x0001 - "dil  6" // standard input (motherboard)
31380      // 0x0002 - "dil  7" // standard input (motherboard)
31381      // 0x0004 - "dil  8" // standard input (motherboard)
31382      // 0x0008 - "dil  9" // standard input (motherboard)
31383      // 0x0010 - "dil 10" // standard input (motherboard)
31384      PORT_MODIFY("IN-18")
31385      // 0x0001 - "dil 11" // standard input (motherboard)
31386      // 0x0002 - "dil 12" // standard input (motherboard)
31387      // 0x0004 - "dil 13" // standard input (motherboard)
31388      // 0x0008 - "dil 14" // standard input (motherboard)
31389      // 0x0010 - "dil 15" // standard input (motherboard)
31390      PORT_MODIFY("IN-19")
31391      // 0x0001 - "dil 16" // standard input (motherboard)
31392      PORT_MODIFY("IN-20")
31393      // 0x0001 - "testsw" // standard input (motherboard)
31394      // 0x0002 - "dor lk" // standard input (expected here)
31395      // 0x0004 - "tp dor" // standard input (expected here)
31396      // 0x0008 - "csh bx" // standard input (expected here)
31397      // 0x0010 - "deflt" // standard input (expected here)
3139831398INPUT_PORTS_END
3139931399
3140031400// PR2005 STIR CRAZY         STIR SOUNDS           STIR  CRAZY
r31373r31374
3142831428}
3142931429
3143031430INPUT_PORTS_START( sc4sahed ) // this structure is generated
31431        PORT_INCLUDE( sc4_base )
31432        PORT_MODIFY("IN-1")
31433        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31434        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31435        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31436        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31437        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
31438        PORT_MODIFY("IN-2")
31439        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
31440        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31441        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31442        PORT_MODIFY("IN-8")
31443        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("right")
31444        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("up")
31445        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi r")
31446        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi l")
31447        PORT_MODIFY("IN-9")
31448        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("lo r")
31449        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("lo l")
31450        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("streak")
31451        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("nudge")
31452        PORT_MODIFY("IN-16")
31453        // 0x0001 - "dil  1" // standard input (motherboard)
31454        // 0x0002 - "dil  2" // standard input (motherboard)
31455        // 0x0004 - "dil  3" // standard input (motherboard)
31456        // 0x0008 - "dil  4" // standard input (motherboard)
31457        // 0x0010 - "dil  5" // standard input (motherboard)
31458        // 0x0100 - "topup" // known extended input, usually 'top up'
31459        PORT_MODIFY("IN-17")
31460        // 0x0001 - "dil  6" // standard input (motherboard)
31461        // 0x0002 - "dil  7" // standard input (motherboard)
31462        // 0x0004 - "dil  8" // standard input (motherboard)
31463        // 0x0008 - "dil  9" // standard input (motherboard)
31464        // 0x0010 - "dil 10" // standard input (motherboard)
31465        PORT_MODIFY("IN-18")
31466        // 0x0001 - "dil 11" // standard input (motherboard)
31467        // 0x0002 - "dil 12" // standard input (motherboard)
31468        // 0x0004 - "dil 13" // standard input (motherboard)
31469        // 0x0008 - "dil 14" // standard input (motherboard)
31470        // 0x0010 - "dil 15" // standard input (motherboard)
31471        PORT_MODIFY("IN-19")
31472        // 0x0001 - "dil 16" // standard input (motherboard)
31473        PORT_MODIFY("IN-20")
31474        // 0x0001 - "test" // standard input (motherboard)
31475        // 0x0002 - "lock" // standard input (expected here)
31476        // 0x0004 - "topdor" // standard input (expected here)
31477        // 0x0008 - "botdor" // standard input (expected here)
31478        // 0x0010 - "hopdmp" // standard input (expected here)
31431      PORT_INCLUDE( sc4_base )
31432      PORT_MODIFY("IN-1")
31433      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31434      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31435      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31436      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31437      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
31438      PORT_MODIFY("IN-2")
31439      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
31440      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31441      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31442      PORT_MODIFY("IN-8")
31443      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("right")
31444      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("up")
31445      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi r")
31446      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi l")
31447      PORT_MODIFY("IN-9")
31448      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("lo r")
31449      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("lo l")
31450      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("streak")
31451      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("nudge")
31452      PORT_MODIFY("IN-16")
31453      // 0x0001 - "dil  1" // standard input (motherboard)
31454      // 0x0002 - "dil  2" // standard input (motherboard)
31455      // 0x0004 - "dil  3" // standard input (motherboard)
31456      // 0x0008 - "dil  4" // standard input (motherboard)
31457      // 0x0010 - "dil  5" // standard input (motherboard)
31458      // 0x0100 - "topup" // known extended input, usually 'top up'
31459      PORT_MODIFY("IN-17")
31460      // 0x0001 - "dil  6" // standard input (motherboard)
31461      // 0x0002 - "dil  7" // standard input (motherboard)
31462      // 0x0004 - "dil  8" // standard input (motherboard)
31463      // 0x0008 - "dil  9" // standard input (motherboard)
31464      // 0x0010 - "dil 10" // standard input (motherboard)
31465      PORT_MODIFY("IN-18")
31466      // 0x0001 - "dil 11" // standard input (motherboard)
31467      // 0x0002 - "dil 12" // standard input (motherboard)
31468      // 0x0004 - "dil 13" // standard input (motherboard)
31469      // 0x0008 - "dil 14" // standard input (motherboard)
31470      // 0x0010 - "dil 15" // standard input (motherboard)
31471      PORT_MODIFY("IN-19")
31472      // 0x0001 - "dil 16" // standard input (motherboard)
31473      PORT_MODIFY("IN-20")
31474      // 0x0001 - "test" // standard input (motherboard)
31475      // 0x0002 - "lock" // standard input (expected here)
31476      // 0x0004 - "topdor" // standard input (expected here)
31477      // 0x0008 - "botdor" // standard input (expected here)
31478      // 0x0010 - "hopdmp" // standard input (expected here)
3147931479INPUT_PORTS_END
3148031480
3148131481//  PRxxxx STREAKS AHEAD V1.0         STREAKSSND          STREAKS  AHEAD
r31373r31374
3150031500}
3150131501
3150231502INPUT_PORTS_START( sc4strx ) // this structure is generated
31503        PORT_INCLUDE( sc4_base )
31504        PORT_MODIFY("IN-1")
31505        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31506        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
31507        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
31508        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
31509        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
31510        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
31511        PORT_MODIFY("IN-2")
31512        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("shuffl")
31513        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31514        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31515        PORT_MODIFY("IN-3")
31516        // 0x0004 - "stk 4" // standard input (expected here)
31517        // 0x0008 - "stk 3" // standard input (expected here)
31518        // 0x0010 - "stk 2" // standard input (expected here)
31519        PORT_MODIFY("IN-4")
31520        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
31521        PORT_MODIFY("IN-5")
31522        // 0x0001 - "priz4" // standard input (expected here)
31523        // 0x0002 - "priz3" // standard input (expected here)
31524        // 0x0004 - "priz2" // standard input (expected here)
31525        // 0x0008 - "priz1" // standard input (expected here)
31526        PORT_MODIFY("IN-6")
31527        // 0x0001 - "perc1" // standard input (expected here)
31528        // 0x0002 - "perc2" // standard input (expected here)
31529        // 0x0004 - "perc3" // standard input (expected here)
31530        // 0x0008 - "perc4" // standard input (expected here)
31531        PORT_MODIFY("IN-8")
31532        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("auto n")
31533        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk fet")
31534        PORT_MODIFY("IN-16")
31535        // 0x0001 - "dil 1" // standard input (motherboard)
31536        // 0x0002 - "dil 2" // standard input (motherboard)
31537        // 0x0004 - "dil 3" // standard input (motherboard)
31538        // 0x0008 - "dil 4" // standard input (motherboard)
31539        // 0x0010 - "dil 5" // standard input (motherboard)
31540        // 0x0100 - "htopup" // known extended input, usually 'top up'
31541        PORT_MODIFY("IN-17")
31542        // 0x0001 - "dil 6" // standard input (motherboard)
31543        // 0x0002 - "dil 7" // standard input (motherboard)
31544        // 0x0004 - "dil 8" // standard input (motherboard)
31545        // 0x0008 - "dil 9" // standard input (motherboard)
31546        // 0x0010 - "dil 10" // standard input (motherboard)
31547        PORT_MODIFY("IN-18")
31548        // 0x0001 - "dil 11" // standard input (motherboard)
31549        // 0x0002 - "dil 12" // standard input (motherboard)
31550        // 0x0004 - "dil 13" // standard input (motherboard)
31551        // 0x0008 - "dil 14" // standard input (motherboard)
31552        // 0x0010 - "dil 15" // standard input (motherboard)
31553        PORT_MODIFY("IN-19")
31554        // 0x0001 - "dil 16" // standard input (motherboard)
31555        PORT_MODIFY("IN-20")
31556        // 0x0001 - "grnbut" // standard input (motherboard)
31557        // 0x0002 - "dorlok" // standard input (expected here)
31558        // 0x0004 - "serdor" // standard input (expected here)
31559        // 0x0008 - "cshdor" // standard input (expected here)
31560        // 0x0010 - "hopdmp" // standard input (expected here)
31503      PORT_INCLUDE( sc4_base )
31504      PORT_MODIFY("IN-1")
31505      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31506      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
31507      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
31508      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
31509      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
31510      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
31511      PORT_MODIFY("IN-2")
31512      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("shuffl")
31513      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31514      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31515      PORT_MODIFY("IN-3")
31516      // 0x0004 - "stk 4" // standard input (expected here)
31517      // 0x0008 - "stk 3" // standard input (expected here)
31518      // 0x0010 - "stk 2" // standard input (expected here)
31519      PORT_MODIFY("IN-4")
31520      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
31521      PORT_MODIFY("IN-5")
31522      // 0x0001 - "priz4" // standard input (expected here)
31523      // 0x0002 - "priz3" // standard input (expected here)
31524      // 0x0004 - "priz2" // standard input (expected here)
31525      // 0x0008 - "priz1" // standard input (expected here)
31526      PORT_MODIFY("IN-6")
31527      // 0x0001 - "perc1" // standard input (expected here)
31528      // 0x0002 - "perc2" // standard input (expected here)
31529      // 0x0004 - "perc3" // standard input (expected here)
31530      // 0x0008 - "perc4" // standard input (expected here)
31531      PORT_MODIFY("IN-8")
31532      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("auto n")
31533      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk fet")
31534      PORT_MODIFY("IN-16")
31535      // 0x0001 - "dil 1" // standard input (motherboard)
31536      // 0x0002 - "dil 2" // standard input (motherboard)
31537      // 0x0004 - "dil 3" // standard input (motherboard)
31538      // 0x0008 - "dil 4" // standard input (motherboard)
31539      // 0x0010 - "dil 5" // standard input (motherboard)
31540      // 0x0100 - "htopup" // known extended input, usually 'top up'
31541      PORT_MODIFY("IN-17")
31542      // 0x0001 - "dil 6" // standard input (motherboard)
31543      // 0x0002 - "dil 7" // standard input (motherboard)
31544      // 0x0004 - "dil 8" // standard input (motherboard)
31545      // 0x0008 - "dil 9" // standard input (motherboard)
31546      // 0x0010 - "dil 10" // standard input (motherboard)
31547      PORT_MODIFY("IN-18")
31548      // 0x0001 - "dil 11" // standard input (motherboard)
31549      // 0x0002 - "dil 12" // standard input (motherboard)
31550      // 0x0004 - "dil 13" // standard input (motherboard)
31551      // 0x0008 - "dil 14" // standard input (motherboard)
31552      // 0x0010 - "dil 15" // standard input (motherboard)
31553      PORT_MODIFY("IN-19")
31554      // 0x0001 - "dil 16" // standard input (motherboard)
31555      PORT_MODIFY("IN-20")
31556      // 0x0001 - "grnbut" // standard input (motherboard)
31557      // 0x0002 - "dorlok" // standard input (expected here)
31558      // 0x0004 - "serdor" // standard input (expected here)
31559      // 0x0008 - "cshdor" // standard input (expected here)
31560      // 0x0010 - "hopdmp" // standard input (expected here)
3156131561INPUT_PORTS_END
3156231562
3156331563
r31373r31374
3159231592}
3159331593
3159431594INPUT_PORTS_START( sc4suscl ) // this structure is generated
31595        PORT_INCLUDE( sc4_base )
31596        PORT_MODIFY("IN-1")
31597        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
31598        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
31599        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
31600        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
31601        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
31602        PORT_MODIFY("IN-2")
31603        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
31604        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
31605        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
31606        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31607        PORT_MODIFY("IN-3")
31608        // 0x0004 - "stk 4" // standard input (expected here)
31609        // 0x0008 - "stk 3" // standard input (expected here)
31610        // 0x0010 - "stk 2" // standard input (expected here)
31611        PORT_MODIFY("IN-5")
31612        // 0x0001 - "priz4" // standard input (expected here)
31613        // 0x0002 - "priz3" // standard input (expected here)
31614        // 0x0004 - "priz2" // standard input (expected here)
31615        // 0x0008 - "priz1" // standard input (expected here)
31616        PORT_MODIFY("IN-8")
31617        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
31618        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
31619        PORT_MODIFY("IN-16")
31620        // 0x0001 - "dil 1" // standard input (motherboard)
31621        // 0x0002 - "dil 2" // standard input (motherboard)
31622        // 0x0004 - "dil 3" // standard input (motherboard)
31623        // 0x0008 - "dil 4" // standard input (motherboard)
31624        // 0x0010 - "dil 5" // standard input (motherboard)
31625        // 0x0100 - "top up" // known extended input, usually 'top up'
31626        PORT_MODIFY("IN-17")
31627        // 0x0001 - "dil 6" // standard input (motherboard)
31628        // 0x0002 - "dil 7" // standard input (motherboard)
31629        // 0x0004 - "dil 8" // standard input (motherboard)
31630        // 0x0008 - "dil 9" // standard input (motherboard)
31631        // 0x0010 - "dil10" // standard input (motherboard)
31632        PORT_MODIFY("IN-18")
31633        // 0x0001 - "dil11" // standard input (motherboard)
31634        // 0x0002 - "dil12" // standard input (motherboard)
31635        // 0x0004 - "dil13" // standard input (motherboard)
31636        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
31637        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
31638        PORT_MODIFY("IN-19")
31639        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
31640        PORT_MODIFY("IN-20")
31641        // 0x0001 - "grnbut" // standard input (motherboard)
31642        // 0x0002 - "dorlok" // standard input (expected here)
31643        // 0x0004 - "topdor" // standard input (expected here)
31644        // 0x0008 - "botdor" // standard input (expected here)
31645        // 0x0010 - "hopdmp" // standard input (expected here)
31595      PORT_INCLUDE( sc4_base )
31596      PORT_MODIFY("IN-1")
31597      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
31598      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
31599      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
31600      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
31601      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
31602      PORT_MODIFY("IN-2")
31603      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
31604      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
31605      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
31606      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31607      PORT_MODIFY("IN-3")
31608      // 0x0004 - "stk 4" // standard input (expected here)
31609      // 0x0008 - "stk 3" // standard input (expected here)
31610      // 0x0010 - "stk 2" // standard input (expected here)
31611      PORT_MODIFY("IN-5")
31612      // 0x0001 - "priz4" // standard input (expected here)
31613      // 0x0002 - "priz3" // standard input (expected here)
31614      // 0x0004 - "priz2" // standard input (expected here)
31615      // 0x0008 - "priz1" // standard input (expected here)
31616      PORT_MODIFY("IN-8")
31617      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
31618      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
31619      PORT_MODIFY("IN-16")
31620      // 0x0001 - "dil 1" // standard input (motherboard)
31621      // 0x0002 - "dil 2" // standard input (motherboard)
31622      // 0x0004 - "dil 3" // standard input (motherboard)
31623      // 0x0008 - "dil 4" // standard input (motherboard)
31624      // 0x0010 - "dil 5" // standard input (motherboard)
31625      // 0x0100 - "top up" // known extended input, usually 'top up'
31626      PORT_MODIFY("IN-17")
31627      // 0x0001 - "dil 6" // standard input (motherboard)
31628      // 0x0002 - "dil 7" // standard input (motherboard)
31629      // 0x0004 - "dil 8" // standard input (motherboard)
31630      // 0x0008 - "dil 9" // standard input (motherboard)
31631      // 0x0010 - "dil10" // standard input (motherboard)
31632      PORT_MODIFY("IN-18")
31633      // 0x0001 - "dil11" // standard input (motherboard)
31634      // 0x0002 - "dil12" // standard input (motherboard)
31635      // 0x0004 - "dil13" // standard input (motherboard)
31636      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
31637      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
31638      PORT_MODIFY("IN-19")
31639      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
31640      PORT_MODIFY("IN-20")
31641      // 0x0001 - "grnbut" // standard input (motherboard)
31642      // 0x0002 - "dorlok" // standard input (expected here)
31643      // 0x0004 - "topdor" // standard input (expected here)
31644      // 0x0008 - "botdor" // standard input (expected here)
31645      // 0x0010 - "hopdmp" // standard input (expected here)
3164631646INPUT_PORTS_END
3164731647
3164831648// PR2357 CLUB SUITS U SIR         SUITS U SIR CLUB  CLUB SUIT SOUNDS
r31373r31374
3167631676}
3167731677
3167831678INPUT_PORTS_START( sc4taekw ) // this structure is generated
31679        PORT_INCLUDE( sc4_base )
31680        PORT_MODIFY("IN-1")
31681        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31682        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31683        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31684        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31685        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
31686        PORT_MODIFY("IN-2")
31687        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
31688        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31689        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31690        PORT_MODIFY("IN-8")
31691        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("low r")
31692        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("low l")
31693        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("high l")
31694        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("high r")
31695        PORT_MODIFY("IN-16")
31696        // 0x0001 - "dil  1" // standard input (motherboard)
31697        // 0x0002 - "dil  2" // standard input (motherboard)
31698        // 0x0004 - "dil  3" // standard input (motherboard)
31699        // 0x0008 - "dil  4" // standard input (motherboard)
31700        // 0x0010 - "dil  5" // standard input (motherboard)
31701        // 0x0100 - "topup" // known extended input, usually 'top up'
31702        PORT_MODIFY("IN-17")
31703        // 0x0001 - "dil  6" // standard input (motherboard)
31704        // 0x0002 - "dil  7" // standard input (motherboard)
31705        // 0x0004 - "dil  8" // standard input (motherboard)
31706        // 0x0008 - "dil  9" // standard input (motherboard)
31707        // 0x0010 - "dil 10" // standard input (motherboard)
31708        PORT_MODIFY("IN-18")
31709        // 0x0001 - "dil 11" // standard input (motherboard)
31710        // 0x0002 - "dil 12" // standard input (motherboard)
31711        // 0x0004 - "dil 13" // standard input (motherboard)
31712        // 0x0008 - "dil 14" // standard input (motherboard)
31713        // 0x0010 - "dil 15" // standard input (motherboard)
31714        PORT_MODIFY("IN-19")
31715        // 0x0001 - "dil 16" // standard input (motherboard)
31716        PORT_MODIFY("IN-20")
31717        // 0x0001 - "test" // standard input (motherboard)
31718        // 0x0002 - "lock" // standard input (expected here)
31719        // 0x0004 - "topdor" // standard input (expected here)
31720        // 0x0008 - "botdor" // standard input (expected here)
31721        // 0x0010 - "hopdmp" // standard input (expected here)
31679      PORT_INCLUDE( sc4_base )
31680      PORT_MODIFY("IN-1")
31681      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31682      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31683      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31684      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31685      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
31686      PORT_MODIFY("IN-2")
31687      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
31688      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31689      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31690      PORT_MODIFY("IN-8")
31691      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("low r")
31692      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("low l")
31693      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("high l")
31694      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("high r")
31695      PORT_MODIFY("IN-16")
31696      // 0x0001 - "dil  1" // standard input (motherboard)
31697      // 0x0002 - "dil  2" // standard input (motherboard)
31698      // 0x0004 - "dil  3" // standard input (motherboard)
31699      // 0x0008 - "dil  4" // standard input (motherboard)
31700      // 0x0010 - "dil  5" // standard input (motherboard)
31701      // 0x0100 - "topup" // known extended input, usually 'top up'
31702      PORT_MODIFY("IN-17")
31703      // 0x0001 - "dil  6" // standard input (motherboard)
31704      // 0x0002 - "dil  7" // standard input (motherboard)
31705      // 0x0004 - "dil  8" // standard input (motherboard)
31706      // 0x0008 - "dil  9" // standard input (motherboard)
31707      // 0x0010 - "dil 10" // standard input (motherboard)
31708      PORT_MODIFY("IN-18")
31709      // 0x0001 - "dil 11" // standard input (motherboard)
31710      // 0x0002 - "dil 12" // standard input (motherboard)
31711      // 0x0004 - "dil 13" // standard input (motherboard)
31712      // 0x0008 - "dil 14" // standard input (motherboard)
31713      // 0x0010 - "dil 15" // standard input (motherboard)
31714      PORT_MODIFY("IN-19")
31715      // 0x0001 - "dil 16" // standard input (motherboard)
31716      PORT_MODIFY("IN-20")
31717      // 0x0001 - "test" // standard input (motherboard)
31718      // 0x0002 - "lock" // standard input (expected here)
31719      // 0x0004 - "topdor" // standard input (expected here)
31720      // 0x0008 - "botdor" // standard input (expected here)
31721      // 0x0010 - "hopdmp" // standard input (expected here)
3172231722INPUT_PORTS_END
3172331723
3172431724
r31373r31374
3175331753}
3175431754
3175531755INPUT_PORTS_START( sc4taknt ) // this structure is generated
31756        PORT_INCLUDE( sc4_base )
31757        PORT_MODIFY("IN-1")
31758        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31759        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
31760        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
31761        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
31762        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("st/col")
31763        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
31764        PORT_MODIFY("IN-2")
31765        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
31766        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31767        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31768        PORT_MODIFY("IN-3")
31769        // 0x0004 - "stk 4" // standard input (expected here)
31770        // 0x0008 - "stk 3" // standard input (expected here)
31771        // 0x0010 - "stk 2" // standard input (expected here)
31772        PORT_MODIFY("IN-4")
31773        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
31774        PORT_MODIFY("IN-5")
31775        // 0x0001 - "priz4" // standard input (expected here)
31776        // 0x0002 - "priz3" // standard input (expected here)
31777        // 0x0004 - "priz2" // standard input (expected here)
31778        // 0x0008 - "priz1" // standard input (expected here)
31779        PORT_MODIFY("IN-6")
31780        // 0x0001 - "perc1" // standard input (expected here)
31781        // 0x0002 - "perc2" // standard input (expected here)
31782        // 0x0004 - "perc3" // standard input (expected here)
31783        // 0x0008 - "perc4" // standard input (expected here)
31784        PORT_MODIFY("IN-8")
31785        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
31786        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("coll")
31787        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nudges")
31788        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("notes")
31789        PORT_MODIFY("IN-16")
31790        // 0x0001 - "dil 1" // standard input (motherboard)
31791        // 0x0002 - "dil 2" // standard input (motherboard)
31792        // 0x0004 - "dil 3" // standard input (motherboard)
31793        // 0x0008 - "dil 4" // standard input (motherboard)
31794        // 0x0010 - "dil 5" // standard input (motherboard)
31795        // 0x0100 - "htopup" // known extended input, usually 'top up'
31796        PORT_MODIFY("IN-17")
31797        // 0x0001 - "dil 6" // standard input (motherboard)
31798        // 0x0002 - "dil 7" // standard input (motherboard)
31799        // 0x0004 - "dil 8" // standard input (motherboard)
31800        // 0x0008 - "dil 9" // standard input (motherboard)
31801        // 0x0010 - "dil 10" // standard input (motherboard)
31802        PORT_MODIFY("IN-18")
31803        // 0x0001 - "dil 11" // standard input (motherboard)
31804        // 0x0002 - "dil 12" // standard input (motherboard)
31805        // 0x0004 - "dil 13" // standard input (motherboard)
31806        // 0x0008 - "dil 14" // standard input (motherboard)
31807        // 0x0010 - "dil 15" // standard input (motherboard)
31808        PORT_MODIFY("IN-19")
31809        // 0x0001 - "dil 16" // standard input (motherboard)
31810        PORT_MODIFY("IN-20")
31811        // 0x0001 - "grnbut" // standard input (motherboard)
31812        // 0x0002 - "dorlok" // standard input (expected here)
31813        // 0x0004 - "serdor" // standard input (expected here)
31814        // 0x0008 - "cshdor" // standard input (expected here)
31815        // 0x0010 - "hopdmp" // standard input (expected here)
31756      PORT_INCLUDE( sc4_base )
31757      PORT_MODIFY("IN-1")
31758      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31759      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
31760      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
31761      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
31762      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("st/col")
31763      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
31764      PORT_MODIFY("IN-2")
31765      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
31766      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31767      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31768      PORT_MODIFY("IN-3")
31769      // 0x0004 - "stk 4" // standard input (expected here)
31770      // 0x0008 - "stk 3" // standard input (expected here)
31771      // 0x0010 - "stk 2" // standard input (expected here)
31772      PORT_MODIFY("IN-4")
31773      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
31774      PORT_MODIFY("IN-5")
31775      // 0x0001 - "priz4" // standard input (expected here)
31776      // 0x0002 - "priz3" // standard input (expected here)
31777      // 0x0004 - "priz2" // standard input (expected here)
31778      // 0x0008 - "priz1" // standard input (expected here)
31779      PORT_MODIFY("IN-6")
31780      // 0x0001 - "perc1" // standard input (expected here)
31781      // 0x0002 - "perc2" // standard input (expected here)
31782      // 0x0004 - "perc3" // standard input (expected here)
31783      // 0x0008 - "perc4" // standard input (expected here)
31784      PORT_MODIFY("IN-8")
31785      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
31786      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("coll")
31787      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nudges")
31788      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("notes")
31789      PORT_MODIFY("IN-16")
31790      // 0x0001 - "dil 1" // standard input (motherboard)
31791      // 0x0002 - "dil 2" // standard input (motherboard)
31792      // 0x0004 - "dil 3" // standard input (motherboard)
31793      // 0x0008 - "dil 4" // standard input (motherboard)
31794      // 0x0010 - "dil 5" // standard input (motherboard)
31795      // 0x0100 - "htopup" // known extended input, usually 'top up'
31796      PORT_MODIFY("IN-17")
31797      // 0x0001 - "dil 6" // standard input (motherboard)
31798      // 0x0002 - "dil 7" // standard input (motherboard)
31799      // 0x0004 - "dil 8" // standard input (motherboard)
31800      // 0x0008 - "dil 9" // standard input (motherboard)
31801      // 0x0010 - "dil 10" // standard input (motherboard)
31802      PORT_MODIFY("IN-18")
31803      // 0x0001 - "dil 11" // standard input (motherboard)
31804      // 0x0002 - "dil 12" // standard input (motherboard)
31805      // 0x0004 - "dil 13" // standard input (motherboard)
31806      // 0x0008 - "dil 14" // standard input (motherboard)
31807      // 0x0010 - "dil 15" // standard input (motherboard)
31808      PORT_MODIFY("IN-19")
31809      // 0x0001 - "dil 16" // standard input (motherboard)
31810      PORT_MODIFY("IN-20")
31811      // 0x0001 - "grnbut" // standard input (motherboard)
31812      // 0x0002 - "dorlok" // standard input (expected here)
31813      // 0x0004 - "serdor" // standard input (expected here)
31814      // 0x0008 - "cshdor" // standard input (expected here)
31815      // 0x0010 - "hopdmp" // standard input (expected here)
3181631816INPUT_PORTS_END
3181731817
3181831818// PR1302 AWP TAKE NOTE         PR1302 TAKE NOTE SOUNDS11
r31373r31374
3184231842}
3184331843
3184431844INPUT_PORTS_START( sc4takcl ) // this structure is generated
31845        PORT_INCLUDE( sc4_base )
31846        PORT_MODIFY("IN-1")
31847        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancol")
31848        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31849        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31850        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31851        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
31852        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
31853        PORT_MODIFY("IN-2")
31854        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
31855        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
31856        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31857        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31858        PORT_MODIFY("IN-3")
31859        // 0x0004 - "stk 4" // standard input (expected here)
31860        // 0x0008 - "stk 3" // standard input (expected here)
31861        // 0x0010 - "stk 2" // standard input (expected here)
31862        PORT_MODIFY("IN-4")
31863        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
31864        PORT_MODIFY("IN-5")
31865        // 0x0001 - "priz4" // standard input (expected here)
31866        // 0x0002 - "priz3" // standard input (expected here)
31867        // 0x0004 - "priz2" // standard input (expected here)
31868        // 0x0008 - "priz1" // standard input (expected here)
31869        PORT_MODIFY("IN-8")
31870        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c nuds")
31871        PORT_MODIFY("IN-16")
31872        // 0x0001 - "dil 1" // standard input (motherboard)
31873        // 0x0002 - "dil 2" // standard input (motherboard)
31874        // 0x0004 - "dil 3" // standard input (motherboard)
31875        // 0x0008 - "dil 4" // standard input (motherboard)
31876        // 0x0010 - "dil 5" // standard input (motherboard)
31877        // 0x0100 - "top up" // known extended input, usually 'top up'
31878        PORT_MODIFY("IN-17")
31879        // 0x0001 - "dil 6" // standard input (motherboard)
31880        // 0x0002 - "dil 7" // standard input (motherboard)
31881        // 0x0004 - "dil 8" // standard input (motherboard)
31882        // 0x0008 - "dil 9" // standard input (motherboard)
31883        // 0x0010 - "dil10" // standard input (motherboard)
31884        PORT_MODIFY("IN-18")
31885        // 0x0001 - "dil11" // standard input (motherboard)
31886        // 0x0002 - "dil12" // standard input (motherboard)
31887        // 0x0004 - "dil13" // standard input (motherboard)
31888        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
31889        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
31890        PORT_MODIFY("IN-19")
31891        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
31892        PORT_MODIFY("IN-20")
31893        // 0x0001 - "grnbut" // standard input (motherboard)
31894        // 0x0002 - "dorlok" // standard input (expected here)
31895        // 0x0004 - "topdor" // standard input (expected here)
31896        // 0x0008 - "botdor" // standard input (expected here)
31897        // 0x0010 - "hopdmp" // standard input (expected here)
31845      PORT_INCLUDE( sc4_base )
31846      PORT_MODIFY("IN-1")
31847      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancol")
31848      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
31849      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
31850      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
31851      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
31852      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
31853      PORT_MODIFY("IN-2")
31854      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
31855      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
31856      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31857      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
31858      PORT_MODIFY("IN-3")
31859      // 0x0004 - "stk 4" // standard input (expected here)
31860      // 0x0008 - "stk 3" // standard input (expected here)
31861      // 0x0010 - "stk 2" // standard input (expected here)
31862      PORT_MODIFY("IN-4")
31863      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
31864      PORT_MODIFY("IN-5")
31865      // 0x0001 - "priz4" // standard input (expected here)
31866      // 0x0002 - "priz3" // standard input (expected here)
31867      // 0x0004 - "priz2" // standard input (expected here)
31868      // 0x0008 - "priz1" // standard input (expected here)
31869      PORT_MODIFY("IN-8")
31870      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c nuds")
31871      PORT_MODIFY("IN-16")
31872      // 0x0001 - "dil 1" // standard input (motherboard)
31873      // 0x0002 - "dil 2" // standard input (motherboard)
31874      // 0x0004 - "dil 3" // standard input (motherboard)
31875      // 0x0008 - "dil 4" // standard input (motherboard)
31876      // 0x0010 - "dil 5" // standard input (motherboard)
31877      // 0x0100 - "top up" // known extended input, usually 'top up'
31878      PORT_MODIFY("IN-17")
31879      // 0x0001 - "dil 6" // standard input (motherboard)
31880      // 0x0002 - "dil 7" // standard input (motherboard)
31881      // 0x0004 - "dil 8" // standard input (motherboard)
31882      // 0x0008 - "dil 9" // standard input (motherboard)
31883      // 0x0010 - "dil10" // standard input (motherboard)
31884      PORT_MODIFY("IN-18")
31885      // 0x0001 - "dil11" // standard input (motherboard)
31886      // 0x0002 - "dil12" // standard input (motherboard)
31887      // 0x0004 - "dil13" // standard input (motherboard)
31888      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
31889      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
31890      PORT_MODIFY("IN-19")
31891      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
31892      PORT_MODIFY("IN-20")
31893      // 0x0001 - "grnbut" // standard input (motherboard)
31894      // 0x0002 - "dorlok" // standard input (expected here)
31895      // 0x0004 - "topdor" // standard input (expected here)
31896      // 0x0008 - "botdor" // standard input (expected here)
31897      // 0x0010 - "hopdmp" // standard input (expected here)
3189831898INPUT_PORTS_END
3189931899
3190031900// PR1323 CLUB TAKE NOTE         PR1323 CNOT SOUNDS11
r31373r31374
3193031930}
3193131931
3193231932INPUT_PORTS_START( sc4tetri ) // this structure is generated
31933        PORT_INCLUDE( sc4_base )
31934        PORT_MODIFY("IN-1")
31935        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31936        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
31937        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
31938        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
31939        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
31940        PORT_MODIFY("IN-2")
31941        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
31942        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31943        PORT_MODIFY("IN-8")
31944        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk spn")
31945        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk ndg")
31946        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk csh")
31947        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fet")
31948        PORT_MODIFY("IN-16")
31949        // 0x0001 - "dil  1" // standard input (motherboard)
31950        // 0x0002 - "dil  2" // standard input (motherboard)
31951        // 0x0004 - "dil  3" // standard input (motherboard)
31952        // 0x0008 - "dil  4" // standard input (motherboard)
31953        // 0x0010 - "dil  5" // standard input (motherboard)
31954        PORT_MODIFY("IN-17")
31955        // 0x0001 - "dil  6" // standard input (motherboard)
31956        // 0x0002 - "dil  7" // standard input (motherboard)
31957        // 0x0004 - "dil  8" // standard input (motherboard)
31958        // 0x0008 - "dil  9" // standard input (motherboard)
31959        // 0x0010 - "dil 10" // standard input (motherboard)
31960        PORT_MODIFY("IN-18")
31961        // 0x0001 - "dil 11" // standard input (motherboard)
31962        // 0x0002 - "dil 12" // standard input (motherboard)
31963        // 0x0004 - "dil 13" // standard input (motherboard)
31964        // 0x0008 - "dil 14" // standard input (motherboard)
31965        // 0x0010 - "dil 15" // standard input (motherboard)
31966        PORT_MODIFY("IN-19")
31967        // 0x0001 - "dil 16" // standard input (motherboard)
31968        PORT_MODIFY("IN-20")
31969        // 0x0001 - "testsw" // standard input (motherboard)
31933      PORT_INCLUDE( sc4_base )
31934      PORT_MODIFY("IN-1")
31935      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
31936      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
31937      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
31938      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
31939      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
31940      PORT_MODIFY("IN-2")
31941      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
31942      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
31943      PORT_MODIFY("IN-8")
31944      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk spn")
31945      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk ndg")
31946      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk csh")
31947      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fet")
31948      PORT_MODIFY("IN-16")
31949      // 0x0001 - "dil  1" // standard input (motherboard)
31950      // 0x0002 - "dil  2" // standard input (motherboard)
31951      // 0x0004 - "dil  3" // standard input (motherboard)
31952      // 0x0008 - "dil  4" // standard input (motherboard)
31953      // 0x0010 - "dil  5" // standard input (motherboard)
31954      PORT_MODIFY("IN-17")
31955      // 0x0001 - "dil  6" // standard input (motherboard)
31956      // 0x0002 - "dil  7" // standard input (motherboard)
31957      // 0x0004 - "dil  8" // standard input (motherboard)
31958      // 0x0008 - "dil  9" // standard input (motherboard)
31959      // 0x0010 - "dil 10" // standard input (motherboard)
31960      PORT_MODIFY("IN-18")
31961      // 0x0001 - "dil 11" // standard input (motherboard)
31962      // 0x0002 - "dil 12" // standard input (motherboard)
31963      // 0x0004 - "dil 13" // standard input (motherboard)
31964      // 0x0008 - "dil 14" // standard input (motherboard)
31965      // 0x0010 - "dil 15" // standard input (motherboard)
31966      PORT_MODIFY("IN-19")
31967      // 0x0001 - "dil 16" // standard input (motherboard)
31968      PORT_MODIFY("IN-20")
31969      // 0x0001 - "testsw" // standard input (motherboard)
3197031970INPUT_PORTS_END
3197131971
3197231972
r31373r31374
3200232002}
3200332003
3200432004INPUT_PORTS_START( sc4tbana ) // this structure is generated
32005        PORT_INCLUDE( sc4_base )
32006        PORT_MODIFY("IN-1")
32007        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32008        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colect")
32009        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1 OR high")
32010        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2 OR low")
32011        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
32012        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
32013        PORT_MODIFY("IN-2")
32014        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
32015        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32016        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32017        PORT_MODIFY("IN-3")
32018        // 0x0004 - "stk 4" // standard input (expected here)
32019        // 0x0008 - "stk 3" // standard input (expected here)
32020        // 0x0010 - "stk 2" // standard input (expected here)
32021        PORT_MODIFY("IN-5")
32022        // 0x0001 - "priz4" // standard input (expected here)
32023        // 0x0002 - "priz3" // standard input (expected here)
32024        // 0x0004 - "priz2" // standard input (expected here)
32025        // 0x0008 - "priz1" // standard input (expected here)
32026        PORT_MODIFY("IN-6")
32027        // 0x0001 - "perc1" // standard input (expected here)
32028        // 0x0002 - "perc2" // standard input (expected here)
32029        // 0x0004 - "perc3" // standard input (expected here)
32030        // 0x0008 - "perc4" // standard input (expected here)
32031        PORT_MODIFY("IN-8")
32032        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht")
32033        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk nud")
32034        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk ss")
32035        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk fea")
32036        PORT_MODIFY("IN-16")
32037        // 0x0001 - "dil 1" // standard input (motherboard)
32038        // 0x0002 - "dil 2" // standard input (motherboard)
32039        // 0x0004 - "dil 3" // standard input (motherboard)
32040        // 0x0008 - "dil 4" // standard input (motherboard)
32041        // 0x0010 - "dil 5" // standard input (motherboard)
32042        // 0x0100 - "top up" // known extended input, usually 'top up'
32043        PORT_MODIFY("IN-17")
32044        // 0x0001 - "dil 6" // standard input (motherboard)
32045        // 0x0002 - "dil 7" // standard input (motherboard)
32046        // 0x0004 - "dil 8" // standard input (motherboard)
32047        // 0x0008 - "dil 9" // standard input (motherboard)
32048        // 0x0010 - "dil10" // standard input (motherboard)
32049        PORT_MODIFY("IN-18")
32050        // 0x0001 - "dil11" // standard input (motherboard)
32051        // 0x0002 - "dil12" // standard input (motherboard)
32052        // 0x0004 - "dil13" // standard input (motherboard)
32053        // 0x0008 - "dil14" // standard input (motherboard)
32054        // 0x0010 - "dil15" // standard input (motherboard)
32055        PORT_MODIFY("IN-19")
32056        // 0x0001 - "dil16" // standard input (motherboard)
32057        PORT_MODIFY("IN-20")
32058        // 0x0001 - "grnbut" // standard input (motherboard)
32059        // 0x0002 - "dorlok" // standard input (expected here)
32060        // 0x0004 - "topdor" // standard input (expected here)
32061        // 0x0008 - "botdor" // standard input (expected here)
32062        // 0x0010 - "hopdmp" // standard input (expected here)
32005      PORT_INCLUDE( sc4_base )
32006      PORT_MODIFY("IN-1")
32007      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32008      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colect")
32009      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1 OR high")
32010      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2 OR low")
32011      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
32012      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
32013      PORT_MODIFY("IN-2")
32014      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
32015      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32016      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32017      PORT_MODIFY("IN-3")
32018      // 0x0004 - "stk 4" // standard input (expected here)
32019      // 0x0008 - "stk 3" // standard input (expected here)
32020      // 0x0010 - "stk 2" // standard input (expected here)
32021      PORT_MODIFY("IN-5")
32022      // 0x0001 - "priz4" // standard input (expected here)
32023      // 0x0002 - "priz3" // standard input (expected here)
32024      // 0x0004 - "priz2" // standard input (expected here)
32025      // 0x0008 - "priz1" // standard input (expected here)
32026      PORT_MODIFY("IN-6")
32027      // 0x0001 - "perc1" // standard input (expected here)
32028      // 0x0002 - "perc2" // standard input (expected here)
32029      // 0x0004 - "perc3" // standard input (expected here)
32030      // 0x0008 - "perc4" // standard input (expected here)
32031      PORT_MODIFY("IN-8")
32032      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht")
32033      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk nud")
32034      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk ss")
32035      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk fea")
32036      PORT_MODIFY("IN-16")
32037      // 0x0001 - "dil 1" // standard input (motherboard)
32038      // 0x0002 - "dil 2" // standard input (motherboard)
32039      // 0x0004 - "dil 3" // standard input (motherboard)
32040      // 0x0008 - "dil 4" // standard input (motherboard)
32041      // 0x0010 - "dil 5" // standard input (motherboard)
32042      // 0x0100 - "top up" // known extended input, usually 'top up'
32043      PORT_MODIFY("IN-17")
32044      // 0x0001 - "dil 6" // standard input (motherboard)
32045      // 0x0002 - "dil 7" // standard input (motherboard)
32046      // 0x0004 - "dil 8" // standard input (motherboard)
32047      // 0x0008 - "dil 9" // standard input (motherboard)
32048      // 0x0010 - "dil10" // standard input (motherboard)
32049      PORT_MODIFY("IN-18")
32050      // 0x0001 - "dil11" // standard input (motherboard)
32051      // 0x0002 - "dil12" // standard input (motherboard)
32052      // 0x0004 - "dil13" // standard input (motherboard)
32053      // 0x0008 - "dil14" // standard input (motherboard)
32054      // 0x0010 - "dil15" // standard input (motherboard)
32055      PORT_MODIFY("IN-19")
32056      // 0x0001 - "dil16" // standard input (motherboard)
32057      PORT_MODIFY("IN-20")
32058      // 0x0001 - "grnbut" // standard input (motherboard)
32059      // 0x0002 - "dorlok" // standard input (expected here)
32060      // 0x0004 - "topdor" // standard input (expected here)
32061      // 0x0008 - "botdor" // standard input (expected here)
32062      // 0x0010 - "hopdmp" // standard input (expected here)
3206332063INPUT_PORTS_END
3206432064
3206532065// PR1110 TOP BANANA         PR1110 TOP BANANA SOUNDS11
r31373r31374
3208332083}
3208432084
3208532085INPUT_PORTS_START( sc4tgear ) // this structure is generated
32086        PORT_INCLUDE( sc4_base )
32087        PORT_MODIFY("IN-1")
32088        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32089        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
32090        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
32091        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
32092        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
32093        PORT_MODIFY("IN-2")
32094        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("runmon")
32095        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchge")
32096        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32097        PORT_MODIFY("IN-8")
32098        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fet")
32099        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
32100        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("higher")
32101        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lower")
32102        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk prz")
32103        PORT_MODIFY("IN-16")
32104        // 0x0001 - "dil  1" // standard input (motherboard)
32105        // 0x0002 - "dil  2" // standard input (motherboard)
32106        // 0x0004 - "dil  3" // standard input (motherboard)
32107        // 0x0008 - "dil  4" // standard input (motherboard)
32108        // 0x0010 - "dil  5" // standard input (motherboard)
32109        PORT_MODIFY("IN-17")
32110        // 0x0001 - "dil  6" // standard input (motherboard)
32111        // 0x0002 - "dil  7" // standard input (motherboard)
32112        // 0x0004 - "dil  8" // standard input (motherboard)
32113        // 0x0008 - "dil  9" // standard input (motherboard)
32114        // 0x0010 - "dil 10" // standard input (motherboard)
32115        PORT_MODIFY("IN-18")
32116        // 0x0001 - "dil 11" // standard input (motherboard)
32117        // 0x0002 - "dil 12" // standard input (motherboard)
32118        // 0x0004 - "dil 13" // standard input (motherboard)
32119        // 0x0008 - "dil 14" // standard input (motherboard)
32120        // 0x0010 - "dil 15" // standard input (motherboard)
32121        PORT_MODIFY("IN-19")
32122        // 0x0001 - "dil 16" // standard input (motherboard)
32123        PORT_MODIFY("IN-20")
32124        // 0x0001 - "testsw" // standard input (motherboard)
32086      PORT_INCLUDE( sc4_base )
32087      PORT_MODIFY("IN-1")
32088      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32089      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
32090      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
32091      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
32092      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
32093      PORT_MODIFY("IN-2")
32094      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("runmon")
32095      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchge")
32096      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32097      PORT_MODIFY("IN-8")
32098      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fet")
32099      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
32100      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("higher")
32101      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lower")
32102      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk prz")
32103      PORT_MODIFY("IN-16")
32104      // 0x0001 - "dil  1" // standard input (motherboard)
32105      // 0x0002 - "dil  2" // standard input (motherboard)
32106      // 0x0004 - "dil  3" // standard input (motherboard)
32107      // 0x0008 - "dil  4" // standard input (motherboard)
32108      // 0x0010 - "dil  5" // standard input (motherboard)
32109      PORT_MODIFY("IN-17")
32110      // 0x0001 - "dil  6" // standard input (motherboard)
32111      // 0x0002 - "dil  7" // standard input (motherboard)
32112      // 0x0004 - "dil  8" // standard input (motherboard)
32113      // 0x0008 - "dil  9" // standard input (motherboard)
32114      // 0x0010 - "dil 10" // standard input (motherboard)
32115      PORT_MODIFY("IN-18")
32116      // 0x0001 - "dil 11" // standard input (motherboard)
32117      // 0x0002 - "dil 12" // standard input (motherboard)
32118      // 0x0004 - "dil 13" // standard input (motherboard)
32119      // 0x0008 - "dil 14" // standard input (motherboard)
32120      // 0x0010 - "dil 15" // standard input (motherboard)
32121      PORT_MODIFY("IN-19")
32122      // 0x0001 - "dil 16" // standard input (motherboard)
32123      PORT_MODIFY("IN-20")
32124      // 0x0001 - "testsw" // standard input (motherboard)
3212532125INPUT_PORTS_END
3212632126
3212732127// REEL 4 ERR 24
r31373r31374
3215332153}
3215432154
3215532155INPUT_PORTS_START( sc4tload ) // this structure is generated
32156        PORT_INCLUDE( sc4_base )
32157        PORT_MODIFY("IN-1")
32158        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32159        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
32160        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
32161        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
32162        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
32163        PORT_MODIFY("IN-2")
32164        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
32165        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32166        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32167        PORT_MODIFY("IN-8")
32168        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("take f")
32169        PORT_MODIFY("IN-16")
32170        // 0x0001 - "dil 1" // standard input (motherboard)
32171        // 0x0002 - "dil 2" // standard input (motherboard)
32172        // 0x0004 - "dil 3" // standard input (motherboard)
32173        // 0x0008 - "dil 4" // standard input (motherboard)
32174        // 0x0010 - "dil 5" // standard input (motherboard)
32175        // 0x0100 - "top up" // known extended input, usually 'top up'
32176        PORT_MODIFY("IN-17")
32177        // 0x0001 - "dil 6" // standard input (motherboard)
32178        // 0x0002 - "dil 7" // standard input (motherboard)
32179        // 0x0004 - "dil 8" // standard input (motherboard)
32180        // 0x0008 - "dil 9" // standard input (motherboard)
32181        // 0x0010 - "dil10" // standard input (motherboard)
32182        PORT_MODIFY("IN-18")
32183        // 0x0001 - "dil11" // standard input (motherboard)
32184        // 0x0002 - "dil12" // standard input (motherboard)
32185        // 0x0004 - "dil13" // standard input (motherboard)
32186        // 0x0008 - "dil14" // standard input (motherboard)
32187        // 0x0010 - "dil15" // standard input (motherboard)
32188        PORT_MODIFY("IN-19")
32189        // 0x0001 - "dil16" // standard input (motherboard)
32190        PORT_MODIFY("IN-20")
32191        // 0x0001 - "testsw" // standard input (motherboard)
32192        // 0x0002 - "dor lk" // standard input (expected here)
32193        // 0x0004 - "tp dor" // standard input (expected here)
32194        // 0x0008 - "csh bx" // standard input (expected here)
32195        // 0x0010 - "deflt" // standard input (expected here)
32156      PORT_INCLUDE( sc4_base )
32157      PORT_MODIFY("IN-1")
32158      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32159      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
32160      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
32161      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
32162      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
32163      PORT_MODIFY("IN-2")
32164      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
32165      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32166      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32167      PORT_MODIFY("IN-8")
32168      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("take f")
32169      PORT_MODIFY("IN-16")
32170      // 0x0001 - "dil 1" // standard input (motherboard)
32171      // 0x0002 - "dil 2" // standard input (motherboard)
32172      // 0x0004 - "dil 3" // standard input (motherboard)
32173      // 0x0008 - "dil 4" // standard input (motherboard)
32174      // 0x0010 - "dil 5" // standard input (motherboard)
32175      // 0x0100 - "top up" // known extended input, usually 'top up'
32176      PORT_MODIFY("IN-17")
32177      // 0x0001 - "dil 6" // standard input (motherboard)
32178      // 0x0002 - "dil 7" // standard input (motherboard)
32179      // 0x0004 - "dil 8" // standard input (motherboard)
32180      // 0x0008 - "dil 9" // standard input (motherboard)
32181      // 0x0010 - "dil10" // standard input (motherboard)
32182      PORT_MODIFY("IN-18")
32183      // 0x0001 - "dil11" // standard input (motherboard)
32184      // 0x0002 - "dil12" // standard input (motherboard)
32185      // 0x0004 - "dil13" // standard input (motherboard)
32186      // 0x0008 - "dil14" // standard input (motherboard)
32187      // 0x0010 - "dil15" // standard input (motherboard)
32188      PORT_MODIFY("IN-19")
32189      // 0x0001 - "dil16" // standard input (motherboard)
32190      PORT_MODIFY("IN-20")
32191      // 0x0001 - "testsw" // standard input (motherboard)
32192      // 0x0002 - "dor lk" // standard input (expected here)
32193      // 0x0004 - "tp dor" // standard input (expected here)
32194      // 0x0008 - "csh bx" // standard input (expected here)
32195      // 0x0010 - "deflt" // standard input (expected here)
3219632196INPUT_PORTS_END
3219732197
3219832198// PR2112 TOP LOADER         LOAD SOUNDS         TOP LOADER
r31373r31374
3221732217}
3221832218
3221932219INPUT_PORTS_START( sc4ttomb ) // this structure is generated
32220        PORT_INCLUDE( sc4_base )
32221        PORT_MODIFY("IN-1")
32222        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32223        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32224        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
32225        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
32226        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
32227        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
32228        PORT_MODIFY("IN-2")
32229        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
32230        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32231        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32232        PORT_MODIFY("IN-3")
32233        // 0x0004 - "stk 4" // standard input (expected here)
32234        // 0x0008 - "stk 3" // standard input (expected here)
32235        // 0x0010 - "stk 2" // standard input (expected here)
32236        PORT_MODIFY("IN-5")
32237        // 0x0001 - "priz4" // standard input (expected here)
32238        // 0x0002 - "priz3" // standard input (expected here)
32239        // 0x0004 - "priz2" // standard input (expected here)
32240        // 0x0008 - "priz1" // standard input (expected here)
32241        PORT_MODIFY("IN-6")
32242        // 0x0001 - "perc1" // standard input (expected here)
32243        // 0x0002 - "perc2" // standard input (expected here)
32244        // 0x0004 - "perc3" // standard input (expected here)
32245        // 0x0008 - "perc4" // standard input (expected here)
32246        PORT_MODIFY("IN-8")
32247        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk sht")
32248        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("blu lo")
32249        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("red lo")
32250        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("gre lo")
32251        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk stp")
32252        PORT_MODIFY("IN-9")
32253        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("blu hi")
32254        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("red hi")
32255        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("gre hi")
32256        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("col rd")
32257        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("tk nud")
32258        PORT_MODIFY("IN-10")
32259        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_1 ) PORT_NAME("col bl")
32260        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_2 ) PORT_NAME("col gr")
32261        PORT_MODIFY("IN-16")
32262        // 0x0001 - "dil  1" // standard input (motherboard)
32263        // 0x0002 - "dil  2" // standard input (motherboard)
32264        // 0x0004 - "dil  3" // standard input (motherboard)
32265        // 0x0008 - "dil  4" // standard input (motherboard)
32266        // 0x0010 - "dil  5" // standard input (motherboard)
32267        // 0x0100 - "top up" // known extended input, usually 'top up'
32268        PORT_MODIFY("IN-17")
32269        // 0x0001 - "dil  6" // standard input (motherboard)
32270        // 0x0002 - "dil  7" // standard input (motherboard)
32271        // 0x0004 - "dil  8" // standard input (motherboard)
32272        // 0x0008 - "dil  9" // standard input (motherboard)
32273        // 0x0010 - "dil 10" // standard input (motherboard)
32274        PORT_MODIFY("IN-18")
32275        // 0x0001 - "dil 11" // standard input (motherboard)
32276        // 0x0002 - "dil 12" // standard input (motherboard)
32277        // 0x0004 - "dil 13" // standard input (motherboard)
32278        // 0x0008 - "dil 14" // standard input (motherboard)
32279        // 0x0010 - "dil 15" // standard input (motherboard)
32280        PORT_MODIFY("IN-19")
32281        // 0x0001 - "dil 16" // standard input (motherboard)
32282        PORT_MODIFY("IN-20")
32283        // 0x0001 - "grnbut" // standard input (motherboard)
32284        // 0x0002 - "dorlok" // standard input (expected here)
32285        // 0x0004 - "topdor" // standard input (expected here)
32286        // 0x0008 - "botdor" // standard input (expected here)
32287        // 0x0010 - "hopdmp OR hopdmp" // standard input (expected here)
32220      PORT_INCLUDE( sc4_base )
32221      PORT_MODIFY("IN-1")
32222      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32223      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32224      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
32225      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
32226      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
32227      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
32228      PORT_MODIFY("IN-2")
32229      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
32230      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32231      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32232      PORT_MODIFY("IN-3")
32233      // 0x0004 - "stk 4" // standard input (expected here)
32234      // 0x0008 - "stk 3" // standard input (expected here)
32235      // 0x0010 - "stk 2" // standard input (expected here)
32236      PORT_MODIFY("IN-5")
32237      // 0x0001 - "priz4" // standard input (expected here)
32238      // 0x0002 - "priz3" // standard input (expected here)
32239      // 0x0004 - "priz2" // standard input (expected here)
32240      // 0x0008 - "priz1" // standard input (expected here)
32241      PORT_MODIFY("IN-6")
32242      // 0x0001 - "perc1" // standard input (expected here)
32243      // 0x0002 - "perc2" // standard input (expected here)
32244      // 0x0004 - "perc3" // standard input (expected here)
32245      // 0x0008 - "perc4" // standard input (expected here)
32246      PORT_MODIFY("IN-8")
32247      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk sht")
32248      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("blu lo")
32249      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("red lo")
32250      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("gre lo")
32251      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk stp")
32252      PORT_MODIFY("IN-9")
32253      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("blu hi")
32254      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("red hi")
32255      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("gre hi")
32256      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("col rd")
32257      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("tk nud")
32258      PORT_MODIFY("IN-10")
32259      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_1 ) PORT_NAME("col bl")
32260      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_2 ) PORT_NAME("col gr")
32261      PORT_MODIFY("IN-16")
32262      // 0x0001 - "dil  1" // standard input (motherboard)
32263      // 0x0002 - "dil  2" // standard input (motherboard)
32264      // 0x0004 - "dil  3" // standard input (motherboard)
32265      // 0x0008 - "dil  4" // standard input (motherboard)
32266      // 0x0010 - "dil  5" // standard input (motherboard)
32267      // 0x0100 - "top up" // known extended input, usually 'top up'
32268      PORT_MODIFY("IN-17")
32269      // 0x0001 - "dil  6" // standard input (motherboard)
32270      // 0x0002 - "dil  7" // standard input (motherboard)
32271      // 0x0004 - "dil  8" // standard input (motherboard)
32272      // 0x0008 - "dil  9" // standard input (motherboard)
32273      // 0x0010 - "dil 10" // standard input (motherboard)
32274      PORT_MODIFY("IN-18")
32275      // 0x0001 - "dil 11" // standard input (motherboard)
32276      // 0x0002 - "dil 12" // standard input (motherboard)
32277      // 0x0004 - "dil 13" // standard input (motherboard)
32278      // 0x0008 - "dil 14" // standard input (motherboard)
32279      // 0x0010 - "dil 15" // standard input (motherboard)
32280      PORT_MODIFY("IN-19")
32281      // 0x0001 - "dil 16" // standard input (motherboard)
32282      PORT_MODIFY("IN-20")
32283      // 0x0001 - "grnbut" // standard input (motherboard)
32284      // 0x0002 - "dorlok" // standard input (expected here)
32285      // 0x0004 - "topdor" // standard input (expected here)
32286      // 0x0008 - "botdor" // standard input (expected here)
32287      // 0x0010 - "hopdmp OR hopdmp" // standard input (expected here)
3228832288INPUT_PORTS_END
3228932289
3229032290// PR1305 TREASURE TOMB         PR1305 TRES TOMB SOUNDS11         /    HIT SHOT
r31373r31374
3231132311}
3231232312
3231332313INPUT_PORTS_START( sc4tridn ) // this structure is generated
32314        PORT_INCLUDE( sc4_base )
32315        PORT_MODIFY("IN-1")
32316        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32317        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
32318        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
32319        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
32320        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
32321        PORT_MODIFY("IN-2")
32322        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
32323        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32324        PORT_MODIFY("IN-16")
32325        // 0x0001 - "dil  1" // standard input (motherboard)
32326        // 0x0002 - "dil  2" // standard input (motherboard)
32327        // 0x0004 - "dil  3" // standard input (motherboard)
32328        // 0x0008 - "dil  4" // standard input (motherboard)
32329        // 0x0010 - "dil  5" // standard input (motherboard)
32330        // 0x0100 - "top up" // known extended input, usually 'top up'
32331        PORT_MODIFY("IN-17")
32332        // 0x0001 - "dil  6" // standard input (motherboard)
32333        // 0x0002 - "dil  7" // standard input (motherboard)
32334        // 0x0004 - "dil  8" // standard input (motherboard)
32335        // 0x0008 - "dil  9" // standard input (motherboard)
32336        // 0x0010 - "dil 10" // standard input (motherboard)
32337        PORT_MODIFY("IN-18")
32338        // 0x0001 - "dil 11" // standard input (motherboard)
32339        // 0x0002 - "dil 12" // standard input (motherboard)
32340        // 0x0004 - "dil 13" // standard input (motherboard)
32341        // 0x0008 - "dil 14" // standard input (motherboard)
32342        // 0x0010 - "dil 15" // standard input (motherboard)
32343        PORT_MODIFY("IN-19")
32344        // 0x0001 - "dil 16" // standard input (motherboard)
32345        PORT_MODIFY("IN-20")
32346        // 0x0001 - "testsw" // standard input (motherboard)
32347        // 0x0002 - "dor lk" // standard input (expected here)
32348        // 0x0004 - "tp dor" // standard input (expected here)
32349        // 0x0008 - "csh bx" // standard input (expected here)
32350        // 0x0010 - "deflt" // standard input (expected here)
32314      PORT_INCLUDE( sc4_base )
32315      PORT_MODIFY("IN-1")
32316      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32317      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
32318      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
32319      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
32320      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
32321      PORT_MODIFY("IN-2")
32322      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
32323      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32324      PORT_MODIFY("IN-16")
32325      // 0x0001 - "dil  1" // standard input (motherboard)
32326      // 0x0002 - "dil  2" // standard input (motherboard)
32327      // 0x0004 - "dil  3" // standard input (motherboard)
32328      // 0x0008 - "dil  4" // standard input (motherboard)
32329      // 0x0010 - "dil  5" // standard input (motherboard)
32330      // 0x0100 - "top up" // known extended input, usually 'top up'
32331      PORT_MODIFY("IN-17")
32332      // 0x0001 - "dil  6" // standard input (motherboard)
32333      // 0x0002 - "dil  7" // standard input (motherboard)
32334      // 0x0004 - "dil  8" // standard input (motherboard)
32335      // 0x0008 - "dil  9" // standard input (motherboard)
32336      // 0x0010 - "dil 10" // standard input (motherboard)
32337      PORT_MODIFY("IN-18")
32338      // 0x0001 - "dil 11" // standard input (motherboard)
32339      // 0x0002 - "dil 12" // standard input (motherboard)
32340      // 0x0004 - "dil 13" // standard input (motherboard)
32341      // 0x0008 - "dil 14" // standard input (motherboard)
32342      // 0x0010 - "dil 15" // standard input (motherboard)
32343      PORT_MODIFY("IN-19")
32344      // 0x0001 - "dil 16" // standard input (motherboard)
32345      PORT_MODIFY("IN-20")
32346      // 0x0001 - "testsw" // standard input (motherboard)
32347      // 0x0002 - "dor lk" // standard input (expected here)
32348      // 0x0004 - "tp dor" // standard input (expected here)
32349      // 0x0008 - "csh bx" // standard input (expected here)
32350      // 0x0010 - "deflt" // standard input (expected here)
3235132351INPUT_PORTS_END
3235232352
3235332353// PR2103 THE TRIDENT         TRID SOUNDS         THE TRIDENT
r31373r31374
3237932379}
3238032380
3238132381INPUT_PORTS_START( sc4vrgcl ) // this structure is generated
32382        PORT_INCLUDE( sc4_base )
32383        PORT_MODIFY("IN-1")
32384        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
32385        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32386        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
32387        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
32388        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
32389        PORT_MODIFY("IN-2")
32390        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
32391        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
32392        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32393        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32394        PORT_MODIFY("IN-3")
32395        // 0x0004 - "stk 4" // standard input (expected here)
32396        // 0x0008 - "stk 3" // standard input (expected here)
32397        // 0x0010 - "stk 2" // standard input (expected here)
32398        PORT_MODIFY("IN-4")
32399        // 0x0001 - "hop2lo" // unexpected here
32400        // 0x0002 - "hop1lo" // known extended(?) input, sometimes 'hop hi'
32401        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
32402        PORT_MODIFY("IN-5")
32403        // 0x0001 - "priz4" // standard input (expected here)
32404        // 0x0002 - "priz3" // standard input (expected here)
32405        // 0x0004 - "priz2" // standard input (expected here)
32406        // 0x0008 - "priz1" // standard input (expected here)
32407        PORT_MODIFY("IN-8")
32408        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
32409        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk fet")
32410        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk knk")
32411        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nud hi")
32412        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("fet hi")
32413        PORT_MODIFY("IN-9")
32414        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("knk hi")
32415        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("nud lo")
32416        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("fet lo")
32417        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("knk lo")
32418        PORT_MODIFY("IN-16")
32419        // 0x0001 - "dil 1" // standard input (motherboard)
32420        // 0x0002 - "dil 2" // standard input (motherboard)
32421        // 0x0004 - "dil 3" // standard input (motherboard)
32422        // 0x0008 - "dil 4" // standard input (motherboard)
32423        // 0x0010 - "dil 5" // standard input (motherboard)
32424        PORT_MODIFY("IN-17")
32425        // 0x0001 - "dil 6" // standard input (motherboard)
32426        // 0x0002 - "dil 7" // standard input (motherboard)
32427        // 0x0004 - "dil 8" // standard input (motherboard)
32428        // 0x0008 - "dil 9" // standard input (motherboard)
32429        // 0x0010 - "dil10" // standard input (motherboard)
32430        PORT_MODIFY("IN-18")
32431        // 0x0001 - "dil11" // standard input (motherboard)
32432        // 0x0002 - "dil12" // standard input (motherboard)
32433        // 0x0004 - "dil13" // standard input (motherboard)
32434        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
32435        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
32436        PORT_MODIFY("IN-19")
32437        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
32438        PORT_MODIFY("IN-20")
32439        // 0x0001 - "grnbut" // standard input (motherboard)
32440        // 0x0002 - "dorlok" // standard input (expected here)
32441        // 0x0004 - "topdor" // standard input (expected here)
32442        // 0x0008 - "botdor" // standard input (expected here)
32443        // 0x0010 - "hopdmp" // standard input (expected here)
32382      PORT_INCLUDE( sc4_base )
32383      PORT_MODIFY("IN-1")
32384      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
32385      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32386      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
32387      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
32388      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
32389      PORT_MODIFY("IN-2")
32390      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
32391      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
32392      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32393      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32394      PORT_MODIFY("IN-3")
32395      // 0x0004 - "stk 4" // standard input (expected here)
32396      // 0x0008 - "stk 3" // standard input (expected here)
32397      // 0x0010 - "stk 2" // standard input (expected here)
32398      PORT_MODIFY("IN-4")
32399      // 0x0001 - "hop2lo" // unexpected here
32400      // 0x0002 - "hop1lo" // known extended(?) input, sometimes 'hop hi'
32401      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
32402      PORT_MODIFY("IN-5")
32403      // 0x0001 - "priz4" // standard input (expected here)
32404      // 0x0002 - "priz3" // standard input (expected here)
32405      // 0x0004 - "priz2" // standard input (expected here)
32406      // 0x0008 - "priz1" // standard input (expected here)
32407      PORT_MODIFY("IN-8")
32408      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
32409      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk fet")
32410      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk knk")
32411      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nud hi")
32412      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("fet hi")
32413      PORT_MODIFY("IN-9")
32414      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("knk hi")
32415      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("nud lo")
32416      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("fet lo")
32417      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("knk lo")
32418      PORT_MODIFY("IN-16")
32419      // 0x0001 - "dil 1" // standard input (motherboard)
32420      // 0x0002 - "dil 2" // standard input (motherboard)
32421      // 0x0004 - "dil 3" // standard input (motherboard)
32422      // 0x0008 - "dil 4" // standard input (motherboard)
32423      // 0x0010 - "dil 5" // standard input (motherboard)
32424      PORT_MODIFY("IN-17")
32425      // 0x0001 - "dil 6" // standard input (motherboard)
32426      // 0x0002 - "dil 7" // standard input (motherboard)
32427      // 0x0004 - "dil 8" // standard input (motherboard)
32428      // 0x0008 - "dil 9" // standard input (motherboard)
32429      // 0x0010 - "dil10" // standard input (motherboard)
32430      PORT_MODIFY("IN-18")
32431      // 0x0001 - "dil11" // standard input (motherboard)
32432      // 0x0002 - "dil12" // standard input (motherboard)
32433      // 0x0004 - "dil13" // standard input (motherboard)
32434      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
32435      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
32436      PORT_MODIFY("IN-19")
32437      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
32438      PORT_MODIFY("IN-20")
32439      // 0x0001 - "grnbut" // standard input (motherboard)
32440      // 0x0002 - "dorlok" // standard input (expected here)
32441      // 0x0004 - "topdor" // standard input (expected here)
32442      // 0x0008 - "botdor" // standard input (expected here)
32443      // 0x0010 - "hopdmp" // standard input (expected here)
3244432444INPUT_PORTS_END
3244532445
3244632446// PR1037 CLUB VERY RICH GEEZER         PR1037 RICH SOUNDS11         VERY RICH GEEZER
r31373r31374
3247332473}
3247432474
3247532475INPUT_PORTS_START( sc4leg ) // this structure is generated
32476        PORT_INCLUDE( sc4_base )
32477        PORT_MODIFY("IN-1")
32478        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32479        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32480        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
32481        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
32482        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
32483        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
32484        PORT_MODIFY("IN-2")
32485        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
32486        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32487        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32488        PORT_MODIFY("IN-3")
32489        // 0x0004 - "stk 4" // standard input (expected here)
32490        // 0x0008 - "stk 3" // standard input (expected here)
32491        // 0x0010 - "stk 2" // standard input (expected here)
32492        PORT_MODIFY("IN-5")
32493        // 0x0001 - "priz4" // standard input (expected here)
32494        // 0x0002 - "priz3" // standard input (expected here)
32495        // 0x0004 - "priz2" // standard input (expected here)
32496        // 0x0008 - "priz1" // standard input (expected here)
32497        PORT_MODIFY("IN-6")
32498        // 0x0001 - "perc1" // standard input (expected here)
32499        // 0x0002 - "perc2" // standard input (expected here)
32500        // 0x0004 - "perc3" // standard input (expected here)
32501        // 0x0008 - "perc4" // standard input (expected here)
32502        PORT_MODIFY("IN-8")
32503        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
32504        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sun")
32505        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bon")
32506        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fsh")
32507        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("t high")
32508        PORT_MODIFY("IN-9")
32509        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("t  low")
32510        PORT_MODIFY("IN-16")
32511        // 0x0001 - "dil 1 OR dil sw" // standard input (motherboard)
32512        // 0x0002 - "dil 2 OR dil sw" // standard input (motherboard)
32513        // 0x0004 - "dil 3 OR dil sw" // standard input (motherboard)
32514        // 0x0008 - "dil 4 OR dil sw" // standard input (motherboard)
32515        // 0x0010 - "dil 5 OR dil sw" // standard input (motherboard)
32516        // 0x0100 - "top up" // known extended input, usually 'top up'
32517        PORT_MODIFY("IN-17")
32518        // 0x0001 - "dil 6 OR dil sw" // standard input (motherboard)
32519        // 0x0002 - "dil 7 OR dil sw" // standard input (motherboard)
32520        // 0x0004 - "dil 8 OR dil sw" // standard input (motherboard)
32521        // 0x0008 - "dil 9 OR dil sw" // standard input (motherboard)
32522        // 0x0010 - "dil10 OR dil sw" // standard input (motherboard)
32523        PORT_MODIFY("IN-18")
32524        // 0x0001 - "dil11 OR dil sw" // standard input (motherboard)
32525        // 0x0002 - "dil12 OR dil sw" // standard input (motherboard)
32526        // 0x0004 - "dil13 OR dil sw" // standard input (motherboard)
32527        // 0x0008 - "dil14 OR dil sw" // standard input (motherboard)
32528        // 0x0010 - "dil15 OR dil sw" // standard input (motherboard)
32529        PORT_MODIFY("IN-19")
32530        // 0x0001 - "dil16 OR dil sw" // standard input (motherboard)
32531        PORT_MODIFY("IN-20")
32532        // 0x0001 - "grnbut OR green" // standard input (motherboard)
32533        // 0x0002 - "dorlok" // standard input (expected here)
32534        // 0x0004 - "topdor" // standard input (expected here)
32535        // 0x0008 - "botdor" // standard input (expected here)
32536        // 0x0010 - "hopdmp" // standard input (expected here)
32476      PORT_INCLUDE( sc4_base )
32477      PORT_MODIFY("IN-1")
32478      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32479      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32480      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
32481      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
32482      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
32483      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
32484      PORT_MODIFY("IN-2")
32485      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
32486      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32487      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32488      PORT_MODIFY("IN-3")
32489      // 0x0004 - "stk 4" // standard input (expected here)
32490      // 0x0008 - "stk 3" // standard input (expected here)
32491      // 0x0010 - "stk 2" // standard input (expected here)
32492      PORT_MODIFY("IN-5")
32493      // 0x0001 - "priz4" // standard input (expected here)
32494      // 0x0002 - "priz3" // standard input (expected here)
32495      // 0x0004 - "priz2" // standard input (expected here)
32496      // 0x0008 - "priz1" // standard input (expected here)
32497      PORT_MODIFY("IN-6")
32498      // 0x0001 - "perc1" // standard input (expected here)
32499      // 0x0002 - "perc2" // standard input (expected here)
32500      // 0x0004 - "perc3" // standard input (expected here)
32501      // 0x0008 - "perc4" // standard input (expected here)
32502      PORT_MODIFY("IN-8")
32503      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
32504      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sun")
32505      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bon")
32506      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fsh")
32507      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("t high")
32508      PORT_MODIFY("IN-9")
32509      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("t  low")
32510      PORT_MODIFY("IN-16")
32511      // 0x0001 - "dil 1 OR dil sw" // standard input (motherboard)
32512      // 0x0002 - "dil 2 OR dil sw" // standard input (motherboard)
32513      // 0x0004 - "dil 3 OR dil sw" // standard input (motherboard)
32514      // 0x0008 - "dil 4 OR dil sw" // standard input (motherboard)
32515      // 0x0010 - "dil 5 OR dil sw" // standard input (motherboard)
32516      // 0x0100 - "top up" // known extended input, usually 'top up'
32517      PORT_MODIFY("IN-17")
32518      // 0x0001 - "dil 6 OR dil sw" // standard input (motherboard)
32519      // 0x0002 - "dil 7 OR dil sw" // standard input (motherboard)
32520      // 0x0004 - "dil 8 OR dil sw" // standard input (motherboard)
32521      // 0x0008 - "dil 9 OR dil sw" // standard input (motherboard)
32522      // 0x0010 - "dil10 OR dil sw" // standard input (motherboard)
32523      PORT_MODIFY("IN-18")
32524      // 0x0001 - "dil11 OR dil sw" // standard input (motherboard)
32525      // 0x0002 - "dil12 OR dil sw" // standard input (motherboard)
32526      // 0x0004 - "dil13 OR dil sw" // standard input (motherboard)
32527      // 0x0008 - "dil14 OR dil sw" // standard input (motherboard)
32528      // 0x0010 - "dil15 OR dil sw" // standard input (motherboard)
32529      PORT_MODIFY("IN-19")
32530      // 0x0001 - "dil16 OR dil sw" // standard input (motherboard)
32531      PORT_MODIFY("IN-20")
32532      // 0x0001 - "grnbut OR green" // standard input (motherboard)
32533      // 0x0002 - "dorlok" // standard input (expected here)
32534      // 0x0004 - "topdor" // standard input (expected here)
32535      // 0x0008 - "botdor" // standard input (expected here)
32536      // 0x0010 - "hopdmp" // standard input (expected here)
3253732537INPUT_PORTS_END
3253832538
3253932539// PR7120 WHO WANTS TO BE A LEGIONNAIRE         PR7120 LEGIONNAIRE SOUNDS11
r31373r31374
3256932569}
3257032570
3257132571INPUT_PORTS_START( sc4legcb ) // this structure is generated
32572        PORT_INCLUDE( sc4_base )
32573        PORT_MODIFY("IN-1")
32574        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
32575        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32576        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
32577        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
32578        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
32579        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
32580        PORT_MODIFY("IN-2")
32581        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
32582        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
32583        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32584        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32585        PORT_MODIFY("IN-3")
32586        // 0x0004 - "stk 4" // standard input (expected here)
32587        // 0x0008 - "stk 3" // standard input (expected here)
32588        // 0x0010 - "stk 2" // standard input (expected here)
32589        PORT_MODIFY("IN-4")
32590        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
32591        PORT_MODIFY("IN-5")
32592        // 0x0001 - "priz4" // standard input (expected here)
32593        // 0x0002 - "priz3" // standard input (expected here)
32594        // 0x0004 - "priz2" // standard input (expected here)
32595        // 0x0008 - "priz1" // standard input (expected here)
32596        PORT_MODIFY("IN-8")
32597        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
32598        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sun")
32599        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bon")
32600        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
32601        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("high")
32602        PORT_MODIFY("IN-9")
32603        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("low")
32604        PORT_MODIFY("IN-16")
32605        // 0x0001 - "dil 1" // standard input (motherboard)
32606        // 0x0002 - "dil 2" // standard input (motherboard)
32607        // 0x0004 - "dil 3" // standard input (motherboard)
32608        // 0x0008 - "dil 4" // standard input (motherboard)
32609        // 0x0010 - "dil 5" // standard input (motherboard)
32610        // 0x0100 - "top up" // known extended input, usually 'top up'
32611        PORT_MODIFY("IN-17")
32612        // 0x0001 - "dil 6" // standard input (motherboard)
32613        // 0x0002 - "dil 7" // standard input (motherboard)
32614        // 0x0004 - "dil 8" // standard input (motherboard)
32615        // 0x0008 - "dil 9" // standard input (motherboard)
32616        // 0x0010 - "dil10" // standard input (motherboard)
32617        PORT_MODIFY("IN-18")
32618        // 0x0001 - "dil11" // standard input (motherboard)
32619        // 0x0002 - "dil12" // standard input (motherboard)
32620        // 0x0004 - "dil13" // standard input (motherboard)
32621        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
32622        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
32623        PORT_MODIFY("IN-19")
32624        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
32625        PORT_MODIFY("IN-20")
32626        // 0x0001 - "grnbut" // standard input (motherboard)
32627        // 0x0002 - "dorlok" // standard input (expected here)
32628        // 0x0004 - "topdor" // standard input (expected here)
32629        // 0x0008 - "botdor" // standard input (expected here)
32630        // 0x0010 - "hopdmp" // standard input (expected here)
32572      PORT_INCLUDE( sc4_base )
32573      PORT_MODIFY("IN-1")
32574      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
32575      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32576      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
32577      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
32578      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
32579      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
32580      PORT_MODIFY("IN-2")
32581      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
32582      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
32583      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32584      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32585      PORT_MODIFY("IN-3")
32586      // 0x0004 - "stk 4" // standard input (expected here)
32587      // 0x0008 - "stk 3" // standard input (expected here)
32588      // 0x0010 - "stk 2" // standard input (expected here)
32589      PORT_MODIFY("IN-4")
32590      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
32591      PORT_MODIFY("IN-5")
32592      // 0x0001 - "priz4" // standard input (expected here)
32593      // 0x0002 - "priz3" // standard input (expected here)
32594      // 0x0004 - "priz2" // standard input (expected here)
32595      // 0x0008 - "priz1" // standard input (expected here)
32596      PORT_MODIFY("IN-8")
32597      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
32598      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sun")
32599      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bon")
32600      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
32601      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("high")
32602      PORT_MODIFY("IN-9")
32603      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("low")
32604      PORT_MODIFY("IN-16")
32605      // 0x0001 - "dil 1" // standard input (motherboard)
32606      // 0x0002 - "dil 2" // standard input (motherboard)
32607      // 0x0004 - "dil 3" // standard input (motherboard)
32608      // 0x0008 - "dil 4" // standard input (motherboard)
32609      // 0x0010 - "dil 5" // standard input (motherboard)
32610      // 0x0100 - "top up" // known extended input, usually 'top up'
32611      PORT_MODIFY("IN-17")
32612      // 0x0001 - "dil 6" // standard input (motherboard)
32613      // 0x0002 - "dil 7" // standard input (motherboard)
32614      // 0x0004 - "dil 8" // standard input (motherboard)
32615      // 0x0008 - "dil 9" // standard input (motherboard)
32616      // 0x0010 - "dil10" // standard input (motherboard)
32617      PORT_MODIFY("IN-18")
32618      // 0x0001 - "dil11" // standard input (motherboard)
32619      // 0x0002 - "dil12" // standard input (motherboard)
32620      // 0x0004 - "dil13" // standard input (motherboard)
32621      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
32622      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
32623      PORT_MODIFY("IN-19")
32624      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
32625      PORT_MODIFY("IN-20")
32626      // 0x0001 - "grnbut" // standard input (motherboard)
32627      // 0x0002 - "dorlok" // standard input (expected here)
32628      // 0x0004 - "topdor" // standard input (expected here)
32629      // 0x0008 - "botdor" // standard input (expected here)
32630      // 0x0010 - "hopdmp" // standard input (expected here)
3263132631INPUT_PORTS_END
3263232632
3263332633// PR1038 CLUB WHO WANTS TO BE A LEGIONNAIRE         PR1038 CLUB WWTBAL SOUNDS11
r31373r31374
3265732657}
3265832658
3265932659INPUT_PORTS_START( sc4wspin ) // this structure is generated
32660        PORT_INCLUDE( sc4_base )
32661        PORT_MODIFY("IN-1")
32662        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32663        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("blank")
32664        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
32665        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
32666        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
32667        PORT_MODIFY("IN-2")
32668        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto")
32669        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32670        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32671        PORT_MODIFY("IN-16")
32672        // 0x0001 - "dil  1" // standard input (motherboard)
32673        // 0x0002 - "dil  2" // standard input (motherboard)
32674        // 0x0004 - "dil  3" // standard input (motherboard)
32675        // 0x0008 - "dil  4" // standard input (motherboard)
32676        // 0x0010 - "dil  5" // standard input (motherboard)
32677        // 0x0100 - "topup" // known extended input, usually 'top up'
32678        PORT_MODIFY("IN-17")
32679        // 0x0001 - "dil  6" // standard input (motherboard)
32680        // 0x0002 - "dil  7" // standard input (motherboard)
32681        // 0x0004 - "dil  8" // standard input (motherboard)
32682        // 0x0008 - "dil  9" // standard input (motherboard)
32683        // 0x0010 - "dil 10" // standard input (motherboard)
32684        PORT_MODIFY("IN-18")
32685        // 0x0001 - "dil 11" // standard input (motherboard)
32686        // 0x0002 - "dil 12" // standard input (motherboard)
32687        // 0x0004 - "dil 13" // standard input (motherboard)
32688        // 0x0008 - "dil 14" // standard input (motherboard)
32689        // 0x0010 - "dil 15" // standard input (motherboard)
32690        PORT_MODIFY("IN-19")
32691        // 0x0001 - "dil 16" // standard input (motherboard)
32692        PORT_MODIFY("IN-20")
32693        // 0x0001 - "test" // standard input (motherboard)
32694        // 0x0002 - "lock" // standard input (expected here)
32695        // 0x0004 - "topdor" // standard input (expected here)
32696        // 0x0008 - "botdor" // standard input (expected here)
32697        // 0x0010 - "hopdmp" // standard input (expected here)
32660      PORT_INCLUDE( sc4_base )
32661      PORT_MODIFY("IN-1")
32662      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32663      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("blank")
32664      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
32665      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
32666      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
32667      PORT_MODIFY("IN-2")
32668      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto")
32669      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32670      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32671      PORT_MODIFY("IN-16")
32672      // 0x0001 - "dil  1" // standard input (motherboard)
32673      // 0x0002 - "dil  2" // standard input (motherboard)
32674      // 0x0004 - "dil  3" // standard input (motherboard)
32675      // 0x0008 - "dil  4" // standard input (motherboard)
32676      // 0x0010 - "dil  5" // standard input (motherboard)
32677      // 0x0100 - "topup" // known extended input, usually 'top up'
32678      PORT_MODIFY("IN-17")
32679      // 0x0001 - "dil  6" // standard input (motherboard)
32680      // 0x0002 - "dil  7" // standard input (motherboard)
32681      // 0x0004 - "dil  8" // standard input (motherboard)
32682      // 0x0008 - "dil  9" // standard input (motherboard)
32683      // 0x0010 - "dil 10" // standard input (motherboard)
32684      PORT_MODIFY("IN-18")
32685      // 0x0001 - "dil 11" // standard input (motherboard)
32686      // 0x0002 - "dil 12" // standard input (motherboard)
32687      // 0x0004 - "dil 13" // standard input (motherboard)
32688      // 0x0008 - "dil 14" // standard input (motherboard)
32689      // 0x0010 - "dil 15" // standard input (motherboard)
32690      PORT_MODIFY("IN-19")
32691      // 0x0001 - "dil 16" // standard input (motherboard)
32692      PORT_MODIFY("IN-20")
32693      // 0x0001 - "test" // standard input (motherboard)
32694      // 0x0002 - "lock" // standard input (expected here)
32695      // 0x0004 - "topdor" // standard input (expected here)
32696      // 0x0008 - "botdor" // standard input (expected here)
32697      // 0x0010 - "hopdmp" // standard input (expected here)
3269832698INPUT_PORTS_END
3269932699
3270032700// QPS162 WIN SPINNER Arcade Version  011         WINSPINNERSND           WIN  SPINNER
r31373r31374
3272132721}
3272232722
3272332723INPUT_PORTS_START( sc4wwys ) // this structure is generated
32724        PORT_INCLUDE( sc4_base )
32725        PORT_MODIFY("IN-1")
32726        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32727        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32728        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
32729        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
32730        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
32731        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
32732        PORT_MODIFY("IN-2")
32733        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
32734        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32735        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32736        PORT_MODIFY("IN-3")
32737        // 0x0004 - "stk 4" // standard input (expected here)
32738        // 0x0008 - "stk 3" // standard input (expected here)
32739        // 0x0010 - "stk 2" // standard input (expected here)
32740        PORT_MODIFY("IN-5")
32741        // 0x0001 - "priz4" // standard input (expected here)
32742        // 0x0002 - "priz3" // standard input (expected here)
32743        // 0x0004 - "priz2" // standard input (expected here)
32744        // 0x0008 - "priz1" // standard input (expected here)
32745        PORT_MODIFY("IN-6")
32746        // 0x0001 - "perc1" // standard input (expected here)
32747        // 0x0002 - "perc2" // standard input (expected here)
32748        // 0x0004 - "perc3" // standard input (expected here)
32749        // 0x0008 - "perc4" // standard input (expected here)
32750        PORT_MODIFY("IN-8")
32751        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fea")
32752        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lo blt")
32753        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lo ko")
32754        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lo nud")
32755        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
32756        PORT_MODIFY("IN-9")
32757        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("tk spr")
32758        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hi blt")
32759        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("hi ko")
32760        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("hi nud")
32761        PORT_MODIFY("IN-16")
32762        // 0x0001 - "dil 1" // standard input (motherboard)
32763        // 0x0002 - "dil 2" // standard input (motherboard)
32764        // 0x0004 - "dil 3" // standard input (motherboard)
32765        // 0x0008 - "dil 4" // standard input (motherboard)
32766        // 0x0010 - "dil 5" // standard input (motherboard)
32767        // 0x0100 - "top up" // known extended input, usually 'top up'
32768        PORT_MODIFY("IN-17")
32769        // 0x0001 - "dil 6" // standard input (motherboard)
32770        // 0x0002 - "dil 7" // standard input (motherboard)
32771        // 0x0004 - "dil 8" // standard input (motherboard)
32772        // 0x0008 - "dil 9" // standard input (motherboard)
32773        // 0x0010 - "dil10" // standard input (motherboard)
32774        PORT_MODIFY("IN-18")
32775        // 0x0001 - "dil11" // standard input (motherboard)
32776        // 0x0002 - "dil12" // standard input (motherboard)
32777        // 0x0004 - "dil13" // standard input (motherboard)
32778        // 0x0008 - "dil14" // standard input (motherboard)
32779        // 0x0010 - "dil15" // standard input (motherboard)
32780        PORT_MODIFY("IN-19")
32781        // 0x0001 - "dil16" // standard input (motherboard)
32782        PORT_MODIFY("IN-20")
32783        // 0x0001 - "grnbut" // standard input (motherboard)
32784        // 0x0002 - "dorlok" // standard input (expected here)
32785        // 0x0004 - "topdor" // standard input (expected here)
32786        // 0x0008 - "botdor" // standard input (expected here)
32787        // 0x0010 - "hopdmp" // standard input (expected here)
32724      PORT_INCLUDE( sc4_base )
32725      PORT_MODIFY("IN-1")
32726      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32727      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32728      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
32729      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
32730      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
32731      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
32732      PORT_MODIFY("IN-2")
32733      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
32734      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32735      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32736      PORT_MODIFY("IN-3")
32737      // 0x0004 - "stk 4" // standard input (expected here)
32738      // 0x0008 - "stk 3" // standard input (expected here)
32739      // 0x0010 - "stk 2" // standard input (expected here)
32740      PORT_MODIFY("IN-5")
32741      // 0x0001 - "priz4" // standard input (expected here)
32742      // 0x0002 - "priz3" // standard input (expected here)
32743      // 0x0004 - "priz2" // standard input (expected here)
32744      // 0x0008 - "priz1" // standard input (expected here)
32745      PORT_MODIFY("IN-6")
32746      // 0x0001 - "perc1" // standard input (expected here)
32747      // 0x0002 - "perc2" // standard input (expected here)
32748      // 0x0004 - "perc3" // standard input (expected here)
32749      // 0x0008 - "perc4" // standard input (expected here)
32750      PORT_MODIFY("IN-8")
32751      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fea")
32752      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lo blt")
32753      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lo ko")
32754      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lo nud")
32755      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
32756      PORT_MODIFY("IN-9")
32757      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("tk spr")
32758      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hi blt")
32759      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("hi ko")
32760      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("hi nud")
32761      PORT_MODIFY("IN-16")
32762      // 0x0001 - "dil 1" // standard input (motherboard)
32763      // 0x0002 - "dil 2" // standard input (motherboard)
32764      // 0x0004 - "dil 3" // standard input (motherboard)
32765      // 0x0008 - "dil 4" // standard input (motherboard)
32766      // 0x0010 - "dil 5" // standard input (motherboard)
32767      // 0x0100 - "top up" // known extended input, usually 'top up'
32768      PORT_MODIFY("IN-17")
32769      // 0x0001 - "dil 6" // standard input (motherboard)
32770      // 0x0002 - "dil 7" // standard input (motherboard)
32771      // 0x0004 - "dil 8" // standard input (motherboard)
32772      // 0x0008 - "dil 9" // standard input (motherboard)
32773      // 0x0010 - "dil10" // standard input (motherboard)
32774      PORT_MODIFY("IN-18")
32775      // 0x0001 - "dil11" // standard input (motherboard)
32776      // 0x0002 - "dil12" // standard input (motherboard)
32777      // 0x0004 - "dil13" // standard input (motherboard)
32778      // 0x0008 - "dil14" // standard input (motherboard)
32779      // 0x0010 - "dil15" // standard input (motherboard)
32780      PORT_MODIFY("IN-19")
32781      // 0x0001 - "dil16" // standard input (motherboard)
32782      PORT_MODIFY("IN-20")
32783      // 0x0001 - "grnbut" // standard input (motherboard)
32784      // 0x0002 - "dorlok" // standard input (expected here)
32785      // 0x0004 - "topdor" // standard input (expected here)
32786      // 0x0008 - "botdor" // standard input (expected here)
32787      // 0x0010 - "hopdmp" // standard input (expected here)
3278832788INPUT_PORTS_END
3278932789
3279032790//  PR1301 WIN WHEN YOUR SPINNING         PR1301 WIN W Y S SOUNDS11
r31373r31374
3282532825}
3282632826
3282732827INPUT_PORTS_START( sc4winspa ) // this structure is generated
32828        PORT_INCLUDE( sc4_base )
32829        PORT_MODIFY("IN-1")
32830        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32831        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32832        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
32833        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
32834        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("auto")
32835        PORT_MODIFY("IN-2")
32836        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
32837        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
32838        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32839        PORT_MODIFY("IN-4")
32840        // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
32841        PORT_MODIFY("IN-16")
32842        // 0x0001 - "dil  1" // standard input (motherboard)
32843        // 0x0002 - "dil  2" // standard input (motherboard)
32844        // 0x0004 - "dil  3" // standard input (motherboard)
32845        // 0x0008 - "dil  4" // standard input (motherboard)
32846        // 0x0010 - "dil  5" // standard input (motherboard)
32847        PORT_MODIFY("IN-17")
32848        // 0x0001 - "dil  6" // standard input (motherboard)
32849        // 0x0002 - "dil  7" // standard input (motherboard)
32850        // 0x0004 - "dil  8" // standard input (motherboard)
32851        // 0x0008 - "dil  9" // standard input (motherboard)
32852        // 0x0010 - "dil 10" // standard input (motherboard)
32853        PORT_MODIFY("IN-18")
32854        // 0x0001 - "dil 11" // standard input (motherboard)
32855        // 0x0002 - "dil 12" // standard input (motherboard)
32856        // 0x0004 - "dil 13" // standard input (motherboard)
32857        // 0x0008 - "dil 14" // standard input (motherboard)
32858        // 0x0010 - "dil 15" // standard input (motherboard)
32859        PORT_MODIFY("IN-19")
32860        // 0x0001 - "dil 16" // standard input (motherboard)
32861        PORT_MODIFY("IN-20")
32862        // 0x0001 - "test" // standard input (motherboard)
32863        // 0x0002 - "botdor OR botdor" // standard input (expected here)
32864        // 0x0004 - "topdor OR topdor" // standard input (expected here)
32865        // 0x0008 - "hopdmp OR hopdmp" // standard input (expected here)
32866        // 0x0010 - "topdor" // standard input (expected here)
32828      PORT_INCLUDE( sc4_base )
32829      PORT_MODIFY("IN-1")
32830      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32831      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32832      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
32833      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
32834      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("auto")
32835      PORT_MODIFY("IN-2")
32836      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
32837      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
32838      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32839      PORT_MODIFY("IN-4")
32840      // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
32841      PORT_MODIFY("IN-16")
32842      // 0x0001 - "dil  1" // standard input (motherboard)
32843      // 0x0002 - "dil  2" // standard input (motherboard)
32844      // 0x0004 - "dil  3" // standard input (motherboard)
32845      // 0x0008 - "dil  4" // standard input (motherboard)
32846      // 0x0010 - "dil  5" // standard input (motherboard)
32847      PORT_MODIFY("IN-17")
32848      // 0x0001 - "dil  6" // standard input (motherboard)
32849      // 0x0002 - "dil  7" // standard input (motherboard)
32850      // 0x0004 - "dil  8" // standard input (motherboard)
32851      // 0x0008 - "dil  9" // standard input (motherboard)
32852      // 0x0010 - "dil 10" // standard input (motherboard)
32853      PORT_MODIFY("IN-18")
32854      // 0x0001 - "dil 11" // standard input (motherboard)
32855      // 0x0002 - "dil 12" // standard input (motherboard)
32856      // 0x0004 - "dil 13" // standard input (motherboard)
32857      // 0x0008 - "dil 14" // standard input (motherboard)
32858      // 0x0010 - "dil 15" // standard input (motherboard)
32859      PORT_MODIFY("IN-19")
32860      // 0x0001 - "dil 16" // standard input (motherboard)
32861      PORT_MODIFY("IN-20")
32862      // 0x0001 - "test" // standard input (motherboard)
32863      // 0x0002 - "botdor OR botdor" // standard input (expected here)
32864      // 0x0004 - "topdor OR topdor" // standard input (expected here)
32865      // 0x0008 - "hopdmp OR hopdmp" // standard input (expected here)
32866      // 0x0010 - "topdor" // standard input (expected here)
3286732867INPUT_PORTS_END
3286832868
3286932869// PR2526 WINNING SPIN TOP BOX         WINNINGSPINSND           WINNING SPIN
r31373r31374
3292632926}
3292732927
3292832928INPUT_PORTS_START( sc4wondw ) // this structure is generated
32929        PORT_INCLUDE( sc4_base )
32930        PORT_MODIFY("IN-1")
32931        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32932        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32933        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
32934        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
32935        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
32936        PORT_MODIFY("IN-2")
32937        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
32938        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32939        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32940        PORT_MODIFY("IN-3")
32941        // 0x0004 - "stk 4" // standard input (expected here)
32942        // 0x0008 - "stk 3" // standard input (expected here)
32943        // 0x0010 - "stk 2" // standard input (expected here)
32944        PORT_MODIFY("IN-5")
32945        // 0x0001 - "priz4" // standard input (expected here)
32946        // 0x0002 - "priz3" // standard input (expected here)
32947        // 0x0004 - "priz2" // standard input (expected here)
32948        // 0x0008 - "priz1" // standard input (expected here)
32949        PORT_MODIFY("IN-6")
32950        // 0x0001 - "perc1" // standard input (expected here)
32951        // 0x0002 - "perc2" // standard input (expected here)
32952        // 0x0004 - "perc3" // standard input (expected here)
32953        // 0x0008 - "perc4" // standard input (expected here)
32954        PORT_MODIFY("IN-8")
32955        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
32956        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht OR tk ss")
32957        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk haz")
32958        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fea")
32959        PORT_MODIFY("IN-16")
32960        // 0x0001 - "dil 1" // standard input (motherboard)
32961        // 0x0002 - "dil 2" // standard input (motherboard)
32962        // 0x0004 - "dil 3" // standard input (motherboard)
32963        // 0x0008 - "dil 4" // standard input (motherboard)
32964        // 0x0010 - "dil 5" // standard input (motherboard)
32965        PORT_MODIFY("IN-17")
32966        // 0x0001 - "dil 6" // standard input (motherboard)
32967        // 0x0002 - "dil 7" // standard input (motherboard)
32968        // 0x0004 - "dil 8" // standard input (motherboard)
32969        // 0x0008 - "dil 9" // standard input (motherboard)
32970        // 0x0010 - "dil10" // standard input (motherboard)
32971        PORT_MODIFY("IN-18")
32972        // 0x0001 - "dil11" // standard input (motherboard)
32973        // 0x0002 - "dil12" // standard input (motherboard)
32974        // 0x0004 - "dil13" // standard input (motherboard)
32975        // 0x0008 - "dil14" // standard input (motherboard)
32976        // 0x0010 - "dil15" // standard input (motherboard)
32977        PORT_MODIFY("IN-19")
32978        // 0x0001 - "dil16" // standard input (motherboard)
32979        PORT_MODIFY("IN-20")
32980        // 0x0001 - "grnbut" // standard input (motherboard)
32981        // 0x0002 - "dorlok" // standard input (expected here)
32982        // 0x0004 - "topdor" // standard input (expected here)
32983        // 0x0008 - "botdor" // standard input (expected here)
32984        // 0x0010 - "hopdmp" // standard input (expected here)
32929      PORT_INCLUDE( sc4_base )
32930      PORT_MODIFY("IN-1")
32931      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
32932      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
32933      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
32934      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
32935      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
32936      PORT_MODIFY("IN-2")
32937      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
32938      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
32939      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
32940      PORT_MODIFY("IN-3")
32941      // 0x0004 - "stk 4" // standard input (expected here)
32942      // 0x0008 - "stk 3" // standard input (expected here)
32943      // 0x0010 - "stk 2" // standard input (expected here)
32944      PORT_MODIFY("IN-5")
32945      // 0x0001 - "priz4" // standard input (expected here)
32946      // 0x0002 - "priz3" // standard input (expected here)
32947      // 0x0004 - "priz2" // standard input (expected here)
32948      // 0x0008 - "priz1" // standard input (expected here)
32949      PORT_MODIFY("IN-6")
32950      // 0x0001 - "perc1" // standard input (expected here)
32951      // 0x0002 - "perc2" // standard input (expected here)
32952      // 0x0004 - "perc3" // standard input (expected here)
32953      // 0x0008 - "perc4" // standard input (expected here)
32954      PORT_MODIFY("IN-8")
32955      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
32956      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht OR tk ss")
32957      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk haz")
32958      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fea")
32959      PORT_MODIFY("IN-16")
32960      // 0x0001 - "dil 1" // standard input (motherboard)
32961      // 0x0002 - "dil 2" // standard input (motherboard)
32962      // 0x0004 - "dil 3" // standard input (motherboard)
32963      // 0x0008 - "dil 4" // standard input (motherboard)
32964      // 0x0010 - "dil 5" // standard input (motherboard)
32965      PORT_MODIFY("IN-17")
32966      // 0x0001 - "dil 6" // standard input (motherboard)
32967      // 0x0002 - "dil 7" // standard input (motherboard)
32968      // 0x0004 - "dil 8" // standard input (motherboard)
32969      // 0x0008 - "dil 9" // standard input (motherboard)
32970      // 0x0010 - "dil10" // standard input (motherboard)
32971      PORT_MODIFY("IN-18")
32972      // 0x0001 - "dil11" // standard input (motherboard)
32973      // 0x0002 - "dil12" // standard input (motherboard)
32974      // 0x0004 - "dil13" // standard input (motherboard)
32975      // 0x0008 - "dil14" // standard input (motherboard)
32976      // 0x0010 - "dil15" // standard input (motherboard)
32977      PORT_MODIFY("IN-19")
32978      // 0x0001 - "dil16" // standard input (motherboard)
32979      PORT_MODIFY("IN-20")
32980      // 0x0001 - "grnbut" // standard input (motherboard)
32981      // 0x0002 - "dorlok" // standard input (expected here)
32982      // 0x0004 - "topdor" // standard input (expected here)
32983      // 0x0008 - "botdor" // standard input (expected here)
32984      // 0x0010 - "hopdmp" // standard input (expected here)
3298532985INPUT_PORTS_END
3298632986
3298732987// PR1318 WONDER WHEEL         PR1314 WONDER WHEEL SOUNDS11
r31373r31374
3300533005}
3300633006
3300733007INPUT_PORTS_START( sc4xmark ) // this structure is generated
33008        PORT_INCLUDE( sc4_base )
33009        PORT_MODIFY("IN-1")
33010        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33011        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
33012        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
33013        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
33014        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
33015        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
33016        PORT_MODIFY("IN-2")
33017        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33018        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33019        PORT_MODIFY("IN-3")
33020        // 0x0004 - "stk 4" // standard input (expected here)
33021        // 0x0008 - "stk 3" // standard input (expected here)
33022        // 0x0010 - "stk 2" // standard input (expected here)
33023        PORT_MODIFY("IN-5")
33024        // 0x0001 - "priz4" // standard input (expected here)
33025        // 0x0002 - "priz3" // standard input (expected here)
33026        // 0x0004 - "priz2" // standard input (expected here)
33027        // 0x0008 - "priz1" // standard input (expected here)
33028        PORT_MODIFY("IN-6")
33029        // 0x0001 - "perc1" // standard input (expected here)
33030        // 0x0002 - "perc2" // standard input (expected here)
33031        // 0x0004 - "perc3" // standard input (expected here)
33032        // 0x0008 - "perc4" // standard input (expected here)
33033        PORT_MODIFY("IN-8")
33034        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("low 3")
33035        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("low 2")
33036        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("low 1")
33037        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk nud")
33038        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk grd")
33039        PORT_MODIFY("IN-9")
33040        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("high 1")
33041        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("high 2")
33042        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("high 3")
33043        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("tk csh")
33044        PORT_MODIFY("IN-10")
33045        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_0 ) PORT_NAME("left")
33046        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_1 ) PORT_NAME("up")
33047        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_2 ) PORT_NAME("right")
33048        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_3 ) PORT_NAME("down")
33049        PORT_MODIFY("IN-16")
33050        // 0x0001 - "dil sw" // standard input (motherboard)
33051        // 0x0002 - "dil sw" // standard input (motherboard)
33052        // 0x0004 - "dil sw" // standard input (motherboard)
33053        // 0x0008 - "dil sw" // standard input (motherboard)
33054        // 0x0010 - "dil sw" // standard input (motherboard)
33055        // 0x0100 - "top up" // known extended input, usually 'top up'
33056        PORT_MODIFY("IN-17")
33057        // 0x0001 - "dil sw" // standard input (motherboard)
33058        // 0x0002 - "dil sw" // standard input (motherboard)
33059        // 0x0004 - "dil sw" // standard input (motherboard)
33060        // 0x0008 - "dil sw" // standard input (motherboard)
33061        // 0x0010 - "dil sw" // standard input (motherboard)
33062        PORT_MODIFY("IN-18")
33063        // 0x0001 - "dil sw" // standard input (motherboard)
33064        // 0x0002 - "dil sw" // standard input (motherboard)
33065        // 0x0004 - "dil sw" // standard input (motherboard)
33066        // 0x0008 - "dil sw" // standard input (motherboard)
33067        // 0x0010 - "dil sw" // standard input (motherboard)
33068        PORT_MODIFY("IN-19")
33069        // 0x0001 - "dil sw" // standard input (motherboard)
33070        PORT_MODIFY("IN-20")
33071        // 0x0001 - "green" // standard input (motherboard)
33072        // 0x0002 - "dorlok" // standard input (expected here)
33073        // 0x0004 - "topdor" // standard input (expected here)
33074        // 0x0008 - "botdor" // standard input (expected here)
33075        // 0x0010 - "hopdmp" // standard input (expected here)
33008      PORT_INCLUDE( sc4_base )
33009      PORT_MODIFY("IN-1")
33010      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33011      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
33012      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
33013      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
33014      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
33015      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
33016      PORT_MODIFY("IN-2")
33017      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33018      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33019      PORT_MODIFY("IN-3")
33020      // 0x0004 - "stk 4" // standard input (expected here)
33021      // 0x0008 - "stk 3" // standard input (expected here)
33022      // 0x0010 - "stk 2" // standard input (expected here)
33023      PORT_MODIFY("IN-5")
33024      // 0x0001 - "priz4" // standard input (expected here)
33025      // 0x0002 - "priz3" // standard input (expected here)
33026      // 0x0004 - "priz2" // standard input (expected here)
33027      // 0x0008 - "priz1" // standard input (expected here)
33028      PORT_MODIFY("IN-6")
33029      // 0x0001 - "perc1" // standard input (expected here)
33030      // 0x0002 - "perc2" // standard input (expected here)
33031      // 0x0004 - "perc3" // standard input (expected here)
33032      // 0x0008 - "perc4" // standard input (expected here)
33033      PORT_MODIFY("IN-8")
33034      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("low 3")
33035      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("low 2")
33036      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("low 1")
33037      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk nud")
33038      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk grd")
33039      PORT_MODIFY("IN-9")
33040      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("high 1")
33041      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("high 2")
33042      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("high 3")
33043      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("tk csh")
33044      PORT_MODIFY("IN-10")
33045      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_0 ) PORT_NAME("left")
33046      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_1 ) PORT_NAME("up")
33047      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_2 ) PORT_NAME("right")
33048      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_3 ) PORT_NAME("down")
33049      PORT_MODIFY("IN-16")
33050      // 0x0001 - "dil sw" // standard input (motherboard)
33051      // 0x0002 - "dil sw" // standard input (motherboard)
33052      // 0x0004 - "dil sw" // standard input (motherboard)
33053      // 0x0008 - "dil sw" // standard input (motherboard)
33054      // 0x0010 - "dil sw" // standard input (motherboard)
33055      // 0x0100 - "top up" // known extended input, usually 'top up'
33056      PORT_MODIFY("IN-17")
33057      // 0x0001 - "dil sw" // standard input (motherboard)
33058      // 0x0002 - "dil sw" // standard input (motherboard)
33059      // 0x0004 - "dil sw" // standard input (motherboard)
33060      // 0x0008 - "dil sw" // standard input (motherboard)
33061      // 0x0010 - "dil sw" // standard input (motherboard)
33062      PORT_MODIFY("IN-18")
33063      // 0x0001 - "dil sw" // standard input (motherboard)
33064      // 0x0002 - "dil sw" // standard input (motherboard)
33065      // 0x0004 - "dil sw" // standard input (motherboard)
33066      // 0x0008 - "dil sw" // standard input (motherboard)
33067      // 0x0010 - "dil sw" // standard input (motherboard)
33068      PORT_MODIFY("IN-19")
33069      // 0x0001 - "dil sw" // standard input (motherboard)
33070      PORT_MODIFY("IN-20")
33071      // 0x0001 - "green" // standard input (motherboard)
33072      // 0x0002 - "dorlok" // standard input (expected here)
33073      // 0x0004 - "topdor" // standard input (expected here)
33074      // 0x0008 - "botdor" // standard input (expected here)
33075      // 0x0010 - "hopdmp" // standard input (expected here)
3307633076INPUT_PORTS_END
3307733077
3307833078// PR1116 X MARKS THE SPOT         PR1116 X MARKS THE SPOT SOUNDS11
r31373r31374
3309833098}
3309933099
3310033100INPUT_PORTS_START( sc4blokq ) // this structure is generated
33101        PORT_INCLUDE( sc4_base )
33102        PORT_MODIFY("IN-1")
33103        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33104        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
33105        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
33106        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
33107        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
33108        PORT_MODIFY("IN-2")
33109        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
33110        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33111        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33112        PORT_MODIFY("IN-4")
33113        // 0x0010 - "topup" // known extended(?) input, sometimes 'top up'
33114        PORT_MODIFY("IN-8")
33115        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("rig hi")
33116        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("up hi")
33117        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lef hi")
33118        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lef lo")
33119        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("up lo")
33120        PORT_MODIFY("IN-9")
33121        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("rig lo")
33122        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("featre")
33123        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("cash")
33124        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("nudge")
33125        PORT_MODIFY("IN-16")
33126        // 0x0001 - "dil  1" // standard input (motherboard)
33127        // 0x0002 - "dil  2" // standard input (motherboard)
33128        // 0x0004 - "dil  3" // standard input (motherboard)
33129        // 0x0008 - "dil  4" // standard input (motherboard)
33130        // 0x0010 - "dil  5" // standard input (motherboard)
33131        PORT_MODIFY("IN-17")
33132        // 0x0001 - "dil  6" // standard input (motherboard)
33133        // 0x0002 - "dil  7" // standard input (motherboard)
33134        // 0x0004 - "dil  8" // standard input (motherboard)
33135        // 0x0008 - "dil  9" // standard input (motherboard)
33136        // 0x0010 - "dil 10" // standard input (motherboard)
33137        PORT_MODIFY("IN-18")
33138        // 0x0001 - "dil 11" // standard input (motherboard)
33139        // 0x0002 - "dil 12" // standard input (motherboard)
33140        // 0x0004 - "dil 13" // standard input (motherboard)
33141        // 0x0008 - "dil 14" // standard input (motherboard)
33142        // 0x0010 - "dil 15" // standard input (motherboard)
33143        PORT_MODIFY("IN-19")
33144        // 0x0001 - "dil 16" // standard input (motherboard)
33145        PORT_MODIFY("IN-20")
33146        // 0x0001 - "test" // standard input (motherboard)
33147        // 0x0002 - "lock" // standard input (expected here)
33148        // 0x0004 - "topdor" // standard input (expected here)
33149        // 0x0008 - "botdor" // standard input (expected here)
33150        // 0x0010 - "hopdmp" // standard input (expected here)
33101      PORT_INCLUDE( sc4_base )
33102      PORT_MODIFY("IN-1")
33103      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33104      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
33105      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
33106      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
33107      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
33108      PORT_MODIFY("IN-2")
33109      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
33110      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33111      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33112      PORT_MODIFY("IN-4")
33113      // 0x0010 - "topup" // known extended(?) input, sometimes 'top up'
33114      PORT_MODIFY("IN-8")
33115      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("rig hi")
33116      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("up hi")
33117      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lef hi")
33118      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lef lo")
33119      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("up lo")
33120      PORT_MODIFY("IN-9")
33121      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("rig lo")
33122      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("featre")
33123      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("cash")
33124      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("nudge")
33125      PORT_MODIFY("IN-16")
33126      // 0x0001 - "dil  1" // standard input (motherboard)
33127      // 0x0002 - "dil  2" // standard input (motherboard)
33128      // 0x0004 - "dil  3" // standard input (motherboard)
33129      // 0x0008 - "dil  4" // standard input (motherboard)
33130      // 0x0010 - "dil  5" // standard input (motherboard)
33131      PORT_MODIFY("IN-17")
33132      // 0x0001 - "dil  6" // standard input (motherboard)
33133      // 0x0002 - "dil  7" // standard input (motherboard)
33134      // 0x0004 - "dil  8" // standard input (motherboard)
33135      // 0x0008 - "dil  9" // standard input (motherboard)
33136      // 0x0010 - "dil 10" // standard input (motherboard)
33137      PORT_MODIFY("IN-18")
33138      // 0x0001 - "dil 11" // standard input (motherboard)
33139      // 0x0002 - "dil 12" // standard input (motherboard)
33140      // 0x0004 - "dil 13" // standard input (motherboard)
33141      // 0x0008 - "dil 14" // standard input (motherboard)
33142      // 0x0010 - "dil 15" // standard input (motherboard)
33143      PORT_MODIFY("IN-19")
33144      // 0x0001 - "dil 16" // standard input (motherboard)
33145      PORT_MODIFY("IN-20")
33146      // 0x0001 - "test" // standard input (motherboard)
33147      // 0x0002 - "lock" // standard input (expected here)
33148      // 0x0004 - "topdor" // standard input (expected here)
33149      // 0x0008 - "botdor" // standard input (expected here)
33150      // 0x0010 - "hopdmp" // standard input (expected here)
3315133151INPUT_PORTS_END
3315233152
3315333153// PR2025 BLOCK BUSTER         BUSTERSND           BLOCK BUSTER
r31373r31374
3317833178}
3317933179
3318033180INPUT_PORTS_START( sc4onup ) // this structure is generated
33181        PORT_INCLUDE( sc4_base )
33182        PORT_MODIFY("IN-1")
33183        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33184        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
33185        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
33186        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
33187        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
33188        PORT_MODIFY("IN-2")
33189        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
33190        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33191        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33192        PORT_MODIFY("IN-8")
33193        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("step")
33194        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("rgt hi")
33195        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("rgt lo")
33196        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lef lo")
33197        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lef hi")
33198        PORT_MODIFY("IN-9")
33199        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("mid hi")
33200        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("rgt hi")
33201        PORT_MODIFY("IN-16")
33202        // 0x0001 - "dil  1" // standard input (motherboard)
33203        // 0x0002 - "dil  2" // standard input (motherboard)
33204        // 0x0004 - "dil  3" // standard input (motherboard)
33205        // 0x0008 - "dil  4" // standard input (motherboard)
33206        // 0x0010 - "dil  5" // standard input (motherboard)
33207        // 0x0100 - "top up" // known extended input, usually 'top up'
33208        PORT_MODIFY("IN-17")
33209        // 0x0001 - "dil  6" // standard input (motherboard)
33210        // 0x0002 - "dil  7" // standard input (motherboard)
33211        // 0x0004 - "dil  8" // standard input (motherboard)
33212        // 0x0008 - "dil  9" // standard input (motherboard)
33213        // 0x0010 - "dil 10" // standard input (motherboard)
33214        PORT_MODIFY("IN-18")
33215        // 0x0001 - "dil 11" // standard input (motherboard)
33216        // 0x0002 - "dil 12" // standard input (motherboard)
33217        // 0x0004 - "dil 13" // standard input (motherboard)
33218        // 0x0008 - "dil 14" // standard input (motherboard)
33219        // 0x0010 - "dil 15" // standard input (motherboard)
33220        PORT_MODIFY("IN-19")
33221        // 0x0001 - "dil 16" // standard input (motherboard)
33222        PORT_MODIFY("IN-20")
33223        // 0x0001 - "testsw" // standard input (motherboard)
33224        // 0x0002 - "dor lk" // standard input (expected here)
33225        // 0x0004 - "tp dor" // standard input (expected here)
33226        // 0x0008 - "csh bx" // standard input (expected here)
33227        // 0x0010 - "deflt" // standard input (expected here)
33181      PORT_INCLUDE( sc4_base )
33182      PORT_MODIFY("IN-1")
33183      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33184      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
33185      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
33186      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
33187      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
33188      PORT_MODIFY("IN-2")
33189      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
33190      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33191      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33192      PORT_MODIFY("IN-8")
33193      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("step")
33194      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("rgt hi")
33195      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("rgt lo")
33196      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lef lo")
33197      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lef hi")
33198      PORT_MODIFY("IN-9")
33199      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("mid hi")
33200      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("rgt hi")
33201      PORT_MODIFY("IN-16")
33202      // 0x0001 - "dil  1" // standard input (motherboard)
33203      // 0x0002 - "dil  2" // standard input (motherboard)
33204      // 0x0004 - "dil  3" // standard input (motherboard)
33205      // 0x0008 - "dil  4" // standard input (motherboard)
33206      // 0x0010 - "dil  5" // standard input (motherboard)
33207      // 0x0100 - "top up" // known extended input, usually 'top up'
33208      PORT_MODIFY("IN-17")
33209      // 0x0001 - "dil  6" // standard input (motherboard)
33210      // 0x0002 - "dil  7" // standard input (motherboard)
33211      // 0x0004 - "dil  8" // standard input (motherboard)
33212      // 0x0008 - "dil  9" // standard input (motherboard)
33213      // 0x0010 - "dil 10" // standard input (motherboard)
33214      PORT_MODIFY("IN-18")
33215      // 0x0001 - "dil 11" // standard input (motherboard)
33216      // 0x0002 - "dil 12" // standard input (motherboard)
33217      // 0x0004 - "dil 13" // standard input (motherboard)
33218      // 0x0008 - "dil 14" // standard input (motherboard)
33219      // 0x0010 - "dil 15" // standard input (motherboard)
33220      PORT_MODIFY("IN-19")
33221      // 0x0001 - "dil 16" // standard input (motherboard)
33222      PORT_MODIFY("IN-20")
33223      // 0x0001 - "testsw" // standard input (motherboard)
33224      // 0x0002 - "dor lk" // standard input (expected here)
33225      // 0x0004 - "tp dor" // standard input (expected here)
33226      // 0x0008 - "csh bx" // standard input (expected here)
33227      // 0x0010 - "deflt" // standard input (expected here)
3322833228INPUT_PORTS_END
3322933229
3323033230//  PR2076 ON THE UP         HYPE SOUNDS         ON THE UP
r31373r31374
3324833248}
3324933249
3325033250INPUT_PORTS_START( sc4hyper ) // this structure is generated
33251        PORT_INCLUDE( sc4_base )
33252        PORT_MODIFY("IN-1")
33253        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33254        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
33255        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
33256        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
33257        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
33258        PORT_MODIFY("IN-2")
33259        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
33260        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33261        PORT_MODIFY("IN-8")
33262        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
33263        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("rgt lo")
33264        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("mid lo")
33265        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lef lo")
33266        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lef hi")
33267        PORT_MODIFY("IN-9")
33268        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("mid hi")
33269        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("rgt hi")
33270        PORT_MODIFY("IN-16")
33271        // 0x0001 - "dil  1" // standard input (motherboard)
33272        // 0x0002 - "dil  2" // standard input (motherboard)
33273        // 0x0004 - "dil  3" // standard input (motherboard)
33274        // 0x0008 - "dil  4" // standard input (motherboard)
33275        // 0x0010 - "dil  5" // standard input (motherboard)
33276        // 0x0100 - "top up" // known extended input, usually 'top up'
33277        PORT_MODIFY("IN-17")
33278        // 0x0001 - "dil  6" // standard input (motherboard)
33279        // 0x0002 - "dil  7" // standard input (motherboard)
33280        // 0x0004 - "dil  8" // standard input (motherboard)
33281        // 0x0008 - "dil  9" // standard input (motherboard)
33282        // 0x0010 - "dil 10" // standard input (motherboard)
33283        PORT_MODIFY("IN-18")
33284        // 0x0001 - "dil 11" // standard input (motherboard)
33285        // 0x0002 - "dil 12" // standard input (motherboard)
33286        // 0x0004 - "dil 13" // standard input (motherboard)
33287        // 0x0008 - "dil 14" // standard input (motherboard)
33288        // 0x0010 - "dil 15" // standard input (motherboard)
33289        PORT_MODIFY("IN-19")
33290        // 0x0001 - "dil 16" // standard input (motherboard)
33291        PORT_MODIFY("IN-20")
33292        // 0x0001 - "testsw" // standard input (motherboard)
33293        // 0x0002 - "dor lk" // standard input (expected here)
33294        // 0x0004 - "tp dor" // standard input (expected here)
33295        // 0x0008 - "csh bx" // standard input (expected here)
33296        // 0x0010 - "deflt" // standard input (expected here)
33251      PORT_INCLUDE( sc4_base )
33252      PORT_MODIFY("IN-1")
33253      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33254      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
33255      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
33256      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
33257      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
33258      PORT_MODIFY("IN-2")
33259      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
33260      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33261      PORT_MODIFY("IN-8")
33262      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
33263      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("rgt lo")
33264      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("mid lo")
33265      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lef lo")
33266      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lef hi")
33267      PORT_MODIFY("IN-9")
33268      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("mid hi")
33269      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("rgt hi")
33270      PORT_MODIFY("IN-16")
33271      // 0x0001 - "dil  1" // standard input (motherboard)
33272      // 0x0002 - "dil  2" // standard input (motherboard)
33273      // 0x0004 - "dil  3" // standard input (motherboard)
33274      // 0x0008 - "dil  4" // standard input (motherboard)
33275      // 0x0010 - "dil  5" // standard input (motherboard)
33276      // 0x0100 - "top up" // known extended input, usually 'top up'
33277      PORT_MODIFY("IN-17")
33278      // 0x0001 - "dil  6" // standard input (motherboard)
33279      // 0x0002 - "dil  7" // standard input (motherboard)
33280      // 0x0004 - "dil  8" // standard input (motherboard)
33281      // 0x0008 - "dil  9" // standard input (motherboard)
33282      // 0x0010 - "dil 10" // standard input (motherboard)
33283      PORT_MODIFY("IN-18")
33284      // 0x0001 - "dil 11" // standard input (motherboard)
33285      // 0x0002 - "dil 12" // standard input (motherboard)
33286      // 0x0004 - "dil 13" // standard input (motherboard)
33287      // 0x0008 - "dil 14" // standard input (motherboard)
33288      // 0x0010 - "dil 15" // standard input (motherboard)
33289      PORT_MODIFY("IN-19")
33290      // 0x0001 - "dil 16" // standard input (motherboard)
33291      PORT_MODIFY("IN-20")
33292      // 0x0001 - "testsw" // standard input (motherboard)
33293      // 0x0002 - "dor lk" // standard input (expected here)
33294      // 0x0004 - "tp dor" // standard input (expected here)
33295      // 0x0008 - "csh bx" // standard input (expected here)
33296      // 0x0010 - "deflt" // standard input (expected here)
3329733297INPUT_PORTS_END
3329833298
3329933299//  PR2053 HYPERACTIVEL         HYPE SOUNDS         HYPERACTIVE
r31373r31374
3331833318}
3331933319
3332033320INPUT_PORTS_START( sc4pglcl ) // this structure is generated
33321        PORT_INCLUDE( sc4_base )
33322        PORT_MODIFY("IN-1")
33323        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("hold1")
33324        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold2 OR high")
33325        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold3 OR low")
33326        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold4")
33327        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("cancel")
33328        PORT_MODIFY("IN-2")
33329        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stpcol")
33330        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
33331        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
33332        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33333        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
33334        PORT_MODIFY("IN-4")
33335        // 0x0001 - "hop2lo" // unexpected here
33336        // 0x0002 - "hop1lo OR hop lo" // known extended(?) input, sometimes 'hop hi'
33337        PORT_MODIFY("IN-16")
33338        // 0x0001 - "dil 1" // standard input (motherboard)
33339        // 0x0002 - "dil 2" // standard input (motherboard)
33340        // 0x0004 - "dil 3" // standard input (motherboard)
33341        // 0x0008 - "dil 4" // standard input (motherboard)
33342        // 0x0010 - "dil 5" // standard input (motherboard)
33343        // 0x0100 - "top up" // known extended input, usually 'top up'
33344        PORT_MODIFY("IN-17")
33345        // 0x0001 - "dil 6" // standard input (motherboard)
33346        // 0x0002 - "dil 7" // standard input (motherboard)
33347        // 0x0004 - "dil 8" // standard input (motherboard)
33348        // 0x0008 - "dil 9" // standard input (motherboard)
33349        // 0x0010 - "dil10" // standard input (motherboard)
33350        PORT_MODIFY("IN-18")
33351        // 0x0001 - "dil11" // standard input (motherboard)
33352        // 0x0002 - "dil12" // standard input (motherboard)
33353        // 0x0004 - "dil13" // standard input (motherboard)
33354        // 0x0008 - "dil14" // standard input (motherboard)
33355        // 0x0010 - "dil15" // standard input (motherboard)
33356        PORT_MODIFY("IN-19")
33357        // 0x0001 - "dil16" // standard input (motherboard)
33358        PORT_MODIFY("IN-20")
33359        // 0x0001 - "grnbut" // standard input (motherboard)
33360        // 0x0002 - "dorlok" // standard input (expected here)
33361        // 0x0004 - "topdor" // standard input (expected here)
33362        // 0x0008 - "botdor" // standard input (expected here)
33363        // 0x0010 - "hopdmp" // standard input (expected here)
33321      PORT_INCLUDE( sc4_base )
33322      PORT_MODIFY("IN-1")
33323      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("hold1")
33324      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold2 OR high")
33325      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold3 OR low")
33326      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold4")
33327      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("cancel")
33328      PORT_MODIFY("IN-2")
33329      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stpcol")
33330      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
33331      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
33332      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33333      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
33334      PORT_MODIFY("IN-4")
33335      // 0x0001 - "hop2lo" // unexpected here
33336      // 0x0002 - "hop1lo OR hop lo" // known extended(?) input, sometimes 'hop hi'
33337      PORT_MODIFY("IN-16")
33338      // 0x0001 - "dil 1" // standard input (motherboard)
33339      // 0x0002 - "dil 2" // standard input (motherboard)
33340      // 0x0004 - "dil 3" // standard input (motherboard)
33341      // 0x0008 - "dil 4" // standard input (motherboard)
33342      // 0x0010 - "dil 5" // standard input (motherboard)
33343      // 0x0100 - "top up" // known extended input, usually 'top up'
33344      PORT_MODIFY("IN-17")
33345      // 0x0001 - "dil 6" // standard input (motherboard)
33346      // 0x0002 - "dil 7" // standard input (motherboard)
33347      // 0x0004 - "dil 8" // standard input (motherboard)
33348      // 0x0008 - "dil 9" // standard input (motherboard)
33349      // 0x0010 - "dil10" // standard input (motherboard)
33350      PORT_MODIFY("IN-18")
33351      // 0x0001 - "dil11" // standard input (motherboard)
33352      // 0x0002 - "dil12" // standard input (motherboard)
33353      // 0x0004 - "dil13" // standard input (motherboard)
33354      // 0x0008 - "dil14" // standard input (motherboard)
33355      // 0x0010 - "dil15" // standard input (motherboard)
33356      PORT_MODIFY("IN-19")
33357      // 0x0001 - "dil16" // standard input (motherboard)
33358      PORT_MODIFY("IN-20")
33359      // 0x0001 - "grnbut" // standard input (motherboard)
33360      // 0x0002 - "dorlok" // standard input (expected here)
33361      // 0x0004 - "topdor" // standard input (expected here)
33362      // 0x0008 - "botdor" // standard input (expected here)
33363      // 0x0010 - "hopdmp" // standard input (expected here)
3336433364INPUT_PORTS_END
3336533365
3336633366// PR1623 PHARAOHS GOLD         PHARAOHS GOLD CLUB  PR1623 CLASS PHAR GOLD SOUNDS11
r31373r31374
3339733397}
3339833398
3339933399INPUT_PORTS_START( sc4po8 ) // this structure is generated
33400        PORT_INCLUDE( sc4_base )
33401        PORT_MODIFY("IN-1")
33402        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33403        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
33404        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
33405        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
33406        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
33407        PORT_MODIFY("IN-2")
33408        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
33409        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33410        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33411        PORT_MODIFY("IN-8")
33412        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("right")
33413        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("up")
33414        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
33415        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nudge")
33416        PORT_MODIFY("IN-16")
33417        // 0x0001 - "dil  1" // standard input (motherboard)
33418        // 0x0002 - "dil  2" // standard input (motherboard)
33419        // 0x0004 - "dil  3" // standard input (motherboard)
33420        // 0x0008 - "dil  4" // standard input (motherboard)
33421        // 0x0010 - "dil  5" // standard input (motherboard)
33422        // 0x0100 - "topup" // known extended input, usually 'top up'
33423        PORT_MODIFY("IN-17")
33424        // 0x0001 - "dil  6" // standard input (motherboard)
33425        // 0x0002 - "dil  7" // standard input (motherboard)
33426        // 0x0004 - "dil  8" // standard input (motherboard)
33427        // 0x0008 - "dil  9" // standard input (motherboard)
33428        // 0x0010 - "dil 10" // standard input (motherboard)
33429        PORT_MODIFY("IN-18")
33430        // 0x0001 - "dil 11" // standard input (motherboard)
33431        // 0x0002 - "dil 12" // standard input (motherboard)
33432        // 0x0004 - "dil 13" // standard input (motherboard)
33433        // 0x0008 - "dil 14" // standard input (motherboard)
33434        // 0x0010 - "dil 15" // standard input (motherboard)
33435        PORT_MODIFY("IN-19")
33436        // 0x0001 - "dil 16" // standard input (motherboard)
33437        PORT_MODIFY("IN-20")
33438        // 0x0001 - "test" // standard input (motherboard)
33439        // 0x0002 - "lock" // standard input (expected here)
33440        // 0x0004 - "topdor" // standard input (expected here)
33441        // 0x0008 - "botdor" // standard input (expected here)
33442        // 0x0010 - "hopdmp" // standard input (expected here)
33400      PORT_INCLUDE( sc4_base )
33401      PORT_MODIFY("IN-1")
33402      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33403      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
33404      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
33405      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
33406      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
33407      PORT_MODIFY("IN-2")
33408      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
33409      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33410      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33411      PORT_MODIFY("IN-8")
33412      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("right")
33413      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("up")
33414      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
33415      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nudge")
33416      PORT_MODIFY("IN-16")
33417      // 0x0001 - "dil  1" // standard input (motherboard)
33418      // 0x0002 - "dil  2" // standard input (motherboard)
33419      // 0x0004 - "dil  3" // standard input (motherboard)
33420      // 0x0008 - "dil  4" // standard input (motherboard)
33421      // 0x0010 - "dil  5" // standard input (motherboard)
33422      // 0x0100 - "topup" // known extended input, usually 'top up'
33423      PORT_MODIFY("IN-17")
33424      // 0x0001 - "dil  6" // standard input (motherboard)
33425      // 0x0002 - "dil  7" // standard input (motherboard)
33426      // 0x0004 - "dil  8" // standard input (motherboard)
33427      // 0x0008 - "dil  9" // standard input (motherboard)
33428      // 0x0010 - "dil 10" // standard input (motherboard)
33429      PORT_MODIFY("IN-18")
33430      // 0x0001 - "dil 11" // standard input (motherboard)
33431      // 0x0002 - "dil 12" // standard input (motherboard)
33432      // 0x0004 - "dil 13" // standard input (motherboard)
33433      // 0x0008 - "dil 14" // standard input (motherboard)
33434      // 0x0010 - "dil 15" // standard input (motherboard)
33435      PORT_MODIFY("IN-19")
33436      // 0x0001 - "dil 16" // standard input (motherboard)
33437      PORT_MODIFY("IN-20")
33438      // 0x0001 - "test" // standard input (motherboard)
33439      // 0x0002 - "lock" // standard input (expected here)
33440      // 0x0004 - "topdor" // standard input (expected here)
33441      // 0x0008 - "botdor" // standard input (expected here)
33442      // 0x0010 - "hopdmp" // standard input (expected here)
3344333443INPUT_PORTS_END
3344433444
3344533445// PR2530 PIECES OF EIGHT V1.0         PIECESOFEIGHTSND         PIECES OF EIGHT
r31373r31374
3348433484}
3348533485
3348633486INPUT_PORTS_START( sc4adjb ) // this structure is generated
33487        PORT_INCLUDE( sc4_base )
33488        PORT_MODIFY("IN-1")
33489        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33490        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
33491        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
33492        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
33493        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
33494        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
33495        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
33496        PORT_MODIFY("IN-2")
33497        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
33498        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
33499        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33500        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33501        PORT_MODIFY("IN-3")
33502        // 0x0004 - "stk 4" // standard input (expected here)
33503        // 0x0008 - "stk 3" // standard input (expected here)
33504        // 0x0010 - "stk 2" // standard input (expected here)
33505        PORT_MODIFY("IN-5")
33506        // 0x0001 - "priz4" // standard input (expected here)
33507        // 0x0002 - "priz3" // standard input (expected here)
33508        // 0x0004 - "priz2" // standard input (expected here)
33509        // 0x0008 - "priz1" // standard input (expected here)
33510        PORT_MODIFY("IN-6")
33511        // 0x0001 - "perc1" // standard input (expected here)
33512        // 0x0002 - "perc2" // standard input (expected here)
33513        // 0x0004 - "perc3" // standard input (expected here)
33514        // 0x0008 - "perc4" // standard input (expected here)
33515        PORT_MODIFY("IN-8")
33516        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("b gamb")
33517        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("leave")
33518        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("jiggy")
33519        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take")
33520        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("streak")
33521        PORT_MODIFY("IN-16")
33522        // 0x0001 - "dil1" // standard input (motherboard)
33523        // 0x0002 - "dil2" // standard input (motherboard)
33524        // 0x0004 - "dil3" // standard input (motherboard)
33525        // 0x0008 - "dil4" // standard input (motherboard)
33526        // 0x0010 - "dil5" // standard input (motherboard)
33527        // 0x0100 - "top up" // known extended input, usually 'top up'
33528        PORT_MODIFY("IN-17")
33529        // 0x0001 - "dil6" // standard input (motherboard)
33530        // 0x0002 - "dil7" // standard input (motherboard)
33531        // 0x0004 - "dil8" // standard input (motherboard)
33532        // 0x0008 - "dil9" // standard input (motherboard)
33533        // 0x0010 - "dil10" // standard input (motherboard)
33534        PORT_MODIFY("IN-18")
33535        // 0x0001 - "dil11" // standard input (motherboard)
33536        // 0x0002 - "dil12" // standard input (motherboard)
33537        // 0x0004 - "dil13" // standard input (motherboard)
33538        // 0x0008 - "dil14" // standard input (motherboard)
33539        // 0x0010 - "dil15" // standard input (motherboard)
33540        PORT_MODIFY("IN-19")
33541        // 0x0001 - "dil16" // standard input (motherboard)
33542        PORT_MODIFY("IN-20")
33543        // 0x0001 - "grnbut" // standard input (motherboard)
33544        // 0x0002 - "dorlok" // standard input (expected here)
33545        // 0x0004 - "serdor" // standard input (expected here)
33546        // 0x0008 - "cshdor" // standard input (expected here)
33547        // 0x0010 - "hopdmp" // standard input (expected here)
33487      PORT_INCLUDE( sc4_base )
33488      PORT_MODIFY("IN-1")
33489      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33490      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
33491      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
33492      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
33493      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
33494      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
33495      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
33496      PORT_MODIFY("IN-2")
33497      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
33498      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
33499      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33500      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33501      PORT_MODIFY("IN-3")
33502      // 0x0004 - "stk 4" // standard input (expected here)
33503      // 0x0008 - "stk 3" // standard input (expected here)
33504      // 0x0010 - "stk 2" // standard input (expected here)
33505      PORT_MODIFY("IN-5")
33506      // 0x0001 - "priz4" // standard input (expected here)
33507      // 0x0002 - "priz3" // standard input (expected here)
33508      // 0x0004 - "priz2" // standard input (expected here)
33509      // 0x0008 - "priz1" // standard input (expected here)
33510      PORT_MODIFY("IN-6")
33511      // 0x0001 - "perc1" // standard input (expected here)
33512      // 0x0002 - "perc2" // standard input (expected here)
33513      // 0x0004 - "perc3" // standard input (expected here)
33514      // 0x0008 - "perc4" // standard input (expected here)
33515      PORT_MODIFY("IN-8")
33516      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("b gamb")
33517      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("leave")
33518      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("jiggy")
33519      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take")
33520      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("streak")
33521      PORT_MODIFY("IN-16")
33522      // 0x0001 - "dil1" // standard input (motherboard)
33523      // 0x0002 - "dil2" // standard input (motherboard)
33524      // 0x0004 - "dil3" // standard input (motherboard)
33525      // 0x0008 - "dil4" // standard input (motherboard)
33526      // 0x0010 - "dil5" // standard input (motherboard)
33527      // 0x0100 - "top up" // known extended input, usually 'top up'
33528      PORT_MODIFY("IN-17")
33529      // 0x0001 - "dil6" // standard input (motherboard)
33530      // 0x0002 - "dil7" // standard input (motherboard)
33531      // 0x0004 - "dil8" // standard input (motherboard)
33532      // 0x0008 - "dil9" // standard input (motherboard)
33533      // 0x0010 - "dil10" // standard input (motherboard)
33534      PORT_MODIFY("IN-18")
33535      // 0x0001 - "dil11" // standard input (motherboard)
33536      // 0x0002 - "dil12" // standard input (motherboard)
33537      // 0x0004 - "dil13" // standard input (motherboard)
33538      // 0x0008 - "dil14" // standard input (motherboard)
33539      // 0x0010 - "dil15" // standard input (motherboard)
33540      PORT_MODIFY("IN-19")
33541      // 0x0001 - "dil16" // standard input (motherboard)
33542      PORT_MODIFY("IN-20")
33543      // 0x0001 - "grnbut" // standard input (motherboard)
33544      // 0x0002 - "dorlok" // standard input (expected here)
33545      // 0x0004 - "serdor" // standard input (expected here)
33546      // 0x0008 - "cshdor" // standard input (expected here)
33547      // 0x0010 - "hopdmp" // standard input (expected here)
3354833548INPUT_PORTS_END
3354933549
3355033550// PR3039 AWP ANT N DECS JIGGY BANK S4         PR3009 JIGGY BANK SOUNDS11        JIGGY BANK  S.SITE
r31373r31374
3357633576}
3357733577
3357833578INPUT_PORTS_START( sc4adwta ) // this structure is generated
33579        PORT_INCLUDE( sc4_base )
33580        PORT_MODIFY("IN-1")
33581        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33582        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
33583        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
33584        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
33585        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 4")
33586        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
33587        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
33588        PORT_MODIFY("IN-2")
33589        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("cstake")
33590        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("colect")
33591        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
33592        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33593        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
33594        PORT_MODIFY("IN-3")
33595        // 0x0004 - "stk 4" // standard input (expected here)
33596        // 0x0008 - "stk 2" // standard input (expected here)
33597        // 0x0010 - "stk 3" // standard input (expected here)
33598        PORT_MODIFY("IN-5")
33599        // 0x0001 - "priz4" // standard input (expected here)
33600        // 0x0002 - "priz3" // standard input (expected here)
33601        // 0x0004 - "priz2" // standard input (expected here)
33602        // 0x0008 - "priz1" // standard input (expected here)
33603        PORT_MODIFY("IN-6")
33604        // 0x0001 - "perc1" // standard input (expected here)
33605        // 0x0002 - "perc2" // standard input (expected here)
33606        // 0x0004 - "perc3" // standard input (expected here)
33607        // 0x0008 - "perc4" // standard input (expected here)
33608        PORT_MODIFY("IN-8")
33609        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("no")
33610        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("useky")
33611        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("yes")
33612        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("big gm")
33613        PORT_MODIFY("IN-16")
33614        // 0x0001 - "dil1" // standard input (motherboard)
33615        // 0x0002 - "dil2" // standard input (motherboard)
33616        // 0x0004 - "dil3" // standard input (motherboard)
33617        // 0x0008 - "dil4" // standard input (motherboard)
33618        // 0x0010 - "dil5" // standard input (motherboard)
33619        // 0x0100 - "top up" // known extended input, usually 'top up'
33620        PORT_MODIFY("IN-17")
33621        // 0x0001 - "dil6" // standard input (motherboard)
33622        // 0x0002 - "dil7" // standard input (motherboard)
33623        // 0x0004 - "dil8" // standard input (motherboard)
33624        // 0x0008 - "dil9" // standard input (motherboard)
33625        // 0x0010 - "dil10" // standard input (motherboard)
33626        PORT_MODIFY("IN-18")
33627        // 0x0001 - "dil11" // standard input (motherboard)
33628        // 0x0002 - "dil12" // standard input (motherboard)
33629        // 0x0004 - "dil13" // standard input (motherboard)
33630        // 0x0008 - "dil14" // standard input (motherboard)
33631        // 0x0010 - "dil15" // standard input (motherboard)
33632        PORT_MODIFY("IN-19")
33633        // 0x0001 - "dil16" // standard input (motherboard)
33634        PORT_MODIFY("IN-20")
33635        // 0x0001 - "grnbut" // standard input (motherboard)
33636        // 0x0002 - "dorlok" // standard input (expected here)
33637        // 0x0004 - "serdor" // standard input (expected here)
33638        // 0x0008 - "cshdor" // standard input (expected here)
33639        // 0x0010 - "hopdmp" // standard input (expected here)
33579      PORT_INCLUDE( sc4_base )
33580      PORT_MODIFY("IN-1")
33581      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33582      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
33583      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
33584      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
33585      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 4")
33586      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
33587      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
33588      PORT_MODIFY("IN-2")
33589      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("cstake")
33590      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("colect")
33591      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
33592      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33593      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
33594      PORT_MODIFY("IN-3")
33595      // 0x0004 - "stk 4" // standard input (expected here)
33596      // 0x0008 - "stk 2" // standard input (expected here)
33597      // 0x0010 - "stk 3" // standard input (expected here)
33598      PORT_MODIFY("IN-5")
33599      // 0x0001 - "priz4" // standard input (expected here)
33600      // 0x0002 - "priz3" // standard input (expected here)
33601      // 0x0004 - "priz2" // standard input (expected here)
33602      // 0x0008 - "priz1" // standard input (expected here)
33603      PORT_MODIFY("IN-6")
33604      // 0x0001 - "perc1" // standard input (expected here)
33605      // 0x0002 - "perc2" // standard input (expected here)
33606      // 0x0004 - "perc3" // standard input (expected here)
33607      // 0x0008 - "perc4" // standard input (expected here)
33608      PORT_MODIFY("IN-8")
33609      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("no")
33610      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("useky")
33611      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("yes")
33612      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("big gm")
33613      PORT_MODIFY("IN-16")
33614      // 0x0001 - "dil1" // standard input (motherboard)
33615      // 0x0002 - "dil2" // standard input (motherboard)
33616      // 0x0004 - "dil3" // standard input (motherboard)
33617      // 0x0008 - "dil4" // standard input (motherboard)
33618      // 0x0010 - "dil5" // standard input (motherboard)
33619      // 0x0100 - "top up" // known extended input, usually 'top up'
33620      PORT_MODIFY("IN-17")
33621      // 0x0001 - "dil6" // standard input (motherboard)
33622      // 0x0002 - "dil7" // standard input (motherboard)
33623      // 0x0004 - "dil8" // standard input (motherboard)
33624      // 0x0008 - "dil9" // standard input (motherboard)
33625      // 0x0010 - "dil10" // standard input (motherboard)
33626      PORT_MODIFY("IN-18")
33627      // 0x0001 - "dil11" // standard input (motherboard)
33628      // 0x0002 - "dil12" // standard input (motherboard)
33629      // 0x0004 - "dil13" // standard input (motherboard)
33630      // 0x0008 - "dil14" // standard input (motherboard)
33631      // 0x0010 - "dil15" // standard input (motherboard)
33632      PORT_MODIFY("IN-19")
33633      // 0x0001 - "dil16" // standard input (motherboard)
33634      PORT_MODIFY("IN-20")
33635      // 0x0001 - "grnbut" // standard input (motherboard)
33636      // 0x0002 - "dorlok" // standard input (expected here)
33637      // 0x0004 - "serdor" // standard input (expected here)
33638      // 0x0008 - "cshdor" // standard input (expected here)
33639      // 0x0010 - "hopdmp" // standard input (expected here)
3364033640INPUT_PORTS_END
3364133641
3364233642// PR1940 AWP ANT N DECS WTAD S4         PR1940 ADSNT SHOWTIME SOUNDS11    ANTNDECSWTAD  S.SITE
r31373r31374
3366033660}
3366133661
3366233662INPUT_PORTS_START( sc4a40 ) // this structure is generated
33663        PORT_INCLUDE( sc4_base )
33664        PORT_MODIFY("IN-1")
33665        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
33666        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
33667        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
33668        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
33669        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
33670        PORT_MODIFY("IN-2")
33671        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
33672        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
33673        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33674        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33675        PORT_MODIFY("IN-8")
33676        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("h cash")
33677        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("h nuds")
33678        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkspin")
33679        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tkcpot")
33680        PORT_MODIFY("IN-16")
33681        // 0x0001 - "dil 1" // standard input (motherboard)
33682        // 0x0002 - "dil 2" // standard input (motherboard)
33683        // 0x0004 - "dil 3" // standard input (motherboard)
33684        // 0x0008 - "dil 4" // standard input (motherboard)
33685        // 0x0010 - "dil 5" // standard input (motherboard)
33686        // 0x0100 - "topup" // known extended input, usually 'top up'
33687        PORT_MODIFY("IN-17")
33688        // 0x0001 - "dil 6" // standard input (motherboard)
33689        // 0x0002 - "dil 7" // standard input (motherboard)
33690        // 0x0004 - "dil 8" // standard input (motherboard)
33691        // 0x0008 - "dil 9" // standard input (motherboard)
33692        // 0x0010 - "dil10" // standard input (motherboard)
33693        PORT_MODIFY("IN-18")
33694        // 0x0001 - "dil11" // standard input (motherboard)
33695        // 0x0002 - "dil12" // standard input (motherboard)
33696        // 0x0004 - "dil13" // standard input (motherboard)
33697        // 0x0008 - "dil14" // standard input (motherboard)
33698        // 0x0010 - "dil15" // standard input (motherboard)
33699        PORT_MODIFY("IN-19")
33700        // 0x0001 - "dil16" // standard input (motherboard)
33701        PORT_MODIFY("IN-20")
33702        // 0x0001 - "test" // standard input (motherboard)
33703        // 0x0002 - "dor lk" // standard input (expected here)
33704        // 0x0004 - "tp dor" // standard input (expected here)
33705        // 0x0008 - "csh bx" // standard input (expected here)
33706        // 0x0010 - "deflt" // standard input (expected here)
33663      PORT_INCLUDE( sc4_base )
33664      PORT_MODIFY("IN-1")
33665      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
33666      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
33667      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
33668      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
33669      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
33670      PORT_MODIFY("IN-2")
33671      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
33672      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
33673      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33674      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33675      PORT_MODIFY("IN-8")
33676      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("h cash")
33677      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("h nuds")
33678      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkspin")
33679      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tkcpot")
33680      PORT_MODIFY("IN-16")
33681      // 0x0001 - "dil 1" // standard input (motherboard)
33682      // 0x0002 - "dil 2" // standard input (motherboard)
33683      // 0x0004 - "dil 3" // standard input (motherboard)
33684      // 0x0008 - "dil 4" // standard input (motherboard)
33685      // 0x0010 - "dil 5" // standard input (motherboard)
33686      // 0x0100 - "topup" // known extended input, usually 'top up'
33687      PORT_MODIFY("IN-17")
33688      // 0x0001 - "dil 6" // standard input (motherboard)
33689      // 0x0002 - "dil 7" // standard input (motherboard)
33690      // 0x0004 - "dil 8" // standard input (motherboard)
33691      // 0x0008 - "dil 9" // standard input (motherboard)
33692      // 0x0010 - "dil10" // standard input (motherboard)
33693      PORT_MODIFY("IN-18")
33694      // 0x0001 - "dil11" // standard input (motherboard)
33695      // 0x0002 - "dil12" // standard input (motherboard)
33696      // 0x0004 - "dil13" // standard input (motherboard)
33697      // 0x0008 - "dil14" // standard input (motherboard)
33698      // 0x0010 - "dil15" // standard input (motherboard)
33699      PORT_MODIFY("IN-19")
33700      // 0x0001 - "dil16" // standard input (motherboard)
33701      PORT_MODIFY("IN-20")
33702      // 0x0001 - "test" // standard input (motherboard)
33703      // 0x0002 - "dor lk" // standard input (expected here)
33704      // 0x0004 - "tp dor" // standard input (expected here)
33705      // 0x0008 - "csh bx" // standard input (expected here)
33706      // 0x0010 - "deflt" // standard input (expected here)
3370733707INPUT_PORTS_END
3370833708
3370933709// PR2200 AROUND THE BOARD         AROU SOUNDS         AROUND THE BOARD
r31373r31374
3372933729}
3373033730
3373133731INPUT_PORTS_START( sc4a40cl ) // this structure is generated
33732        PORT_INCLUDE( sc4_base )
33733        PORT_MODIFY("IN-1")
33734        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
33735        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
33736        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
33737        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
33738        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
33739        PORT_MODIFY("IN-2")
33740        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
33741        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
33742        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
33743        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33744        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
33745        PORT_MODIFY("IN-3")
33746        // 0x0004 - "stk 4" // standard input (expected here)
33747        // 0x0008 - "stk 3" // standard input (expected here)
33748        // 0x0010 - "stk 2" // standard input (expected here)
33749        PORT_MODIFY("IN-4")
33750        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
33751        PORT_MODIFY("IN-5")
33752        // 0x0001 - "priz4" // standard input (expected here)
33753        // 0x0002 - "priz3" // standard input (expected here)
33754        // 0x0004 - "priz2" // standard input (expected here)
33755        // 0x0008 - "priz1" // standard input (expected here)
33756        PORT_MODIFY("IN-8")
33757        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
33758        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk mtr")
33759        PORT_MODIFY("IN-16")
33760        // 0x0001 - "dil 1" // standard input (motherboard)
33761        // 0x0002 - "dil 2" // standard input (motherboard)
33762        // 0x0004 - "dil 3" // standard input (motherboard)
33763        // 0x0008 - "dil 4" // standard input (motherboard)
33764        // 0x0010 - "dil 5" // standard input (motherboard)
33765        // 0x0100 - "top up" // known extended input, usually 'top up'
33766        PORT_MODIFY("IN-17")
33767        // 0x0001 - "dil 6" // standard input (motherboard)
33768        // 0x0002 - "dil 7" // standard input (motherboard)
33769        // 0x0004 - "dil 8" // standard input (motherboard)
33770        // 0x0008 - "dil 9" // standard input (motherboard)
33771        // 0x0010 - "dil10" // standard input (motherboard)
33772        PORT_MODIFY("IN-18")
33773        // 0x0001 - "dil11" // standard input (motherboard)
33774        // 0x0002 - "dil12" // standard input (motherboard)
33775        // 0x0004 - "dil13" // standard input (motherboard)
33776        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
33777        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
33778        PORT_MODIFY("IN-19")
33779        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
33780        PORT_MODIFY("IN-20")
33781        // 0x0001 - "grnbut" // standard input (motherboard)
33782        // 0x0002 - "dorlok" // standard input (expected here)
33783        // 0x0004 - "topdor" // standard input (expected here)
33784        // 0x0008 - "botdor" // standard input (expected here)
33785        // 0x0010 - "hopdmp" // standard input (expected here)
33732      PORT_INCLUDE( sc4_base )
33733      PORT_MODIFY("IN-1")
33734      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
33735      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
33736      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
33737      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
33738      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
33739      PORT_MODIFY("IN-2")
33740      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
33741      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
33742      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
33743      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33744      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
33745      PORT_MODIFY("IN-3")
33746      // 0x0004 - "stk 4" // standard input (expected here)
33747      // 0x0008 - "stk 3" // standard input (expected here)
33748      // 0x0010 - "stk 2" // standard input (expected here)
33749      PORT_MODIFY("IN-4")
33750      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
33751      PORT_MODIFY("IN-5")
33752      // 0x0001 - "priz4" // standard input (expected here)
33753      // 0x0002 - "priz3" // standard input (expected here)
33754      // 0x0004 - "priz2" // standard input (expected here)
33755      // 0x0008 - "priz1" // standard input (expected here)
33756      PORT_MODIFY("IN-8")
33757      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
33758      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk mtr")
33759      PORT_MODIFY("IN-16")
33760      // 0x0001 - "dil 1" // standard input (motherboard)
33761      // 0x0002 - "dil 2" // standard input (motherboard)
33762      // 0x0004 - "dil 3" // standard input (motherboard)
33763      // 0x0008 - "dil 4" // standard input (motherboard)
33764      // 0x0010 - "dil 5" // standard input (motherboard)
33765      // 0x0100 - "top up" // known extended input, usually 'top up'
33766      PORT_MODIFY("IN-17")
33767      // 0x0001 - "dil 6" // standard input (motherboard)
33768      // 0x0002 - "dil 7" // standard input (motherboard)
33769      // 0x0004 - "dil 8" // standard input (motherboard)
33770      // 0x0008 - "dil 9" // standard input (motherboard)
33771      // 0x0010 - "dil10" // standard input (motherboard)
33772      PORT_MODIFY("IN-18")
33773      // 0x0001 - "dil11" // standard input (motherboard)
33774      // 0x0002 - "dil12" // standard input (motherboard)
33775      // 0x0004 - "dil13" // standard input (motherboard)
33776      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
33777      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
33778      PORT_MODIFY("IN-19")
33779      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
33780      PORT_MODIFY("IN-20")
33781      // 0x0001 - "grnbut" // standard input (motherboard)
33782      // 0x0002 - "dorlok" // standard input (expected here)
33783      // 0x0004 - "topdor" // standard input (expected here)
33784      // 0x0008 - "botdor" // standard input (expected here)
33785      // 0x0010 - "hopdmp" // standard input (expected here)
3378633786INPUT_PORTS_END
3378733787
3378833788// PR2154 CLUB AROUND BOAR         CLB AROUND BOARD  CLUB  AROU SOUNDS
r31373r31374
3380933809}
3381033810
3381133811INPUT_PORTS_START( sc4bantm ) // this structure is generated
33812        PORT_INCLUDE( sc4_base )
33813        PORT_MODIFY("IN-1")
33814        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
33815        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
33816        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
33817        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
33818        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
33819        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
33820        PORT_MODIFY("IN-2")
33821        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
33822        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
33823        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33824        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33825        PORT_MODIFY("IN-3")
33826        // 0x0004 - "stk3" // standard input (expected here)
33827        // 0x0008 - "stk1" // standard input (expected here)
33828        // 0x0010 - "stk2" // standard input (expected here)
33829        PORT_MODIFY("IN-5")
33830        // 0x0001 - "jp 1" // standard input (expected here)
33831        // 0x0002 - "jp 2" // standard input (expected here)
33832        // 0x0004 - "jp 3" // standard input (expected here)
33833        // 0x0008 - "jp 4" // standard input (expected here)
33834        PORT_MODIFY("IN-6")
33835        // 0x0001 - "pc 1" // standard input (expected here)
33836        // 0x0002 - "pc 2" // standard input (expected here)
33837        // 0x0004 - "pc 3" // standard input (expected here)
33838        // 0x0008 - "pc 4" // standard input (expected here)
33839        PORT_MODIFY("IN-8")
33840        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c hi")
33841        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c lo")
33842        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("b lo")
33843        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("b hi")
33844        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f lo")
33845        PORT_MODIFY("IN-9")
33846        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("f hi")
33847        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("step")
33848        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("shoot")
33849        PORT_MODIFY("IN-16")
33850        // 0x0001 - "dil  1" // standard input (motherboard)
33851        // 0x0002 - "dil  2" // standard input (motherboard)
33852        // 0x0004 - "dil  3" // standard input (motherboard)
33853        // 0x0008 - "dil  4" // standard input (motherboard)
33854        // 0x0010 - "dil  5" // standard input (motherboard)
33855        // 0x0100 - "top up OR top up" // known extended input, usually 'top up'
33856        PORT_MODIFY("IN-17")
33857        // 0x0001 - "dil  6" // standard input (motherboard)
33858        // 0x0002 - "dil  7" // standard input (motherboard)
33859        // 0x0004 - "dil  8" // standard input (motherboard)
33860        // 0x0008 - "dil  9" // standard input (motherboard)
33861        // 0x0010 - "dil 10" // standard input (motherboard)
33862        PORT_MODIFY("IN-18")
33863        // 0x0001 - "dil 11" // standard input (motherboard)
33864        // 0x0002 - "dil 12" // standard input (motherboard)
33865        // 0x0004 - "dil 13" // standard input (motherboard)
33866        // 0x0008 - "dil 14" // standard input (motherboard)
33867        // 0x0010 - "dil 15" // standard input (motherboard)
33868        PORT_MODIFY("IN-19")
33869        // 0x0001 - "dil 16" // standard input (motherboard)
33870        PORT_MODIFY("IN-20")
33871        // 0x0001 - "test" // standard input (motherboard)
33872        // 0x0002 - "dorlk" // standard input (expected here)
33873        // 0x0004 - "topdr" // standard input (expected here)
33874        // 0x0008 - "cshbx" // standard input (expected here)
33875        // 0x0010 - "dump" // standard input (expected here)
33812      PORT_INCLUDE( sc4_base )
33813      PORT_MODIFY("IN-1")
33814      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
33815      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
33816      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
33817      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
33818      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
33819      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
33820      PORT_MODIFY("IN-2")
33821      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
33822      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
33823      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33824      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33825      PORT_MODIFY("IN-3")
33826      // 0x0004 - "stk3" // standard input (expected here)
33827      // 0x0008 - "stk1" // standard input (expected here)
33828      // 0x0010 - "stk2" // standard input (expected here)
33829      PORT_MODIFY("IN-5")
33830      // 0x0001 - "jp 1" // standard input (expected here)
33831      // 0x0002 - "jp 2" // standard input (expected here)
33832      // 0x0004 - "jp 3" // standard input (expected here)
33833      // 0x0008 - "jp 4" // standard input (expected here)
33834      PORT_MODIFY("IN-6")
33835      // 0x0001 - "pc 1" // standard input (expected here)
33836      // 0x0002 - "pc 2" // standard input (expected here)
33837      // 0x0004 - "pc 3" // standard input (expected here)
33838      // 0x0008 - "pc 4" // standard input (expected here)
33839      PORT_MODIFY("IN-8")
33840      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c hi")
33841      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c lo")
33842      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("b lo")
33843      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("b hi")
33844      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f lo")
33845      PORT_MODIFY("IN-9")
33846      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("f hi")
33847      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("step")
33848      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("shoot")
33849      PORT_MODIFY("IN-16")
33850      // 0x0001 - "dil  1" // standard input (motherboard)
33851      // 0x0002 - "dil  2" // standard input (motherboard)
33852      // 0x0004 - "dil  3" // standard input (motherboard)
33853      // 0x0008 - "dil  4" // standard input (motherboard)
33854      // 0x0010 - "dil  5" // standard input (motherboard)
33855      // 0x0100 - "top up OR top up" // known extended input, usually 'top up'
33856      PORT_MODIFY("IN-17")
33857      // 0x0001 - "dil  6" // standard input (motherboard)
33858      // 0x0002 - "dil  7" // standard input (motherboard)
33859      // 0x0004 - "dil  8" // standard input (motherboard)
33860      // 0x0008 - "dil  9" // standard input (motherboard)
33861      // 0x0010 - "dil 10" // standard input (motherboard)
33862      PORT_MODIFY("IN-18")
33863      // 0x0001 - "dil 11" // standard input (motherboard)
33864      // 0x0002 - "dil 12" // standard input (motherboard)
33865      // 0x0004 - "dil 13" // standard input (motherboard)
33866      // 0x0008 - "dil 14" // standard input (motherboard)
33867      // 0x0010 - "dil 15" // standard input (motherboard)
33868      PORT_MODIFY("IN-19")
33869      // 0x0001 - "dil 16" // standard input (motherboard)
33870      PORT_MODIFY("IN-20")
33871      // 0x0001 - "test" // standard input (motherboard)
33872      // 0x0002 - "dorlk" // standard input (expected here)
33873      // 0x0004 - "topdr" // standard input (expected here)
33874      // 0x0008 - "cshbx" // standard input (expected here)
33875      // 0x0010 - "dump" // standard input (expected here)
3387633876INPUT_PORTS_END
3387733877
3387833878// PR2301 BANTAM OF THE OPERA         BANTAM SOUNDS         BANTAMOFTHEOPERA
r31373r31374
3389933899}
3390033900
3390133901INPUT_PORTS_START( sc4bar7 ) // this structure is generated
33902        PORT_INCLUDE( sc4_base )
33903        PORT_MODIFY("IN-1")
33904        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("autply")
33905        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
33906        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
33907        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
33908        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("cancel")
33909        // 0x0100 - "pndlow" // known extended input, usually 'hopper fit'
33910        PORT_MODIFY("IN-2")
33911        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33912        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33913        // 0x0100 - "10plow" // unexpected here
33914        PORT_MODIFY("IN-3")
33915        // 0x0004 - "stk 4" // standard input (expected here)
33916        // 0x0008 - "stk 3" // standard input (expected here)
33917        // 0x0010 - "stk 2" // standard input (expected here)
33918        PORT_MODIFY("IN-5")
33919        // 0x0001 - "priz4" // standard input (expected here)
33920        // 0x0002 - "priz3" // standard input (expected here)
33921        // 0x0004 - "priz2" // standard input (expected here)
33922        // 0x0008 - "priz1" // standard input (expected here)
33923        PORT_MODIFY("IN-6")
33924        // 0x0001 - "perc1" // standard input (expected here)
33925        // 0x0002 - "perc2" // standard input (expected here)
33926        // 0x0004 - "perc3" // standard input (expected here)
33927        // 0x0008 - "perc4" // standard input (expected here)
33928        PORT_MODIFY("IN-16")
33929        // 0x0001 - "dil 1" // standard input (motherboard)
33930        // 0x0002 - "dil 2" // standard input (motherboard)
33931        // 0x0004 - "dil 3" // standard input (motherboard)
33932        // 0x0008 - "dil 4" // standard input (motherboard)
33933        // 0x0010 - "dil 5" // standard input (motherboard)
33934        // 0x0100 - "htopup" // known extended input, usually 'top up'
33935        PORT_MODIFY("IN-17")
33936        // 0x0001 - "dil 6" // standard input (motherboard)
33937        // 0x0002 - "dil 7" // standard input (motherboard)
33938        // 0x0004 - "dil 8" // standard input (motherboard)
33939        // 0x0008 - "dil 9" // standard input (motherboard)
33940        // 0x0010 - "dil10" // standard input (motherboard)
33941        PORT_MODIFY("IN-18")
33942        // 0x0001 - "dil11" // standard input (motherboard)
33943        // 0x0002 - "dil12" // standard input (motherboard)
33944        // 0x0004 - "dil13" // standard input (motherboard)
33945        // 0x0008 - "dil14" // standard input (motherboard)
33946        // 0x0010 - "dil15" // standard input (motherboard)
33947        PORT_MODIFY("IN-19")
33948        // 0x0001 - "dil16" // standard input (motherboard)
33949        PORT_MODIFY("IN-20")
33950        // 0x0001 - "grnbut" // standard input (motherboard)
33951        // 0x0002 - "dorlok" // standard input (expected here)
33952        // 0x0004 - "serdor" // standard input (expected here)
33953        // 0x0008 - "cshdor" // standard input (expected here)
33954        // 0x0010 - "hopdmp" // standard input (expected here)
33902      PORT_INCLUDE( sc4_base )
33903      PORT_MODIFY("IN-1")
33904      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("autply")
33905      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
33906      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
33907      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
33908      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("cancel")
33909      // 0x0100 - "pndlow" // known extended input, usually 'hopper fit'
33910      PORT_MODIFY("IN-2")
33911      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
33912      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33913      // 0x0100 - "10plow" // unexpected here
33914      PORT_MODIFY("IN-3")
33915      // 0x0004 - "stk 4" // standard input (expected here)
33916      // 0x0008 - "stk 3" // standard input (expected here)
33917      // 0x0010 - "stk 2" // standard input (expected here)
33918      PORT_MODIFY("IN-5")
33919      // 0x0001 - "priz4" // standard input (expected here)
33920      // 0x0002 - "priz3" // standard input (expected here)
33921      // 0x0004 - "priz2" // standard input (expected here)
33922      // 0x0008 - "priz1" // standard input (expected here)
33923      PORT_MODIFY("IN-6")
33924      // 0x0001 - "perc1" // standard input (expected here)
33925      // 0x0002 - "perc2" // standard input (expected here)
33926      // 0x0004 - "perc3" // standard input (expected here)
33927      // 0x0008 - "perc4" // standard input (expected here)
33928      PORT_MODIFY("IN-16")
33929      // 0x0001 - "dil 1" // standard input (motherboard)
33930      // 0x0002 - "dil 2" // standard input (motherboard)
33931      // 0x0004 - "dil 3" // standard input (motherboard)
33932      // 0x0008 - "dil 4" // standard input (motherboard)
33933      // 0x0010 - "dil 5" // standard input (motherboard)
33934      // 0x0100 - "htopup" // known extended input, usually 'top up'
33935      PORT_MODIFY("IN-17")
33936      // 0x0001 - "dil 6" // standard input (motherboard)
33937      // 0x0002 - "dil 7" // standard input (motherboard)
33938      // 0x0004 - "dil 8" // standard input (motherboard)
33939      // 0x0008 - "dil 9" // standard input (motherboard)
33940      // 0x0010 - "dil10" // standard input (motherboard)
33941      PORT_MODIFY("IN-18")
33942      // 0x0001 - "dil11" // standard input (motherboard)
33943      // 0x0002 - "dil12" // standard input (motherboard)
33944      // 0x0004 - "dil13" // standard input (motherboard)
33945      // 0x0008 - "dil14" // standard input (motherboard)
33946      // 0x0010 - "dil15" // standard input (motherboard)
33947      PORT_MODIFY("IN-19")
33948      // 0x0001 - "dil16" // standard input (motherboard)
33949      PORT_MODIFY("IN-20")
33950      // 0x0001 - "grnbut" // standard input (motherboard)
33951      // 0x0002 - "dorlok" // standard input (expected here)
33952      // 0x0004 - "serdor" // standard input (expected here)
33953      // 0x0008 - "cshdor" // standard input (expected here)
33954      // 0x0010 - "hopdmp" // standard input (expected here)
3395533955INPUT_PORTS_END
3395633956
3395733957INPUT_PORTS_START( sc4bar7b ) // this structure is generated
33958        PORT_INCLUDE( sc4_base )
33959        PORT_MODIFY("IN-1")
33960        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33961        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
33962        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
33963        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
33964        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("autply")
33965        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("pndlow OR 10plow")
33966        PORT_MODIFY("IN-2")
33967        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trnsfr")
33968        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
33969        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33970        PORT_MODIFY("IN-3")
33971        // 0x0004 - "stk 4" // standard input (expected here)
33972        // 0x0008 - "stk 2" // standard input (expected here)
33973        // 0x0010 - "stk 3" // standard input (expected here)
33974        PORT_MODIFY("IN-4")
33975        // 0x0008 - "htopup" // known extended(?) input, sometimes 'hop top'
33976        PORT_MODIFY("IN-5")
33977        // 0x0001 - "priz4" // standard input (expected here)
33978        // 0x0002 - "priz3" // standard input (expected here)
33979        // 0x0004 - "priz2" // standard input (expected here)
33980        // 0x0008 - "priz1" // standard input (expected here)
33981        PORT_MODIFY("IN-6")
33982        // 0x0001 - "perc1" // standard input (expected here)
33983        // 0x0002 - "perc2" // standard input (expected here)
33984        // 0x0004 - "perc3" // standard input (expected here)
33985        // 0x0008 - "perc4" // standard input (expected here)
33986        PORT_MODIFY("IN-16")
33987        // 0x0001 - "dil 1" // standard input (motherboard)
33988        // 0x0002 - "dil 2" // standard input (motherboard)
33989        // 0x0004 - "dil 3" // standard input (motherboard)
33990        // 0x0008 - "dil 4" // standard input (motherboard)
33991        // 0x0010 - "dil 5" // standard input (motherboard)
33992        PORT_MODIFY("IN-17")
33993        // 0x0001 - "dil 6" // standard input (motherboard)
33994        // 0x0002 - "dil 7" // standard input (motherboard)
33995        // 0x0004 - "dil 8" // standard input (motherboard)
33996        // 0x0008 - "dil 9" // standard input (motherboard)
33997        // 0x0010 - "dil10" // standard input (motherboard)
33998        PORT_MODIFY("IN-18")
33999        // 0x0001 - "dil11" // standard input (motherboard)
34000        // 0x0002 - "dil12" // standard input (motherboard)
34001        // 0x0004 - "dil13" // standard input (motherboard)
34002        // 0x0008 - "dil14" // standard input (motherboard)
34003        // 0x0010 - "dil15" // standard input (motherboard)
34004        PORT_MODIFY("IN-19")
34005        // 0x0001 - "dil16" // standard input (motherboard)
34006        PORT_MODIFY("IN-20")
34007        // 0x0001 - "grnbut" // standard input (motherboard)
34008        // 0x0004 - "serdor" // standard input (expected here)
34009        // 0x0008 - "hopdmp" // standard input (expected here)
34010        // 0x0010 - "cshdor" // standard input (expected here)
33958      PORT_INCLUDE( sc4_base )
33959      PORT_MODIFY("IN-1")
33960      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
33961      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
33962      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
33963      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
33964      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("autply")
33965      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("pndlow OR 10plow")
33966      PORT_MODIFY("IN-2")
33967      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trnsfr")
33968      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
33969      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
33970      PORT_MODIFY("IN-3")
33971      // 0x0004 - "stk 4" // standard input (expected here)
33972      // 0x0008 - "stk 2" // standard input (expected here)
33973      // 0x0010 - "stk 3" // standard input (expected here)
33974      PORT_MODIFY("IN-4")
33975      // 0x0008 - "htopup" // known extended(?) input, sometimes 'hop top'
33976      PORT_MODIFY("IN-5")
33977      // 0x0001 - "priz4" // standard input (expected here)
33978      // 0x0002 - "priz3" // standard input (expected here)
33979      // 0x0004 - "priz2" // standard input (expected here)
33980      // 0x0008 - "priz1" // standard input (expected here)
33981      PORT_MODIFY("IN-6")
33982      // 0x0001 - "perc1" // standard input (expected here)
33983      // 0x0002 - "perc2" // standard input (expected here)
33984      // 0x0004 - "perc3" // standard input (expected here)
33985      // 0x0008 - "perc4" // standard input (expected here)
33986      PORT_MODIFY("IN-16")
33987      // 0x0001 - "dil 1" // standard input (motherboard)
33988      // 0x0002 - "dil 2" // standard input (motherboard)
33989      // 0x0004 - "dil 3" // standard input (motherboard)
33990      // 0x0008 - "dil 4" // standard input (motherboard)
33991      // 0x0010 - "dil 5" // standard input (motherboard)
33992      PORT_MODIFY("IN-17")
33993      // 0x0001 - "dil 6" // standard input (motherboard)
33994      // 0x0002 - "dil 7" // standard input (motherboard)
33995      // 0x0004 - "dil 8" // standard input (motherboard)
33996      // 0x0008 - "dil 9" // standard input (motherboard)
33997      // 0x0010 - "dil10" // standard input (motherboard)
33998      PORT_MODIFY("IN-18")
33999      // 0x0001 - "dil11" // standard input (motherboard)
34000      // 0x0002 - "dil12" // standard input (motherboard)
34001      // 0x0004 - "dil13" // standard input (motherboard)
34002      // 0x0008 - "dil14" // standard input (motherboard)
34003      // 0x0010 - "dil15" // standard input (motherboard)
34004      PORT_MODIFY("IN-19")
34005      // 0x0001 - "dil16" // standard input (motherboard)
34006      PORT_MODIFY("IN-20")
34007      // 0x0001 - "grnbut" // standard input (motherboard)
34008      // 0x0004 - "serdor" // standard input (expected here)
34009      // 0x0008 - "hopdmp" // standard input (expected here)
34010      // 0x0010 - "cshdor" // standard input (expected here)
3401134011INPUT_PORTS_END
3401234012
3401334013// PR1433 BAR7S         PR1433 BAR SEVENS SOUNDS11
r31373r31374
3403734037}
3403834038
3403934039INPUT_PORTS_START( sc4batl ) // this structure is generated
34040        PORT_INCLUDE( sc4_base )
34041        PORT_MODIFY("IN-1")
34042        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
34043        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
34044        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
34045        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
34046        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
34047        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
34048        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34049        PORT_MODIFY("IN-2")
34050        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
34051        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
34052        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34053        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34054        PORT_MODIFY("IN-3")
34055        // 0x0004 - "stk 4" // standard input (expected here)
34056        // 0x0008 - "stk 2" // standard input (expected here)
34057        // 0x0010 - "stk 3" // standard input (expected here)
34058        PORT_MODIFY("IN-5")
34059        // 0x0001 - "priz4" // standard input (expected here)
34060        // 0x0002 - "priz3" // standard input (expected here)
34061        // 0x0004 - "priz2" // standard input (expected here)
34062        // 0x0008 - "priz1" // standard input (expected here)
34063        PORT_MODIFY("IN-6")
34064        // 0x0001 - "perc1" // standard input (expected here)
34065        // 0x0002 - "perc2" // standard input (expected here)
34066        // 0x0004 - "perc3" // standard input (expected here)
34067        // 0x0008 - "perc4" // standard input (expected here)
34068        PORT_MODIFY("IN-8")
34069        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("death")
34070        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shots")
34071        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("featur")
34072        PORT_MODIFY("IN-16")
34073        // 0x0001 - "dil1" // standard input (motherboard)
34074        // 0x0002 - "dil2" // standard input (motherboard)
34075        // 0x0004 - "dil3" // standard input (motherboard)
34076        // 0x0008 - "dil4" // standard input (motherboard)
34077        // 0x0010 - "dil5" // standard input (motherboard)
34078        // 0x0100 - "top up" // known extended input, usually 'top up'
34079        PORT_MODIFY("IN-17")
34080        // 0x0001 - "dil6" // standard input (motherboard)
34081        // 0x0002 - "dil7" // standard input (motherboard)
34082        // 0x0004 - "dil8" // standard input (motherboard)
34083        // 0x0008 - "dil9" // standard input (motherboard)
34084        // 0x0010 - "dil10" // standard input (motherboard)
34085        PORT_MODIFY("IN-18")
34086        // 0x0001 - "dil11" // standard input (motherboard)
34087        // 0x0002 - "dil12" // standard input (motherboard)
34088        // 0x0004 - "dil13" // standard input (motherboard)
34089        // 0x0008 - "dil14" // standard input (motherboard)
34090        // 0x0010 - "dil15" // standard input (motherboard)
34091        PORT_MODIFY("IN-19")
34092        // 0x0001 - "dil16" // standard input (motherboard)
34093        PORT_MODIFY("IN-20")
34094        // 0x0001 - "grnbut" // standard input (motherboard)
34095        // 0x0002 - "dorlok" // standard input (expected here)
34096        // 0x0004 - "serdor" // standard input (expected here)
34097        // 0x0008 - "cshdor" // standard input (expected here)
34098        // 0x0010 - "hopdmp" // standard input (expected here)
34040      PORT_INCLUDE( sc4_base )
34041      PORT_MODIFY("IN-1")
34042      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
34043      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
34044      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
34045      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
34046      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
34047      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
34048      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34049      PORT_MODIFY("IN-2")
34050      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
34051      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
34052      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34053      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34054      PORT_MODIFY("IN-3")
34055      // 0x0004 - "stk 4" // standard input (expected here)
34056      // 0x0008 - "stk 2" // standard input (expected here)
34057      // 0x0010 - "stk 3" // standard input (expected here)
34058      PORT_MODIFY("IN-5")
34059      // 0x0001 - "priz4" // standard input (expected here)
34060      // 0x0002 - "priz3" // standard input (expected here)
34061      // 0x0004 - "priz2" // standard input (expected here)
34062      // 0x0008 - "priz1" // standard input (expected here)
34063      PORT_MODIFY("IN-6")
34064      // 0x0001 - "perc1" // standard input (expected here)
34065      // 0x0002 - "perc2" // standard input (expected here)
34066      // 0x0004 - "perc3" // standard input (expected here)
34067      // 0x0008 - "perc4" // standard input (expected here)
34068      PORT_MODIFY("IN-8")
34069      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("death")
34070      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shots")
34071      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("featur")
34072      PORT_MODIFY("IN-16")
34073      // 0x0001 - "dil1" // standard input (motherboard)
34074      // 0x0002 - "dil2" // standard input (motherboard)
34075      // 0x0004 - "dil3" // standard input (motherboard)
34076      // 0x0008 - "dil4" // standard input (motherboard)
34077      // 0x0010 - "dil5" // standard input (motherboard)
34078      // 0x0100 - "top up" // known extended input, usually 'top up'
34079      PORT_MODIFY("IN-17")
34080      // 0x0001 - "dil6" // standard input (motherboard)
34081      // 0x0002 - "dil7" // standard input (motherboard)
34082      // 0x0004 - "dil8" // standard input (motherboard)
34083      // 0x0008 - "dil9" // standard input (motherboard)
34084      // 0x0010 - "dil10" // standard input (motherboard)
34085      PORT_MODIFY("IN-18")
34086      // 0x0001 - "dil11" // standard input (motherboard)
34087      // 0x0002 - "dil12" // standard input (motherboard)
34088      // 0x0004 - "dil13" // standard input (motherboard)
34089      // 0x0008 - "dil14" // standard input (motherboard)
34090      // 0x0010 - "dil15" // standard input (motherboard)
34091      PORT_MODIFY("IN-19")
34092      // 0x0001 - "dil16" // standard input (motherboard)
34093      PORT_MODIFY("IN-20")
34094      // 0x0001 - "grnbut" // standard input (motherboard)
34095      // 0x0002 - "dorlok" // standard input (expected here)
34096      // 0x0004 - "serdor" // standard input (expected here)
34097      // 0x0008 - "cshdor" // standard input (expected here)
34098      // 0x0010 - "hopdmp" // standard input (expected here)
3409934099INPUT_PORTS_END
3410034100
3410134101// PR1724 AWP BATTLESHIPS AND CRUISERS S4         PR1704 B AND C SOUNDS11         BATTLESHIPSCRUIS  S.SITE
r31373r31374
3412034120}
3412134121
3412234122INPUT_PORTS_START( sc4bull ) // this structure is generated
34123        PORT_INCLUDE( sc4_base )
34124        PORT_MODIFY("IN-1")
34125        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR coll")
34126        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
34127        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
34128        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
34129        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
34130        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
34131        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34132        PORT_MODIFY("IN-2")
34133        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
34134        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
34135        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34136        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34137        PORT_MODIFY("IN-5")
34138        // 0x0001 - "priz4" // standard input (expected here)
34139        // 0x0002 - "priz3" // standard input (expected here)
34140        // 0x0004 - "priz2" // standard input (expected here)
34141        // 0x0008 - "priz1" // standard input (expected here)
34142        PORT_MODIFY("IN-6")
34143        // 0x0001 - "perc1" // standard input (expected here)
34144        // 0x0002 - "perc2" // standard input (expected here)
34145        // 0x0004 - "perc3" // standard input (expected here)
34146        // 0x0008 - "perc4" // standard input (expected here)
34147        PORT_MODIFY("IN-8")
34148        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkstep")
34149        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lorght")
34150        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lomid")
34151        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("loleft")
34152        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hirght")
34153        PORT_MODIFY("IN-9")
34154        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("himid")
34155        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hileft")
34156        PORT_MODIFY("IN-16")
34157        // 0x0001 - "dil1" // standard input (motherboard)
34158        // 0x0002 - "dil2" // standard input (motherboard)
34159        // 0x0004 - "dil3" // standard input (motherboard)
34160        // 0x0008 - "dil4" // standard input (motherboard)
34161        // 0x0010 - "dil5" // standard input (motherboard)
34162        // 0x0100 - "top up" // known extended input, usually 'top up'
34163        PORT_MODIFY("IN-17")
34164        // 0x0001 - "dil6" // standard input (motherboard)
34165        // 0x0002 - "dil7" // standard input (motherboard)
34166        // 0x0004 - "dil8" // standard input (motherboard)
34167        // 0x0008 - "dil9" // standard input (motherboard)
34168        // 0x0010 - "dil10" // standard input (motherboard)
34169        PORT_MODIFY("IN-18")
34170        // 0x0001 - "dil11" // standard input (motherboard)
34171        // 0x0002 - "dil12" // standard input (motherboard)
34172        // 0x0004 - "dil13" // standard input (motherboard)
34173        // 0x0008 - "dil14" // standard input (motherboard)
34174        // 0x0010 - "dil15" // standard input (motherboard)
34175        PORT_MODIFY("IN-19")
34176        // 0x0001 - "dil16" // standard input (motherboard)
34177        PORT_MODIFY("IN-20")
34178        // 0x0001 - "grnbut" // standard input (motherboard)
34179        // 0x0002 - "dorlok" // standard input (expected here)
34180        // 0x0004 - "serdor" // standard input (expected here)
34181        // 0x0008 - "cshdor" // standard input (expected here)
34182        // 0x0010 - "hopdmp" // standard input (expected here)
34123      PORT_INCLUDE( sc4_base )
34124      PORT_MODIFY("IN-1")
34125      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR coll")
34126      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
34127      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
34128      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
34129      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
34130      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
34131      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34132      PORT_MODIFY("IN-2")
34133      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
34134      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
34135      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34136      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34137      PORT_MODIFY("IN-5")
34138      // 0x0001 - "priz4" // standard input (expected here)
34139      // 0x0002 - "priz3" // standard input (expected here)
34140      // 0x0004 - "priz2" // standard input (expected here)
34141      // 0x0008 - "priz1" // standard input (expected here)
34142      PORT_MODIFY("IN-6")
34143      // 0x0001 - "perc1" // standard input (expected here)
34144      // 0x0002 - "perc2" // standard input (expected here)
34145      // 0x0004 - "perc3" // standard input (expected here)
34146      // 0x0008 - "perc4" // standard input (expected here)
34147      PORT_MODIFY("IN-8")
34148      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkstep")
34149      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lorght")
34150      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lomid")
34151      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("loleft")
34152      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hirght")
34153      PORT_MODIFY("IN-9")
34154      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("himid")
34155      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hileft")
34156      PORT_MODIFY("IN-16")
34157      // 0x0001 - "dil1" // standard input (motherboard)
34158      // 0x0002 - "dil2" // standard input (motherboard)
34159      // 0x0004 - "dil3" // standard input (motherboard)
34160      // 0x0008 - "dil4" // standard input (motherboard)
34161      // 0x0010 - "dil5" // standard input (motherboard)
34162      // 0x0100 - "top up" // known extended input, usually 'top up'
34163      PORT_MODIFY("IN-17")
34164      // 0x0001 - "dil6" // standard input (motherboard)
34165      // 0x0002 - "dil7" // standard input (motherboard)
34166      // 0x0004 - "dil8" // standard input (motherboard)
34167      // 0x0008 - "dil9" // standard input (motherboard)
34168      // 0x0010 - "dil10" // standard input (motherboard)
34169      PORT_MODIFY("IN-18")
34170      // 0x0001 - "dil11" // standard input (motherboard)
34171      // 0x0002 - "dil12" // standard input (motherboard)
34172      // 0x0004 - "dil13" // standard input (motherboard)
34173      // 0x0008 - "dil14" // standard input (motherboard)
34174      // 0x0010 - "dil15" // standard input (motherboard)
34175      PORT_MODIFY("IN-19")
34176      // 0x0001 - "dil16" // standard input (motherboard)
34177      PORT_MODIFY("IN-20")
34178      // 0x0001 - "grnbut" // standard input (motherboard)
34179      // 0x0002 - "dorlok" // standard input (expected here)
34180      // 0x0004 - "serdor" // standard input (expected here)
34181      // 0x0008 - "cshdor" // standard input (expected here)
34182      // 0x0010 - "hopdmp" // standard input (expected here)
3418334183INPUT_PORTS_END
3418434184
3418534185// PR1722 AWP BULLSEYE SCORP4         PR1702 BULLSEYE SOUNDS11         BULLSEYE  S.SITE
r31373r31374
3420534205}
3420634206
3420734207INPUT_PORTS_START( sc4bulcs ) // this structure is generated
34208        PORT_INCLUDE( sc4_base )
34209        PORT_MODIFY("IN-1")
34210        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
34211        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
34212        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
34213        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
34214        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
34215        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34216        PORT_MODIFY("IN-2")
34217        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("colect")
34218        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
34219        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34220        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34221        PORT_MODIFY("IN-5")
34222        // 0x0001 - "priz4" // standard input (expected here)
34223        // 0x0002 - "priz3" // standard input (expected here)
34224        // 0x0004 - "priz2" // standard input (expected here)
34225        // 0x0008 - "priz1" // standard input (expected here)
34226        PORT_MODIFY("IN-6")
34227        // 0x0001 - "perc1" // standard input (expected here)
34228        // 0x0002 - "perc2" // standard input (expected here)
34229        // 0x0004 - "perc3" // standard input (expected here)
34230        // 0x0008 - "perc4" // standard input (expected here)
34231        PORT_MODIFY("IN-8")
34232        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkstep")
34233        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lorght")
34234        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lomid")
34235        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("loleft")
34236        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hirght")
34237        PORT_MODIFY("IN-9")
34238        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("himid")
34239        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hileft")
34240        PORT_MODIFY("IN-16")
34241        // 0x0001 - "dil1" // standard input (motherboard)
34242        // 0x0002 - "dil2" // standard input (motherboard)
34243        // 0x0004 - "dil3" // standard input (motherboard)
34244        // 0x0008 - "dil4" // standard input (motherboard)
34245        // 0x0010 - "dil5" // standard input (motherboard)
34246        // 0x0100 - "top up" // known extended input, usually 'top up'
34247        PORT_MODIFY("IN-17")
34248        // 0x0001 - "dil6" // standard input (motherboard)
34249        // 0x0002 - "dil7" // standard input (motherboard)
34250        // 0x0004 - "dil8" // standard input (motherboard)
34251        // 0x0008 - "dil9" // standard input (motherboard)
34252        // 0x0010 - "dil10" // standard input (motherboard)
34253        PORT_MODIFY("IN-18")
34254        // 0x0001 - "dil11" // standard input (motherboard)
34255        // 0x0002 - "dil12" // standard input (motherboard)
34256        // 0x0004 - "dil13" // standard input (motherboard)
34257        // 0x0008 - "dil14" // standard input (motherboard)
34258        // 0x0010 - "dil15" // standard input (motherboard)
34259        PORT_MODIFY("IN-19")
34260        // 0x0001 - "dil16" // standard input (motherboard)
34261        PORT_MODIFY("IN-20")
34262        // 0x0001 - "grnbut" // standard input (motherboard)
34263        // 0x0002 - "dorlok" // standard input (expected here)
34264        // 0x0004 - "serdor" // standard input (expected here)
34265        // 0x0008 - "cshdor" // standard input (expected here)
34266        // 0x0010 - "hopdmp" // standard input (expected here)
34208      PORT_INCLUDE( sc4_base )
34209      PORT_MODIFY("IN-1")
34210      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
34211      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
34212      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
34213      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
34214      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
34215      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34216      PORT_MODIFY("IN-2")
34217      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("colect")
34218      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
34219      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34220      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34221      PORT_MODIFY("IN-5")
34222      // 0x0001 - "priz4" // standard input (expected here)
34223      // 0x0002 - "priz3" // standard input (expected here)
34224      // 0x0004 - "priz2" // standard input (expected here)
34225      // 0x0008 - "priz1" // standard input (expected here)
34226      PORT_MODIFY("IN-6")
34227      // 0x0001 - "perc1" // standard input (expected here)
34228      // 0x0002 - "perc2" // standard input (expected here)
34229      // 0x0004 - "perc3" // standard input (expected here)
34230      // 0x0008 - "perc4" // standard input (expected here)
34231      PORT_MODIFY("IN-8")
34232      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkstep")
34233      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lorght")
34234      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lomid")
34235      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("loleft")
34236      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hirght")
34237      PORT_MODIFY("IN-9")
34238      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("himid")
34239      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hileft")
34240      PORT_MODIFY("IN-16")
34241      // 0x0001 - "dil1" // standard input (motherboard)
34242      // 0x0002 - "dil2" // standard input (motherboard)
34243      // 0x0004 - "dil3" // standard input (motherboard)
34244      // 0x0008 - "dil4" // standard input (motherboard)
34245      // 0x0010 - "dil5" // standard input (motherboard)
34246      // 0x0100 - "top up" // known extended input, usually 'top up'
34247      PORT_MODIFY("IN-17")
34248      // 0x0001 - "dil6" // standard input (motherboard)
34249      // 0x0002 - "dil7" // standard input (motherboard)
34250      // 0x0004 - "dil8" // standard input (motherboard)
34251      // 0x0008 - "dil9" // standard input (motherboard)
34252      // 0x0010 - "dil10" // standard input (motherboard)
34253      PORT_MODIFY("IN-18")
34254      // 0x0001 - "dil11" // standard input (motherboard)
34255      // 0x0002 - "dil12" // standard input (motherboard)
34256      // 0x0004 - "dil13" // standard input (motherboard)
34257      // 0x0008 - "dil14" // standard input (motherboard)
34258      // 0x0010 - "dil15" // standard input (motherboard)
34259      PORT_MODIFY("IN-19")
34260      // 0x0001 - "dil16" // standard input (motherboard)
34261      PORT_MODIFY("IN-20")
34262      // 0x0001 - "grnbut" // standard input (motherboard)
34263      // 0x0002 - "dorlok" // standard input (expected here)
34264      // 0x0004 - "serdor" // standard input (expected here)
34265      // 0x0008 - "cshdor" // standard input (expected here)
34266      // 0x0010 - "hopdmp" // standard input (expected here)
3426734267INPUT_PORTS_END
3426834268
3426934269// PR1740 AWP BULLSEYE CLASSIC SCORP4         PR1702 BULLSEYE SOUNDS11         BULLSEYE CLASSIC  S.SITE
r31373r31374
3428934289}
3429034290
3429134291INPUT_PORTS_START( sc4butch ) // this structure is generated
34292        PORT_INCLUDE( sc4_base )
34293        PORT_MODIFY("IN-1")
34294        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
34295        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
34296        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
34297        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
34298        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
34299        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
34300        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34301        PORT_MODIFY("IN-2")
34302        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
34303        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
34304        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34305        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34306        PORT_MODIFY("IN-3")
34307        // 0x0004 - "stk 4" // standard input (expected here)
34308        // 0x0008 - "stk 3" // standard input (expected here)
34309        // 0x0010 - "stk 2" // standard input (expected here)
34310        PORT_MODIFY("IN-5")
34311        // 0x0001 - "priz4" // standard input (expected here)
34312        // 0x0002 - "priz3" // standard input (expected here)
34313        // 0x0004 - "priz2" // standard input (expected here)
34314        // 0x0008 - "priz1" // standard input (expected here)
34315        PORT_MODIFY("IN-6")
34316        // 0x0001 - "perc1" // standard input (expected here)
34317        // 0x0002 - "perc2" // standard input (expected here)
34318        // 0x0004 - "perc3" // standard input (expected here)
34319        // 0x0008 - "perc4" // standard input (expected here)
34320        PORT_MODIFY("IN-8")
34321        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("dead")
34322        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lo rig")
34323        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi rig")
34324        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lo lef")
34325        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi lef")
34326        PORT_MODIFY("IN-9")
34327        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("streak")
34328        PORT_MODIFY("IN-16")
34329        // 0x0001 - "dil1" // standard input (motherboard)
34330        // 0x0002 - "dil2" // standard input (motherboard)
34331        // 0x0004 - "dil3" // standard input (motherboard)
34332        // 0x0008 - "dil4" // standard input (motherboard)
34333        // 0x0010 - "dil5" // standard input (motherboard)
34334        // 0x0100 - "top up" // known extended input, usually 'top up'
34335        PORT_MODIFY("IN-17")
34336        // 0x0001 - "dil6" // standard input (motherboard)
34337        // 0x0002 - "dil7" // standard input (motherboard)
34338        // 0x0004 - "dil8" // standard input (motherboard)
34339        // 0x0008 - "dil9" // standard input (motherboard)
34340        // 0x0010 - "dil10" // standard input (motherboard)
34341        PORT_MODIFY("IN-18")
34342        // 0x0001 - "dil11" // standard input (motherboard)
34343        // 0x0002 - "dil12" // standard input (motherboard)
34344        // 0x0004 - "dil13" // standard input (motherboard)
34345        // 0x0008 - "dil14" // standard input (motherboard)
34346        // 0x0010 - "dil15" // standard input (motherboard)
34347        PORT_MODIFY("IN-19")
34348        // 0x0001 - "dil16" // standard input (motherboard)
34349        PORT_MODIFY("IN-20")
34350        // 0x0001 - "grnbut" // standard input (motherboard)
34351        // 0x0002 - "dorlok" // standard input (expected here)
34352        // 0x0004 - "serdor" // standard input (expected here)
34353        // 0x0008 - "cshdor" // standard input (expected here)
34354        // 0x0010 - "hopdmp" // standard input (expected here)
34292      PORT_INCLUDE( sc4_base )
34293      PORT_MODIFY("IN-1")
34294      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
34295      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
34296      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
34297      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
34298      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
34299      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
34300      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34301      PORT_MODIFY("IN-2")
34302      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
34303      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
34304      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34305      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34306      PORT_MODIFY("IN-3")
34307      // 0x0004 - "stk 4" // standard input (expected here)
34308      // 0x0008 - "stk 3" // standard input (expected here)
34309      // 0x0010 - "stk 2" // standard input (expected here)
34310      PORT_MODIFY("IN-5")
34311      // 0x0001 - "priz4" // standard input (expected here)
34312      // 0x0002 - "priz3" // standard input (expected here)
34313      // 0x0004 - "priz2" // standard input (expected here)
34314      // 0x0008 - "priz1" // standard input (expected here)
34315      PORT_MODIFY("IN-6")
34316      // 0x0001 - "perc1" // standard input (expected here)
34317      // 0x0002 - "perc2" // standard input (expected here)
34318      // 0x0004 - "perc3" // standard input (expected here)
34319      // 0x0008 - "perc4" // standard input (expected here)
34320      PORT_MODIFY("IN-8")
34321      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("dead")
34322      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lo rig")
34323      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi rig")
34324      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lo lef")
34325      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi lef")
34326      PORT_MODIFY("IN-9")
34327      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("streak")
34328      PORT_MODIFY("IN-16")
34329      // 0x0001 - "dil1" // standard input (motherboard)
34330      // 0x0002 - "dil2" // standard input (motherboard)
34331      // 0x0004 - "dil3" // standard input (motherboard)
34332      // 0x0008 - "dil4" // standard input (motherboard)
34333      // 0x0010 - "dil5" // standard input (motherboard)
34334      // 0x0100 - "top up" // known extended input, usually 'top up'
34335      PORT_MODIFY("IN-17")
34336      // 0x0001 - "dil6" // standard input (motherboard)
34337      // 0x0002 - "dil7" // standard input (motherboard)
34338      // 0x0004 - "dil8" // standard input (motherboard)
34339      // 0x0008 - "dil9" // standard input (motherboard)
34340      // 0x0010 - "dil10" // standard input (motherboard)
34341      PORT_MODIFY("IN-18")
34342      // 0x0001 - "dil11" // standard input (motherboard)
34343      // 0x0002 - "dil12" // standard input (motherboard)
34344      // 0x0004 - "dil13" // standard input (motherboard)
34345      // 0x0008 - "dil14" // standard input (motherboard)
34346      // 0x0010 - "dil15" // standard input (motherboard)
34347      PORT_MODIFY("IN-19")
34348      // 0x0001 - "dil16" // standard input (motherboard)
34349      PORT_MODIFY("IN-20")
34350      // 0x0001 - "grnbut" // standard input (motherboard)
34351      // 0x0002 - "dorlok" // standard input (expected here)
34352      // 0x0004 - "serdor" // standard input (expected here)
34353      // 0x0008 - "cshdor" // standard input (expected here)
34354      // 0x0010 - "hopdmp" // standard input (expected here)
3435534355INPUT_PORTS_END
3435634356
3435734357// PR1930 AWP BUTCH CASHIDY AND THE SUNDANCE QUID S4         PR1910 B C AND THE S Q SOUNDS11   BUTCH N SUNDANCE  S.SITE
r31373r31374
3438234382}
3438334383
3438434384INPUT_PORTS_START( sc4cabin ) // this structure is generated
34385        PORT_INCLUDE( sc4_base )
34386        PORT_MODIFY("IN-1")
34387        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
34388        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
34389        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
34390        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
34391        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
34392        PORT_MODIFY("IN-2")
34393        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
34394        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
34395        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34396        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
34397        PORT_MODIFY("IN-8")
34398        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("f lo")
34399        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
34400        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c lo")
34401        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
34402        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c hi")
34403        PORT_MODIFY("IN-9")
34404        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
34405        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("f hi")
34406        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("step")
34407        PORT_MODIFY("IN-16")
34408        // 0x0001 - "dil 1" // standard input (motherboard)
34409        // 0x0002 - "dil 2" // standard input (motherboard)
34410        // 0x0004 - "dil 3" // standard input (motherboard)
34411        // 0x0008 - "dil 4" // standard input (motherboard)
34412        // 0x0010 - "dil 5" // standard input (motherboard)
34413        // 0x0100 - "topup" // known extended input, usually 'top up'
34414        PORT_MODIFY("IN-17")
34415        // 0x0001 - "dil 6" // standard input (motherboard)
34416        // 0x0002 - "dil 7" // standard input (motherboard)
34417        // 0x0004 - "dil 8" // standard input (motherboard)
34418        // 0x0008 - "dil 9" // standard input (motherboard)
34419        // 0x0010 - "dil10" // standard input (motherboard)
34420        PORT_MODIFY("IN-18")
34421        // 0x0001 - "dil11" // standard input (motherboard)
34422        // 0x0002 - "dil12" // standard input (motherboard)
34423        // 0x0004 - "dil13" // standard input (motherboard)
34424        // 0x0008 - "dil14" // standard input (motherboard)
34425        // 0x0010 - "dil15" // standard input (motherboard)
34426        PORT_MODIFY("IN-19")
34427        // 0x0001 - "dil16" // standard input (motherboard)
34428        PORT_MODIFY("IN-20")
34429        // 0x0001 - "test" // standard input (motherboard)
34430        // 0x0002 - "dorlk" // standard input (expected here)
34431        // 0x0004 - "tpdor" // standard input (expected here)
34432        // 0x0008 - "cshbx" // standard input (expected here)
34433        // 0x0010 - "deflt" // standard input (expected here)
34385      PORT_INCLUDE( sc4_base )
34386      PORT_MODIFY("IN-1")
34387      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
34388      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
34389      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
34390      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
34391      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
34392      PORT_MODIFY("IN-2")
34393      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
34394      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
34395      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34396      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
34397      PORT_MODIFY("IN-8")
34398      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("f lo")
34399      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
34400      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c lo")
34401      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
34402      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c hi")
34403      PORT_MODIFY("IN-9")
34404      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
34405      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("f hi")
34406      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("step")
34407      PORT_MODIFY("IN-16")
34408      // 0x0001 - "dil 1" // standard input (motherboard)
34409      // 0x0002 - "dil 2" // standard input (motherboard)
34410      // 0x0004 - "dil 3" // standard input (motherboard)
34411      // 0x0008 - "dil 4" // standard input (motherboard)
34412      // 0x0010 - "dil 5" // standard input (motherboard)
34413      // 0x0100 - "topup" // known extended input, usually 'top up'
34414      PORT_MODIFY("IN-17")
34415      // 0x0001 - "dil 6" // standard input (motherboard)
34416      // 0x0002 - "dil 7" // standard input (motherboard)
34417      // 0x0004 - "dil 8" // standard input (motherboard)
34418      // 0x0008 - "dil 9" // standard input (motherboard)
34419      // 0x0010 - "dil10" // standard input (motherboard)
34420      PORT_MODIFY("IN-18")
34421      // 0x0001 - "dil11" // standard input (motherboard)
34422      // 0x0002 - "dil12" // standard input (motherboard)
34423      // 0x0004 - "dil13" // standard input (motherboard)
34424      // 0x0008 - "dil14" // standard input (motherboard)
34425      // 0x0010 - "dil15" // standard input (motherboard)
34426      PORT_MODIFY("IN-19")
34427      // 0x0001 - "dil16" // standard input (motherboard)
34428      PORT_MODIFY("IN-20")
34429      // 0x0001 - "test" // standard input (motherboard)
34430      // 0x0002 - "dorlk" // standard input (expected here)
34431      // 0x0004 - "tpdor" // standard input (expected here)
34432      // 0x0008 - "cshbx" // standard input (expected here)
34433      // 0x0010 - "deflt" // standard input (expected here)
3443434434INPUT_PORTS_END
3443534435
3443634436// PR2209 CABIN FEVER         CABF SOUNDS         CABIN FEVER
r31373r31374
3446634466}
3446734467
3446834468INPUT_PORTS_START( sc4cari ) // this structure is generated
34469        PORT_INCLUDE( sc4_base )
34470        PORT_MODIFY("IN-1")
34471        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh 1")
34472        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh 2")
34473        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh 3")
34474        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh 4")
34475        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh 4")
34476        // 0x0100 - "hoplw" // known extended input, usually 'hopper fit'
34477        PORT_MODIFY("IN-2")
34478        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh 3")
34479        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh 2")
34480        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh 1")
34481        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
34482        PORT_MODIFY("IN-8")
34483        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
34484        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
34485        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
34486        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
34487        PORT_MODIFY("IN-9")
34488        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("c hi")
34489        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("b hi")
34490        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("f hi")
34491        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("take")
34492        PORT_MODIFY("IN-16")
34493        // 0x0001 - "dil 1" // standard input (motherboard)
34494        // 0x0002 - "dil 2" // standard input (motherboard)
34495        // 0x0004 - "dil 3" // standard input (motherboard)
34496        // 0x0008 - "dil 4" // standard input (motherboard)
34497        // 0x0010 - "dil 5" // standard input (motherboard)
34498        // 0x0100 - "topup" // known extended input, usually 'top up'
34499        PORT_MODIFY("IN-17")
34500        // 0x0001 - "dil 6" // standard input (motherboard)
34501        // 0x0002 - "dil 7" // standard input (motherboard)
34502        // 0x0004 - "dil 8" // standard input (motherboard)
34503        // 0x0008 - "dil 9" // standard input (motherboard)
34504        // 0x0010 - "dil10" // standard input (motherboard)
34505        PORT_MODIFY("IN-18")
34506        // 0x0001 - "dil11" // standard input (motherboard)
34507        // 0x0002 - "dil12" // standard input (motherboard)
34508        // 0x0004 - "dil13" // standard input (motherboard)
34509        // 0x0008 - "dil14" // standard input (motherboard)
34510        // 0x0010 - "dil15" // standard input (motherboard)
34511        PORT_MODIFY("IN-19")
34512        // 0x0001 - "dil16" // standard input (motherboard)
34513        PORT_MODIFY("IN-20")
34514        // 0x0001 - "test" // standard input (motherboard)
34515        // 0x0002 - "dorlk" // standard input (expected here)
34516        // 0x0004 - "topdr" // standard input (expected here)
34517        // 0x0008 - "cshbx" // standard input (expected here)
34518        // 0x0010 - "deflt" // standard input (expected here)
34469      PORT_INCLUDE( sc4_base )
34470      PORT_MODIFY("IN-1")
34471      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh 1")
34472      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh 2")
34473      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh 3")
34474      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh 4")
34475      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh 4")
34476      // 0x0100 - "hoplw" // known extended input, usually 'hopper fit'
34477      PORT_MODIFY("IN-2")
34478      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh 3")
34479      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh 2")
34480      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh 1")
34481      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
34482      PORT_MODIFY("IN-8")
34483      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
34484      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
34485      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
34486      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
34487      PORT_MODIFY("IN-9")
34488      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("c hi")
34489      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("b hi")
34490      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("f hi")
34491      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("take")
34492      PORT_MODIFY("IN-16")
34493      // 0x0001 - "dil 1" // standard input (motherboard)
34494      // 0x0002 - "dil 2" // standard input (motherboard)
34495      // 0x0004 - "dil 3" // standard input (motherboard)
34496      // 0x0008 - "dil 4" // standard input (motherboard)
34497      // 0x0010 - "dil 5" // standard input (motherboard)
34498      // 0x0100 - "topup" // known extended input, usually 'top up'
34499      PORT_MODIFY("IN-17")
34500      // 0x0001 - "dil 6" // standard input (motherboard)
34501      // 0x0002 - "dil 7" // standard input (motherboard)
34502      // 0x0004 - "dil 8" // standard input (motherboard)
34503      // 0x0008 - "dil 9" // standard input (motherboard)
34504      // 0x0010 - "dil10" // standard input (motherboard)
34505      PORT_MODIFY("IN-18")
34506      // 0x0001 - "dil11" // standard input (motherboard)
34507      // 0x0002 - "dil12" // standard input (motherboard)
34508      // 0x0004 - "dil13" // standard input (motherboard)
34509      // 0x0008 - "dil14" // standard input (motherboard)
34510      // 0x0010 - "dil15" // standard input (motherboard)
34511      PORT_MODIFY("IN-19")
34512      // 0x0001 - "dil16" // standard input (motherboard)
34513      PORT_MODIFY("IN-20")
34514      // 0x0001 - "test" // standard input (motherboard)
34515      // 0x0002 - "dorlk" // standard input (expected here)
34516      // 0x0004 - "topdr" // standard input (expected here)
34517      // 0x0008 - "cshbx" // standard input (expected here)
34518      // 0x0010 - "deflt" // standard input (expected here)
3451934519INPUT_PORTS_END
3452034520
3452134521//  PR2326 CARIBBEAN CASH         CABC SOUNDS         CARIBBEAN CASH
r31373r31374
3454434544}
3454534545
3454634546INPUT_PORTS_START( sc4cariq ) // this structure is generated
34547        PORT_INCLUDE( sc4_base )
34548        PORT_MODIFY("IN-1")
34549        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
34550        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
34551        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
34552        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
34553        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stop")
34554        PORT_MODIFY("IN-2")
34555        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("collec")
34556        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchan")
34557        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34558        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34559        PORT_MODIFY("IN-4")
34560        // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
34561        PORT_MODIFY("IN-8")
34562        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
34563        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
34564        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk fet")
34565        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk nud")
34566        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("qps")
34567        PORT_MODIFY("IN-16")
34568        // 0x0001 - "dil sw" // standard input (motherboard)
34569        // 0x0002 - "dil sw" // standard input (motherboard)
34570        // 0x0004 - "dil sw" // standard input (motherboard)
34571        // 0x0008 - "dil sw" // standard input (motherboard)
34572        // 0x0010 - "dil sw" // standard input (motherboard)
34573        PORT_MODIFY("IN-17")
34574        // 0x0001 - "dil sw" // standard input (motherboard)
34575        // 0x0002 - "dil sw" // standard input (motherboard)
34576        // 0x0004 - "dil sw" // standard input (motherboard)
34577        // 0x0008 - "dil sw" // standard input (motherboard)
34578        // 0x0010 - "dil sw" // standard input (motherboard)
34579        PORT_MODIFY("IN-18")
34580        // 0x0001 - "dil sw" // standard input (motherboard)
34581        // 0x0002 - "dil sw" // standard input (motherboard)
34582        // 0x0004 - "dil sw" // standard input (motherboard)
34583        // 0x0008 - "dil sw" // standard input (motherboard)
34584        // 0x0010 - "dil sw" // standard input (motherboard)
34585        PORT_MODIFY("IN-19")
34586        // 0x0001 - "dil sw" // standard input (motherboard)
34587        PORT_MODIFY("IN-20")
34588        // 0x0001 - "green" // standard input (motherboard)
34589        // 0x0002 - "pay dr" // standard input (expected here)
34590        // 0x0004 - "bot dr" // standard input (expected here)
34591        // 0x0008 - "dump" // standard input (expected here)
34592        // 0x0010 - "top dr" // standard input (expected here)
34547      PORT_INCLUDE( sc4_base )
34548      PORT_MODIFY("IN-1")
34549      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
34550      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
34551      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
34552      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
34553      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stop")
34554      PORT_MODIFY("IN-2")
34555      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("collec")
34556      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchan")
34557      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34558      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34559      PORT_MODIFY("IN-4")
34560      // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
34561      PORT_MODIFY("IN-8")
34562      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
34563      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
34564      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk fet")
34565      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk nud")
34566      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("qps")
34567      PORT_MODIFY("IN-16")
34568      // 0x0001 - "dil sw" // standard input (motherboard)
34569      // 0x0002 - "dil sw" // standard input (motherboard)
34570      // 0x0004 - "dil sw" // standard input (motherboard)
34571      // 0x0008 - "dil sw" // standard input (motherboard)
34572      // 0x0010 - "dil sw" // standard input (motherboard)
34573      PORT_MODIFY("IN-17")
34574      // 0x0001 - "dil sw" // standard input (motherboard)
34575      // 0x0002 - "dil sw" // standard input (motherboard)
34576      // 0x0004 - "dil sw" // standard input (motherboard)
34577      // 0x0008 - "dil sw" // standard input (motherboard)
34578      // 0x0010 - "dil sw" // standard input (motherboard)
34579      PORT_MODIFY("IN-18")
34580      // 0x0001 - "dil sw" // standard input (motherboard)
34581      // 0x0002 - "dil sw" // standard input (motherboard)
34582      // 0x0004 - "dil sw" // standard input (motherboard)
34583      // 0x0008 - "dil sw" // standard input (motherboard)
34584      // 0x0010 - "dil sw" // standard input (motherboard)
34585      PORT_MODIFY("IN-19")
34586      // 0x0001 - "dil sw" // standard input (motherboard)
34587      PORT_MODIFY("IN-20")
34588      // 0x0001 - "green" // standard input (motherboard)
34589      // 0x0002 - "pay dr" // standard input (expected here)
34590      // 0x0004 - "bot dr" // standard input (expected here)
34591      // 0x0008 - "dump" // standard input (expected here)
34592      // 0x0010 - "top dr" // standard input (expected here)
3459334593INPUT_PORTS_END
3459434594
3459534595// these lack identification strings, and it's not the same game as above
r31373r31374
3461934619}
3462034620
3462134621INPUT_PORTS_START( sc4cblas ) // this structure is generated
34622        PORT_INCLUDE( sc4_base )
34623        PORT_MODIFY("IN-1")
34624        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
34625        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("holda")
34626        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("holdb")
34627        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("holdc")
34628        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("transf")
34629        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
34630        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34631        PORT_MODIFY("IN-2")
34632        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34633        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34634        PORT_MODIFY("IN-3")
34635        // 0x0004 - "stk 4" // standard input (expected here)
34636        // 0x0008 - "stk 3" // standard input (expected here)
34637        // 0x0010 - "stk 2" // standard input (expected here)
34638        PORT_MODIFY("IN-5")
34639        // 0x0001 - "priz4" // standard input (expected here)
34640        // 0x0002 - "priz3" // standard input (expected here)
34641        // 0x0004 - "priz2" // standard input (expected here)
34642        // 0x0008 - "priz1" // standard input (expected here)
34643        PORT_MODIFY("IN-6")
34644        // 0x0001 - "perc1" // standard input (expected here)
34645        // 0x0002 - "perc2" // standard input (expected here)
34646        // 0x0004 - "perc3" // standard input (expected here)
34647        // 0x0008 - "perc4" // standard input (expected here)
34648        PORT_MODIFY("IN-8")
34649        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("take f")
34650        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("take c")
34651        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("take b")
34652        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take n")
34653        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("take s")
34654        PORT_MODIFY("IN-9")
34655        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("take b")
34656        PORT_MODIFY("IN-16")
34657        // 0x0001 - "dil 1" // standard input (motherboard)
34658        // 0x0002 - "dil 2" // standard input (motherboard)
34659        // 0x0004 - "dil 3" // standard input (motherboard)
34660        // 0x0008 - "dil 4" // standard input (motherboard)
34661        // 0x0010 - "dil 5" // standard input (motherboard)
34662        // 0x0100 - "top up" // known extended input, usually 'top up'
34663        PORT_MODIFY("IN-17")
34664        // 0x0001 - "dil 6" // standard input (motherboard)
34665        // 0x0002 - "dil 7" // standard input (motherboard)
34666        // 0x0004 - "dil 8" // standard input (motherboard)
34667        // 0x0008 - "dil 9" // standard input (motherboard)
34668        // 0x0010 - "dil 10" // standard input (motherboard)
34669        PORT_MODIFY("IN-18")
34670        // 0x0001 - "dil 11" // standard input (motherboard)
34671        // 0x0002 - "dil 12" // standard input (motherboard)
34672        // 0x0004 - "dil 13" // standard input (motherboard)
34673        // 0x0008 - "dil 14" // standard input (motherboard)
34674        // 0x0010 - "dil 15" // standard input (motherboard)
34675        PORT_MODIFY("IN-19")
34676        // 0x0001 - "dil 16" // standard input (motherboard)
34677        PORT_MODIFY("IN-20")
34678        // 0x0001 - "grnbut" // standard input (motherboard)
34679        // 0x0002 - "dorlok" // standard input (expected here)
34680        // 0x0004 - "serdor" // standard input (expected here)
34681        // 0x0008 - "cshdor" // standard input (expected here)
34682        // 0x0010 - "hopdmp" // standard input (expected here)
34622      PORT_INCLUDE( sc4_base )
34623      PORT_MODIFY("IN-1")
34624      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
34625      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("holda")
34626      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("holdb")
34627      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("holdc")
34628      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("transf")
34629      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
34630      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34631      PORT_MODIFY("IN-2")
34632      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34633      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34634      PORT_MODIFY("IN-3")
34635      // 0x0004 - "stk 4" // standard input (expected here)
34636      // 0x0008 - "stk 3" // standard input (expected here)
34637      // 0x0010 - "stk 2" // standard input (expected here)
34638      PORT_MODIFY("IN-5")
34639      // 0x0001 - "priz4" // standard input (expected here)
34640      // 0x0002 - "priz3" // standard input (expected here)
34641      // 0x0004 - "priz2" // standard input (expected here)
34642      // 0x0008 - "priz1" // standard input (expected here)
34643      PORT_MODIFY("IN-6")
34644      // 0x0001 - "perc1" // standard input (expected here)
34645      // 0x0002 - "perc2" // standard input (expected here)
34646      // 0x0004 - "perc3" // standard input (expected here)
34647      // 0x0008 - "perc4" // standard input (expected here)
34648      PORT_MODIFY("IN-8")
34649      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("take f")
34650      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("take c")
34651      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("take b")
34652      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take n")
34653      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("take s")
34654      PORT_MODIFY("IN-9")
34655      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("take b")
34656      PORT_MODIFY("IN-16")
34657      // 0x0001 - "dil 1" // standard input (motherboard)
34658      // 0x0002 - "dil 2" // standard input (motherboard)
34659      // 0x0004 - "dil 3" // standard input (motherboard)
34660      // 0x0008 - "dil 4" // standard input (motherboard)
34661      // 0x0010 - "dil 5" // standard input (motherboard)
34662      // 0x0100 - "top up" // known extended input, usually 'top up'
34663      PORT_MODIFY("IN-17")
34664      // 0x0001 - "dil 6" // standard input (motherboard)
34665      // 0x0002 - "dil 7" // standard input (motherboard)
34666      // 0x0004 - "dil 8" // standard input (motherboard)
34667      // 0x0008 - "dil 9" // standard input (motherboard)
34668      // 0x0010 - "dil 10" // standard input (motherboard)
34669      PORT_MODIFY("IN-18")
34670      // 0x0001 - "dil 11" // standard input (motherboard)
34671      // 0x0002 - "dil 12" // standard input (motherboard)
34672      // 0x0004 - "dil 13" // standard input (motherboard)
34673      // 0x0008 - "dil 14" // standard input (motherboard)
34674      // 0x0010 - "dil 15" // standard input (motherboard)
34675      PORT_MODIFY("IN-19")
34676      // 0x0001 - "dil 16" // standard input (motherboard)
34677      PORT_MODIFY("IN-20")
34678      // 0x0001 - "grnbut" // standard input (motherboard)
34679      // 0x0002 - "dorlok" // standard input (expected here)
34680      // 0x0004 - "serdor" // standard input (expected here)
34681      // 0x0008 - "cshdor" // standard input (expected here)
34682      // 0x0010 - "hopdmp" // standard input (expected here)
3468334683INPUT_PORTS_END
3468434684
3468534685// PR1683 BLAS14
r31373r31374
3470434704}
3470534705
3470634706INPUT_PORTS_START( sc4casxt ) // this structure is generated
34707        PORT_INCLUDE( sc4_base )
34708        PORT_MODIFY("IN-1")
34709        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR collec")
34710        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
34711        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
34712        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
34713        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("transf")
34714        PORT_MODIFY("IN-2")
34715        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
34716        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
34717        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34718        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34719        PORT_MODIFY("IN-3")
34720        // 0x0004 - "stk 4" // standard input (expected here)
34721        // 0x0008 - "stk 3" // standard input (expected here)
34722        // 0x0010 - "stk 2" // standard input (expected here)
34723        PORT_MODIFY("IN-4")
34724        // 0x0008 - "top up OR top up" // known extended(?) input, sometimes 'hop top'
34725        PORT_MODIFY("IN-5")
34726        // 0x0001 - "priz4" // standard input (expected here)
34727        // 0x0002 - "priz3" // standard input (expected here)
34728        // 0x0004 - "priz2" // standard input (expected here)
34729        // 0x0008 - "priz1" // standard input (expected here)
34730        PORT_MODIFY("IN-6")
34731        // 0x0001 - "perc1" // standard input (expected here)
34732        // 0x0002 - "perc2" // standard input (expected here)
34733        // 0x0004 - "perc3" // standard input (expected here)
34734        // 0x0008 - "perc4" // standard input (expected here)
34735        PORT_MODIFY("IN-16")
34736        // 0x0001 - "dil  1" // standard input (motherboard)
34737        // 0x0002 - "dil  2" // standard input (motherboard)
34738        // 0x0004 - "dil  3" // standard input (motherboard)
34739        // 0x0008 - "dil  4" // standard input (motherboard)
34740        // 0x0010 - "dil  5" // standard input (motherboard)
34741        PORT_MODIFY("IN-17")
34742        // 0x0001 - "dil  6" // standard input (motherboard)
34743        // 0x0002 - "dil  7" // standard input (motherboard)
34744        // 0x0004 - "dil  8" // standard input (motherboard)
34745        // 0x0008 - "dil  9" // standard input (motherboard)
34746        // 0x0010 - "dil 10" // standard input (motherboard)
34747        PORT_MODIFY("IN-18")
34748        // 0x0001 - "dil 11" // standard input (motherboard)
34749        // 0x0002 - "dil 12" // standard input (motherboard)
34750        // 0x0004 - "dil 13" // standard input (motherboard)
34751        // 0x0008 - "dil 14" // standard input (motherboard)
34752        // 0x0010 - "dil 15" // standard input (motherboard)
34753        PORT_MODIFY("IN-19")
34754        // 0x0001 - "dil 16" // standard input (motherboard)
34755        PORT_MODIFY("IN-20")
34756        // 0x0001 - "green OR test" // standard input (motherboard)
34757        // 0x0002 - "cshdor" // standard input (expected here)
34758        // 0x0004 - "serdor" // standard input (expected here)
34759        // 0x0008 - "hopdmp" // standard input (expected here)
34760        // 0x0010 - "serdor" // standard input (expected here)
34707      PORT_INCLUDE( sc4_base )
34708      PORT_MODIFY("IN-1")
34709      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR collec")
34710      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
34711      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
34712      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
34713      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("transf")
34714      PORT_MODIFY("IN-2")
34715      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
34716      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
34717      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34718      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34719      PORT_MODIFY("IN-3")
34720      // 0x0004 - "stk 4" // standard input (expected here)
34721      // 0x0008 - "stk 3" // standard input (expected here)
34722      // 0x0010 - "stk 2" // standard input (expected here)
34723      PORT_MODIFY("IN-4")
34724      // 0x0008 - "top up OR top up" // known extended(?) input, sometimes 'hop top'
34725      PORT_MODIFY("IN-5")
34726      // 0x0001 - "priz4" // standard input (expected here)
34727      // 0x0002 - "priz3" // standard input (expected here)
34728      // 0x0004 - "priz2" // standard input (expected here)
34729      // 0x0008 - "priz1" // standard input (expected here)
34730      PORT_MODIFY("IN-6")
34731      // 0x0001 - "perc1" // standard input (expected here)
34732      // 0x0002 - "perc2" // standard input (expected here)
34733      // 0x0004 - "perc3" // standard input (expected here)
34734      // 0x0008 - "perc4" // standard input (expected here)
34735      PORT_MODIFY("IN-16")
34736      // 0x0001 - "dil  1" // standard input (motherboard)
34737      // 0x0002 - "dil  2" // standard input (motherboard)
34738      // 0x0004 - "dil  3" // standard input (motherboard)
34739      // 0x0008 - "dil  4" // standard input (motherboard)
34740      // 0x0010 - "dil  5" // standard input (motherboard)
34741      PORT_MODIFY("IN-17")
34742      // 0x0001 - "dil  6" // standard input (motherboard)
34743      // 0x0002 - "dil  7" // standard input (motherboard)
34744      // 0x0004 - "dil  8" // standard input (motherboard)
34745      // 0x0008 - "dil  9" // standard input (motherboard)
34746      // 0x0010 - "dil 10" // standard input (motherboard)
34747      PORT_MODIFY("IN-18")
34748      // 0x0001 - "dil 11" // standard input (motherboard)
34749      // 0x0002 - "dil 12" // standard input (motherboard)
34750      // 0x0004 - "dil 13" // standard input (motherboard)
34751      // 0x0008 - "dil 14" // standard input (motherboard)
34752      // 0x0010 - "dil 15" // standard input (motherboard)
34753      PORT_MODIFY("IN-19")
34754      // 0x0001 - "dil 16" // standard input (motherboard)
34755      PORT_MODIFY("IN-20")
34756      // 0x0001 - "green OR test" // standard input (motherboard)
34757      // 0x0002 - "cshdor" // standard input (expected here)
34758      // 0x0004 - "serdor" // standard input (expected here)
34759      // 0x0008 - "hopdmp" // standard input (expected here)
34760      // 0x0010 - "serdor" // standard input (expected here)
3476134761INPUT_PORTS_END
3476234762
3476334763// PR2338 XTRAVAGANZA         XTRV SOUNDS         XTRAVAGANZA
r31373r31374
3478534785}
3478634786
3478734787INPUT_PORTS_START( sc4chavi ) // this structure is generated
34788        PORT_INCLUDE( sc4_base )
34789        PORT_MODIFY("IN-1")
34790        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
34791        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
34792        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
34793        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
34794        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
34795        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
34796        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34797        PORT_MODIFY("IN-2")
34798        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
34799        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
34800        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34801        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34802        PORT_MODIFY("IN-5")
34803        // 0x0001 - "priz4" // standard input (expected here)
34804        // 0x0002 - "priz3" // standard input (expected here)
34805        // 0x0004 - "priz2" // standard input (expected here)
34806        // 0x0008 - "priz1" // standard input (expected here)
34807        PORT_MODIFY("IN-6")
34808        // 0x0001 - "perc1" // standard input (expected here)
34809        // 0x0002 - "perc2" // standard input (expected here)
34810        // 0x0004 - "perc3" // standard input (expected here)
34811        // 0x0008 - "perc4" // standard input (expected here)
34812        PORT_MODIFY("IN-8")
34813        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("chav i")
34814        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("g bonu")
34815        PORT_MODIFY("IN-16")
34816        // 0x0001 - "dil1" // standard input (motherboard)
34817        // 0x0002 - "dil2" // standard input (motherboard)
34818        // 0x0004 - "dil3" // standard input (motherboard)
34819        // 0x0008 - "dil4" // standard input (motherboard)
34820        // 0x0010 - "dil5" // standard input (motherboard)
34821        // 0x0100 - "top up" // known extended input, usually 'top up'
34822        PORT_MODIFY("IN-17")
34823        // 0x0001 - "dil6" // standard input (motherboard)
34824        // 0x0002 - "dil7" // standard input (motherboard)
34825        // 0x0004 - "dil8" // standard input (motherboard)
34826        // 0x0008 - "dil9" // standard input (motherboard)
34827        // 0x0010 - "dil10" // standard input (motherboard)
34828        PORT_MODIFY("IN-18")
34829        // 0x0001 - "dil11" // standard input (motherboard)
34830        // 0x0002 - "dil12" // standard input (motherboard)
34831        // 0x0004 - "dil13" // standard input (motherboard)
34832        // 0x0008 - "dil14" // standard input (motherboard)
34833        // 0x0010 - "dil15" // standard input (motherboard)
34834        PORT_MODIFY("IN-19")
34835        // 0x0001 - "dil16" // standard input (motherboard)
34836        PORT_MODIFY("IN-20")
34837        // 0x0001 - "grnbut" // standard input (motherboard)
34838        // 0x0002 - "dorlok" // standard input (expected here)
34839        // 0x0004 - "serdor" // standard input (expected here)
34840        // 0x0008 - "cshdor" // standard input (expected here)
34841        // 0x0010 - "hopdmp" // standard input (expected here)
34788      PORT_INCLUDE( sc4_base )
34789      PORT_MODIFY("IN-1")
34790      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
34791      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
34792      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
34793      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
34794      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
34795      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
34796      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34797      PORT_MODIFY("IN-2")
34798      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
34799      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
34800      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34801      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34802      PORT_MODIFY("IN-5")
34803      // 0x0001 - "priz4" // standard input (expected here)
34804      // 0x0002 - "priz3" // standard input (expected here)
34805      // 0x0004 - "priz2" // standard input (expected here)
34806      // 0x0008 - "priz1" // standard input (expected here)
34807      PORT_MODIFY("IN-6")
34808      // 0x0001 - "perc1" // standard input (expected here)
34809      // 0x0002 - "perc2" // standard input (expected here)
34810      // 0x0004 - "perc3" // standard input (expected here)
34811      // 0x0008 - "perc4" // standard input (expected here)
34812      PORT_MODIFY("IN-8")
34813      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("chav i")
34814      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("g bonu")
34815      PORT_MODIFY("IN-16")
34816      // 0x0001 - "dil1" // standard input (motherboard)
34817      // 0x0002 - "dil2" // standard input (motherboard)
34818      // 0x0004 - "dil3" // standard input (motherboard)
34819      // 0x0008 - "dil4" // standard input (motherboard)
34820      // 0x0010 - "dil5" // standard input (motherboard)
34821      // 0x0100 - "top up" // known extended input, usually 'top up'
34822      PORT_MODIFY("IN-17")
34823      // 0x0001 - "dil6" // standard input (motherboard)
34824      // 0x0002 - "dil7" // standard input (motherboard)
34825      // 0x0004 - "dil8" // standard input (motherboard)
34826      // 0x0008 - "dil9" // standard input (motherboard)
34827      // 0x0010 - "dil10" // standard input (motherboard)
34828      PORT_MODIFY("IN-18")
34829      // 0x0001 - "dil11" // standard input (motherboard)
34830      // 0x0002 - "dil12" // standard input (motherboard)
34831      // 0x0004 - "dil13" // standard input (motherboard)
34832      // 0x0008 - "dil14" // standard input (motherboard)
34833      // 0x0010 - "dil15" // standard input (motherboard)
34834      PORT_MODIFY("IN-19")
34835      // 0x0001 - "dil16" // standard input (motherboard)
34836      PORT_MODIFY("IN-20")
34837      // 0x0001 - "grnbut" // standard input (motherboard)
34838      // 0x0002 - "dorlok" // standard input (expected here)
34839      // 0x0004 - "serdor" // standard input (expected here)
34840      // 0x0008 - "cshdor" // standard input (expected here)
34841      // 0x0010 - "hopdmp" // standard input (expected here)
3484234842INPUT_PORTS_END
3484334843
3484434844// PR1731 AWP CHAV IT SCORP4         PR1711 CHAV IT SOUNDS11         CHAV IT S.SITE
r31373r31374
3486834868}
3486934869
3487034870INPUT_PORTS_START( sc4chavy ) // this structure is generated
34871        PORT_INCLUDE( sc4_base )
34872        PORT_MODIFY("IN-1")
34873        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
34874        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
34875        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
34876        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
34877        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
34878        // 0x0100 - "hoplw" // known extended input, usually 'hopper fit'
34879        PORT_MODIFY("IN-2")
34880        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
34881        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
34882        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34883        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
34884        PORT_MODIFY("IN-8")
34885        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("pink")
34886        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("yell")
34887        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
34888        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nuds")
34889        PORT_MODIFY("IN-16")
34890        // 0x0001 - "dil 1" // standard input (motherboard)
34891        // 0x0002 - "dil 2" // standard input (motherboard)
34892        // 0x0004 - "dil 3" // standard input (motherboard)
34893        // 0x0008 - "dil 4" // standard input (motherboard)
34894        // 0x0010 - "dil 5" // standard input (motherboard)
34895        // 0x0100 - "topup" // known extended input, usually 'top up'
34896        PORT_MODIFY("IN-17")
34897        // 0x0001 - "dil 6" // standard input (motherboard)
34898        // 0x0002 - "dil 7" // standard input (motherboard)
34899        // 0x0004 - "dil 8" // standard input (motherboard)
34900        // 0x0008 - "dil 9" // standard input (motherboard)
34901        // 0x0010 - "dil10" // standard input (motherboard)
34902        PORT_MODIFY("IN-18")
34903        // 0x0001 - "dil11" // standard input (motherboard)
34904        // 0x0002 - "dil12" // standard input (motherboard)
34905        // 0x0004 - "dil13" // standard input (motherboard)
34906        // 0x0008 - "dil14" // standard input (motherboard)
34907        // 0x0010 - "dil15" // standard input (motherboard)
34908        PORT_MODIFY("IN-19")
34909        // 0x0001 - "dil16" // standard input (motherboard)
34910        PORT_MODIFY("IN-20")
34911        // 0x0001 - "test" // standard input (motherboard)
34912        // 0x0002 - "dorlk" // standard input (expected here)
34913        // 0x0004 - "topdr" // standard input (expected here)
34914        // 0x0008 - "cshbx" // standard input (expected here)
34915        // 0x0010 - "deflt" // standard input (expected here)
34871      PORT_INCLUDE( sc4_base )
34872      PORT_MODIFY("IN-1")
34873      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
34874      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
34875      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
34876      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
34877      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
34878      // 0x0100 - "hoplw" // known extended input, usually 'hopper fit'
34879      PORT_MODIFY("IN-2")
34880      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
34881      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
34882      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34883      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
34884      PORT_MODIFY("IN-8")
34885      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("pink")
34886      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("yell")
34887      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
34888      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nuds")
34889      PORT_MODIFY("IN-16")
34890      // 0x0001 - "dil 1" // standard input (motherboard)
34891      // 0x0002 - "dil 2" // standard input (motherboard)
34892      // 0x0004 - "dil 3" // standard input (motherboard)
34893      // 0x0008 - "dil 4" // standard input (motherboard)
34894      // 0x0010 - "dil 5" // standard input (motherboard)
34895      // 0x0100 - "topup" // known extended input, usually 'top up'
34896      PORT_MODIFY("IN-17")
34897      // 0x0001 - "dil 6" // standard input (motherboard)
34898      // 0x0002 - "dil 7" // standard input (motherboard)
34899      // 0x0004 - "dil 8" // standard input (motherboard)
34900      // 0x0008 - "dil 9" // standard input (motherboard)
34901      // 0x0010 - "dil10" // standard input (motherboard)
34902      PORT_MODIFY("IN-18")
34903      // 0x0001 - "dil11" // standard input (motherboard)
34904      // 0x0002 - "dil12" // standard input (motherboard)
34905      // 0x0004 - "dil13" // standard input (motherboard)
34906      // 0x0008 - "dil14" // standard input (motherboard)
34907      // 0x0010 - "dil15" // standard input (motherboard)
34908      PORT_MODIFY("IN-19")
34909      // 0x0001 - "dil16" // standard input (motherboard)
34910      PORT_MODIFY("IN-20")
34911      // 0x0001 - "test" // standard input (motherboard)
34912      // 0x0002 - "dorlk" // standard input (expected here)
34913      // 0x0004 - "topdr" // standard input (expected here)
34914      // 0x0008 - "cshbx" // standard input (expected here)
34915      // 0x0010 - "deflt" // standard input (expected here)
3491634916INPUT_PORTS_END
3491734917
3491834918// PR2305 CHAVVY CHASE         CHVY SOUNDS
r31373r31374
3494334943}
3494434944
3494534945INPUT_PORTS_START( sc4cmani ) // this structure is generated
34946        PORT_INCLUDE( sc4_base )
34947        PORT_MODIFY("IN-1")
34948        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
34949        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
34950        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
34951        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
34952        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
34953        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34954        PORT_MODIFY("IN-2")
34955        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
34956        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34957        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34958        PORT_MODIFY("IN-3")
34959        // 0x0004 - "stk 4" // standard input (expected here)
34960        // 0x0008 - "stk 3" // standard input (expected here)
34961        // 0x0010 - "stk 2" // standard input (expected here)
34962        PORT_MODIFY("IN-5")
34963        // 0x0001 - "priz4" // standard input (expected here)
34964        // 0x0002 - "priz3" // standard input (expected here)
34965        // 0x0004 - "priz2" // standard input (expected here)
34966        // 0x0008 - "priz1" // standard input (expected here)
34967        PORT_MODIFY("IN-6")
34968        // 0x0001 - "perc1" // standard input (expected here)
34969        // 0x0002 - "perc2" // standard input (expected here)
34970        // 0x0004 - "perc3" // standard input (expected here)
34971        // 0x0008 - "perc4" // standard input (expected here)
34972        PORT_MODIFY("IN-8")
34973        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk sht")
34974        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("blu lo")
34975        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("red lo")
34976        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("gre lo")
34977        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk stp")
34978        PORT_MODIFY("IN-9")
34979        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("col bl")
34980        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("blu hi")
34981        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("red hi")
34982        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("gre hi")
34983        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("tk nud")
34984        PORT_MODIFY("IN-10")
34985        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_0 ) PORT_NAME("col rd")
34986        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_1 ) PORT_NAME("col gr")
34987        PORT_MODIFY("IN-16")
34988        // 0x0001 - "dil  1" // standard input (motherboard)
34989        // 0x0002 - "dil  2" // standard input (motherboard)
34990        // 0x0004 - "dil  3" // standard input (motherboard)
34991        // 0x0008 - "dil  4" // standard input (motherboard)
34992        // 0x0010 - "dil  5" // standard input (motherboard)
34993        // 0x0100 - "top up" // known extended input, usually 'top up'
34994        PORT_MODIFY("IN-17")
34995        // 0x0001 - "dil  6" // standard input (motherboard)
34996        // 0x0002 - "dil  7" // standard input (motherboard)
34997        // 0x0004 - "dil  8" // standard input (motherboard)
34998        // 0x0008 - "dil  9" // standard input (motherboard)
34999        // 0x0010 - "dil 10" // standard input (motherboard)
35000        PORT_MODIFY("IN-18")
35001        // 0x0001 - "dil 11" // standard input (motherboard)
35002        // 0x0002 - "dil 12" // standard input (motherboard)
35003        // 0x0004 - "dil 13" // standard input (motherboard)
35004        // 0x0008 - "dil 14" // standard input (motherboard)
35005        // 0x0010 - "dil 15" // standard input (motherboard)
35006        PORT_MODIFY("IN-19")
35007        // 0x0001 - "dil 16" // standard input (motherboard)
35008        PORT_MODIFY("IN-20")
35009        // 0x0001 - "grnbut" // standard input (motherboard)
35010        // 0x0002 - "dorlok" // standard input (expected here)
35011        // 0x0004 - "topdor" // standard input (expected here)
35012        // 0x0008 - "botdor" // standard input (expected here)
35013        // 0x0010 - "hopdmp OR hopdmp" // standard input (expected here)
34946      PORT_INCLUDE( sc4_base )
34947      PORT_MODIFY("IN-1")
34948      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
34949      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
34950      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
34951      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
34952      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
34953      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
34954      PORT_MODIFY("IN-2")
34955      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
34956      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
34957      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
34958      PORT_MODIFY("IN-3")
34959      // 0x0004 - "stk 4" // standard input (expected here)
34960      // 0x0008 - "stk 3" // standard input (expected here)
34961      // 0x0010 - "stk 2" // standard input (expected here)
34962      PORT_MODIFY("IN-5")
34963      // 0x0001 - "priz4" // standard input (expected here)
34964      // 0x0002 - "priz3" // standard input (expected here)
34965      // 0x0004 - "priz2" // standard input (expected here)
34966      // 0x0008 - "priz1" // standard input (expected here)
34967      PORT_MODIFY("IN-6")
34968      // 0x0001 - "perc1" // standard input (expected here)
34969      // 0x0002 - "perc2" // standard input (expected here)
34970      // 0x0004 - "perc3" // standard input (expected here)
34971      // 0x0008 - "perc4" // standard input (expected here)
34972      PORT_MODIFY("IN-8")
34973      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk sht")
34974      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("blu lo")
34975      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("red lo")
34976      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("gre lo")
34977      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk stp")
34978      PORT_MODIFY("IN-9")
34979      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("col bl")
34980      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("blu hi")
34981      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("red hi")
34982      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("gre hi")
34983      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("tk nud")
34984      PORT_MODIFY("IN-10")
34985      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_0 ) PORT_NAME("col rd")
34986      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_1 ) PORT_NAME("col gr")
34987      PORT_MODIFY("IN-16")
34988      // 0x0001 - "dil  1" // standard input (motherboard)
34989      // 0x0002 - "dil  2" // standard input (motherboard)
34990      // 0x0004 - "dil  3" // standard input (motherboard)
34991      // 0x0008 - "dil  4" // standard input (motherboard)
34992      // 0x0010 - "dil  5" // standard input (motherboard)
34993      // 0x0100 - "top up" // known extended input, usually 'top up'
34994      PORT_MODIFY("IN-17")
34995      // 0x0001 - "dil  6" // standard input (motherboard)
34996      // 0x0002 - "dil  7" // standard input (motherboard)
34997      // 0x0004 - "dil  8" // standard input (motherboard)
34998      // 0x0008 - "dil  9" // standard input (motherboard)
34999      // 0x0010 - "dil 10" // standard input (motherboard)
35000      PORT_MODIFY("IN-18")
35001      // 0x0001 - "dil 11" // standard input (motherboard)
35002      // 0x0002 - "dil 12" // standard input (motherboard)
35003      // 0x0004 - "dil 13" // standard input (motherboard)
35004      // 0x0008 - "dil 14" // standard input (motherboard)
35005      // 0x0010 - "dil 15" // standard input (motherboard)
35006      PORT_MODIFY("IN-19")
35007      // 0x0001 - "dil 16" // standard input (motherboard)
35008      PORT_MODIFY("IN-20")
35009      // 0x0001 - "grnbut" // standard input (motherboard)
35010      // 0x0002 - "dorlok" // standard input (expected here)
35011      // 0x0004 - "topdor" // standard input (expected here)
35012      // 0x0008 - "botdor" // standard input (expected here)
35013      // 0x0010 - "hopdmp OR hopdmp" // standard input (expected here)
3501435014INPUT_PORTS_END
3501535015
3501635016// PR1308 COLOUR MANIA         PR1308 COLOUR MAN SOUNDS11
r31373r31374
3503535035}
3503635036
3503735037INPUT_PORTS_START( sc4ctl ) // this structure is generated
35038        PORT_INCLUDE( sc4_base )
35039        PORT_MODIFY("IN-1")
35040        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35041        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
35042        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
35043        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
35044        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
35045        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
35046        PORT_MODIFY("IN-2")
35047        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
35048        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
35049        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35050        PORT_MODIFY("IN-3")
35051        // 0x0004 - "stk 4" // standard input (expected here)
35052        // 0x0008 - "stk 3" // standard input (expected here)
35053        // 0x0010 - "stk 2" // standard input (expected here)
35054        PORT_MODIFY("IN-4")
35055        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
35056        PORT_MODIFY("IN-5")
35057        // 0x0001 - "priz4" // standard input (expected here)
35058        // 0x0002 - "priz3" // standard input (expected here)
35059        // 0x0004 - "priz2" // standard input (expected here)
35060        // 0x0008 - "priz1" // standard input (expected here)
35061        PORT_MODIFY("IN-6")
35062        // 0x0001 - "perc1" // standard input (expected here)
35063        // 0x0002 - "perc2" // standard input (expected here)
35064        // 0x0004 - "perc3" // standard input (expected here)
35065        // 0x0008 - "perc4" // standard input (expected here)
35066        PORT_MODIFY("IN-8")
35067        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
35068        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("spins")
35069        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("shoot")
35070        PORT_MODIFY("IN-16")
35071        // 0x0001 - "dil 1" // standard input (motherboard)
35072        // 0x0002 - "dil 2" // standard input (motherboard)
35073        // 0x0004 - "dil 3" // standard input (motherboard)
35074        // 0x0008 - "dil 4" // standard input (motherboard)
35075        // 0x0010 - "dil 5" // standard input (motherboard)
35076        // 0x0100 - "htopup" // known extended input, usually 'top up'
35077        PORT_MODIFY("IN-17")
35078        // 0x0001 - "dil 6" // standard input (motherboard)
35079        // 0x0002 - "dil 7" // standard input (motherboard)
35080        // 0x0004 - "dil 8" // standard input (motherboard)
35081        // 0x0008 - "dil 9" // standard input (motherboard)
35082        // 0x0010 - "dil 10" // standard input (motherboard)
35083        PORT_MODIFY("IN-18")
35084        // 0x0001 - "dil 11" // standard input (motherboard)
35085        // 0x0002 - "dil 12" // standard input (motherboard)
35086        // 0x0004 - "dil 13" // standard input (motherboard)
35087        // 0x0008 - "dil 14" // standard input (motherboard)
35088        // 0x0010 - "dil 15" // standard input (motherboard)
35089        PORT_MODIFY("IN-19")
35090        // 0x0001 - "dil 16" // standard input (motherboard)
35091        PORT_MODIFY("IN-20")
35092        // 0x0001 - "grnbut" // standard input (motherboard)
35093        // 0x0002 - "dorlok" // standard input (expected here)
35094        // 0x0004 - "serdor" // standard input (expected here)
35095        // 0x0008 - "cshdor" // standard input (expected here)
35096        // 0x0010 - "hopdmp" // standard input (expected here)
35038      PORT_INCLUDE( sc4_base )
35039      PORT_MODIFY("IN-1")
35040      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35041      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
35042      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
35043      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
35044      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
35045      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
35046      PORT_MODIFY("IN-2")
35047      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
35048      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
35049      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35050      PORT_MODIFY("IN-3")
35051      // 0x0004 - "stk 4" // standard input (expected here)
35052      // 0x0008 - "stk 3" // standard input (expected here)
35053      // 0x0010 - "stk 2" // standard input (expected here)
35054      PORT_MODIFY("IN-4")
35055      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
35056      PORT_MODIFY("IN-5")
35057      // 0x0001 - "priz4" // standard input (expected here)
35058      // 0x0002 - "priz3" // standard input (expected here)
35059      // 0x0004 - "priz2" // standard input (expected here)
35060      // 0x0008 - "priz1" // standard input (expected here)
35061      PORT_MODIFY("IN-6")
35062      // 0x0001 - "perc1" // standard input (expected here)
35063      // 0x0002 - "perc2" // standard input (expected here)
35064      // 0x0004 - "perc3" // standard input (expected here)
35065      // 0x0008 - "perc4" // standard input (expected here)
35066      PORT_MODIFY("IN-8")
35067      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
35068      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("spins")
35069      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("shoot")
35070      PORT_MODIFY("IN-16")
35071      // 0x0001 - "dil 1" // standard input (motherboard)
35072      // 0x0002 - "dil 2" // standard input (motherboard)
35073      // 0x0004 - "dil 3" // standard input (motherboard)
35074      // 0x0008 - "dil 4" // standard input (motherboard)
35075      // 0x0010 - "dil 5" // standard input (motherboard)
35076      // 0x0100 - "htopup" // known extended input, usually 'top up'
35077      PORT_MODIFY("IN-17")
35078      // 0x0001 - "dil 6" // standard input (motherboard)
35079      // 0x0002 - "dil 7" // standard input (motherboard)
35080      // 0x0004 - "dil 8" // standard input (motherboard)
35081      // 0x0008 - "dil 9" // standard input (motherboard)
35082      // 0x0010 - "dil 10" // standard input (motherboard)
35083      PORT_MODIFY("IN-18")
35084      // 0x0001 - "dil 11" // standard input (motherboard)
35085      // 0x0002 - "dil 12" // standard input (motherboard)
35086      // 0x0004 - "dil 13" // standard input (motherboard)
35087      // 0x0008 - "dil 14" // standard input (motherboard)
35088      // 0x0010 - "dil 15" // standard input (motherboard)
35089      PORT_MODIFY("IN-19")
35090      // 0x0001 - "dil 16" // standard input (motherboard)
35091      PORT_MODIFY("IN-20")
35092      // 0x0001 - "grnbut" // standard input (motherboard)
35093      // 0x0002 - "dorlok" // standard input (expected here)
35094      // 0x0004 - "serdor" // standard input (expected here)
35095      // 0x0008 - "cshdor" // standard input (expected here)
35096      // 0x0010 - "hopdmp" // standard input (expected here)
3509735097INPUT_PORTS_END
3509835098
3509935099
r31373r31374
3510735107
3510835108
3510935109INPUT_PORTS_START( sc4crsc ) // this structure is generated
35110        PORT_INCLUDE( sc4_base )
35111        PORT_MODIFY("IN-1")
35112        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
35113        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
35114        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
35115        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
35116        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("safe c")
35117        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
35118        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
35119        PORT_MODIFY("IN-2")
35120        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
35121        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
35122        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
35123        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35124        PORT_MODIFY("IN-3")
35125        // 0x0004 - "stk 4" // standard input (expected here)
35126        // 0x0008 - "stk 3" // standard input (expected here)
35127        // 0x0010 - "stk 2" // standard input (expected here)
35128        PORT_MODIFY("IN-5")
35129        // 0x0001 - "priz4" // standard input (expected here)
35130        // 0x0002 - "priz3" // standard input (expected here)
35131        // 0x0004 - "priz2" // standard input (expected here)
35132        // 0x0008 - "priz1" // standard input (expected here)
35133        PORT_MODIFY("IN-6")
35134        // 0x0001 - "perc1" // standard input (expected here)
35135        // 0x0002 - "perc2" // standard input (expected here)
35136        // 0x0004 - "perc3" // standard input (expected here)
35137        // 0x0008 - "perc4" // standard input (expected here)
35138        PORT_MODIFY("IN-8")
35139        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("h or m")
35140        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("leave")
35141        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("takeit")
35142        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("streak")
35143        PORT_MODIFY("IN-16")
35144        // 0x0001 - "dil1" // standard input (motherboard)
35145        // 0x0002 - "dil2" // standard input (motherboard)
35146        // 0x0004 - "dil3" // standard input (motherboard)
35147        // 0x0008 - "dil4" // standard input (motherboard)
35148        // 0x0010 - "dil5" // standard input (motherboard)
35149        // 0x0100 - "top up" // known extended input, usually 'top up'
35150        PORT_MODIFY("IN-17")
35151        // 0x0001 - "dil6" // standard input (motherboard)
35152        // 0x0002 - "dil7" // standard input (motherboard)
35153        // 0x0004 - "dil8" // standard input (motherboard)
35154        // 0x0008 - "dil9" // standard input (motherboard)
35155        // 0x0010 - "dil10" // standard input (motherboard)
35156        PORT_MODIFY("IN-18")
35157        // 0x0001 - "dil11" // standard input (motherboard)
35158        // 0x0002 - "dil12" // standard input (motherboard)
35159        // 0x0004 - "dil13" // standard input (motherboard)
35160        // 0x0008 - "dil14" // standard input (motherboard)
35161        // 0x0010 - "dil15" // standard input (motherboard)
35162        PORT_MODIFY("IN-19")
35163        // 0x0001 - "dil16" // standard input (motherboard)
35164        PORT_MODIFY("IN-20")
35165        // 0x0001 - "grnbut" // standard input (motherboard)
35166        // 0x0002 - "dorlok" // standard input (expected here)
35167        // 0x0004 - "serdor" // standard input (expected here)
35168        // 0x0008 - "cshdor" // standard input (expected here)
35169        // 0x0010 - "hopdmp" // standard input (expected here)
35110      PORT_INCLUDE( sc4_base )
35111      PORT_MODIFY("IN-1")
35112      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
35113      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
35114      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
35115      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
35116      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("safe c")
35117      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
35118      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
35119      PORT_MODIFY("IN-2")
35120      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
35121      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
35122      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
35123      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35124      PORT_MODIFY("IN-3")
35125      // 0x0004 - "stk 4" // standard input (expected here)
35126      // 0x0008 - "stk 3" // standard input (expected here)
35127      // 0x0010 - "stk 2" // standard input (expected here)
35128      PORT_MODIFY("IN-5")
35129      // 0x0001 - "priz4" // standard input (expected here)
35130      // 0x0002 - "priz3" // standard input (expected here)
35131      // 0x0004 - "priz2" // standard input (expected here)
35132      // 0x0008 - "priz1" // standard input (expected here)
35133      PORT_MODIFY("IN-6")
35134      // 0x0001 - "perc1" // standard input (expected here)
35135      // 0x0002 - "perc2" // standard input (expected here)
35136      // 0x0004 - "perc3" // standard input (expected here)
35137      // 0x0008 - "perc4" // standard input (expected here)
35138      PORT_MODIFY("IN-8")
35139      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("h or m")
35140      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("leave")
35141      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("takeit")
35142      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("streak")
35143      PORT_MODIFY("IN-16")
35144      // 0x0001 - "dil1" // standard input (motherboard)
35145      // 0x0002 - "dil2" // standard input (motherboard)
35146      // 0x0004 - "dil3" // standard input (motherboard)
35147      // 0x0008 - "dil4" // standard input (motherboard)
35148      // 0x0010 - "dil5" // standard input (motherboard)
35149      // 0x0100 - "top up" // known extended input, usually 'top up'
35150      PORT_MODIFY("IN-17")
35151      // 0x0001 - "dil6" // standard input (motherboard)
35152      // 0x0002 - "dil7" // standard input (motherboard)
35153      // 0x0004 - "dil8" // standard input (motherboard)
35154      // 0x0008 - "dil9" // standard input (motherboard)
35155      // 0x0010 - "dil10" // standard input (motherboard)
35156      PORT_MODIFY("IN-18")
35157      // 0x0001 - "dil11" // standard input (motherboard)
35158      // 0x0002 - "dil12" // standard input (motherboard)
35159      // 0x0004 - "dil13" // standard input (motherboard)
35160      // 0x0008 - "dil14" // standard input (motherboard)
35161      // 0x0010 - "dil15" // standard input (motherboard)
35162      PORT_MODIFY("IN-19")
35163      // 0x0001 - "dil16" // standard input (motherboard)
35164      PORT_MODIFY("IN-20")
35165      // 0x0001 - "grnbut" // standard input (motherboard)
35166      // 0x0002 - "dorlok" // standard input (expected here)
35167      // 0x0004 - "serdor" // standard input (expected here)
35168      // 0x0008 - "cshdor" // standard input (expected here)
35169      // 0x0010 - "hopdmp" // standard input (expected here)
3517035170INPUT_PORTS_END
3517135171
3517235172// PR3035 AWP COPS AND ROBBERS SAFE CRACKER S4         PR3005 SAFE CRACKER SOUNDS11      SAFE CRACKER  S.SITE
r31373r31374
3519735197}
3519835198
3519935199INPUT_PORTS_START( sc4coro ) // this structure is generated
35200        PORT_INCLUDE( sc4_base )
35201        PORT_MODIFY("IN-1")
35202        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
35203        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
35204        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
35205        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
35206        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
35207        PORT_MODIFY("IN-2")
35208        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
35209        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
35210        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
35211        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35212        PORT_MODIFY("IN-8")
35213        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
35214        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nuds")
35215        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("step")
35216        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("levl1")
35217        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("levl2")
35218        PORT_MODIFY("IN-9")
35219        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("levl3")
35220        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("levl4")
35221        PORT_MODIFY("IN-16")
35222        // 0x0001 - "dil  1" // standard input (motherboard)
35223        // 0x0002 - "dil  2" // standard input (motherboard)
35224        // 0x0004 - "dil  3" // standard input (motherboard)
35225        // 0x0008 - "dil  4" // standard input (motherboard)
35226        // 0x0010 - "dil  5" // standard input (motherboard)
35227        // 0x0100 - "top up" // known extended input, usually 'top up'
35228        PORT_MODIFY("IN-17")
35229        // 0x0001 - "dil  6" // standard input (motherboard)
35230        // 0x0002 - "dil  7" // standard input (motherboard)
35231        // 0x0004 - "dil  8" // standard input (motherboard)
35232        // 0x0008 - "dil  9" // standard input (motherboard)
35233        // 0x0010 - "dil 10" // standard input (motherboard)
35234        PORT_MODIFY("IN-18")
35235        // 0x0001 - "dil 11" // standard input (motherboard)
35236        // 0x0002 - "dil 12" // standard input (motherboard)
35237        // 0x0004 - "dil 13" // standard input (motherboard)
35238        // 0x0008 - "dil 14" // standard input (motherboard)
35239        // 0x0010 - "dil 15 OR deflt" // standard input (motherboard)
35240        PORT_MODIFY("IN-19")
35241        // 0x0001 - "dil 16" // standard input (motherboard)
35242        PORT_MODIFY("IN-20")
35243        // 0x0001 - "test" // standard input (motherboard)
35244        // 0x0002 - "dorlk" // standard input (expected here)
35245        // 0x0004 - "topdr" // standard input (expected here)
35246        // 0x0008 - "cshbx" // standard input (expected here)
35247        // 0x0010 - "hoplow" // standard input (expected here)
35200      PORT_INCLUDE( sc4_base )
35201      PORT_MODIFY("IN-1")
35202      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
35203      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
35204      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
35205      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
35206      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
35207      PORT_MODIFY("IN-2")
35208      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
35209      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
35210      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
35211      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35212      PORT_MODIFY("IN-8")
35213      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
35214      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nuds")
35215      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("step")
35216      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("levl1")
35217      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("levl2")
35218      PORT_MODIFY("IN-9")
35219      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("levl3")
35220      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("levl4")
35221      PORT_MODIFY("IN-16")
35222      // 0x0001 - "dil  1" // standard input (motherboard)
35223      // 0x0002 - "dil  2" // standard input (motherboard)
35224      // 0x0004 - "dil  3" // standard input (motherboard)
35225      // 0x0008 - "dil  4" // standard input (motherboard)
35226      // 0x0010 - "dil  5" // standard input (motherboard)
35227      // 0x0100 - "top up" // known extended input, usually 'top up'
35228      PORT_MODIFY("IN-17")
35229      // 0x0001 - "dil  6" // standard input (motherboard)
35230      // 0x0002 - "dil  7" // standard input (motherboard)
35231      // 0x0004 - "dil  8" // standard input (motherboard)
35232      // 0x0008 - "dil  9" // standard input (motherboard)
35233      // 0x0010 - "dil 10" // standard input (motherboard)
35234      PORT_MODIFY("IN-18")
35235      // 0x0001 - "dil 11" // standard input (motherboard)
35236      // 0x0002 - "dil 12" // standard input (motherboard)
35237      // 0x0004 - "dil 13" // standard input (motherboard)
35238      // 0x0008 - "dil 14" // standard input (motherboard)
35239      // 0x0010 - "dil 15 OR deflt" // standard input (motherboard)
35240      PORT_MODIFY("IN-19")
35241      // 0x0001 - "dil 16" // standard input (motherboard)
35242      PORT_MODIFY("IN-20")
35243      // 0x0001 - "test" // standard input (motherboard)
35244      // 0x0002 - "dorlk" // standard input (expected here)
35245      // 0x0004 - "topdr" // standard input (expected here)
35246      // 0x0008 - "cshbx" // standard input (expected here)
35247      // 0x0010 - "hoplow" // standard input (expected here)
3524835248INPUT_PORTS_END
3524935249
3525035250// PR2252 CORONATION  ST         CORRY SOUNDS                 CORONATION  ST
r31373r31374
3529235292}
3529335293
3529435294INPUT_PORTS_START( sc4coroc ) // this structure is generated
35295        PORT_INCLUDE( sc4_base )
35296        PORT_MODIFY("IN-1")
35297        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35298        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
35299        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
35300        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
35301        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("auto")
35302        PORT_MODIFY("IN-2")
35303        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("blank")
35304        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
35305        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35306        PORT_MODIFY("IN-4")
35307        // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
35308        PORT_MODIFY("IN-16")
35309        // 0x0001 - "dil  1" // standard input (motherboard)
35310        // 0x0002 - "dil  2" // standard input (motherboard)
35311        // 0x0004 - "dil  3" // standard input (motherboard)
35312        // 0x0008 - "dil  4" // standard input (motherboard)
35313        // 0x0010 - "dil  5" // standard input (motherboard)
35314        PORT_MODIFY("IN-17")
35315        // 0x0001 - "dil  6" // standard input (motherboard)
35316        // 0x0002 - "dil  7" // standard input (motherboard)
35317        // 0x0004 - "dil  8" // standard input (motherboard)
35318        // 0x0008 - "dil  9" // standard input (motherboard)
35319        // 0x0010 - "dil 10" // standard input (motherboard)
35320        PORT_MODIFY("IN-18")
35321        // 0x0001 - "dil 11" // standard input (motherboard)
35322        // 0x0002 - "dil 12" // standard input (motherboard)
35323        // 0x0004 - "dil 13" // standard input (motherboard)
35324        // 0x0008 - "dil 14" // standard input (motherboard)
35325        // 0x0010 - "dil 15" // standard input (motherboard)
35326        PORT_MODIFY("IN-19")
35327        // 0x0001 - "dil 16" // standard input (motherboard)
35328        PORT_MODIFY("IN-20")
35329        // 0x0001 - "test" // standard input (motherboard)
35330        // 0x0002 - "botdor OR botdor" // standard input (expected here)
35331        // 0x0004 - "topdor OR topdor" // standard input (expected here)
35332        // 0x0008 - "hopdmp OR hopdmp" // standard input (expected here)
35333        // 0x0010 - "topdor" // standard input (expected here)
35295      PORT_INCLUDE( sc4_base )
35296      PORT_MODIFY("IN-1")
35297      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35298      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
35299      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
35300      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
35301      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("auto")
35302      PORT_MODIFY("IN-2")
35303      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("blank")
35304      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
35305      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35306      PORT_MODIFY("IN-4")
35307      // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
35308      PORT_MODIFY("IN-16")
35309      // 0x0001 - "dil  1" // standard input (motherboard)
35310      // 0x0002 - "dil  2" // standard input (motherboard)
35311      // 0x0004 - "dil  3" // standard input (motherboard)
35312      // 0x0008 - "dil  4" // standard input (motherboard)
35313      // 0x0010 - "dil  5" // standard input (motherboard)
35314      PORT_MODIFY("IN-17")
35315      // 0x0001 - "dil  6" // standard input (motherboard)
35316      // 0x0002 - "dil  7" // standard input (motherboard)
35317      // 0x0004 - "dil  8" // standard input (motherboard)
35318      // 0x0008 - "dil  9" // standard input (motherboard)
35319      // 0x0010 - "dil 10" // standard input (motherboard)
35320      PORT_MODIFY("IN-18")
35321      // 0x0001 - "dil 11" // standard input (motherboard)
35322      // 0x0002 - "dil 12" // standard input (motherboard)
35323      // 0x0004 - "dil 13" // standard input (motherboard)
35324      // 0x0008 - "dil 14" // standard input (motherboard)
35325      // 0x0010 - "dil 15" // standard input (motherboard)
35326      PORT_MODIFY("IN-19")
35327      // 0x0001 - "dil 16" // standard input (motherboard)
35328      PORT_MODIFY("IN-20")
35329      // 0x0001 - "test" // standard input (motherboard)
35330      // 0x0002 - "botdor OR botdor" // standard input (expected here)
35331      // 0x0004 - "topdor OR topdor" // standard input (expected here)
35332      // 0x0008 - "hopdmp OR hopdmp" // standard input (expected here)
35333      // 0x0010 - "topdor" // standard input (expected here)
3533435334INPUT_PORTS_END
3533535335
3533635336INPUT_PORTS_START( sc4corod ) // this structure is generated
35337        PORT_INCLUDE( sc4_base )
35338        PORT_MODIFY("IN-1")
35339        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR colect")
35340        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
35341        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
35342        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
35343        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("autopl")
35344        PORT_MODIFY("IN-2")
35345        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
35346        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
35347        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35348        PORT_MODIFY("IN-3")
35349        // 0x0004 - "stk 4" // standard input (expected here)
35350        // 0x0008 - "stk 3" // standard input (expected here)
35351        // 0x0010 - "stk 2" // standard input (expected here)
35352        PORT_MODIFY("IN-4")
35353        // 0x0008 - "top up" // known extended(?) input, sometimes 'hop top'
35354        PORT_MODIFY("IN-5")
35355        // 0x0001 - "priz4" // standard input (expected here)
35356        // 0x0002 - "priz3" // standard input (expected here)
35357        // 0x0004 - "priz2" // standard input (expected here)
35358        // 0x0008 - "priz1" // standard input (expected here)
35359        PORT_MODIFY("IN-6")
35360        // 0x0001 - "perc1" // standard input (expected here)
35361        // 0x0002 - "perc2" // standard input (expected here)
35362        // 0x0004 - "perc3" // standard input (expected here)
35363        // 0x0008 - "perc4" // standard input (expected here)
35364        PORT_MODIFY("IN-16")
35365        // 0x0001 - "dil  1" // standard input (motherboard)
35366        // 0x0002 - "dil  2" // standard input (motherboard)
35367        // 0x0004 - "dil  3" // standard input (motherboard)
35368        // 0x0008 - "dil  4" // standard input (motherboard)
35369        // 0x0010 - "dil  5" // standard input (motherboard)
35370        PORT_MODIFY("IN-17")
35371        // 0x0001 - "dil  6" // standard input (motherboard)
35372        // 0x0002 - "dil  7" // standard input (motherboard)
35373        // 0x0004 - "dil  8" // standard input (motherboard)
35374        // 0x0008 - "dil  9" // standard input (motherboard)
35375        // 0x0010 - "dil 10" // standard input (motherboard)
35376        PORT_MODIFY("IN-18")
35377        // 0x0001 - "dil 11" // standard input (motherboard)
35378        // 0x0002 - "dil 12" // standard input (motherboard)
35379        // 0x0004 - "dil 13" // standard input (motherboard)
35380        // 0x0008 - "dil 14" // standard input (motherboard)
35381        // 0x0010 - "dil 15" // standard input (motherboard)
35382        PORT_MODIFY("IN-19")
35383        // 0x0001 - "dil 16" // standard input (motherboard)
35384        PORT_MODIFY("IN-20")
35385        // 0x0001 - "test" // standard input (motherboard)
35386        // 0x0004 - "cshdor" // standard input (expected here)
35387        // 0x0008 - "hopdmp" // standard input (expected here)
35388        // 0x0010 - "serdor" // standard input (expected here)
35337      PORT_INCLUDE( sc4_base )
35338      PORT_MODIFY("IN-1")
35339      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR colect")
35340      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
35341      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
35342      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
35343      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("autopl")
35344      PORT_MODIFY("IN-2")
35345      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
35346      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
35347      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35348      PORT_MODIFY("IN-3")
35349      // 0x0004 - "stk 4" // standard input (expected here)
35350      // 0x0008 - "stk 3" // standard input (expected here)
35351      // 0x0010 - "stk 2" // standard input (expected here)
35352      PORT_MODIFY("IN-4")
35353      // 0x0008 - "top up" // known extended(?) input, sometimes 'hop top'
35354      PORT_MODIFY("IN-5")
35355      // 0x0001 - "priz4" // standard input (expected here)
35356      // 0x0002 - "priz3" // standard input (expected here)
35357      // 0x0004 - "priz2" // standard input (expected here)
35358      // 0x0008 - "priz1" // standard input (expected here)
35359      PORT_MODIFY("IN-6")
35360      // 0x0001 - "perc1" // standard input (expected here)
35361      // 0x0002 - "perc2" // standard input (expected here)
35362      // 0x0004 - "perc3" // standard input (expected here)
35363      // 0x0008 - "perc4" // standard input (expected here)
35364      PORT_MODIFY("IN-16")
35365      // 0x0001 - "dil  1" // standard input (motherboard)
35366      // 0x0002 - "dil  2" // standard input (motherboard)
35367      // 0x0004 - "dil  3" // standard input (motherboard)
35368      // 0x0008 - "dil  4" // standard input (motherboard)
35369      // 0x0010 - "dil  5" // standard input (motherboard)
35370      PORT_MODIFY("IN-17")
35371      // 0x0001 - "dil  6" // standard input (motherboard)
35372      // 0x0002 - "dil  7" // standard input (motherboard)
35373      // 0x0004 - "dil  8" // standard input (motherboard)
35374      // 0x0008 - "dil  9" // standard input (motherboard)
35375      // 0x0010 - "dil 10" // standard input (motherboard)
35376      PORT_MODIFY("IN-18")
35377      // 0x0001 - "dil 11" // standard input (motherboard)
35378      // 0x0002 - "dil 12" // standard input (motherboard)
35379      // 0x0004 - "dil 13" // standard input (motherboard)
35380      // 0x0008 - "dil 14" // standard input (motherboard)
35381      // 0x0010 - "dil 15" // standard input (motherboard)
35382      PORT_MODIFY("IN-19")
35383      // 0x0001 - "dil 16" // standard input (motherboard)
35384      PORT_MODIFY("IN-20")
35385      // 0x0001 - "test" // standard input (motherboard)
35386      // 0x0004 - "cshdor" // standard input (expected here)
35387      // 0x0008 - "hopdmp" // standard input (expected here)
35388      // 0x0010 - "serdor" // standard input (expected here)
3538935389INPUT_PORTS_END
3539035390
3539135391
r31373r31374
3542235422}
3542335423
3542435424INPUT_PORTS_START( sc4corcl ) // this structure is generated
35425        PORT_INCLUDE( sc4_base )
35426        PORT_MODIFY("IN-1")
35427        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
35428        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
35429        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
35430        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
35431        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh5")
35432        PORT_MODIFY("IN-2")
35433        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh4")
35434        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh3")
35435        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh2")
35436        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35437        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("rh1")
35438        PORT_MODIFY("IN-3")
35439        // 0x0004 - "stk 4" // standard input (expected here)
35440        // 0x0008 - "stk 3" // standard input (expected here)
35441        // 0x0010 - "stk 2" // standard input (expected here)
35442        PORT_MODIFY("IN-4")
35443        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
35444        PORT_MODIFY("IN-5")
35445        // 0x0001 - "priz4" // standard input (expected here)
35446        // 0x0002 - "priz3" // standard input (expected here)
35447        // 0x0004 - "priz2" // standard input (expected here)
35448        // 0x0008 - "priz1" // standard input (expected here)
35449        PORT_MODIFY("IN-8")
35450        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("havnud")
35451        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
35452        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("level1")
35453        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("level2")
35454        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("level3")
35455        PORT_MODIFY("IN-9")
35456        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("level4")
35457        PORT_MODIFY("IN-16")
35458        // 0x0001 - "dil 1" // standard input (motherboard)
35459        // 0x0002 - "dil 2" // standard input (motherboard)
35460        // 0x0004 - "dil 3" // standard input (motherboard)
35461        // 0x0008 - "dil 4" // standard input (motherboard)
35462        // 0x0010 - "dil 5" // standard input (motherboard)
35463        // 0x0100 - "top up" // known extended input, usually 'top up'
35464        PORT_MODIFY("IN-17")
35465        // 0x0001 - "dil 6" // standard input (motherboard)
35466        // 0x0002 - "dil 7" // standard input (motherboard)
35467        // 0x0004 - "dil 8" // standard input (motherboard)
35468        // 0x0008 - "dil 9" // standard input (motherboard)
35469        // 0x0010 - "dil10" // standard input (motherboard)
35470        PORT_MODIFY("IN-18")
35471        // 0x0001 - "dil11" // standard input (motherboard)
35472        // 0x0002 - "dil12" // standard input (motherboard)
35473        // 0x0004 - "dil13" // standard input (motherboard)
35474        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
35475        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
35476        PORT_MODIFY("IN-19")
35477        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
35478        PORT_MODIFY("IN-20")
35479        // 0x0001 - "grnbut" // standard input (motherboard)
35480        // 0x0002 - "dorlok" // standard input (expected here)
35481        // 0x0004 - "topdor" // standard input (expected here)
35482        // 0x0008 - "botdor" // standard input (expected here)
35483        // 0x0010 - "hopdmp" // standard input (expected here)
35425      PORT_INCLUDE( sc4_base )
35426      PORT_MODIFY("IN-1")
35427      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
35428      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
35429      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
35430      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
35431      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh5")
35432      PORT_MODIFY("IN-2")
35433      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh4")
35434      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh3")
35435      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh2")
35436      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35437      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("rh1")
35438      PORT_MODIFY("IN-3")
35439      // 0x0004 - "stk 4" // standard input (expected here)
35440      // 0x0008 - "stk 3" // standard input (expected here)
35441      // 0x0010 - "stk 2" // standard input (expected here)
35442      PORT_MODIFY("IN-4")
35443      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
35444      PORT_MODIFY("IN-5")
35445      // 0x0001 - "priz4" // standard input (expected here)
35446      // 0x0002 - "priz3" // standard input (expected here)
35447      // 0x0004 - "priz2" // standard input (expected here)
35448      // 0x0008 - "priz1" // standard input (expected here)
35449      PORT_MODIFY("IN-8")
35450      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("havnud")
35451      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
35452      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("level1")
35453      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("level2")
35454      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("level3")
35455      PORT_MODIFY("IN-9")
35456      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("level4")
35457      PORT_MODIFY("IN-16")
35458      // 0x0001 - "dil 1" // standard input (motherboard)
35459      // 0x0002 - "dil 2" // standard input (motherboard)
35460      // 0x0004 - "dil 3" // standard input (motherboard)
35461      // 0x0008 - "dil 4" // standard input (motherboard)
35462      // 0x0010 - "dil 5" // standard input (motherboard)
35463      // 0x0100 - "top up" // known extended input, usually 'top up'
35464      PORT_MODIFY("IN-17")
35465      // 0x0001 - "dil 6" // standard input (motherboard)
35466      // 0x0002 - "dil 7" // standard input (motherboard)
35467      // 0x0004 - "dil 8" // standard input (motherboard)
35468      // 0x0008 - "dil 9" // standard input (motherboard)
35469      // 0x0010 - "dil10" // standard input (motherboard)
35470      PORT_MODIFY("IN-18")
35471      // 0x0001 - "dil11" // standard input (motherboard)
35472      // 0x0002 - "dil12" // standard input (motherboard)
35473      // 0x0004 - "dil13" // standard input (motherboard)
35474      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
35475      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
35476      PORT_MODIFY("IN-19")
35477      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
35478      PORT_MODIFY("IN-20")
35479      // 0x0001 - "grnbut" // standard input (motherboard)
35480      // 0x0002 - "dorlok" // standard input (expected here)
35481      // 0x0004 - "topdor" // standard input (expected here)
35482      // 0x0008 - "botdor" // standard input (expected here)
35483      // 0x0010 - "hopdmp" // standard input (expected here)
3548435484INPUT_PORTS_END
3548535485
3548635486// PR2383 CLUBCORONATIONSTREET         CLUBCORONATIONST  CLUB  CCORO SOUNDS         CLUB CORO ST
r31373r31374
3550435504}
3550535505
3550635506INPUT_PORTS_START( sc4count ) // this structure is generated
35507        PORT_INCLUDE( sc4_base )
35508        PORT_MODIFY("IN-1")
35509        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35510        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
35511        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
35512        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
35513        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
35514        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
35515        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
35516        PORT_MODIFY("IN-2")
35517        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
35518        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
35519        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
35520        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35521        PORT_MODIFY("IN-3")
35522        // 0x0004 - "stk 4" // standard input (expected here)
35523        // 0x0008 - "stk 3" // standard input (expected here)
35524        // 0x0010 - "stk 2" // standard input (expected here)
35525        PORT_MODIFY("IN-5")
35526        // 0x0001 - "priz4" // standard input (expected here)
35527        // 0x0002 - "priz3" // standard input (expected here)
35528        // 0x0004 - "priz2" // standard input (expected here)
35529        // 0x0008 - "priz1" // standard input (expected here)
35530        PORT_MODIFY("IN-6")
35531        // 0x0001 - "perc1" // standard input (expected here)
35532        // 0x0002 - "perc2" // standard input (expected here)
35533        // 0x0004 - "perc3" // standard input (expected here)
35534        // 0x0008 - "perc4" // standard input (expected here)
35535        PORT_MODIFY("IN-8")
35536        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
35537        PORT_MODIFY("IN-16")
35538        // 0x0001 - "dil1" // standard input (motherboard)
35539        // 0x0002 - "dil2" // standard input (motherboard)
35540        // 0x0004 - "dil3" // standard input (motherboard)
35541        // 0x0008 - "dil4" // standard input (motherboard)
35542        // 0x0010 - "dil5" // standard input (motherboard)
35543        // 0x0100 - "top up" // known extended input, usually 'top up'
35544        PORT_MODIFY("IN-17")
35545        // 0x0001 - "dil6" // standard input (motherboard)
35546        // 0x0002 - "dil7" // standard input (motherboard)
35547        // 0x0004 - "dil8" // standard input (motherboard)
35548        // 0x0008 - "dil9" // standard input (motherboard)
35549        // 0x0010 - "dil10" // standard input (motherboard)
35550        PORT_MODIFY("IN-18")
35551        // 0x0001 - "dil11" // standard input (motherboard)
35552        // 0x0002 - "dil12" // standard input (motherboard)
35553        // 0x0004 - "dil13" // standard input (motherboard)
35554        // 0x0008 - "dil14" // standard input (motherboard)
35555        // 0x0010 - "dil15" // standard input (motherboard)
35556        PORT_MODIFY("IN-19")
35557        // 0x0001 - "dil16" // standard input (motherboard)
35558        PORT_MODIFY("IN-20")
35559        // 0x0001 - "grnbut" // standard input (motherboard)
35560        // 0x0002 - "dorlok" // standard input (expected here)
35561        // 0x0004 - "serdor" // standard input (expected here)
35562        // 0x0008 - "cshdor" // standard input (expected here)
35563        // 0x0010 - "hopdmp" // standard input (expected here)
35507      PORT_INCLUDE( sc4_base )
35508      PORT_MODIFY("IN-1")
35509      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35510      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
35511      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
35512      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
35513      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
35514      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
35515      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
35516      PORT_MODIFY("IN-2")
35517      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
35518      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
35519      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
35520      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35521      PORT_MODIFY("IN-3")
35522      // 0x0004 - "stk 4" // standard input (expected here)
35523      // 0x0008 - "stk 3" // standard input (expected here)
35524      // 0x0010 - "stk 2" // standard input (expected here)
35525      PORT_MODIFY("IN-5")
35526      // 0x0001 - "priz4" // standard input (expected here)
35527      // 0x0002 - "priz3" // standard input (expected here)
35528      // 0x0004 - "priz2" // standard input (expected here)
35529      // 0x0008 - "priz1" // standard input (expected here)
35530      PORT_MODIFY("IN-6")
35531      // 0x0001 - "perc1" // standard input (expected here)
35532      // 0x0002 - "perc2" // standard input (expected here)
35533      // 0x0004 - "perc3" // standard input (expected here)
35534      // 0x0008 - "perc4" // standard input (expected here)
35535      PORT_MODIFY("IN-8")
35536      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
35537      PORT_MODIFY("IN-16")
35538      // 0x0001 - "dil1" // standard input (motherboard)
35539      // 0x0002 - "dil2" // standard input (motherboard)
35540      // 0x0004 - "dil3" // standard input (motherboard)
35541      // 0x0008 - "dil4" // standard input (motherboard)
35542      // 0x0010 - "dil5" // standard input (motherboard)
35543      // 0x0100 - "top up" // known extended input, usually 'top up'
35544      PORT_MODIFY("IN-17")
35545      // 0x0001 - "dil6" // standard input (motherboard)
35546      // 0x0002 - "dil7" // standard input (motherboard)
35547      // 0x0004 - "dil8" // standard input (motherboard)
35548      // 0x0008 - "dil9" // standard input (motherboard)
35549      // 0x0010 - "dil10" // standard input (motherboard)
35550      PORT_MODIFY("IN-18")
35551      // 0x0001 - "dil11" // standard input (motherboard)
35552      // 0x0002 - "dil12" // standard input (motherboard)
35553      // 0x0004 - "dil13" // standard input (motherboard)
35554      // 0x0008 - "dil14" // standard input (motherboard)
35555      // 0x0010 - "dil15" // standard input (motherboard)
35556      PORT_MODIFY("IN-19")
35557      // 0x0001 - "dil16" // standard input (motherboard)
35558      PORT_MODIFY("IN-20")
35559      // 0x0001 - "grnbut" // standard input (motherboard)
35560      // 0x0002 - "dorlok" // standard input (expected here)
35561      // 0x0004 - "serdor" // standard input (expected here)
35562      // 0x0008 - "cshdor" // standard input (expected here)
35563      // 0x0010 - "hopdmp" // standard input (expected here)
3556435564INPUT_PORTS_END
3556535565
3556635566// PR1929 AWP COUNTDOWN S4         PR1909 COUNTDOWN SOUNDS11         COUNTDOWN S.SITE
r31373r31374
3558635586}
3558735587
3558835588INPUT_PORTS_START( sc4dnd ) // this structure is generated
35589        PORT_INCLUDE( sc4_base )
35590        PORT_MODIFY("IN-1")
35591        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35592        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
35593        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
35594        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
35595        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 4")
35596        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
35597        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
35598        PORT_MODIFY("IN-2")
35599        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("cstake")
35600        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("colect")
35601        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
35602        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35603        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
35604        PORT_MODIFY("IN-3")
35605        // 0x0004 - "stk 4" // standard input (expected here)
35606        // 0x0008 - "stk 2" // standard input (expected here)
35607        // 0x0010 - "stk 3" // standard input (expected here)
35608        PORT_MODIFY("IN-5")
35609        // 0x0001 - "priz4" // standard input (expected here)
35610        // 0x0002 - "priz3" // standard input (expected here)
35611        // 0x0004 - "priz2" // standard input (expected here)
35612        // 0x0008 - "priz1" // standard input (expected here)
35613        PORT_MODIFY("IN-6")
35614        // 0x0001 - "perc1" // standard input (expected here)
35615        // 0x0002 - "perc2" // standard input (expected here)
35616        // 0x0004 - "perc3" // standard input (expected here)
35617        // 0x0008 - "perc4" // standard input (expected here)
35618        PORT_MODIFY("IN-8")
35619        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nodeal")
35620        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("deal")
35621        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c or b")
35622        PORT_MODIFY("IN-16")
35623        // 0x0001 - "dil1" // standard input (motherboard)
35624        // 0x0002 - "dil2" // standard input (motherboard)
35625        // 0x0004 - "dil3" // standard input (motherboard)
35626        // 0x0008 - "dil4" // standard input (motherboard)
35627        // 0x0010 - "dil5" // standard input (motherboard)
35628        // 0x0100 - "top up" // known extended input, usually 'top up'
35629        PORT_MODIFY("IN-17")
35630        // 0x0001 - "dil6" // standard input (motherboard)
35631        // 0x0002 - "dil7" // standard input (motherboard)
35632        // 0x0004 - "dil8" // standard input (motherboard)
35633        // 0x0008 - "dil9" // standard input (motherboard)
35634        // 0x0010 - "dil10" // standard input (motherboard)
35635        PORT_MODIFY("IN-18")
35636        // 0x0001 - "dil11" // standard input (motherboard)
35637        // 0x0002 - "dil12" // standard input (motherboard)
35638        // 0x0004 - "dil13" // standard input (motherboard)
35639        // 0x0008 - "dil14" // standard input (motherboard)
35640        // 0x0010 - "dil15" // standard input (motherboard)
35641        PORT_MODIFY("IN-19")
35642        // 0x0001 - "dil16" // standard input (motherboard)
35643        PORT_MODIFY("IN-20")
35644        // 0x0001 - "grnbut" // standard input (motherboard)
35645        // 0x0002 - "dorlok" // standard input (expected here)
35646        // 0x0004 - "serdor" // standard input (expected here)
35647        // 0x0008 - "cshdor" // standard input (expected here)
35648        // 0x0010 - "hopdmp" // standard input (expected here)
35589      PORT_INCLUDE( sc4_base )
35590      PORT_MODIFY("IN-1")
35591      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35592      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
35593      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
35594      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
35595      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 4")
35596      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
35597      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
35598      PORT_MODIFY("IN-2")
35599      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("cstake")
35600      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("colect")
35601      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
35602      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35603      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
35604      PORT_MODIFY("IN-3")
35605      // 0x0004 - "stk 4" // standard input (expected here)
35606      // 0x0008 - "stk 2" // standard input (expected here)
35607      // 0x0010 - "stk 3" // standard input (expected here)
35608      PORT_MODIFY("IN-5")
35609      // 0x0001 - "priz4" // standard input (expected here)
35610      // 0x0002 - "priz3" // standard input (expected here)
35611      // 0x0004 - "priz2" // standard input (expected here)
35612      // 0x0008 - "priz1" // standard input (expected here)
35613      PORT_MODIFY("IN-6")
35614      // 0x0001 - "perc1" // standard input (expected here)
35615      // 0x0002 - "perc2" // standard input (expected here)
35616      // 0x0004 - "perc3" // standard input (expected here)
35617      // 0x0008 - "perc4" // standard input (expected here)
35618      PORT_MODIFY("IN-8")
35619      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nodeal")
35620      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("deal")
35621      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c or b")
35622      PORT_MODIFY("IN-16")
35623      // 0x0001 - "dil1" // standard input (motherboard)
35624      // 0x0002 - "dil2" // standard input (motherboard)
35625      // 0x0004 - "dil3" // standard input (motherboard)
35626      // 0x0008 - "dil4" // standard input (motherboard)
35627      // 0x0010 - "dil5" // standard input (motherboard)
35628      // 0x0100 - "top up" // known extended input, usually 'top up'
35629      PORT_MODIFY("IN-17")
35630      // 0x0001 - "dil6" // standard input (motherboard)
35631      // 0x0002 - "dil7" // standard input (motherboard)
35632      // 0x0004 - "dil8" // standard input (motherboard)
35633      // 0x0008 - "dil9" // standard input (motherboard)
35634      // 0x0010 - "dil10" // standard input (motherboard)
35635      PORT_MODIFY("IN-18")
35636      // 0x0001 - "dil11" // standard input (motherboard)
35637      // 0x0002 - "dil12" // standard input (motherboard)
35638      // 0x0004 - "dil13" // standard input (motherboard)
35639      // 0x0008 - "dil14" // standard input (motherboard)
35640      // 0x0010 - "dil15" // standard input (motherboard)
35641      PORT_MODIFY("IN-19")
35642      // 0x0001 - "dil16" // standard input (motherboard)
35643      PORT_MODIFY("IN-20")
35644      // 0x0001 - "grnbut" // standard input (motherboard)
35645      // 0x0002 - "dorlok" // standard input (expected here)
35646      // 0x0004 - "serdor" // standard input (expected here)
35647      // 0x0008 - "cshdor" // standard input (expected here)
35648      // 0x0010 - "hopdmp" // standard input (expected here)
3564935649INPUT_PORTS_END
3565035650INPUT_PORTS_START( sc4dnd25 )
3565135651   PORT_INCLUDE( sc4dnd )
r31373r31374
3569835698}
3569935699
3570035700INPUT_PORTS_START( sc4dndcs ) // this structure is generated
35701        PORT_INCLUDE( sc4_base )
35702        PORT_MODIFY("IN-1")
35703        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35704        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
35705        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
35706        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
35707        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 4")
35708        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
35709        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
35710        PORT_MODIFY("IN-2")
35711        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("cstake")
35712        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("colect")
35713        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35714        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
35715        PORT_MODIFY("IN-3")
35716        // 0x0004 - "stk 4" // standard input (expected here)
35717        // 0x0008 - "stk 2" // standard input (expected here)
35718        // 0x0010 - "stk 3" // standard input (expected here)
35719        PORT_MODIFY("IN-5")
35720        // 0x0001 - "priz4" // standard input (expected here)
35721        // 0x0002 - "priz3" // standard input (expected here)
35722        // 0x0004 - "priz2" // standard input (expected here)
35723        // 0x0008 - "priz1" // standard input (expected here)
35724        PORT_MODIFY("IN-6")
35725        // 0x0001 - "perc1" // standard input (expected here)
35726        // 0x0002 - "perc2" // standard input (expected here)
35727        // 0x0004 - "perc3" // standard input (expected here)
35728        // 0x0008 - "perc4" // standard input (expected here)
35729        PORT_MODIFY("IN-8")
35730        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nodeal")
35731        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("deal")
35732        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c or b")
35733        PORT_MODIFY("IN-16")
35734        // 0x0001 - "dil1" // standard input (motherboard)
35735        // 0x0002 - "dil2" // standard input (motherboard)
35736        // 0x0004 - "dil3" // standard input (motherboard)
35737        // 0x0008 - "dil4" // standard input (motherboard)
35738        // 0x0010 - "dil5" // standard input (motherboard)
35739        // 0x0100 - "top up" // known extended input, usually 'top up'
35740        PORT_MODIFY("IN-17")
35741        // 0x0001 - "dil6" // standard input (motherboard)
35742        // 0x0002 - "dil7" // standard input (motherboard)
35743        // 0x0004 - "dil8" // standard input (motherboard)
35744        // 0x0008 - "dil9" // standard input (motherboard)
35745        // 0x0010 - "dil10" // standard input (motherboard)
35746        PORT_MODIFY("IN-18")
35747        // 0x0001 - "dil11" // standard input (motherboard)
35748        // 0x0002 - "dil12" // standard input (motherboard)
35749        // 0x0004 - "dil13" // standard input (motherboard)
35750        // 0x0008 - "dil14" // standard input (motherboard)
35751        // 0x0010 - "dil15" // standard input (motherboard)
35752        PORT_MODIFY("IN-19")
35753        // 0x0001 - "dil16" // standard input (motherboard)
35754        PORT_MODIFY("IN-20")
35755        // 0x0001 - "grnbut" // standard input (motherboard)
35756        // 0x0002 - "dorlok" // standard input (expected here)
35757        // 0x0004 - "serdor" // standard input (expected here)
35758        // 0x0008 - "cshdor" // standard input (expected here)
35759        // 0x0010 - "hopdmp" // standard input (expected here)
35701      PORT_INCLUDE( sc4_base )
35702      PORT_MODIFY("IN-1")
35703      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35704      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
35705      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
35706      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
35707      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 4")
35708      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
35709      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
35710      PORT_MODIFY("IN-2")
35711      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("cstake")
35712      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("colect")
35713      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35714      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
35715      PORT_MODIFY("IN-3")
35716      // 0x0004 - "stk 4" // standard input (expected here)
35717      // 0x0008 - "stk 2" // standard input (expected here)
35718      // 0x0010 - "stk 3" // standard input (expected here)
35719      PORT_MODIFY("IN-5")
35720      // 0x0001 - "priz4" // standard input (expected here)
35721      // 0x0002 - "priz3" // standard input (expected here)
35722      // 0x0004 - "priz2" // standard input (expected here)
35723      // 0x0008 - "priz1" // standard input (expected here)
35724      PORT_MODIFY("IN-6")
35725      // 0x0001 - "perc1" // standard input (expected here)
35726      // 0x0002 - "perc2" // standard input (expected here)
35727      // 0x0004 - "perc3" // standard input (expected here)
35728      // 0x0008 - "perc4" // standard input (expected here)
35729      PORT_MODIFY("IN-8")
35730      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nodeal")
35731      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("deal")
35732      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c or b")
35733      PORT_MODIFY("IN-16")
35734      // 0x0001 - "dil1" // standard input (motherboard)
35735      // 0x0002 - "dil2" // standard input (motherboard)
35736      // 0x0004 - "dil3" // standard input (motherboard)
35737      // 0x0008 - "dil4" // standard input (motherboard)
35738      // 0x0010 - "dil5" // standard input (motherboard)
35739      // 0x0100 - "top up" // known extended input, usually 'top up'
35740      PORT_MODIFY("IN-17")
35741      // 0x0001 - "dil6" // standard input (motherboard)
35742      // 0x0002 - "dil7" // standard input (motherboard)
35743      // 0x0004 - "dil8" // standard input (motherboard)
35744      // 0x0008 - "dil9" // standard input (motherboard)
35745      // 0x0010 - "dil10" // standard input (motherboard)
35746      PORT_MODIFY("IN-18")
35747      // 0x0001 - "dil11" // standard input (motherboard)
35748      // 0x0002 - "dil12" // standard input (motherboard)
35749      // 0x0004 - "dil13" // standard input (motherboard)
35750      // 0x0008 - "dil14" // standard input (motherboard)
35751      // 0x0010 - "dil15" // standard input (motherboard)
35752      PORT_MODIFY("IN-19")
35753      // 0x0001 - "dil16" // standard input (motherboard)
35754      PORT_MODIFY("IN-20")
35755      // 0x0001 - "grnbut" // standard input (motherboard)
35756      // 0x0002 - "dorlok" // standard input (expected here)
35757      // 0x0004 - "serdor" // standard input (expected here)
35758      // 0x0008 - "cshdor" // standard input (expected here)
35759      // 0x0010 - "hopdmp" // standard input (expected here)
3576035760INPUT_PORTS_END
3576135761
3576235762INPUT_PORTS_START( sc4dndcs5 )
r31373r31374
3579135791}
3579235792
3579335793INPUT_PORTS_START( sc4dndbb ) // this structure is generated
35794        PORT_INCLUDE( sc4_base )
35795        PORT_MODIFY("IN-1")
35796        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35797        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
35798        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
35799        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
35800        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
35801        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
35802        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
35803        PORT_MODIFY("IN-2")
35804        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
35805        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
35806        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
35807        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35808        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
35809        PORT_MODIFY("IN-3")
35810        // 0x0004 - "stk 4" // standard input (expected here)
35811        // 0x0008 - "stk 3" // standard input (expected here)
35812        // 0x0010 - "stk 2" // standard input (expected here)
35813        PORT_MODIFY("IN-5")
35814        // 0x0001 - "priz4" // standard input (expected here)
35815        // 0x0002 - "priz3" // standard input (expected here)
35816        // 0x0004 - "priz2" // standard input (expected here)
35817        // 0x0008 - "priz1" // standard input (expected here)
35818        PORT_MODIFY("IN-6")
35819        // 0x0001 - "perc1" // standard input (expected here)
35820        // 0x0002 - "perc2" // standard input (expected here)
35821        // 0x0004 - "perc3" // standard input (expected here)
35822        // 0x0008 - "perc4" // standard input (expected here)
35823        PORT_MODIFY("IN-8")
35824        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cs bus")
35825        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
35826        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nodeal")
35827        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("deal")
35828        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk str")
35829        PORT_MODIFY("IN-9")
35830        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("pl del")
35831        PORT_MODIFY("IN-16")
35832        // 0x0001 - "dil1" // standard input (motherboard)
35833        // 0x0002 - "dil2" // standard input (motherboard)
35834        // 0x0004 - "dil3" // standard input (motherboard)
35835        // 0x0008 - "dil4" // standard input (motherboard)
35836        // 0x0010 - "dil5" // standard input (motherboard)
35837        // 0x0100 - "top up" // known extended input, usually 'top up'
35838        PORT_MODIFY("IN-17")
35839        // 0x0001 - "dil6" // standard input (motherboard)
35840        // 0x0002 - "dil7" // standard input (motherboard)
35841        // 0x0004 - "dil8" // standard input (motherboard)
35842        // 0x0008 - "dil9" // standard input (motherboard)
35843        // 0x0010 - "dil10" // standard input (motherboard)
35844        PORT_MODIFY("IN-18")
35845        // 0x0001 - "dil11" // standard input (motherboard)
35846        // 0x0002 - "dil12" // standard input (motherboard)
35847        // 0x0004 - "dil13" // standard input (motherboard)
35848        // 0x0008 - "dil14" // standard input (motherboard)
35849        // 0x0010 - "dil15" // standard input (motherboard)
35850        PORT_MODIFY("IN-19")
35851        // 0x0001 - "dil16" // standard input (motherboard)
35852        PORT_MODIFY("IN-20")
35853        // 0x0001 - "grnbut" // standard input (motherboard)
35854        // 0x0002 - "dorlok" // standard input (expected here)
35855        // 0x0004 - "serdor" // standard input (expected here)
35856        // 0x0008 - "cshdor" // standard input (expected here)
35857        // 0x0010 - "hopdmp" // standard input (expected here)
35794      PORT_INCLUDE( sc4_base )
35795      PORT_MODIFY("IN-1")
35796      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35797      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
35798      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
35799      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
35800      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
35801      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
35802      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
35803      PORT_MODIFY("IN-2")
35804      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
35805      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
35806      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
35807      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35808      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
35809      PORT_MODIFY("IN-3")
35810      // 0x0004 - "stk 4" // standard input (expected here)
35811      // 0x0008 - "stk 3" // standard input (expected here)
35812      // 0x0010 - "stk 2" // standard input (expected here)
35813      PORT_MODIFY("IN-5")
35814      // 0x0001 - "priz4" // standard input (expected here)
35815      // 0x0002 - "priz3" // standard input (expected here)
35816      // 0x0004 - "priz2" // standard input (expected here)
35817      // 0x0008 - "priz1" // standard input (expected here)
35818      PORT_MODIFY("IN-6")
35819      // 0x0001 - "perc1" // standard input (expected here)
35820      // 0x0002 - "perc2" // standard input (expected here)
35821      // 0x0004 - "perc3" // standard input (expected here)
35822      // 0x0008 - "perc4" // standard input (expected here)
35823      PORT_MODIFY("IN-8")
35824      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cs bus")
35825      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
35826      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nodeal")
35827      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("deal")
35828      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk str")
35829      PORT_MODIFY("IN-9")
35830      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("pl del")
35831      PORT_MODIFY("IN-16")
35832      // 0x0001 - "dil1" // standard input (motherboard)
35833      // 0x0002 - "dil2" // standard input (motherboard)
35834      // 0x0004 - "dil3" // standard input (motherboard)
35835      // 0x0008 - "dil4" // standard input (motherboard)
35836      // 0x0010 - "dil5" // standard input (motherboard)
35837      // 0x0100 - "top up" // known extended input, usually 'top up'
35838      PORT_MODIFY("IN-17")
35839      // 0x0001 - "dil6" // standard input (motherboard)
35840      // 0x0002 - "dil7" // standard input (motherboard)
35841      // 0x0004 - "dil8" // standard input (motherboard)
35842      // 0x0008 - "dil9" // standard input (motherboard)
35843      // 0x0010 - "dil10" // standard input (motherboard)
35844      PORT_MODIFY("IN-18")
35845      // 0x0001 - "dil11" // standard input (motherboard)
35846      // 0x0002 - "dil12" // standard input (motherboard)
35847      // 0x0004 - "dil13" // standard input (motherboard)
35848      // 0x0008 - "dil14" // standard input (motherboard)
35849      // 0x0010 - "dil15" // standard input (motherboard)
35850      PORT_MODIFY("IN-19")
35851      // 0x0001 - "dil16" // standard input (motherboard)
35852      PORT_MODIFY("IN-20")
35853      // 0x0001 - "grnbut" // standard input (motherboard)
35854      // 0x0002 - "dorlok" // standard input (expected here)
35855      // 0x0004 - "serdor" // standard input (expected here)
35856      // 0x0008 - "cshdor" // standard input (expected here)
35857      // 0x0010 - "hopdmp" // standard input (expected here)
3585835858INPUT_PORTS_END
3585935859
3586035860INPUT_PORTS_START( sc4dndbb35 )
r31373r31374
3590035900   m_reel_setup = sc4dndcl_reel_configs;
3590135901}
3590235902INPUT_PORTS_START( sc4dndcl ) // this structure is generated
35903        PORT_INCLUDE( sc4_base )
35904        PORT_MODIFY("IN-1")
35905        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35906        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
35907        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
35908        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
35909        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
35910        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
35911        PORT_MODIFY("IN-2")
35912        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("st/col")
35913        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ch gme")
35914        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("trnsfr")
35915        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35916        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("exchng")
35917        PORT_MODIFY("IN-3")
35918        // 0x0004 - "stk 4" // standard input (expected here)
35919        // 0x0008 - "stk 3" // standard input (expected here)
35920        // 0x0010 - "stk 2" // standard input (expected here)
35921        PORT_MODIFY("IN-4")
35922        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
35923        PORT_MODIFY("IN-5")
35924        // 0x0001 - "priz4" // standard input (expected here)
35925        // 0x0002 - "priz3" // standard input (expected here)
35926        // 0x0004 - "priz2" // standard input (expected here)
35927        // 0x0008 - "priz1" // standard input (expected here)
35928        PORT_MODIFY("IN-8")
35929        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("start")
35930        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("gam ft")
35931        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nodeal")
35932        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk nud")
35933        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("deal")
35934        PORT_MODIFY("IN-16")
35935        // 0x0001 - "dil 1" // standard input (motherboard)
35936        // 0x0002 - "dil 2" // standard input (motherboard)
35937        // 0x0004 - "dil 3" // standard input (motherboard)
35938        // 0x0008 - "dil 4" // standard input (motherboard)
35939        // 0x0010 - "dil 5" // standard input (motherboard)
35940        // 0x0100 - "top up" // known extended input, usually 'top up'
35941        PORT_MODIFY("IN-17")
35942        // 0x0001 - "dil 6" // standard input (motherboard)
35943        // 0x0002 - "dil 7" // standard input (motherboard)
35944        // 0x0004 - "dil 8" // standard input (motherboard)
35945        // 0x0008 - "dil 9" // standard input (motherboard)
35946        // 0x0010 - "dil10" // standard input (motherboard)
35947        PORT_MODIFY("IN-18")
35948        // 0x0001 - "dil11" // standard input (motherboard)
35949        // 0x0002 - "dil12" // standard input (motherboard)
35950        // 0x0004 - "dil13" // standard input (motherboard)
35951        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
35952        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
35953        PORT_MODIFY("IN-19")
35954        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
35955        PORT_MODIFY("IN-20")
35956        // 0x0001 - "grnbut" // standard input (motherboard)
35957        // 0x0002 - "dorlok" // standard input (expected here)
35958        // 0x0004 - "topdor" // standard input (expected here)
35959        // 0x0008 - "botdor" // standard input (expected here)
35960        // 0x0010 - "hopdmp" // standard input (expected here)
35903      PORT_INCLUDE( sc4_base )
35904      PORT_MODIFY("IN-1")
35905      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
35906      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
35907      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
35908      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
35909      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
35910      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
35911      PORT_MODIFY("IN-2")
35912      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("st/col")
35913      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ch gme")
35914      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("trnsfr")
35915      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
35916      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("exchng")
35917      PORT_MODIFY("IN-3")
35918      // 0x0004 - "stk 4" // standard input (expected here)
35919      // 0x0008 - "stk 3" // standard input (expected here)
35920      // 0x0010 - "stk 2" // standard input (expected here)
35921      PORT_MODIFY("IN-4")
35922      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
35923      PORT_MODIFY("IN-5")
35924      // 0x0001 - "priz4" // standard input (expected here)
35925      // 0x0002 - "priz3" // standard input (expected here)
35926      // 0x0004 - "priz2" // standard input (expected here)
35927      // 0x0008 - "priz1" // standard input (expected here)
35928      PORT_MODIFY("IN-8")
35929      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("start")
35930      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("gam ft")
35931      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nodeal")
35932      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk nud")
35933      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("deal")
35934      PORT_MODIFY("IN-16")
35935      // 0x0001 - "dil 1" // standard input (motherboard)
35936      // 0x0002 - "dil 2" // standard input (motherboard)
35937      // 0x0004 - "dil 3" // standard input (motherboard)
35938      // 0x0008 - "dil 4" // standard input (motherboard)
35939      // 0x0010 - "dil 5" // standard input (motherboard)
35940      // 0x0100 - "top up" // known extended input, usually 'top up'
35941      PORT_MODIFY("IN-17")
35942      // 0x0001 - "dil 6" // standard input (motherboard)
35943      // 0x0002 - "dil 7" // standard input (motherboard)
35944      // 0x0004 - "dil 8" // standard input (motherboard)
35945      // 0x0008 - "dil 9" // standard input (motherboard)
35946      // 0x0010 - "dil10" // standard input (motherboard)
35947      PORT_MODIFY("IN-18")
35948      // 0x0001 - "dil11" // standard input (motherboard)
35949      // 0x0002 - "dil12" // standard input (motherboard)
35950      // 0x0004 - "dil13" // standard input (motherboard)
35951      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
35952      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
35953      PORT_MODIFY("IN-19")
35954      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
35955      PORT_MODIFY("IN-20")
35956      // 0x0001 - "grnbut" // standard input (motherboard)
35957      // 0x0002 - "dorlok" // standard input (expected here)
35958      // 0x0004 - "topdor" // standard input (expected here)
35959      // 0x0008 - "botdor" // standard input (expected here)
35960      // 0x0010 - "hopdmp" // standard input (expected here)
3596135961INPUT_PORTS_END
3596235962
3596335963INPUT_PORTS_START( sc4dndcl250 )
r31373r31374
3600036000   m_reel_setup = sc4dnddd_reel_configs;
3600136001}
3600236002INPUT_PORTS_START( sc4dnddd ) // this structure is generated
36003        PORT_INCLUDE( sc4_base )
36004        PORT_MODIFY("IN-1")
36005        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36006        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36007        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36008        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36009        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36010        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36011        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36012        PORT_MODIFY("IN-2")
36013        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36014        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
36015        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
36016        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36017        PORT_MODIFY("IN-3")
36018        // 0x0004 - "stk 4" // standard input (expected here)
36019        // 0x0008 - "stk 3" // standard input (expected here)
36020        // 0x0010 - "stk 2" // standard input (expected here)
36021        PORT_MODIFY("IN-5")
36022        // 0x0001 - "priz4" // standard input (expected here)
36023        // 0x0002 - "priz3" // standard input (expected here)
36024        // 0x0004 - "priz2" // standard input (expected here)
36025        // 0x0008 - "priz1" // standard input (expected here)
36026        PORT_MODIFY("IN-6")
36027        // 0x0001 - "perc1" // standard input (expected here)
36028        // 0x0002 - "perc2" // standard input (expected here)
36029        // 0x0004 - "perc3" // standard input (expected here)
36030        // 0x0008 - "perc4" // standard input (expected here)
36031        PORT_MODIFY("IN-8")
36032        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c or b")
36033        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("pl don")
36034        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("no dea")
36035        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("deal")
36036        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk str")
36037        PORT_MODIFY("IN-16")
36038        // 0x0001 - "dil1" // standard input (motherboard)
36039        // 0x0002 - "dil2" // standard input (motherboard)
36040        // 0x0004 - "dil3" // standard input (motherboard)
36041        // 0x0008 - "dil4" // standard input (motherboard)
36042        // 0x0010 - "dil5" // standard input (motherboard)
36043        // 0x0100 - "top up" // known extended input, usually 'top up'
36044        PORT_MODIFY("IN-17")
36045        // 0x0001 - "dil6" // standard input (motherboard)
36046        // 0x0002 - "dil7" // standard input (motherboard)
36047        // 0x0004 - "dil8" // standard input (motherboard)
36048        // 0x0008 - "dil9" // standard input (motherboard)
36049        // 0x0010 - "dil10" // standard input (motherboard)
36050        PORT_MODIFY("IN-18")
36051        // 0x0001 - "dil11" // standard input (motherboard)
36052        // 0x0002 - "dil12" // standard input (motherboard)
36053        // 0x0004 - "dil13" // standard input (motherboard)
36054        // 0x0008 - "dil14" // standard input (motherboard)
36055        // 0x0010 - "dil15" // standard input (motherboard)
36056        PORT_MODIFY("IN-19")
36057        // 0x0001 - "dil16" // standard input (motherboard)
36058        PORT_MODIFY("IN-20")
36059        // 0x0001 - "grnbut" // standard input (motherboard)
36060        // 0x0002 - "dorlok" // standard input (expected here)
36061        // 0x0004 - "serdor" // standard input (expected here)
36062        // 0x0008 - "cshdor" // standard input (expected here)
36063        // 0x0010 - "hopdmp" // standard input (expected here)
36003      PORT_INCLUDE( sc4_base )
36004      PORT_MODIFY("IN-1")
36005      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36006      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36007      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36008      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36009      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36010      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36011      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36012      PORT_MODIFY("IN-2")
36013      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36014      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
36015      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
36016      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36017      PORT_MODIFY("IN-3")
36018      // 0x0004 - "stk 4" // standard input (expected here)
36019      // 0x0008 - "stk 3" // standard input (expected here)
36020      // 0x0010 - "stk 2" // standard input (expected here)
36021      PORT_MODIFY("IN-5")
36022      // 0x0001 - "priz4" // standard input (expected here)
36023      // 0x0002 - "priz3" // standard input (expected here)
36024      // 0x0004 - "priz2" // standard input (expected here)
36025      // 0x0008 - "priz1" // standard input (expected here)
36026      PORT_MODIFY("IN-6")
36027      // 0x0001 - "perc1" // standard input (expected here)
36028      // 0x0002 - "perc2" // standard input (expected here)
36029      // 0x0004 - "perc3" // standard input (expected here)
36030      // 0x0008 - "perc4" // standard input (expected here)
36031      PORT_MODIFY("IN-8")
36032      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c or b")
36033      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("pl don")
36034      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("no dea")
36035      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("deal")
36036      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk str")
36037      PORT_MODIFY("IN-16")
36038      // 0x0001 - "dil1" // standard input (motherboard)
36039      // 0x0002 - "dil2" // standard input (motherboard)
36040      // 0x0004 - "dil3" // standard input (motherboard)
36041      // 0x0008 - "dil4" // standard input (motherboard)
36042      // 0x0010 - "dil5" // standard input (motherboard)
36043      // 0x0100 - "top up" // known extended input, usually 'top up'
36044      PORT_MODIFY("IN-17")
36045      // 0x0001 - "dil6" // standard input (motherboard)
36046      // 0x0002 - "dil7" // standard input (motherboard)
36047      // 0x0004 - "dil8" // standard input (motherboard)
36048      // 0x0008 - "dil9" // standard input (motherboard)
36049      // 0x0010 - "dil10" // standard input (motherboard)
36050      PORT_MODIFY("IN-18")
36051      // 0x0001 - "dil11" // standard input (motherboard)
36052      // 0x0002 - "dil12" // standard input (motherboard)
36053      // 0x0004 - "dil13" // standard input (motherboard)
36054      // 0x0008 - "dil14" // standard input (motherboard)
36055      // 0x0010 - "dil15" // standard input (motherboard)
36056      PORT_MODIFY("IN-19")
36057      // 0x0001 - "dil16" // standard input (motherboard)
36058      PORT_MODIFY("IN-20")
36059      // 0x0001 - "grnbut" // standard input (motherboard)
36060      // 0x0002 - "dorlok" // standard input (expected here)
36061      // 0x0004 - "serdor" // standard input (expected here)
36062      // 0x0008 - "cshdor" // standard input (expected here)
36063      // 0x0010 - "hopdmp" // standard input (expected here)
3606436064INPUT_PORTS_END
3606536065
3606636066INPUT_PORTS_START( sc4dnddd35 )
r31373r31374
3610536105}
3610636106
3610736107INPUT_PORTS_START( sc4dndhf ) // this structure is generated
36108        PORT_INCLUDE( sc4_base )
36109        PORT_MODIFY("IN-1")
36110        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36111        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collct")
36112        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
36113        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
36114        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
36115        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36116        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36117        PORT_MODIFY("IN-2")
36118        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake")
36119        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
36120        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
36121        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36122        PORT_MODIFY("IN-3")
36123        // 0x0004 - "stk 4" // standard input (expected here)
36124        // 0x0008 - "stk 3" // standard input (expected here)
36125        // 0x0010 - "stk 2" // standard input (expected here)
36126        PORT_MODIFY("IN-5")
36127        // 0x0001 - "priz4" // standard input (expected here)
36128        // 0x0002 - "priz3" // standard input (expected here)
36129        // 0x0004 - "priz2" // standard input (expected here)
36130        // 0x0008 - "priz1" // standard input (expected here)
36131        PORT_MODIFY("IN-6")
36132        // 0x0001 - "perc1" // standard input (expected here)
36133        // 0x0002 - "perc2" // standard input (expected here)
36134        // 0x0004 - "perc3" // standard input (expected here)
36135        // 0x0008 - "perc4" // standard input (expected here)
36136        PORT_MODIFY("IN-8")
36137        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("autonu")
36138        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nodeal")
36139        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("play d")
36140        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("deal")
36141        PORT_MODIFY("IN-16")
36142        // 0x0001 - "dil1" // standard input (motherboard)
36143        // 0x0002 - "dil2" // standard input (motherboard)
36144        // 0x0004 - "dil3" // standard input (motherboard)
36145        // 0x0008 - "dil4" // standard input (motherboard)
36146        // 0x0010 - "dil5" // standard input (motherboard)
36147        // 0x0100 - "htopup" // known extended input, usually 'top up'
36148        PORT_MODIFY("IN-17")
36149        // 0x0001 - "dil6" // standard input (motherboard)
36150        // 0x0002 - "dil7" // standard input (motherboard)
36151        // 0x0004 - "dil8" // standard input (motherboard)
36152        // 0x0008 - "dil9" // standard input (motherboard)
36153        // 0x0010 - "dil10" // standard input (motherboard)
36154        PORT_MODIFY("IN-18")
36155        // 0x0001 - "dil11" // standard input (motherboard)
36156        // 0x0002 - "dil12" // standard input (motherboard)
36157        // 0x0004 - "dil13" // standard input (motherboard)
36158        // 0x0008 - "dil14" // standard input (motherboard)
36159        // 0x0010 - "dil15" // standard input (motherboard)
36160        PORT_MODIFY("IN-19")
36161        // 0x0001 - "dil16" // standard input (motherboard)
36162        PORT_MODIFY("IN-20")
36163        // 0x0001 - "grnbut" // standard input (motherboard)
36164        // 0x0002 - "dorlok" // standard input (expected here)
36165        // 0x0004 - "serdor" // standard input (expected here)
36166        // 0x0008 - "cshdor" // standard input (expected here)
36167        // 0x0010 - "hopdmp" // standard input (expected here)
36108      PORT_INCLUDE( sc4_base )
36109      PORT_MODIFY("IN-1")
36110      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36111      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collct")
36112      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
36113      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
36114      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
36115      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36116      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36117      PORT_MODIFY("IN-2")
36118      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake")
36119      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
36120      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
36121      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36122      PORT_MODIFY("IN-3")
36123      // 0x0004 - "stk 4" // standard input (expected here)
36124      // 0x0008 - "stk 3" // standard input (expected here)
36125      // 0x0010 - "stk 2" // standard input (expected here)
36126      PORT_MODIFY("IN-5")
36127      // 0x0001 - "priz4" // standard input (expected here)
36128      // 0x0002 - "priz3" // standard input (expected here)
36129      // 0x0004 - "priz2" // standard input (expected here)
36130      // 0x0008 - "priz1" // standard input (expected here)
36131      PORT_MODIFY("IN-6")
36132      // 0x0001 - "perc1" // standard input (expected here)
36133      // 0x0002 - "perc2" // standard input (expected here)
36134      // 0x0004 - "perc3" // standard input (expected here)
36135      // 0x0008 - "perc4" // standard input (expected here)
36136      PORT_MODIFY("IN-8")
36137      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("autonu")
36138      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nodeal")
36139      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("play d")
36140      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("deal")
36141      PORT_MODIFY("IN-16")
36142      // 0x0001 - "dil1" // standard input (motherboard)
36143      // 0x0002 - "dil2" // standard input (motherboard)
36144      // 0x0004 - "dil3" // standard input (motherboard)
36145      // 0x0008 - "dil4" // standard input (motherboard)
36146      // 0x0010 - "dil5" // standard input (motherboard)
36147      // 0x0100 - "htopup" // known extended input, usually 'top up'
36148      PORT_MODIFY("IN-17")
36149      // 0x0001 - "dil6" // standard input (motherboard)
36150      // 0x0002 - "dil7" // standard input (motherboard)
36151      // 0x0004 - "dil8" // standard input (motherboard)
36152      // 0x0008 - "dil9" // standard input (motherboard)
36153      // 0x0010 - "dil10" // standard input (motherboard)
36154      PORT_MODIFY("IN-18")
36155      // 0x0001 - "dil11" // standard input (motherboard)
36156      // 0x0002 - "dil12" // standard input (motherboard)
36157      // 0x0004 - "dil13" // standard input (motherboard)
36158      // 0x0008 - "dil14" // standard input (motherboard)
36159      // 0x0010 - "dil15" // standard input (motherboard)
36160      PORT_MODIFY("IN-19")
36161      // 0x0001 - "dil16" // standard input (motherboard)
36162      PORT_MODIFY("IN-20")
36163      // 0x0001 - "grnbut" // standard input (motherboard)
36164      // 0x0002 - "dorlok" // standard input (expected here)
36165      // 0x0004 - "serdor" // standard input (expected here)
36166      // 0x0008 - "cshdor" // standard input (expected here)
36167      // 0x0010 - "hopdmp" // standard input (expected here)
3616836168INPUT_PORTS_END
3616936169
3617036170
r31373r31374
3621436214}
3621536215
3621636216INPUT_PORTS_START( sc4dndys ) // this structure is generated
36217        PORT_INCLUDE( sc4_base )
36218        PORT_MODIFY("IN-1")
36219        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36220        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36221        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36222        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36223        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36224        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36225        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36226        PORT_MODIFY("IN-2")
36227        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("cstake")
36228        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchan")
36229        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
36230        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36231        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
36232        PORT_MODIFY("IN-3")
36233        // 0x0004 - "stk 4" // standard input (expected here)
36234        // 0x0008 - "stk 3" // standard input (expected here)
36235        // 0x0010 - "stk 2" // standard input (expected here)
36236        PORT_MODIFY("IN-5")
36237        // 0x0001 - "priz4" // standard input (expected here)
36238        // 0x0002 - "priz3" // standard input (expected here)
36239        // 0x0004 - "priz2" // standard input (expected here)
36240        // 0x0008 - "priz1" // standard input (expected here)
36241        PORT_MODIFY("IN-6")
36242        // 0x0001 - "perc1" // standard input (expected here)
36243        // 0x0002 - "perc2" // standard input (expected here)
36244        // 0x0004 - "perc3" // standard input (expected here)
36245        // 0x0008 - "perc4" // standard input (expected here)
36246        PORT_MODIFY("IN-8")
36247        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bns gm")
36248        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lo fea")
36249        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lo sup")
36250        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lo csh")
36251        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("step")
36252        PORT_MODIFY("IN-9")
36253        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hi fea")
36254        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hi sup")
36255        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("hi csh")
36256        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("ply dl")
36257        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("nodeal")
36258        PORT_MODIFY("IN-10")
36259        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_0 ) PORT_NAME("deal")
36260        PORT_MODIFY("IN-16")
36261        // 0x0001 - "dil1" // standard input (motherboard)
36262        // 0x0002 - "dil2" // standard input (motherboard)
36263        // 0x0004 - "dil3" // standard input (motherboard)
36264        // 0x0008 - "dil4" // standard input (motherboard)
36265        // 0x0010 - "dil5" // standard input (motherboard)
36266        // 0x0100 - "top up" // known extended input, usually 'top up'
36267        PORT_MODIFY("IN-17")
36268        // 0x0001 - "dil6" // standard input (motherboard)
36269        // 0x0002 - "dil7" // standard input (motherboard)
36270        // 0x0004 - "dil8" // standard input (motherboard)
36271        // 0x0008 - "dil9" // standard input (motherboard)
36272        // 0x0010 - "dil10" // standard input (motherboard)
36273        PORT_MODIFY("IN-18")
36274        // 0x0001 - "dil11" // standard input (motherboard)
36275        // 0x0002 - "dil12" // standard input (motherboard)
36276        // 0x0004 - "dil13" // standard input (motherboard)
36277        // 0x0008 - "dil14" // standard input (motherboard)
36278        // 0x0010 - "dil15" // standard input (motherboard)
36279        PORT_MODIFY("IN-19")
36280        // 0x0001 - "dil16" // standard input (motherboard)
36281        PORT_MODIFY("IN-20")
36282        // 0x0001 - "grnbut" // standard input (motherboard)
36283        // 0x0002 - "dorlok" // standard input (expected here)
36284        // 0x0004 - "serdor" // standard input (expected here)
36285        // 0x0008 - "cshdor" // standard input (expected here)
36286        // 0x0010 - "hopdmp" // standard input (expected here)
36217      PORT_INCLUDE( sc4_base )
36218      PORT_MODIFY("IN-1")
36219      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36220      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36221      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36222      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36223      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36224      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36225      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36226      PORT_MODIFY("IN-2")
36227      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("cstake")
36228      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchan")
36229      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
36230      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36231      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
36232      PORT_MODIFY("IN-3")
36233      // 0x0004 - "stk 4" // standard input (expected here)
36234      // 0x0008 - "stk 3" // standard input (expected here)
36235      // 0x0010 - "stk 2" // standard input (expected here)
36236      PORT_MODIFY("IN-5")
36237      // 0x0001 - "priz4" // standard input (expected here)
36238      // 0x0002 - "priz3" // standard input (expected here)
36239      // 0x0004 - "priz2" // standard input (expected here)
36240      // 0x0008 - "priz1" // standard input (expected here)
36241      PORT_MODIFY("IN-6")
36242      // 0x0001 - "perc1" // standard input (expected here)
36243      // 0x0002 - "perc2" // standard input (expected here)
36244      // 0x0004 - "perc3" // standard input (expected here)
36245      // 0x0008 - "perc4" // standard input (expected here)
36246      PORT_MODIFY("IN-8")
36247      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bns gm")
36248      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lo fea")
36249      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lo sup")
36250      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lo csh")
36251      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("step")
36252      PORT_MODIFY("IN-9")
36253      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hi fea")
36254      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hi sup")
36255      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("hi csh")
36256      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("ply dl")
36257      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("nodeal")
36258      PORT_MODIFY("IN-10")
36259      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_10_0 ) PORT_NAME("deal")
36260      PORT_MODIFY("IN-16")
36261      // 0x0001 - "dil1" // standard input (motherboard)
36262      // 0x0002 - "dil2" // standard input (motherboard)
36263      // 0x0004 - "dil3" // standard input (motherboard)
36264      // 0x0008 - "dil4" // standard input (motherboard)
36265      // 0x0010 - "dil5" // standard input (motherboard)
36266      // 0x0100 - "top up" // known extended input, usually 'top up'
36267      PORT_MODIFY("IN-17")
36268      // 0x0001 - "dil6" // standard input (motherboard)
36269      // 0x0002 - "dil7" // standard input (motherboard)
36270      // 0x0004 - "dil8" // standard input (motherboard)
36271      // 0x0008 - "dil9" // standard input (motherboard)
36272      // 0x0010 - "dil10" // standard input (motherboard)
36273      PORT_MODIFY("IN-18")
36274      // 0x0001 - "dil11" // standard input (motherboard)
36275      // 0x0002 - "dil12" // standard input (motherboard)
36276      // 0x0004 - "dil13" // standard input (motherboard)
36277      // 0x0008 - "dil14" // standard input (motherboard)
36278      // 0x0010 - "dil15" // standard input (motherboard)
36279      PORT_MODIFY("IN-19")
36280      // 0x0001 - "dil16" // standard input (motherboard)
36281      PORT_MODIFY("IN-20")
36282      // 0x0001 - "grnbut" // standard input (motherboard)
36283      // 0x0002 - "dorlok" // standard input (expected here)
36284      // 0x0004 - "serdor" // standard input (expected here)
36285      // 0x0008 - "cshdor" // standard input (expected here)
36286      // 0x0010 - "hopdmp" // standard input (expected here)
3628736287INPUT_PORTS_END
3628836288
3628936289INPUT_PORTS_START( sc4dndys35 )
r31373r31374
3632536325}
3632636326
3632736327INPUT_PORTS_START( sc4dndlp ) // this structure is generated
36328        PORT_INCLUDE( sc4_base )
36329        PORT_MODIFY("IN-1")
36330        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36331        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36332        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36333        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36334        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36335        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36336        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36337        PORT_MODIFY("IN-2")
36338        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36339        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
36340        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
36341        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36342        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
36343        PORT_MODIFY("IN-3")
36344        // 0x0004 - "stk 4" // standard input (expected here)
36345        // 0x0008 - "stk 3" // standard input (expected here)
36346        // 0x0010 - "stk 2" // standard input (expected here)
36347        PORT_MODIFY("IN-5")
36348        // 0x0001 - "priz4" // standard input (expected here)
36349        // 0x0002 - "priz3" // standard input (expected here)
36350        // 0x0004 - "priz2" // standard input (expected here)
36351        // 0x0008 - "priz1" // standard input (expected here)
36352        PORT_MODIFY("IN-6")
36353        // 0x0001 - "perc1" // standard input (expected here)
36354        // 0x0002 - "perc2" // standard input (expected here)
36355        // 0x0004 - "perc3" // standard input (expected here)
36356        // 0x0008 - "perc4" // standard input (expected here)
36357        PORT_MODIFY("IN-8")
36358        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cs bus")
36359        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
36360        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mes")
36361        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("z1 but")
36362        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("z2 but")
36363        PORT_MODIFY("IN-9")
36364        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("z3 but")
36365        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("z4 but")
36366        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("deal")
36367        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("pl del")
36368        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("nodeal")
36369        PORT_MODIFY("IN-16")
36370        // 0x0001 - "dil1" // standard input (motherboard)
36371        // 0x0002 - "dil2" // standard input (motherboard)
36372        // 0x0004 - "dil3" // standard input (motherboard)
36373        // 0x0008 - "dil4" // standard input (motherboard)
36374        // 0x0010 - "dil5" // standard input (motherboard)
36375        // 0x0100 - "top up" // known extended input, usually 'top up'
36376        PORT_MODIFY("IN-17")
36377        // 0x0001 - "dil6" // standard input (motherboard)
36378        // 0x0002 - "dil7" // standard input (motherboard)
36379        // 0x0004 - "dil8" // standard input (motherboard)
36380        // 0x0008 - "dil9" // standard input (motherboard)
36381        // 0x0010 - "dil10" // standard input (motherboard)
36382        PORT_MODIFY("IN-18")
36383        // 0x0001 - "dil11" // standard input (motherboard)
36384        // 0x0002 - "dil12" // standard input (motherboard)
36385        // 0x0004 - "dil13" // standard input (motherboard)
36386        // 0x0008 - "dil14" // standard input (motherboard)
36387        // 0x0010 - "dil15" // standard input (motherboard)
36388        PORT_MODIFY("IN-19")
36389        // 0x0001 - "dil16" // standard input (motherboard)
36390        PORT_MODIFY("IN-20")
36391        // 0x0001 - "grnbut" // standard input (motherboard)
36392        // 0x0002 - "dorlok" // standard input (expected here)
36393        // 0x0004 - "serdor" // standard input (expected here)
36394        // 0x0008 - "cshdor" // standard input (expected here)
36395        // 0x0010 - "hopdmp" // standard input (expected here)
36328      PORT_INCLUDE( sc4_base )
36329      PORT_MODIFY("IN-1")
36330      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36331      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36332      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36333      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36334      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36335      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36336      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36337      PORT_MODIFY("IN-2")
36338      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36339      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
36340      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
36341      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36342      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
36343      PORT_MODIFY("IN-3")
36344      // 0x0004 - "stk 4" // standard input (expected here)
36345      // 0x0008 - "stk 3" // standard input (expected here)
36346      // 0x0010 - "stk 2" // standard input (expected here)
36347      PORT_MODIFY("IN-5")
36348      // 0x0001 - "priz4" // standard input (expected here)
36349      // 0x0002 - "priz3" // standard input (expected here)
36350      // 0x0004 - "priz2" // standard input (expected here)
36351      // 0x0008 - "priz1" // standard input (expected here)
36352      PORT_MODIFY("IN-6")
36353      // 0x0001 - "perc1" // standard input (expected here)
36354      // 0x0002 - "perc2" // standard input (expected here)
36355      // 0x0004 - "perc3" // standard input (expected here)
36356      // 0x0008 - "perc4" // standard input (expected here)
36357      PORT_MODIFY("IN-8")
36358      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cs bus")
36359      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
36360      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mes")
36361      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("z1 but")
36362      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("z2 but")
36363      PORT_MODIFY("IN-9")
36364      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("z3 but")
36365      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("z4 but")
36366      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("deal")
36367      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("pl del")
36368      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("nodeal")
36369      PORT_MODIFY("IN-16")
36370      // 0x0001 - "dil1" // standard input (motherboard)
36371      // 0x0002 - "dil2" // standard input (motherboard)
36372      // 0x0004 - "dil3" // standard input (motherboard)
36373      // 0x0008 - "dil4" // standard input (motherboard)
36374      // 0x0010 - "dil5" // standard input (motherboard)
36375      // 0x0100 - "top up" // known extended input, usually 'top up'
36376      PORT_MODIFY("IN-17")
36377      // 0x0001 - "dil6" // standard input (motherboard)
36378      // 0x0002 - "dil7" // standard input (motherboard)
36379      // 0x0004 - "dil8" // standard input (motherboard)
36380      // 0x0008 - "dil9" // standard input (motherboard)
36381      // 0x0010 - "dil10" // standard input (motherboard)
36382      PORT_MODIFY("IN-18")
36383      // 0x0001 - "dil11" // standard input (motherboard)
36384      // 0x0002 - "dil12" // standard input (motherboard)
36385      // 0x0004 - "dil13" // standard input (motherboard)
36386      // 0x0008 - "dil14" // standard input (motherboard)
36387      // 0x0010 - "dil15" // standard input (motherboard)
36388      PORT_MODIFY("IN-19")
36389      // 0x0001 - "dil16" // standard input (motherboard)
36390      PORT_MODIFY("IN-20")
36391      // 0x0001 - "grnbut" // standard input (motherboard)
36392      // 0x0002 - "dorlok" // standard input (expected here)
36393      // 0x0004 - "serdor" // standard input (expected here)
36394      // 0x0008 - "cshdor" // standard input (expected here)
36395      // 0x0010 - "hopdmp" // standard input (expected here)
3639636396INPUT_PORTS_END
3639736397
3639836398
r31373r31374
3643036430}
3643136431
3643236432INPUT_PORTS_START( sc4dndra ) // this structure is generated
36433        PORT_INCLUDE( sc4_base )
36434        PORT_MODIFY("IN-1")
36435        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36436        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36437        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36438        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36439        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36440        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36441        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36442        PORT_MODIFY("IN-2")
36443        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36444        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
36445        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
36446        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36447        PORT_MODIFY("IN-3")
36448        // 0x0004 - "stk 4" // standard input (expected here)
36449        // 0x0008 - "stk 3" // standard input (expected here)
36450        // 0x0010 - "stk 2" // standard input (expected here)
36451        PORT_MODIFY("IN-5")
36452        // 0x0001 - "priz4" // standard input (expected here)
36453        // 0x0002 - "priz3" // standard input (expected here)
36454        // 0x0004 - "priz2" // standard input (expected here)
36455        // 0x0008 - "priz1" // standard input (expected here)
36456        PORT_MODIFY("IN-6")
36457        // 0x0001 - "perc1" // standard input (expected here)
36458        // 0x0002 - "perc2" // standard input (expected here)
36459        // 0x0004 - "perc3" // standard input (expected here)
36460        // 0x0008 - "perc4" // standard input (expected here)
36461        PORT_MODIFY("IN-8")
36462        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("b gamb")
36463        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
36464        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nodeal")
36465        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("p deal")
36466        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("deal")
36467        PORT_MODIFY("IN-9")
36468        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("p s bd")
36469        PORT_MODIFY("IN-16")
36470        // 0x0001 - "dil1" // standard input (motherboard)
36471        // 0x0002 - "dil2" // standard input (motherboard)
36472        // 0x0004 - "dil3" // standard input (motherboard)
36473        // 0x0008 - "dil4" // standard input (motherboard)
36474        // 0x0010 - "dil5" // standard input (motherboard)
36475        // 0x0100 - "top up" // known extended input, usually 'top up'
36476        PORT_MODIFY("IN-17")
36477        // 0x0001 - "dil6" // standard input (motherboard)
36478        // 0x0002 - "dil7" // standard input (motherboard)
36479        // 0x0004 - "dil8" // standard input (motherboard)
36480        // 0x0008 - "dil9" // standard input (motherboard)
36481        // 0x0010 - "dil10" // standard input (motherboard)
36482        PORT_MODIFY("IN-18")
36483        // 0x0001 - "dil11" // standard input (motherboard)
36484        // 0x0002 - "dil12" // standard input (motherboard)
36485        // 0x0004 - "dil13" // standard input (motherboard)
36486        // 0x0008 - "dil14" // standard input (motherboard)
36487        // 0x0010 - "dil15" // standard input (motherboard)
36488        PORT_MODIFY("IN-19")
36489        // 0x0001 - "dil16" // standard input (motherboard)
36490        PORT_MODIFY("IN-20")
36491        // 0x0001 - "grnbut" // standard input (motherboard)
36492        // 0x0002 - "dorlok" // standard input (expected here)
36493        // 0x0004 - "serdor" // standard input (expected here)
36494        // 0x0008 - "cshdor" // standard input (expected here)
36495        // 0x0010 - "hopdmp" // standard input (expected here)
36433      PORT_INCLUDE( sc4_base )
36434      PORT_MODIFY("IN-1")
36435      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36436      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36437      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36438      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36439      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36440      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36441      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36442      PORT_MODIFY("IN-2")
36443      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36444      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
36445      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
36446      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36447      PORT_MODIFY("IN-3")
36448      // 0x0004 - "stk 4" // standard input (expected here)
36449      // 0x0008 - "stk 3" // standard input (expected here)
36450      // 0x0010 - "stk 2" // standard input (expected here)
36451      PORT_MODIFY("IN-5")
36452      // 0x0001 - "priz4" // standard input (expected here)
36453      // 0x0002 - "priz3" // standard input (expected here)
36454      // 0x0004 - "priz2" // standard input (expected here)
36455      // 0x0008 - "priz1" // standard input (expected here)
36456      PORT_MODIFY("IN-6")
36457      // 0x0001 - "perc1" // standard input (expected here)
36458      // 0x0002 - "perc2" // standard input (expected here)
36459      // 0x0004 - "perc3" // standard input (expected here)
36460      // 0x0008 - "perc4" // standard input (expected here)
36461      PORT_MODIFY("IN-8")
36462      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("b gamb")
36463      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
36464      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nodeal")
36465      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("p deal")
36466      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("deal")
36467      PORT_MODIFY("IN-9")
36468      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("p s bd")
36469      PORT_MODIFY("IN-16")
36470      // 0x0001 - "dil1" // standard input (motherboard)
36471      // 0x0002 - "dil2" // standard input (motherboard)
36472      // 0x0004 - "dil3" // standard input (motherboard)
36473      // 0x0008 - "dil4" // standard input (motherboard)
36474      // 0x0010 - "dil5" // standard input (motherboard)
36475      // 0x0100 - "top up" // known extended input, usually 'top up'
36476      PORT_MODIFY("IN-17")
36477      // 0x0001 - "dil6" // standard input (motherboard)
36478      // 0x0002 - "dil7" // standard input (motherboard)
36479      // 0x0004 - "dil8" // standard input (motherboard)
36480      // 0x0008 - "dil9" // standard input (motherboard)
36481      // 0x0010 - "dil10" // standard input (motherboard)
36482      PORT_MODIFY("IN-18")
36483      // 0x0001 - "dil11" // standard input (motherboard)
36484      // 0x0002 - "dil12" // standard input (motherboard)
36485      // 0x0004 - "dil13" // standard input (motherboard)
36486      // 0x0008 - "dil14" // standard input (motherboard)
36487      // 0x0010 - "dil15" // standard input (motherboard)
36488      PORT_MODIFY("IN-19")
36489      // 0x0001 - "dil16" // standard input (motherboard)
36490      PORT_MODIFY("IN-20")
36491      // 0x0001 - "grnbut" // standard input (motherboard)
36492      // 0x0002 - "dorlok" // standard input (expected here)
36493      // 0x0004 - "serdor" // standard input (expected here)
36494      // 0x0008 - "cshdor" // standard input (expected here)
36495      // 0x0010 - "hopdmp" // standard input (expected here)
3649636496INPUT_PORTS_END
3649736497
3649836498INPUT_PORTS_START( sc4dndra35 )
r31373r31374
3653436534}
3653536535
3653636536INPUT_PORTS_START( sc4dndbd ) // this structure is generated
36537        PORT_INCLUDE( sc4_base )
36538        PORT_MODIFY("IN-1")
36539        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36540        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36541        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36542        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36543        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36544        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36545        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36546        PORT_MODIFY("IN-2")
36547        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36548        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
36549        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
36550        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36551        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
36552        PORT_MODIFY("IN-3")
36553        // 0x0004 - "stk 4" // standard input (expected here)
36554        // 0x0008 - "stk 3" // standard input (expected here)
36555        // 0x0010 - "stk 2" // standard input (expected here)
36556        PORT_MODIFY("IN-5")
36557        // 0x0001 - "priz4" // standard input (expected here)
36558        // 0x0002 - "priz3" // standard input (expected here)
36559        // 0x0004 - "priz2" // standard input (expected here)
36560        // 0x0008 - "priz1" // standard input (expected here)
36561        PORT_MODIFY("IN-6")
36562        // 0x0001 - "perc1" // standard input (expected here)
36563        // 0x0002 - "perc2" // standard input (expected here)
36564        // 0x0004 - "perc3" // standard input (expected here)
36565        // 0x0008 - "perc4" // standard input (expected here)
36566        PORT_MODIFY("IN-8")
36567        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cs bus")
36568        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nodeal")
36569        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("pl del")
36570        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("deal")
36571        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk mes")
36572        PORT_MODIFY("IN-9")
36573        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("tk str")
36574        PORT_MODIFY("IN-16")
36575        // 0x0001 - "dil1" // standard input (motherboard)
36576        // 0x0002 - "dil2" // standard input (motherboard)
36577        // 0x0004 - "dil3" // standard input (motherboard)
36578        // 0x0008 - "dil4" // standard input (motherboard)
36579        // 0x0010 - "dil5" // standard input (motherboard)
36580        // 0x0100 - "top up" // known extended input, usually 'top up'
36581        PORT_MODIFY("IN-17")
36582        // 0x0001 - "dil6" // standard input (motherboard)
36583        // 0x0002 - "dil7" // standard input (motherboard)
36584        // 0x0004 - "dil8" // standard input (motherboard)
36585        // 0x0008 - "dil9" // standard input (motherboard)
36586        // 0x0010 - "dil10" // standard input (motherboard)
36587        PORT_MODIFY("IN-18")
36588        // 0x0001 - "dil11" // standard input (motherboard)
36589        // 0x0002 - "dil12" // standard input (motherboard)
36590        // 0x0004 - "dil13" // standard input (motherboard)
36591        // 0x0008 - "dil14" // standard input (motherboard)
36592        // 0x0010 - "dil15" // standard input (motherboard)
36593        PORT_MODIFY("IN-19")
36594        // 0x0001 - "dil16" // standard input (motherboard)
36595        PORT_MODIFY("IN-20")
36596        // 0x0001 - "grnbut" // standard input (motherboard)
36597        // 0x0002 - "dorlok" // standard input (expected here)
36598        // 0x0004 - "serdor" // standard input (expected here)
36599        // 0x0008 - "cshdor" // standard input (expected here)
36600        // 0x0010 - "hopdmp" // standard input (expected here)
36537      PORT_INCLUDE( sc4_base )
36538      PORT_MODIFY("IN-1")
36539      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36540      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36541      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36542      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36543      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36544      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36545      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36546      PORT_MODIFY("IN-2")
36547      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36548      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
36549      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
36550      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36551      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
36552      PORT_MODIFY("IN-3")
36553      // 0x0004 - "stk 4" // standard input (expected here)
36554      // 0x0008 - "stk 3" // standard input (expected here)
36555      // 0x0010 - "stk 2" // standard input (expected here)
36556      PORT_MODIFY("IN-5")
36557      // 0x0001 - "priz4" // standard input (expected here)
36558      // 0x0002 - "priz3" // standard input (expected here)
36559      // 0x0004 - "priz2" // standard input (expected here)
36560      // 0x0008 - "priz1" // standard input (expected here)
36561      PORT_MODIFY("IN-6")
36562      // 0x0001 - "perc1" // standard input (expected here)
36563      // 0x0002 - "perc2" // standard input (expected here)
36564      // 0x0004 - "perc3" // standard input (expected here)
36565      // 0x0008 - "perc4" // standard input (expected here)
36566      PORT_MODIFY("IN-8")
36567      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cs bus")
36568      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nodeal")
36569      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("pl del")
36570      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("deal")
36571      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk mes")
36572      PORT_MODIFY("IN-9")
36573      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("tk str")
36574      PORT_MODIFY("IN-16")
36575      // 0x0001 - "dil1" // standard input (motherboard)
36576      // 0x0002 - "dil2" // standard input (motherboard)
36577      // 0x0004 - "dil3" // standard input (motherboard)
36578      // 0x0008 - "dil4" // standard input (motherboard)
36579      // 0x0010 - "dil5" // standard input (motherboard)
36580      // 0x0100 - "top up" // known extended input, usually 'top up'
36581      PORT_MODIFY("IN-17")
36582      // 0x0001 - "dil6" // standard input (motherboard)
36583      // 0x0002 - "dil7" // standard input (motherboard)
36584      // 0x0004 - "dil8" // standard input (motherboard)
36585      // 0x0008 - "dil9" // standard input (motherboard)
36586      // 0x0010 - "dil10" // standard input (motherboard)
36587      PORT_MODIFY("IN-18")
36588      // 0x0001 - "dil11" // standard input (motherboard)
36589      // 0x0002 - "dil12" // standard input (motherboard)
36590      // 0x0004 - "dil13" // standard input (motherboard)
36591      // 0x0008 - "dil14" // standard input (motherboard)
36592      // 0x0010 - "dil15" // standard input (motherboard)
36593      PORT_MODIFY("IN-19")
36594      // 0x0001 - "dil16" // standard input (motherboard)
36595      PORT_MODIFY("IN-20")
36596      // 0x0001 - "grnbut" // standard input (motherboard)
36597      // 0x0002 - "dorlok" // standard input (expected here)
36598      // 0x0004 - "serdor" // standard input (expected here)
36599      // 0x0008 - "cshdor" // standard input (expected here)
36600      // 0x0010 - "hopdmp" // standard input (expected here)
3660136601INPUT_PORTS_END
3660236602
3660336603INPUT_PORTS_START( sc4dndbd35 )
r31373r31374
3664036640}
3664136641
3664236642INPUT_PORTS_START( sc4dndbr ) // this structure is generated
36643        PORT_INCLUDE( sc4_base )
36644        PORT_MODIFY("IN-1")
36645        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
36646        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36647        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36648        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36649        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exchan")
36650        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36651        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36652        PORT_MODIFY("IN-2")
36653        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36654        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
36655        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
36656        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36657        PORT_MODIFY("IN-3")
36658        // 0x0004 - "stk 4" // standard input (expected here)
36659        // 0x0008 - "stk 3" // standard input (expected here)
36660        // 0x0010 - "stk 2" // standard input (expected here)
36661        PORT_MODIFY("IN-5")
36662        // 0x0001 - "priz4" // standard input (expected here)
36663        // 0x0002 - "priz3" // standard input (expected here)
36664        // 0x0004 - "priz2" // standard input (expected here)
36665        // 0x0008 - "priz1" // standard input (expected here)
36666        PORT_MODIFY("IN-6")
36667        // 0x0001 - "perc1" // standard input (expected here)
36668        // 0x0002 - "perc2" // standard input (expected here)
36669        // 0x0004 - "perc3" // standard input (expected here)
36670        // 0x0008 - "perc4" // standard input (expected here)
36671        PORT_MODIFY("IN-8")
36672        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nodeal")
36673        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("play d")
36674        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("deal")
36675        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c or b")
36676        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk mes")
36677        PORT_MODIFY("IN-16")
36678        // 0x0001 - "dil1" // standard input (motherboard)
36679        // 0x0002 - "dil2" // standard input (motherboard)
36680        // 0x0004 - "dil3" // standard input (motherboard)
36681        // 0x0008 - "dil4" // standard input (motherboard)
36682        // 0x0010 - "dil5" // standard input (motherboard)
36683        // 0x0100 - "top up" // known extended input, usually 'top up'
36684        PORT_MODIFY("IN-17")
36685        // 0x0001 - "dil6" // standard input (motherboard)
36686        // 0x0002 - "dil7" // standard input (motherboard)
36687        // 0x0004 - "dil8" // standard input (motherboard)
36688        // 0x0008 - "dil9" // standard input (motherboard)
36689        // 0x0010 - "dil10" // standard input (motherboard)
36690        PORT_MODIFY("IN-18")
36691        // 0x0001 - "dil11" // standard input (motherboard)
36692        // 0x0002 - "dil12" // standard input (motherboard)
36693        // 0x0004 - "dil13" // standard input (motherboard)
36694        // 0x0008 - "dil14" // standard input (motherboard)
36695        // 0x0010 - "dil15" // standard input (motherboard)
36696        PORT_MODIFY("IN-19")
36697        // 0x0001 - "dil16" // standard input (motherboard)
36698        PORT_MODIFY("IN-20")
36699        // 0x0001 - "grnbut" // standard input (motherboard)
36700        // 0x0002 - "dorlok" // standard input (expected here)
36701        // 0x0004 - "serdor" // standard input (expected here)
36702        // 0x0008 - "cshdor" // standard input (expected here)
36703        // 0x0010 - "hopdmp" // standard input (expected here)
36643      PORT_INCLUDE( sc4_base )
36644      PORT_MODIFY("IN-1")
36645      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
36646      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36647      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36648      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36649      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exchan")
36650      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36651      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36652      PORT_MODIFY("IN-2")
36653      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36654      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
36655      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
36656      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36657      PORT_MODIFY("IN-3")
36658      // 0x0004 - "stk 4" // standard input (expected here)
36659      // 0x0008 - "stk 3" // standard input (expected here)
36660      // 0x0010 - "stk 2" // standard input (expected here)
36661      PORT_MODIFY("IN-5")
36662      // 0x0001 - "priz4" // standard input (expected here)
36663      // 0x0002 - "priz3" // standard input (expected here)
36664      // 0x0004 - "priz2" // standard input (expected here)
36665      // 0x0008 - "priz1" // standard input (expected here)
36666      PORT_MODIFY("IN-6")
36667      // 0x0001 - "perc1" // standard input (expected here)
36668      // 0x0002 - "perc2" // standard input (expected here)
36669      // 0x0004 - "perc3" // standard input (expected here)
36670      // 0x0008 - "perc4" // standard input (expected here)
36671      PORT_MODIFY("IN-8")
36672      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nodeal")
36673      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("play d")
36674      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("deal")
36675      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c or b")
36676      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk mes")
36677      PORT_MODIFY("IN-16")
36678      // 0x0001 - "dil1" // standard input (motherboard)
36679      // 0x0002 - "dil2" // standard input (motherboard)
36680      // 0x0004 - "dil3" // standard input (motherboard)
36681      // 0x0008 - "dil4" // standard input (motherboard)
36682      // 0x0010 - "dil5" // standard input (motherboard)
36683      // 0x0100 - "top up" // known extended input, usually 'top up'
36684      PORT_MODIFY("IN-17")
36685      // 0x0001 - "dil6" // standard input (motherboard)
36686      // 0x0002 - "dil7" // standard input (motherboard)
36687      // 0x0004 - "dil8" // standard input (motherboard)
36688      // 0x0008 - "dil9" // standard input (motherboard)
36689      // 0x0010 - "dil10" // standard input (motherboard)
36690      PORT_MODIFY("IN-18")
36691      // 0x0001 - "dil11" // standard input (motherboard)
36692      // 0x0002 - "dil12" // standard input (motherboard)
36693      // 0x0004 - "dil13" // standard input (motherboard)
36694      // 0x0008 - "dil14" // standard input (motherboard)
36695      // 0x0010 - "dil15" // standard input (motherboard)
36696      PORT_MODIFY("IN-19")
36697      // 0x0001 - "dil16" // standard input (motherboard)
36698      PORT_MODIFY("IN-20")
36699      // 0x0001 - "grnbut" // standard input (motherboard)
36700      // 0x0002 - "dorlok" // standard input (expected here)
36701      // 0x0004 - "serdor" // standard input (expected here)
36702      // 0x0008 - "cshdor" // standard input (expected here)
36703      // 0x0010 - "hopdmp" // standard input (expected here)
3670436704INPUT_PORTS_END
3670536705
3670636706INPUT_PORTS_START( sc4dndbr35 )
r31373r31374
3674536745}
3674636746
3674736747INPUT_PORTS_START( sc4dndcc ) // this structure is generated
36748        PORT_INCLUDE( sc4_base )
36749        PORT_MODIFY("IN-1")
36750        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36751        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36752        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36753        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36754        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36755        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36756        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36757        PORT_MODIFY("IN-2")
36758        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36759        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
36760        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
36761        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36762        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
36763        PORT_MODIFY("IN-3")
36764        // 0x0004 - "stk 4" // standard input (expected here)
36765        // 0x0008 - "stk 3" // standard input (expected here)
36766        // 0x0010 - "stk 2" // standard input (expected here)
36767        PORT_MODIFY("IN-5")
36768        // 0x0001 - "priz4" // standard input (expected here)
36769        // 0x0002 - "priz3" // standard input (expected here)
36770        // 0x0004 - "priz2" // standard input (expected here)
36771        // 0x0008 - "priz1" // standard input (expected here)
36772        PORT_MODIFY("IN-6")
36773        // 0x0001 - "perc1" // standard input (expected here)
36774        // 0x0002 - "perc2" // standard input (expected here)
36775        // 0x0004 - "perc3" // standard input (expected here)
36776        // 0x0008 - "perc4" // standard input (expected here)
36777        PORT_MODIFY("IN-8")
36778        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cs bus")
36779        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
36780        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mes")
36781        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nodeal")
36782        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("pl del")
36783        PORT_MODIFY("IN-9")
36784        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("deal")
36785        PORT_MODIFY("IN-16")
36786        // 0x0001 - "dil1" // standard input (motherboard)
36787        // 0x0002 - "dil2" // standard input (motherboard)
36788        // 0x0004 - "dil3" // standard input (motherboard)
36789        // 0x0008 - "dil4" // standard input (motherboard)
36790        // 0x0010 - "dil5" // standard input (motherboard)
36791        // 0x0100 - "top up" // known extended input, usually 'top up'
36792        PORT_MODIFY("IN-17")
36793        // 0x0001 - "dil6" // standard input (motherboard)
36794        // 0x0002 - "dil7" // standard input (motherboard)
36795        // 0x0004 - "dil8" // standard input (motherboard)
36796        // 0x0008 - "dil9" // standard input (motherboard)
36797        // 0x0010 - "dil10" // standard input (motherboard)
36798        PORT_MODIFY("IN-18")
36799        // 0x0001 - "dil11" // standard input (motherboard)
36800        // 0x0002 - "dil12" // standard input (motherboard)
36801        // 0x0004 - "dil13" // standard input (motherboard)
36802        // 0x0008 - "dil14" // standard input (motherboard)
36803        // 0x0010 - "dil15" // standard input (motherboard)
36804        PORT_MODIFY("IN-19")
36805        // 0x0001 - "dil16" // standard input (motherboard)
36806        PORT_MODIFY("IN-20")
36807        // 0x0001 - "grnbut" // standard input (motherboard)
36808        // 0x0002 - "dorlok" // standard input (expected here)
36809        // 0x0004 - "serdor" // standard input (expected here)
36810        // 0x0008 - "cshdor" // standard input (expected here)
36811        // 0x0010 - "hopdmp" // standard input (expected here)
36748      PORT_INCLUDE( sc4_base )
36749      PORT_MODIFY("IN-1")
36750      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36751      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36752      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36753      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36754      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36755      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36756      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36757      PORT_MODIFY("IN-2")
36758      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36759      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
36760      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
36761      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36762      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
36763      PORT_MODIFY("IN-3")
36764      // 0x0004 - "stk 4" // standard input (expected here)
36765      // 0x0008 - "stk 3" // standard input (expected here)
36766      // 0x0010 - "stk 2" // standard input (expected here)
36767      PORT_MODIFY("IN-5")
36768      // 0x0001 - "priz4" // standard input (expected here)
36769      // 0x0002 - "priz3" // standard input (expected here)
36770      // 0x0004 - "priz2" // standard input (expected here)
36771      // 0x0008 - "priz1" // standard input (expected here)
36772      PORT_MODIFY("IN-6")
36773      // 0x0001 - "perc1" // standard input (expected here)
36774      // 0x0002 - "perc2" // standard input (expected here)
36775      // 0x0004 - "perc3" // standard input (expected here)
36776      // 0x0008 - "perc4" // standard input (expected here)
36777      PORT_MODIFY("IN-8")
36778      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cs bus")
36779      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
36780      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mes")
36781      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nodeal")
36782      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("pl del")
36783      PORT_MODIFY("IN-9")
36784      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("deal")
36785      PORT_MODIFY("IN-16")
36786      // 0x0001 - "dil1" // standard input (motherboard)
36787      // 0x0002 - "dil2" // standard input (motherboard)
36788      // 0x0004 - "dil3" // standard input (motherboard)
36789      // 0x0008 - "dil4" // standard input (motherboard)
36790      // 0x0010 - "dil5" // standard input (motherboard)
36791      // 0x0100 - "top up" // known extended input, usually 'top up'
36792      PORT_MODIFY("IN-17")
36793      // 0x0001 - "dil6" // standard input (motherboard)
36794      // 0x0002 - "dil7" // standard input (motherboard)
36795      // 0x0004 - "dil8" // standard input (motherboard)
36796      // 0x0008 - "dil9" // standard input (motherboard)
36797      // 0x0010 - "dil10" // standard input (motherboard)
36798      PORT_MODIFY("IN-18")
36799      // 0x0001 - "dil11" // standard input (motherboard)
36800      // 0x0002 - "dil12" // standard input (motherboard)
36801      // 0x0004 - "dil13" // standard input (motherboard)
36802      // 0x0008 - "dil14" // standard input (motherboard)
36803      // 0x0010 - "dil15" // standard input (motherboard)
36804      PORT_MODIFY("IN-19")
36805      // 0x0001 - "dil16" // standard input (motherboard)
36806      PORT_MODIFY("IN-20")
36807      // 0x0001 - "grnbut" // standard input (motherboard)
36808      // 0x0002 - "dorlok" // standard input (expected here)
36809      // 0x0004 - "serdor" // standard input (expected here)
36810      // 0x0008 - "cshdor" // standard input (expected here)
36811      // 0x0010 - "hopdmp" // standard input (expected here)
3681236812INPUT_PORTS_END
3681336813
3681436814INPUT_PORTS_START( sc4dndcc35 )
r31373r31374
3685136851   m_reel_setup = sc4dnddw_reel_configs;
3685236852}
3685336853INPUT_PORTS_START( sc4dnddw ) // this structure is generated
36854        PORT_INCLUDE( sc4_base )
36855        PORT_MODIFY("IN-1")
36856        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36857        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36858        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36859        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36860        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36861        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36862        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36863        PORT_MODIFY("IN-2")
36864        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchan")
36865        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ch stk")
36866        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
36867        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36868        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
36869        PORT_MODIFY("IN-3")
36870        // 0x0004 - "stk 4" // standard input (expected here)
36871        // 0x0008 - "stk 3" // standard input (expected here)
36872        // 0x0010 - "stk 2" // standard input (expected here)
36873        PORT_MODIFY("IN-5")
36874        // 0x0001 - "priz4" // standard input (expected here)
36875        // 0x0002 - "priz3" // standard input (expected here)
36876        // 0x0004 - "priz2" // standard input (expected here)
36877        // 0x0008 - "priz1" // standard input (expected here)
36878        PORT_MODIFY("IN-6")
36879        // 0x0001 - "perc1" // standard input (expected here)
36880        // 0x0002 - "perc2" // standard input (expected here)
36881        // 0x0004 - "perc3" // standard input (expected here)
36882        // 0x0008 - "perc4" // standard input (expected here)
36883        PORT_MODIFY("IN-8")
36884        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bankit")
36885        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("p deal")
36886        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("streak")
36887        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("l deal")
36888        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("m deal")
36889        PORT_MODIFY("IN-9")
36890        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("r deal")
36891        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("dond")
36892        PORT_MODIFY("IN-16")
36893        // 0x0001 - "dil1" // standard input (motherboard)
36894        // 0x0002 - "dil2" // standard input (motherboard)
36895        // 0x0004 - "dil3" // standard input (motherboard)
36896        // 0x0008 - "dil4" // standard input (motherboard)
36897        // 0x0010 - "dil5" // standard input (motherboard)
36898        // 0x0100 - "top up" // known extended input, usually 'top up'
36899        PORT_MODIFY("IN-17")
36900        // 0x0001 - "dil6" // standard input (motherboard)
36901        // 0x0002 - "dil7" // standard input (motherboard)
36902        // 0x0004 - "dil8" // standard input (motherboard)
36903        // 0x0008 - "dil9" // standard input (motherboard)
36904        // 0x0010 - "dil10" // standard input (motherboard)
36905        PORT_MODIFY("IN-18")
36906        // 0x0001 - "dil11" // standard input (motherboard)
36907        // 0x0002 - "dil12" // standard input (motherboard)
36908        // 0x0004 - "dil13" // standard input (motherboard)
36909        // 0x0008 - "dil14" // standard input (motherboard)
36910        // 0x0010 - "dil15" // standard input (motherboard)
36911        PORT_MODIFY("IN-19")
36912        // 0x0001 - "dil16" // standard input (motherboard)
36913        PORT_MODIFY("IN-20")
36914        // 0x0001 - "grnbut" // standard input (motherboard)
36915        // 0x0002 - "dorlok" // standard input (expected here)
36916        // 0x0004 - "serdor" // standard input (expected here)
36917        // 0x0008 - "cshdor" // standard input (expected here)
36918        // 0x0010 - "hopdmp" // standard input (expected here)
36854      PORT_INCLUDE( sc4_base )
36855      PORT_MODIFY("IN-1")
36856      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36857      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36858      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36859      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36860      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
36861      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36862      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36863      PORT_MODIFY("IN-2")
36864      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchan")
36865      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ch stk")
36866      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
36867      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36868      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
36869      PORT_MODIFY("IN-3")
36870      // 0x0004 - "stk 4" // standard input (expected here)
36871      // 0x0008 - "stk 3" // standard input (expected here)
36872      // 0x0010 - "stk 2" // standard input (expected here)
36873      PORT_MODIFY("IN-5")
36874      // 0x0001 - "priz4" // standard input (expected here)
36875      // 0x0002 - "priz3" // standard input (expected here)
36876      // 0x0004 - "priz2" // standard input (expected here)
36877      // 0x0008 - "priz1" // standard input (expected here)
36878      PORT_MODIFY("IN-6")
36879      // 0x0001 - "perc1" // standard input (expected here)
36880      // 0x0002 - "perc2" // standard input (expected here)
36881      // 0x0004 - "perc3" // standard input (expected here)
36882      // 0x0008 - "perc4" // standard input (expected here)
36883      PORT_MODIFY("IN-8")
36884      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bankit")
36885      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("p deal")
36886      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("streak")
36887      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("l deal")
36888      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("m deal")
36889      PORT_MODIFY("IN-9")
36890      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("r deal")
36891      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("dond")
36892      PORT_MODIFY("IN-16")
36893      // 0x0001 - "dil1" // standard input (motherboard)
36894      // 0x0002 - "dil2" // standard input (motherboard)
36895      // 0x0004 - "dil3" // standard input (motherboard)
36896      // 0x0008 - "dil4" // standard input (motherboard)
36897      // 0x0010 - "dil5" // standard input (motherboard)
36898      // 0x0100 - "top up" // known extended input, usually 'top up'
36899      PORT_MODIFY("IN-17")
36900      // 0x0001 - "dil6" // standard input (motherboard)
36901      // 0x0002 - "dil7" // standard input (motherboard)
36902      // 0x0004 - "dil8" // standard input (motherboard)
36903      // 0x0008 - "dil9" // standard input (motherboard)
36904      // 0x0010 - "dil10" // standard input (motherboard)
36905      PORT_MODIFY("IN-18")
36906      // 0x0001 - "dil11" // standard input (motherboard)
36907      // 0x0002 - "dil12" // standard input (motherboard)
36908      // 0x0004 - "dil13" // standard input (motherboard)
36909      // 0x0008 - "dil14" // standard input (motherboard)
36910      // 0x0010 - "dil15" // standard input (motherboard)
36911      PORT_MODIFY("IN-19")
36912      // 0x0001 - "dil16" // standard input (motherboard)
36913      PORT_MODIFY("IN-20")
36914      // 0x0001 - "grnbut" // standard input (motherboard)
36915      // 0x0002 - "dorlok" // standard input (expected here)
36916      // 0x0004 - "serdor" // standard input (expected here)
36917      // 0x0008 - "cshdor" // standard input (expected here)
36918      // 0x0010 - "hopdmp" // standard input (expected here)
3691936919INPUT_PORTS_END
3692036920
3692136921INPUT_PORTS_START( sc4dnddw35 )
r31373r31374
3695936959}
3696036960
3696136961INPUT_PORTS_START( sc4dnddf ) // this structure is generated
36962        PORT_INCLUDE( sc4_base )
36963        PORT_MODIFY("IN-1")
36964        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36965        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36966        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36967        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36968        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
36969        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36970        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36971        PORT_MODIFY("IN-2")
36972        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36973        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("tra/ex")
36974        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("sta/ga")
36975        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36976        PORT_MODIFY("IN-3")
36977        // 0x0004 - "stk 4" // standard input (expected here)
36978        // 0x0008 - "stk 3" // standard input (expected here)
36979        // 0x0010 - "stk 2" // standard input (expected here)
36980        PORT_MODIFY("IN-5")
36981        // 0x0001 - "priz4" // standard input (expected here)
36982        // 0x0002 - "priz3" // standard input (expected here)
36983        // 0x0004 - "priz2" // standard input (expected here)
36984        // 0x0008 - "priz1" // standard input (expected here)
36985        PORT_MODIFY("IN-6")
36986        // 0x0001 - "perc1" // standard input (expected here)
36987        // 0x0002 - "perc2" // standard input (expected here)
36988        // 0x0004 - "perc3" // standard input (expected here)
36989        // 0x0008 - "perc4" // standard input (expected here)
36990        PORT_MODIFY("IN-8")
36991        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk bns")
36992        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("bankit")
36993        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nodeal")
36994        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("deal")
36995        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("ply dl")
36996        PORT_MODIFY("IN-16")
36997        // 0x0001 - "dil1" // standard input (motherboard)
36998        // 0x0002 - "dil2" // standard input (motherboard)
36999        // 0x0004 - "dil3" // standard input (motherboard)
37000        // 0x0008 - "dil4" // standard input (motherboard)
37001        // 0x0010 - "dil5" // standard input (motherboard)
37002        // 0x0100 - "top up" // known extended input, usually 'top up'
37003        PORT_MODIFY("IN-17")
37004        // 0x0001 - "dil6" // standard input (motherboard)
37005        // 0x0002 - "dil7" // standard input (motherboard)
37006        // 0x0004 - "dil8" // standard input (motherboard)
37007        // 0x0008 - "dil9" // standard input (motherboard)
37008        // 0x0010 - "dil10" // standard input (motherboard)
37009        PORT_MODIFY("IN-18")
37010        // 0x0001 - "dil11" // standard input (motherboard)
37011        // 0x0002 - "dil12" // standard input (motherboard)
37012        // 0x0004 - "dil13" // standard input (motherboard)
37013        // 0x0008 - "dil14" // standard input (motherboard)
37014        // 0x0010 - "dil15" // standard input (motherboard)
37015        PORT_MODIFY("IN-19")
37016        // 0x0001 - "dil16" // standard input (motherboard)
37017        PORT_MODIFY("IN-20")
37018        // 0x0001 - "grnbut" // standard input (motherboard)
37019        // 0x0002 - "dorlok" // standard input (expected here)
37020        // 0x0004 - "serdor" // standard input (expected here)
37021        // 0x0008 - "cshdor" // standard input (expected here)
37022        // 0x0010 - "hopdmp" // standard input (expected here)
36962      PORT_INCLUDE( sc4_base )
36963      PORT_MODIFY("IN-1")
36964      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
36965      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
36966      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
36967      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
36968      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
36969      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
36970      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
36971      PORT_MODIFY("IN-2")
36972      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
36973      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("tra/ex")
36974      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("sta/ga")
36975      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
36976      PORT_MODIFY("IN-3")
36977      // 0x0004 - "stk 4" // standard input (expected here)
36978      // 0x0008 - "stk 3" // standard input (expected here)
36979      // 0x0010 - "stk 2" // standard input (expected here)
36980      PORT_MODIFY("IN-5")
36981      // 0x0001 - "priz4" // standard input (expected here)
36982      // 0x0002 - "priz3" // standard input (expected here)
36983      // 0x0004 - "priz2" // standard input (expected here)
36984      // 0x0008 - "priz1" // standard input (expected here)
36985      PORT_MODIFY("IN-6")
36986      // 0x0001 - "perc1" // standard input (expected here)
36987      // 0x0002 - "perc2" // standard input (expected here)
36988      // 0x0004 - "perc3" // standard input (expected here)
36989      // 0x0008 - "perc4" // standard input (expected here)
36990      PORT_MODIFY("IN-8")
36991      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk bns")
36992      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("bankit")
36993      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nodeal")
36994      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("deal")
36995      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("ply dl")
36996      PORT_MODIFY("IN-16")
36997      // 0x0001 - "dil1" // standard input (motherboard)
36998      // 0x0002 - "dil2" // standard input (motherboard)
36999      // 0x0004 - "dil3" // standard input (motherboard)
37000      // 0x0008 - "dil4" // standard input (motherboard)
37001      // 0x0010 - "dil5" // standard input (motherboard)
37002      // 0x0100 - "top up" // known extended input, usually 'top up'
37003      PORT_MODIFY("IN-17")
37004      // 0x0001 - "dil6" // standard input (motherboard)
37005      // 0x0002 - "dil7" // standard input (motherboard)
37006      // 0x0004 - "dil8" // standard input (motherboard)
37007      // 0x0008 - "dil9" // standard input (motherboard)
37008      // 0x0010 - "dil10" // standard input (motherboard)
37009      PORT_MODIFY("IN-18")
37010      // 0x0001 - "dil11" // standard input (motherboard)
37011      // 0x0002 - "dil12" // standard input (motherboard)
37012      // 0x0004 - "dil13" // standard input (motherboard)
37013      // 0x0008 - "dil14" // standard input (motherboard)
37014      // 0x0010 - "dil15" // standard input (motherboard)
37015      PORT_MODIFY("IN-19")
37016      // 0x0001 - "dil16" // standard input (motherboard)
37017      PORT_MODIFY("IN-20")
37018      // 0x0001 - "grnbut" // standard input (motherboard)
37019      // 0x0002 - "dorlok" // standard input (expected here)
37020      // 0x0004 - "serdor" // standard input (expected here)
37021      // 0x0008 - "cshdor" // standard input (expected here)
37022      // 0x0010 - "hopdmp" // standard input (expected here)
3702337023INPUT_PORTS_END
3702437024
3702537025INPUT_PORTS_START( sc4dnddf35 )
r31373r31374
3706137061}
3706237062
3706337063INPUT_PORTS_START( sc4dndpg ) // this structure is generated
37064        PORT_INCLUDE( sc4_base )
37065        PORT_MODIFY("IN-1")
37066        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37067        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37068        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37069        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37070        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
37071        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37072        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37073        PORT_MODIFY("IN-2")
37074        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
37075        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
37076        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
37077        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37078        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
37079        PORT_MODIFY("IN-3")
37080        // 0x0004 - "stk 4" // standard input (expected here)
37081        // 0x0008 - "stk 3" // standard input (expected here)
37082        // 0x0010 - "stk 2" // standard input (expected here)
37083        PORT_MODIFY("IN-5")
37084        // 0x0001 - "priz4" // standard input (expected here)
37085        // 0x0002 - "priz3" // standard input (expected here)
37086        // 0x0004 - "priz2" // standard input (expected here)
37087        // 0x0008 - "priz1" // standard input (expected here)
37088        PORT_MODIFY("IN-6")
37089        // 0x0001 - "perc1" // standard input (expected here)
37090        // 0x0002 - "perc2" // standard input (expected here)
37091        // 0x0004 - "perc3" // standard input (expected here)
37092        // 0x0008 - "perc4" // standard input (expected here)
37093        PORT_MODIFY("IN-8")
37094        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cs bus")
37095        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
37096        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mes")
37097        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nodeal")
37098        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("pl del")
37099        PORT_MODIFY("IN-9")
37100        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("deal")
37101        PORT_MODIFY("IN-16")
37102        // 0x0001 - "dil1" // standard input (motherboard)
37103        // 0x0002 - "dil2" // standard input (motherboard)
37104        // 0x0004 - "dil3" // standard input (motherboard)
37105        // 0x0008 - "dil4" // standard input (motherboard)
37106        // 0x0010 - "dil5" // standard input (motherboard)
37107        // 0x0100 - "top up" // known extended input, usually 'top up'
37108        PORT_MODIFY("IN-17")
37109        // 0x0001 - "dil6" // standard input (motherboard)
37110        // 0x0002 - "dil7" // standard input (motherboard)
37111        // 0x0004 - "dil8" // standard input (motherboard)
37112        // 0x0008 - "dil9" // standard input (motherboard)
37113        // 0x0010 - "dil10" // standard input (motherboard)
37114        PORT_MODIFY("IN-18")
37115        // 0x0001 - "dil11" // standard input (motherboard)
37116        // 0x0002 - "dil12" // standard input (motherboard)
37117        // 0x0004 - "dil13" // standard input (motherboard)
37118        // 0x0008 - "dil14" // standard input (motherboard)
37119        // 0x0010 - "dil15" // standard input (motherboard)
37120        PORT_MODIFY("IN-19")
37121        // 0x0001 - "dil16" // standard input (motherboard)
37122        PORT_MODIFY("IN-20")
37123        // 0x0001 - "grnbut" // standard input (motherboard)
37124        // 0x0002 - "dorlok" // standard input (expected here)
37125        // 0x0004 - "serdor" // standard input (expected here)
37126        // 0x0008 - "cshdor" // standard input (expected here)
37127        // 0x0010 - "hopdmp" // standard input (expected here)
37064      PORT_INCLUDE( sc4_base )
37065      PORT_MODIFY("IN-1")
37066      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37067      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37068      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37069      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37070      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
37071      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37072      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37073      PORT_MODIFY("IN-2")
37074      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
37075      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
37076      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
37077      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37078      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
37079      PORT_MODIFY("IN-3")
37080      // 0x0004 - "stk 4" // standard input (expected here)
37081      // 0x0008 - "stk 3" // standard input (expected here)
37082      // 0x0010 - "stk 2" // standard input (expected here)
37083      PORT_MODIFY("IN-5")
37084      // 0x0001 - "priz4" // standard input (expected here)
37085      // 0x0002 - "priz3" // standard input (expected here)
37086      // 0x0004 - "priz2" // standard input (expected here)
37087      // 0x0008 - "priz1" // standard input (expected here)
37088      PORT_MODIFY("IN-6")
37089      // 0x0001 - "perc1" // standard input (expected here)
37090      // 0x0002 - "perc2" // standard input (expected here)
37091      // 0x0004 - "perc3" // standard input (expected here)
37092      // 0x0008 - "perc4" // standard input (expected here)
37093      PORT_MODIFY("IN-8")
37094      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cs bus")
37095      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
37096      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mes")
37097      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nodeal")
37098      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("pl del")
37099      PORT_MODIFY("IN-9")
37100      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("deal")
37101      PORT_MODIFY("IN-16")
37102      // 0x0001 - "dil1" // standard input (motherboard)
37103      // 0x0002 - "dil2" // standard input (motherboard)
37104      // 0x0004 - "dil3" // standard input (motherboard)
37105      // 0x0008 - "dil4" // standard input (motherboard)
37106      // 0x0010 - "dil5" // standard input (motherboard)
37107      // 0x0100 - "top up" // known extended input, usually 'top up'
37108      PORT_MODIFY("IN-17")
37109      // 0x0001 - "dil6" // standard input (motherboard)
37110      // 0x0002 - "dil7" // standard input (motherboard)
37111      // 0x0004 - "dil8" // standard input (motherboard)
37112      // 0x0008 - "dil9" // standard input (motherboard)
37113      // 0x0010 - "dil10" // standard input (motherboard)
37114      PORT_MODIFY("IN-18")
37115      // 0x0001 - "dil11" // standard input (motherboard)
37116      // 0x0002 - "dil12" // standard input (motherboard)
37117      // 0x0004 - "dil13" // standard input (motherboard)
37118      // 0x0008 - "dil14" // standard input (motherboard)
37119      // 0x0010 - "dil15" // standard input (motherboard)
37120      PORT_MODIFY("IN-19")
37121      // 0x0001 - "dil16" // standard input (motherboard)
37122      PORT_MODIFY("IN-20")
37123      // 0x0001 - "grnbut" // standard input (motherboard)
37124      // 0x0002 - "dorlok" // standard input (expected here)
37125      // 0x0004 - "serdor" // standard input (expected here)
37126      // 0x0008 - "cshdor" // standard input (expected here)
37127      // 0x0010 - "hopdmp" // standard input (expected here)
3712837128INPUT_PORTS_END
3712937129
3713037130INPUT_PORTS_START( sc4dndpg35 )
r31373r31374
3716637166   m_reel_setup = sc4dndtp_reel_configs;
3716737167}
3716837168INPUT_PORTS_START( sc4dndtp ) // this structure is generated
37169        PORT_INCLUDE( sc4_base )
37170        PORT_MODIFY("IN-1")
37171        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37172        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37173        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37174        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37175        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
37176        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37177        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37178        PORT_MODIFY("IN-2")
37179        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
37180        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
37181        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37182        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37183        PORT_MODIFY("IN-3")
37184        // 0x0004 - "stk 4" // standard input (expected here)
37185        // 0x0008 - "stk 3" // standard input (expected here)
37186        // 0x0010 - "stk 2" // standard input (expected here)
37187        PORT_MODIFY("IN-5")
37188        // 0x0001 - "priz4" // standard input (expected here)
37189        // 0x0002 - "priz3" // standard input (expected here)
37190        // 0x0004 - "priz2" // standard input (expected here)
37191        // 0x0008 - "priz1" // standard input (expected here)
37192        PORT_MODIFY("IN-6")
37193        // 0x0001 - "perc1" // standard input (expected here)
37194        // 0x0002 - "perc2" // standard input (expected here)
37195        // 0x0004 - "perc3" // standard input (expected here)
37196        // 0x0008 - "perc4" // standard input (expected here)
37197        PORT_MODIFY("IN-8")
37198        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nodeal")
37199        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("dond")
37200        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("deal")
37201        PORT_MODIFY("IN-16")
37202        // 0x0001 - "dil1" // standard input (motherboard)
37203        // 0x0002 - "dil2" // standard input (motherboard)
37204        // 0x0004 - "dil3" // standard input (motherboard)
37205        // 0x0008 - "dil4" // standard input (motherboard)
37206        // 0x0010 - "dil5" // standard input (motherboard)
37207        // 0x0100 - "top up" // known extended input, usually 'top up'
37208        PORT_MODIFY("IN-17")
37209        // 0x0001 - "dil6" // standard input (motherboard)
37210        // 0x0002 - "dil7" // standard input (motherboard)
37211        // 0x0004 - "dil8" // standard input (motherboard)
37212        // 0x0008 - "dil9" // standard input (motherboard)
37213        // 0x0010 - "dil10" // standard input (motherboard)
37214        PORT_MODIFY("IN-18")
37215        // 0x0001 - "dil11" // standard input (motherboard)
37216        // 0x0002 - "dil12" // standard input (motherboard)
37217        // 0x0004 - "dil13" // standard input (motherboard)
37218        // 0x0008 - "dil14" // standard input (motherboard)
37219        // 0x0010 - "dil15" // standard input (motherboard)
37220        PORT_MODIFY("IN-19")
37221        // 0x0001 - "dil16" // standard input (motherboard)
37222        PORT_MODIFY("IN-20")
37223        // 0x0001 - "grnbut" // standard input (motherboard)
37224        // 0x0002 - "dorlok" // standard input (expected here)
37225        // 0x0004 - "serdor" // standard input (expected here)
37226        // 0x0008 - "cshdor" // standard input (expected here)
37227        // 0x0010 - "hopdmp" // standard input (expected here)
37169      PORT_INCLUDE( sc4_base )
37170      PORT_MODIFY("IN-1")
37171      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37172      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37173      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37174      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37175      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
37176      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37177      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37178      PORT_MODIFY("IN-2")
37179      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
37180      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
37181      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37182      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37183      PORT_MODIFY("IN-3")
37184      // 0x0004 - "stk 4" // standard input (expected here)
37185      // 0x0008 - "stk 3" // standard input (expected here)
37186      // 0x0010 - "stk 2" // standard input (expected here)
37187      PORT_MODIFY("IN-5")
37188      // 0x0001 - "priz4" // standard input (expected here)
37189      // 0x0002 - "priz3" // standard input (expected here)
37190      // 0x0004 - "priz2" // standard input (expected here)
37191      // 0x0008 - "priz1" // standard input (expected here)
37192      PORT_MODIFY("IN-6")
37193      // 0x0001 - "perc1" // standard input (expected here)
37194      // 0x0002 - "perc2" // standard input (expected here)
37195      // 0x0004 - "perc3" // standard input (expected here)
37196      // 0x0008 - "perc4" // standard input (expected here)
37197      PORT_MODIFY("IN-8")
37198      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nodeal")
37199      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("dond")
37200      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("deal")
37201      PORT_MODIFY("IN-16")
37202      // 0x0001 - "dil1" // standard input (motherboard)
37203      // 0x0002 - "dil2" // standard input (motherboard)
37204      // 0x0004 - "dil3" // standard input (motherboard)
37205      // 0x0008 - "dil4" // standard input (motherboard)
37206      // 0x0010 - "dil5" // standard input (motherboard)
37207      // 0x0100 - "top up" // known extended input, usually 'top up'
37208      PORT_MODIFY("IN-17")
37209      // 0x0001 - "dil6" // standard input (motherboard)
37210      // 0x0002 - "dil7" // standard input (motherboard)
37211      // 0x0004 - "dil8" // standard input (motherboard)
37212      // 0x0008 - "dil9" // standard input (motherboard)
37213      // 0x0010 - "dil10" // standard input (motherboard)
37214      PORT_MODIFY("IN-18")
37215      // 0x0001 - "dil11" // standard input (motherboard)
37216      // 0x0002 - "dil12" // standard input (motherboard)
37217      // 0x0004 - "dil13" // standard input (motherboard)
37218      // 0x0008 - "dil14" // standard input (motherboard)
37219      // 0x0010 - "dil15" // standard input (motherboard)
37220      PORT_MODIFY("IN-19")
37221      // 0x0001 - "dil16" // standard input (motherboard)
37222      PORT_MODIFY("IN-20")
37223      // 0x0001 - "grnbut" // standard input (motherboard)
37224      // 0x0002 - "dorlok" // standard input (expected here)
37225      // 0x0004 - "serdor" // standard input (expected here)
37226      // 0x0008 - "cshdor" // standard input (expected here)
37227      // 0x0010 - "hopdmp" // standard input (expected here)
3722837228INPUT_PORTS_END
3722937229
3723037230INPUT_PORTS_START( sc4dndtp35 )
r31373r31374
3726837268}
3726937269
3727037270INPUT_PORTS_START( sc4dndww ) // this structure is generated
37271        PORT_INCLUDE( sc4_base )
37272        PORT_MODIFY("IN-1")
37273        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37274        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37275        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37276        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37277        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
37278        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37279        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37280        PORT_MODIFY("IN-2")
37281        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
37282        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
37283        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
37284        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37285        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
37286        PORT_MODIFY("IN-3")
37287        // 0x0004 - "stk 4" // standard input (expected here)
37288        // 0x0008 - "stk 3" // standard input (expected here)
37289        // 0x0010 - "stk 2" // standard input (expected here)
37290        PORT_MODIFY("IN-5")
37291        // 0x0001 - "priz4" // standard input (expected here)
37292        // 0x0002 - "priz3" // standard input (expected here)
37293        // 0x0004 - "priz2" // standard input (expected here)
37294        // 0x0008 - "priz1" // standard input (expected here)
37295        PORT_MODIFY("IN-6")
37296        // 0x0001 - "perc1" // standard input (expected here)
37297        // 0x0002 - "perc2" // standard input (expected here)
37298        // 0x0004 - "perc3" // standard input (expected here)
37299        // 0x0008 - "perc4" // standard input (expected here)
37300        PORT_MODIFY("IN-8")
37301        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("b ndel")
37302        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b deal")
37303        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mes")
37304        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk bon")
37305        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk str")
37306        PORT_MODIFY("IN-9")
37307        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nodeal")
37308        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("pl del")
37309        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("deal")
37310        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("cs bus")
37311        PORT_MODIFY("IN-16")
37312        // 0x0001 - "dil1" // standard input (motherboard)
37313        // 0x0002 - "dil2" // standard input (motherboard)
37314        // 0x0004 - "dil3" // standard input (motherboard)
37315        // 0x0008 - "dil4" // standard input (motherboard)
37316        // 0x0010 - "dil5" // standard input (motherboard)
37317        // 0x0100 - "top up" // known extended input, usually 'top up'
37318        PORT_MODIFY("IN-17")
37319        // 0x0001 - "dil6" // standard input (motherboard)
37320        // 0x0002 - "dil7" // standard input (motherboard)
37321        // 0x0004 - "dil8" // standard input (motherboard)
37322        // 0x0008 - "dil9" // standard input (motherboard)
37323        // 0x0010 - "dil10" // standard input (motherboard)
37324        PORT_MODIFY("IN-18")
37325        // 0x0001 - "dil11" // standard input (motherboard)
37326        // 0x0002 - "dil12" // standard input (motherboard)
37327        // 0x0004 - "dil13" // standard input (motherboard)
37328        // 0x0008 - "dil14" // standard input (motherboard)
37329        // 0x0010 - "dil15" // standard input (motherboard)
37330        PORT_MODIFY("IN-19")
37331        // 0x0001 - "dil16" // standard input (motherboard)
37332        PORT_MODIFY("IN-20")
37333        // 0x0001 - "grnbut" // standard input (motherboard)
37334        // 0x0002 - "dorlok" // standard input (expected here)
37335        // 0x0004 - "serdor" // standard input (expected here)
37336        // 0x0008 - "cshdor" // standard input (expected here)
37337        // 0x0010 - "hopdmp" // standard input (expected here)
37271      PORT_INCLUDE( sc4_base )
37272      PORT_MODIFY("IN-1")
37273      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37274      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37275      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37276      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37277      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
37278      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37279      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37280      PORT_MODIFY("IN-2")
37281      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
37282      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
37283      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
37284      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37285      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
37286      PORT_MODIFY("IN-3")
37287      // 0x0004 - "stk 4" // standard input (expected here)
37288      // 0x0008 - "stk 3" // standard input (expected here)
37289      // 0x0010 - "stk 2" // standard input (expected here)
37290      PORT_MODIFY("IN-5")
37291      // 0x0001 - "priz4" // standard input (expected here)
37292      // 0x0002 - "priz3" // standard input (expected here)
37293      // 0x0004 - "priz2" // standard input (expected here)
37294      // 0x0008 - "priz1" // standard input (expected here)
37295      PORT_MODIFY("IN-6")
37296      // 0x0001 - "perc1" // standard input (expected here)
37297      // 0x0002 - "perc2" // standard input (expected here)
37298      // 0x0004 - "perc3" // standard input (expected here)
37299      // 0x0008 - "perc4" // standard input (expected here)
37300      PORT_MODIFY("IN-8")
37301      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("b ndel")
37302      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b deal")
37303      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mes")
37304      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk bon")
37305      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk str")
37306      PORT_MODIFY("IN-9")
37307      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nodeal")
37308      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("pl del")
37309      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("deal")
37310      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("cs bus")
37311      PORT_MODIFY("IN-16")
37312      // 0x0001 - "dil1" // standard input (motherboard)
37313      // 0x0002 - "dil2" // standard input (motherboard)
37314      // 0x0004 - "dil3" // standard input (motherboard)
37315      // 0x0008 - "dil4" // standard input (motherboard)
37316      // 0x0010 - "dil5" // standard input (motherboard)
37317      // 0x0100 - "top up" // known extended input, usually 'top up'
37318      PORT_MODIFY("IN-17")
37319      // 0x0001 - "dil6" // standard input (motherboard)
37320      // 0x0002 - "dil7" // standard input (motherboard)
37321      // 0x0004 - "dil8" // standard input (motherboard)
37322      // 0x0008 - "dil9" // standard input (motherboard)
37323      // 0x0010 - "dil10" // standard input (motherboard)
37324      PORT_MODIFY("IN-18")
37325      // 0x0001 - "dil11" // standard input (motherboard)
37326      // 0x0002 - "dil12" // standard input (motherboard)
37327      // 0x0004 - "dil13" // standard input (motherboard)
37328      // 0x0008 - "dil14" // standard input (motherboard)
37329      // 0x0010 - "dil15" // standard input (motherboard)
37330      PORT_MODIFY("IN-19")
37331      // 0x0001 - "dil16" // standard input (motherboard)
37332      PORT_MODIFY("IN-20")
37333      // 0x0001 - "grnbut" // standard input (motherboard)
37334      // 0x0002 - "dorlok" // standard input (expected here)
37335      // 0x0004 - "serdor" // standard input (expected here)
37336      // 0x0008 - "cshdor" // standard input (expected here)
37337      // 0x0010 - "hopdmp" // standard input (expected here)
3733837338INPUT_PORTS_END
3733937339
3734037340INPUT_PORTS_START( sc4dndww35 )
r31373r31374
3737037370}
3737137371
3737237372INPUT_PORTS_START( sc4dndcw ) // this structure is generated
37373        PORT_INCLUDE( sc4_base )
37374        PORT_MODIFY("IN-1")
37375        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37376        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37377        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37378        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37379        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
37380        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37381        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37382        PORT_MODIFY("IN-2")
37383        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchag")
37384        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
37385        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37386        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37387        PORT_MODIFY("IN-3")
37388        // 0x0004 - "stk 4" // standard input (expected here)
37389        // 0x0008 - "stk 3" // standard input (expected here)
37390        // 0x0010 - "stk 2" // standard input (expected here)
37391        PORT_MODIFY("IN-5")
37392        // 0x0001 - "priz4" // standard input (expected here)
37393        // 0x0002 - "priz3" // standard input (expected here)
37394        // 0x0004 - "priz2" // standard input (expected here)
37395        // 0x0008 - "priz1" // standard input (expected here)
37396        PORT_MODIFY("IN-6")
37397        // 0x0001 - "perc1" // standard input (expected here)
37398        // 0x0002 - "perc2" // standard input (expected here)
37399        // 0x0004 - "perc3" // standard input (expected here)
37400        // 0x0008 - "perc4" // standard input (expected here)
37401        PORT_MODIFY("IN-8")
37402        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("b ndel")
37403        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b deal")
37404        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mes")
37405        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk bon")
37406        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk str")
37407        PORT_MODIFY("IN-9")
37408        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nodeal")
37409        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("pl del")
37410        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("deal")
37411        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("cs bus")
37412        PORT_MODIFY("IN-16")
37413        // 0x0001 - "dil1" // standard input (motherboard)
37414        // 0x0002 - "dil2" // standard input (motherboard)
37415        // 0x0004 - "dil3" // standard input (motherboard)
37416        // 0x0008 - "dil4" // standard input (motherboard)
37417        // 0x0010 - "dil5" // standard input (motherboard)
37418        // 0x0100 - "top up" // known extended input, usually 'top up'
37419        PORT_MODIFY("IN-17")
37420        // 0x0001 - "dil6" // standard input (motherboard)
37421        // 0x0002 - "dil7" // standard input (motherboard)
37422        // 0x0004 - "dil8" // standard input (motherboard)
37423        // 0x0008 - "dil9" // standard input (motherboard)
37424        // 0x0010 - "dil10" // standard input (motherboard)
37425        PORT_MODIFY("IN-18")
37426        // 0x0001 - "dil11" // standard input (motherboard)
37427        // 0x0002 - "dil12" // standard input (motherboard)
37428        // 0x0004 - "dil13" // standard input (motherboard)
37429        // 0x0008 - "dil14" // standard input (motherboard)
37430        // 0x0010 - "dil15" // standard input (motherboard)
37431        PORT_MODIFY("IN-19")
37432        // 0x0001 - "dil16" // standard input (motherboard)
37433        PORT_MODIFY("IN-20")
37434        // 0x0001 - "grnbut" // standard input (motherboard)
37435        // 0x0002 - "dorlok" // standard input (expected here)
37436        // 0x0004 - "serdor" // standard input (expected here)
37437        // 0x0008 - "cshdor" // standard input (expected here)
37438        // 0x0010 - "hopdmp" // standard input (expected here)
37373      PORT_INCLUDE( sc4_base )
37374      PORT_MODIFY("IN-1")
37375      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37376      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37377      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37378      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37379      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
37380      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37381      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37382      PORT_MODIFY("IN-2")
37383      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchag")
37384      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
37385      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37386      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37387      PORT_MODIFY("IN-3")
37388      // 0x0004 - "stk 4" // standard input (expected here)
37389      // 0x0008 - "stk 3" // standard input (expected here)
37390      // 0x0010 - "stk 2" // standard input (expected here)
37391      PORT_MODIFY("IN-5")
37392      // 0x0001 - "priz4" // standard input (expected here)
37393      // 0x0002 - "priz3" // standard input (expected here)
37394      // 0x0004 - "priz2" // standard input (expected here)
37395      // 0x0008 - "priz1" // standard input (expected here)
37396      PORT_MODIFY("IN-6")
37397      // 0x0001 - "perc1" // standard input (expected here)
37398      // 0x0002 - "perc2" // standard input (expected here)
37399      // 0x0004 - "perc3" // standard input (expected here)
37400      // 0x0008 - "perc4" // standard input (expected here)
37401      PORT_MODIFY("IN-8")
37402      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("b ndel")
37403      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b deal")
37404      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mes")
37405      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk bon")
37406      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk str")
37407      PORT_MODIFY("IN-9")
37408      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nodeal")
37409      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("pl del")
37410      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("deal")
37411      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("cs bus")
37412      PORT_MODIFY("IN-16")
37413      // 0x0001 - "dil1" // standard input (motherboard)
37414      // 0x0002 - "dil2" // standard input (motherboard)
37415      // 0x0004 - "dil3" // standard input (motherboard)
37416      // 0x0008 - "dil4" // standard input (motherboard)
37417      // 0x0010 - "dil5" // standard input (motherboard)
37418      // 0x0100 - "top up" // known extended input, usually 'top up'
37419      PORT_MODIFY("IN-17")
37420      // 0x0001 - "dil6" // standard input (motherboard)
37421      // 0x0002 - "dil7" // standard input (motherboard)
37422      // 0x0004 - "dil8" // standard input (motherboard)
37423      // 0x0008 - "dil9" // standard input (motherboard)
37424      // 0x0010 - "dil10" // standard input (motherboard)
37425      PORT_MODIFY("IN-18")
37426      // 0x0001 - "dil11" // standard input (motherboard)
37427      // 0x0002 - "dil12" // standard input (motherboard)
37428      // 0x0004 - "dil13" // standard input (motherboard)
37429      // 0x0008 - "dil14" // standard input (motherboard)
37430      // 0x0010 - "dil15" // standard input (motherboard)
37431      PORT_MODIFY("IN-19")
37432      // 0x0001 - "dil16" // standard input (motherboard)
37433      PORT_MODIFY("IN-20")
37434      // 0x0001 - "grnbut" // standard input (motherboard)
37435      // 0x0002 - "dorlok" // standard input (expected here)
37436      // 0x0004 - "serdor" // standard input (expected here)
37437      // 0x0008 - "cshdor" // standard input (expected here)
37438      // 0x0010 - "hopdmp" // standard input (expected here)
3743937439INPUT_PORTS_END
3744037440
3744137441INPUT_PORTS_START( sc4dndcw5 )
r31373r31374
3746937469}
3747037470
3747137471INPUT_PORTS_START( sc4dndtr ) // this structure is generated
37472        PORT_INCLUDE( sc4_base )
37473        PORT_MODIFY("IN-1")
37474        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
37475        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37476        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37477        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37478        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exchan")
37479        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37480        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37481        PORT_MODIFY("IN-2")
37482        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
37483        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
37484        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37485        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37486        PORT_MODIFY("IN-3")
37487        // 0x0004 - "stk 4" // standard input (expected here)
37488        // 0x0008 - "stk 3" // standard input (expected here)
37489        // 0x0010 - "stk 2" // standard input (expected here)
37490        PORT_MODIFY("IN-5")
37491        // 0x0001 - "priz4" // standard input (expected here)
37492        // 0x0002 - "priz3" // standard input (expected here)
37493        // 0x0004 - "priz2" // standard input (expected here)
37494        // 0x0008 - "priz1" // standard input (expected here)
37495        PORT_MODIFY("IN-6")
37496        // 0x0001 - "perc1" // standard input (expected here)
37497        // 0x0002 - "perc2" // standard input (expected here)
37498        // 0x0004 - "perc3" // standard input (expected here)
37499        // 0x0008 - "perc4" // standard input (expected here)
37500        PORT_MODIFY("IN-8")
37501        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("no dea")
37502        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("play g")
37503        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("deal")
37504        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk msg")
37505        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("csh bu")
37506        PORT_MODIFY("IN-16")
37507        // 0x0001 - "dil1" // standard input (motherboard)
37508        // 0x0002 - "dil2" // standard input (motherboard)
37509        // 0x0004 - "dil3" // standard input (motherboard)
37510        // 0x0008 - "dil4" // standard input (motherboard)
37511        // 0x0010 - "dil5" // standard input (motherboard)
37512        // 0x0100 - "top up" // known extended input, usually 'top up'
37513        PORT_MODIFY("IN-17")
37514        // 0x0001 - "dil6" // standard input (motherboard)
37515        // 0x0002 - "dil7" // standard input (motherboard)
37516        // 0x0004 - "dil8" // standard input (motherboard)
37517        // 0x0008 - "dil9" // standard input (motherboard)
37518        // 0x0010 - "dil10" // standard input (motherboard)
37519        PORT_MODIFY("IN-18")
37520        // 0x0001 - "dil11" // standard input (motherboard)
37521        // 0x0002 - "dil12" // standard input (motherboard)
37522        // 0x0004 - "dil13" // standard input (motherboard)
37523        // 0x0008 - "dil14" // standard input (motherboard)
37524        // 0x0010 - "dil15" // standard input (motherboard)
37525        PORT_MODIFY("IN-19")
37526        // 0x0001 - "dil16" // standard input (motherboard)
37527        PORT_MODIFY("IN-20")
37528        // 0x0001 - "grnbut" // standard input (motherboard)
37529        // 0x0002 - "dorlok" // standard input (expected here)
37530        // 0x0004 - "serdor" // standard input (expected here)
37531        // 0x0008 - "cshdor" // standard input (expected here)
37532        // 0x0010 - "hopdmp" // standard input (expected here)
37472      PORT_INCLUDE( sc4_base )
37473      PORT_MODIFY("IN-1")
37474      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
37475      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37476      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37477      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37478      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exchan")
37479      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37480      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37481      PORT_MODIFY("IN-2")
37482      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
37483      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
37484      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37485      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37486      PORT_MODIFY("IN-3")
37487      // 0x0004 - "stk 4" // standard input (expected here)
37488      // 0x0008 - "stk 3" // standard input (expected here)
37489      // 0x0010 - "stk 2" // standard input (expected here)
37490      PORT_MODIFY("IN-5")
37491      // 0x0001 - "priz4" // standard input (expected here)
37492      // 0x0002 - "priz3" // standard input (expected here)
37493      // 0x0004 - "priz2" // standard input (expected here)
37494      // 0x0008 - "priz1" // standard input (expected here)
37495      PORT_MODIFY("IN-6")
37496      // 0x0001 - "perc1" // standard input (expected here)
37497      // 0x0002 - "perc2" // standard input (expected here)
37498      // 0x0004 - "perc3" // standard input (expected here)
37499      // 0x0008 - "perc4" // standard input (expected here)
37500      PORT_MODIFY("IN-8")
37501      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("no dea")
37502      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("play g")
37503      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("deal")
37504      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk msg")
37505      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("csh bu")
37506      PORT_MODIFY("IN-16")
37507      // 0x0001 - "dil1" // standard input (motherboard)
37508      // 0x0002 - "dil2" // standard input (motherboard)
37509      // 0x0004 - "dil3" // standard input (motherboard)
37510      // 0x0008 - "dil4" // standard input (motherboard)
37511      // 0x0010 - "dil5" // standard input (motherboard)
37512      // 0x0100 - "top up" // known extended input, usually 'top up'
37513      PORT_MODIFY("IN-17")
37514      // 0x0001 - "dil6" // standard input (motherboard)
37515      // 0x0002 - "dil7" // standard input (motherboard)
37516      // 0x0004 - "dil8" // standard input (motherboard)
37517      // 0x0008 - "dil9" // standard input (motherboard)
37518      // 0x0010 - "dil10" // standard input (motherboard)
37519      PORT_MODIFY("IN-18")
37520      // 0x0001 - "dil11" // standard input (motherboard)
37521      // 0x0002 - "dil12" // standard input (motherboard)
37522      // 0x0004 - "dil13" // standard input (motherboard)
37523      // 0x0008 - "dil14" // standard input (motherboard)
37524      // 0x0010 - "dil15" // standard input (motherboard)
37525      PORT_MODIFY("IN-19")
37526      // 0x0001 - "dil16" // standard input (motherboard)
37527      PORT_MODIFY("IN-20")
37528      // 0x0001 - "grnbut" // standard input (motherboard)
37529      // 0x0002 - "dorlok" // standard input (expected here)
37530      // 0x0004 - "serdor" // standard input (expected here)
37531      // 0x0008 - "cshdor" // standard input (expected here)
37532      // 0x0010 - "hopdmp" // standard input (expected here)
3753337533INPUT_PORTS_END
3753437534
3753537535INPUT_PORTS_START( sc4dndtr70 )
r31373r31374
3756137561}
3756237562
3756337563INPUT_PORTS_START( sc4dndwb ) // this structure is generated
37564        PORT_INCLUDE( sc4_base )
37565        PORT_MODIFY("IN-1")
37566        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
37567        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37568        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37569        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37570        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
37571        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37572        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37573        PORT_MODIFY("IN-2")
37574        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
37575        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
37576        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37577        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37578        PORT_MODIFY("IN-3")
37579        // 0x0004 - "stk 4" // standard input (expected here)
37580        // 0x0008 - "stk 3" // standard input (expected here)
37581        // 0x0010 - "stk 2" // standard input (expected here)
37582        PORT_MODIFY("IN-5")
37583        // 0x0001 - "priz4" // standard input (expected here)
37584        // 0x0002 - "priz3" // standard input (expected here)
37585        // 0x0004 - "priz2" // standard input (expected here)
37586        // 0x0008 - "priz1" // standard input (expected here)
37587        PORT_MODIFY("IN-6")
37588        // 0x0001 - "perc1" // standard input (expected here)
37589        // 0x0002 - "perc2" // standard input (expected here)
37590        // 0x0004 - "perc3" // standard input (expected here)
37591        // 0x0008 - "perc4" // standard input (expected here)
37592        PORT_MODIFY("IN-8")
37593        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("step")
37594        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("csh lo")
37595        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("sup lo")
37596        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("fet lo")
37597        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("csh hi")
37598        PORT_MODIFY("IN-9")
37599        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("sup hi")
37600        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("fet hi")
37601        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("nodeal")
37602        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("play")
37603        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("deal")
37604        PORT_MODIFY("IN-16")
37605        // 0x0001 - "dil1" // standard input (motherboard)
37606        // 0x0002 - "dil2" // standard input (motherboard)
37607        // 0x0004 - "dil3" // standard input (motherboard)
37608        // 0x0008 - "dil4" // standard input (motherboard)
37609        // 0x0010 - "dil5" // standard input (motherboard)
37610        // 0x0100 - "top up" // known extended input, usually 'top up'
37611        PORT_MODIFY("IN-17")
37612        // 0x0001 - "dil6" // standard input (motherboard)
37613        // 0x0002 - "dil7" // standard input (motherboard)
37614        // 0x0004 - "dil8" // standard input (motherboard)
37615        // 0x0008 - "dil9" // standard input (motherboard)
37616        // 0x0010 - "dil10" // standard input (motherboard)
37617        PORT_MODIFY("IN-18")
37618        // 0x0001 - "dil11" // standard input (motherboard)
37619        // 0x0002 - "dil12" // standard input (motherboard)
37620        // 0x0004 - "dil13" // standard input (motherboard)
37621        // 0x0008 - "dil14" // standard input (motherboard)
37622        // 0x0010 - "dil15" // standard input (motherboard)
37623        PORT_MODIFY("IN-19")
37624        // 0x0001 - "dil16" // standard input (motherboard)
37625        PORT_MODIFY("IN-20")
37626        // 0x0001 - "grnbut" // standard input (motherboard)
37627        // 0x0002 - "dorlok" // standard input (expected here)
37628        // 0x0004 - "serdor" // standard input (expected here)
37629        // 0x0008 - "cshdor" // standard input (expected here)
37630        // 0x0010 - "hopdmp" // standard input (expected here)
37564      PORT_INCLUDE( sc4_base )
37565      PORT_MODIFY("IN-1")
37566      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
37567      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37568      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37569      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37570      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
37571      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37572      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37573      PORT_MODIFY("IN-2")
37574      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
37575      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
37576      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37577      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37578      PORT_MODIFY("IN-3")
37579      // 0x0004 - "stk 4" // standard input (expected here)
37580      // 0x0008 - "stk 3" // standard input (expected here)
37581      // 0x0010 - "stk 2" // standard input (expected here)
37582      PORT_MODIFY("IN-5")
37583      // 0x0001 - "priz4" // standard input (expected here)
37584      // 0x0002 - "priz3" // standard input (expected here)
37585      // 0x0004 - "priz2" // standard input (expected here)
37586      // 0x0008 - "priz1" // standard input (expected here)
37587      PORT_MODIFY("IN-6")
37588      // 0x0001 - "perc1" // standard input (expected here)
37589      // 0x0002 - "perc2" // standard input (expected here)
37590      // 0x0004 - "perc3" // standard input (expected here)
37591      // 0x0008 - "perc4" // standard input (expected here)
37592      PORT_MODIFY("IN-8")
37593      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("step")
37594      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("csh lo")
37595      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("sup lo")
37596      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("fet lo")
37597      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("csh hi")
37598      PORT_MODIFY("IN-9")
37599      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("sup hi")
37600      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("fet hi")
37601      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("nodeal")
37602      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("play")
37603      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("deal")
37604      PORT_MODIFY("IN-16")
37605      // 0x0001 - "dil1" // standard input (motherboard)
37606      // 0x0002 - "dil2" // standard input (motherboard)
37607      // 0x0004 - "dil3" // standard input (motherboard)
37608      // 0x0008 - "dil4" // standard input (motherboard)
37609      // 0x0010 - "dil5" // standard input (motherboard)
37610      // 0x0100 - "top up" // known extended input, usually 'top up'
37611      PORT_MODIFY("IN-17")
37612      // 0x0001 - "dil6" // standard input (motherboard)
37613      // 0x0002 - "dil7" // standard input (motherboard)
37614      // 0x0004 - "dil8" // standard input (motherboard)
37615      // 0x0008 - "dil9" // standard input (motherboard)
37616      // 0x0010 - "dil10" // standard input (motherboard)
37617      PORT_MODIFY("IN-18")
37618      // 0x0001 - "dil11" // standard input (motherboard)
37619      // 0x0002 - "dil12" // standard input (motherboard)
37620      // 0x0004 - "dil13" // standard input (motherboard)
37621      // 0x0008 - "dil14" // standard input (motherboard)
37622      // 0x0010 - "dil15" // standard input (motherboard)
37623      PORT_MODIFY("IN-19")
37624      // 0x0001 - "dil16" // standard input (motherboard)
37625      PORT_MODIFY("IN-20")
37626      // 0x0001 - "grnbut" // standard input (motherboard)
37627      // 0x0002 - "dorlok" // standard input (expected here)
37628      // 0x0004 - "serdor" // standard input (expected here)
37629      // 0x0008 - "cshdor" // standard input (expected here)
37630      // 0x0010 - "hopdmp" // standard input (expected here)
3763137631INPUT_PORTS_END
3763237632
3763337633INPUT_PORTS_START( sc4dndwb35 )
r31373r31374
3766437664}
3766537665
3766637666INPUT_PORTS_START( sc4dndbe ) // this structure is generated
37667        PORT_INCLUDE( sc4_base )
37668        PORT_MODIFY("IN-1")
37669        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37670        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37671        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37672        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37673        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
37674        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37675        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37676        PORT_MODIFY("IN-2")
37677        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("deal o")
37678        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
37679        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37680        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37681        PORT_MODIFY("IN-3")
37682        // 0x0004 - "stk 4" // standard input (expected here)
37683        // 0x0008 - "stk 3" // standard input (expected here)
37684        // 0x0010 - "stk 2" // standard input (expected here)
37685        PORT_MODIFY("IN-5")
37686        // 0x0001 - "priz4" // standard input (expected here)
37687        // 0x0002 - "priz3" // standard input (expected here)
37688        // 0x0004 - "priz2" // standard input (expected here)
37689        // 0x0008 - "priz1" // standard input (expected here)
37690        PORT_MODIFY("IN-6")
37691        // 0x0001 - "perc1" // standard input (expected here)
37692        // 0x0002 - "perc2" // standard input (expected here)
37693        // 0x0004 - "perc3" // standard input (expected here)
37694        // 0x0008 - "perc4" // standard input (expected here)
37695        PORT_MODIFY("IN-8")
37696        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c or b")
37697        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nodeal")
37698        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("deal")
37699        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("streak")
37700        PORT_MODIFY("IN-16")
37701        // 0x0001 - "dil1" // standard input (motherboard)
37702        // 0x0002 - "dil2" // standard input (motherboard)
37703        // 0x0004 - "dil3" // standard input (motherboard)
37704        // 0x0008 - "dil4" // standard input (motherboard)
37705        // 0x0010 - "dil5" // standard input (motherboard)
37706        // 0x0100 - "top up" // known extended input, usually 'top up'
37707        PORT_MODIFY("IN-17")
37708        // 0x0001 - "dil6" // standard input (motherboard)
37709        // 0x0002 - "dil7" // standard input (motherboard)
37710        // 0x0004 - "dil8" // standard input (motherboard)
37711        // 0x0008 - "dil9" // standard input (motherboard)
37712        // 0x0010 - "dil10" // standard input (motherboard)
37713        PORT_MODIFY("IN-18")
37714        // 0x0001 - "dil11" // standard input (motherboard)
37715        // 0x0002 - "dil12" // standard input (motherboard)
37716        // 0x0004 - "dil13" // standard input (motherboard)
37717        // 0x0008 - "dil14" // standard input (motherboard)
37718        // 0x0010 - "dil15" // standard input (motherboard)
37719        PORT_MODIFY("IN-19")
37720        // 0x0001 - "dil16" // standard input (motherboard)
37721        PORT_MODIFY("IN-20")
37722        // 0x0001 - "grnbut" // standard input (motherboard)
37723        // 0x0002 - "dorlok" // standard input (expected here)
37724        // 0x0004 - "serdor" // standard input (expected here)
37725        // 0x0008 - "cshdor" // standard input (expected here)
37726        // 0x0010 - "hopdmp" // standard input (expected here)
37667      PORT_INCLUDE( sc4_base )
37668      PORT_MODIFY("IN-1")
37669      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37670      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37671      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37672      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37673      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
37674      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37675      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37676      PORT_MODIFY("IN-2")
37677      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("deal o")
37678      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
37679      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37680      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37681      PORT_MODIFY("IN-3")
37682      // 0x0004 - "stk 4" // standard input (expected here)
37683      // 0x0008 - "stk 3" // standard input (expected here)
37684      // 0x0010 - "stk 2" // standard input (expected here)
37685      PORT_MODIFY("IN-5")
37686      // 0x0001 - "priz4" // standard input (expected here)
37687      // 0x0002 - "priz3" // standard input (expected here)
37688      // 0x0004 - "priz2" // standard input (expected here)
37689      // 0x0008 - "priz1" // standard input (expected here)
37690      PORT_MODIFY("IN-6")
37691      // 0x0001 - "perc1" // standard input (expected here)
37692      // 0x0002 - "perc2" // standard input (expected here)
37693      // 0x0004 - "perc3" // standard input (expected here)
37694      // 0x0008 - "perc4" // standard input (expected here)
37695      PORT_MODIFY("IN-8")
37696      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c or b")
37697      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nodeal")
37698      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("deal")
37699      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("streak")
37700      PORT_MODIFY("IN-16")
37701      // 0x0001 - "dil1" // standard input (motherboard)
37702      // 0x0002 - "dil2" // standard input (motherboard)
37703      // 0x0004 - "dil3" // standard input (motherboard)
37704      // 0x0008 - "dil4" // standard input (motherboard)
37705      // 0x0010 - "dil5" // standard input (motherboard)
37706      // 0x0100 - "top up" // known extended input, usually 'top up'
37707      PORT_MODIFY("IN-17")
37708      // 0x0001 - "dil6" // standard input (motherboard)
37709      // 0x0002 - "dil7" // standard input (motherboard)
37710      // 0x0004 - "dil8" // standard input (motherboard)
37711      // 0x0008 - "dil9" // standard input (motherboard)
37712      // 0x0010 - "dil10" // standard input (motherboard)
37713      PORT_MODIFY("IN-18")
37714      // 0x0001 - "dil11" // standard input (motherboard)
37715      // 0x0002 - "dil12" // standard input (motherboard)
37716      // 0x0004 - "dil13" // standard input (motherboard)
37717      // 0x0008 - "dil14" // standard input (motherboard)
37718      // 0x0010 - "dil15" // standard input (motherboard)
37719      PORT_MODIFY("IN-19")
37720      // 0x0001 - "dil16" // standard input (motherboard)
37721      PORT_MODIFY("IN-20")
37722      // 0x0001 - "grnbut" // standard input (motherboard)
37723      // 0x0002 - "dorlok" // standard input (expected here)
37724      // 0x0004 - "serdor" // standard input (expected here)
37725      // 0x0008 - "cshdor" // standard input (expected here)
37726      // 0x0010 - "hopdmp" // standard input (expected here)
3772737727INPUT_PORTS_END
3772837728
3772937729INPUT_PORTS_START( sc4dndbe25 )
r31373r31374
3777337773}
3777437774
3777537775INPUT_PORTS_START( sc4dndbc ) // this structure is generated
37776        PORT_INCLUDE( sc4_base )
37777        PORT_MODIFY("IN-1")
37778        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37779        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37780        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37781        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37782        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
37783        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37784        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37785        PORT_MODIFY("IN-2")
37786        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
37787        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
37788        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
37789        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37790        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
37791        PORT_MODIFY("IN-3")
37792        // 0x0004 - "stk 4" // standard input (expected here)
37793        // 0x0008 - "stk 3" // standard input (expected here)
37794        // 0x0010 - "stk 2" // standard input (expected here)
37795        PORT_MODIFY("IN-5")
37796        // 0x0001 - "priz4" // standard input (expected here)
37797        // 0x0002 - "priz3" // standard input (expected here)
37798        // 0x0004 - "priz2" // standard input (expected here)
37799        // 0x0008 - "priz1" // standard input (expected here)
37800        PORT_MODIFY("IN-6")
37801        // 0x0001 - "perc1" // standard input (expected here)
37802        // 0x0002 - "perc2" // standard input (expected here)
37803        // 0x0004 - "perc3" // standard input (expected here)
37804        // 0x0008 - "perc4" // standard input (expected here)
37805        PORT_MODIFY("IN-8")
37806        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cs bus")
37807        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
37808        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mes")
37809        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nodeal")
37810        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("pl del")
37811        PORT_MODIFY("IN-9")
37812        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("deal")
37813        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("tk stk")
37814        PORT_MODIFY("IN-16")
37815        // 0x0001 - "dil1" // standard input (motherboard)
37816        // 0x0002 - "dil2" // standard input (motherboard)
37817        // 0x0004 - "dil3" // standard input (motherboard)
37818        // 0x0008 - "dil4" // standard input (motherboard)
37819        // 0x0010 - "dil5" // standard input (motherboard)
37820        // 0x0100 - "top up" // known extended input, usually 'top up'
37821        PORT_MODIFY("IN-17")
37822        // 0x0001 - "dil6" // standard input (motherboard)
37823        // 0x0002 - "dil7" // standard input (motherboard)
37824        // 0x0004 - "dil8" // standard input (motherboard)
37825        // 0x0008 - "dil9" // standard input (motherboard)
37826        // 0x0010 - "dil10" // standard input (motherboard)
37827        PORT_MODIFY("IN-18")
37828        // 0x0001 - "dil11" // standard input (motherboard)
37829        // 0x0002 - "dil12" // standard input (motherboard)
37830        // 0x0004 - "dil13" // standard input (motherboard)
37831        // 0x0008 - "dil14" // standard input (motherboard)
37832        // 0x0010 - "dil15" // standard input (motherboard)
37833        PORT_MODIFY("IN-19")
37834        // 0x0001 - "dil16" // standard input (motherboard)
37835        PORT_MODIFY("IN-20")
37836        // 0x0001 - "grnbut" // standard input (motherboard)
37837        // 0x0002 - "dorlok" // standard input (expected here)
37838        // 0x0004 - "serdor" // standard input (expected here)
37839        // 0x0008 - "cshdor" // standard input (expected here)
37840        // 0x0010 - "hopdmp" // standard input (expected here)
37776      PORT_INCLUDE( sc4_base )
37777      PORT_MODIFY("IN-1")
37778      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37779      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37780      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37781      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37782      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
37783      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37784      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
37785      PORT_MODIFY("IN-2")
37786      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
37787      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
37788      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
37789      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37790      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
37791      PORT_MODIFY("IN-3")
37792      // 0x0004 - "stk 4" // standard input (expected here)
37793      // 0x0008 - "stk 3" // standard input (expected here)
37794      // 0x0010 - "stk 2" // standard input (expected here)
37795      PORT_MODIFY("IN-5")
37796      // 0x0001 - "priz4" // standard input (expected here)
37797      // 0x0002 - "priz3" // standard input (expected here)
37798      // 0x0004 - "priz2" // standard input (expected here)
37799      // 0x0008 - "priz1" // standard input (expected here)
37800      PORT_MODIFY("IN-6")
37801      // 0x0001 - "perc1" // standard input (expected here)
37802      // 0x0002 - "perc2" // standard input (expected here)
37803      // 0x0004 - "perc3" // standard input (expected here)
37804      // 0x0008 - "perc4" // standard input (expected here)
37805      PORT_MODIFY("IN-8")
37806      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cs bus")
37807      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
37808      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mes")
37809      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nodeal")
37810      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("pl del")
37811      PORT_MODIFY("IN-9")
37812      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("deal")
37813      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("tk stk")
37814      PORT_MODIFY("IN-16")
37815      // 0x0001 - "dil1" // standard input (motherboard)
37816      // 0x0002 - "dil2" // standard input (motherboard)
37817      // 0x0004 - "dil3" // standard input (motherboard)
37818      // 0x0008 - "dil4" // standard input (motherboard)
37819      // 0x0010 - "dil5" // standard input (motherboard)
37820      // 0x0100 - "top up" // known extended input, usually 'top up'
37821      PORT_MODIFY("IN-17")
37822      // 0x0001 - "dil6" // standard input (motherboard)
37823      // 0x0002 - "dil7" // standard input (motherboard)
37824      // 0x0004 - "dil8" // standard input (motherboard)
37825      // 0x0008 - "dil9" // standard input (motherboard)
37826      // 0x0010 - "dil10" // standard input (motherboard)
37827      PORT_MODIFY("IN-18")
37828      // 0x0001 - "dil11" // standard input (motherboard)
37829      // 0x0002 - "dil12" // standard input (motherboard)
37830      // 0x0004 - "dil13" // standard input (motherboard)
37831      // 0x0008 - "dil14" // standard input (motherboard)
37832      // 0x0010 - "dil15" // standard input (motherboard)
37833      PORT_MODIFY("IN-19")
37834      // 0x0001 - "dil16" // standard input (motherboard)
37835      PORT_MODIFY("IN-20")
37836      // 0x0001 - "grnbut" // standard input (motherboard)
37837      // 0x0002 - "dorlok" // standard input (expected here)
37838      // 0x0004 - "serdor" // standard input (expected here)
37839      // 0x0008 - "cshdor" // standard input (expected here)
37840      // 0x0010 - "hopdmp" // standard input (expected here)
3784137841INPUT_PORTS_END
3784237842
3784337843INPUT_PORTS_START( sc4dndbc70 )
r31373r31374
3786937869}
3787037870
3787137871INPUT_PORTS_START( sc4dmine ) // this structure is generated
37872        PORT_INCLUDE( sc4_base )
37873        PORT_MODIFY("IN-1")
37874        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37875        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37876        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37877        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37878        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
37879        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37880        PORT_MODIFY("IN-2")
37881        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
37882        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37883        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37884        PORT_MODIFY("IN-3")
37885        // 0x0004 - "stk 4" // standard input (expected here)
37886        // 0x0008 - "stk 3" // standard input (expected here)
37887        // 0x0010 - "stk 2" // standard input (expected here)
37888        PORT_MODIFY("IN-4")
37889        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
37890        PORT_MODIFY("IN-5")
37891        // 0x0001 - "priz4" // standard input (expected here)
37892        // 0x0002 - "priz3" // standard input (expected here)
37893        // 0x0004 - "priz2" // standard input (expected here)
37894        // 0x0008 - "priz1" // standard input (expected here)
37895        PORT_MODIFY("IN-6")
37896        // 0x0001 - "perc1" // standard input (expected here)
37897        // 0x0002 - "perc2" // standard input (expected here)
37898        // 0x0004 - "perc3" // standard input (expected here)
37899        // 0x0008 - "perc4" // standard input (expected here)
37900        PORT_MODIFY("IN-8")
37901        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
37902        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("spins")
37903        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("shoot")
37904        PORT_MODIFY("IN-16")
37905        // 0x0001 - "dil 1" // standard input (motherboard)
37906        // 0x0002 - "dil 2" // standard input (motherboard)
37907        // 0x0004 - "dil 3" // standard input (motherboard)
37908        // 0x0008 - "dil 4" // standard input (motherboard)
37909        // 0x0010 - "dil 5" // standard input (motherboard)
37910        // 0x0100 - "htopup" // known extended input, usually 'top up'
37911        PORT_MODIFY("IN-17")
37912        // 0x0001 - "dil 6" // standard input (motherboard)
37913        // 0x0002 - "dil 7" // standard input (motherboard)
37914        // 0x0004 - "dil 8" // standard input (motherboard)
37915        // 0x0008 - "dil 9" // standard input (motherboard)
37916        // 0x0010 - "dil 10" // standard input (motherboard)
37917        PORT_MODIFY("IN-18")
37918        // 0x0001 - "dil 11" // standard input (motherboard)
37919        // 0x0002 - "dil 12" // standard input (motherboard)
37920        // 0x0004 - "dil 13" // standard input (motherboard)
37921        // 0x0008 - "dil 14" // standard input (motherboard)
37922        // 0x0010 - "dil 15" // standard input (motherboard)
37923        PORT_MODIFY("IN-19")
37924        // 0x0001 - "dil 16" // standard input (motherboard)
37925        PORT_MODIFY("IN-20")
37926        // 0x0001 - "grnbut" // standard input (motherboard)
37927        // 0x0002 - "dorlok" // standard input (expected here)
37928        // 0x0004 - "serdor" // standard input (expected here)
37929        // 0x0008 - "cshdor" // standard input (expected here)
37930        // 0x0010 - "hopdmp" // standard input (expected here)
37872      PORT_INCLUDE( sc4_base )
37873      PORT_MODIFY("IN-1")
37874      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37875      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37876      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37877      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37878      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
37879      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37880      PORT_MODIFY("IN-2")
37881      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
37882      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37883      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37884      PORT_MODIFY("IN-3")
37885      // 0x0004 - "stk 4" // standard input (expected here)
37886      // 0x0008 - "stk 3" // standard input (expected here)
37887      // 0x0010 - "stk 2" // standard input (expected here)
37888      PORT_MODIFY("IN-4")
37889      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
37890      PORT_MODIFY("IN-5")
37891      // 0x0001 - "priz4" // standard input (expected here)
37892      // 0x0002 - "priz3" // standard input (expected here)
37893      // 0x0004 - "priz2" // standard input (expected here)
37894      // 0x0008 - "priz1" // standard input (expected here)
37895      PORT_MODIFY("IN-6")
37896      // 0x0001 - "perc1" // standard input (expected here)
37897      // 0x0002 - "perc2" // standard input (expected here)
37898      // 0x0004 - "perc3" // standard input (expected here)
37899      // 0x0008 - "perc4" // standard input (expected here)
37900      PORT_MODIFY("IN-8")
37901      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
37902      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("spins")
37903      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("shoot")
37904      PORT_MODIFY("IN-16")
37905      // 0x0001 - "dil 1" // standard input (motherboard)
37906      // 0x0002 - "dil 2" // standard input (motherboard)
37907      // 0x0004 - "dil 3" // standard input (motherboard)
37908      // 0x0008 - "dil 4" // standard input (motherboard)
37909      // 0x0010 - "dil 5" // standard input (motherboard)
37910      // 0x0100 - "htopup" // known extended input, usually 'top up'
37911      PORT_MODIFY("IN-17")
37912      // 0x0001 - "dil 6" // standard input (motherboard)
37913      // 0x0002 - "dil 7" // standard input (motherboard)
37914      // 0x0004 - "dil 8" // standard input (motherboard)
37915      // 0x0008 - "dil 9" // standard input (motherboard)
37916      // 0x0010 - "dil 10" // standard input (motherboard)
37917      PORT_MODIFY("IN-18")
37918      // 0x0001 - "dil 11" // standard input (motherboard)
37919      // 0x0002 - "dil 12" // standard input (motherboard)
37920      // 0x0004 - "dil 13" // standard input (motherboard)
37921      // 0x0008 - "dil 14" // standard input (motherboard)
37922      // 0x0010 - "dil 15" // standard input (motherboard)
37923      PORT_MODIFY("IN-19")
37924      // 0x0001 - "dil 16" // standard input (motherboard)
37925      PORT_MODIFY("IN-20")
37926      // 0x0001 - "grnbut" // standard input (motherboard)
37927      // 0x0002 - "dorlok" // standard input (expected here)
37928      // 0x0004 - "serdor" // standard input (expected here)
37929      // 0x0008 - "cshdor" // standard input (expected here)
37930      // 0x0010 - "hopdmp" // standard input (expected here)
3793137931INPUT_PORTS_END
3793237932
3793337933// PR1307 AWP DIAMOND MINE         PR1307 DIAM MINE SOUNDS11
r31373r31374
3796237962}
3796337963
3796437964INPUT_PORTS_START( sc4ddosh ) // this structure is generated
37965        PORT_INCLUDE( sc4_base )
37966        PORT_MODIFY("IN-1")
37967        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37968        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37969        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37970        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37971        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
37972        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37973        PORT_MODIFY("IN-2")
37974        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
37975        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37976        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37977        PORT_MODIFY("IN-3")
37978        // 0x0004 - "stk 4" // standard input (expected here)
37979        // 0x0008 - "stk 3" // standard input (expected here)
37980        // 0x0010 - "stk 2" // standard input (expected here)
37981        PORT_MODIFY("IN-4")
37982        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
37983        PORT_MODIFY("IN-5")
37984        // 0x0001 - "priz4" // standard input (expected here)
37985        // 0x0002 - "priz3" // standard input (expected here)
37986        // 0x0004 - "priz2" // standard input (expected here)
37987        // 0x0008 - "priz1" // standard input (expected here)
37988        PORT_MODIFY("IN-6")
37989        // 0x0001 - "perc1" // standard input (expected here)
37990        // 0x0002 - "perc2" // standard input (expected here)
37991        // 0x0004 - "perc3" // standard input (expected here)
37992        // 0x0008 - "perc4" // standard input (expected here)
37993        PORT_MODIFY("IN-8")
37994        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
37995        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nudges")
37996        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("step")
37997        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fet")
37998        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk kos")
37999        PORT_MODIFY("IN-16")
38000        // 0x0001 - "dil 1" // standard input (motherboard)
38001        // 0x0002 - "dil 2" // standard input (motherboard)
38002        // 0x0004 - "dil 3" // standard input (motherboard)
38003        // 0x0008 - "dil 4" // standard input (motherboard)
38004        // 0x0010 - "dil 5" // standard input (motherboard)
38005        // 0x0100 - "htopup" // known extended input, usually 'top up'
38006        PORT_MODIFY("IN-17")
38007        // 0x0001 - "dil 6" // standard input (motherboard)
38008        // 0x0002 - "dil 7" // standard input (motherboard)
38009        // 0x0004 - "dil 8" // standard input (motherboard)
38010        // 0x0008 - "dil 9" // standard input (motherboard)
38011        // 0x0010 - "dil 10" // standard input (motherboard)
38012        PORT_MODIFY("IN-18")
38013        // 0x0001 - "dil 11" // standard input (motherboard)
38014        // 0x0002 - "dil 12" // standard input (motherboard)
38015        // 0x0004 - "dil 13" // standard input (motherboard)
38016        // 0x0008 - "dil 14" // standard input (motherboard)
38017        // 0x0010 - "dil 15" // standard input (motherboard)
38018        PORT_MODIFY("IN-19")
38019        // 0x0001 - "dil 16" // standard input (motherboard)
38020        PORT_MODIFY("IN-20")
38021        // 0x0001 - "grnbut" // standard input (motherboard)
38022        // 0x0002 - "dorlok" // standard input (expected here)
38023        // 0x0004 - "serdor" // standard input (expected here)
38024        // 0x0008 - "cshdor" // standard input (expected here)
38025        // 0x0010 - "hopdmp" // standard input (expected here)
37965      PORT_INCLUDE( sc4_base )
37966      PORT_MODIFY("IN-1")
37967      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
37968      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
37969      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
37970      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
37971      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
37972      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
37973      PORT_MODIFY("IN-2")
37974      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
37975      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
37976      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
37977      PORT_MODIFY("IN-3")
37978      // 0x0004 - "stk 4" // standard input (expected here)
37979      // 0x0008 - "stk 3" // standard input (expected here)
37980      // 0x0010 - "stk 2" // standard input (expected here)
37981      PORT_MODIFY("IN-4")
37982      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
37983      PORT_MODIFY("IN-5")
37984      // 0x0001 - "priz4" // standard input (expected here)
37985      // 0x0002 - "priz3" // standard input (expected here)
37986      // 0x0004 - "priz2" // standard input (expected here)
37987      // 0x0008 - "priz1" // standard input (expected here)
37988      PORT_MODIFY("IN-6")
37989      // 0x0001 - "perc1" // standard input (expected here)
37990      // 0x0002 - "perc2" // standard input (expected here)
37991      // 0x0004 - "perc3" // standard input (expected here)
37992      // 0x0008 - "perc4" // standard input (expected here)
37993      PORT_MODIFY("IN-8")
37994      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
37995      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nudges")
37996      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("step")
37997      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fet")
37998      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk kos")
37999      PORT_MODIFY("IN-16")
38000      // 0x0001 - "dil 1" // standard input (motherboard)
38001      // 0x0002 - "dil 2" // standard input (motherboard)
38002      // 0x0004 - "dil 3" // standard input (motherboard)
38003      // 0x0008 - "dil 4" // standard input (motherboard)
38004      // 0x0010 - "dil 5" // standard input (motherboard)
38005      // 0x0100 - "htopup" // known extended input, usually 'top up'
38006      PORT_MODIFY("IN-17")
38007      // 0x0001 - "dil 6" // standard input (motherboard)
38008      // 0x0002 - "dil 7" // standard input (motherboard)
38009      // 0x0004 - "dil 8" // standard input (motherboard)
38010      // 0x0008 - "dil 9" // standard input (motherboard)
38011      // 0x0010 - "dil 10" // standard input (motherboard)
38012      PORT_MODIFY("IN-18")
38013      // 0x0001 - "dil 11" // standard input (motherboard)
38014      // 0x0002 - "dil 12" // standard input (motherboard)
38015      // 0x0004 - "dil 13" // standard input (motherboard)
38016      // 0x0008 - "dil 14" // standard input (motherboard)
38017      // 0x0010 - "dil 15" // standard input (motherboard)
38018      PORT_MODIFY("IN-19")
38019      // 0x0001 - "dil 16" // standard input (motherboard)
38020      PORT_MODIFY("IN-20")
38021      // 0x0001 - "grnbut" // standard input (motherboard)
38022      // 0x0002 - "dorlok" // standard input (expected here)
38023      // 0x0004 - "serdor" // standard input (expected here)
38024      // 0x0008 - "cshdor" // standard input (expected here)
38025      // 0x0010 - "hopdmp" // standard input (expected here)
3802638026INPUT_PORTS_END
3802738027
3802838028// saw a crash on exit with this game, why?
r31373r31374
3804638046GAMEL( 200?, sc4ddoshk   ,sc4ddosh,  sc4, sc4ddosh, sc4_state, sc4ddosh_mbus, ROT0, "BFM","Doctor Dosh (Bellfruit) (Scorpion 4) (set 16)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
3804738047
3804838048INPUT_PORTS_START( sc4dhh ) // this structure is generated
38049        PORT_INCLUDE( sc4_base )
38050        PORT_MODIFY("IN-1")
38051        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
38052        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38053        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38054        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38055        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
38056        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38057        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38058        PORT_MODIFY("IN-2")
38059        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
38060        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
38061        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38062        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38063        PORT_MODIFY("IN-3")
38064        // 0x0004 - "stk 4" // standard input (expected here)
38065        // 0x0008 - "stk 2" // standard input (expected here)
38066        // 0x0010 - "stk 3" // standard input (expected here)
38067        PORT_MODIFY("IN-5")
38068        // 0x0001 - "priz4" // standard input (expected here)
38069        // 0x0002 - "priz3" // standard input (expected here)
38070        // 0x0004 - "priz2" // standard input (expected here)
38071        // 0x0008 - "priz1" // standard input (expected here)
38072        PORT_MODIFY("IN-6")
38073        // 0x0001 - "perc1" // standard input (expected here)
38074        // 0x0002 - "perc2" // standard input (expected here)
38075        // 0x0004 - "perc3" // standard input (expected here)
38076        // 0x0008 - "perc4" // standard input (expected here)
38077        PORT_MODIFY("IN-8")
38078        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("sink")
38079        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lo rig")
38080        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi rig")
38081        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lo lef")
38082        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi lef")
38083        PORT_MODIFY("IN-9")
38084        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("streak")
38085        PORT_MODIFY("IN-16")
38086        // 0x0001 - "dil1" // standard input (motherboard)
38087        // 0x0002 - "dil2" // standard input (motherboard)
38088        // 0x0004 - "dil3" // standard input (motherboard)
38089        // 0x0008 - "dil4" // standard input (motherboard)
38090        // 0x0010 - "dil5" // standard input (motherboard)
38091        // 0x0100 - "top up" // known extended input, usually 'top up'
38092        PORT_MODIFY("IN-17")
38093        // 0x0001 - "dil6" // standard input (motherboard)
38094        // 0x0002 - "dil7" // standard input (motherboard)
38095        // 0x0004 - "dil8" // standard input (motherboard)
38096        // 0x0008 - "dil9" // standard input (motherboard)
38097        // 0x0010 - "dil10" // standard input (motherboard)
38098        PORT_MODIFY("IN-18")
38099        // 0x0001 - "dil11" // standard input (motherboard)
38100        // 0x0002 - "dil12" // standard input (motherboard)
38101        // 0x0004 - "dil13" // standard input (motherboard)
38102        // 0x0008 - "dil14" // standard input (motherboard)
38103        // 0x0010 - "dil15" // standard input (motherboard)
38104        PORT_MODIFY("IN-19")
38105        // 0x0001 - "dil16" // standard input (motherboard)
38106        PORT_MODIFY("IN-20")
38107        // 0x0001 - "grnbut" // standard input (motherboard)
38108        // 0x0002 - "dorlok" // standard input (expected here)
38109        // 0x0004 - "serdor" // standard input (expected here)
38110        // 0x0008 - "cshdor" // standard input (expected here)
38111        // 0x0010 - "hopdmp" // standard input (expected here)
38049      PORT_INCLUDE( sc4_base )
38050      PORT_MODIFY("IN-1")
38051      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
38052      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38053      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38054      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38055      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
38056      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38057      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38058      PORT_MODIFY("IN-2")
38059      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
38060      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
38061      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38062      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38063      PORT_MODIFY("IN-3")
38064      // 0x0004 - "stk 4" // standard input (expected here)
38065      // 0x0008 - "stk 2" // standard input (expected here)
38066      // 0x0010 - "stk 3" // standard input (expected here)
38067      PORT_MODIFY("IN-5")
38068      // 0x0001 - "priz4" // standard input (expected here)
38069      // 0x0002 - "priz3" // standard input (expected here)
38070      // 0x0004 - "priz2" // standard input (expected here)
38071      // 0x0008 - "priz1" // standard input (expected here)
38072      PORT_MODIFY("IN-6")
38073      // 0x0001 - "perc1" // standard input (expected here)
38074      // 0x0002 - "perc2" // standard input (expected here)
38075      // 0x0004 - "perc3" // standard input (expected here)
38076      // 0x0008 - "perc4" // standard input (expected here)
38077      PORT_MODIFY("IN-8")
38078      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("sink")
38079      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lo rig")
38080      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi rig")
38081      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lo lef")
38082      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi lef")
38083      PORT_MODIFY("IN-9")
38084      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("streak")
38085      PORT_MODIFY("IN-16")
38086      // 0x0001 - "dil1" // standard input (motherboard)
38087      // 0x0002 - "dil2" // standard input (motherboard)
38088      // 0x0004 - "dil3" // standard input (motherboard)
38089      // 0x0008 - "dil4" // standard input (motherboard)
38090      // 0x0010 - "dil5" // standard input (motherboard)
38091      // 0x0100 - "top up" // known extended input, usually 'top up'
38092      PORT_MODIFY("IN-17")
38093      // 0x0001 - "dil6" // standard input (motherboard)
38094      // 0x0002 - "dil7" // standard input (motherboard)
38095      // 0x0004 - "dil8" // standard input (motherboard)
38096      // 0x0008 - "dil9" // standard input (motherboard)
38097      // 0x0010 - "dil10" // standard input (motherboard)
38098      PORT_MODIFY("IN-18")
38099      // 0x0001 - "dil11" // standard input (motherboard)
38100      // 0x0002 - "dil12" // standard input (motherboard)
38101      // 0x0004 - "dil13" // standard input (motherboard)
38102      // 0x0008 - "dil14" // standard input (motherboard)
38103      // 0x0010 - "dil15" // standard input (motherboard)
38104      PORT_MODIFY("IN-19")
38105      // 0x0001 - "dil16" // standard input (motherboard)
38106      PORT_MODIFY("IN-20")
38107      // 0x0001 - "grnbut" // standard input (motherboard)
38108      // 0x0002 - "dorlok" // standard input (expected here)
38109      // 0x0004 - "serdor" // standard input (expected here)
38110      // 0x0008 - "cshdor" // standard input (expected here)
38111      // 0x0010 - "hopdmp" // standard input (expected here)
3811238112INPUT_PORTS_END
3811338113
3811438114// board positions & steppa feature don't light anything, investigate (might only be a problem in demo mode?)
r31373r31374
3813738137}
3813838138
3813938139INPUT_PORTS_START( sc4dough ) // this structure is generated
38140        PORT_INCLUDE( sc4_base )
38141        PORT_MODIFY("IN-1")
38142        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR coll")
38143        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38144        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38145        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38146        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
38147        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38148        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38149        PORT_MODIFY("IN-2")
38150        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
38151        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
38152        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38153        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38154        PORT_MODIFY("IN-5")
38155        // 0x0001 - "priz4" // standard input (expected here)
38156        // 0x0002 - "priz3" // standard input (expected here)
38157        // 0x0004 - "priz2" // standard input (expected here)
38158        // 0x0008 - "priz1" // standard input (expected here)
38159        PORT_MODIFY("IN-6")
38160        // 0x0001 - "perc1" // standard input (expected here)
38161        // 0x0002 - "perc2" // standard input (expected here)
38162        // 0x0004 - "perc3" // standard input (expected here)
38163        // 0x0008 - "perc4" // standard input (expected here)
38164        PORT_MODIFY("IN-8")
38165        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkstep")
38166        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("low")
38167        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("sshoot")
38168        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("f shot")
38169        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk bon")
38170        PORT_MODIFY("IN-9")
38171        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("high")
38172        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c shot")
38173        PORT_MODIFY("IN-16")
38174        // 0x0001 - "dil1" // standard input (motherboard)
38175        // 0x0002 - "dil2" // standard input (motherboard)
38176        // 0x0004 - "dil3" // standard input (motherboard)
38177        // 0x0008 - "dil4" // standard input (motherboard)
38178        // 0x0010 - "dil5" // standard input (motherboard)
38179        // 0x0100 - "top up" // known extended input, usually 'top up'
38180        PORT_MODIFY("IN-17")
38181        // 0x0001 - "dil6" // standard input (motherboard)
38182        // 0x0002 - "dil7" // standard input (motherboard)
38183        // 0x0004 - "dil8" // standard input (motherboard)
38184        // 0x0008 - "dil9" // standard input (motherboard)
38185        // 0x0010 - "dil10" // standard input (motherboard)
38186        PORT_MODIFY("IN-18")
38187        // 0x0001 - "dil11" // standard input (motherboard)
38188        // 0x0002 - "dil12" // standard input (motherboard)
38189        // 0x0004 - "dil13" // standard input (motherboard)
38190        // 0x0008 - "dil14" // standard input (motherboard)
38191        // 0x0010 - "dil15" // standard input (motherboard)
38192        PORT_MODIFY("IN-19")
38193        // 0x0001 - "dil16" // standard input (motherboard)
38194        PORT_MODIFY("IN-20")
38195        // 0x0001 - "grnbut" // standard input (motherboard)
38196        // 0x0002 - "dorlok" // standard input (expected here)
38197        // 0x0004 - "serdor" // standard input (expected here)
38198        // 0x0008 - "cshdor" // standard input (expected here)
38199        // 0x0010 - "hopdmp" // standard input (expected here)
38140      PORT_INCLUDE( sc4_base )
38141      PORT_MODIFY("IN-1")
38142      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR coll")
38143      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38144      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38145      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38146      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
38147      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38148      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38149      PORT_MODIFY("IN-2")
38150      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
38151      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
38152      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38153      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38154      PORT_MODIFY("IN-5")
38155      // 0x0001 - "priz4" // standard input (expected here)
38156      // 0x0002 - "priz3" // standard input (expected here)
38157      // 0x0004 - "priz2" // standard input (expected here)
38158      // 0x0008 - "priz1" // standard input (expected here)
38159      PORT_MODIFY("IN-6")
38160      // 0x0001 - "perc1" // standard input (expected here)
38161      // 0x0002 - "perc2" // standard input (expected here)
38162      // 0x0004 - "perc3" // standard input (expected here)
38163      // 0x0008 - "perc4" // standard input (expected here)
38164      PORT_MODIFY("IN-8")
38165      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkstep")
38166      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("low")
38167      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("sshoot")
38168      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("f shot")
38169      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk bon")
38170      PORT_MODIFY("IN-9")
38171      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("high")
38172      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c shot")
38173      PORT_MODIFY("IN-16")
38174      // 0x0001 - "dil1" // standard input (motherboard)
38175      // 0x0002 - "dil2" // standard input (motherboard)
38176      // 0x0004 - "dil3" // standard input (motherboard)
38177      // 0x0008 - "dil4" // standard input (motherboard)
38178      // 0x0010 - "dil5" // standard input (motherboard)
38179      // 0x0100 - "top up" // known extended input, usually 'top up'
38180      PORT_MODIFY("IN-17")
38181      // 0x0001 - "dil6" // standard input (motherboard)
38182      // 0x0002 - "dil7" // standard input (motherboard)
38183      // 0x0004 - "dil8" // standard input (motherboard)
38184      // 0x0008 - "dil9" // standard input (motherboard)
38185      // 0x0010 - "dil10" // standard input (motherboard)
38186      PORT_MODIFY("IN-18")
38187      // 0x0001 - "dil11" // standard input (motherboard)
38188      // 0x0002 - "dil12" // standard input (motherboard)
38189      // 0x0004 - "dil13" // standard input (motherboard)
38190      // 0x0008 - "dil14" // standard input (motherboard)
38191      // 0x0010 - "dil15" // standard input (motherboard)
38192      PORT_MODIFY("IN-19")
38193      // 0x0001 - "dil16" // standard input (motherboard)
38194      PORT_MODIFY("IN-20")
38195      // 0x0001 - "grnbut" // standard input (motherboard)
38196      // 0x0002 - "dorlok" // standard input (expected here)
38197      // 0x0004 - "serdor" // standard input (expected here)
38198      // 0x0008 - "cshdor" // standard input (expected here)
38199      // 0x0010 - "hopdmp" // standard input (expected here)
3820038200INPUT_PORTS_END
3820138201
3820238202// PR1615 AWP DOUGH SELECTA SCORP4         PR1615 DOUGH SELECTA SOUNDS11     DOUGH SELECTA S.SITE
r31373r31374
3822038220}
3822138221
3822238222INPUT_PORTS_START( sc4emmer ) // this structure is generated
38223        PORT_INCLUDE( sc4_base )
38224        PORT_MODIFY("IN-1")
38225        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
38226        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
38227        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
38228        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
38229        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
38230        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
38231        PORT_MODIFY("IN-2")
38232        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
38233        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
38234        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
38235        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38236        PORT_MODIFY("IN-3")
38237        // 0x0004 - "stk3" // standard input (expected here)
38238        // 0x0008 - "stk1" // standard input (expected here)
38239        // 0x0010 - "stk2" // standard input (expected here)
38240        PORT_MODIFY("IN-5")
38241        // 0x0001 - "jp 1" // standard input (expected here)
38242        // 0x0002 - "jp 2" // standard input (expected here)
38243        // 0x0004 - "jp 3" // standard input (expected here)
38244        // 0x0008 - "jp 4" // standard input (expected here)
38245        PORT_MODIFY("IN-6")
38246        // 0x0001 - "pc 1" // standard input (expected here)
38247        // 0x0002 - "pc 2" // standard input (expected here)
38248        // 0x0004 - "pc 3" // standard input (expected here)
38249        // 0x0008 - "pc 4" // standard input (expected here)
38250        PORT_MODIFY("IN-8")
38251        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("lo")
38252        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("hi")
38253        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("step")
38254        PORT_MODIFY("IN-16")
38255        // 0x0001 - "dil 1" // standard input (motherboard)
38256        // 0x0002 - "dil 2" // standard input (motherboard)
38257        // 0x0004 - "dil 3" // standard input (motherboard)
38258        // 0x0008 - "dil 4" // standard input (motherboard)
38259        // 0x0010 - "dil 5" // standard input (motherboard)
38260        // 0x0100 - "top up" // known extended input, usually 'top up'
38261        PORT_MODIFY("IN-17")
38262        // 0x0001 - "dil 6" // standard input (motherboard)
38263        // 0x0002 - "dil 7" // standard input (motherboard)
38264        // 0x0004 - "dil 8" // standard input (motherboard)
38265        // 0x0008 - "dil 9" // standard input (motherboard)
38266        // 0x0010 - "dil10" // standard input (motherboard)
38267        PORT_MODIFY("IN-18")
38268        // 0x0001 - "dil11" // standard input (motherboard)
38269        // 0x0002 - "dil12" // standard input (motherboard)
38270        // 0x0004 - "dil13" // standard input (motherboard)
38271        // 0x0008 - "dil14" // standard input (motherboard)
38272        // 0x0010 - "dil15" // standard input (motherboard)
38273        PORT_MODIFY("IN-19")
38274        // 0x0001 - "dil16" // standard input (motherboard)
38275        PORT_MODIFY("IN-20")
38276        // 0x0001 - "test OR test" // standard input (motherboard)
38277        // 0x0002 - "dorlk" // standard input (expected here)
38278        // 0x0004 - "topdr" // standard input (expected here)
38279        // 0x0008 - "cshbx" // standard input (expected here)
38280        // 0x0010 - "dump" // standard input (expected here)
38223      PORT_INCLUDE( sc4_base )
38224      PORT_MODIFY("IN-1")
38225      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
38226      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
38227      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
38228      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
38229      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
38230      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
38231      PORT_MODIFY("IN-2")
38232      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
38233      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
38234      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
38235      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38236      PORT_MODIFY("IN-3")
38237      // 0x0004 - "stk3" // standard input (expected here)
38238      // 0x0008 - "stk1" // standard input (expected here)
38239      // 0x0010 - "stk2" // standard input (expected here)
38240      PORT_MODIFY("IN-5")
38241      // 0x0001 - "jp 1" // standard input (expected here)
38242      // 0x0002 - "jp 2" // standard input (expected here)
38243      // 0x0004 - "jp 3" // standard input (expected here)
38244      // 0x0008 - "jp 4" // standard input (expected here)
38245      PORT_MODIFY("IN-6")
38246      // 0x0001 - "pc 1" // standard input (expected here)
38247      // 0x0002 - "pc 2" // standard input (expected here)
38248      // 0x0004 - "pc 3" // standard input (expected here)
38249      // 0x0008 - "pc 4" // standard input (expected here)
38250      PORT_MODIFY("IN-8")
38251      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("lo")
38252      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("hi")
38253      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("step")
38254      PORT_MODIFY("IN-16")
38255      // 0x0001 - "dil 1" // standard input (motherboard)
38256      // 0x0002 - "dil 2" // standard input (motherboard)
38257      // 0x0004 - "dil 3" // standard input (motherboard)
38258      // 0x0008 - "dil 4" // standard input (motherboard)
38259      // 0x0010 - "dil 5" // standard input (motherboard)
38260      // 0x0100 - "top up" // known extended input, usually 'top up'
38261      PORT_MODIFY("IN-17")
38262      // 0x0001 - "dil 6" // standard input (motherboard)
38263      // 0x0002 - "dil 7" // standard input (motherboard)
38264      // 0x0004 - "dil 8" // standard input (motherboard)
38265      // 0x0008 - "dil 9" // standard input (motherboard)
38266      // 0x0010 - "dil10" // standard input (motherboard)
38267      PORT_MODIFY("IN-18")
38268      // 0x0001 - "dil11" // standard input (motherboard)
38269      // 0x0002 - "dil12" // standard input (motherboard)
38270      // 0x0004 - "dil13" // standard input (motherboard)
38271      // 0x0008 - "dil14" // standard input (motherboard)
38272      // 0x0010 - "dil15" // standard input (motherboard)
38273      PORT_MODIFY("IN-19")
38274      // 0x0001 - "dil16" // standard input (motherboard)
38275      PORT_MODIFY("IN-20")
38276      // 0x0001 - "test OR test" // standard input (motherboard)
38277      // 0x0002 - "dorlk" // standard input (expected here)
38278      // 0x0004 - "topdr" // standard input (expected here)
38279      // 0x0008 - "cshbx" // standard input (expected here)
38280      // 0x0010 - "dump" // standard input (expected here)
3828138281INPUT_PORTS_END
3828238282
3828338283// PR2313 EMMERDALE         EMMR SOUNDS         EMMERDALE
r31373r31374
3830438304}
3830538305
3830638306INPUT_PORTS_START( sc4evol ) // this structure is generated
38307        PORT_INCLUDE( sc4_base )
38308        PORT_MODIFY("IN-1")
38309        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
38310        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
38311        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
38312        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
38313        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
38314        PORT_MODIFY("IN-2")
38315        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
38316        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
38317        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38318        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38319        PORT_MODIFY("IN-8")
38320        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
38321        PORT_MODIFY("IN-16")
38322        // 0x0001 - "dil 1" // standard input (motherboard)
38323        // 0x0002 - "dil 2" // standard input (motherboard)
38324        // 0x0004 - "dil 3" // standard input (motherboard)
38325        // 0x0008 - "dil 4" // standard input (motherboard)
38326        // 0x0010 - "dil 5" // standard input (motherboard)
38327        // 0x0100 - "topup" // known extended input, usually 'top up'
38328        PORT_MODIFY("IN-17")
38329        // 0x0001 - "dil 6" // standard input (motherboard)
38330        // 0x0002 - "dil 7" // standard input (motherboard)
38331        // 0x0004 - "dil 8" // standard input (motherboard)
38332        // 0x0008 - "dil 9" // standard input (motherboard)
38333        // 0x0010 - "dil10" // standard input (motherboard)
38334        PORT_MODIFY("IN-18")
38335        // 0x0001 - "dil11" // standard input (motherboard)
38336        // 0x0002 - "dil12" // standard input (motherboard)
38337        // 0x0004 - "dil13" // standard input (motherboard)
38338        // 0x0008 - "dil14" // standard input (motherboard)
38339        // 0x0010 - "dil15" // standard input (motherboard)
38340        PORT_MODIFY("IN-19")
38341        // 0x0001 - "dil16" // standard input (motherboard)
38342        PORT_MODIFY("IN-20")
38343        // 0x0001 - "test" // standard input (motherboard)
38344        // 0x0002 - "dorlk" // standard input (expected here)
38345        // 0x0004 - "tpdor" // standard input (expected here)
38346        // 0x0008 - "cshbx" // standard input (expected here)
38347        // 0x0010 - "deflt" // standard input (expected here)
38307      PORT_INCLUDE( sc4_base )
38308      PORT_MODIFY("IN-1")
38309      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
38310      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
38311      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
38312      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
38313      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
38314      PORT_MODIFY("IN-2")
38315      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
38316      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
38317      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38318      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38319      PORT_MODIFY("IN-8")
38320      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
38321      PORT_MODIFY("IN-16")
38322      // 0x0001 - "dil 1" // standard input (motherboard)
38323      // 0x0002 - "dil 2" // standard input (motherboard)
38324      // 0x0004 - "dil 3" // standard input (motherboard)
38325      // 0x0008 - "dil 4" // standard input (motherboard)
38326      // 0x0010 - "dil 5" // standard input (motherboard)
38327      // 0x0100 - "topup" // known extended input, usually 'top up'
38328      PORT_MODIFY("IN-17")
38329      // 0x0001 - "dil 6" // standard input (motherboard)
38330      // 0x0002 - "dil 7" // standard input (motherboard)
38331      // 0x0004 - "dil 8" // standard input (motherboard)
38332      // 0x0008 - "dil 9" // standard input (motherboard)
38333      // 0x0010 - "dil10" // standard input (motherboard)
38334      PORT_MODIFY("IN-18")
38335      // 0x0001 - "dil11" // standard input (motherboard)
38336      // 0x0002 - "dil12" // standard input (motherboard)
38337      // 0x0004 - "dil13" // standard input (motherboard)
38338      // 0x0008 - "dil14" // standard input (motherboard)
38339      // 0x0010 - "dil15" // standard input (motherboard)
38340      PORT_MODIFY("IN-19")
38341      // 0x0001 - "dil16" // standard input (motherboard)
38342      PORT_MODIFY("IN-20")
38343      // 0x0001 - "test" // standard input (motherboard)
38344      // 0x0002 - "dorlk" // standard input (expected here)
38345      // 0x0004 - "tpdor" // standard input (expected here)
38346      // 0x0008 - "cshbx" // standard input (expected here)
38347      // 0x0010 - "deflt" // standard input (expected here)
3834838348INPUT_PORTS_END
3834938349
3835038350// PR2135 EVOLUTION         EVOL SOUNDS         EVOLUTION
r31373r31374
3837438374}
3837538375
3837638376INPUT_PORTS_START( sc4fguy ) // this structure is generated
38377        PORT_INCLUDE( sc4_base )
38378        PORT_MODIFY("IN-1")
38379        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
38380        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38381        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38382        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38383        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
38384        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38385        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38386        PORT_MODIFY("IN-2")
38387        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
38388        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
38389        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38390        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38391        PORT_MODIFY("IN-3")
38392        // 0x0004 - "stk 4" // standard input (expected here)
38393        // 0x0008 - "stk 3" // standard input (expected here)
38394        // 0x0010 - "stk 2" // standard input (expected here)
38395        PORT_MODIFY("IN-5")
38396        // 0x0001 - "priz4" // standard input (expected here)
38397        // 0x0002 - "priz3" // standard input (expected here)
38398        // 0x0004 - "priz2" // standard input (expected here)
38399        // 0x0008 - "priz1" // standard input (expected here)
38400        PORT_MODIFY("IN-6")
38401        // 0x0001 - "perc1" // standard input (expected here)
38402        // 0x0002 - "perc2" // standard input (expected here)
38403        // 0x0004 - "perc3" // standard input (expected here)
38404        // 0x0008 - "perc4" // standard input (expected here)
38405        PORT_MODIFY("IN-8")
38406        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c or b")
38407        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("ply fg")
38408        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("leave")
38409        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take")
38410        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("streak")
38411        PORT_MODIFY("IN-16")
38412        // 0x0001 - "dil1" // standard input (motherboard)
38413        // 0x0002 - "dil2" // standard input (motherboard)
38414        // 0x0004 - "dil3" // standard input (motherboard)
38415        // 0x0008 - "dil4" // standard input (motherboard)
38416        // 0x0010 - "dil5" // standard input (motherboard)
38417        // 0x0100 - "top up" // known extended input, usually 'top up'
38418        PORT_MODIFY("IN-17")
38419        // 0x0001 - "dil6" // standard input (motherboard)
38420        // 0x0002 - "dil7" // standard input (motherboard)
38421        // 0x0004 - "dil8" // standard input (motherboard)
38422        // 0x0008 - "dil9" // standard input (motherboard)
38423        // 0x0010 - "dil10" // standard input (motherboard)
38424        PORT_MODIFY("IN-18")
38425        // 0x0001 - "dil11" // standard input (motherboard)
38426        // 0x0002 - "dil12" // standard input (motherboard)
38427        // 0x0004 - "dil13" // standard input (motherboard)
38428        // 0x0008 - "dil14" // standard input (motherboard)
38429        // 0x0010 - "dil15" // standard input (motherboard)
38430        PORT_MODIFY("IN-19")
38431        // 0x0001 - "dil16" // standard input (motherboard)
38432        PORT_MODIFY("IN-20")
38433        // 0x0001 - "grnbut" // standard input (motherboard)
38434        // 0x0002 - "dorlok" // standard input (expected here)
38435        // 0x0004 - "serdor" // standard input (expected here)
38436        // 0x0008 - "cshdor" // standard input (expected here)
38437        // 0x0010 - "hopdmp" // standard input (expected here)
38377      PORT_INCLUDE( sc4_base )
38378      PORT_MODIFY("IN-1")
38379      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
38380      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38381      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38382      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38383      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
38384      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38385      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38386      PORT_MODIFY("IN-2")
38387      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
38388      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
38389      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38390      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38391      PORT_MODIFY("IN-3")
38392      // 0x0004 - "stk 4" // standard input (expected here)
38393      // 0x0008 - "stk 3" // standard input (expected here)
38394      // 0x0010 - "stk 2" // standard input (expected here)
38395      PORT_MODIFY("IN-5")
38396      // 0x0001 - "priz4" // standard input (expected here)
38397      // 0x0002 - "priz3" // standard input (expected here)
38398      // 0x0004 - "priz2" // standard input (expected here)
38399      // 0x0008 - "priz1" // standard input (expected here)
38400      PORT_MODIFY("IN-6")
38401      // 0x0001 - "perc1" // standard input (expected here)
38402      // 0x0002 - "perc2" // standard input (expected here)
38403      // 0x0004 - "perc3" // standard input (expected here)
38404      // 0x0008 - "perc4" // standard input (expected here)
38405      PORT_MODIFY("IN-8")
38406      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c or b")
38407      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("ply fg")
38408      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("leave")
38409      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take")
38410      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("streak")
38411      PORT_MODIFY("IN-16")
38412      // 0x0001 - "dil1" // standard input (motherboard)
38413      // 0x0002 - "dil2" // standard input (motherboard)
38414      // 0x0004 - "dil3" // standard input (motherboard)
38415      // 0x0008 - "dil4" // standard input (motherboard)
38416      // 0x0010 - "dil5" // standard input (motherboard)
38417      // 0x0100 - "top up" // known extended input, usually 'top up'
38418      PORT_MODIFY("IN-17")
38419      // 0x0001 - "dil6" // standard input (motherboard)
38420      // 0x0002 - "dil7" // standard input (motherboard)
38421      // 0x0004 - "dil8" // standard input (motherboard)
38422      // 0x0008 - "dil9" // standard input (motherboard)
38423      // 0x0010 - "dil10" // standard input (motherboard)
38424      PORT_MODIFY("IN-18")
38425      // 0x0001 - "dil11" // standard input (motherboard)
38426      // 0x0002 - "dil12" // standard input (motherboard)
38427      // 0x0004 - "dil13" // standard input (motherboard)
38428      // 0x0008 - "dil14" // standard input (motherboard)
38429      // 0x0010 - "dil15" // standard input (motherboard)
38430      PORT_MODIFY("IN-19")
38431      // 0x0001 - "dil16" // standard input (motherboard)
38432      PORT_MODIFY("IN-20")
38433      // 0x0001 - "grnbut" // standard input (motherboard)
38434      // 0x0002 - "dorlok" // standard input (expected here)
38435      // 0x0004 - "serdor" // standard input (expected here)
38436      // 0x0008 - "cshdor" // standard input (expected here)
38437      // 0x0010 - "hopdmp" // standard input (expected here)
3843838438INPUT_PORTS_END
3843938439
3844038440INPUT_PORTS_START( sc4fguy35 )
r31373r31374
3847638476}
3847738477
3847838478INPUT_PORTS_START( sc4fbspn ) // this structure is generated
38479        PORT_INCLUDE( sc4_base )
38480        PORT_MODIFY("IN-1")
38481        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR coll")
38482        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38483        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38484        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38485        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
38486        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38487        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38488        PORT_MODIFY("IN-2")
38489        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
38490        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
38491        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38492        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38493        PORT_MODIFY("IN-4")
38494        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
38495        PORT_MODIFY("IN-5")
38496        // 0x0001 - "priz4" // standard input (expected here)
38497        // 0x0002 - "priz3" // standard input (expected here)
38498        // 0x0004 - "priz2" // standard input (expected here)
38499        // 0x0008 - "priz1" // standard input (expected here)
38500        PORT_MODIFY("IN-6")
38501        // 0x0001 - "perc1" // standard input (expected here)
38502        // 0x0002 - "perc2" // standard input (expected here)
38503        // 0x0004 - "perc3" // standard input (expected here)
38504        // 0x0008 - "perc4" // standard input (expected here)
38505        PORT_MODIFY("IN-8")
38506        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("g gutz")
38507        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("g bonu")
38508        PORT_MODIFY("IN-16")
38509        // 0x0001 - "dil1" // standard input (motherboard)
38510        // 0x0002 - "dil2" // standard input (motherboard)
38511        // 0x0004 - "dil3" // standard input (motherboard)
38512        // 0x0008 - "dil4" // standard input (motherboard)
38513        // 0x0010 - "dil5" // standard input (motherboard)
38514        PORT_MODIFY("IN-17")
38515        // 0x0001 - "dil6" // standard input (motherboard)
38516        // 0x0002 - "dil7" // standard input (motherboard)
38517        // 0x0004 - "dil8" // standard input (motherboard)
38518        // 0x0008 - "dil9" // standard input (motherboard)
38519        // 0x0010 - "dil10" // standard input (motherboard)
38520        PORT_MODIFY("IN-18")
38521        // 0x0001 - "dil11" // standard input (motherboard)
38522        // 0x0002 - "dil12" // standard input (motherboard)
38523        // 0x0004 - "dil13" // standard input (motherboard)
38524        // 0x0008 - "dil14" // standard input (motherboard)
38525        // 0x0010 - "dil15" // standard input (motherboard)
38526        PORT_MODIFY("IN-19")
38527        // 0x0001 - "dil16" // standard input (motherboard)
38528        PORT_MODIFY("IN-20")
38529        // 0x0001 - "grnbut" // standard input (motherboard)
38530        // 0x0002 - "dorlok" // standard input (expected here)
38531        // 0x0004 - "serdor" // standard input (expected here)
38532        // 0x0008 - "cshdor" // standard input (expected here)
38533        // 0x0010 - "hopdmp" // standard input (expected here)
38479      PORT_INCLUDE( sc4_base )
38480      PORT_MODIFY("IN-1")
38481      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR coll")
38482      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38483      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38484      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38485      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
38486      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38487      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38488      PORT_MODIFY("IN-2")
38489      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
38490      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
38491      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38492      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38493      PORT_MODIFY("IN-4")
38494      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
38495      PORT_MODIFY("IN-5")
38496      // 0x0001 - "priz4" // standard input (expected here)
38497      // 0x0002 - "priz3" // standard input (expected here)
38498      // 0x0004 - "priz2" // standard input (expected here)
38499      // 0x0008 - "priz1" // standard input (expected here)
38500      PORT_MODIFY("IN-6")
38501      // 0x0001 - "perc1" // standard input (expected here)
38502      // 0x0002 - "perc2" // standard input (expected here)
38503      // 0x0004 - "perc3" // standard input (expected here)
38504      // 0x0008 - "perc4" // standard input (expected here)
38505      PORT_MODIFY("IN-8")
38506      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("g gutz")
38507      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("g bonu")
38508      PORT_MODIFY("IN-16")
38509      // 0x0001 - "dil1" // standard input (motherboard)
38510      // 0x0002 - "dil2" // standard input (motherboard)
38511      // 0x0004 - "dil3" // standard input (motherboard)
38512      // 0x0008 - "dil4" // standard input (motherboard)
38513      // 0x0010 - "dil5" // standard input (motherboard)
38514      PORT_MODIFY("IN-17")
38515      // 0x0001 - "dil6" // standard input (motherboard)
38516      // 0x0002 - "dil7" // standard input (motherboard)
38517      // 0x0004 - "dil8" // standard input (motherboard)
38518      // 0x0008 - "dil9" // standard input (motherboard)
38519      // 0x0010 - "dil10" // standard input (motherboard)
38520      PORT_MODIFY("IN-18")
38521      // 0x0001 - "dil11" // standard input (motherboard)
38522      // 0x0002 - "dil12" // standard input (motherboard)
38523      // 0x0004 - "dil13" // standard input (motherboard)
38524      // 0x0008 - "dil14" // standard input (motherboard)
38525      // 0x0010 - "dil15" // standard input (motherboard)
38526      PORT_MODIFY("IN-19")
38527      // 0x0001 - "dil16" // standard input (motherboard)
38528      PORT_MODIFY("IN-20")
38529      // 0x0001 - "grnbut" // standard input (motherboard)
38530      // 0x0002 - "dorlok" // standard input (expected here)
38531      // 0x0004 - "serdor" // standard input (expected here)
38532      // 0x0008 - "cshdor" // standard input (expected here)
38533      // 0x0010 - "hopdmp" // standard input (expected here)
3853438534INPUT_PORTS_END
3853538535
3853638536// PR1721 AWP FAT BOY SPIN SCORP4         PR1701 FAT BOY SPIN SOUNDS11      FAT BOY SPIN  S.SITE
r31373r31374
3855738557}
3855838558
3855938559INPUT_PORTS_START( sc4fmj ) // this structure is generated
38560        PORT_INCLUDE( sc4_base )
38561        PORT_MODIFY("IN-1")
38562        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
38563        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
38564        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
38565        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
38566        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
38567        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
38568        PORT_MODIFY("IN-2")
38569        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
38570        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
38571        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
38572        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38573        PORT_MODIFY("IN-3")
38574        // 0x0004 - "stk3" // standard input (expected here)
38575        // 0x0008 - "stk1" // standard input (expected here)
38576        // 0x0010 - "stk2" // standard input (expected here)
38577        PORT_MODIFY("IN-5")
38578        // 0x0001 - "jp 1" // standard input (expected here)
38579        // 0x0002 - "jp 2" // standard input (expected here)
38580        // 0x0004 - "jp 3" // standard input (expected here)
38581        // 0x0008 - "jp 4" // standard input (expected here)
38582        PORT_MODIFY("IN-6")
38583        // 0x0001 - "pc 1" // standard input (expected here)
38584        // 0x0002 - "pc 2" // standard input (expected here)
38585        // 0x0004 - "pc 3" // standard input (expected here)
38586        // 0x0008 - "pc 4" // standard input (expected here)
38587        PORT_MODIFY("IN-8")
38588        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk bon")
38589        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
38590        PORT_MODIFY("IN-16")
38591        // 0x0001 - "dil 1" // standard input (motherboard)
38592        // 0x0002 - "dil 2" // standard input (motherboard)
38593        // 0x0004 - "dil 3" // standard input (motherboard)
38594        // 0x0008 - "dil 4" // standard input (motherboard)
38595        // 0x0010 - "dil 5" // standard input (motherboard)
38596        // 0x0100 - "top up" // known extended input, usually 'top up'
38597        PORT_MODIFY("IN-17")
38598        // 0x0001 - "dil 6" // standard input (motherboard)
38599        // 0x0002 - "dil 7" // standard input (motherboard)
38600        // 0x0004 - "dil 8" // standard input (motherboard)
38601        // 0x0008 - "dil 9" // standard input (motherboard)
38602        // 0x0010 - "dil10" // standard input (motherboard)
38603        PORT_MODIFY("IN-18")
38604        // 0x0001 - "dil11" // standard input (motherboard)
38605        // 0x0002 - "dil12" // standard input (motherboard)
38606        // 0x0004 - "dil13" // standard input (motherboard)
38607        // 0x0008 - "dil14" // standard input (motherboard)
38608        // 0x0010 - "dil15" // standard input (motherboard)
38609        PORT_MODIFY("IN-19")
38610        // 0x0001 - "dil16" // standard input (motherboard)
38611        PORT_MODIFY("IN-20")
38612        // 0x0001 - "test OR test" // standard input (motherboard)
38613        // 0x0002 - "dorlk" // standard input (expected here)
38614        // 0x0004 - "topdr" // standard input (expected here)
38615        // 0x0008 - "cshbx" // standard input (expected here)
38616        // 0x0010 - "dump" // standard input (expected here)
38560      PORT_INCLUDE( sc4_base )
38561      PORT_MODIFY("IN-1")
38562      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
38563      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
38564      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
38565      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
38566      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
38567      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
38568      PORT_MODIFY("IN-2")
38569      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
38570      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
38571      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
38572      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38573      PORT_MODIFY("IN-3")
38574      // 0x0004 - "stk3" // standard input (expected here)
38575      // 0x0008 - "stk1" // standard input (expected here)
38576      // 0x0010 - "stk2" // standard input (expected here)
38577      PORT_MODIFY("IN-5")
38578      // 0x0001 - "jp 1" // standard input (expected here)
38579      // 0x0002 - "jp 2" // standard input (expected here)
38580      // 0x0004 - "jp 3" // standard input (expected here)
38581      // 0x0008 - "jp 4" // standard input (expected here)
38582      PORT_MODIFY("IN-6")
38583      // 0x0001 - "pc 1" // standard input (expected here)
38584      // 0x0002 - "pc 2" // standard input (expected here)
38585      // 0x0004 - "pc 3" // standard input (expected here)
38586      // 0x0008 - "pc 4" // standard input (expected here)
38587      PORT_MODIFY("IN-8")
38588      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk bon")
38589      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
38590      PORT_MODIFY("IN-16")
38591      // 0x0001 - "dil 1" // standard input (motherboard)
38592      // 0x0002 - "dil 2" // standard input (motherboard)
38593      // 0x0004 - "dil 3" // standard input (motherboard)
38594      // 0x0008 - "dil 4" // standard input (motherboard)
38595      // 0x0010 - "dil 5" // standard input (motherboard)
38596      // 0x0100 - "top up" // known extended input, usually 'top up'
38597      PORT_MODIFY("IN-17")
38598      // 0x0001 - "dil 6" // standard input (motherboard)
38599      // 0x0002 - "dil 7" // standard input (motherboard)
38600      // 0x0004 - "dil 8" // standard input (motherboard)
38601      // 0x0008 - "dil 9" // standard input (motherboard)
38602      // 0x0010 - "dil10" // standard input (motherboard)
38603      PORT_MODIFY("IN-18")
38604      // 0x0001 - "dil11" // standard input (motherboard)
38605      // 0x0002 - "dil12" // standard input (motherboard)
38606      // 0x0004 - "dil13" // standard input (motherboard)
38607      // 0x0008 - "dil14" // standard input (motherboard)
38608      // 0x0010 - "dil15" // standard input (motherboard)
38609      PORT_MODIFY("IN-19")
38610      // 0x0001 - "dil16" // standard input (motherboard)
38611      PORT_MODIFY("IN-20")
38612      // 0x0001 - "test OR test" // standard input (motherboard)
38613      // 0x0002 - "dorlk" // standard input (expected here)
38614      // 0x0004 - "topdr" // standard input (expected here)
38615      // 0x0008 - "cshbx" // standard input (expected here)
38616      // 0x0010 - "dump" // standard input (expected here)
3861738617INPUT_PORTS_END
3861838618
3861938619// PR2328 FULL METAL JACKPOT         FULLM SOUNDS         F METAL JACKPOT
r31373r31374
3864038640}
3864138641
3864238642INPUT_PORTS_START( sc4gd ) // this structure is generated
38643        PORT_INCLUDE( sc4_base )
38644        PORT_MODIFY("IN-1")
38645        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
38646        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
38647        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
38648        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
38649        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
38650        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38651        PORT_MODIFY("IN-2")
38652        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
38653        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38654        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38655        PORT_MODIFY("IN-3")
38656        // 0x0004 - "stk 4" // standard input (expected here)
38657        // 0x0008 - "stk 3" // standard input (expected here)
38658        // 0x0010 - "stk 2" // standard input (expected here)
38659        PORT_MODIFY("IN-5")
38660        // 0x0001 - "priz4" // standard input (expected here)
38661        // 0x0002 - "priz3" // standard input (expected here)
38662        // 0x0004 - "priz2" // standard input (expected here)
38663        // 0x0008 - "priz1" // standard input (expected here)
38664        PORT_MODIFY("IN-6")
38665        // 0x0001 - "perc1" // standard input (expected here)
38666        // 0x0002 - "perc2" // standard input (expected here)
38667        // 0x0004 - "perc3" // standard input (expected here)
38668        // 0x0008 - "perc4" // standard input (expected here)
38669        PORT_MODIFY("IN-8")
38670        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk haz")
38671        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk ss")
38672        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk nud")
38673        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk sht")
38674        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk fea")
38675        PORT_MODIFY("IN-16")
38676        // 0x0001 - "dil 1" // standard input (motherboard)
38677        // 0x0002 - "dil 2" // standard input (motherboard)
38678        // 0x0004 - "dil 3" // standard input (motherboard)
38679        // 0x0008 - "dil 4" // standard input (motherboard)
38680        // 0x0010 - "dil 5" // standard input (motherboard)
38681        // 0x0100 - "top up" // known extended input, usually 'top up'
38682        PORT_MODIFY("IN-17")
38683        // 0x0001 - "dil 6" // standard input (motherboard)
38684        // 0x0002 - "dil 7" // standard input (motherboard)
38685        // 0x0004 - "dil 8" // standard input (motherboard)
38686        // 0x0008 - "dil 9" // standard input (motherboard)
38687        // 0x0010 - "dil10" // standard input (motherboard)
38688        PORT_MODIFY("IN-18")
38689        // 0x0001 - "dil11" // standard input (motherboard)
38690        // 0x0002 - "dil12" // standard input (motherboard)
38691        // 0x0004 - "dil13" // standard input (motherboard)
38692        // 0x0008 - "dil14" // standard input (motherboard)
38693        // 0x0010 - "dil15" // standard input (motherboard)
38694        PORT_MODIFY("IN-19")
38695        // 0x0001 - "dil16" // standard input (motherboard)
38696        PORT_MODIFY("IN-20")
38697        // 0x0001 - "grnbut" // standard input (motherboard)
38698        // 0x0002 - "dorlok" // standard input (expected here)
38699        // 0x0004 - "topdor" // standard input (expected here)
38700        // 0x0008 - "botdor" // standard input (expected here)
38701        // 0x0010 - "hopdmp" // standard input (expected here)
38643      PORT_INCLUDE( sc4_base )
38644      PORT_MODIFY("IN-1")
38645      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
38646      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
38647      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
38648      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
38649      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
38650      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38651      PORT_MODIFY("IN-2")
38652      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
38653      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38654      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38655      PORT_MODIFY("IN-3")
38656      // 0x0004 - "stk 4" // standard input (expected here)
38657      // 0x0008 - "stk 3" // standard input (expected here)
38658      // 0x0010 - "stk 2" // standard input (expected here)
38659      PORT_MODIFY("IN-5")
38660      // 0x0001 - "priz4" // standard input (expected here)
38661      // 0x0002 - "priz3" // standard input (expected here)
38662      // 0x0004 - "priz2" // standard input (expected here)
38663      // 0x0008 - "priz1" // standard input (expected here)
38664      PORT_MODIFY("IN-6")
38665      // 0x0001 - "perc1" // standard input (expected here)
38666      // 0x0002 - "perc2" // standard input (expected here)
38667      // 0x0004 - "perc3" // standard input (expected here)
38668      // 0x0008 - "perc4" // standard input (expected here)
38669      PORT_MODIFY("IN-8")
38670      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk haz")
38671      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk ss")
38672      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk nud")
38673      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk sht")
38674      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk fea")
38675      PORT_MODIFY("IN-16")
38676      // 0x0001 - "dil 1" // standard input (motherboard)
38677      // 0x0002 - "dil 2" // standard input (motherboard)
38678      // 0x0004 - "dil 3" // standard input (motherboard)
38679      // 0x0008 - "dil 4" // standard input (motherboard)
38680      // 0x0010 - "dil 5" // standard input (motherboard)
38681      // 0x0100 - "top up" // known extended input, usually 'top up'
38682      PORT_MODIFY("IN-17")
38683      // 0x0001 - "dil 6" // standard input (motherboard)
38684      // 0x0002 - "dil 7" // standard input (motherboard)
38685      // 0x0004 - "dil 8" // standard input (motherboard)
38686      // 0x0008 - "dil 9" // standard input (motherboard)
38687      // 0x0010 - "dil10" // standard input (motherboard)
38688      PORT_MODIFY("IN-18")
38689      // 0x0001 - "dil11" // standard input (motherboard)
38690      // 0x0002 - "dil12" // standard input (motherboard)
38691      // 0x0004 - "dil13" // standard input (motherboard)
38692      // 0x0008 - "dil14" // standard input (motherboard)
38693      // 0x0010 - "dil15" // standard input (motherboard)
38694      PORT_MODIFY("IN-19")
38695      // 0x0001 - "dil16" // standard input (motherboard)
38696      PORT_MODIFY("IN-20")
38697      // 0x0001 - "grnbut" // standard input (motherboard)
38698      // 0x0002 - "dorlok" // standard input (expected here)
38699      // 0x0004 - "topdor" // standard input (expected here)
38700      // 0x0008 - "botdor" // standard input (expected here)
38701      // 0x0010 - "hopdmp" // standard input (expected here)
3870238702INPUT_PORTS_END
3870338703
3870438704// PR1016 GOLD DIGGER         PR1016 GOLD DIGGER SOUNDS11
r31373r31374
3872938729
3873038730
3873138731INPUT_PORTS_START( sc4gdclb ) // this structure is generated
38732        PORT_INCLUDE( sc4_base )
38733        PORT_MODIFY("IN-1")
38734        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
38735        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
38736        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
38737        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
38738        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
38739        PORT_MODIFY("IN-2")
38740        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
38741        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
38742        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38743        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38744        PORT_MODIFY("IN-3")
38745        // 0x0004 - "stk 4" // standard input (expected here)
38746        // 0x0008 - "stk 3" // standard input (expected here)
38747        // 0x0010 - "stk 2" // standard input (expected here)
38748        PORT_MODIFY("IN-4")
38749        // 0x0001 - "hop2lo" // unexpected here
38750        // 0x0002 - "hop1lo OR hop lo" // known extended(?) input, sometimes 'hop hi'
38751        PORT_MODIFY("IN-5")
38752        // 0x0001 - "priz4" // standard input (expected here)
38753        // 0x0002 - "priz3" // standard input (expected here)
38754        // 0x0004 - "priz2" // standard input (expected here)
38755        // 0x0008 - "priz1" // standard input (expected here)
38756        PORT_MODIFY("IN-16")
38757        // 0x0001 - "dil 1" // standard input (motherboard)
38758        // 0x0002 - "dil 2" // standard input (motherboard)
38759        // 0x0004 - "dil 3" // standard input (motherboard)
38760        // 0x0008 - "dil 4" // standard input (motherboard)
38761        // 0x0010 - "dil 5" // standard input (motherboard)
38762        // 0x0100 - "top up" // known extended input, usually 'top up'
38763        PORT_MODIFY("IN-17")
38764        // 0x0001 - "dil 6" // standard input (motherboard)
38765        // 0x0002 - "dil 7" // standard input (motherboard)
38766        // 0x0004 - "dil 8" // standard input (motherboard)
38767        // 0x0008 - "dil 9" // standard input (motherboard)
38768        // 0x0010 - "dil10" // standard input (motherboard)
38769        PORT_MODIFY("IN-18")
38770        // 0x0001 - "dil11" // standard input (motherboard)
38771        // 0x0002 - "dil12" // standard input (motherboard)
38772        // 0x0004 - "dil13" // standard input (motherboard)
38773        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
38774        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
38775        PORT_MODIFY("IN-19")
38776        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
38777        PORT_MODIFY("IN-20")
38778        // 0x0001 - "grnbut" // standard input (motherboard)
38779        // 0x0002 - "dorlok" // standard input (expected here)
38780        // 0x0004 - "topdor" // standard input (expected here)
38781        // 0x0008 - "botdor" // standard input (expected here)
38782        // 0x0010 - "hopdmp" // standard input (expected here)
38732      PORT_INCLUDE( sc4_base )
38733      PORT_MODIFY("IN-1")
38734      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
38735      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
38736      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
38737      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
38738      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
38739      PORT_MODIFY("IN-2")
38740      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
38741      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
38742      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38743      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38744      PORT_MODIFY("IN-3")
38745      // 0x0004 - "stk 4" // standard input (expected here)
38746      // 0x0008 - "stk 3" // standard input (expected here)
38747      // 0x0010 - "stk 2" // standard input (expected here)
38748      PORT_MODIFY("IN-4")
38749      // 0x0001 - "hop2lo" // unexpected here
38750      // 0x0002 - "hop1lo OR hop lo" // known extended(?) input, sometimes 'hop hi'
38751      PORT_MODIFY("IN-5")
38752      // 0x0001 - "priz4" // standard input (expected here)
38753      // 0x0002 - "priz3" // standard input (expected here)
38754      // 0x0004 - "priz2" // standard input (expected here)
38755      // 0x0008 - "priz1" // standard input (expected here)
38756      PORT_MODIFY("IN-16")
38757      // 0x0001 - "dil 1" // standard input (motherboard)
38758      // 0x0002 - "dil 2" // standard input (motherboard)
38759      // 0x0004 - "dil 3" // standard input (motherboard)
38760      // 0x0008 - "dil 4" // standard input (motherboard)
38761      // 0x0010 - "dil 5" // standard input (motherboard)
38762      // 0x0100 - "top up" // known extended input, usually 'top up'
38763      PORT_MODIFY("IN-17")
38764      // 0x0001 - "dil 6" // standard input (motherboard)
38765      // 0x0002 - "dil 7" // standard input (motherboard)
38766      // 0x0004 - "dil 8" // standard input (motherboard)
38767      // 0x0008 - "dil 9" // standard input (motherboard)
38768      // 0x0010 - "dil10" // standard input (motherboard)
38769      PORT_MODIFY("IN-18")
38770      // 0x0001 - "dil11" // standard input (motherboard)
38771      // 0x0002 - "dil12" // standard input (motherboard)
38772      // 0x0004 - "dil13" // standard input (motherboard)
38773      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
38774      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
38775      PORT_MODIFY("IN-19")
38776      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
38777      PORT_MODIFY("IN-20")
38778      // 0x0001 - "grnbut" // standard input (motherboard)
38779      // 0x0002 - "dorlok" // standard input (expected here)
38780      // 0x0004 - "topdor" // standard input (expected here)
38781      // 0x0008 - "botdor" // standard input (expected here)
38782      // 0x0010 - "hopdmp" // standard input (expected here)
3878338783INPUT_PORTS_END
3878438784
3878538785// PR1137 CLUB GOLD DIGGER         PR1137 GOLDD CL SOUNDS11
r31373r31374
3881338813}
3881438814
3881538815INPUT_PORTS_START( sc4gball ) // this structure is generated
38816        PORT_INCLUDE( sc4_base )
38817        PORT_MODIFY("IN-1")
38818        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
38819        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38820        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38821        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38822        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
38823        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38824        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38825        PORT_MODIFY("IN-2")
38826        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
38827        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
38828        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38829        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38830        PORT_MODIFY("IN-3")
38831        // 0x0004 - "stk 4" // standard input (expected here)
38832        // 0x0008 - "stk 2" // standard input (expected here)
38833        // 0x0010 - "stk 3" // standard input (expected here)
38834        PORT_MODIFY("IN-4")
38835        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
38836        PORT_MODIFY("IN-5")
38837        // 0x0001 - "priz4" // standard input (expected here)
38838        // 0x0002 - "priz3" // standard input (expected here)
38839        // 0x0004 - "priz2" // standard input (expected here)
38840        // 0x0008 - "priz1" // standard input (expected here)
38841        PORT_MODIFY("IN-6")
38842        // 0x0001 - "perc1" // standard input (expected here)
38843        // 0x0002 - "perc2" // standard input (expected here)
38844        // 0x0004 - "perc3" // standard input (expected here)
38845        // 0x0008 - "perc4" // standard input (expected here)
38846        PORT_MODIFY("IN-16")
38847        // 0x0001 - "dil1" // standard input (motherboard)
38848        // 0x0002 - "dil2" // standard input (motherboard)
38849        // 0x0004 - "dil3" // standard input (motherboard)
38850        // 0x0008 - "dil4" // standard input (motherboard)
38851        // 0x0010 - "dil5" // standard input (motherboard)
38852        PORT_MODIFY("IN-17")
38853        // 0x0001 - "dil6" // standard input (motherboard)
38854        // 0x0002 - "dil7" // standard input (motherboard)
38855        // 0x0004 - "dil8" // standard input (motherboard)
38856        // 0x0008 - "dil9" // standard input (motherboard)
38857        // 0x0010 - "dil10" // standard input (motherboard)
38858        PORT_MODIFY("IN-18")
38859        // 0x0001 - "dil11" // standard input (motherboard)
38860        // 0x0002 - "dil12" // standard input (motherboard)
38861        // 0x0004 - "dil13" // standard input (motherboard)
38862        // 0x0008 - "dil14" // standard input (motherboard)
38863        // 0x0010 - "dil15" // standard input (motherboard)
38864        PORT_MODIFY("IN-19")
38865        // 0x0001 - "dil16" // standard input (motherboard)
38866        PORT_MODIFY("IN-20")
38867        // 0x0001 - "grnbut" // standard input (motherboard)
38868        // 0x0002 - "dorlok" // standard input (expected here)
38869        // 0x0004 - "serdor" // standard input (expected here)
38870        // 0x0008 - "cshdor" // standard input (expected here)
38871        // 0x0010 - "hopdmp" // standard input (expected here)
38816      PORT_INCLUDE( sc4_base )
38817      PORT_MODIFY("IN-1")
38818      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
38819      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38820      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38821      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38822      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
38823      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38824      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38825      PORT_MODIFY("IN-2")
38826      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
38827      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
38828      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38829      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38830      PORT_MODIFY("IN-3")
38831      // 0x0004 - "stk 4" // standard input (expected here)
38832      // 0x0008 - "stk 2" // standard input (expected here)
38833      // 0x0010 - "stk 3" // standard input (expected here)
38834      PORT_MODIFY("IN-4")
38835      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
38836      PORT_MODIFY("IN-5")
38837      // 0x0001 - "priz4" // standard input (expected here)
38838      // 0x0002 - "priz3" // standard input (expected here)
38839      // 0x0004 - "priz2" // standard input (expected here)
38840      // 0x0008 - "priz1" // standard input (expected here)
38841      PORT_MODIFY("IN-6")
38842      // 0x0001 - "perc1" // standard input (expected here)
38843      // 0x0002 - "perc2" // standard input (expected here)
38844      // 0x0004 - "perc3" // standard input (expected here)
38845      // 0x0008 - "perc4" // standard input (expected here)
38846      PORT_MODIFY("IN-16")
38847      // 0x0001 - "dil1" // standard input (motherboard)
38848      // 0x0002 - "dil2" // standard input (motherboard)
38849      // 0x0004 - "dil3" // standard input (motherboard)
38850      // 0x0008 - "dil4" // standard input (motherboard)
38851      // 0x0010 - "dil5" // standard input (motherboard)
38852      PORT_MODIFY("IN-17")
38853      // 0x0001 - "dil6" // standard input (motherboard)
38854      // 0x0002 - "dil7" // standard input (motherboard)
38855      // 0x0004 - "dil8" // standard input (motherboard)
38856      // 0x0008 - "dil9" // standard input (motherboard)
38857      // 0x0010 - "dil10" // standard input (motherboard)
38858      PORT_MODIFY("IN-18")
38859      // 0x0001 - "dil11" // standard input (motherboard)
38860      // 0x0002 - "dil12" // standard input (motherboard)
38861      // 0x0004 - "dil13" // standard input (motherboard)
38862      // 0x0008 - "dil14" // standard input (motherboard)
38863      // 0x0010 - "dil15" // standard input (motherboard)
38864      PORT_MODIFY("IN-19")
38865      // 0x0001 - "dil16" // standard input (motherboard)
38866      PORT_MODIFY("IN-20")
38867      // 0x0001 - "grnbut" // standard input (motherboard)
38868      // 0x0002 - "dorlok" // standard input (expected here)
38869      // 0x0004 - "serdor" // standard input (expected here)
38870      // 0x0008 - "cshdor" // standard input (expected here)
38871      // 0x0010 - "hopdmp" // standard input (expected here)
3887238872INPUT_PORTS_END
3887338873
3887438874// this is a football themed game... completely different to golden balls casino
r31373r31374
3889538895}
3889638896
3889738897INPUT_PORTS_START( sc4gunp ) // this structure is generated
38898        PORT_INCLUDE( sc4_base )
38899        PORT_MODIFY("IN-1")
38900        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
38901        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38902        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38903        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38904        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
38905        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38906        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38907        PORT_MODIFY("IN-2")
38908        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
38909        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
38910        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38911        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38912        PORT_MODIFY("IN-3")
38913        // 0x0004 - "stk 4" // standard input (expected here)
38914        // 0x0008 - "stk 3" // standard input (expected here)
38915        // 0x0010 - "stk 2" // standard input (expected here)
38916        PORT_MODIFY("IN-5")
38917        // 0x0001 - "priz4" // standard input (expected here)
38918        // 0x0002 - "priz3" // standard input (expected here)
38919        // 0x0004 - "priz2" // standard input (expected here)
38920        // 0x0008 - "priz1" // standard input (expected here)
38921        PORT_MODIFY("IN-6")
38922        // 0x0001 - "perc1" // standard input (expected here)
38923        // 0x0002 - "perc2" // standard input (expected here)
38924        // 0x0004 - "perc3" // standard input (expected here)
38925        // 0x0008 - "perc4" // standard input (expected here)
38926        PORT_MODIFY("IN-8")
38927        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("do/die")
38928        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("sp d/d")
38929        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bns")
38930        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("s mess")
38931        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk str")
38932        PORT_MODIFY("IN-16")
38933        // 0x0001 - "dil1" // standard input (motherboard)
38934        // 0x0002 - "dil2" // standard input (motherboard)
38935        // 0x0004 - "dil3" // standard input (motherboard)
38936        // 0x0008 - "dil4" // standard input (motherboard)
38937        // 0x0010 - "dil5" // standard input (motherboard)
38938        // 0x0100 - "top up" // known extended input, usually 'top up'
38939        PORT_MODIFY("IN-17")
38940        // 0x0001 - "dil6" // standard input (motherboard)
38941        // 0x0002 - "dil7" // standard input (motherboard)
38942        // 0x0004 - "dil8" // standard input (motherboard)
38943        // 0x0008 - "dil9" // standard input (motherboard)
38944        // 0x0010 - "dil10" // standard input (motherboard)
38945        PORT_MODIFY("IN-18")
38946        // 0x0001 - "dil11" // standard input (motherboard)
38947        // 0x0002 - "dil12" // standard input (motherboard)
38948        // 0x0004 - "dil13" // standard input (motherboard)
38949        // 0x0008 - "dil14" // standard input (motherboard)
38950        // 0x0010 - "dil15" // standard input (motherboard)
38951        PORT_MODIFY("IN-19")
38952        // 0x0001 - "dil16" // standard input (motherboard)
38953        PORT_MODIFY("IN-20")
38954        // 0x0001 - "grnbut" // standard input (motherboard)
38955        // 0x0002 - "dorlok" // standard input (expected here)
38956        // 0x0004 - "serdor" // standard input (expected here)
38957        // 0x0008 - "cshdor" // standard input (expected here)
38958        // 0x0010 - "hopdmp" // standard input (expected here)
38898      PORT_INCLUDE( sc4_base )
38899      PORT_MODIFY("IN-1")
38900      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
38901      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38902      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38903      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38904      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
38905      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38906      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
38907      PORT_MODIFY("IN-2")
38908      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
38909      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
38910      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38911      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
38912      PORT_MODIFY("IN-3")
38913      // 0x0004 - "stk 4" // standard input (expected here)
38914      // 0x0008 - "stk 3" // standard input (expected here)
38915      // 0x0010 - "stk 2" // standard input (expected here)
38916      PORT_MODIFY("IN-5")
38917      // 0x0001 - "priz4" // standard input (expected here)
38918      // 0x0002 - "priz3" // standard input (expected here)
38919      // 0x0004 - "priz2" // standard input (expected here)
38920      // 0x0008 - "priz1" // standard input (expected here)
38921      PORT_MODIFY("IN-6")
38922      // 0x0001 - "perc1" // standard input (expected here)
38923      // 0x0002 - "perc2" // standard input (expected here)
38924      // 0x0004 - "perc3" // standard input (expected here)
38925      // 0x0008 - "perc4" // standard input (expected here)
38926      PORT_MODIFY("IN-8")
38927      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("do/die")
38928      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("sp d/d")
38929      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bns")
38930      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("s mess")
38931      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk str")
38932      PORT_MODIFY("IN-16")
38933      // 0x0001 - "dil1" // standard input (motherboard)
38934      // 0x0002 - "dil2" // standard input (motherboard)
38935      // 0x0004 - "dil3" // standard input (motherboard)
38936      // 0x0008 - "dil4" // standard input (motherboard)
38937      // 0x0010 - "dil5" // standard input (motherboard)
38938      // 0x0100 - "top up" // known extended input, usually 'top up'
38939      PORT_MODIFY("IN-17")
38940      // 0x0001 - "dil6" // standard input (motherboard)
38941      // 0x0002 - "dil7" // standard input (motherboard)
38942      // 0x0004 - "dil8" // standard input (motherboard)
38943      // 0x0008 - "dil9" // standard input (motherboard)
38944      // 0x0010 - "dil10" // standard input (motherboard)
38945      PORT_MODIFY("IN-18")
38946      // 0x0001 - "dil11" // standard input (motherboard)
38947      // 0x0002 - "dil12" // standard input (motherboard)
38948      // 0x0004 - "dil13" // standard input (motherboard)
38949      // 0x0008 - "dil14" // standard input (motherboard)
38950      // 0x0010 - "dil15" // standard input (motherboard)
38951      PORT_MODIFY("IN-19")
38952      // 0x0001 - "dil16" // standard input (motherboard)
38953      PORT_MODIFY("IN-20")
38954      // 0x0001 - "grnbut" // standard input (motherboard)
38955      // 0x0002 - "dorlok" // standard input (expected here)
38956      // 0x0004 - "serdor" // standard input (expected here)
38957      // 0x0008 - "cshdor" // standard input (expected here)
38958      // 0x0010 - "hopdmp" // standard input (expected here)
3895938959INPUT_PORTS_END
3896038960
3896138961// PR3046 AWP THE GUNPOWDER SLOT S4         PR3016 GUNPOWDER SLOT SOUNDS11    GUNPOWDER SLOT  S.SITE
r31373r31374
3898538985}
3898638986
3898738987INPUT_PORTS_START( sc4hapnt ) // this structure is generated
38988        PORT_INCLUDE( sc4_base )
38989        PORT_MODIFY("IN-1")
38990        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
38991        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38992        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38993        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38994        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
38995        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38996        PORT_MODIFY("IN-2")
38997        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
38998        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38999        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39000        PORT_MODIFY("IN-4")
39001        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
39002        PORT_MODIFY("IN-5")
39003        // 0x0001 - "priz4" // standard input (expected here)
39004        // 0x0002 - "priz3" // standard input (expected here)
39005        // 0x0004 - "priz2" // standard input (expected here)
39006        // 0x0008 - "priz1" // standard input (expected here)
39007        PORT_MODIFY("IN-6")
39008        // 0x0001 - "perc1" // standard input (expected here)
39009        // 0x0002 - "perc2" // standard input (expected here)
39010        // 0x0004 - "perc3" // standard input (expected here)
39011        // 0x0008 - "perc4" // standard input (expected here)
39012        PORT_MODIFY("IN-8")
39013        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk not")
39014        PORT_MODIFY("IN-16")
39015        // 0x0001 - "dil 1" // standard input (motherboard)
39016        // 0x0002 - "dil 2" // standard input (motherboard)
39017        // 0x0004 - "dil 3" // standard input (motherboard)
39018        // 0x0008 - "dil 4" // standard input (motherboard)
39019        // 0x0010 - "dil 5" // standard input (motherboard)
39020        // 0x0100 - "htopup" // known extended input, usually 'top up'
39021        PORT_MODIFY("IN-17")
39022        // 0x0001 - "dil 6" // standard input (motherboard)
39023        // 0x0002 - "dil 7" // standard input (motherboard)
39024        // 0x0004 - "dil 8" // standard input (motherboard)
39025        // 0x0008 - "dil 9" // standard input (motherboard)
39026        // 0x0010 - "dil 10" // standard input (motherboard)
39027        PORT_MODIFY("IN-18")
39028        // 0x0001 - "dil 11" // standard input (motherboard)
39029        // 0x0002 - "dil 12" // standard input (motherboard)
39030        // 0x0004 - "dil 13" // standard input (motherboard)
39031        // 0x0008 - "dil 14" // standard input (motherboard)
39032        // 0x0010 - "dil 15" // standard input (motherboard)
39033        PORT_MODIFY("IN-19")
39034        // 0x0001 - "dil 16" // standard input (motherboard)
39035        PORT_MODIFY("IN-20")
39036        // 0x0001 - "grnbut" // standard input (motherboard)
39037        // 0x0002 - "dorlok" // standard input (expected here)
39038        // 0x0004 - "serdor" // standard input (expected here)
39039        // 0x0008 - "cshdor" // standard input (expected here)
39040        // 0x0010 - "hopdmp" // standard input (expected here)
38988      PORT_INCLUDE( sc4_base )
38989      PORT_MODIFY("IN-1")
38990      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
38991      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
38992      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
38993      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
38994      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
38995      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
38996      PORT_MODIFY("IN-2")
38997      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
38998      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
38999      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39000      PORT_MODIFY("IN-4")
39001      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
39002      PORT_MODIFY("IN-5")
39003      // 0x0001 - "priz4" // standard input (expected here)
39004      // 0x0002 - "priz3" // standard input (expected here)
39005      // 0x0004 - "priz2" // standard input (expected here)
39006      // 0x0008 - "priz1" // standard input (expected here)
39007      PORT_MODIFY("IN-6")
39008      // 0x0001 - "perc1" // standard input (expected here)
39009      // 0x0002 - "perc2" // standard input (expected here)
39010      // 0x0004 - "perc3" // standard input (expected here)
39011      // 0x0008 - "perc4" // standard input (expected here)
39012      PORT_MODIFY("IN-8")
39013      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk not")
39014      PORT_MODIFY("IN-16")
39015      // 0x0001 - "dil 1" // standard input (motherboard)
39016      // 0x0002 - "dil 2" // standard input (motherboard)
39017      // 0x0004 - "dil 3" // standard input (motherboard)
39018      // 0x0008 - "dil 4" // standard input (motherboard)
39019      // 0x0010 - "dil 5" // standard input (motherboard)
39020      // 0x0100 - "htopup" // known extended input, usually 'top up'
39021      PORT_MODIFY("IN-17")
39022      // 0x0001 - "dil 6" // standard input (motherboard)
39023      // 0x0002 - "dil 7" // standard input (motherboard)
39024      // 0x0004 - "dil 8" // standard input (motherboard)
39025      // 0x0008 - "dil 9" // standard input (motherboard)
39026      // 0x0010 - "dil 10" // standard input (motherboard)
39027      PORT_MODIFY("IN-18")
39028      // 0x0001 - "dil 11" // standard input (motherboard)
39029      // 0x0002 - "dil 12" // standard input (motherboard)
39030      // 0x0004 - "dil 13" // standard input (motherboard)
39031      // 0x0008 - "dil 14" // standard input (motherboard)
39032      // 0x0010 - "dil 15" // standard input (motherboard)
39033      PORT_MODIFY("IN-19")
39034      // 0x0001 - "dil 16" // standard input (motherboard)
39035      PORT_MODIFY("IN-20")
39036      // 0x0001 - "grnbut" // standard input (motherboard)
39037      // 0x0002 - "dorlok" // standard input (expected here)
39038      // 0x0004 - "serdor" // standard input (expected here)
39039      // 0x0008 - "cshdor" // standard input (expected here)
39040      // 0x0010 - "hopdmp" // standard input (expected here)
3904139041INPUT_PORTS_END
3904239042
3904339043// PR1306 AWP HAPPY NOTES         PR1306 HAPPY NOTES SOUNDS11
r31373r31374
3905039050
3905139051
3905239052INPUT_PORTS_START( sc4hellb ) // this structure is generated
39053        PORT_INCLUDE( sc4_base )
39054        PORT_MODIFY("IN-1")
39055        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39056        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
39057        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
39058        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
39059        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
39060        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39061        PORT_MODIFY("IN-2")
39062        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
39063        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39064        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39065        PORT_MODIFY("IN-3")
39066        // 0x0004 - "stk 4" // standard input (expected here)
39067        // 0x0008 - "stk 3" // standard input (expected here)
39068        // 0x0010 - "stk 2" // standard input (expected here)
39069        PORT_MODIFY("IN-5")
39070        // 0x0001 - "priz4" // standard input (expected here)
39071        // 0x0002 - "priz3" // standard input (expected here)
39072        // 0x0004 - "priz2" // standard input (expected here)
39073        // 0x0008 - "priz1" // standard input (expected here)
39074        PORT_MODIFY("IN-6")
39075        // 0x0001 - "perc1" // standard input (expected here)
39076        // 0x0002 - "perc2" // standard input (expected here)
39077        // 0x0004 - "perc3" // standard input (expected here)
39078        // 0x0008 - "perc4" // standard input (expected here)
39079        PORT_MODIFY("IN-8")
39080        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
39081        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shoot")
39082        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spins")
39083        PORT_MODIFY("IN-16")
39084        // 0x0001 - "dil 1" // standard input (motherboard)
39085        // 0x0002 - "dil 2" // standard input (motherboard)
39086        // 0x0004 - "dil 3" // standard input (motherboard)
39087        // 0x0008 - "dil 4" // standard input (motherboard)
39088        // 0x0010 - "dil 5" // standard input (motherboard)
39089        PORT_MODIFY("IN-17")
39090        // 0x0001 - "dil 6" // standard input (motherboard)
39091        // 0x0002 - "dil 7" // standard input (motherboard)
39092        // 0x0004 - "dil 8" // standard input (motherboard)
39093        // 0x0008 - "dil 9" // standard input (motherboard)
39094        // 0x0010 - "dil 10" // standard input (motherboard)
39095        PORT_MODIFY("IN-18")
39096        // 0x0001 - "dil 11" // standard input (motherboard)
39097        // 0x0002 - "dil 12" // standard input (motherboard)
39098        // 0x0004 - "dil 13" // standard input (motherboard)
39099        // 0x0008 - "dil 14" // standard input (motherboard)
39100        // 0x0010 - "dil 15" // standard input (motherboard)
39101        PORT_MODIFY("IN-19")
39102        // 0x0001 - "dil 16" // standard input (motherboard)
39103        PORT_MODIFY("IN-20")
39104        // 0x0001 - "grnbut" // standard input (motherboard)
39105        // 0x0002 - "dorlok" // standard input (expected here)
39106        // 0x0004 - "serdor" // standard input (expected here)
39107        // 0x0008 - "cshdor" // standard input (expected here)
39108        // 0x0010 - "hopdmp" // standard input (expected here)
39053      PORT_INCLUDE( sc4_base )
39054      PORT_MODIFY("IN-1")
39055      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39056      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
39057      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
39058      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
39059      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
39060      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39061      PORT_MODIFY("IN-2")
39062      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
39063      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39064      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39065      PORT_MODIFY("IN-3")
39066      // 0x0004 - "stk 4" // standard input (expected here)
39067      // 0x0008 - "stk 3" // standard input (expected here)
39068      // 0x0010 - "stk 2" // standard input (expected here)
39069      PORT_MODIFY("IN-5")
39070      // 0x0001 - "priz4" // standard input (expected here)
39071      // 0x0002 - "priz3" // standard input (expected here)
39072      // 0x0004 - "priz2" // standard input (expected here)
39073      // 0x0008 - "priz1" // standard input (expected here)
39074      PORT_MODIFY("IN-6")
39075      // 0x0001 - "perc1" // standard input (expected here)
39076      // 0x0002 - "perc2" // standard input (expected here)
39077      // 0x0004 - "perc3" // standard input (expected here)
39078      // 0x0008 - "perc4" // standard input (expected here)
39079      PORT_MODIFY("IN-8")
39080      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
39081      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shoot")
39082      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spins")
39083      PORT_MODIFY("IN-16")
39084      // 0x0001 - "dil 1" // standard input (motherboard)
39085      // 0x0002 - "dil 2" // standard input (motherboard)
39086      // 0x0004 - "dil 3" // standard input (motherboard)
39087      // 0x0008 - "dil 4" // standard input (motherboard)
39088      // 0x0010 - "dil 5" // standard input (motherboard)
39089      PORT_MODIFY("IN-17")
39090      // 0x0001 - "dil 6" // standard input (motherboard)
39091      // 0x0002 - "dil 7" // standard input (motherboard)
39092      // 0x0004 - "dil 8" // standard input (motherboard)
39093      // 0x0008 - "dil 9" // standard input (motherboard)
39094      // 0x0010 - "dil 10" // standard input (motherboard)
39095      PORT_MODIFY("IN-18")
39096      // 0x0001 - "dil 11" // standard input (motherboard)
39097      // 0x0002 - "dil 12" // standard input (motherboard)
39098      // 0x0004 - "dil 13" // standard input (motherboard)
39099      // 0x0008 - "dil 14" // standard input (motherboard)
39100      // 0x0010 - "dil 15" // standard input (motherboard)
39101      PORT_MODIFY("IN-19")
39102      // 0x0001 - "dil 16" // standard input (motherboard)
39103      PORT_MODIFY("IN-20")
39104      // 0x0001 - "grnbut" // standard input (motherboard)
39105      // 0x0002 - "dorlok" // standard input (expected here)
39106      // 0x0004 - "serdor" // standard input (expected here)
39107      // 0x0008 - "cshdor" // standard input (expected here)
39108      // 0x0010 - "hopdmp" // standard input (expected here)
3910939109INPUT_PORTS_END
3911039110
3911139111// PR1419 AWP HELLS BELLS         PR1402 HELLS BELLS SOUNDS11
r31373r31374
3913939139}
3914039140
3914139141INPUT_PORTS_START( sc4hill ) // this structure is generated
39142        PORT_INCLUDE( sc4_base )
39143        PORT_MODIFY("IN-1")
39144        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR coll")
39145        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
39146        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
39147        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
39148        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
39149        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39150        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39151        PORT_MODIFY("IN-2")
39152        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
39153        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
39154        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39155        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39156        PORT_MODIFY("IN-3")
39157        // 0x0004 - "stk 4" // standard input (expected here)
39158        // 0x0008 - "stk 3" // standard input (expected here)
39159        // 0x0010 - "stk 2" // standard input (expected here)
39160        PORT_MODIFY("IN-4")
39161        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
39162        PORT_MODIFY("IN-5")
39163        // 0x0001 - "priz4" // standard input (expected here)
39164        // 0x0002 - "priz3" // standard input (expected here)
39165        // 0x0004 - "priz2" // standard input (expected here)
39166        // 0x0008 - "priz1" // standard input (expected here)
39167        PORT_MODIFY("IN-6")
39168        // 0x0001 - "perc1" // standard input (expected here)
39169        // 0x0002 - "perc2" // standard input (expected here)
39170        // 0x0004 - "perc3" // standard input (expected here)
39171        // 0x0008 - "perc4" // standard input (expected here)
39172        PORT_MODIFY("IN-8")
39173        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkstep")
39174        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lorght")
39175        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lomid")
39176        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("loleft")
39177        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hirght")
39178        PORT_MODIFY("IN-9")
39179        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("himid")
39180        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hileft")
39181        PORT_MODIFY("IN-16")
39182        // 0x0001 - "dil1" // standard input (motherboard)
39183        // 0x0002 - "dil2" // standard input (motherboard)
39184        // 0x0004 - "dil3" // standard input (motherboard)
39185        // 0x0008 - "dil4" // standard input (motherboard)
39186        // 0x0010 - "dil5" // standard input (motherboard)
39187        PORT_MODIFY("IN-17")
39188        // 0x0001 - "dil6" // standard input (motherboard)
39189        // 0x0002 - "dil7" // standard input (motherboard)
39190        // 0x0004 - "dil8" // standard input (motherboard)
39191        // 0x0008 - "dil9" // standard input (motherboard)
39192        // 0x0010 - "dil10" // standard input (motherboard)
39193        PORT_MODIFY("IN-18")
39194        // 0x0001 - "dil11" // standard input (motherboard)
39195        // 0x0002 - "dil12" // standard input (motherboard)
39196        // 0x0004 - "dil13" // standard input (motherboard)
39197        // 0x0008 - "dil14" // standard input (motherboard)
39198        // 0x0010 - "dil15" // standard input (motherboard)
39199        PORT_MODIFY("IN-19")
39200        // 0x0001 - "dil16" // standard input (motherboard)
39201        PORT_MODIFY("IN-20")
39202        // 0x0001 - "grnbut" // standard input (motherboard)
39203        // 0x0002 - "dorlok" // standard input (expected here)
39204        // 0x0004 - "serdor" // standard input (expected here)
39205        // 0x0008 - "cshdor" // standard input (expected here)
39206        // 0x0010 - "hopdmp" // standard input (expected here)
39142      PORT_INCLUDE( sc4_base )
39143      PORT_MODIFY("IN-1")
39144      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR coll")
39145      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
39146      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
39147      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
39148      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
39149      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39150      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39151      PORT_MODIFY("IN-2")
39152      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
39153      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
39154      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39155      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39156      PORT_MODIFY("IN-3")
39157      // 0x0004 - "stk 4" // standard input (expected here)
39158      // 0x0008 - "stk 3" // standard input (expected here)
39159      // 0x0010 - "stk 2" // standard input (expected here)
39160      PORT_MODIFY("IN-4")
39161      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
39162      PORT_MODIFY("IN-5")
39163      // 0x0001 - "priz4" // standard input (expected here)
39164      // 0x0002 - "priz3" // standard input (expected here)
39165      // 0x0004 - "priz2" // standard input (expected here)
39166      // 0x0008 - "priz1" // standard input (expected here)
39167      PORT_MODIFY("IN-6")
39168      // 0x0001 - "perc1" // standard input (expected here)
39169      // 0x0002 - "perc2" // standard input (expected here)
39170      // 0x0004 - "perc3" // standard input (expected here)
39171      // 0x0008 - "perc4" // standard input (expected here)
39172      PORT_MODIFY("IN-8")
39173      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkstep")
39174      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lorght")
39175      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lomid")
39176      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("loleft")
39177      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hirght")
39178      PORT_MODIFY("IN-9")
39179      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("himid")
39180      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hileft")
39181      PORT_MODIFY("IN-16")
39182      // 0x0001 - "dil1" // standard input (motherboard)
39183      // 0x0002 - "dil2" // standard input (motherboard)
39184      // 0x0004 - "dil3" // standard input (motherboard)
39185      // 0x0008 - "dil4" // standard input (motherboard)
39186      // 0x0010 - "dil5" // standard input (motherboard)
39187      PORT_MODIFY("IN-17")
39188      // 0x0001 - "dil6" // standard input (motherboard)
39189      // 0x0002 - "dil7" // standard input (motherboard)
39190      // 0x0004 - "dil8" // standard input (motherboard)
39191      // 0x0008 - "dil9" // standard input (motherboard)
39192      // 0x0010 - "dil10" // standard input (motherboard)
39193      PORT_MODIFY("IN-18")
39194      // 0x0001 - "dil11" // standard input (motherboard)
39195      // 0x0002 - "dil12" // standard input (motherboard)
39196      // 0x0004 - "dil13" // standard input (motherboard)
39197      // 0x0008 - "dil14" // standard input (motherboard)
39198      // 0x0010 - "dil15" // standard input (motherboard)
39199      PORT_MODIFY("IN-19")
39200      // 0x0001 - "dil16" // standard input (motherboard)
39201      PORT_MODIFY("IN-20")
39202      // 0x0001 - "grnbut" // standard input (motherboard)
39203      // 0x0002 - "dorlok" // standard input (expected here)
39204      // 0x0004 - "serdor" // standard input (expected here)
39205      // 0x0008 - "cshdor" // standard input (expected here)
39206      // 0x0010 - "hopdmp" // standard input (expected here)
3920739207INPUT_PORTS_END
3920839208
3920939209// PR1643 AWP HILLBILLIONAIRE SCORP4         PR1613 HILLBILLIONAIRE SOUNDS11   HILLBILLIONAIRE S.SITE
r31373r31374
3922839228}
3922939229
3923039230INPUT_PORTS_START( sc4hiss ) // this structure is generated
39231        PORT_INCLUDE( sc4_base )
39232        PORT_MODIFY("IN-1")
39233        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
39234        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
39235        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
39236        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
39237        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
39238        PORT_MODIFY("IN-2")
39239        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
39240        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
39241        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39242        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
39243        PORT_MODIFY("IN-8")
39244        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
39245        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
39246        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
39247        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c hi")
39248        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("b hi")
39249        PORT_MODIFY("IN-9")
39250        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("f hi")
39251        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("step")
39252        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
39253        PORT_MODIFY("IN-16")
39254        // 0x0001 - "dil 1" // standard input (motherboard)
39255        // 0x0002 - "dil 2" // standard input (motherboard)
39256        // 0x0004 - "dil 3" // standard input (motherboard)
39257        // 0x0008 - "dil 4" // standard input (motherboard)
39258        // 0x0010 - "dil 5" // standard input (motherboard)
39259        // 0x0100 - "top up" // known extended input, usually 'top up'
39260        PORT_MODIFY("IN-17")
39261        // 0x0001 - "dil 6" // standard input (motherboard)
39262        // 0x0002 - "dil 7" // standard input (motherboard)
39263        // 0x0004 - "dil 8" // standard input (motherboard)
39264        // 0x0008 - "dil 9" // standard input (motherboard)
39265        // 0x0010 - "dil10" // standard input (motherboard)
39266        PORT_MODIFY("IN-18")
39267        // 0x0001 - "dil11" // standard input (motherboard)
39268        // 0x0002 - "dil12" // standard input (motherboard)
39269        // 0x0004 - "dil13" // standard input (motherboard)
39270        // 0x0008 - "dil14" // standard input (motherboard)
39271        // 0x0010 - "dil15" // standard input (motherboard)
39272        PORT_MODIFY("IN-19")
39273        // 0x0001 - "dil16" // standard input (motherboard)
39274        PORT_MODIFY("IN-20")
39275        // 0x0001 - "test" // standard input (motherboard)
39276        // 0x0002 - "lock" // standard input (expected here)
39277        // 0x0004 - "topdor" // standard input (expected here)
39278        // 0x0008 - "botdor" // standard input (expected here)
39279        // 0x0010 - "hopdmp" // standard input (expected here)
39231      PORT_INCLUDE( sc4_base )
39232      PORT_MODIFY("IN-1")
39233      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
39234      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
39235      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
39236      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
39237      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
39238      PORT_MODIFY("IN-2")
39239      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
39240      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
39241      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39242      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
39243      PORT_MODIFY("IN-8")
39244      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
39245      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
39246      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
39247      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c hi")
39248      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("b hi")
39249      PORT_MODIFY("IN-9")
39250      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("f hi")
39251      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("step")
39252      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
39253      PORT_MODIFY("IN-16")
39254      // 0x0001 - "dil 1" // standard input (motherboard)
39255      // 0x0002 - "dil 2" // standard input (motherboard)
39256      // 0x0004 - "dil 3" // standard input (motherboard)
39257      // 0x0008 - "dil 4" // standard input (motherboard)
39258      // 0x0010 - "dil 5" // standard input (motherboard)
39259      // 0x0100 - "top up" // known extended input, usually 'top up'
39260      PORT_MODIFY("IN-17")
39261      // 0x0001 - "dil 6" // standard input (motherboard)
39262      // 0x0002 - "dil 7" // standard input (motherboard)
39263      // 0x0004 - "dil 8" // standard input (motherboard)
39264      // 0x0008 - "dil 9" // standard input (motherboard)
39265      // 0x0010 - "dil10" // standard input (motherboard)
39266      PORT_MODIFY("IN-18")
39267      // 0x0001 - "dil11" // standard input (motherboard)
39268      // 0x0002 - "dil12" // standard input (motherboard)
39269      // 0x0004 - "dil13" // standard input (motherboard)
39270      // 0x0008 - "dil14" // standard input (motherboard)
39271      // 0x0010 - "dil15" // standard input (motherboard)
39272      PORT_MODIFY("IN-19")
39273      // 0x0001 - "dil16" // standard input (motherboard)
39274      PORT_MODIFY("IN-20")
39275      // 0x0001 - "test" // standard input (motherboard)
39276      // 0x0002 - "lock" // standard input (expected here)
39277      // 0x0004 - "topdor" // standard input (expected here)
39278      // 0x0008 - "botdor" // standard input (expected here)
39279      // 0x0010 - "hopdmp" // standard input (expected here)
3928039280INPUT_PORTS_END
3928139281
3928239282// PR2176 HISSING QUID         VIPA SOUNDS         HISSING QUID
r31373r31374
3930739307}
3930839308
3930939309INPUT_PORTS_START( sc4hotrd ) // this structure is generated
39310        PORT_INCLUDE( sc4_base )
39311        PORT_MODIFY("IN-1")
39312        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
39313        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
39314        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
39315        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
39316        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
39317        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39318        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39319        PORT_MODIFY("IN-2")
39320        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
39321        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
39322        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39323        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39324        PORT_MODIFY("IN-5")
39325        // 0x0001 - "priz4" // standard input (expected here)
39326        // 0x0002 - "priz3" // standard input (expected here)
39327        // 0x0004 - "priz2" // standard input (expected here)
39328        // 0x0008 - "priz1" // standard input (expected here)
39329        PORT_MODIFY("IN-6")
39330        // 0x0001 - "perc1" // standard input (expected here)
39331        // 0x0002 - "perc2" // standard input (expected here)
39332        // 0x0004 - "perc3" // standard input (expected here)
39333        // 0x0008 - "perc4" // standard input (expected here)
39334        PORT_MODIFY("IN-8")
39335        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lose")
39336        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hole8")
39337        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hole7")
39338        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hole6")
39339        PORT_MODIFY("IN-9")
39340        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hole5")
39341        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hole4")
39342        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("hole3")
39343        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("hole2")
39344        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("hole1")
39345        PORT_MODIFY("IN-16")
39346        // 0x0001 - "dil1" // standard input (motherboard)
39347        // 0x0002 - "dil2" // standard input (motherboard)
39348        // 0x0004 - "dil3" // standard input (motherboard)
39349        // 0x0008 - "dil4" // standard input (motherboard)
39350        // 0x0010 - "dil5" // standard input (motherboard)
39351        // 0x0100 - "top up" // known extended input, usually 'top up'
39352        PORT_MODIFY("IN-17")
39353        // 0x0001 - "dil6" // standard input (motherboard)
39354        // 0x0002 - "dil7" // standard input (motherboard)
39355        // 0x0004 - "dil8" // standard input (motherboard)
39356        // 0x0008 - "dil9" // standard input (motherboard)
39357        // 0x0010 - "dil10" // standard input (motherboard)
39358        PORT_MODIFY("IN-18")
39359        // 0x0001 - "dil11" // standard input (motherboard)
39360        // 0x0002 - "dil12" // standard input (motherboard)
39361        // 0x0004 - "dil13" // standard input (motherboard)
39362        // 0x0008 - "dil14" // standard input (motherboard)
39363        // 0x0010 - "dil15" // standard input (motherboard)
39364        PORT_MODIFY("IN-19")
39365        // 0x0001 - "dil16" // standard input (motherboard)
39366        PORT_MODIFY("IN-20")
39367        // 0x0001 - "grnbut" // standard input (motherboard)
39368        // 0x0002 - "dorlok" // standard input (expected here)
39369        // 0x0004 - "serdor" // standard input (expected here)
39370        // 0x0008 - "cshdor" // standard input (expected here)
39371        // 0x0010 - "hopdmp" // standard input (expected here)
39310      PORT_INCLUDE( sc4_base )
39311      PORT_MODIFY("IN-1")
39312      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
39313      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
39314      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
39315      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
39316      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
39317      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39318      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39319      PORT_MODIFY("IN-2")
39320      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
39321      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
39322      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39323      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39324      PORT_MODIFY("IN-5")
39325      // 0x0001 - "priz4" // standard input (expected here)
39326      // 0x0002 - "priz3" // standard input (expected here)
39327      // 0x0004 - "priz2" // standard input (expected here)
39328      // 0x0008 - "priz1" // standard input (expected here)
39329      PORT_MODIFY("IN-6")
39330      // 0x0001 - "perc1" // standard input (expected here)
39331      // 0x0002 - "perc2" // standard input (expected here)
39332      // 0x0004 - "perc3" // standard input (expected here)
39333      // 0x0008 - "perc4" // standard input (expected here)
39334      PORT_MODIFY("IN-8")
39335      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lose")
39336      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hole8")
39337      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hole7")
39338      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hole6")
39339      PORT_MODIFY("IN-9")
39340      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hole5")
39341      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hole4")
39342      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("hole3")
39343      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("hole2")
39344      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("hole1")
39345      PORT_MODIFY("IN-16")
39346      // 0x0001 - "dil1" // standard input (motherboard)
39347      // 0x0002 - "dil2" // standard input (motherboard)
39348      // 0x0004 - "dil3" // standard input (motherboard)
39349      // 0x0008 - "dil4" // standard input (motherboard)
39350      // 0x0010 - "dil5" // standard input (motherboard)
39351      // 0x0100 - "top up" // known extended input, usually 'top up'
39352      PORT_MODIFY("IN-17")
39353      // 0x0001 - "dil6" // standard input (motherboard)
39354      // 0x0002 - "dil7" // standard input (motherboard)
39355      // 0x0004 - "dil8" // standard input (motherboard)
39356      // 0x0008 - "dil9" // standard input (motherboard)
39357      // 0x0010 - "dil10" // standard input (motherboard)
39358      PORT_MODIFY("IN-18")
39359      // 0x0001 - "dil11" // standard input (motherboard)
39360      // 0x0002 - "dil12" // standard input (motherboard)
39361      // 0x0004 - "dil13" // standard input (motherboard)
39362      // 0x0008 - "dil14" // standard input (motherboard)
39363      // 0x0010 - "dil15" // standard input (motherboard)
39364      PORT_MODIFY("IN-19")
39365      // 0x0001 - "dil16" // standard input (motherboard)
39366      PORT_MODIFY("IN-20")
39367      // 0x0001 - "grnbut" // standard input (motherboard)
39368      // 0x0002 - "dorlok" // standard input (expected here)
39369      // 0x0004 - "serdor" // standard input (expected here)
39370      // 0x0008 - "cshdor" // standard input (expected here)
39371      // 0x0010 - "hopdmp" // standard input (expected here)
3937239372INPUT_PORTS_END
3937339373
3937439374// PR1733 AWP HOT ROD SCORP4         PR1713 HOT ROD SOUNDS11         HOT ROD S.SITE
r31373r31374
3939239392}
3939339393
3939439394INPUT_PORTS_START( sc4hotsh ) // this structure is generated
39395        PORT_INCLUDE( sc4_base )
39396        PORT_MODIFY("IN-1")
39397        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39398        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
39399        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
39400        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
39401        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
39402        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39403        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39404        PORT_MODIFY("IN-2")
39405        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
39406        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchan")
39407        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
39408        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39409        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
39410        PORT_MODIFY("IN-3")
39411        // 0x0004 - "stk 4" // standard input (expected here)
39412        // 0x0008 - "stk 3" // standard input (expected here)
39413        // 0x0010 - "stk 2" // standard input (expected here)
39414        PORT_MODIFY("IN-5")
39415        // 0x0001 - "priz4" // standard input (expected here)
39416        // 0x0002 - "priz3" // standard input (expected here)
39417        // 0x0004 - "priz2" // standard input (expected here)
39418        // 0x0008 - "priz1" // standard input (expected here)
39419        PORT_MODIFY("IN-6")
39420        // 0x0001 - "perc1" // standard input (expected here)
39421        // 0x0002 - "perc2" // standard input (expected here)
39422        // 0x0004 - "perc3" // standard input (expected here)
39423        // 0x0008 - "perc4" // standard input (expected here)
39424        PORT_MODIFY("IN-8")
39425        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("h or m")
39426        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk str")
39427        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bon")
39428        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk tip")
39429        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("ply hs")
39430        PORT_MODIFY("IN-9")
39431        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("bankit")
39432        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("shoot")
39433        PORT_MODIFY("IN-16")
39434        // 0x0001 - "dil1" // standard input (motherboard)
39435        // 0x0002 - "dil2" // standard input (motherboard)
39436        // 0x0004 - "dil3" // standard input (motherboard)
39437        // 0x0008 - "dil4" // standard input (motherboard)
39438        // 0x0010 - "dil5" // standard input (motherboard)
39439        // 0x0100 - "top up" // known extended input, usually 'top up'
39440        PORT_MODIFY("IN-17")
39441        // 0x0001 - "dil6" // standard input (motherboard)
39442        // 0x0002 - "dil7" // standard input (motherboard)
39443        // 0x0004 - "dil8" // standard input (motherboard)
39444        // 0x0008 - "dil9" // standard input (motherboard)
39445        // 0x0010 - "dil10" // standard input (motherboard)
39446        PORT_MODIFY("IN-18")
39447        // 0x0001 - "dil11" // standard input (motherboard)
39448        // 0x0002 - "dil12" // standard input (motherboard)
39449        // 0x0004 - "dil13" // standard input (motherboard)
39450        // 0x0008 - "dil14" // standard input (motherboard)
39451        // 0x0010 - "dil15" // standard input (motherboard)
39452        PORT_MODIFY("IN-19")
39453        // 0x0001 - "dil16" // standard input (motherboard)
39454        PORT_MODIFY("IN-20")
39455        // 0x0001 - "grnbut" // standard input (motherboard)
39456        // 0x0002 - "dorlok" // standard input (expected here)
39457        // 0x0004 - "serdor" // standard input (expected here)
39458        // 0x0008 - "cshdor" // standard input (expected here)
39459        // 0x0010 - "hopdmp" // standard input (expected here)
39395      PORT_INCLUDE( sc4_base )
39396      PORT_MODIFY("IN-1")
39397      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39398      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
39399      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
39400      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
39401      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
39402      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39403      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39404      PORT_MODIFY("IN-2")
39405      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
39406      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchan")
39407      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
39408      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39409      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
39410      PORT_MODIFY("IN-3")
39411      // 0x0004 - "stk 4" // standard input (expected here)
39412      // 0x0008 - "stk 3" // standard input (expected here)
39413      // 0x0010 - "stk 2" // standard input (expected here)
39414      PORT_MODIFY("IN-5")
39415      // 0x0001 - "priz4" // standard input (expected here)
39416      // 0x0002 - "priz3" // standard input (expected here)
39417      // 0x0004 - "priz2" // standard input (expected here)
39418      // 0x0008 - "priz1" // standard input (expected here)
39419      PORT_MODIFY("IN-6")
39420      // 0x0001 - "perc1" // standard input (expected here)
39421      // 0x0002 - "perc2" // standard input (expected here)
39422      // 0x0004 - "perc3" // standard input (expected here)
39423      // 0x0008 - "perc4" // standard input (expected here)
39424      PORT_MODIFY("IN-8")
39425      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("h or m")
39426      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk str")
39427      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bon")
39428      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk tip")
39429      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("ply hs")
39430      PORT_MODIFY("IN-9")
39431      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("bankit")
39432      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("shoot")
39433      PORT_MODIFY("IN-16")
39434      // 0x0001 - "dil1" // standard input (motherboard)
39435      // 0x0002 - "dil2" // standard input (motherboard)
39436      // 0x0004 - "dil3" // standard input (motherboard)
39437      // 0x0008 - "dil4" // standard input (motherboard)
39438      // 0x0010 - "dil5" // standard input (motherboard)
39439      // 0x0100 - "top up" // known extended input, usually 'top up'
39440      PORT_MODIFY("IN-17")
39441      // 0x0001 - "dil6" // standard input (motherboard)
39442      // 0x0002 - "dil7" // standard input (motherboard)
39443      // 0x0004 - "dil8" // standard input (motherboard)
39444      // 0x0008 - "dil9" // standard input (motherboard)
39445      // 0x0010 - "dil10" // standard input (motherboard)
39446      PORT_MODIFY("IN-18")
39447      // 0x0001 - "dil11" // standard input (motherboard)
39448      // 0x0002 - "dil12" // standard input (motherboard)
39449      // 0x0004 - "dil13" // standard input (motherboard)
39450      // 0x0008 - "dil14" // standard input (motherboard)
39451      // 0x0010 - "dil15" // standard input (motherboard)
39452      PORT_MODIFY("IN-19")
39453      // 0x0001 - "dil16" // standard input (motherboard)
39454      PORT_MODIFY("IN-20")
39455      // 0x0001 - "grnbut" // standard input (motherboard)
39456      // 0x0002 - "dorlok" // standard input (expected here)
39457      // 0x0004 - "serdor" // standard input (expected here)
39458      // 0x0008 - "cshdor" // standard input (expected here)
39459      // 0x0010 - "hopdmp" // standard input (expected here)
3946039460INPUT_PORTS_END
3946139461
3946239462// PR3231 AWP HOT SHOT SCORP4         PR3211 HOT SHOT SOUNDS11         HOT SHOT  S.SITE
r31373r31374
3948239482
3948339483
3948439484INPUT_PORTS_START( sc4hotwd ) // this structure is generated
39485        PORT_INCLUDE( sc4_base )
39486        PORT_MODIFY("IN-1")
39487        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39488        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
39489        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
39490        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
39491        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
39492        PORT_MODIFY("IN-2")
39493        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
39494        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39495        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39496        PORT_MODIFY("IN-3")
39497        // 0x0004 - "stk 4" // standard input (expected here)
39498        // 0x0008 - "stk 3" // standard input (expected here)
39499        // 0x0010 - "stk 2" // standard input (expected here)
39500        PORT_MODIFY("IN-5")
39501        // 0x0001 - "priz4" // standard input (expected here)
39502        // 0x0002 - "priz3" // standard input (expected here)
39503        // 0x0004 - "priz2" // standard input (expected here)
39504        // 0x0008 - "priz1" // standard input (expected here)
39505        PORT_MODIFY("IN-6")
39506        // 0x0001 - "perc1" // standard input (expected here)
39507        // 0x0002 - "perc2" // standard input (expected here)
39508        // 0x0004 - "perc3" // standard input (expected here)
39509        // 0x0008 - "perc4" // standard input (expected here)
39510        PORT_MODIFY("IN-8")
39511        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fea")
39512        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht")
39513        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk haz")
39514        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk nud")
39515        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk ss")
39516        PORT_MODIFY("IN-16")
39517        // 0x0001 - "dil 1" // standard input (motherboard)
39518        // 0x0002 - "dil 2" // standard input (motherboard)
39519        // 0x0004 - "dil 3" // standard input (motherboard)
39520        // 0x0008 - "dil 4" // standard input (motherboard)
39521        // 0x0010 - "dil 5" // standard input (motherboard)
39522        PORT_MODIFY("IN-17")
39523        // 0x0001 - "dil 6" // standard input (motherboard)
39524        // 0x0002 - "dil 7" // standard input (motherboard)
39525        // 0x0004 - "dil 8" // standard input (motherboard)
39526        // 0x0008 - "dil 9" // standard input (motherboard)
39527        // 0x0010 - "dil10" // standard input (motherboard)
39528        PORT_MODIFY("IN-18")
39529        // 0x0001 - "dil11" // standard input (motherboard)
39530        // 0x0002 - "dil12" // standard input (motherboard)
39531        // 0x0004 - "dil13" // standard input (motherboard)
39532        // 0x0008 - "dil14" // standard input (motherboard)
39533        // 0x0010 - "dil15" // standard input (motherboard)
39534        PORT_MODIFY("IN-19")
39535        // 0x0001 - "dil16" // standard input (motherboard)
39536        PORT_MODIFY("IN-20")
39537        // 0x0001 - "grnbut" // standard input (motherboard)
39538        // 0x0002 - "dorlok" // standard input (expected here)
39539        // 0x0004 - "topdor" // standard input (expected here)
39540        // 0x0008 - "botdor" // standard input (expected here)
39541        // 0x0010 - "hopdmp" // standard input (expected here)
39485      PORT_INCLUDE( sc4_base )
39486      PORT_MODIFY("IN-1")
39487      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39488      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
39489      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
39490      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
39491      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
39492      PORT_MODIFY("IN-2")
39493      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
39494      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39495      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39496      PORT_MODIFY("IN-3")
39497      // 0x0004 - "stk 4" // standard input (expected here)
39498      // 0x0008 - "stk 3" // standard input (expected here)
39499      // 0x0010 - "stk 2" // standard input (expected here)
39500      PORT_MODIFY("IN-5")
39501      // 0x0001 - "priz4" // standard input (expected here)
39502      // 0x0002 - "priz3" // standard input (expected here)
39503      // 0x0004 - "priz2" // standard input (expected here)
39504      // 0x0008 - "priz1" // standard input (expected here)
39505      PORT_MODIFY("IN-6")
39506      // 0x0001 - "perc1" // standard input (expected here)
39507      // 0x0002 - "perc2" // standard input (expected here)
39508      // 0x0004 - "perc3" // standard input (expected here)
39509      // 0x0008 - "perc4" // standard input (expected here)
39510      PORT_MODIFY("IN-8")
39511      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fea")
39512      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht")
39513      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk haz")
39514      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk nud")
39515      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk ss")
39516      PORT_MODIFY("IN-16")
39517      // 0x0001 - "dil 1" // standard input (motherboard)
39518      // 0x0002 - "dil 2" // standard input (motherboard)
39519      // 0x0004 - "dil 3" // standard input (motherboard)
39520      // 0x0008 - "dil 4" // standard input (motherboard)
39521      // 0x0010 - "dil 5" // standard input (motherboard)
39522      PORT_MODIFY("IN-17")
39523      // 0x0001 - "dil 6" // standard input (motherboard)
39524      // 0x0002 - "dil 7" // standard input (motherboard)
39525      // 0x0004 - "dil 8" // standard input (motherboard)
39526      // 0x0008 - "dil 9" // standard input (motherboard)
39527      // 0x0010 - "dil10" // standard input (motherboard)
39528      PORT_MODIFY("IN-18")
39529      // 0x0001 - "dil11" // standard input (motherboard)
39530      // 0x0002 - "dil12" // standard input (motherboard)
39531      // 0x0004 - "dil13" // standard input (motherboard)
39532      // 0x0008 - "dil14" // standard input (motherboard)
39533      // 0x0010 - "dil15" // standard input (motherboard)
39534      PORT_MODIFY("IN-19")
39535      // 0x0001 - "dil16" // standard input (motherboard)
39536      PORT_MODIFY("IN-20")
39537      // 0x0001 - "grnbut" // standard input (motherboard)
39538      // 0x0002 - "dorlok" // standard input (expected here)
39539      // 0x0004 - "topdor" // standard input (expected here)
39540      // 0x0008 - "botdor" // standard input (expected here)
39541      // 0x0010 - "hopdmp" // standard input (expected here)
3954239542INPUT_PORTS_END
3954339543
3954439544// PR1311 HOT WAD         PR1311 HOT WAD SOUNDS11
r31373r31374
3956939569}
3957039570
3957139571INPUT_PORTS_START( sc4celeb ) // this structure is generated
39572        PORT_INCLUDE( sc4_base )
39573        PORT_MODIFY("IN-1")
39574        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39575        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
39576        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
39577        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
39578        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
39579        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39580        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39581        PORT_MODIFY("IN-2")
39582        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
39583        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
39584        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39585        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39586        PORT_MODIFY("IN-3")
39587        // 0x0004 - "stk 4" // standard input (expected here)
39588        // 0x0008 - "stk 2" // standard input (expected here)
39589        // 0x0010 - "stk 3" // standard input (expected here)
39590        PORT_MODIFY("IN-4")
39591        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
39592        PORT_MODIFY("IN-5")
39593        // 0x0001 - "priz4" // standard input (expected here)
39594        // 0x0002 - "priz3" // standard input (expected here)
39595        // 0x0004 - "priz2" // standard input (expected here)
39596        // 0x0008 - "priz1" // standard input (expected here)
39597        PORT_MODIFY("IN-6")
39598        // 0x0001 - "perc1" // standard input (expected here)
39599        // 0x0002 - "perc2" // standard input (expected here)
39600        // 0x0004 - "perc3" // standard input (expected here)
39601        // 0x0008 - "perc4" // standard input (expected here)
39602        PORT_MODIFY("IN-8")
39603        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("get me")
39604        PORT_MODIFY("IN-16")
39605        // 0x0001 - "dil 1" // standard input (motherboard)
39606        // 0x0002 - "dil 2" // standard input (motherboard)
39607        // 0x0004 - "dil 3" // standard input (motherboard)
39608        // 0x0008 - "dil 4" // standard input (motherboard)
39609        // 0x0010 - "dil 5" // standard input (motherboard)
39610        PORT_MODIFY("IN-17")
39611        // 0x0001 - "dil 6" // standard input (motherboard)
39612        // 0x0002 - "dil 7" // standard input (motherboard)
39613        // 0x0004 - "dil 8" // standard input (motherboard)
39614        // 0x0008 - "dil 9" // standard input (motherboard)
39615        // 0x0010 - "dil10" // standard input (motherboard)
39616        PORT_MODIFY("IN-18")
39617        // 0x0001 - "dil11" // standard input (motherboard)
39618        // 0x0002 - "dil12" // standard input (motherboard)
39619        // 0x0004 - "dil13" // standard input (motherboard)
39620        // 0x0008 - "dil14" // standard input (motherboard)
39621        // 0x0010 - "dil15" // standard input (motherboard)
39622        PORT_MODIFY("IN-19")
39623        // 0x0001 - "dil16" // standard input (motherboard)
39624        PORT_MODIFY("IN-20")
39625        // 0x0001 - "grnbut" // standard input (motherboard)
39626        // 0x0002 - "dorlok" // standard input (expected here)
39627        // 0x0004 - "serdor" // standard input (expected here)
39628        // 0x0008 - "cshdor" // standard input (expected here)
39629        // 0x0010 - "hopdmp" // standard input (expected here)
39572      PORT_INCLUDE( sc4_base )
39573      PORT_MODIFY("IN-1")
39574      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39575      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
39576      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
39577      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
39578      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
39579      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39580      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39581      PORT_MODIFY("IN-2")
39582      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
39583      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
39584      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39585      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39586      PORT_MODIFY("IN-3")
39587      // 0x0004 - "stk 4" // standard input (expected here)
39588      // 0x0008 - "stk 2" // standard input (expected here)
39589      // 0x0010 - "stk 3" // standard input (expected here)
39590      PORT_MODIFY("IN-4")
39591      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
39592      PORT_MODIFY("IN-5")
39593      // 0x0001 - "priz4" // standard input (expected here)
39594      // 0x0002 - "priz3" // standard input (expected here)
39595      // 0x0004 - "priz2" // standard input (expected here)
39596      // 0x0008 - "priz1" // standard input (expected here)
39597      PORT_MODIFY("IN-6")
39598      // 0x0001 - "perc1" // standard input (expected here)
39599      // 0x0002 - "perc2" // standard input (expected here)
39600      // 0x0004 - "perc3" // standard input (expected here)
39601      // 0x0008 - "perc4" // standard input (expected here)
39602      PORT_MODIFY("IN-8")
39603      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("get me")
39604      PORT_MODIFY("IN-16")
39605      // 0x0001 - "dil 1" // standard input (motherboard)
39606      // 0x0002 - "dil 2" // standard input (motherboard)
39607      // 0x0004 - "dil 3" // standard input (motherboard)
39608      // 0x0008 - "dil 4" // standard input (motherboard)
39609      // 0x0010 - "dil 5" // standard input (motherboard)
39610      PORT_MODIFY("IN-17")
39611      // 0x0001 - "dil 6" // standard input (motherboard)
39612      // 0x0002 - "dil 7" // standard input (motherboard)
39613      // 0x0004 - "dil 8" // standard input (motherboard)
39614      // 0x0008 - "dil 9" // standard input (motherboard)
39615      // 0x0010 - "dil10" // standard input (motherboard)
39616      PORT_MODIFY("IN-18")
39617      // 0x0001 - "dil11" // standard input (motherboard)
39618      // 0x0002 - "dil12" // standard input (motherboard)
39619      // 0x0004 - "dil13" // standard input (motherboard)
39620      // 0x0008 - "dil14" // standard input (motherboard)
39621      // 0x0010 - "dil15" // standard input (motherboard)
39622      PORT_MODIFY("IN-19")
39623      // 0x0001 - "dil16" // standard input (motherboard)
39624      PORT_MODIFY("IN-20")
39625      // 0x0001 - "grnbut" // standard input (motherboard)
39626      // 0x0002 - "dorlok" // standard input (expected here)
39627      // 0x0004 - "serdor" // standard input (expected here)
39628      // 0x0008 - "cshdor" // standard input (expected here)
39629      // 0x0010 - "hopdmp" // standard input (expected here)
3963039630INPUT_PORTS_END
3963139631
3963239632// PR1603 AWP IM A CELEBRITY         PR1603 IM A CELEB SOUNDS11        IM A CELEBRITY  S.SITE
r31373r31374
3965439654}
3965539655
3965639656INPUT_PORTS_START( sc4inspn ) // this structure is generated
39657        PORT_INCLUDE( sc4_base )
39658        PORT_MODIFY("IN-1")
39659        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
39660        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
39661        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
39662        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
39663        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
39664        PORT_MODIFY("IN-2")
39665        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
39666        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39667        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39668        PORT_MODIFY("IN-8")
39669        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("take s")
39670        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cashpo")
39671        PORT_MODIFY("IN-16")
39672        // 0x0001 - "dil  1" // standard input (motherboard)
39673        // 0x0002 - "dil  2" // standard input (motherboard)
39674        // 0x0004 - "dil  3" // standard input (motherboard)
39675        // 0x0008 - "dil  4" // standard input (motherboard)
39676        // 0x0010 - "dil  5" // standard input (motherboard)
39677        // 0x0100 - "topup" // known extended input, usually 'top up'
39678        PORT_MODIFY("IN-17")
39679        // 0x0001 - "dil  6" // standard input (motherboard)
39680        // 0x0002 - "dil  7" // standard input (motherboard)
39681        // 0x0004 - "dil  8" // standard input (motherboard)
39682        // 0x0008 - "dil  9" // standard input (motherboard)
39683        // 0x0010 - "dil 10" // standard input (motherboard)
39684        PORT_MODIFY("IN-18")
39685        // 0x0001 - "dil 11" // standard input (motherboard)
39686        // 0x0002 - "dil 12" // standard input (motherboard)
39687        // 0x0004 - "dil 13" // standard input (motherboard)
39688        // 0x0008 - "dil 14" // standard input (motherboard)
39689        // 0x0010 - "dil 15" // standard input (motherboard)
39690        PORT_MODIFY("IN-19")
39691        // 0x0001 - "dil 16" // standard input (motherboard)
39692        PORT_MODIFY("IN-20")
39693        // 0x0001 - "test" // standard input (motherboard)
39694        // 0x0002 - "lock" // standard input (expected here)
39695        // 0x0004 - "topdor" // standard input (expected here)
39696        // 0x0008 - "botdor" // standard input (expected here)
39697        // 0x0010 - "hopdmp" // standard input (expected here)
39657      PORT_INCLUDE( sc4_base )
39658      PORT_MODIFY("IN-1")
39659      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
39660      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
39661      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
39662      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
39663      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
39664      PORT_MODIFY("IN-2")
39665      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
39666      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39667      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39668      PORT_MODIFY("IN-8")
39669      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("take s")
39670      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cashpo")
39671      PORT_MODIFY("IN-16")
39672      // 0x0001 - "dil  1" // standard input (motherboard)
39673      // 0x0002 - "dil  2" // standard input (motherboard)
39674      // 0x0004 - "dil  3" // standard input (motherboard)
39675      // 0x0008 - "dil  4" // standard input (motherboard)
39676      // 0x0010 - "dil  5" // standard input (motherboard)
39677      // 0x0100 - "topup" // known extended input, usually 'top up'
39678      PORT_MODIFY("IN-17")
39679      // 0x0001 - "dil  6" // standard input (motherboard)
39680      // 0x0002 - "dil  7" // standard input (motherboard)
39681      // 0x0004 - "dil  8" // standard input (motherboard)
39682      // 0x0008 - "dil  9" // standard input (motherboard)
39683      // 0x0010 - "dil 10" // standard input (motherboard)
39684      PORT_MODIFY("IN-18")
39685      // 0x0001 - "dil 11" // standard input (motherboard)
39686      // 0x0002 - "dil 12" // standard input (motherboard)
39687      // 0x0004 - "dil 13" // standard input (motherboard)
39688      // 0x0008 - "dil 14" // standard input (motherboard)
39689      // 0x0010 - "dil 15" // standard input (motherboard)
39690      PORT_MODIFY("IN-19")
39691      // 0x0001 - "dil 16" // standard input (motherboard)
39692      PORT_MODIFY("IN-20")
39693      // 0x0001 - "test" // standard input (motherboard)
39694      // 0x0002 - "lock" // standard input (expected here)
39695      // 0x0004 - "topdor" // standard input (expected here)
39696      // 0x0008 - "botdor" // standard input (expected here)
39697      // 0x0010 - "hopdmp" // standard input (expected here)
3969839698INPUT_PORTS_END
3969939699
3970039700// PR2555 INNER SPIN V013         INNERSPINSND            INNER SPIN
r31373r31374
3971939719}
3972039720
3972139721INPUT_PORTS_START( sc4ijob ) // this structure is generated
39722        PORT_INCLUDE( sc4_base )
39723        PORT_MODIFY("IN-1")
39724        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
39725        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("ch stk")
39726        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
39727        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
39728        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
39729        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39730        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39731        PORT_MODIFY("IN-2")
39732        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ply it")
39733        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
39734        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39735        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39736        PORT_MODIFY("IN-3")
39737        // 0x0004 - "stk 4" // standard input (expected here)
39738        // 0x0008 - "stk 3" // standard input (expected here)
39739        // 0x0010 - "stk 2" // standard input (expected here)
39740        PORT_MODIFY("IN-5")
39741        // 0x0001 - "priz4" // standard input (expected here)
39742        // 0x0002 - "priz3" // standard input (expected here)
39743        // 0x0004 - "priz2" // standard input (expected here)
39744        // 0x0008 - "priz1" // standard input (expected here)
39745        PORT_MODIFY("IN-6")
39746        // 0x0001 - "perc1" // standard input (expected here)
39747        // 0x0002 - "perc2" // standard input (expected here)
39748        // 0x0004 - "perc3" // standard input (expected here)
39749        // 0x0008 - "perc4" // standard input (expected here)
39750        PORT_MODIFY("IN-8")
39751        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("get aw")
39752        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("streak")
39753        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("leave")
39754        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take")
39755        PORT_MODIFY("IN-16")
39756        // 0x0001 - "dil1" // standard input (motherboard)
39757        // 0x0002 - "dil2" // standard input (motherboard)
39758        // 0x0004 - "dil3" // standard input (motherboard)
39759        // 0x0008 - "dil4" // standard input (motherboard)
39760        // 0x0010 - "dil5" // standard input (motherboard)
39761        // 0x0100 - "top up" // known extended input, usually 'top up'
39762        PORT_MODIFY("IN-17")
39763        // 0x0001 - "dil6" // standard input (motherboard)
39764        // 0x0002 - "dil7" // standard input (motherboard)
39765        // 0x0004 - "dil8" // standard input (motherboard)
39766        // 0x0008 - "dil9" // standard input (motherboard)
39767        // 0x0010 - "dil10" // standard input (motherboard)
39768        PORT_MODIFY("IN-18")
39769        // 0x0001 - "dil11" // standard input (motherboard)
39770        // 0x0002 - "dil12" // standard input (motherboard)
39771        // 0x0004 - "dil13" // standard input (motherboard)
39772        // 0x0008 - "dil14" // standard input (motherboard)
39773        // 0x0010 - "dil15" // standard input (motherboard)
39774        PORT_MODIFY("IN-19")
39775        // 0x0001 - "dil16" // standard input (motherboard)
39776        PORT_MODIFY("IN-20")
39777        // 0x0001 - "grnbut" // standard input (motherboard)
39778        // 0x0002 - "dorlok" // standard input (expected here)
39779        // 0x0004 - "serdor" // standard input (expected here)
39780        // 0x0008 - "cshdor" // standard input (expected here)
39781        // 0x0010 - "hopdmp" // standard input (expected here)
39722      PORT_INCLUDE( sc4_base )
39723      PORT_MODIFY("IN-1")
39724      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
39725      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("ch stk")
39726      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
39727      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
39728      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
39729      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39730      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39731      PORT_MODIFY("IN-2")
39732      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ply it")
39733      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
39734      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39735      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39736      PORT_MODIFY("IN-3")
39737      // 0x0004 - "stk 4" // standard input (expected here)
39738      // 0x0008 - "stk 3" // standard input (expected here)
39739      // 0x0010 - "stk 2" // standard input (expected here)
39740      PORT_MODIFY("IN-5")
39741      // 0x0001 - "priz4" // standard input (expected here)
39742      // 0x0002 - "priz3" // standard input (expected here)
39743      // 0x0004 - "priz2" // standard input (expected here)
39744      // 0x0008 - "priz1" // standard input (expected here)
39745      PORT_MODIFY("IN-6")
39746      // 0x0001 - "perc1" // standard input (expected here)
39747      // 0x0002 - "perc2" // standard input (expected here)
39748      // 0x0004 - "perc3" // standard input (expected here)
39749      // 0x0008 - "perc4" // standard input (expected here)
39750      PORT_MODIFY("IN-8")
39751      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("get aw")
39752      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("streak")
39753      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("leave")
39754      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take")
39755      PORT_MODIFY("IN-16")
39756      // 0x0001 - "dil1" // standard input (motherboard)
39757      // 0x0002 - "dil2" // standard input (motherboard)
39758      // 0x0004 - "dil3" // standard input (motherboard)
39759      // 0x0008 - "dil4" // standard input (motherboard)
39760      // 0x0010 - "dil5" // standard input (motherboard)
39761      // 0x0100 - "top up" // known extended input, usually 'top up'
39762      PORT_MODIFY("IN-17")
39763      // 0x0001 - "dil6" // standard input (motherboard)
39764      // 0x0002 - "dil7" // standard input (motherboard)
39765      // 0x0004 - "dil8" // standard input (motherboard)
39766      // 0x0008 - "dil9" // standard input (motherboard)
39767      // 0x0010 - "dil10" // standard input (motherboard)
39768      PORT_MODIFY("IN-18")
39769      // 0x0001 - "dil11" // standard input (motherboard)
39770      // 0x0002 - "dil12" // standard input (motherboard)
39771      // 0x0004 - "dil13" // standard input (motherboard)
39772      // 0x0008 - "dil14" // standard input (motherboard)
39773      // 0x0010 - "dil15" // standard input (motherboard)
39774      PORT_MODIFY("IN-19")
39775      // 0x0001 - "dil16" // standard input (motherboard)
39776      PORT_MODIFY("IN-20")
39777      // 0x0001 - "grnbut" // standard input (motherboard)
39778      // 0x0002 - "dorlok" // standard input (expected here)
39779      // 0x0004 - "serdor" // standard input (expected here)
39780      // 0x0008 - "cshdor" // standard input (expected here)
39781      // 0x0010 - "hopdmp" // standard input (expected here)
3978239782INPUT_PORTS_END
3978339783
3978439784
r31373r31374
3981539815}
3981639816
3981739817INPUT_PORTS_START( sc4ldvl ) // this structure is generated
39818        PORT_INCLUDE( sc4_base )
39819        PORT_MODIFY("IN-1")
39820        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39821        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
39822        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
39823        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
39824        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
39825        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
39826        PORT_MODIFY("IN-2")
39827        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
39828        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("chgstk")
39829        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39830        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39831        PORT_MODIFY("IN-3")
39832        // 0x0004 - "stk3" // standard input (expected here)
39833        // 0x0008 - "stk1" // standard input (expected here)
39834        // 0x0010 - "stk2" // standard input (expected here)
39835        PORT_MODIFY("IN-5")
39836        // 0x0001 - "jp 1" // standard input (expected here)
39837        // 0x0002 - "jp 2" // standard input (expected here)
39838        // 0x0004 - "jp 3" // standard input (expected here)
39839        // 0x0008 - "jp 4" // standard input (expected here)
39840        PORT_MODIFY("IN-6")
39841        // 0x0001 - "pc 1" // standard input (expected here)
39842        // 0x0002 - "pc 2" // standard input (expected here)
39843        // 0x0004 - "pc 3" // standard input (expected here)
39844        // 0x0008 - "pc 4" // standard input (expected here)
39845        PORT_MODIFY("IN-8")
39846        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk cas")
39847        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("move u")
39848        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk cpo")
39849        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk sho")
39850        PORT_MODIFY("IN-16")
39851        // 0x0001 - "dil  1" // standard input (motherboard)
39852        // 0x0002 - "dil  2" // standard input (motherboard)
39853        // 0x0004 - "dil  3" // standard input (motherboard)
39854        // 0x0008 - "dil  4" // standard input (motherboard)
39855        // 0x0010 - "dil  5" // standard input (motherboard)
39856        // 0x0100 - "top up" // known extended input, usually 'top up'
39857        PORT_MODIFY("IN-17")
39858        // 0x0001 - "dil  6" // standard input (motherboard)
39859        // 0x0002 - "dil  7" // standard input (motherboard)
39860        // 0x0004 - "dil  8" // standard input (motherboard)
39861        // 0x0008 - "dil  9" // standard input (motherboard)
39862        // 0x0010 - "dil 10" // standard input (motherboard)
39863        PORT_MODIFY("IN-18")
39864        // 0x0001 - "dil 11" // standard input (motherboard)
39865        // 0x0002 - "dil 12" // standard input (motherboard)
39866        // 0x0004 - "dil 13" // standard input (motherboard)
39867        // 0x0008 - "dil 14" // standard input (motherboard)
39868        // 0x0010 - "dil 15" // standard input (motherboard)
39869        PORT_MODIFY("IN-19")
39870        // 0x0001 - "dil 16" // standard input (motherboard)
39871        PORT_MODIFY("IN-20")
39872        // 0x0001 - "test" // standard input (motherboard)
39873        // 0x0002 - "dorlk" // standard input (expected here)
39874        // 0x0004 - "topdr" // standard input (expected here)
39875        // 0x0008 - "cshbx" // standard input (expected here)
39876        // 0x0010 - "dump" // standard input (expected here)
39818      PORT_INCLUDE( sc4_base )
39819      PORT_MODIFY("IN-1")
39820      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39821      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
39822      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
39823      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
39824      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
39825      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
39826      PORT_MODIFY("IN-2")
39827      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
39828      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("chgstk")
39829      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39830      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39831      PORT_MODIFY("IN-3")
39832      // 0x0004 - "stk3" // standard input (expected here)
39833      // 0x0008 - "stk1" // standard input (expected here)
39834      // 0x0010 - "stk2" // standard input (expected here)
39835      PORT_MODIFY("IN-5")
39836      // 0x0001 - "jp 1" // standard input (expected here)
39837      // 0x0002 - "jp 2" // standard input (expected here)
39838      // 0x0004 - "jp 3" // standard input (expected here)
39839      // 0x0008 - "jp 4" // standard input (expected here)
39840      PORT_MODIFY("IN-6")
39841      // 0x0001 - "pc 1" // standard input (expected here)
39842      // 0x0002 - "pc 2" // standard input (expected here)
39843      // 0x0004 - "pc 3" // standard input (expected here)
39844      // 0x0008 - "pc 4" // standard input (expected here)
39845      PORT_MODIFY("IN-8")
39846      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk cas")
39847      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("move u")
39848      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk cpo")
39849      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk sho")
39850      PORT_MODIFY("IN-16")
39851      // 0x0001 - "dil  1" // standard input (motherboard)
39852      // 0x0002 - "dil  2" // standard input (motherboard)
39853      // 0x0004 - "dil  3" // standard input (motherboard)
39854      // 0x0008 - "dil  4" // standard input (motherboard)
39855      // 0x0010 - "dil  5" // standard input (motherboard)
39856      // 0x0100 - "top up" // known extended input, usually 'top up'
39857      PORT_MODIFY("IN-17")
39858      // 0x0001 - "dil  6" // standard input (motherboard)
39859      // 0x0002 - "dil  7" // standard input (motherboard)
39860      // 0x0004 - "dil  8" // standard input (motherboard)
39861      // 0x0008 - "dil  9" // standard input (motherboard)
39862      // 0x0010 - "dil 10" // standard input (motherboard)
39863      PORT_MODIFY("IN-18")
39864      // 0x0001 - "dil 11" // standard input (motherboard)
39865      // 0x0002 - "dil 12" // standard input (motherboard)
39866      // 0x0004 - "dil 13" // standard input (motherboard)
39867      // 0x0008 - "dil 14" // standard input (motherboard)
39868      // 0x0010 - "dil 15" // standard input (motherboard)
39869      PORT_MODIFY("IN-19")
39870      // 0x0001 - "dil 16" // standard input (motherboard)
39871      PORT_MODIFY("IN-20")
39872      // 0x0001 - "test" // standard input (motherboard)
39873      // 0x0002 - "dorlk" // standard input (expected here)
39874      // 0x0004 - "topdr" // standard input (expected here)
39875      // 0x0008 - "cshbx" // standard input (expected here)
39876      // 0x0010 - "dump" // standard input (expected here)
3987739877INPUT_PORTS_END
3987839878
3987939879// PR2376 LITTLE DEVIL         LDEVIL SOUNDS         LITTLE DEVIL
r31373r31374
3990039900}
3990139901
3990239902INPUT_PORTS_START( sc4lotrr ) // this structure is generated
39903        PORT_INCLUDE( sc4_base )
39904        PORT_MODIFY("IN-1")
39905        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39906        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
39907        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
39908        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
39909        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
39910        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39911        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39912        PORT_MODIFY("IN-2")
39913        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
39914        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
39915        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39916        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39917        PORT_MODIFY("IN-3")
39918        // 0x0004 - "stk 4" // standard input (expected here)
39919        // 0x0008 - "stk 3" // standard input (expected here)
39920        // 0x0010 - "stk 2" // standard input (expected here)
39921        PORT_MODIFY("IN-4")
39922        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
39923        PORT_MODIFY("IN-5")
39924        // 0x0001 - "priz4" // standard input (expected here)
39925        // 0x0002 - "priz3" // standard input (expected here)
39926        // 0x0004 - "priz2" // standard input (expected here)
39927        // 0x0008 - "priz1" // standard input (expected here)
39928        PORT_MODIFY("IN-6")
39929        // 0x0001 - "perc1" // standard input (expected here)
39930        // 0x0002 - "perc2" // standard input (expected here)
39931        // 0x0004 - "perc3" // standard input (expected here)
39932        // 0x0008 - "perc4" // standard input (expected here)
39933        PORT_MODIFY("IN-16")
39934        // 0x0001 - "dil1" // standard input (motherboard)
39935        // 0x0002 - "dil2" // standard input (motherboard)
39936        // 0x0004 - "dil3" // standard input (motherboard)
39937        // 0x0008 - "dil4" // standard input (motherboard)
39938        // 0x0010 - "dil5" // standard input (motherboard)
39939        PORT_MODIFY("IN-17")
39940        // 0x0001 - "dil6" // standard input (motherboard)
39941        // 0x0002 - "dil7" // standard input (motherboard)
39942        // 0x0004 - "dil8" // standard input (motherboard)
39943        // 0x0008 - "dil9" // standard input (motherboard)
39944        // 0x0010 - "dil10" // standard input (motherboard)
39945        PORT_MODIFY("IN-18")
39946        // 0x0001 - "dil11" // standard input (motherboard)
39947        // 0x0002 - "dil12" // standard input (motherboard)
39948        // 0x0004 - "dil13" // standard input (motherboard)
39949        // 0x0008 - "dil14" // standard input (motherboard)
39950        // 0x0010 - "dil15" // standard input (motherboard)
39951        PORT_MODIFY("IN-19")
39952        // 0x0001 - "dil16" // standard input (motherboard)
39953        PORT_MODIFY("IN-20")
39954        // 0x0001 - "grnbut" // standard input (motherboard)
39955        // 0x0002 - "dorlok" // standard input (expected here)
39956        // 0x0004 - "serdor" // standard input (expected here)
39957        // 0x0008 - "cshdor" // standard input (expected here)
39958        // 0x0010 - "hopdmp" // standard input (expected here)
39903      PORT_INCLUDE( sc4_base )
39904      PORT_MODIFY("IN-1")
39905      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39906      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
39907      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
39908      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
39909      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
39910      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39911      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39912      PORT_MODIFY("IN-2")
39913      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
39914      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
39915      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
39916      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
39917      PORT_MODIFY("IN-3")
39918      // 0x0004 - "stk 4" // standard input (expected here)
39919      // 0x0008 - "stk 3" // standard input (expected here)
39920      // 0x0010 - "stk 2" // standard input (expected here)
39921      PORT_MODIFY("IN-4")
39922      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
39923      PORT_MODIFY("IN-5")
39924      // 0x0001 - "priz4" // standard input (expected here)
39925      // 0x0002 - "priz3" // standard input (expected here)
39926      // 0x0004 - "priz2" // standard input (expected here)
39927      // 0x0008 - "priz1" // standard input (expected here)
39928      PORT_MODIFY("IN-6")
39929      // 0x0001 - "perc1" // standard input (expected here)
39930      // 0x0002 - "perc2" // standard input (expected here)
39931      // 0x0004 - "perc3" // standard input (expected here)
39932      // 0x0008 - "perc4" // standard input (expected here)
39933      PORT_MODIFY("IN-16")
39934      // 0x0001 - "dil1" // standard input (motherboard)
39935      // 0x0002 - "dil2" // standard input (motherboard)
39936      // 0x0004 - "dil3" // standard input (motherboard)
39937      // 0x0008 - "dil4" // standard input (motherboard)
39938      // 0x0010 - "dil5" // standard input (motherboard)
39939      PORT_MODIFY("IN-17")
39940      // 0x0001 - "dil6" // standard input (motherboard)
39941      // 0x0002 - "dil7" // standard input (motherboard)
39942      // 0x0004 - "dil8" // standard input (motherboard)
39943      // 0x0008 - "dil9" // standard input (motherboard)
39944      // 0x0010 - "dil10" // standard input (motherboard)
39945      PORT_MODIFY("IN-18")
39946      // 0x0001 - "dil11" // standard input (motherboard)
39947      // 0x0002 - "dil12" // standard input (motherboard)
39948      // 0x0004 - "dil13" // standard input (motherboard)
39949      // 0x0008 - "dil14" // standard input (motherboard)
39950      // 0x0010 - "dil15" // standard input (motherboard)
39951      PORT_MODIFY("IN-19")
39952      // 0x0001 - "dil16" // standard input (motherboard)
39953      PORT_MODIFY("IN-20")
39954      // 0x0001 - "grnbut" // standard input (motherboard)
39955      // 0x0002 - "dorlok" // standard input (expected here)
39956      // 0x0004 - "serdor" // standard input (expected here)
39957      // 0x0008 - "cshdor" // standard input (expected here)
39958      // 0x0010 - "hopdmp" // standard input (expected here)
3995939959INPUT_PORTS_END
3996039960
3996139961// PR1427 AWP RETURN OF THE KING         PR1413 RETURN OF THE  SOUNDS11    RETURN OF KING  S.SITE
r31373r31374
3998439984}
3998539985
3998639986INPUT_PORTS_START( sc4manic ) // this structure is generated
39987        PORT_INCLUDE( sc4_base )
39988        PORT_MODIFY("IN-1")
39989        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39990        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
39991        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
39992        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
39993        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
39994        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39995        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39996        PORT_MODIFY("IN-2")
39997        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
39998        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("tra/ex")
39999        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("sta/ga")
40000        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40001        PORT_MODIFY("IN-3")
40002        // 0x0004 - "stk 4" // standard input (expected here)
40003        // 0x0008 - "stk 3" // standard input (expected here)
40004        // 0x0010 - "stk 2" // standard input (expected here)
40005        PORT_MODIFY("IN-5")
40006        // 0x0001 - "priz4" // standard input (expected here)
40007        // 0x0002 - "priz3" // standard input (expected here)
40008        // 0x0004 - "priz2" // standard input (expected here)
40009        // 0x0008 - "priz1" // standard input (expected here)
40010        PORT_MODIFY("IN-6")
40011        // 0x0001 - "perc1" // standard input (expected here)
40012        // 0x0002 - "perc2" // standard input (expected here)
40013        // 0x0004 - "perc3" // standard input (expected here)
40014        // 0x0008 - "perc4" // standard input (expected here)
40015        PORT_MODIFY("IN-8")
40016        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bankit")
40017        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bns")
40018        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk csh")
40019        PORT_MODIFY("IN-16")
40020        // 0x0001 - "dil1" // standard input (motherboard)
40021        // 0x0002 - "dil2" // standard input (motherboard)
40022        // 0x0004 - "dil3" // standard input (motherboard)
40023        // 0x0008 - "dil4" // standard input (motherboard)
40024        // 0x0010 - "dil5" // standard input (motherboard)
40025        // 0x0100 - "top up" // known extended input, usually 'top up'
40026        PORT_MODIFY("IN-17")
40027        // 0x0001 - "dil6" // standard input (motherboard)
40028        // 0x0002 - "dil7" // standard input (motherboard)
40029        // 0x0004 - "dil8" // standard input (motherboard)
40030        // 0x0008 - "dil9" // standard input (motherboard)
40031        // 0x0010 - "dil10" // standard input (motherboard)
40032        PORT_MODIFY("IN-18")
40033        // 0x0001 - "dil11" // standard input (motherboard)
40034        // 0x0002 - "dil12" // standard input (motherboard)
40035        // 0x0004 - "dil13" // standard input (motherboard)
40036        // 0x0008 - "dil14" // standard input (motherboard)
40037        // 0x0010 - "dil15" // standard input (motherboard)
40038        PORT_MODIFY("IN-19")
40039        // 0x0001 - "dil16" // standard input (motherboard)
40040        PORT_MODIFY("IN-20")
40041        // 0x0001 - "grnbut" // standard input (motherboard)
40042        // 0x0002 - "dorlok" // standard input (expected here)
40043        // 0x0004 - "serdor" // standard input (expected here)
40044        // 0x0008 - "cshdor" // standard input (expected here)
40045        // 0x0010 - "hopdmp" // standard input (expected here)
39987      PORT_INCLUDE( sc4_base )
39988      PORT_MODIFY("IN-1")
39989      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
39990      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
39991      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
39992      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
39993      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
39994      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
39995      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
39996      PORT_MODIFY("IN-2")
39997      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
39998      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("tra/ex")
39999      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("sta/ga")
40000      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40001      PORT_MODIFY("IN-3")
40002      // 0x0004 - "stk 4" // standard input (expected here)
40003      // 0x0008 - "stk 3" // standard input (expected here)
40004      // 0x0010 - "stk 2" // standard input (expected here)
40005      PORT_MODIFY("IN-5")
40006      // 0x0001 - "priz4" // standard input (expected here)
40007      // 0x0002 - "priz3" // standard input (expected here)
40008      // 0x0004 - "priz2" // standard input (expected here)
40009      // 0x0008 - "priz1" // standard input (expected here)
40010      PORT_MODIFY("IN-6")
40011      // 0x0001 - "perc1" // standard input (expected here)
40012      // 0x0002 - "perc2" // standard input (expected here)
40013      // 0x0004 - "perc3" // standard input (expected here)
40014      // 0x0008 - "perc4" // standard input (expected here)
40015      PORT_MODIFY("IN-8")
40016      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bankit")
40017      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bns")
40018      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk csh")
40019      PORT_MODIFY("IN-16")
40020      // 0x0001 - "dil1" // standard input (motherboard)
40021      // 0x0002 - "dil2" // standard input (motherboard)
40022      // 0x0004 - "dil3" // standard input (motherboard)
40023      // 0x0008 - "dil4" // standard input (motherboard)
40024      // 0x0010 - "dil5" // standard input (motherboard)
40025      // 0x0100 - "top up" // known extended input, usually 'top up'
40026      PORT_MODIFY("IN-17")
40027      // 0x0001 - "dil6" // standard input (motherboard)
40028      // 0x0002 - "dil7" // standard input (motherboard)
40029      // 0x0004 - "dil8" // standard input (motherboard)
40030      // 0x0008 - "dil9" // standard input (motherboard)
40031      // 0x0010 - "dil10" // standard input (motherboard)
40032      PORT_MODIFY("IN-18")
40033      // 0x0001 - "dil11" // standard input (motherboard)
40034      // 0x0002 - "dil12" // standard input (motherboard)
40035      // 0x0004 - "dil13" // standard input (motherboard)
40036      // 0x0008 - "dil14" // standard input (motherboard)
40037      // 0x0010 - "dil15" // standard input (motherboard)
40038      PORT_MODIFY("IN-19")
40039      // 0x0001 - "dil16" // standard input (motherboard)
40040      PORT_MODIFY("IN-20")
40041      // 0x0001 - "grnbut" // standard input (motherboard)
40042      // 0x0002 - "dorlok" // standard input (expected here)
40043      // 0x0004 - "serdor" // standard input (expected here)
40044      // 0x0008 - "cshdor" // standard input (expected here)
40045      // 0x0010 - "hopdmp" // standard input (expected here)
4004640046INPUT_PORTS_END
4004740047
4004840048// PR3034 AWP MANIC MINER SCORP4         PR3004 MANIC MINER SOUNDS11       MANIC MINER S.SITE
r31373r31374
4007240072}
4007340073
4007440074INPUT_PORTS_START( sc4mmm ) // this structure is generated
40075        PORT_INCLUDE( sc4_base )
40076        PORT_MODIFY("IN-1")
40077        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
40078        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
40079        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
40080        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
40081        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
40082        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
40083        PORT_MODIFY("IN-2")
40084        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
40085        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("tk fea")
40086        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
40087        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40088        PORT_MODIFY("IN-3")
40089        // 0x0004 - "stk3" // standard input (expected here)
40090        // 0x0008 - "stk1" // standard input (expected here)
40091        // 0x0010 - "stk2" // standard input (expected here)
40092        PORT_MODIFY("IN-5")
40093        // 0x0001 - "jp 1" // standard input (expected here)
40094        // 0x0002 - "jp 2" // standard input (expected here)
40095        // 0x0004 - "jp 3" // standard input (expected here)
40096        // 0x0008 - "jp 4" // standard input (expected here)
40097        PORT_MODIFY("IN-6")
40098        // 0x0001 - "pc 1" // standard input (expected here)
40099        // 0x0002 - "pc 2" // standard input (expected here)
40100        // 0x0004 - "pc 3" // standard input (expected here)
40101        // 0x0008 - "pc 4" // standard input (expected here)
40102        PORT_MODIFY("IN-8")
40103        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bon ga")
40104        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
40105        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("take m")
40106        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("p supe")
40107        PORT_MODIFY("IN-16")
40108        // 0x0001 - "dil 1" // standard input (motherboard)
40109        // 0x0002 - "dil 2" // standard input (motherboard)
40110        // 0x0004 - "dil 3" // standard input (motherboard)
40111        // 0x0008 - "dil 4" // standard input (motherboard)
40112        // 0x0010 - "dil 5" // standard input (motherboard)
40113        // 0x0100 - "top up" // known extended input, usually 'top up'
40114        PORT_MODIFY("IN-17")
40115        // 0x0001 - "dil 6" // standard input (motherboard)
40116        // 0x0002 - "dil 7" // standard input (motherboard)
40117        // 0x0004 - "dil 8" // standard input (motherboard)
40118        // 0x0008 - "dil 9" // standard input (motherboard)
40119        // 0x0010 - "dil10" // standard input (motherboard)
40120        PORT_MODIFY("IN-18")
40121        // 0x0001 - "dil11" // standard input (motherboard)
40122        // 0x0002 - "dil12" // standard input (motherboard)
40123        // 0x0004 - "dil13" // standard input (motherboard)
40124        // 0x0008 - "dil14" // standard input (motherboard)
40125        // 0x0010 - "dil15" // standard input (motherboard)
40126        PORT_MODIFY("IN-19")
40127        // 0x0001 - "dil16" // standard input (motherboard)
40128        PORT_MODIFY("IN-20")
40129        // 0x0001 - "test" // standard input (motherboard)
40130        // 0x0002 - "dorlk" // standard input (expected here)
40131        // 0x0004 - "topdr" // standard input (expected here)
40132        // 0x0008 - "cshbx" // standard input (expected here)
40133        // 0x0010 - "dump" // standard input (expected here)
40075      PORT_INCLUDE( sc4_base )
40076      PORT_MODIFY("IN-1")
40077      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
40078      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
40079      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
40080      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
40081      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
40082      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
40083      PORT_MODIFY("IN-2")
40084      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
40085      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("tk fea")
40086      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
40087      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40088      PORT_MODIFY("IN-3")
40089      // 0x0004 - "stk3" // standard input (expected here)
40090      // 0x0008 - "stk1" // standard input (expected here)
40091      // 0x0010 - "stk2" // standard input (expected here)
40092      PORT_MODIFY("IN-5")
40093      // 0x0001 - "jp 1" // standard input (expected here)
40094      // 0x0002 - "jp 2" // standard input (expected here)
40095      // 0x0004 - "jp 3" // standard input (expected here)
40096      // 0x0008 - "jp 4" // standard input (expected here)
40097      PORT_MODIFY("IN-6")
40098      // 0x0001 - "pc 1" // standard input (expected here)
40099      // 0x0002 - "pc 2" // standard input (expected here)
40100      // 0x0004 - "pc 3" // standard input (expected here)
40101      // 0x0008 - "pc 4" // standard input (expected here)
40102      PORT_MODIFY("IN-8")
40103      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bon ga")
40104      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
40105      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("take m")
40106      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("p supe")
40107      PORT_MODIFY("IN-16")
40108      // 0x0001 - "dil 1" // standard input (motherboard)
40109      // 0x0002 - "dil 2" // standard input (motherboard)
40110      // 0x0004 - "dil 3" // standard input (motherboard)
40111      // 0x0008 - "dil 4" // standard input (motherboard)
40112      // 0x0010 - "dil 5" // standard input (motherboard)
40113      // 0x0100 - "top up" // known extended input, usually 'top up'
40114      PORT_MODIFY("IN-17")
40115      // 0x0001 - "dil 6" // standard input (motherboard)
40116      // 0x0002 - "dil 7" // standard input (motherboard)
40117      // 0x0004 - "dil 8" // standard input (motherboard)
40118      // 0x0008 - "dil 9" // standard input (motherboard)
40119      // 0x0010 - "dil10" // standard input (motherboard)
40120      PORT_MODIFY("IN-18")
40121      // 0x0001 - "dil11" // standard input (motherboard)
40122      // 0x0002 - "dil12" // standard input (motherboard)
40123      // 0x0004 - "dil13" // standard input (motherboard)
40124      // 0x0008 - "dil14" // standard input (motherboard)
40125      // 0x0010 - "dil15" // standard input (motherboard)
40126      PORT_MODIFY("IN-19")
40127      // 0x0001 - "dil16" // standard input (motherboard)
40128      PORT_MODIFY("IN-20")
40129      // 0x0001 - "test" // standard input (motherboard)
40130      // 0x0002 - "dorlk" // standard input (expected here)
40131      // 0x0004 - "topdr" // standard input (expected here)
40132      // 0x0008 - "cshbx" // standard input (expected here)
40133      // 0x0010 - "dump" // standard input (expected here)
4013440134INPUT_PORTS_END
4013540135
4013640136
r31373r31374
4016140161}
4016240162
4016340163INPUT_PORTS_START( sc4mmad ) // this structure is generated
40164        PORT_INCLUDE( sc4_base )
40165        PORT_MODIFY("IN-1")
40166        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
40167        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
40168        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
40169        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
40170        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stake")
40171        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
40172        PORT_MODIFY("IN-2")
40173        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
40174        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
40175        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
40176        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40177        PORT_MODIFY("IN-4")
40178        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
40179        PORT_MODIFY("IN-8")
40180        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
40181        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
40182        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
40183        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
40184        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
40185        PORT_MODIFY("IN-9")
40186        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
40187        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
40188        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
40189        PORT_MODIFY("IN-16")
40190        // 0x0001 - "dil 1" // standard input (motherboard)
40191        // 0x0002 - "dil 2" // standard input (motherboard)
40192        // 0x0004 - "dil 3" // standard input (motherboard)
40193        // 0x0008 - "dil 4" // standard input (motherboard)
40194        // 0x0010 - "dil 5" // standard input (motherboard)
40195        // 0x0100 - "topup" // known extended input, usually 'top up'
40196        PORT_MODIFY("IN-17")
40197        // 0x0001 - "dil 6" // standard input (motherboard)
40198        // 0x0002 - "dil 7" // standard input (motherboard)
40199        // 0x0004 - "dil 8" // standard input (motherboard)
40200        // 0x0008 - "dil 9" // standard input (motherboard)
40201        // 0x0010 - "dil10" // standard input (motherboard)
40202        PORT_MODIFY("IN-18")
40203        // 0x0001 - "dil11" // standard input (motherboard)
40204        // 0x0002 - "dil12" // standard input (motherboard)
40205        // 0x0004 - "dil13" // standard input (motherboard)
40206        // 0x0008 - "dil14" // standard input (motherboard)
40207        // 0x0010 - "dil15" // standard input (motherboard)
40208        PORT_MODIFY("IN-19")
40209        // 0x0001 - "dil16" // standard input (motherboard)
40210        PORT_MODIFY("IN-20")
40211        // 0x0001 - "test" // standard input (motherboard)
40212        // 0x0002 - "dorlk" // standard input (expected here)
40213        // 0x0004 - "tpdor" // standard input (expected here)
40214        // 0x0008 - "cshbx" // standard input (expected here)
40215        // 0x0010 - "deflt" // standard input (expected here)
40164      PORT_INCLUDE( sc4_base )
40165      PORT_MODIFY("IN-1")
40166      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
40167      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
40168      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
40169      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
40170      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stake")
40171      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
40172      PORT_MODIFY("IN-2")
40173      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
40174      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
40175      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
40176      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40177      PORT_MODIFY("IN-4")
40178      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
40179      PORT_MODIFY("IN-8")
40180      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
40181      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
40182      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
40183      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
40184      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
40185      PORT_MODIFY("IN-9")
40186      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
40187      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
40188      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
40189      PORT_MODIFY("IN-16")
40190      // 0x0001 - "dil 1" // standard input (motherboard)
40191      // 0x0002 - "dil 2" // standard input (motherboard)
40192      // 0x0004 - "dil 3" // standard input (motherboard)
40193      // 0x0008 - "dil 4" // standard input (motherboard)
40194      // 0x0010 - "dil 5" // standard input (motherboard)
40195      // 0x0100 - "topup" // known extended input, usually 'top up'
40196      PORT_MODIFY("IN-17")
40197      // 0x0001 - "dil 6" // standard input (motherboard)
40198      // 0x0002 - "dil 7" // standard input (motherboard)
40199      // 0x0004 - "dil 8" // standard input (motherboard)
40200      // 0x0008 - "dil 9" // standard input (motherboard)
40201      // 0x0010 - "dil10" // standard input (motherboard)
40202      PORT_MODIFY("IN-18")
40203      // 0x0001 - "dil11" // standard input (motherboard)
40204      // 0x0002 - "dil12" // standard input (motherboard)
40205      // 0x0004 - "dil13" // standard input (motherboard)
40206      // 0x0008 - "dil14" // standard input (motherboard)
40207      // 0x0010 - "dil15" // standard input (motherboard)
40208      PORT_MODIFY("IN-19")
40209      // 0x0001 - "dil16" // standard input (motherboard)
40210      PORT_MODIFY("IN-20")
40211      // 0x0001 - "test" // standard input (motherboard)
40212      // 0x0002 - "dorlk" // standard input (expected here)
40213      // 0x0004 - "tpdor" // standard input (expected here)
40214      // 0x0008 - "cshbx" // standard input (expected here)
40215      // 0x0010 - "deflt" // standard input (expected here)
4021640216INPUT_PORTS_END
4021740217
4021840218// PR2533 MONEY MADNESS         MONM SOUNDS         MONEY MADNESS
r31373r31374
4024440244}
4024540245
4024640246INPUT_PORTS_START( sc4mdm ) // this structure is generated
40247        PORT_INCLUDE( sc4_base )
40248        PORT_MODIFY("IN-1")
40249        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
40250        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
40251        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
40252        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
40253        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
40254        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
40255        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
40256        PORT_MODIFY("IN-2")
40257        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
40258        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
40259        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
40260        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40261        PORT_MODIFY("IN-3")
40262        // 0x0004 - "stk 4" // standard input (expected here)
40263        // 0x0008 - "stk 3" // standard input (expected here)
40264        // 0x0010 - "stk 2" // standard input (expected here)
40265        PORT_MODIFY("IN-5")
40266        // 0x0001 - "priz4" // standard input (expected here)
40267        // 0x0002 - "priz3" // standard input (expected here)
40268        // 0x0004 - "priz2" // standard input (expected here)
40269        // 0x0008 - "priz1" // standard input (expected here)
40270        PORT_MODIFY("IN-6")
40271        // 0x0001 - "perc1" // standard input (expected here)
40272        // 0x0002 - "perc2" // standard input (expected here)
40273        // 0x0004 - "perc3" // standard input (expected here)
40274        // 0x0008 - "perc4" // standard input (expected here)
40275        PORT_MODIFY("IN-8")
40276        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("b or b")
40277        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("pl mon")
40278        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("leave")
40279        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take")
40280        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk str")
40281        PORT_MODIFY("IN-16")
40282        // 0x0001 - "dil1" // standard input (motherboard)
40283        // 0x0002 - "dil2" // standard input (motherboard)
40284        // 0x0004 - "dil3" // standard input (motherboard)
40285        // 0x0008 - "dil4" // standard input (motherboard)
40286        // 0x0010 - "dil5" // standard input (motherboard)
40287        // 0x0100 - "top up" // known extended input, usually 'top up'
40288        PORT_MODIFY("IN-17")
40289        // 0x0001 - "dil6" // standard input (motherboard)
40290        // 0x0002 - "dil7" // standard input (motherboard)
40291        // 0x0004 - "dil8" // standard input (motherboard)
40292        // 0x0008 - "dil9" // standard input (motherboard)
40293        // 0x0010 - "dil10" // standard input (motherboard)
40294        PORT_MODIFY("IN-18")
40295        // 0x0001 - "dil11" // standard input (motherboard)
40296        // 0x0002 - "dil12" // standard input (motherboard)
40297        // 0x0004 - "dil13" // standard input (motherboard)
40298        // 0x0008 - "dil14" // standard input (motherboard)
40299        // 0x0010 - "dil15" // standard input (motherboard)
40300        PORT_MODIFY("IN-19")
40301        // 0x0001 - "dil16" // standard input (motherboard)
40302        PORT_MODIFY("IN-20")
40303        // 0x0001 - "grnbut" // standard input (motherboard)
40304        // 0x0002 - "dorlok" // standard input (expected here)
40305        // 0x0004 - "serdor" // standard input (expected here)
40306        // 0x0008 - "cshdor" // standard input (expected here)
40307        // 0x0010 - "hopdmp" // standard input (expected here)
40247      PORT_INCLUDE( sc4_base )
40248      PORT_MODIFY("IN-1")
40249      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
40250      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
40251      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
40252      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
40253      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
40254      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
40255      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
40256      PORT_MODIFY("IN-2")
40257      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
40258      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
40259      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
40260      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40261      PORT_MODIFY("IN-3")
40262      // 0x0004 - "stk 4" // standard input (expected here)
40263      // 0x0008 - "stk 3" // standard input (expected here)
40264      // 0x0010 - "stk 2" // standard input (expected here)
40265      PORT_MODIFY("IN-5")
40266      // 0x0001 - "priz4" // standard input (expected here)
40267      // 0x0002 - "priz3" // standard input (expected here)
40268      // 0x0004 - "priz2" // standard input (expected here)
40269      // 0x0008 - "priz1" // standard input (expected here)
40270      PORT_MODIFY("IN-6")
40271      // 0x0001 - "perc1" // standard input (expected here)
40272      // 0x0002 - "perc2" // standard input (expected here)
40273      // 0x0004 - "perc3" // standard input (expected here)
40274      // 0x0008 - "perc4" // standard input (expected here)
40275      PORT_MODIFY("IN-8")
40276      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("b or b")
40277      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("pl mon")
40278      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("leave")
40279      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take")
40280      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk str")
40281      PORT_MODIFY("IN-16")
40282      // 0x0001 - "dil1" // standard input (motherboard)
40283      // 0x0002 - "dil2" // standard input (motherboard)
40284      // 0x0004 - "dil3" // standard input (motherboard)
40285      // 0x0008 - "dil4" // standard input (motherboard)
40286      // 0x0010 - "dil5" // standard input (motherboard)
40287      // 0x0100 - "top up" // known extended input, usually 'top up'
40288      PORT_MODIFY("IN-17")
40289      // 0x0001 - "dil6" // standard input (motherboard)
40290      // 0x0002 - "dil7" // standard input (motherboard)
40291      // 0x0004 - "dil8" // standard input (motherboard)
40292      // 0x0008 - "dil9" // standard input (motherboard)
40293      // 0x0010 - "dil10" // standard input (motherboard)
40294      PORT_MODIFY("IN-18")
40295      // 0x0001 - "dil11" // standard input (motherboard)
40296      // 0x0002 - "dil12" // standard input (motherboard)
40297      // 0x0004 - "dil13" // standard input (motherboard)
40298      // 0x0008 - "dil14" // standard input (motherboard)
40299      // 0x0010 - "dil15" // standard input (motherboard)
40300      PORT_MODIFY("IN-19")
40301      // 0x0001 - "dil16" // standard input (motherboard)
40302      PORT_MODIFY("IN-20")
40303      // 0x0001 - "grnbut" // standard input (motherboard)
40304      // 0x0002 - "dorlok" // standard input (expected here)
40305      // 0x0004 - "serdor" // standard input (expected here)
40306      // 0x0008 - "cshdor" // standard input (expected here)
40307      // 0x0010 - "hopdmp" // standard input (expected here)
4030840308INPUT_PORTS_END
4030940309
4031040310// PR3333 AWP MONOPOLY DOUBLE MONEY S4         PR3308 MPOLY D MONEY SOUNDS11     DOUBLE MONEY  S.SITE
r31373r31374
4032840328}
4032940329
4033040330INPUT_PORTS_START( sc4mhn ) // this structure is generated
40331        PORT_INCLUDE( sc4_base )
40332        PORT_MODIFY("IN-1")
40333        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
40334        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
40335        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
40336        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
40337        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
40338        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
40339        PORT_MODIFY("IN-2")
40340        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
40341        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
40342        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
40343        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
40344        PORT_MODIFY("IN-3")
40345        // 0x0004 - "stk3" // standard input (expected here)
40346        // 0x0008 - "stk1" // standard input (expected here)
40347        // 0x0010 - "stk2" // standard input (expected here)
40348        PORT_MODIFY("IN-5")
40349        // 0x0001 - "jp 1" // standard input (expected here)
40350        // 0x0002 - "jp 2" // standard input (expected here)
40351        // 0x0004 - "jp 3" // standard input (expected here)
40352        // 0x0008 - "jp 4" // standard input (expected here)
40353        PORT_MODIFY("IN-6")
40354        // 0x0001 - "pc 1" // standard input (expected here)
40355        // 0x0002 - "pc 2" // standard input (expected here)
40356        // 0x0004 - "pc 3" // standard input (expected here)
40357        // 0x0008 - "pc 4" // standard input (expected here)
40358        PORT_MODIFY("IN-8")
40359        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("f lo")
40360        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
40361        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c lo")
40362        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shot")
40363        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c hi")
40364        PORT_MODIFY("IN-9")
40365        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
40366        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("f hi")
40367        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("step")
40368        PORT_MODIFY("IN-16")
40369        // 0x0001 - "dil 1" // standard input (motherboard)
40370        // 0x0002 - "dil 2" // standard input (motherboard)
40371        // 0x0004 - "dil 3" // standard input (motherboard)
40372        // 0x0008 - "dil 4" // standard input (motherboard)
40373        // 0x0010 - "dil 5" // standard input (motherboard)
40374        // 0x0100 - "topup" // known extended input, usually 'top up'
40375        PORT_MODIFY("IN-17")
40376        // 0x0001 - "dil 6" // standard input (motherboard)
40377        // 0x0002 - "dil 7" // standard input (motherboard)
40378        // 0x0004 - "dil 8" // standard input (motherboard)
40379        // 0x0008 - "dil 9" // standard input (motherboard)
40380        // 0x0010 - "dil10" // standard input (motherboard)
40381        PORT_MODIFY("IN-18")
40382        // 0x0001 - "dil11" // standard input (motherboard)
40383        // 0x0002 - "dil12" // standard input (motherboard)
40384        // 0x0004 - "dil13" // standard input (motherboard)
40385        // 0x0008 - "dil14" // standard input (motherboard)
40386        // 0x0010 - "dil15" // standard input (motherboard)
40387        PORT_MODIFY("IN-19")
40388        // 0x0001 - "dil16" // standard input (motherboard)
40389        PORT_MODIFY("IN-20")
40390        // 0x0001 - "test" // standard input (motherboard)
40391        // 0x0002 - "dorlk" // standard input (expected here)
40392        // 0x0004 - "topdr" // standard input (expected here)
40393        // 0x0008 - "cshbx" // standard input (expected here)
40394        // 0x0010 - "dump" // standard input (expected here)
40331      PORT_INCLUDE( sc4_base )
40332      PORT_MODIFY("IN-1")
40333      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
40334      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
40335      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
40336      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
40337      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
40338      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
40339      PORT_MODIFY("IN-2")
40340      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
40341      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
40342      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
40343      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
40344      PORT_MODIFY("IN-3")
40345      // 0x0004 - "stk3" // standard input (expected here)
40346      // 0x0008 - "stk1" // standard input (expected here)
40347      // 0x0010 - "stk2" // standard input (expected here)
40348      PORT_MODIFY("IN-5")
40349      // 0x0001 - "jp 1" // standard input (expected here)
40350      // 0x0002 - "jp 2" // standard input (expected here)
40351      // 0x0004 - "jp 3" // standard input (expected here)
40352      // 0x0008 - "jp 4" // standard input (expected here)
40353      PORT_MODIFY("IN-6")
40354      // 0x0001 - "pc 1" // standard input (expected here)
40355      // 0x0002 - "pc 2" // standard input (expected here)
40356      // 0x0004 - "pc 3" // standard input (expected here)
40357      // 0x0008 - "pc 4" // standard input (expected here)
40358      PORT_MODIFY("IN-8")
40359      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("f lo")
40360      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
40361      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c lo")
40362      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shot")
40363      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c hi")
40364      PORT_MODIFY("IN-9")
40365      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
40366      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("f hi")
40367      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("step")
40368      PORT_MODIFY("IN-16")
40369      // 0x0001 - "dil 1" // standard input (motherboard)
40370      // 0x0002 - "dil 2" // standard input (motherboard)
40371      // 0x0004 - "dil 3" // standard input (motherboard)
40372      // 0x0008 - "dil 4" // standard input (motherboard)
40373      // 0x0010 - "dil 5" // standard input (motherboard)
40374      // 0x0100 - "topup" // known extended input, usually 'top up'
40375      PORT_MODIFY("IN-17")
40376      // 0x0001 - "dil 6" // standard input (motherboard)
40377      // 0x0002 - "dil 7" // standard input (motherboard)
40378      // 0x0004 - "dil 8" // standard input (motherboard)
40379      // 0x0008 - "dil 9" // standard input (motherboard)
40380      // 0x0010 - "dil10" // standard input (motherboard)
40381      PORT_MODIFY("IN-18")
40382      // 0x0001 - "dil11" // standard input (motherboard)
40383      // 0x0002 - "dil12" // standard input (motherboard)
40384      // 0x0004 - "dil13" // standard input (motherboard)
40385      // 0x0008 - "dil14" // standard input (motherboard)
40386      // 0x0010 - "dil15" // standard input (motherboard)
40387      PORT_MODIFY("IN-19")
40388      // 0x0001 - "dil16" // standard input (motherboard)
40389      PORT_MODIFY("IN-20")
40390      // 0x0001 - "test" // standard input (motherboard)
40391      // 0x0002 - "dorlk" // standard input (expected here)
40392      // 0x0004 - "topdr" // standard input (expected here)
40393      // 0x0008 - "cshbx" // standard input (expected here)
40394      // 0x0010 - "dump" // standard input (expected here)
4039540395INPUT_PORTS_END
4039640396
4039740397// PR2380 MONOPOLY HERE AND NOW         MR2R SOUNDS         NITH
r31373r31374
4041640416}
4041740417
4041840418INPUT_PORTS_START( sc4mhp ) // this structure is generated
40419        PORT_INCLUDE( sc4_base )
40420        PORT_MODIFY("IN-1")
40421        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
40422        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
40423        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
40424        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
40425        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hot p")
40426        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
40427        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
40428        PORT_MODIFY("IN-2")
40429        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
40430        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ch stk")
40431        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
40432        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40433        PORT_MODIFY("IN-3")
40434        // 0x0004 - "stk 4" // standard input (expected here)
40435        // 0x0008 - "stk 3" // standard input (expected here)
40436        // 0x0010 - "stk 2" // standard input (expected here)
40437        PORT_MODIFY("IN-5")
40438        // 0x0001 - "priz4" // standard input (expected here)
40439        // 0x0002 - "priz3" // standard input (expected here)
40440        // 0x0004 - "priz2" // standard input (expected here)
40441        // 0x0008 - "priz1" // standard input (expected here)
40442        PORT_MODIFY("IN-6")
40443        // 0x0001 - "perc1" // standard input (expected here)
40444        // 0x0002 - "perc2" // standard input (expected here)
40445        // 0x0004 - "perc3" // standard input (expected here)
40446        // 0x0008 - "perc4" // standard input (expected here)
40447        PORT_MODIFY("IN-8")
40448        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("streak")
40449        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b or b")
40450        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("refuse")
40451        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("sell")
40452        PORT_MODIFY("IN-16")
40453        // 0x0001 - "dil1" // standard input (motherboard)
40454        // 0x0002 - "dil2" // standard input (motherboard)
40455        // 0x0004 - "dil3" // standard input (motherboard)
40456        // 0x0008 - "dil4" // standard input (motherboard)
40457        // 0x0010 - "dil5" // standard input (motherboard)
40458        // 0x0100 - "top up" // known extended input, usually 'top up'
40459        PORT_MODIFY("IN-17")
40460        // 0x0001 - "dil6" // standard input (motherboard)
40461        // 0x0002 - "dil7" // standard input (motherboard)
40462        // 0x0004 - "dil8" // standard input (motherboard)
40463        // 0x0008 - "dil9" // standard input (motherboard)
40464        // 0x0010 - "dil10" // standard input (motherboard)
40465        PORT_MODIFY("IN-18")
40466        // 0x0001 - "dil11" // standard input (motherboard)
40467        // 0x0002 - "dil12" // standard input (motherboard)
40468        // 0x0004 - "dil13" // standard input (motherboard)
40469        // 0x0008 - "dil14" // standard input (motherboard)
40470        // 0x0010 - "dil15" // standard input (motherboard)
40471        PORT_MODIFY("IN-19")
40472        // 0x0001 - "dil16" // standard input (motherboard)
40473        PORT_MODIFY("IN-20")
40474        // 0x0001 - "grnbut" // standard input (motherboard)
40475        // 0x0002 - "dorlok" // standard input (expected here)
40476        // 0x0004 - "serdor" // standard input (expected here)
40477        // 0x0008 - "cshdor" // standard input (expected here)
40478        // 0x0010 - "hopdmp" // standard input (expected here)
40419      PORT_INCLUDE( sc4_base )
40420      PORT_MODIFY("IN-1")
40421      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
40422      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
40423      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
40424      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
40425      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hot p")
40426      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
40427      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
40428      PORT_MODIFY("IN-2")
40429      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
40430      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ch stk")
40431      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
40432      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40433      PORT_MODIFY("IN-3")
40434      // 0x0004 - "stk 4" // standard input (expected here)
40435      // 0x0008 - "stk 3" // standard input (expected here)
40436      // 0x0010 - "stk 2" // standard input (expected here)
40437      PORT_MODIFY("IN-5")
40438      // 0x0001 - "priz4" // standard input (expected here)
40439      // 0x0002 - "priz3" // standard input (expected here)
40440      // 0x0004 - "priz2" // standard input (expected here)
40441      // 0x0008 - "priz1" // standard input (expected here)
40442      PORT_MODIFY("IN-6")
40443      // 0x0001 - "perc1" // standard input (expected here)
40444      // 0x0002 - "perc2" // standard input (expected here)
40445      // 0x0004 - "perc3" // standard input (expected here)
40446      // 0x0008 - "perc4" // standard input (expected here)
40447      PORT_MODIFY("IN-8")
40448      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("streak")
40449      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b or b")
40450      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("refuse")
40451      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("sell")
40452      PORT_MODIFY("IN-16")
40453      // 0x0001 - "dil1" // standard input (motherboard)
40454      // 0x0002 - "dil2" // standard input (motherboard)
40455      // 0x0004 - "dil3" // standard input (motherboard)
40456      // 0x0008 - "dil4" // standard input (motherboard)
40457      // 0x0010 - "dil5" // standard input (motherboard)
40458      // 0x0100 - "top up" // known extended input, usually 'top up'
40459      PORT_MODIFY("IN-17")
40460      // 0x0001 - "dil6" // standard input (motherboard)
40461      // 0x0002 - "dil7" // standard input (motherboard)
40462      // 0x0004 - "dil8" // standard input (motherboard)
40463      // 0x0008 - "dil9" // standard input (motherboard)
40464      // 0x0010 - "dil10" // standard input (motherboard)
40465      PORT_MODIFY("IN-18")
40466      // 0x0001 - "dil11" // standard input (motherboard)
40467      // 0x0002 - "dil12" // standard input (motherboard)
40468      // 0x0004 - "dil13" // standard input (motherboard)
40469      // 0x0008 - "dil14" // standard input (motherboard)
40470      // 0x0010 - "dil15" // standard input (motherboard)
40471      PORT_MODIFY("IN-19")
40472      // 0x0001 - "dil16" // standard input (motherboard)
40473      PORT_MODIFY("IN-20")
40474      // 0x0001 - "grnbut" // standard input (motherboard)
40475      // 0x0002 - "dorlok" // standard input (expected here)
40476      // 0x0004 - "serdor" // standard input (expected here)
40477      // 0x0008 - "cshdor" // standard input (expected here)
40478      // 0x0010 - "hopdmp" // standard input (expected here)
4047940479INPUT_PORTS_END
4048040480
4048140481// PR2345 AWP MONOPOLY HOT PROPERTY S4         PR2345 HOT PROPERTY SOUNDS11      HOT PROPERTY  S.SITE
r31373r31374
4051340513}
4051440514
4051540515INPUT_PORTS_START( sc4mmb ) // this structure is generated
40516        PORT_INCLUDE( sc4_base )
40517        PORT_MODIFY("IN-1")
40518        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
40519        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
40520        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
40521        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
40522        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
40523        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
40524        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
40525        PORT_MODIFY("IN-2")
40526        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake")
40527        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("takfet")
40528        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("trnsfr")
40529        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40530        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
40531        PORT_MODIFY("IN-5")
40532        // 0x0001 - "priz4" // standard input (expected here)
40533        // 0x0002 - "priz3" // standard input (expected here)
40534        // 0x0004 - "priz2" // standard input (expected here)
40535        // 0x0008 - "priz1" // standard input (expected here)
40536        PORT_MODIFY("IN-6")
40537        // 0x0001 - "perc1" // standard input (expected here)
40538        // 0x0002 - "perc2" // standard input (expected here)
40539        // 0x0004 - "perc3" // standard input (expected here)
40540        // 0x0008 - "perc4" // standard input (expected here)
40541        PORT_MODIFY("IN-8")
40542        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("sneakp")
40543        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("gamfet")
40544        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("gambon")
40545        PORT_MODIFY("IN-16")
40546        // 0x0001 - "dil1" // standard input (motherboard)
40547        // 0x0002 - "dil2" // standard input (motherboard)
40548        // 0x0004 - "dil3" // standard input (motherboard)
40549        // 0x0008 - "dil4" // standard input (motherboard)
40550        // 0x0010 - "dil5" // standard input (motherboard)
40551        // 0x0100 - "top up" // known extended input, usually 'top up'
40552        PORT_MODIFY("IN-17")
40553        // 0x0001 - "dil6" // standard input (motherboard)
40554        // 0x0002 - "dil7" // standard input (motherboard)
40555        // 0x0004 - "dil8" // standard input (motherboard)
40556        // 0x0008 - "dil9" // standard input (motherboard)
40557        // 0x0010 - "dil10" // standard input (motherboard)
40558        PORT_MODIFY("IN-18")
40559        // 0x0001 - "dil11" // standard input (motherboard)
40560        // 0x0002 - "dil12" // standard input (motherboard)
40561        // 0x0004 - "dil13" // standard input (motherboard)
40562        // 0x0008 - "dil14" // standard input (motherboard)
40563        // 0x0010 - "dil15" // standard input (motherboard)
40564        PORT_MODIFY("IN-19")
40565        // 0x0001 - "dil16" // standard input (motherboard)
40566        PORT_MODIFY("IN-20")
40567        // 0x0001 - "grnbut" // standard input (motherboard)
40568        // 0x0002 - "dorlok" // standard input (expected here)
40569        // 0x0004 - "serdor" // standard input (expected here)
40570        // 0x0008 - "cshdor" // standard input (expected here)
40571        // 0x0010 - "hopdmp" // standard input (expected here)
40516      PORT_INCLUDE( sc4_base )
40517      PORT_MODIFY("IN-1")
40518      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
40519      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
40520      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
40521      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
40522      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
40523      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
40524      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
40525      PORT_MODIFY("IN-2")
40526      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake")
40527      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("takfet")
40528      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("trnsfr")
40529      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40530      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
40531      PORT_MODIFY("IN-5")
40532      // 0x0001 - "priz4" // standard input (expected here)
40533      // 0x0002 - "priz3" // standard input (expected here)
40534      // 0x0004 - "priz2" // standard input (expected here)
40535      // 0x0008 - "priz1" // standard input (expected here)
40536      PORT_MODIFY("IN-6")
40537      // 0x0001 - "perc1" // standard input (expected here)
40538      // 0x0002 - "perc2" // standard input (expected here)
40539      // 0x0004 - "perc3" // standard input (expected here)
40540      // 0x0008 - "perc4" // standard input (expected here)
40541      PORT_MODIFY("IN-8")
40542      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("sneakp")
40543      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("gamfet")
40544      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("gambon")
40545      PORT_MODIFY("IN-16")
40546      // 0x0001 - "dil1" // standard input (motherboard)
40547      // 0x0002 - "dil2" // standard input (motherboard)
40548      // 0x0004 - "dil3" // standard input (motherboard)
40549      // 0x0008 - "dil4" // standard input (motherboard)
40550      // 0x0010 - "dil5" // standard input (motherboard)
40551      // 0x0100 - "top up" // known extended input, usually 'top up'
40552      PORT_MODIFY("IN-17")
40553      // 0x0001 - "dil6" // standard input (motherboard)
40554      // 0x0002 - "dil7" // standard input (motherboard)
40555      // 0x0004 - "dil8" // standard input (motherboard)
40556      // 0x0008 - "dil9" // standard input (motherboard)
40557      // 0x0010 - "dil10" // standard input (motherboard)
40558      PORT_MODIFY("IN-18")
40559      // 0x0001 - "dil11" // standard input (motherboard)
40560      // 0x0002 - "dil12" // standard input (motherboard)
40561      // 0x0004 - "dil13" // standard input (motherboard)
40562      // 0x0008 - "dil14" // standard input (motherboard)
40563      // 0x0010 - "dil15" // standard input (motherboard)
40564      PORT_MODIFY("IN-19")
40565      // 0x0001 - "dil16" // standard input (motherboard)
40566      PORT_MODIFY("IN-20")
40567      // 0x0001 - "grnbut" // standard input (motherboard)
40568      // 0x0002 - "dorlok" // standard input (expected here)
40569      // 0x0004 - "serdor" // standard input (expected here)
40570      // 0x0008 - "cshdor" // standard input (expected here)
40571      // 0x0010 - "hopdmp" // standard input (expected here)
4057240572INPUT_PORTS_END
4057340573
4057440574// PR1931 AWP MONOLOLY MONEY BAGS SCORP4         PR1911 MPOLY MONEYBAGS SOUNDS11   MONEYBAGS S.SITE
r31373r31374
4059240592}
4059340593
4059440594INPUT_PORTS_START( sc4mrh ) // this structure is generated
40595        PORT_INCLUDE( sc4_base )
40596        PORT_MODIFY("IN-1")
40597        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR collec")
40598        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
40599        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
40600        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
40601        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("transf")
40602        PORT_MODIFY("IN-2")
40603        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
40604        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
40605        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
40606        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40607        PORT_MODIFY("IN-3")
40608        // 0x0004 - "stk 4" // standard input (expected here)
40609        // 0x0008 - "stk 3" // standard input (expected here)
40610        // 0x0010 - "stk 2" // standard input (expected here)
40611        PORT_MODIFY("IN-4")
40612        // 0x0008 - "top up OR top up" // known extended(?) input, sometimes 'hop top'
40613        PORT_MODIFY("IN-5")
40614        // 0x0001 - "priz4" // standard input (expected here)
40615        // 0x0002 - "priz3" // standard input (expected here)
40616        // 0x0004 - "priz2" // standard input (expected here)
40617        // 0x0008 - "priz1" // standard input (expected here)
40618        PORT_MODIFY("IN-6")
40619        // 0x0001 - "perc1" // standard input (expected here)
40620        // 0x0002 - "perc2" // standard input (expected here)
40621        // 0x0004 - "perc3" // standard input (expected here)
40622        // 0x0008 - "perc4" // standard input (expected here)
40623        PORT_MODIFY("IN-16")
40624        // 0x0001 - "dil  1" // standard input (motherboard)
40625        // 0x0002 - "dil  2" // standard input (motherboard)
40626        // 0x0004 - "dil  3" // standard input (motherboard)
40627        // 0x0008 - "dil  4" // standard input (motherboard)
40628        // 0x0010 - "dil  5" // standard input (motherboard)
40629        PORT_MODIFY("IN-17")
40630        // 0x0001 - "dil  6" // standard input (motherboard)
40631        // 0x0002 - "dil  7" // standard input (motherboard)
40632        // 0x0004 - "dil  8" // standard input (motherboard)
40633        // 0x0008 - "dil  9" // standard input (motherboard)
40634        // 0x0010 - "dil 10" // standard input (motherboard)
40635        PORT_MODIFY("IN-18")
40636        // 0x0001 - "dil 11" // standard input (motherboard)
40637        // 0x0002 - "dil 12" // standard input (motherboard)
40638        // 0x0004 - "dil 13" // standard input (motherboard)
40639        // 0x0008 - "dil 14" // standard input (motherboard)
40640        // 0x0010 - "dil 15" // standard input (motherboard)
40641        PORT_MODIFY("IN-19")
40642        // 0x0001 - "dil 16" // standard input (motherboard)
40643        PORT_MODIFY("IN-20")
40644        // 0x0001 - "green OR test" // standard input (motherboard)
40645        // 0x0002 - "cshdor" // standard input (expected here)
40646        // 0x0004 - "serdor" // standard input (expected here)
40647        // 0x0008 - "hopdmp" // standard input (expected here)
40648        // 0x0010 - "serdor" // standard input (expected here)
40595      PORT_INCLUDE( sc4_base )
40596      PORT_MODIFY("IN-1")
40597      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR collec")
40598      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
40599      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
40600      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
40601      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("transf")
40602      PORT_MODIFY("IN-2")
40603      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
40604      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
40605      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
40606      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40607      PORT_MODIFY("IN-3")
40608      // 0x0004 - "stk 4" // standard input (expected here)
40609      // 0x0008 - "stk 3" // standard input (expected here)
40610      // 0x0010 - "stk 2" // standard input (expected here)
40611      PORT_MODIFY("IN-4")
40612      // 0x0008 - "top up OR top up" // known extended(?) input, sometimes 'hop top'
40613      PORT_MODIFY("IN-5")
40614      // 0x0001 - "priz4" // standard input (expected here)
40615      // 0x0002 - "priz3" // standard input (expected here)
40616      // 0x0004 - "priz2" // standard input (expected here)
40617      // 0x0008 - "priz1" // standard input (expected here)
40618      PORT_MODIFY("IN-6")
40619      // 0x0001 - "perc1" // standard input (expected here)
40620      // 0x0002 - "perc2" // standard input (expected here)
40621      // 0x0004 - "perc3" // standard input (expected here)
40622      // 0x0008 - "perc4" // standard input (expected here)
40623      PORT_MODIFY("IN-16")
40624      // 0x0001 - "dil  1" // standard input (motherboard)
40625      // 0x0002 - "dil  2" // standard input (motherboard)
40626      // 0x0004 - "dil  3" // standard input (motherboard)
40627      // 0x0008 - "dil  4" // standard input (motherboard)
40628      // 0x0010 - "dil  5" // standard input (motherboard)
40629      PORT_MODIFY("IN-17")
40630      // 0x0001 - "dil  6" // standard input (motherboard)
40631      // 0x0002 - "dil  7" // standard input (motherboard)
40632      // 0x0004 - "dil  8" // standard input (motherboard)
40633      // 0x0008 - "dil  9" // standard input (motherboard)
40634      // 0x0010 - "dil 10" // standard input (motherboard)
40635      PORT_MODIFY("IN-18")
40636      // 0x0001 - "dil 11" // standard input (motherboard)
40637      // 0x0002 - "dil 12" // standard input (motherboard)
40638      // 0x0004 - "dil 13" // standard input (motherboard)
40639      // 0x0008 - "dil 14" // standard input (motherboard)
40640      // 0x0010 - "dil 15" // standard input (motherboard)
40641      PORT_MODIFY("IN-19")
40642      // 0x0001 - "dil 16" // standard input (motherboard)
40643      PORT_MODIFY("IN-20")
40644      // 0x0001 - "green OR test" // standard input (motherboard)
40645      // 0x0002 - "cshdor" // standard input (expected here)
40646      // 0x0004 - "serdor" // standard input (expected here)
40647      // 0x0008 - "hopdmp" // standard input (expected here)
40648      // 0x0010 - "serdor" // standard input (expected here)
4064940649INPUT_PORTS_END
4065040650
4065140651// PR2363 RED HOT MONOP         MONOPOLY  ARCADE  MONO SOUNDS         MONOPOLY
r31373r31374
4067340673}
4067440674
4067540675INPUT_PORTS_START( sc4mr2r ) // this structure is generated
40676        PORT_INCLUDE( sc4_base )
40677        PORT_MODIFY("IN-1")
40678        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
40679        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
40680        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
40681        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
40682        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
40683        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
40684        PORT_MODIFY("IN-2")
40685        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
40686        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
40687        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
40688        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40689        PORT_MODIFY("IN-3")
40690        // 0x0004 - "stk3" // standard input (expected here)
40691        // 0x0008 - "stk1" // standard input (expected here)
40692        // 0x0010 - "stk2" // standard input (expected here)
40693        PORT_MODIFY("IN-5")
40694        // 0x0001 - "jp 1" // standard input (expected here)
40695        // 0x0002 - "jp 2" // standard input (expected here)
40696        // 0x0004 - "jp 3" // standard input (expected here)
40697        // 0x0008 - "jp 4" // standard input (expected here)
40698        PORT_MODIFY("IN-6")
40699        // 0x0001 - "pc 1" // standard input (expected here)
40700        // 0x0002 - "pc 2" // standard input (expected here)
40701        // 0x0004 - "pc 3" // standard input (expected here)
40702        // 0x0008 - "pc 4" // standard input (expected here)
40703        PORT_MODIFY("IN-8")
40704        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("step")
40705        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("take m")
40706        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("bon ga")
40707        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("p supe")
40708        PORT_MODIFY("IN-16")
40709        // 0x0001 - "dil 1" // standard input (motherboard)
40710        // 0x0002 - "dil 2" // standard input (motherboard)
40711        // 0x0004 - "dil 3" // standard input (motherboard)
40712        // 0x0008 - "dil 4" // standard input (motherboard)
40713        // 0x0010 - "dil 5" // standard input (motherboard)
40714        // 0x0100 - "top up" // known extended input, usually 'top up'
40715        PORT_MODIFY("IN-17")
40716        // 0x0001 - "dil 6" // standard input (motherboard)
40717        // 0x0002 - "dil 7" // standard input (motherboard)
40718        // 0x0004 - "dil 8" // standard input (motherboard)
40719        // 0x0008 - "dil 9" // standard input (motherboard)
40720        // 0x0010 - "dil10" // standard input (motherboard)
40721        PORT_MODIFY("IN-18")
40722        // 0x0001 - "dil11" // standard input (motherboard)
40723        // 0x0002 - "dil12" // standard input (motherboard)
40724        // 0x0004 - "dil13" // standard input (motherboard)
40725        // 0x0008 - "dil14" // standard input (motherboard)
40726        // 0x0010 - "dil15" // standard input (motherboard)
40727        PORT_MODIFY("IN-19")
40728        // 0x0001 - "dil16" // standard input (motherboard)
40729        PORT_MODIFY("IN-20")
40730        // 0x0001 - "test" // standard input (motherboard)
40731        // 0x0002 - "dorlk" // standard input (expected here)
40732        // 0x0004 - "topdr" // standard input (expected here)
40733        // 0x0008 - "cshbx" // standard input (expected here)
40734        // 0x0010 - "dump" // standard input (expected here)
40676      PORT_INCLUDE( sc4_base )
40677      PORT_MODIFY("IN-1")
40678      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
40679      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
40680      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
40681      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
40682      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
40683      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
40684      PORT_MODIFY("IN-2")
40685      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
40686      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
40687      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
40688      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40689      PORT_MODIFY("IN-3")
40690      // 0x0004 - "stk3" // standard input (expected here)
40691      // 0x0008 - "stk1" // standard input (expected here)
40692      // 0x0010 - "stk2" // standard input (expected here)
40693      PORT_MODIFY("IN-5")
40694      // 0x0001 - "jp 1" // standard input (expected here)
40695      // 0x0002 - "jp 2" // standard input (expected here)
40696      // 0x0004 - "jp 3" // standard input (expected here)
40697      // 0x0008 - "jp 4" // standard input (expected here)
40698      PORT_MODIFY("IN-6")
40699      // 0x0001 - "pc 1" // standard input (expected here)
40700      // 0x0002 - "pc 2" // standard input (expected here)
40701      // 0x0004 - "pc 3" // standard input (expected here)
40702      // 0x0008 - "pc 4" // standard input (expected here)
40703      PORT_MODIFY("IN-8")
40704      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("step")
40705      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("take m")
40706      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("bon ga")
40707      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("p supe")
40708      PORT_MODIFY("IN-16")
40709      // 0x0001 - "dil 1" // standard input (motherboard)
40710      // 0x0002 - "dil 2" // standard input (motherboard)
40711      // 0x0004 - "dil 3" // standard input (motherboard)
40712      // 0x0008 - "dil 4" // standard input (motherboard)
40713      // 0x0010 - "dil 5" // standard input (motherboard)
40714      // 0x0100 - "top up" // known extended input, usually 'top up'
40715      PORT_MODIFY("IN-17")
40716      // 0x0001 - "dil 6" // standard input (motherboard)
40717      // 0x0002 - "dil 7" // standard input (motherboard)
40718      // 0x0004 - "dil 8" // standard input (motherboard)
40719      // 0x0008 - "dil 9" // standard input (motherboard)
40720      // 0x0010 - "dil10" // standard input (motherboard)
40721      PORT_MODIFY("IN-18")
40722      // 0x0001 - "dil11" // standard input (motherboard)
40723      // 0x0002 - "dil12" // standard input (motherboard)
40724      // 0x0004 - "dil13" // standard input (motherboard)
40725      // 0x0008 - "dil14" // standard input (motherboard)
40726      // 0x0010 - "dil15" // standard input (motherboard)
40727      PORT_MODIFY("IN-19")
40728      // 0x0001 - "dil16" // standard input (motherboard)
40729      PORT_MODIFY("IN-20")
40730      // 0x0001 - "test" // standard input (motherboard)
40731      // 0x0002 - "dorlk" // standard input (expected here)
40732      // 0x0004 - "topdr" // standard input (expected here)
40733      // 0x0008 - "cshbx" // standard input (expected here)
40734      // 0x0010 - "dump" // standard input (expected here)
4073540735INPUT_PORTS_END
4073640736
4073740737// PR2329 MONOPOLY ROAD TO RICHES         MR2R SOUNDS          ROAD TO RICHES
r31373r31374
4075940759}
4076040760
4076140761INPUT_PORTS_START( sc4nmare ) // this structure is generated
40762        PORT_INCLUDE( sc4_base )
40763        PORT_MODIFY("IN-1")
40764        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
40765        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collct")
40766        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
40767        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
40768        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
40769        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
40770        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
40771        PORT_MODIFY("IN-2")
40772        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("hold 4")
40773        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ch stk")
40774        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("trnsfr")
40775        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40776        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
40777        PORT_MODIFY("IN-3")
40778        // 0x0004 - "stk 4" // standard input (expected here)
40779        // 0x0008 - "stk 3" // standard input (expected here)
40780        // 0x0010 - "stk 2" // standard input (expected here)
40781        PORT_MODIFY("IN-5")
40782        // 0x0001 - "priz4" // standard input (expected here)
40783        // 0x0002 - "priz3" // standard input (expected here)
40784        // 0x0004 - "priz2" // standard input (expected here)
40785        // 0x0008 - "priz1" // standard input (expected here)
40786        PORT_MODIFY("IN-6")
40787        // 0x0001 - "perc1" // standard input (expected here)
40788        // 0x0002 - "perc2" // standard input (expected here)
40789        // 0x0004 - "perc3" // standard input (expected here)
40790        // 0x0008 - "perc4" // standard input (expected here)
40791        PORT_MODIFY("IN-8")
40792        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("s or g")
40793        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("grab")
40794        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("slash")
40795        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk stk")
40796        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("d or a")
40797        PORT_MODIFY("IN-16")
40798        // 0x0001 - "dil1" // standard input (motherboard)
40799        // 0x0002 - "dil2" // standard input (motherboard)
40800        // 0x0004 - "dil3" // standard input (motherboard)
40801        // 0x0008 - "dil4" // standard input (motherboard)
40802        // 0x0010 - "dil5" // standard input (motherboard)
40803        // 0x0100 - "top up" // known extended input, usually 'top up'
40804        PORT_MODIFY("IN-17")
40805        // 0x0001 - "dil6" // standard input (motherboard)
40806        // 0x0002 - "dil7" // standard input (motherboard)
40807        // 0x0004 - "dil8" // standard input (motherboard)
40808        // 0x0008 - "dil9" // standard input (motherboard)
40809        // 0x0010 - "dil10" // standard input (motherboard)
40810        PORT_MODIFY("IN-18")
40811        // 0x0001 - "dil11" // standard input (motherboard)
40812        // 0x0002 - "dil12" // standard input (motherboard)
40813        // 0x0004 - "dil13" // standard input (motherboard)
40814        // 0x0008 - "dil14" // standard input (motherboard)
40815        // 0x0010 - "dil15" // standard input (motherboard)
40816        PORT_MODIFY("IN-19")
40817        // 0x0001 - "dil16" // standard input (motherboard)
40818        PORT_MODIFY("IN-20")
40819        // 0x0001 - "grnbut" // standard input (motherboard)
40820        // 0x0002 - "dorlok" // standard input (expected here)
40821        // 0x0004 - "serdor" // standard input (expected here)
40822        // 0x0008 - "cshdor" // standard input (expected here)
40823        // 0x0010 - "hopdmp" // standard input (expected here)
40762      PORT_INCLUDE( sc4_base )
40763      PORT_MODIFY("IN-1")
40764      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
40765      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collct")
40766      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
40767      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
40768      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
40769      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
40770      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
40771      PORT_MODIFY("IN-2")
40772      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("hold 4")
40773      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ch stk")
40774      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("trnsfr")
40775      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40776      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
40777      PORT_MODIFY("IN-3")
40778      // 0x0004 - "stk 4" // standard input (expected here)
40779      // 0x0008 - "stk 3" // standard input (expected here)
40780      // 0x0010 - "stk 2" // standard input (expected here)
40781      PORT_MODIFY("IN-5")
40782      // 0x0001 - "priz4" // standard input (expected here)
40783      // 0x0002 - "priz3" // standard input (expected here)
40784      // 0x0004 - "priz2" // standard input (expected here)
40785      // 0x0008 - "priz1" // standard input (expected here)
40786      PORT_MODIFY("IN-6")
40787      // 0x0001 - "perc1" // standard input (expected here)
40788      // 0x0002 - "perc2" // standard input (expected here)
40789      // 0x0004 - "perc3" // standard input (expected here)
40790      // 0x0008 - "perc4" // standard input (expected here)
40791      PORT_MODIFY("IN-8")
40792      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("s or g")
40793      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("grab")
40794      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("slash")
40795      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk stk")
40796      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("d or a")
40797      PORT_MODIFY("IN-16")
40798      // 0x0001 - "dil1" // standard input (motherboard)
40799      // 0x0002 - "dil2" // standard input (motherboard)
40800      // 0x0004 - "dil3" // standard input (motherboard)
40801      // 0x0008 - "dil4" // standard input (motherboard)
40802      // 0x0010 - "dil5" // standard input (motherboard)
40803      // 0x0100 - "top up" // known extended input, usually 'top up'
40804      PORT_MODIFY("IN-17")
40805      // 0x0001 - "dil6" // standard input (motherboard)
40806      // 0x0002 - "dil7" // standard input (motherboard)
40807      // 0x0004 - "dil8" // standard input (motherboard)
40808      // 0x0008 - "dil9" // standard input (motherboard)
40809      // 0x0010 - "dil10" // standard input (motherboard)
40810      PORT_MODIFY("IN-18")
40811      // 0x0001 - "dil11" // standard input (motherboard)
40812      // 0x0002 - "dil12" // standard input (motherboard)
40813      // 0x0004 - "dil13" // standard input (motherboard)
40814      // 0x0008 - "dil14" // standard input (motherboard)
40815      // 0x0010 - "dil15" // standard input (motherboard)
40816      PORT_MODIFY("IN-19")
40817      // 0x0001 - "dil16" // standard input (motherboard)
40818      PORT_MODIFY("IN-20")
40819      // 0x0001 - "grnbut" // standard input (motherboard)
40820      // 0x0002 - "dorlok" // standard input (expected here)
40821      // 0x0004 - "serdor" // standard input (expected here)
40822      // 0x0008 - "cshdor" // standard input (expected here)
40823      // 0x0010 - "hopdmp" // standard input (expected here)
4082440824INPUT_PORTS_END
4082540825
4082640826// PR3032 AWP NIGHTMARE ON ELM STREET S4         PR3002 ELM STREET SOUNDS11        NIGHTMARE ELM ST  S.SITE
r31373r31374
4084740847}
4084840848
4084940849INPUT_PORTS_START( sc4potp ) // this structure is generated
40850        PORT_INCLUDE( sc4_base )
40851        PORT_MODIFY("IN-1")
40852        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
40853        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
40854        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
40855        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
40856        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
40857        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
40858        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
40859        PORT_MODIFY("IN-2")
40860        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
40861        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
40862        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
40863        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40864        PORT_MODIFY("IN-3")
40865        // 0x0004 - "stk 4" // standard input (expected here)
40866        // 0x0008 - "stk 3" // standard input (expected here)
40867        // 0x0010 - "stk 2" // standard input (expected here)
40868        PORT_MODIFY("IN-4")
40869        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
40870        PORT_MODIFY("IN-5")
40871        // 0x0001 - "priz4" // standard input (expected here)
40872        // 0x0002 - "priz3" // standard input (expected here)
40873        // 0x0004 - "priz2" // standard input (expected here)
40874        // 0x0008 - "priz1" // standard input (expected here)
40875        PORT_MODIFY("IN-6")
40876        // 0x0001 - "perc1" // standard input (expected here)
40877        // 0x0002 - "perc2" // standard input (expected here)
40878        // 0x0004 - "perc3" // standard input (expected here)
40879        // 0x0008 - "perc4" // standard input (expected here)
40880        PORT_MODIFY("IN-8")
40881        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
40882        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c feat")
40883        PORT_MODIFY("IN-16")
40884        // 0x0001 - "dil1" // standard input (motherboard)
40885        // 0x0002 - "dil2" // standard input (motherboard)
40886        // 0x0004 - "dil3" // standard input (motherboard)
40887        // 0x0008 - "dil4" // standard input (motherboard)
40888        // 0x0010 - "dil5" // standard input (motherboard)
40889        PORT_MODIFY("IN-17")
40890        // 0x0001 - "dil6" // standard input (motherboard)
40891        // 0x0002 - "dil7" // standard input (motherboard)
40892        // 0x0004 - "dil8" // standard input (motherboard)
40893        // 0x0008 - "dil9" // standard input (motherboard)
40894        // 0x0010 - "dil10" // standard input (motherboard)
40895        PORT_MODIFY("IN-18")
40896        // 0x0001 - "dil11" // standard input (motherboard)
40897        // 0x0002 - "dil12" // standard input (motherboard)
40898        // 0x0004 - "dil13" // standard input (motherboard)
40899        // 0x0008 - "dil14" // standard input (motherboard)
40900        // 0x0010 - "dil15" // standard input (motherboard)
40901        PORT_MODIFY("IN-19")
40902        // 0x0001 - "dil16" // standard input (motherboard)
40903        PORT_MODIFY("IN-20")
40904        // 0x0001 - "grnbut" // standard input (motherboard)
40905        // 0x0002 - "dorlok" // standard input (expected here)
40906        // 0x0004 - "serdor" // standard input (expected here)
40907        // 0x0008 - "cshdor" // standard input (expected here)
40908        // 0x0010 - "hopdmp" // standard input (expected here)
40850      PORT_INCLUDE( sc4_base )
40851      PORT_MODIFY("IN-1")
40852      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
40853      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
40854      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
40855      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
40856      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
40857      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
40858      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
40859      PORT_MODIFY("IN-2")
40860      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
40861      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
40862      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
40863      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40864      PORT_MODIFY("IN-3")
40865      // 0x0004 - "stk 4" // standard input (expected here)
40866      // 0x0008 - "stk 3" // standard input (expected here)
40867      // 0x0010 - "stk 2" // standard input (expected here)
40868      PORT_MODIFY("IN-4")
40869      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
40870      PORT_MODIFY("IN-5")
40871      // 0x0001 - "priz4" // standard input (expected here)
40872      // 0x0002 - "priz3" // standard input (expected here)
40873      // 0x0004 - "priz2" // standard input (expected here)
40874      // 0x0008 - "priz1" // standard input (expected here)
40875      PORT_MODIFY("IN-6")
40876      // 0x0001 - "perc1" // standard input (expected here)
40877      // 0x0002 - "perc2" // standard input (expected here)
40878      // 0x0004 - "perc3" // standard input (expected here)
40879      // 0x0008 - "perc4" // standard input (expected here)
40880      PORT_MODIFY("IN-8")
40881      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
40882      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c feat")
40883      PORT_MODIFY("IN-16")
40884      // 0x0001 - "dil1" // standard input (motherboard)
40885      // 0x0002 - "dil2" // standard input (motherboard)
40886      // 0x0004 - "dil3" // standard input (motherboard)
40887      // 0x0008 - "dil4" // standard input (motherboard)
40888      // 0x0010 - "dil5" // standard input (motherboard)
40889      PORT_MODIFY("IN-17")
40890      // 0x0001 - "dil6" // standard input (motherboard)
40891      // 0x0002 - "dil7" // standard input (motherboard)
40892      // 0x0004 - "dil8" // standard input (motherboard)
40893      // 0x0008 - "dil9" // standard input (motherboard)
40894      // 0x0010 - "dil10" // standard input (motherboard)
40895      PORT_MODIFY("IN-18")
40896      // 0x0001 - "dil11" // standard input (motherboard)
40897      // 0x0002 - "dil12" // standard input (motherboard)
40898      // 0x0004 - "dil13" // standard input (motherboard)
40899      // 0x0008 - "dil14" // standard input (motherboard)
40900      // 0x0010 - "dil15" // standard input (motherboard)
40901      PORT_MODIFY("IN-19")
40902      // 0x0001 - "dil16" // standard input (motherboard)
40903      PORT_MODIFY("IN-20")
40904      // 0x0001 - "grnbut" // standard input (motherboard)
40905      // 0x0002 - "dorlok" // standard input (expected here)
40906      // 0x0004 - "serdor" // standard input (expected here)
40907      // 0x0008 - "cshdor" // standard input (expected here)
40908      // 0x0010 - "hopdmp" // standard input (expected here)
4090940909INPUT_PORTS_END
4091040910
4091140911// PR1612 PICK OF THE PACK         PR1612 PICK OF THE PACK SOUNDS11  PICK OF THE PACK  S.SITE
r31373r31374
4091440914
4091540915
4091640916INPUT_PORTS_START( sc4ppcr ) // this structure is generated
40917        PORT_INCLUDE( sc4_base )
40918        PORT_MODIFY("IN-1")
40919        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR colect")
40920        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
40921        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
40922        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
40923        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("autopl")
40924        PORT_MODIFY("IN-2")
40925        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
40926        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
40927        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40928        PORT_MODIFY("IN-3")
40929        // 0x0004 - "stk 4" // standard input (expected here)
40930        // 0x0008 - "stk 3" // standard input (expected here)
40931        // 0x0010 - "stk 2" // standard input (expected here)
40932        PORT_MODIFY("IN-4")
40933        // 0x0008 - "top up" // known extended(?) input, sometimes 'hop top'
40934        PORT_MODIFY("IN-5")
40935        // 0x0001 - "priz4" // standard input (expected here)
40936        // 0x0002 - "priz3" // standard input (expected here)
40937        // 0x0004 - "priz2" // standard input (expected here)
40938        // 0x0008 - "priz1" // standard input (expected here)
40939        PORT_MODIFY("IN-6")
40940        // 0x0001 - "perc1" // standard input (expected here)
40941        // 0x0002 - "perc2" // standard input (expected here)
40942        // 0x0004 - "perc3" // standard input (expected here)
40943        // 0x0008 - "perc4" // standard input (expected here)
40944        PORT_MODIFY("IN-16")
40945        // 0x0001 - "dil  1" // standard input (motherboard)
40946        // 0x0002 - "dil  2" // standard input (motherboard)
40947        // 0x0004 - "dil  3" // standard input (motherboard)
40948        // 0x0008 - "dil  4" // standard input (motherboard)
40949        // 0x0010 - "dil  5" // standard input (motherboard)
40950        PORT_MODIFY("IN-17")
40951        // 0x0001 - "dil  6" // standard input (motherboard)
40952        // 0x0002 - "dil  7" // standard input (motherboard)
40953        // 0x0004 - "dil  8" // standard input (motherboard)
40954        // 0x0008 - "dil  9" // standard input (motherboard)
40955        // 0x0010 - "dil 10" // standard input (motherboard)
40956        PORT_MODIFY("IN-18")
40957        // 0x0001 - "dil 11" // standard input (motherboard)
40958        // 0x0002 - "dil 12" // standard input (motherboard)
40959        // 0x0004 - "dil 13" // standard input (motherboard)
40960        // 0x0008 - "dil 14" // standard input (motherboard)
40961        // 0x0010 - "dil 15" // standard input (motherboard)
40962        PORT_MODIFY("IN-19")
40963        // 0x0001 - "dil 16" // standard input (motherboard)
40964        PORT_MODIFY("IN-20")
40965        // 0x0001 - "test" // standard input (motherboard)
40966        // 0x0002 - "cshdor" // standard input (expected here)
40967        // 0x0004 - "serdor" // standard input (expected here)
40968        // 0x0008 - "hopdmp" // standard input (expected here)
40917      PORT_INCLUDE( sc4_base )
40918      PORT_MODIFY("IN-1")
40919      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR colect")
40920      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
40921      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
40922      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
40923      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("autopl")
40924      PORT_MODIFY("IN-2")
40925      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
40926      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
40927      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
40928      PORT_MODIFY("IN-3")
40929      // 0x0004 - "stk 4" // standard input (expected here)
40930      // 0x0008 - "stk 3" // standard input (expected here)
40931      // 0x0010 - "stk 2" // standard input (expected here)
40932      PORT_MODIFY("IN-4")
40933      // 0x0008 - "top up" // known extended(?) input, sometimes 'hop top'
40934      PORT_MODIFY("IN-5")
40935      // 0x0001 - "priz4" // standard input (expected here)
40936      // 0x0002 - "priz3" // standard input (expected here)
40937      // 0x0004 - "priz2" // standard input (expected here)
40938      // 0x0008 - "priz1" // standard input (expected here)
40939      PORT_MODIFY("IN-6")
40940      // 0x0001 - "perc1" // standard input (expected here)
40941      // 0x0002 - "perc2" // standard input (expected here)
40942      // 0x0004 - "perc3" // standard input (expected here)
40943      // 0x0008 - "perc4" // standard input (expected here)
40944      PORT_MODIFY("IN-16")
40945      // 0x0001 - "dil  1" // standard input (motherboard)
40946      // 0x0002 - "dil  2" // standard input (motherboard)
40947      // 0x0004 - "dil  3" // standard input (motherboard)
40948      // 0x0008 - "dil  4" // standard input (motherboard)
40949      // 0x0010 - "dil  5" // standard input (motherboard)
40950      PORT_MODIFY("IN-17")
40951      // 0x0001 - "dil  6" // standard input (motherboard)
40952      // 0x0002 - "dil  7" // standard input (motherboard)
40953      // 0x0004 - "dil  8" // standard input (motherboard)
40954      // 0x0008 - "dil  9" // standard input (motherboard)
40955      // 0x0010 - "dil 10" // standard input (motherboard)
40956      PORT_MODIFY("IN-18")
40957      // 0x0001 - "dil 11" // standard input (motherboard)
40958      // 0x0002 - "dil 12" // standard input (motherboard)
40959      // 0x0004 - "dil 13" // standard input (motherboard)
40960      // 0x0008 - "dil 14" // standard input (motherboard)
40961      // 0x0010 - "dil 15" // standard input (motherboard)
40962      PORT_MODIFY("IN-19")
40963      // 0x0001 - "dil 16" // standard input (motherboard)
40964      PORT_MODIFY("IN-20")
40965      // 0x0001 - "test" // standard input (motherboard)
40966      // 0x0002 - "cshdor" // standard input (expected here)
40967      // 0x0004 - "serdor" // standard input (expected here)
40968      // 0x0008 - "hopdmp" // standard input (expected here)
4096940969INPUT_PORTS_END
4097040970
4097140971// PR2279  PINK PANTHER CLOUSEAUS REVENGE         REVENGE QPS REVENGE SOUNDS
r31373r31374
4100041000}
4100141001
4100241002INPUT_PORTS_START( sc4ppctc ) // this structure is generated
41003        PORT_INCLUDE( sc4_base )
41004        PORT_MODIFY("IN-1")
41005        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
41006        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41007        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41008        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41009        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
41010        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
41011        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
41012        PORT_MODIFY("IN-2")
41013        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
41014        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
41015        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
41016        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41017        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
41018        PORT_MODIFY("IN-3")
41019        // 0x0004 - "stk 4" // standard input (expected here)
41020        // 0x0008 - "stk 3" // standard input (expected here)
41021        // 0x0010 - "stk 2" // standard input (expected here)
41022        PORT_MODIFY("IN-5")
41023        // 0x0001 - "priz4" // standard input (expected here)
41024        // 0x0002 - "priz3" // standard input (expected here)
41025        // 0x0004 - "priz2" // standard input (expected here)
41026        // 0x0008 - "priz1" // standard input (expected here)
41027        PORT_MODIFY("IN-6")
41028        // 0x0001 - "perc1" // standard input (expected here)
41029        // 0x0002 - "perc2" // standard input (expected here)
41030        // 0x0004 - "perc3" // standard input (expected here)
41031        // 0x0008 - "perc4" // standard input (expected here)
41032        PORT_MODIFY("IN-8")
41033        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("b leav")
41034        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b take")
41035        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk clu")
41036        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk bon")
41037        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("cs bus")
41038        PORT_MODIFY("IN-9")
41039        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("tk str")
41040        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("leave")
41041        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("pl ctc")
41042        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("take")
41043        PORT_MODIFY("IN-16")
41044        // 0x0001 - "dil1" // standard input (motherboard)
41045        // 0x0002 - "dil2" // standard input (motherboard)
41046        // 0x0004 - "dil3" // standard input (motherboard)
41047        // 0x0008 - "dil4" // standard input (motherboard)
41048        // 0x0010 - "dil5" // standard input (motherboard)
41049        // 0x0100 - "top up" // known extended input, usually 'top up'
41050        PORT_MODIFY("IN-17")
41051        // 0x0001 - "dil6" // standard input (motherboard)
41052        // 0x0002 - "dil7" // standard input (motherboard)
41053        // 0x0004 - "dil8" // standard input (motherboard)
41054        // 0x0008 - "dil9" // standard input (motherboard)
41055        // 0x0010 - "dil10" // standard input (motherboard)
41056        PORT_MODIFY("IN-18")
41057        // 0x0001 - "dil11" // standard input (motherboard)
41058        // 0x0002 - "dil12" // standard input (motherboard)
41059        // 0x0004 - "dil13" // standard input (motherboard)
41060        // 0x0008 - "dil14" // standard input (motherboard)
41061        // 0x0010 - "dil15" // standard input (motherboard)
41062        PORT_MODIFY("IN-19")
41063        // 0x0001 - "dil16" // standard input (motherboard)
41064        PORT_MODIFY("IN-20")
41065        // 0x0001 - "grnbut" // standard input (motherboard)
41066        // 0x0002 - "dorlok" // standard input (expected here)
41067        // 0x0004 - "serdor" // standard input (expected here)
41068        // 0x0008 - "cshdor" // standard input (expected here)
41069        // 0x0010 - "hopdmp" // standard input (expected here)
41003      PORT_INCLUDE( sc4_base )
41004      PORT_MODIFY("IN-1")
41005      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
41006      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41007      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41008      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41009      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
41010      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
41011      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
41012      PORT_MODIFY("IN-2")
41013      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
41014      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchag")
41015      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
41016      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41017      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
41018      PORT_MODIFY("IN-3")
41019      // 0x0004 - "stk 4" // standard input (expected here)
41020      // 0x0008 - "stk 3" // standard input (expected here)
41021      // 0x0010 - "stk 2" // standard input (expected here)
41022      PORT_MODIFY("IN-5")
41023      // 0x0001 - "priz4" // standard input (expected here)
41024      // 0x0002 - "priz3" // standard input (expected here)
41025      // 0x0004 - "priz2" // standard input (expected here)
41026      // 0x0008 - "priz1" // standard input (expected here)
41027      PORT_MODIFY("IN-6")
41028      // 0x0001 - "perc1" // standard input (expected here)
41029      // 0x0002 - "perc2" // standard input (expected here)
41030      // 0x0004 - "perc3" // standard input (expected here)
41031      // 0x0008 - "perc4" // standard input (expected here)
41032      PORT_MODIFY("IN-8")
41033      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("b leav")
41034      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b take")
41035      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk clu")
41036      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk bon")
41037      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("cs bus")
41038      PORT_MODIFY("IN-9")
41039      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("tk str")
41040      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("leave")
41041      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("pl ctc")
41042      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("take")
41043      PORT_MODIFY("IN-16")
41044      // 0x0001 - "dil1" // standard input (motherboard)
41045      // 0x0002 - "dil2" // standard input (motherboard)
41046      // 0x0004 - "dil3" // standard input (motherboard)
41047      // 0x0008 - "dil4" // standard input (motherboard)
41048      // 0x0010 - "dil5" // standard input (motherboard)
41049      // 0x0100 - "top up" // known extended input, usually 'top up'
41050      PORT_MODIFY("IN-17")
41051      // 0x0001 - "dil6" // standard input (motherboard)
41052      // 0x0002 - "dil7" // standard input (motherboard)
41053      // 0x0004 - "dil8" // standard input (motherboard)
41054      // 0x0008 - "dil9" // standard input (motherboard)
41055      // 0x0010 - "dil10" // standard input (motherboard)
41056      PORT_MODIFY("IN-18")
41057      // 0x0001 - "dil11" // standard input (motherboard)
41058      // 0x0002 - "dil12" // standard input (motherboard)
41059      // 0x0004 - "dil13" // standard input (motherboard)
41060      // 0x0008 - "dil14" // standard input (motherboard)
41061      // 0x0010 - "dil15" // standard input (motherboard)
41062      PORT_MODIFY("IN-19")
41063      // 0x0001 - "dil16" // standard input (motherboard)
41064      PORT_MODIFY("IN-20")
41065      // 0x0001 - "grnbut" // standard input (motherboard)
41066      // 0x0002 - "dorlok" // standard input (expected here)
41067      // 0x0004 - "serdor" // standard input (expected here)
41068      // 0x0008 - "cshdor" // standard input (expected here)
41069      // 0x0010 - "hopdmp" // standard input (expected here)
4107041070INPUT_PORTS_END
4107141071
4107241072// PR2407 AWP PINK PANTHER CRACK THE CODE SCORP4         PR2407 CRACK THE CODE SOUNDS11    CRACK THE CODE  S.SITE
r31373r31374
4108141081
4108241082
4108341083INPUT_PORTS_START( sc4ppdym ) // this structure is generated
41084        PORT_INCLUDE( sc4_base )
41085        PORT_MODIFY("IN-1")
41086        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR collec")
41087        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41088        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41089        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41090        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("blank")
41091        PORT_MODIFY("IN-2")
41092        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
41093        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41094        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill OR refill")
41095        PORT_MODIFY("IN-3")
41096        // 0x0004 - "stk 4" // standard input (expected here)
41097        // 0x0008 - "stk 3" // standard input (expected here)
41098        // 0x0010 - "stk 2" // standard input (expected here)
41099        PORT_MODIFY("IN-4")
41100        // 0x0008 - "top up OR top up" // known extended(?) input, sometimes 'hop top'
41101        PORT_MODIFY("IN-5")
41102        // 0x0001 - "priz4" // standard input (expected here)
41103        // 0x0002 - "priz3" // standard input (expected here)
41104        // 0x0004 - "priz2" // standard input (expected here)
41105        // 0x0008 - "priz1" // standard input (expected here)
41106        PORT_MODIFY("IN-6")
41107        // 0x0001 - "perc1" // standard input (expected here)
41108        // 0x0002 - "perc2" // standard input (expected here)
41109        // 0x0004 - "perc3" // standard input (expected here)
41110        // 0x0008 - "perc4" // standard input (expected here)
41111        PORT_MODIFY("IN-16")
41112        // 0x0001 - "dil  1" // standard input (motherboard)
41113        // 0x0002 - "dil  2" // standard input (motherboard)
41114        // 0x0004 - "dil  3" // standard input (motherboard)
41115        // 0x0008 - "dil  4" // standard input (motherboard)
41116        // 0x0010 - "dil  5" // standard input (motherboard)
41117        PORT_MODIFY("IN-17")
41118        // 0x0001 - "dil  6" // standard input (motherboard)
41119        // 0x0002 - "dil  7" // standard input (motherboard)
41120        // 0x0004 - "dil  8" // standard input (motherboard)
41121        // 0x0008 - "dil  9" // standard input (motherboard)
41122        // 0x0010 - "dil 10" // standard input (motherboard)
41123        PORT_MODIFY("IN-18")
41124        // 0x0001 - "dil 11" // standard input (motherboard)
41125        // 0x0002 - "dil 12" // standard input (motherboard)
41126        // 0x0004 - "dil 13" // standard input (motherboard)
41127        // 0x0008 - "dil 14" // standard input (motherboard)
41128        // 0x0010 - "dil 15" // standard input (motherboard)
41129        PORT_MODIFY("IN-19")
41130        // 0x0001 - "dil 16" // standard input (motherboard)
41131        PORT_MODIFY("IN-20")
41132        // 0x0001 - "test OR grnbut OR test" // standard input (motherboard)
41133        // 0x0002 - "cshdor" // standard input (expected here)
41134        // 0x0004 - "cshdor" // standard input (expected here)
41135        // 0x0008 - "hopdmp" // standard input (expected here)
41136        // 0x0010 - "serdor" // standard input (expected here)
41084      PORT_INCLUDE( sc4_base )
41085      PORT_MODIFY("IN-1")
41086      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR collec")
41087      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41088      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41089      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41090      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("blank")
41091      PORT_MODIFY("IN-2")
41092      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
41093      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41094      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill OR refill")
41095      PORT_MODIFY("IN-3")
41096      // 0x0004 - "stk 4" // standard input (expected here)
41097      // 0x0008 - "stk 3" // standard input (expected here)
41098      // 0x0010 - "stk 2" // standard input (expected here)
41099      PORT_MODIFY("IN-4")
41100      // 0x0008 - "top up OR top up" // known extended(?) input, sometimes 'hop top'
41101      PORT_MODIFY("IN-5")
41102      // 0x0001 - "priz4" // standard input (expected here)
41103      // 0x0002 - "priz3" // standard input (expected here)
41104      // 0x0004 - "priz2" // standard input (expected here)
41105      // 0x0008 - "priz1" // standard input (expected here)
41106      PORT_MODIFY("IN-6")
41107      // 0x0001 - "perc1" // standard input (expected here)
41108      // 0x0002 - "perc2" // standard input (expected here)
41109      // 0x0004 - "perc3" // standard input (expected here)
41110      // 0x0008 - "perc4" // standard input (expected here)
41111      PORT_MODIFY("IN-16")
41112      // 0x0001 - "dil  1" // standard input (motherboard)
41113      // 0x0002 - "dil  2" // standard input (motherboard)
41114      // 0x0004 - "dil  3" // standard input (motherboard)
41115      // 0x0008 - "dil  4" // standard input (motherboard)
41116      // 0x0010 - "dil  5" // standard input (motherboard)
41117      PORT_MODIFY("IN-17")
41118      // 0x0001 - "dil  6" // standard input (motherboard)
41119      // 0x0002 - "dil  7" // standard input (motherboard)
41120      // 0x0004 - "dil  8" // standard input (motherboard)
41121      // 0x0008 - "dil  9" // standard input (motherboard)
41122      // 0x0010 - "dil 10" // standard input (motherboard)
41123      PORT_MODIFY("IN-18")
41124      // 0x0001 - "dil 11" // standard input (motherboard)
41125      // 0x0002 - "dil 12" // standard input (motherboard)
41126      // 0x0004 - "dil 13" // standard input (motherboard)
41127      // 0x0008 - "dil 14" // standard input (motherboard)
41128      // 0x0010 - "dil 15" // standard input (motherboard)
41129      PORT_MODIFY("IN-19")
41130      // 0x0001 - "dil 16" // standard input (motherboard)
41131      PORT_MODIFY("IN-20")
41132      // 0x0001 - "test OR grnbut OR test" // standard input (motherboard)
41133      // 0x0002 - "cshdor" // standard input (expected here)
41134      // 0x0004 - "cshdor" // standard input (expected here)
41135      // 0x0008 - "hopdmp" // standard input (expected here)
41136      // 0x0010 - "serdor" // standard input (expected here)
4113741137INPUT_PORTS_END
4113841138
4113941139// PR2330 PINK PANTHER DYM         PINK PANTHER DYM  QPS DYMT SOUNDS         PINK PANTHER DYM    -
r31373r31374
4116641166}
4116741167
4116841168INPUT_PORTS_START( sc4pony ) // this structure is generated
41169        PORT_INCLUDE( sc4_base )
41170        PORT_MODIFY("IN-1")
41171        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
41172        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41173        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41174        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41175        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
41176        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
41177        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
41178        PORT_MODIFY("IN-2")
41179        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
41180        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41181        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41182        PORT_MODIFY("IN-3")
41183        // 0x0004 - "stk 4" // standard input (expected here)
41184        // 0x0008 - "stk 2" // standard input (expected here)
41185        // 0x0010 - "stk 3" // standard input (expected here)
41186        PORT_MODIFY("IN-5")
41187        // 0x0001 - "priz4" // standard input (expected here)
41188        // 0x0002 - "priz3" // standard input (expected here)
41189        // 0x0004 - "priz2" // standard input (expected here)
41190        // 0x0008 - "priz1" // standard input (expected here)
41191        PORT_MODIFY("IN-6")
41192        // 0x0001 - "perc1" // standard input (expected here)
41193        // 0x0002 - "perc2" // standard input (expected here)
41194        // 0x0004 - "perc3" // standard input (expected here)
41195        // 0x0008 - "perc4" // standard input (expected here)
41196        PORT_MODIFY("IN-8")
41197        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
41198        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shoot")
41199        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spins")
41200        PORT_MODIFY("IN-16")
41201        // 0x0001 - "dil1" // standard input (motherboard)
41202        // 0x0002 - "dil2" // standard input (motherboard)
41203        // 0x0004 - "dil3" // standard input (motherboard)
41204        // 0x0008 - "dil4" // standard input (motherboard)
41205        // 0x0010 - "dil5" // standard input (motherboard)
41206        // 0x0100 - "htopup" // known extended input, usually 'top up'
41207        PORT_MODIFY("IN-17")
41208        // 0x0001 - "dil6" // standard input (motherboard)
41209        // 0x0002 - "dil7" // standard input (motherboard)
41210        // 0x0004 - "dil8" // standard input (motherboard)
41211        // 0x0008 - "dil9" // standard input (motherboard)
41212        // 0x0010 - "dil10" // standard input (motherboard)
41213        PORT_MODIFY("IN-18")
41214        // 0x0001 - "dil11" // standard input (motherboard)
41215        // 0x0002 - "dil12" // standard input (motherboard)
41216        // 0x0004 - "dil13" // standard input (motherboard)
41217        // 0x0008 - "dil14" // standard input (motherboard)
41218        // 0x0010 - "dil15" // standard input (motherboard)
41219        PORT_MODIFY("IN-19")
41220        // 0x0001 - "dil16" // standard input (motherboard)
41221        PORT_MODIFY("IN-20")
41222        // 0x0001 - "grnbut" // standard input (motherboard)
41223        // 0x0002 - "dorlok" // standard input (expected here)
41224        // 0x0004 - "serdor" // standard input (expected here)
41225        // 0x0008 - "cshdor" // standard input (expected here)
41226        // 0x0010 - "hopdmp" // standard input (expected here)
41169      PORT_INCLUDE( sc4_base )
41170      PORT_MODIFY("IN-1")
41171      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
41172      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41173      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41174      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41175      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
41176      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
41177      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
41178      PORT_MODIFY("IN-2")
41179      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
41180      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41181      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41182      PORT_MODIFY("IN-3")
41183      // 0x0004 - "stk 4" // standard input (expected here)
41184      // 0x0008 - "stk 2" // standard input (expected here)
41185      // 0x0010 - "stk 3" // standard input (expected here)
41186      PORT_MODIFY("IN-5")
41187      // 0x0001 - "priz4" // standard input (expected here)
41188      // 0x0002 - "priz3" // standard input (expected here)
41189      // 0x0004 - "priz2" // standard input (expected here)
41190      // 0x0008 - "priz1" // standard input (expected here)
41191      PORT_MODIFY("IN-6")
41192      // 0x0001 - "perc1" // standard input (expected here)
41193      // 0x0002 - "perc2" // standard input (expected here)
41194      // 0x0004 - "perc3" // standard input (expected here)
41195      // 0x0008 - "perc4" // standard input (expected here)
41196      PORT_MODIFY("IN-8")
41197      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
41198      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shoot")
41199      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spins")
41200      PORT_MODIFY("IN-16")
41201      // 0x0001 - "dil1" // standard input (motherboard)
41202      // 0x0002 - "dil2" // standard input (motherboard)
41203      // 0x0004 - "dil3" // standard input (motherboard)
41204      // 0x0008 - "dil4" // standard input (motherboard)
41205      // 0x0010 - "dil5" // standard input (motherboard)
41206      // 0x0100 - "htopup" // known extended input, usually 'top up'
41207      PORT_MODIFY("IN-17")
41208      // 0x0001 - "dil6" // standard input (motherboard)
41209      // 0x0002 - "dil7" // standard input (motherboard)
41210      // 0x0004 - "dil8" // standard input (motherboard)
41211      // 0x0008 - "dil9" // standard input (motherboard)
41212      // 0x0010 - "dil10" // standard input (motherboard)
41213      PORT_MODIFY("IN-18")
41214      // 0x0001 - "dil11" // standard input (motherboard)
41215      // 0x0002 - "dil12" // standard input (motherboard)
41216      // 0x0004 - "dil13" // standard input (motherboard)
41217      // 0x0008 - "dil14" // standard input (motherboard)
41218      // 0x0010 - "dil15" // standard input (motherboard)
41219      PORT_MODIFY("IN-19")
41220      // 0x0001 - "dil16" // standard input (motherboard)
41221      PORT_MODIFY("IN-20")
41222      // 0x0001 - "grnbut" // standard input (motherboard)
41223      // 0x0002 - "dorlok" // standard input (expected here)
41224      // 0x0004 - "serdor" // standard input (expected here)
41225      // 0x0008 - "cshdor" // standard input (expected here)
41226      // 0x0010 - "hopdmp" // standard input (expected here)
4122741227INPUT_PORTS_END
4122841228
4122941229// PR1408 PONY EXPRESS         PR1408 PONY EXPRESS SOUNDS11      PONY EXPRESS  S.SITE
r31373r31374
4125141251}
4125241252
4125341253INPUT_PORTS_START( sc4popey ) // this structure is generated
41254        PORT_INCLUDE( sc4_base )
41255        PORT_MODIFY("IN-1")
41256        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
41257        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("ch stk")
41258        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
41259        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
41260        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
41261        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
41262        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
41263        PORT_MODIFY("IN-2")
41264        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ply it")
41265        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
41266        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41267        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41268        PORT_MODIFY("IN-3")
41269        // 0x0004 - "stk 4" // standard input (expected here)
41270        // 0x0008 - "stk 3" // standard input (expected here)
41271        // 0x0010 - "stk 2" // standard input (expected here)
41272        PORT_MODIFY("IN-5")
41273        // 0x0001 - "priz4" // standard input (expected here)
41274        // 0x0002 - "priz3" // standard input (expected here)
41275        // 0x0004 - "priz2" // standard input (expected here)
41276        // 0x0008 - "priz1" // standard input (expected here)
41277        PORT_MODIFY("IN-6")
41278        // 0x0001 - "perc1" // standard input (expected here)
41279        // 0x0002 - "perc2" // standard input (expected here)
41280        // 0x0004 - "perc3" // standard input (expected here)
41281        // 0x0008 - "perc4" // standard input (expected here)
41282        PORT_MODIFY("IN-8")
41283        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("streak")
41284        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("s or s")
41285        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("leave")
41286        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take")
41287        PORT_MODIFY("IN-16")
41288        // 0x0001 - "dil1" // standard input (motherboard)
41289        // 0x0002 - "dil2" // standard input (motherboard)
41290        // 0x0004 - "dil3" // standard input (motherboard)
41291        // 0x0008 - "dil4" // standard input (motherboard)
41292        // 0x0010 - "dil5" // standard input (motherboard)
41293        // 0x0100 - "top up" // known extended input, usually 'top up'
41294        PORT_MODIFY("IN-17")
41295        // 0x0001 - "dil6" // standard input (motherboard)
41296        // 0x0002 - "dil7" // standard input (motherboard)
41297        // 0x0004 - "dil8" // standard input (motherboard)
41298        // 0x0008 - "dil9" // standard input (motherboard)
41299        // 0x0010 - "dil10" // standard input (motherboard)
41300        PORT_MODIFY("IN-18")
41301        // 0x0001 - "dil11" // standard input (motherboard)
41302        // 0x0002 - "dil12" // standard input (motherboard)
41303        // 0x0004 - "dil13" // standard input (motherboard)
41304        // 0x0008 - "dil14" // standard input (motherboard)
41305        // 0x0010 - "dil15" // standard input (motherboard)
41306        PORT_MODIFY("IN-19")
41307        // 0x0001 - "dil16" // standard input (motherboard)
41308        PORT_MODIFY("IN-20")
41309        // 0x0001 - "grnbut" // standard input (motherboard)
41310        // 0x0002 - "dorlok" // standard input (expected here)
41311        // 0x0004 - "serdor" // standard input (expected here)
41312        // 0x0008 - "cshdor" // standard input (expected here)
41313        // 0x0010 - "hopdmp" // standard input (expected here)
41254      PORT_INCLUDE( sc4_base )
41255      PORT_MODIFY("IN-1")
41256      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("can/co")
41257      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("ch stk")
41258      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
41259      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
41260      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
41261      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
41262      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
41263      PORT_MODIFY("IN-2")
41264      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ply it")
41265      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
41266      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41267      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41268      PORT_MODIFY("IN-3")
41269      // 0x0004 - "stk 4" // standard input (expected here)
41270      // 0x0008 - "stk 3" // standard input (expected here)
41271      // 0x0010 - "stk 2" // standard input (expected here)
41272      PORT_MODIFY("IN-5")
41273      // 0x0001 - "priz4" // standard input (expected here)
41274      // 0x0002 - "priz3" // standard input (expected here)
41275      // 0x0004 - "priz2" // standard input (expected here)
41276      // 0x0008 - "priz1" // standard input (expected here)
41277      PORT_MODIFY("IN-6")
41278      // 0x0001 - "perc1" // standard input (expected here)
41279      // 0x0002 - "perc2" // standard input (expected here)
41280      // 0x0004 - "perc3" // standard input (expected here)
41281      // 0x0008 - "perc4" // standard input (expected here)
41282      PORT_MODIFY("IN-8")
41283      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("streak")
41284      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("s or s")
41285      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("leave")
41286      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("take")
41287      PORT_MODIFY("IN-16")
41288      // 0x0001 - "dil1" // standard input (motherboard)
41289      // 0x0002 - "dil2" // standard input (motherboard)
41290      // 0x0004 - "dil3" // standard input (motherboard)
41291      // 0x0008 - "dil4" // standard input (motherboard)
41292      // 0x0010 - "dil5" // standard input (motherboard)
41293      // 0x0100 - "top up" // known extended input, usually 'top up'
41294      PORT_MODIFY("IN-17")
41295      // 0x0001 - "dil6" // standard input (motherboard)
41296      // 0x0002 - "dil7" // standard input (motherboard)
41297      // 0x0004 - "dil8" // standard input (motherboard)
41298      // 0x0008 - "dil9" // standard input (motherboard)
41299      // 0x0010 - "dil10" // standard input (motherboard)
41300      PORT_MODIFY("IN-18")
41301      // 0x0001 - "dil11" // standard input (motherboard)
41302      // 0x0002 - "dil12" // standard input (motherboard)
41303      // 0x0004 - "dil13" // standard input (motherboard)
41304      // 0x0008 - "dil14" // standard input (motherboard)
41305      // 0x0010 - "dil15" // standard input (motherboard)
41306      PORT_MODIFY("IN-19")
41307      // 0x0001 - "dil16" // standard input (motherboard)
41308      PORT_MODIFY("IN-20")
41309      // 0x0001 - "grnbut" // standard input (motherboard)
41310      // 0x0002 - "dorlok" // standard input (expected here)
41311      // 0x0004 - "serdor" // standard input (expected here)
41312      // 0x0008 - "cshdor" // standard input (expected here)
41313      // 0x0010 - "hopdmp" // standard input (expected here)
4131441314INPUT_PORTS_END
4131541315
4131641316// PR2417 AWP POPEYE S4         PR2417 POPEYE SOUNDS11         POPEYE  S.SITE
r31373r31374
4133941339}
4134041340
4134141341INPUT_PORTS_START( sc4pwrbl ) // this structure is generated
41342        PORT_INCLUDE( sc4_base )
41343        PORT_MODIFY("IN-1")
41344        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
41345        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41346        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41347        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41348        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
41349        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
41350        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
41351        PORT_MODIFY("IN-2")
41352        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
41353        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
41354        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41355        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41356        PORT_MODIFY("IN-3")
41357        // 0x0004 - "stk 4" // standard input (expected here)
41358        // 0x0008 - "stk 2" // standard input (expected here)
41359        // 0x0010 - "stk 3" // standard input (expected here)
41360        PORT_MODIFY("IN-5")
41361        // 0x0001 - "priz4" // standard input (expected here)
41362        // 0x0002 - "priz3" // standard input (expected here)
41363        // 0x0004 - "priz2" // standard input (expected here)
41364        // 0x0008 - "priz1" // standard input (expected here)
41365        PORT_MODIFY("IN-6")
41366        // 0x0001 - "perc1" // standard input (expected here)
41367        // 0x0002 - "perc2" // standard input (expected here)
41368        // 0x0004 - "perc3" // standard input (expected here)
41369        // 0x0008 - "perc4" // standard input (expected here)
41370        PORT_MODIFY("IN-7")
41371        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_0 ) PORT_NAME("tilt")
41372        PORT_MODIFY("IN-8")
41373        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("r ball")
41374        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lose")
41375        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hole 8")
41376        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hole 7")
41377        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hole 6")
41378        PORT_MODIFY("IN-9")
41379        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hole 5")
41380        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hole 4")
41381        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("hole 3")
41382        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("hole 2")
41383        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("hole 1")
41384        PORT_MODIFY("IN-16")
41385        // 0x0001 - "dil 1" // standard input (motherboard)
41386        // 0x0002 - "dil 2" // standard input (motherboard)
41387        // 0x0004 - "dil 3" // standard input (motherboard)
41388        // 0x0008 - "dil 4" // standard input (motherboard)
41389        // 0x0010 - "dil 5" // standard input (motherboard)
41390        // 0x0100 - "htopup" // known extended input, usually 'top up'
41391        PORT_MODIFY("IN-17")
41392        // 0x0001 - "dil 6" // standard input (motherboard)
41393        // 0x0002 - "dil 7" // standard input (motherboard)
41394        // 0x0004 - "dil 8" // standard input (motherboard)
41395        // 0x0008 - "dil 9" // standard input (motherboard)
41396        // 0x0010 - "dil10" // standard input (motherboard)
41397        PORT_MODIFY("IN-18")
41398        // 0x0001 - "dil11" // standard input (motherboard)
41399        // 0x0002 - "dil12" // standard input (motherboard)
41400        // 0x0004 - "dil13" // standard input (motherboard)
41401        // 0x0008 - "dil14" // standard input (motherboard)
41402        // 0x0010 - "dil15" // standard input (motherboard)
41403        PORT_MODIFY("IN-19")
41404        // 0x0001 - "dil16" // standard input (motherboard)
41405        PORT_MODIFY("IN-20")
41406        // 0x0001 - "grnbut" // standard input (motherboard)
41407        // 0x0002 - "dorlok" // standard input (expected here)
41408        // 0x0004 - "serdor" // standard input (expected here)
41409        // 0x0008 - "cshdor" // standard input (expected here)
41410        // 0x0010 - "hopdmp" // standard input (expected here)
41342      PORT_INCLUDE( sc4_base )
41343      PORT_MODIFY("IN-1")
41344      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
41345      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41346      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41347      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41348      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
41349      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
41350      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
41351      PORT_MODIFY("IN-2")
41352      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
41353      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
41354      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41355      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41356      PORT_MODIFY("IN-3")
41357      // 0x0004 - "stk 4" // standard input (expected here)
41358      // 0x0008 - "stk 2" // standard input (expected here)
41359      // 0x0010 - "stk 3" // standard input (expected here)
41360      PORT_MODIFY("IN-5")
41361      // 0x0001 - "priz4" // standard input (expected here)
41362      // 0x0002 - "priz3" // standard input (expected here)
41363      // 0x0004 - "priz2" // standard input (expected here)
41364      // 0x0008 - "priz1" // standard input (expected here)
41365      PORT_MODIFY("IN-6")
41366      // 0x0001 - "perc1" // standard input (expected here)
41367      // 0x0002 - "perc2" // standard input (expected here)
41368      // 0x0004 - "perc3" // standard input (expected here)
41369      // 0x0008 - "perc4" // standard input (expected here)
41370      PORT_MODIFY("IN-7")
41371      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_0 ) PORT_NAME("tilt")
41372      PORT_MODIFY("IN-8")
41373      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("r ball")
41374      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lose")
41375      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hole 8")
41376      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hole 7")
41377      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hole 6")
41378      PORT_MODIFY("IN-9")
41379      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hole 5")
41380      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hole 4")
41381      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("hole 3")
41382      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("hole 2")
41383      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("hole 1")
41384      PORT_MODIFY("IN-16")
41385      // 0x0001 - "dil 1" // standard input (motherboard)
41386      // 0x0002 - "dil 2" // standard input (motherboard)
41387      // 0x0004 - "dil 3" // standard input (motherboard)
41388      // 0x0008 - "dil 4" // standard input (motherboard)
41389      // 0x0010 - "dil 5" // standard input (motherboard)
41390      // 0x0100 - "htopup" // known extended input, usually 'top up'
41391      PORT_MODIFY("IN-17")
41392      // 0x0001 - "dil 6" // standard input (motherboard)
41393      // 0x0002 - "dil 7" // standard input (motherboard)
41394      // 0x0004 - "dil 8" // standard input (motherboard)
41395      // 0x0008 - "dil 9" // standard input (motherboard)
41396      // 0x0010 - "dil10" // standard input (motherboard)
41397      PORT_MODIFY("IN-18")
41398      // 0x0001 - "dil11" // standard input (motherboard)
41399      // 0x0002 - "dil12" // standard input (motherboard)
41400      // 0x0004 - "dil13" // standard input (motherboard)
41401      // 0x0008 - "dil14" // standard input (motherboard)
41402      // 0x0010 - "dil15" // standard input (motherboard)
41403      PORT_MODIFY("IN-19")
41404      // 0x0001 - "dil16" // standard input (motherboard)
41405      PORT_MODIFY("IN-20")
41406      // 0x0001 - "grnbut" // standard input (motherboard)
41407      // 0x0002 - "dorlok" // standard input (expected here)
41408      // 0x0004 - "serdor" // standard input (expected here)
41409      // 0x0008 - "cshdor" // standard input (expected here)
41410      // 0x0010 - "hopdmp" // standard input (expected here)
4141141411INPUT_PORTS_END
4141241412
4141341413// sequel to gamball, mechanical?
r31373r31374
4143341433}
4143441434
4143541435INPUT_PORTS_START( sc4quidv ) // this structure is generated
41436        PORT_INCLUDE( sc4_base )
41437        PORT_MODIFY("IN-1")
41438        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
41439        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
41440        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
41441        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
41442        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
41443        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
41444        PORT_MODIFY("IN-2")
41445        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
41446        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
41447        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
41448        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41449        PORT_MODIFY("IN-3")
41450        // 0x0004 - "stk3" // standard input (expected here)
41451        // 0x0008 - "stk1" // standard input (expected here)
41452        // 0x0010 - "stk2" // standard input (expected here)
41453        PORT_MODIFY("IN-5")
41454        // 0x0001 - "jp 1" // standard input (expected here)
41455        // 0x0002 - "jp 2" // standard input (expected here)
41456        // 0x0004 - "jp 3" // standard input (expected here)
41457        // 0x0008 - "jp 4" // standard input (expected here)
41458        PORT_MODIFY("IN-6")
41459        // 0x0001 - "pc 1" // standard input (expected here)
41460        // 0x0002 - "pc 2" // standard input (expected here)
41461        // 0x0004 - "pc 3" // standard input (expected here)
41462        // 0x0008 - "pc 4" // standard input (expected here)
41463        PORT_MODIFY("IN-8")
41464        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk bon")
41465        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
41466        PORT_MODIFY("IN-16")
41467        // 0x0001 - "dil 1" // standard input (motherboard)
41468        // 0x0002 - "dil 2" // standard input (motherboard)
41469        // 0x0004 - "dil 3" // standard input (motherboard)
41470        // 0x0008 - "dil 4" // standard input (motherboard)
41471        // 0x0010 - "dil 5" // standard input (motherboard)
41472        // 0x0100 - "top up" // known extended input, usually 'top up'
41473        PORT_MODIFY("IN-17")
41474        // 0x0001 - "dil 6" // standard input (motherboard)
41475        // 0x0002 - "dil 7" // standard input (motherboard)
41476        // 0x0004 - "dil 8" // standard input (motherboard)
41477        // 0x0008 - "dil 9" // standard input (motherboard)
41478        // 0x0010 - "dil10" // standard input (motherboard)
41479        PORT_MODIFY("IN-18")
41480        // 0x0001 - "dil11" // standard input (motherboard)
41481        // 0x0002 - "dil12" // standard input (motherboard)
41482        // 0x0004 - "dil13" // standard input (motherboard)
41483        // 0x0008 - "dil14" // standard input (motherboard)
41484        // 0x0010 - "dil15" // standard input (motherboard)
41485        PORT_MODIFY("IN-19")
41486        // 0x0001 - "dil16" // standard input (motherboard)
41487        PORT_MODIFY("IN-20")
41488        // 0x0001 - "test OR test" // standard input (motherboard)
41489        // 0x0002 - "dorlk" // standard input (expected here)
41490        // 0x0004 - "topdr" // standard input (expected here)
41491        // 0x0008 - "cshbx" // standard input (expected here)
41492        // 0x0010 - "dump" // standard input (expected here)
41436      PORT_INCLUDE( sc4_base )
41437      PORT_MODIFY("IN-1")
41438      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
41439      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
41440      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
41441      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
41442      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
41443      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
41444      PORT_MODIFY("IN-2")
41445      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
41446      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
41447      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
41448      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41449      PORT_MODIFY("IN-3")
41450      // 0x0004 - "stk3" // standard input (expected here)
41451      // 0x0008 - "stk1" // standard input (expected here)
41452      // 0x0010 - "stk2" // standard input (expected here)
41453      PORT_MODIFY("IN-5")
41454      // 0x0001 - "jp 1" // standard input (expected here)
41455      // 0x0002 - "jp 2" // standard input (expected here)
41456      // 0x0004 - "jp 3" // standard input (expected here)
41457      // 0x0008 - "jp 4" // standard input (expected here)
41458      PORT_MODIFY("IN-6")
41459      // 0x0001 - "pc 1" // standard input (expected here)
41460      // 0x0002 - "pc 2" // standard input (expected here)
41461      // 0x0004 - "pc 3" // standard input (expected here)
41462      // 0x0008 - "pc 4" // standard input (expected here)
41463      PORT_MODIFY("IN-8")
41464      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk bon")
41465      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
41466      PORT_MODIFY("IN-16")
41467      // 0x0001 - "dil 1" // standard input (motherboard)
41468      // 0x0002 - "dil 2" // standard input (motherboard)
41469      // 0x0004 - "dil 3" // standard input (motherboard)
41470      // 0x0008 - "dil 4" // standard input (motherboard)
41471      // 0x0010 - "dil 5" // standard input (motherboard)
41472      // 0x0100 - "top up" // known extended input, usually 'top up'
41473      PORT_MODIFY("IN-17")
41474      // 0x0001 - "dil 6" // standard input (motherboard)
41475      // 0x0002 - "dil 7" // standard input (motherboard)
41476      // 0x0004 - "dil 8" // standard input (motherboard)
41477      // 0x0008 - "dil 9" // standard input (motherboard)
41478      // 0x0010 - "dil10" // standard input (motherboard)
41479      PORT_MODIFY("IN-18")
41480      // 0x0001 - "dil11" // standard input (motherboard)
41481      // 0x0002 - "dil12" // standard input (motherboard)
41482      // 0x0004 - "dil13" // standard input (motherboard)
41483      // 0x0008 - "dil14" // standard input (motherboard)
41484      // 0x0010 - "dil15" // standard input (motherboard)
41485      PORT_MODIFY("IN-19")
41486      // 0x0001 - "dil16" // standard input (motherboard)
41487      PORT_MODIFY("IN-20")
41488      // 0x0001 - "test OR test" // standard input (motherboard)
41489      // 0x0002 - "dorlk" // standard input (expected here)
41490      // 0x0004 - "topdr" // standard input (expected here)
41491      // 0x0008 - "cshbx" // standard input (expected here)
41492      // 0x0010 - "dump" // standard input (expected here)
4149341493INPUT_PORTS_END
4149441494
4149541495// PR2342 QUID VICIOUS         QUIDV SOUNDS         QUID VICIOUS
r31373r31374
4151541515}
4151641516
4151741517INPUT_PORTS_START( sc4rhxcs ) // this structure is generated
41518        PORT_INCLUDE( sc4_base )
41519        PORT_MODIFY("IN-1")
41520        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR collec")
41521        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41522        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41523        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41524        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("transf")
41525        PORT_MODIFY("IN-2")
41526        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
41527        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
41528        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41529        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41530        PORT_MODIFY("IN-3")
41531        // 0x0004 - "stk 4" // standard input (expected here)
41532        // 0x0008 - "stk 3" // standard input (expected here)
41533        // 0x0010 - "stk 2" // standard input (expected here)
41534        PORT_MODIFY("IN-4")
41535        // 0x0008 - "top up OR top up" // known extended(?) input, sometimes 'hop top'
41536        PORT_MODIFY("IN-5")
41537        // 0x0001 - "priz4" // standard input (expected here)
41538        // 0x0002 - "priz3" // standard input (expected here)
41539        // 0x0004 - "priz2" // standard input (expected here)
41540        // 0x0008 - "priz1" // standard input (expected here)
41541        PORT_MODIFY("IN-6")
41542        // 0x0001 - "perc1" // standard input (expected here)
41543        // 0x0002 - "perc2" // standard input (expected here)
41544        // 0x0004 - "perc3" // standard input (expected here)
41545        // 0x0008 - "perc4" // standard input (expected here)
41546        PORT_MODIFY("IN-16")
41547        // 0x0001 - "dil  1" // standard input (motherboard)
41548        // 0x0002 - "dil  2" // standard input (motherboard)
41549        // 0x0004 - "dil  3" // standard input (motherboard)
41550        // 0x0008 - "dil  4" // standard input (motherboard)
41551        // 0x0010 - "dil  5" // standard input (motherboard)
41552        PORT_MODIFY("IN-17")
41553        // 0x0001 - "dil  6" // standard input (motherboard)
41554        // 0x0002 - "dil  7" // standard input (motherboard)
41555        // 0x0004 - "dil  8" // standard input (motherboard)
41556        // 0x0008 - "dil  9" // standard input (motherboard)
41557        // 0x0010 - "dil 10" // standard input (motherboard)
41558        PORT_MODIFY("IN-18")
41559        // 0x0001 - "dil 11" // standard input (motherboard)
41560        // 0x0002 - "dil 12" // standard input (motherboard)
41561        // 0x0004 - "dil 13" // standard input (motherboard)
41562        // 0x0008 - "dil 14" // standard input (motherboard)
41563        // 0x0010 - "dil 15" // standard input (motherboard)
41564        PORT_MODIFY("IN-19")
41565        // 0x0001 - "dil 16" // standard input (motherboard)
41566        PORT_MODIFY("IN-20")
41567        // 0x0001 - "green OR test" // standard input (motherboard)
41568        // 0x0002 - "cshdor" // standard input (expected here)
41569        // 0x0004 - "serdor" // standard input (expected here)
41570        // 0x0008 - "hopdmp" // standard input (expected here)
41571        // 0x0010 - "serdor" // standard input (expected here)
41518      PORT_INCLUDE( sc4_base )
41519      PORT_MODIFY("IN-1")
41520      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR collec")
41521      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41522      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41523      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41524      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("transf")
41525      PORT_MODIFY("IN-2")
41526      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("autopl")
41527      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
41528      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41529      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41530      PORT_MODIFY("IN-3")
41531      // 0x0004 - "stk 4" // standard input (expected here)
41532      // 0x0008 - "stk 3" // standard input (expected here)
41533      // 0x0010 - "stk 2" // standard input (expected here)
41534      PORT_MODIFY("IN-4")
41535      // 0x0008 - "top up OR top up" // known extended(?) input, sometimes 'hop top'
41536      PORT_MODIFY("IN-5")
41537      // 0x0001 - "priz4" // standard input (expected here)
41538      // 0x0002 - "priz3" // standard input (expected here)
41539      // 0x0004 - "priz2" // standard input (expected here)
41540      // 0x0008 - "priz1" // standard input (expected here)
41541      PORT_MODIFY("IN-6")
41542      // 0x0001 - "perc1" // standard input (expected here)
41543      // 0x0002 - "perc2" // standard input (expected here)
41544      // 0x0004 - "perc3" // standard input (expected here)
41545      // 0x0008 - "perc4" // standard input (expected here)
41546      PORT_MODIFY("IN-16")
41547      // 0x0001 - "dil  1" // standard input (motherboard)
41548      // 0x0002 - "dil  2" // standard input (motherboard)
41549      // 0x0004 - "dil  3" // standard input (motherboard)
41550      // 0x0008 - "dil  4" // standard input (motherboard)
41551      // 0x0010 - "dil  5" // standard input (motherboard)
41552      PORT_MODIFY("IN-17")
41553      // 0x0001 - "dil  6" // standard input (motherboard)
41554      // 0x0002 - "dil  7" // standard input (motherboard)
41555      // 0x0004 - "dil  8" // standard input (motherboard)
41556      // 0x0008 - "dil  9" // standard input (motherboard)
41557      // 0x0010 - "dil 10" // standard input (motherboard)
41558      PORT_MODIFY("IN-18")
41559      // 0x0001 - "dil 11" // standard input (motherboard)
41560      // 0x0002 - "dil 12" // standard input (motherboard)
41561      // 0x0004 - "dil 13" // standard input (motherboard)
41562      // 0x0008 - "dil 14" // standard input (motherboard)
41563      // 0x0010 - "dil 15" // standard input (motherboard)
41564      PORT_MODIFY("IN-19")
41565      // 0x0001 - "dil 16" // standard input (motherboard)
41566      PORT_MODIFY("IN-20")
41567      // 0x0001 - "green OR test" // standard input (motherboard)
41568      // 0x0002 - "cshdor" // standard input (expected here)
41569      // 0x0004 - "serdor" // standard input (expected here)
41570      // 0x0008 - "hopdmp" // standard input (expected here)
41571      // 0x0010 - "serdor" // standard input (expected here)
4157241572INPUT_PORTS_END
4157341573
4157441574// PR2364 CASINO RED HOT X         RED HOT X CRHX SOUNDS         RED HOT X
r31373r31374
4159841598}
4159941599
4160041600INPUT_PORTS_START( sc4redsq ) // this structure is generated
41601        PORT_INCLUDE( sc4_base )
41602        PORT_MODIFY("IN-1")
41603        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cnccol")
41604        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
41605        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
41606        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
41607        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exch")
41608        PORT_MODIFY("IN-2")
41609        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
41610        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41611        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41612        PORT_MODIFY("IN-8")
41613        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("t nuds")
41614        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("t cash")
41615        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("m rght")
41616        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("m down")
41617        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("m left")
41618        PORT_MODIFY("IN-9")
41619        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("m up")
41620        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("t cpot")
41621        PORT_MODIFY("IN-16")
41622        // 0x0001 - "dil 1" // standard input (motherboard)
41623        // 0x0002 - "dil 2" // standard input (motherboard)
41624        // 0x0004 - "dil 3" // standard input (motherboard)
41625        // 0x0008 - "dil 4" // standard input (motherboard)
41626        // 0x0010 - "dil 5" // standard input (motherboard)
41627        // 0x0100 - "top up" // known extended input, usually 'top up'
41628        PORT_MODIFY("IN-17")
41629        // 0x0001 - "dil 6" // standard input (motherboard)
41630        // 0x0002 - "dil 7" // standard input (motherboard)
41631        // 0x0004 - "dil 8" // standard input (motherboard)
41632        // 0x0008 - "dil 9" // standard input (motherboard)
41633        // 0x0010 - "dil10" // standard input (motherboard)
41634        PORT_MODIFY("IN-18")
41635        // 0x0001 - "dil11" // standard input (motherboard)
41636        // 0x0002 - "dil12" // standard input (motherboard)
41637        // 0x0004 - "dil13" // standard input (motherboard)
41638        // 0x0008 - "dil14" // standard input (motherboard)
41639        // 0x0010 - "dil15" // standard input (motherboard)
41640        PORT_MODIFY("IN-19")
41641        // 0x0001 - "dil16" // standard input (motherboard)
41642        PORT_MODIFY("IN-20")
41643        // 0x0001 - "test" // standard input (motherboard)
41644        // 0x0002 - "dor lk" // standard input (expected here)
41645        // 0x0004 - "tp dor" // standard input (expected here)
41646        // 0x0008 - "csh bx" // standard input (expected here)
41647        // 0x0010 - "deflt" // standard input (expected here)
41601      PORT_INCLUDE( sc4_base )
41602      PORT_MODIFY("IN-1")
41603      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cnccol")
41604      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
41605      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
41606      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
41607      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exch")
41608      PORT_MODIFY("IN-2")
41609      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
41610      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41611      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41612      PORT_MODIFY("IN-8")
41613      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("t nuds")
41614      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("t cash")
41615      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("m rght")
41616      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("m down")
41617      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("m left")
41618      PORT_MODIFY("IN-9")
41619      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("m up")
41620      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("t cpot")
41621      PORT_MODIFY("IN-16")
41622      // 0x0001 - "dil 1" // standard input (motherboard)
41623      // 0x0002 - "dil 2" // standard input (motherboard)
41624      // 0x0004 - "dil 3" // standard input (motherboard)
41625      // 0x0008 - "dil 4" // standard input (motherboard)
41626      // 0x0010 - "dil 5" // standard input (motherboard)
41627      // 0x0100 - "top up" // known extended input, usually 'top up'
41628      PORT_MODIFY("IN-17")
41629      // 0x0001 - "dil 6" // standard input (motherboard)
41630      // 0x0002 - "dil 7" // standard input (motherboard)
41631      // 0x0004 - "dil 8" // standard input (motherboard)
41632      // 0x0008 - "dil 9" // standard input (motherboard)
41633      // 0x0010 - "dil10" // standard input (motherboard)
41634      PORT_MODIFY("IN-18")
41635      // 0x0001 - "dil11" // standard input (motherboard)
41636      // 0x0002 - "dil12" // standard input (motherboard)
41637      // 0x0004 - "dil13" // standard input (motherboard)
41638      // 0x0008 - "dil14" // standard input (motherboard)
41639      // 0x0010 - "dil15" // standard input (motherboard)
41640      PORT_MODIFY("IN-19")
41641      // 0x0001 - "dil16" // standard input (motherboard)
41642      PORT_MODIFY("IN-20")
41643      // 0x0001 - "test" // standard input (motherboard)
41644      // 0x0002 - "dor lk" // standard input (expected here)
41645      // 0x0004 - "tp dor" // standard input (expected here)
41646      // 0x0008 - "csh bx" // standard input (expected here)
41647      // 0x0010 - "deflt" // standard input (expected here)
4164841648INPUT_PORTS_END
4164941649
4165041650
r31373r31374
4167241672}
4167341673
4167441674INPUT_PORTS_START( sc4rosts ) // this structure is generated
41675        PORT_INCLUDE( sc4_base )
41676        PORT_MODIFY("IN-1")
41677        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
41678        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
41679        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
41680        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
41681        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
41682        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
41683        PORT_MODIFY("IN-2")
41684        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
41685        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ex/tra")
41686        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41687        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41688        PORT_MODIFY("IN-3")
41689        // 0x0004 - "stk 4" // standard input (expected here)
41690        // 0x0008 - "stk 3" // standard input (expected here)
41691        // 0x0010 - "stk 2" // standard input (expected here)
41692        PORT_MODIFY("IN-4")
41693        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
41694        PORT_MODIFY("IN-5")
41695        // 0x0001 - "priz4" // standard input (expected here)
41696        // 0x0002 - "priz3" // standard input (expected here)
41697        // 0x0004 - "priz2" // standard input (expected here)
41698        // 0x0008 - "priz1" // standard input (expected here)
41699        PORT_MODIFY("IN-8")
41700        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk win")
41701        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk nud")
41702        PORT_MODIFY("IN-16")
41703        // 0x0001 - "dil 1" // standard input (motherboard)
41704        // 0x0002 - "dil 2" // standard input (motherboard)
41705        // 0x0004 - "dil 3" // standard input (motherboard)
41706        // 0x0008 - "dil 4" // standard input (motherboard)
41707        // 0x0010 - "dil 5" // standard input (motherboard)
41708        // 0x0100 - "top up" // known extended input, usually 'top up'
41709        PORT_MODIFY("IN-17")
41710        // 0x0001 - "dil 6" // standard input (motherboard)
41711        // 0x0002 - "dil 7" // standard input (motherboard)
41712        // 0x0004 - "dil 8" // standard input (motherboard)
41713        // 0x0008 - "dil 9" // standard input (motherboard)
41714        // 0x0010 - "dil10" // standard input (motherboard)
41715        PORT_MODIFY("IN-18")
41716        // 0x0001 - "dil11" // standard input (motherboard)
41717        // 0x0002 - "dil12" // standard input (motherboard)
41718        // 0x0004 - "dil13" // standard input (motherboard)
41719        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
41720        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
41721        PORT_MODIFY("IN-19")
41722        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
41723        PORT_MODIFY("IN-20")
41724        // 0x0001 - "grnbut" // standard input (motherboard)
41725        // 0x0002 - "dorlok" // standard input (expected here)
41726        // 0x0004 - "topdor" // standard input (expected here)
41727        // 0x0008 - "botdor" // standard input (expected here)
41728        // 0x0010 - "hopdmp" // standard input (expected here)
41675      PORT_INCLUDE( sc4_base )
41676      PORT_MODIFY("IN-1")
41677      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
41678      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
41679      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
41680      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
41681      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
41682      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
41683      PORT_MODIFY("IN-2")
41684      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
41685      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ex/tra")
41686      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41687      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41688      PORT_MODIFY("IN-3")
41689      // 0x0004 - "stk 4" // standard input (expected here)
41690      // 0x0008 - "stk 3" // standard input (expected here)
41691      // 0x0010 - "stk 2" // standard input (expected here)
41692      PORT_MODIFY("IN-4")
41693      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
41694      PORT_MODIFY("IN-5")
41695      // 0x0001 - "priz4" // standard input (expected here)
41696      // 0x0002 - "priz3" // standard input (expected here)
41697      // 0x0004 - "priz2" // standard input (expected here)
41698      // 0x0008 - "priz1" // standard input (expected here)
41699      PORT_MODIFY("IN-8")
41700      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk win")
41701      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk nud")
41702      PORT_MODIFY("IN-16")
41703      // 0x0001 - "dil 1" // standard input (motherboard)
41704      // 0x0002 - "dil 2" // standard input (motherboard)
41705      // 0x0004 - "dil 3" // standard input (motherboard)
41706      // 0x0008 - "dil 4" // standard input (motherboard)
41707      // 0x0010 - "dil 5" // standard input (motherboard)
41708      // 0x0100 - "top up" // known extended input, usually 'top up'
41709      PORT_MODIFY("IN-17")
41710      // 0x0001 - "dil 6" // standard input (motherboard)
41711      // 0x0002 - "dil 7" // standard input (motherboard)
41712      // 0x0004 - "dil 8" // standard input (motherboard)
41713      // 0x0008 - "dil 9" // standard input (motherboard)
41714      // 0x0010 - "dil10" // standard input (motherboard)
41715      PORT_MODIFY("IN-18")
41716      // 0x0001 - "dil11" // standard input (motherboard)
41717      // 0x0002 - "dil12" // standard input (motherboard)
41718      // 0x0004 - "dil13" // standard input (motherboard)
41719      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
41720      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
41721      PORT_MODIFY("IN-19")
41722      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
41723      PORT_MODIFY("IN-20")
41724      // 0x0001 - "grnbut" // standard input (motherboard)
41725      // 0x0002 - "dorlok" // standard input (expected here)
41726      // 0x0004 - "topdor" // standard input (expected here)
41727      // 0x0008 - "botdor" // standard input (expected here)
41728      // 0x0010 - "hopdmp" // standard input (expected here)
4172941729INPUT_PORTS_END
4173041730
4173141731// PR3256 CLUB RONNIE O SULLIVANS TOURNAMENT SCORP4         RONNIE OSULLIVAN  CLUB  PR3256 RONNIE O SOUNDS11         RONNIE SULLIVAN
r31373r31374
4175541755}
4175641756
4175741757INPUT_PORTS_START( sc4rovrt ) // this structure is generated
41758        PORT_INCLUDE( sc4_base )
41759        PORT_MODIFY("IN-1")
41760        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
41761        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
41762        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
41763        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
41764        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
41765        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
41766        PORT_MODIFY("IN-2")
41767        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
41768        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
41769        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41770        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41771        PORT_MODIFY("IN-3")
41772        // 0x0004 - "stk3" // standard input (expected here)
41773        // 0x0008 - "stk1" // standard input (expected here)
41774        // 0x0010 - "stk2" // standard input (expected here)
41775        PORT_MODIFY("IN-5")
41776        // 0x0001 - "jp 1" // standard input (expected here)
41777        // 0x0002 - "jp 2" // standard input (expected here)
41778        // 0x0004 - "jp 3" // standard input (expected here)
41779        // 0x0008 - "jp 4" // standard input (expected here)
41780        PORT_MODIFY("IN-6")
41781        // 0x0001 - "pc 1" // standard input (expected here)
41782        // 0x0002 - "pc 2" // standard input (expected here)
41783        // 0x0004 - "pc 3" // standard input (expected here)
41784        // 0x0008 - "pc 4" // standard input (expected here)
41785        PORT_MODIFY("IN-8")
41786        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("f lo")
41787        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
41788        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c lo")
41789        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
41790        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c hi")
41791        PORT_MODIFY("IN-9")
41792        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
41793        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("f hi")
41794        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("step")
41795        PORT_MODIFY("IN-16")
41796        // 0x0001 - "dil  1" // standard input (motherboard)
41797        // 0x0002 - "dil  2" // standard input (motherboard)
41798        // 0x0004 - "dil  3" // standard input (motherboard)
41799        // 0x0008 - "dil  4" // standard input (motherboard)
41800        // 0x0010 - "dil  5" // standard input (motherboard)
41801        // 0x0100 - "top up OR top up" // known extended input, usually 'top up'
41802        PORT_MODIFY("IN-17")
41803        // 0x0001 - "dil  6" // standard input (motherboard)
41804        // 0x0002 - "dil  7" // standard input (motherboard)
41805        // 0x0004 - "dil  8" // standard input (motherboard)
41806        // 0x0008 - "dil  9" // standard input (motherboard)
41807        // 0x0010 - "dil 10" // standard input (motherboard)
41808        PORT_MODIFY("IN-18")
41809        // 0x0001 - "dil 11" // standard input (motherboard)
41810        // 0x0002 - "dil 12" // standard input (motherboard)
41811        // 0x0004 - "dil 13" // standard input (motherboard)
41812        // 0x0008 - "dil 14" // standard input (motherboard)
41813        // 0x0010 - "dil 15" // standard input (motherboard)
41814        PORT_MODIFY("IN-19")
41815        // 0x0001 - "dil 16" // standard input (motherboard)
41816        PORT_MODIFY("IN-20")
41817        // 0x0001 - "test" // standard input (motherboard)
41818        // 0x0002 - "dorlk" // standard input (expected here)
41819        // 0x0004 - "topdr" // standard input (expected here)
41820        // 0x0008 - "cshbx" // standard input (expected here)
41821        // 0x0010 - "dump" // standard input (expected here)
41758      PORT_INCLUDE( sc4_base )
41759      PORT_MODIFY("IN-1")
41760      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
41761      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
41762      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
41763      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
41764      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
41765      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
41766      PORT_MODIFY("IN-2")
41767      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
41768      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
41769      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41770      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41771      PORT_MODIFY("IN-3")
41772      // 0x0004 - "stk3" // standard input (expected here)
41773      // 0x0008 - "stk1" // standard input (expected here)
41774      // 0x0010 - "stk2" // standard input (expected here)
41775      PORT_MODIFY("IN-5")
41776      // 0x0001 - "jp 1" // standard input (expected here)
41777      // 0x0002 - "jp 2" // standard input (expected here)
41778      // 0x0004 - "jp 3" // standard input (expected here)
41779      // 0x0008 - "jp 4" // standard input (expected here)
41780      PORT_MODIFY("IN-6")
41781      // 0x0001 - "pc 1" // standard input (expected here)
41782      // 0x0002 - "pc 2" // standard input (expected here)
41783      // 0x0004 - "pc 3" // standard input (expected here)
41784      // 0x0008 - "pc 4" // standard input (expected here)
41785      PORT_MODIFY("IN-8")
41786      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("f lo")
41787      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
41788      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c lo")
41789      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
41790      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c hi")
41791      PORT_MODIFY("IN-9")
41792      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
41793      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("f hi")
41794      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("step")
41795      PORT_MODIFY("IN-16")
41796      // 0x0001 - "dil  1" // standard input (motherboard)
41797      // 0x0002 - "dil  2" // standard input (motherboard)
41798      // 0x0004 - "dil  3" // standard input (motherboard)
41799      // 0x0008 - "dil  4" // standard input (motherboard)
41800      // 0x0010 - "dil  5" // standard input (motherboard)
41801      // 0x0100 - "top up OR top up" // known extended input, usually 'top up'
41802      PORT_MODIFY("IN-17")
41803      // 0x0001 - "dil  6" // standard input (motherboard)
41804      // 0x0002 - "dil  7" // standard input (motherboard)
41805      // 0x0004 - "dil  8" // standard input (motherboard)
41806      // 0x0008 - "dil  9" // standard input (motherboard)
41807      // 0x0010 - "dil 10" // standard input (motherboard)
41808      PORT_MODIFY("IN-18")
41809      // 0x0001 - "dil 11" // standard input (motherboard)
41810      // 0x0002 - "dil 12" // standard input (motherboard)
41811      // 0x0004 - "dil 13" // standard input (motherboard)
41812      // 0x0008 - "dil 14" // standard input (motherboard)
41813      // 0x0010 - "dil 15" // standard input (motherboard)
41814      PORT_MODIFY("IN-19")
41815      // 0x0001 - "dil 16" // standard input (motherboard)
41816      PORT_MODIFY("IN-20")
41817      // 0x0001 - "test" // standard input (motherboard)
41818      // 0x0002 - "dorlk" // standard input (expected here)
41819      // 0x0004 - "topdr" // standard input (expected here)
41820      // 0x0008 - "cshbx" // standard input (expected here)
41821      // 0x0010 - "dump" // standard input (expected here)
4182241822INPUT_PORTS_END
4182341823
4182441824// PR2311 ROVERS RETURN         ROVERS RETURN SOUNDS         ROVERS RETURN
r31373r31374
4184641846}
4184741847
4184841848INPUT_PORTS_START( sc4showt ) // this structure is generated
41849        PORT_INCLUDE( sc4_base )
41850        PORT_MODIFY("IN-1")
41851        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
41852        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41853        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41854        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41855        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
41856        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
41857        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
41858        PORT_MODIFY("IN-2")
41859        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchan")
41860        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ch stk")
41861        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
41862        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41863        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
41864        PORT_MODIFY("IN-3")
41865        // 0x0004 - "stk 4" // standard input (expected here)
41866        // 0x0008 - "stk 3" // standard input (expected here)
41867        // 0x0010 - "stk 2" // standard input (expected here)
41868        PORT_MODIFY("IN-5")
41869        // 0x0001 - "priz4" // standard input (expected here)
41870        // 0x0002 - "priz3" // standard input (expected here)
41871        // 0x0004 - "priz2" // standard input (expected here)
41872        // 0x0008 - "priz1" // standard input (expected here)
41873        PORT_MODIFY("IN-6")
41874        // 0x0001 - "perc1" // standard input (expected here)
41875        // 0x0002 - "perc2" // standard input (expected here)
41876        // 0x0004 - "perc3" // standard input (expected here)
41877        // 0x0008 - "perc4" // standard input (expected here)
41878        PORT_MODIFY("IN-8")
41879        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bankit")
41880        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("p show")
41881        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("streak")
41882        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c cash")
41883        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("sh tim")
41884        PORT_MODIFY("IN-16")
41885        // 0x0001 - "dil1" // standard input (motherboard)
41886        // 0x0002 - "dil2" // standard input (motherboard)
41887        // 0x0004 - "dil3" // standard input (motherboard)
41888        // 0x0008 - "dil4" // standard input (motherboard)
41889        // 0x0010 - "dil5" // standard input (motherboard)
41890        // 0x0100 - "top up" // known extended input, usually 'top up'
41891        PORT_MODIFY("IN-17")
41892        // 0x0001 - "dil6" // standard input (motherboard)
41893        // 0x0002 - "dil7" // standard input (motherboard)
41894        // 0x0004 - "dil8" // standard input (motherboard)
41895        // 0x0008 - "dil9" // standard input (motherboard)
41896        // 0x0010 - "dil10" // standard input (motherboard)
41897        PORT_MODIFY("IN-18")
41898        // 0x0001 - "dil11" // standard input (motherboard)
41899        // 0x0002 - "dil12" // standard input (motherboard)
41900        // 0x0004 - "dil13" // standard input (motherboard)
41901        // 0x0008 - "dil14" // standard input (motherboard)
41902        // 0x0010 - "dil15" // standard input (motherboard)
41903        PORT_MODIFY("IN-19")
41904        // 0x0001 - "dil16" // standard input (motherboard)
41905        PORT_MODIFY("IN-20")
41906        // 0x0001 - "grnbut" // standard input (motherboard)
41907        // 0x0002 - "dorlok" // standard input (expected here)
41908        // 0x0004 - "serdor" // standard input (expected here)
41909        // 0x0008 - "cshdor" // standard input (expected here)
41910        // 0x0010 - "hopdmp" // standard input (expected here)
41849      PORT_INCLUDE( sc4_base )
41850      PORT_MODIFY("IN-1")
41851      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
41852      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41853      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41854      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41855      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
41856      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
41857      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
41858      PORT_MODIFY("IN-2")
41859      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchan")
41860      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ch stk")
41861      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("transf")
41862      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41863      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
41864      PORT_MODIFY("IN-3")
41865      // 0x0004 - "stk 4" // standard input (expected here)
41866      // 0x0008 - "stk 3" // standard input (expected here)
41867      // 0x0010 - "stk 2" // standard input (expected here)
41868      PORT_MODIFY("IN-5")
41869      // 0x0001 - "priz4" // standard input (expected here)
41870      // 0x0002 - "priz3" // standard input (expected here)
41871      // 0x0004 - "priz2" // standard input (expected here)
41872      // 0x0008 - "priz1" // standard input (expected here)
41873      PORT_MODIFY("IN-6")
41874      // 0x0001 - "perc1" // standard input (expected here)
41875      // 0x0002 - "perc2" // standard input (expected here)
41876      // 0x0004 - "perc3" // standard input (expected here)
41877      // 0x0008 - "perc4" // standard input (expected here)
41878      PORT_MODIFY("IN-8")
41879      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bankit")
41880      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("p show")
41881      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("streak")
41882      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c cash")
41883      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("sh tim")
41884      PORT_MODIFY("IN-16")
41885      // 0x0001 - "dil1" // standard input (motherboard)
41886      // 0x0002 - "dil2" // standard input (motherboard)
41887      // 0x0004 - "dil3" // standard input (motherboard)
41888      // 0x0008 - "dil4" // standard input (motherboard)
41889      // 0x0010 - "dil5" // standard input (motherboard)
41890      // 0x0100 - "top up" // known extended input, usually 'top up'
41891      PORT_MODIFY("IN-17")
41892      // 0x0001 - "dil6" // standard input (motherboard)
41893      // 0x0002 - "dil7" // standard input (motherboard)
41894      // 0x0004 - "dil8" // standard input (motherboard)
41895      // 0x0008 - "dil9" // standard input (motherboard)
41896      // 0x0010 - "dil10" // standard input (motherboard)
41897      PORT_MODIFY("IN-18")
41898      // 0x0001 - "dil11" // standard input (motherboard)
41899      // 0x0002 - "dil12" // standard input (motherboard)
41900      // 0x0004 - "dil13" // standard input (motherboard)
41901      // 0x0008 - "dil14" // standard input (motherboard)
41902      // 0x0010 - "dil15" // standard input (motherboard)
41903      PORT_MODIFY("IN-19")
41904      // 0x0001 - "dil16" // standard input (motherboard)
41905      PORT_MODIFY("IN-20")
41906      // 0x0001 - "grnbut" // standard input (motherboard)
41907      // 0x0002 - "dorlok" // standard input (expected here)
41908      // 0x0004 - "serdor" // standard input (expected here)
41909      // 0x0008 - "cshdor" // standard input (expected here)
41910      // 0x0010 - "hopdmp" // standard input (expected here)
4191141911INPUT_PORTS_END
4191241912
4191341913// PR3043 AWP SHOW TIME S4         PR3013 SHOWTIME SOUNDS11         SHOW TIME S.SITE
r31373r31374
4193741937}
4193841938
4193941939INPUT_PORTS_START( sc4spice ) // this structure is generated
41940        PORT_INCLUDE( sc4_base )
41941        PORT_MODIFY("IN-1")
41942        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
41943        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41944        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41945        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41946        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
41947        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
41948        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
41949        PORT_MODIFY("IN-2")
41950        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
41951        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trf/ex")
41952        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41953        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41954        PORT_MODIFY("IN-5")
41955        // 0x0001 - "priz4" // standard input (expected here)
41956        // 0x0002 - "priz3" // standard input (expected here)
41957        // 0x0004 - "priz2" // standard input (expected here)
41958        // 0x0008 - "priz1" // standard input (expected here)
41959        PORT_MODIFY("IN-6")
41960        // 0x0001 - "perc1" // standard input (expected here)
41961        // 0x0002 - "perc2" // standard input (expected here)
41962        // 0x0004 - "perc3" // standard input (expected here)
41963        // 0x0008 - "perc4" // standard input (expected here)
41964        PORT_MODIFY("IN-16")
41965        // 0x0001 - "dil1" // standard input (motherboard)
41966        // 0x0002 - "dil2" // standard input (motherboard)
41967        // 0x0004 - "dil3" // standard input (motherboard)
41968        // 0x0008 - "dil4" // standard input (motherboard)
41969        // 0x0010 - "dil5" // standard input (motherboard)
41970        // 0x0100 - "top up" // known extended input, usually 'top up'
41971        PORT_MODIFY("IN-17")
41972        // 0x0001 - "dil6" // standard input (motherboard)
41973        // 0x0002 - "dil7" // standard input (motherboard)
41974        // 0x0004 - "dil8" // standard input (motherboard)
41975        // 0x0008 - "dil9" // standard input (motherboard)
41976        // 0x0010 - "dil10" // standard input (motherboard)
41977        PORT_MODIFY("IN-18")
41978        // 0x0001 - "dil11" // standard input (motherboard)
41979        // 0x0002 - "dil12" // standard input (motherboard)
41980        // 0x0004 - "dil13" // standard input (motherboard)
41981        // 0x0008 - "dil14" // standard input (motherboard)
41982        // 0x0010 - "dil15" // standard input (motherboard)
41983        PORT_MODIFY("IN-19")
41984        // 0x0001 - "dil16" // standard input (motherboard)
41985        PORT_MODIFY("IN-20")
41986        // 0x0001 - "grnbut" // standard input (motherboard)
41987        // 0x0002 - "dorlok" // standard input (expected here)
41988        // 0x0004 - "serdor" // standard input (expected here)
41989        // 0x0008 - "cshdor" // standard input (expected here)
41990        // 0x0010 - "hopdmp" // standard input (expected here)
41940      PORT_INCLUDE( sc4_base )
41941      PORT_MODIFY("IN-1")
41942      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
41943      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
41944      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
41945      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
41946      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
41947      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
41948      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
41949      PORT_MODIFY("IN-2")
41950      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
41951      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trf/ex")
41952      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
41953      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
41954      PORT_MODIFY("IN-5")
41955      // 0x0001 - "priz4" // standard input (expected here)
41956      // 0x0002 - "priz3" // standard input (expected here)
41957      // 0x0004 - "priz2" // standard input (expected here)
41958      // 0x0008 - "priz1" // standard input (expected here)
41959      PORT_MODIFY("IN-6")
41960      // 0x0001 - "perc1" // standard input (expected here)
41961      // 0x0002 - "perc2" // standard input (expected here)
41962      // 0x0004 - "perc3" // standard input (expected here)
41963      // 0x0008 - "perc4" // standard input (expected here)
41964      PORT_MODIFY("IN-16")
41965      // 0x0001 - "dil1" // standard input (motherboard)
41966      // 0x0002 - "dil2" // standard input (motherboard)
41967      // 0x0004 - "dil3" // standard input (motherboard)
41968      // 0x0008 - "dil4" // standard input (motherboard)
41969      // 0x0010 - "dil5" // standard input (motherboard)
41970      // 0x0100 - "top up" // known extended input, usually 'top up'
41971      PORT_MODIFY("IN-17")
41972      // 0x0001 - "dil6" // standard input (motherboard)
41973      // 0x0002 - "dil7" // standard input (motherboard)
41974      // 0x0004 - "dil8" // standard input (motherboard)
41975      // 0x0008 - "dil9" // standard input (motherboard)
41976      // 0x0010 - "dil10" // standard input (motherboard)
41977      PORT_MODIFY("IN-18")
41978      // 0x0001 - "dil11" // standard input (motherboard)
41979      // 0x0002 - "dil12" // standard input (motherboard)
41980      // 0x0004 - "dil13" // standard input (motherboard)
41981      // 0x0008 - "dil14" // standard input (motherboard)
41982      // 0x0010 - "dil15" // standard input (motherboard)
41983      PORT_MODIFY("IN-19")
41984      // 0x0001 - "dil16" // standard input (motherboard)
41985      PORT_MODIFY("IN-20")
41986      // 0x0001 - "grnbut" // standard input (motherboard)
41987      // 0x0002 - "dorlok" // standard input (expected here)
41988      // 0x0004 - "serdor" // standard input (expected here)
41989      // 0x0008 - "cshdor" // standard input (expected here)
41990      // 0x0010 - "hopdmp" // standard input (expected here)
4199141991INPUT_PORTS_END
4199241992
4199341993// PR1921 AWP SPICE IT UP SCORP4         PR1901 SPICE IT UP SOUNDS11       SPICE IT UP S.SITE
r31373r31374
4201342013}
4201442014
4201542015INPUT_PORTS_START( sc4sus ) // this structure is generated
42016        PORT_INCLUDE( sc4_base )
42017        PORT_MODIFY("IN-1")
42018        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
42019        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
42020        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
42021        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
42022        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
42023        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
42024        PORT_MODIFY("IN-2")
42025        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
42026        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
42027        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42028        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42029        PORT_MODIFY("IN-3")
42030        // 0x0004 - "stk3" // standard input (expected here)
42031        // 0x0008 - "stk1" // standard input (expected here)
42032        // 0x0010 - "stk2" // standard input (expected here)
42033        PORT_MODIFY("IN-5")
42034        // 0x0001 - "jp 1" // standard input (expected here)
42035        // 0x0002 - "jp 2" // standard input (expected here)
42036        // 0x0004 - "jp 3" // standard input (expected here)
42037        // 0x0008 - "jp 4" // standard input (expected here)
42038        PORT_MODIFY("IN-6")
42039        // 0x0001 - "pc 1" // standard input (expected here)
42040        // 0x0002 - "pc 2" // standard input (expected here)
42041        // 0x0004 - "pc 3" // standard input (expected here)
42042        // 0x0008 - "pc 4" // standard input (expected here)
42043        PORT_MODIFY("IN-8")
42044        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
42045        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
42046        PORT_MODIFY("IN-16")
42047        // 0x0001 - "dil 1" // standard input (motherboard)
42048        // 0x0002 - "dil 2" // standard input (motherboard)
42049        // 0x0004 - "dil 3" // standard input (motherboard)
42050        // 0x0008 - "dil 4" // standard input (motherboard)
42051        // 0x0010 - "dil 5" // standard input (motherboard)
42052        // 0x0100 - "top up" // known extended input, usually 'top up'
42053        PORT_MODIFY("IN-17")
42054        // 0x0001 - "dil 6" // standard input (motherboard)
42055        // 0x0002 - "dil 7" // standard input (motherboard)
42056        // 0x0004 - "dil 8" // standard input (motherboard)
42057        // 0x0008 - "dil 9" // standard input (motherboard)
42058        // 0x0010 - "dil10" // standard input (motherboard)
42059        PORT_MODIFY("IN-18")
42060        // 0x0001 - "dil11" // standard input (motherboard)
42061        // 0x0002 - "dil12" // standard input (motherboard)
42062        // 0x0004 - "dil13" // standard input (motherboard)
42063        // 0x0008 - "dil14" // standard input (motherboard)
42064        // 0x0010 - "dil15" // standard input (motherboard)
42065        PORT_MODIFY("IN-19")
42066        // 0x0001 - "dil16" // standard input (motherboard)
42067        PORT_MODIFY("IN-20")
42068        // 0x0001 - "test OR test" // standard input (motherboard)
42069        // 0x0002 - "dorlk" // standard input (expected here)
42070        // 0x0004 - "topdr" // standard input (expected here)
42071        // 0x0008 - "cshbx" // standard input (expected here)
42072        // 0x0010 - "dump" // standard input (expected here)
42016      PORT_INCLUDE( sc4_base )
42017      PORT_MODIFY("IN-1")
42018      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
42019      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
42020      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
42021      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
42022      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
42023      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
42024      PORT_MODIFY("IN-2")
42025      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
42026      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
42027      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42028      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42029      PORT_MODIFY("IN-3")
42030      // 0x0004 - "stk3" // standard input (expected here)
42031      // 0x0008 - "stk1" // standard input (expected here)
42032      // 0x0010 - "stk2" // standard input (expected here)
42033      PORT_MODIFY("IN-5")
42034      // 0x0001 - "jp 1" // standard input (expected here)
42035      // 0x0002 - "jp 2" // standard input (expected here)
42036      // 0x0004 - "jp 3" // standard input (expected here)
42037      // 0x0008 - "jp 4" // standard input (expected here)
42038      PORT_MODIFY("IN-6")
42039      // 0x0001 - "pc 1" // standard input (expected here)
42040      // 0x0002 - "pc 2" // standard input (expected here)
42041      // 0x0004 - "pc 3" // standard input (expected here)
42042      // 0x0008 - "pc 4" // standard input (expected here)
42043      PORT_MODIFY("IN-8")
42044      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
42045      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
42046      PORT_MODIFY("IN-16")
42047      // 0x0001 - "dil 1" // standard input (motherboard)
42048      // 0x0002 - "dil 2" // standard input (motherboard)
42049      // 0x0004 - "dil 3" // standard input (motherboard)
42050      // 0x0008 - "dil 4" // standard input (motherboard)
42051      // 0x0010 - "dil 5" // standard input (motherboard)
42052      // 0x0100 - "top up" // known extended input, usually 'top up'
42053      PORT_MODIFY("IN-17")
42054      // 0x0001 - "dil 6" // standard input (motherboard)
42055      // 0x0002 - "dil 7" // standard input (motherboard)
42056      // 0x0004 - "dil 8" // standard input (motherboard)
42057      // 0x0008 - "dil 9" // standard input (motherboard)
42058      // 0x0010 - "dil10" // standard input (motherboard)
42059      PORT_MODIFY("IN-18")
42060      // 0x0001 - "dil11" // standard input (motherboard)
42061      // 0x0002 - "dil12" // standard input (motherboard)
42062      // 0x0004 - "dil13" // standard input (motherboard)
42063      // 0x0008 - "dil14" // standard input (motherboard)
42064      // 0x0010 - "dil15" // standard input (motherboard)
42065      PORT_MODIFY("IN-19")
42066      // 0x0001 - "dil16" // standard input (motherboard)
42067      PORT_MODIFY("IN-20")
42068      // 0x0001 - "test OR test" // standard input (motherboard)
42069      // 0x0002 - "dorlk" // standard input (expected here)
42070      // 0x0004 - "topdr" // standard input (expected here)
42071      // 0x0008 - "cshbx" // standard input (expected here)
42072      // 0x0010 - "dump" // standard input (expected here)
4207342073INPUT_PORTS_END
4207442074
4207542075// PR2255 SUITUSIR         SUIT SOUNDS         SUITS U SIR
r31373r31374
4209942099}
4210042100
4210142101INPUT_PORTS_START( sc4sslam ) // this structure is generated
42102        PORT_INCLUDE( sc4_base )
42103        PORT_MODIFY("IN-1")
42104        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("colwin")
42105        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("payout")
42106        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("sprslm")
42107        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("selins")
42108        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("chgstk")
42109        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
42110        PORT_MODIFY("IN-2")
42111        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("maxbet")
42112        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42113        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42114        PORT_MODIFY("IN-3")
42115        // 0x0004 - "stk 4" // standard input (expected here)
42116        // 0x0008 - "stk 3" // standard input (expected here)
42117        // 0x0010 - "stk 2" // standard input (expected here)
42118        PORT_MODIFY("IN-4")
42119        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
42120        PORT_MODIFY("IN-5")
42121        // 0x0001 - "priz4" // standard input (expected here)
42122        // 0x0002 - "priz3" // standard input (expected here)
42123        // 0x0004 - "priz2" // standard input (expected here)
42124        // 0x0008 - "priz1" // standard input (expected here)
42125        PORT_MODIFY("IN-16")
42126        // 0x0001 - "dil 1" // standard input (motherboard)
42127        // 0x0002 - "dil 2" // standard input (motherboard)
42128        // 0x0004 - "dil 3" // standard input (motherboard)
42129        // 0x0008 - "dil 4" // standard input (motherboard)
42130        // 0x0010 - "dil 5" // standard input (motherboard)
42131        // 0x0100 - "top up" // known extended input, usually 'top up'
42132        PORT_MODIFY("IN-17")
42133        // 0x0001 - "dil 6" // standard input (motherboard)
42134        // 0x0002 - "dil 7" // standard input (motherboard)
42135        // 0x0004 - "dil 8" // standard input (motherboard)
42136        // 0x0008 - "dil 9" // standard input (motherboard)
42137        // 0x0010 - "dil10" // standard input (motherboard)
42138        PORT_MODIFY("IN-18")
42139        // 0x0001 - "dil11" // standard input (motherboard)
42140        // 0x0002 - "dil12" // standard input (motherboard)
42141        // 0x0004 - "dil13" // standard input (motherboard)
42142        // 0x0008 - "dil14" // standard input (motherboard)
42143        // 0x0010 - "dil15" // standard input (motherboard)
42144        PORT_MODIFY("IN-19")
42145        // 0x0001 - "dil16" // standard input (motherboard)
42146        PORT_MODIFY("IN-20")
42147        // 0x0001 - "grnbut" // standard input (motherboard)
42148        // 0x0002 - "dorlok" // standard input (expected here)
42149        // 0x0004 - "topdor" // standard input (expected here)
42150        // 0x0008 - "botdor" // standard input (expected here)
42151        // 0x0010 - "hopdmp" // standard input (expected here)
42102      PORT_INCLUDE( sc4_base )
42103      PORT_MODIFY("IN-1")
42104      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("colwin")
42105      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("payout")
42106      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("sprslm")
42107      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("selins")
42108      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("chgstk")
42109      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
42110      PORT_MODIFY("IN-2")
42111      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("maxbet")
42112      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42113      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42114      PORT_MODIFY("IN-3")
42115      // 0x0004 - "stk 4" // standard input (expected here)
42116      // 0x0008 - "stk 3" // standard input (expected here)
42117      // 0x0010 - "stk 2" // standard input (expected here)
42118      PORT_MODIFY("IN-4")
42119      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
42120      PORT_MODIFY("IN-5")
42121      // 0x0001 - "priz4" // standard input (expected here)
42122      // 0x0002 - "priz3" // standard input (expected here)
42123      // 0x0004 - "priz2" // standard input (expected here)
42124      // 0x0008 - "priz1" // standard input (expected here)
42125      PORT_MODIFY("IN-16")
42126      // 0x0001 - "dil 1" // standard input (motherboard)
42127      // 0x0002 - "dil 2" // standard input (motherboard)
42128      // 0x0004 - "dil 3" // standard input (motherboard)
42129      // 0x0008 - "dil 4" // standard input (motherboard)
42130      // 0x0010 - "dil 5" // standard input (motherboard)
42131      // 0x0100 - "top up" // known extended input, usually 'top up'
42132      PORT_MODIFY("IN-17")
42133      // 0x0001 - "dil 6" // standard input (motherboard)
42134      // 0x0002 - "dil 7" // standard input (motherboard)
42135      // 0x0004 - "dil 8" // standard input (motherboard)
42136      // 0x0008 - "dil 9" // standard input (motherboard)
42137      // 0x0010 - "dil10" // standard input (motherboard)
42138      PORT_MODIFY("IN-18")
42139      // 0x0001 - "dil11" // standard input (motherboard)
42140      // 0x0002 - "dil12" // standard input (motherboard)
42141      // 0x0004 - "dil13" // standard input (motherboard)
42142      // 0x0008 - "dil14" // standard input (motherboard)
42143      // 0x0010 - "dil15" // standard input (motherboard)
42144      PORT_MODIFY("IN-19")
42145      // 0x0001 - "dil16" // standard input (motherboard)
42146      PORT_MODIFY("IN-20")
42147      // 0x0001 - "grnbut" // standard input (motherboard)
42148      // 0x0002 - "dorlok" // standard input (expected here)
42149      // 0x0004 - "topdor" // standard input (expected here)
42150      // 0x0008 - "botdor" // standard input (expected here)
42151      // 0x0010 - "hopdmp" // standard input (expected here)
4215242152INPUT_PORTS_END
4215342153
4215442154// PR3081 CLUB SUPER SLAM         SUPER SLAM  CLUB  PR3080 SUPER SLAM SOUNDS11
r31373r31374
4217342173}
4217442174
4217542175INPUT_PORTS_START( sc4swbak ) // this structure is generated
42176        PORT_INCLUDE( sc4_base )
42177        PORT_MODIFY("IN-1")
42178        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
42179        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
42180        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
42181        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
42182        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
42183        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
42184        PORT_MODIFY("IN-2")
42185        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
42186        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("tk fea")
42187        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42188        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42189        PORT_MODIFY("IN-3")
42190        // 0x0004 - "stk3" // standard input (expected here)
42191        // 0x0008 - "stk1" // standard input (expected here)
42192        // 0x0010 - "stk2" // standard input (expected here)
42193        PORT_MODIFY("IN-5")
42194        // 0x0001 - "jp 1" // standard input (expected here)
42195        // 0x0002 - "jp 2" // standard input (expected here)
42196        // 0x0004 - "jp 3" // standard input (expected here)
42197        // 0x0008 - "jp 4" // standard input (expected here)
42198        PORT_MODIFY("IN-6")
42199        // 0x0001 - "pc 1" // standard input (expected here)
42200        // 0x0002 - "pc 2" // standard input (expected here)
42201        // 0x0004 - "pc 3" // standard input (expected here)
42202        // 0x0008 - "pc 4" // standard input (expected here)
42203        PORT_MODIFY("IN-8")
42204        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("gamble")
42205        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
42206        PORT_MODIFY("IN-16")
42207        // 0x0001 - "dil 1" // standard input (motherboard)
42208        // 0x0002 - "dil 2" // standard input (motherboard)
42209        // 0x0004 - "dil 3" // standard input (motherboard)
42210        // 0x0008 - "dil 4" // standard input (motherboard)
42211        // 0x0010 - "dil 5" // standard input (motherboard)
42212        // 0x0100 - "top up" // known extended input, usually 'top up'
42213        PORT_MODIFY("IN-17")
42214        // 0x0001 - "dil 6" // standard input (motherboard)
42215        // 0x0002 - "dil 7" // standard input (motherboard)
42216        // 0x0004 - "dil 8" // standard input (motherboard)
42217        // 0x0008 - "dil 9" // standard input (motherboard)
42218        // 0x0010 - "dil10" // standard input (motherboard)
42219        PORT_MODIFY("IN-18")
42220        // 0x0001 - "dil11" // standard input (motherboard)
42221        // 0x0002 - "dil12" // standard input (motherboard)
42222        // 0x0004 - "dil13" // standard input (motherboard)
42223        // 0x0008 - "dil14" // standard input (motherboard)
42224        // 0x0010 - "dil15" // standard input (motherboard)
42225        PORT_MODIFY("IN-19")
42226        // 0x0001 - "dil16" // standard input (motherboard)
42227        PORT_MODIFY("IN-20")
42228        // 0x0001 - "test" // standard input (motherboard)
42229        // 0x0002 - "dorlk" // standard input (expected here)
42230        // 0x0004 - "topdr" // standard input (expected here)
42231        // 0x0008 - "cshbx" // standard input (expected here)
42232        // 0x0010 - "dump" // standard input (expected here)
42176      PORT_INCLUDE( sc4_base )
42177      PORT_MODIFY("IN-1")
42178      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
42179      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
42180      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
42181      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
42182      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
42183      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
42184      PORT_MODIFY("IN-2")
42185      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
42186      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("tk fea")
42187      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42188      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42189      PORT_MODIFY("IN-3")
42190      // 0x0004 - "stk3" // standard input (expected here)
42191      // 0x0008 - "stk1" // standard input (expected here)
42192      // 0x0010 - "stk2" // standard input (expected here)
42193      PORT_MODIFY("IN-5")
42194      // 0x0001 - "jp 1" // standard input (expected here)
42195      // 0x0002 - "jp 2" // standard input (expected here)
42196      // 0x0004 - "jp 3" // standard input (expected here)
42197      // 0x0008 - "jp 4" // standard input (expected here)
42198      PORT_MODIFY("IN-6")
42199      // 0x0001 - "pc 1" // standard input (expected here)
42200      // 0x0002 - "pc 2" // standard input (expected here)
42201      // 0x0004 - "pc 3" // standard input (expected here)
42202      // 0x0008 - "pc 4" // standard input (expected here)
42203      PORT_MODIFY("IN-8")
42204      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("gamble")
42205      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
42206      PORT_MODIFY("IN-16")
42207      // 0x0001 - "dil 1" // standard input (motherboard)
42208      // 0x0002 - "dil 2" // standard input (motherboard)
42209      // 0x0004 - "dil 3" // standard input (motherboard)
42210      // 0x0008 - "dil 4" // standard input (motherboard)
42211      // 0x0010 - "dil 5" // standard input (motherboard)
42212      // 0x0100 - "top up" // known extended input, usually 'top up'
42213      PORT_MODIFY("IN-17")
42214      // 0x0001 - "dil 6" // standard input (motherboard)
42215      // 0x0002 - "dil 7" // standard input (motherboard)
42216      // 0x0004 - "dil 8" // standard input (motherboard)
42217      // 0x0008 - "dil 9" // standard input (motherboard)
42218      // 0x0010 - "dil10" // standard input (motherboard)
42219      PORT_MODIFY("IN-18")
42220      // 0x0001 - "dil11" // standard input (motherboard)
42221      // 0x0002 - "dil12" // standard input (motherboard)
42222      // 0x0004 - "dil13" // standard input (motherboard)
42223      // 0x0008 - "dil14" // standard input (motherboard)
42224      // 0x0010 - "dil15" // standard input (motherboard)
42225      PORT_MODIFY("IN-19")
42226      // 0x0001 - "dil16" // standard input (motherboard)
42227      PORT_MODIFY("IN-20")
42228      // 0x0001 - "test" // standard input (motherboard)
42229      // 0x0002 - "dorlk" // standard input (expected here)
42230      // 0x0004 - "topdr" // standard input (expected here)
42231      // 0x0008 - "cshbx" // standard input (expected here)
42232      // 0x0010 - "dump" // standard input (expected here)
4223342233INPUT_PORTS_END
4223442234
4223542235// PR2235 SWITCHBACK         SWBK SOUNDS         SWITCHBACK
r31373r31374
4225642256}
4225742257
4225842258INPUT_PORTS_START( sc4ttpie ) // this structure is generated
42259        PORT_INCLUDE( sc4_base )
42260        PORT_MODIFY("IN-1")
42261        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
42262        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
42263        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
42264        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
42265        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 4")
42266        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42267        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42268        PORT_MODIFY("IN-2")
42269        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("cstake")
42270        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
42271        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42272        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42273        PORT_MODIFY("IN-3")
42274        // 0x0004 - "stk 4" // standard input (expected here)
42275        // 0x0008 - "stk 2" // standard input (expected here)
42276        // 0x0010 - "stk 3" // standard input (expected here)
42277        PORT_MODIFY("IN-5")
42278        // 0x0001 - "priz4" // standard input (expected here)
42279        // 0x0002 - "priz3" // standard input (expected here)
42280        // 0x0004 - "priz2" // standard input (expected here)
42281        // 0x0008 - "priz1" // standard input (expected here)
42282        PORT_MODIFY("IN-6")
42283        // 0x0001 - "perc1" // standard input (expected here)
42284        // 0x0002 - "perc2" // standard input (expected here)
42285        // 0x0004 - "perc3" // standard input (expected here)
42286        // 0x0008 - "perc4" // standard input (expected here)
42287        PORT_MODIFY("IN-8")
42288        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("checkm")
42289        PORT_MODIFY("IN-16")
42290        // 0x0001 - "dil1" // standard input (motherboard)
42291        // 0x0002 - "dil2" // standard input (motherboard)
42292        // 0x0004 - "dil3" // standard input (motherboard)
42293        // 0x0008 - "dil4" // standard input (motherboard)
42294        // 0x0010 - "dil5" // standard input (motherboard)
42295        // 0x0100 - "top up" // known extended input, usually 'top up'
42296        PORT_MODIFY("IN-17")
42297        // 0x0001 - "dil6" // standard input (motherboard)
42298        // 0x0002 - "dil7" // standard input (motherboard)
42299        // 0x0004 - "dil8" // standard input (motherboard)
42300        // 0x0008 - "dil9" // standard input (motherboard)
42301        // 0x0010 - "dil10" // standard input (motherboard)
42302        PORT_MODIFY("IN-18")
42303        // 0x0001 - "dil11" // standard input (motherboard)
42304        // 0x0002 - "dil12" // standard input (motherboard)
42305        // 0x0004 - "dil13" // standard input (motherboard)
42306        // 0x0008 - "dil14" // standard input (motherboard)
42307        // 0x0010 - "dil15" // standard input (motherboard)
42308        PORT_MODIFY("IN-19")
42309        // 0x0001 - "dil16" // standard input (motherboard)
42310        PORT_MODIFY("IN-20")
42311        // 0x0001 - "grnbut" // standard input (motherboard)
42312        // 0x0002 - "dorlok" // standard input (expected here)
42313        // 0x0004 - "serdor" // standard input (expected here)
42314        // 0x0008 - "cshdor" // standard input (expected here)
42315        // 0x0010 - "hopdmp" // standard input (expected here)
42259      PORT_INCLUDE( sc4_base )
42260      PORT_MODIFY("IN-1")
42261      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
42262      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
42263      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
42264      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
42265      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 4")
42266      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42267      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42268      PORT_MODIFY("IN-2")
42269      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("cstake")
42270      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
42271      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42272      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42273      PORT_MODIFY("IN-3")
42274      // 0x0004 - "stk 4" // standard input (expected here)
42275      // 0x0008 - "stk 2" // standard input (expected here)
42276      // 0x0010 - "stk 3" // standard input (expected here)
42277      PORT_MODIFY("IN-5")
42278      // 0x0001 - "priz4" // standard input (expected here)
42279      // 0x0002 - "priz3" // standard input (expected here)
42280      // 0x0004 - "priz2" // standard input (expected here)
42281      // 0x0008 - "priz1" // standard input (expected here)
42282      PORT_MODIFY("IN-6")
42283      // 0x0001 - "perc1" // standard input (expected here)
42284      // 0x0002 - "perc2" // standard input (expected here)
42285      // 0x0004 - "perc3" // standard input (expected here)
42286      // 0x0008 - "perc4" // standard input (expected here)
42287      PORT_MODIFY("IN-8")
42288      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("checkm")
42289      PORT_MODIFY("IN-16")
42290      // 0x0001 - "dil1" // standard input (motherboard)
42291      // 0x0002 - "dil2" // standard input (motherboard)
42292      // 0x0004 - "dil3" // standard input (motherboard)
42293      // 0x0008 - "dil4" // standard input (motherboard)
42294      // 0x0010 - "dil5" // standard input (motherboard)
42295      // 0x0100 - "top up" // known extended input, usually 'top up'
42296      PORT_MODIFY("IN-17")
42297      // 0x0001 - "dil6" // standard input (motherboard)
42298      // 0x0002 - "dil7" // standard input (motherboard)
42299      // 0x0004 - "dil8" // standard input (motherboard)
42300      // 0x0008 - "dil9" // standard input (motherboard)
42301      // 0x0010 - "dil10" // standard input (motherboard)
42302      PORT_MODIFY("IN-18")
42303      // 0x0001 - "dil11" // standard input (motherboard)
42304      // 0x0002 - "dil12" // standard input (motherboard)
42305      // 0x0004 - "dil13" // standard input (motherboard)
42306      // 0x0008 - "dil14" // standard input (motherboard)
42307      // 0x0010 - "dil15" // standard input (motherboard)
42308      PORT_MODIFY("IN-19")
42309      // 0x0001 - "dil16" // standard input (motherboard)
42310      PORT_MODIFY("IN-20")
42311      // 0x0001 - "grnbut" // standard input (motherboard)
42312      // 0x0002 - "dorlok" // standard input (expected here)
42313      // 0x0004 - "serdor" // standard input (expected here)
42314      // 0x0008 - "cshdor" // standard input (expected here)
42315      // 0x0010 - "hopdmp" // standard input (expected here)
4231642316INPUT_PORTS_END
4231742317
4231842318// PR1714 AWP TAKE THE PIECE S4         PR1714 TAKE THE PIECE SOUNDS11    TAKETHEPIECE  S.SITE
r31373r31374
4234442344}
4234542345
4234642346INPUT_PORTS_START( sc4typ ) // this structure is generated
42347        PORT_INCLUDE( sc4_base )
42348        PORT_MODIFY("IN-1")
42349        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
42350        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
42351        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
42352        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
42353        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("cstake")
42354        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42355        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42356        PORT_MODIFY("IN-2")
42357        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("colect")
42358        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
42359        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42360        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42361        PORT_MODIFY("IN-3")
42362        // 0x0004 - "stk 4" // standard input (expected here)
42363        // 0x0008 - "stk 3" // standard input (expected here)
42364        // 0x0010 - "stk 2" // standard input (expected here)
42365        PORT_MODIFY("IN-5")
42366        // 0x0001 - "priz4" // standard input (expected here)
42367        // 0x0002 - "priz3" // standard input (expected here)
42368        // 0x0004 - "priz2" // standard input (expected here)
42369        // 0x0008 - "priz1" // standard input (expected here)
42370        PORT_MODIFY("IN-6")
42371        // 0x0001 - "perc1" // standard input (expected here)
42372        // 0x0002 - "perc2" // standard input (expected here)
42373        // 0x0004 - "perc3" // standard input (expected here)
42374        // 0x0008 - "perc4" // standard input (expected here)
42375        PORT_MODIFY("IN-8")
42376        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("open r")
42377        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("reject")
42378        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("accept")
42379        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("open l")
42380        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c or b")
42381        PORT_MODIFY("IN-16")
42382        // 0x0001 - "dil1" // standard input (motherboard)
42383        // 0x0002 - "dil2" // standard input (motherboard)
42384        // 0x0004 - "dil3" // standard input (motherboard)
42385        // 0x0008 - "dil4" // standard input (motherboard)
42386        // 0x0010 - "dil5" // standard input (motherboard)
42387        // 0x0100 - "top up" // known extended input, usually 'top up'
42388        PORT_MODIFY("IN-17")
42389        // 0x0001 - "dil6" // standard input (motherboard)
42390        // 0x0002 - "dil7" // standard input (motherboard)
42391        // 0x0004 - "dil8" // standard input (motherboard)
42392        // 0x0008 - "dil9" // standard input (motherboard)
42393        // 0x0010 - "dil10" // standard input (motherboard)
42394        PORT_MODIFY("IN-18")
42395        // 0x0001 - "dil11" // standard input (motherboard)
42396        // 0x0002 - "dil12" // standard input (motherboard)
42397        // 0x0004 - "dil13" // standard input (motherboard)
42398        // 0x0008 - "dil14" // standard input (motherboard)
42399        // 0x0010 - "dil15" // standard input (motherboard)
42400        PORT_MODIFY("IN-19")
42401        // 0x0001 - "dil16" // standard input (motherboard)
42402        PORT_MODIFY("IN-20")
42403        // 0x0001 - "grnbut" // standard input (motherboard)
42404        // 0x0002 - "dorlok" // standard input (expected here)
42405        // 0x0004 - "serdor" // standard input (expected here)
42406        // 0x0008 - "cshdor" // standard input (expected here)
42407        // 0x0010 - "hopdmp" // standard input (expected here)
42347      PORT_INCLUDE( sc4_base )
42348      PORT_MODIFY("IN-1")
42349      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
42350      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
42351      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
42352      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
42353      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("cstake")
42354      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42355      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42356      PORT_MODIFY("IN-2")
42357      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("colect")
42358      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
42359      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42360      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42361      PORT_MODIFY("IN-3")
42362      // 0x0004 - "stk 4" // standard input (expected here)
42363      // 0x0008 - "stk 3" // standard input (expected here)
42364      // 0x0010 - "stk 2" // standard input (expected here)
42365      PORT_MODIFY("IN-5")
42366      // 0x0001 - "priz4" // standard input (expected here)
42367      // 0x0002 - "priz3" // standard input (expected here)
42368      // 0x0004 - "priz2" // standard input (expected here)
42369      // 0x0008 - "priz1" // standard input (expected here)
42370      PORT_MODIFY("IN-6")
42371      // 0x0001 - "perc1" // standard input (expected here)
42372      // 0x0002 - "perc2" // standard input (expected here)
42373      // 0x0004 - "perc3" // standard input (expected here)
42374      // 0x0008 - "perc4" // standard input (expected here)
42375      PORT_MODIFY("IN-8")
42376      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("open r")
42377      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("reject")
42378      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("accept")
42379      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("open l")
42380      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c or b")
42381      PORT_MODIFY("IN-16")
42382      // 0x0001 - "dil1" // standard input (motherboard)
42383      // 0x0002 - "dil2" // standard input (motherboard)
42384      // 0x0004 - "dil3" // standard input (motherboard)
42385      // 0x0008 - "dil4" // standard input (motherboard)
42386      // 0x0010 - "dil5" // standard input (motherboard)
42387      // 0x0100 - "top up" // known extended input, usually 'top up'
42388      PORT_MODIFY("IN-17")
42389      // 0x0001 - "dil6" // standard input (motherboard)
42390      // 0x0002 - "dil7" // standard input (motherboard)
42391      // 0x0004 - "dil8" // standard input (motherboard)
42392      // 0x0008 - "dil9" // standard input (motherboard)
42393      // 0x0010 - "dil10" // standard input (motherboard)
42394      PORT_MODIFY("IN-18")
42395      // 0x0001 - "dil11" // standard input (motherboard)
42396      // 0x0002 - "dil12" // standard input (motherboard)
42397      // 0x0004 - "dil13" // standard input (motherboard)
42398      // 0x0008 - "dil14" // standard input (motherboard)
42399      // 0x0010 - "dil15" // standard input (motherboard)
42400      PORT_MODIFY("IN-19")
42401      // 0x0001 - "dil16" // standard input (motherboard)
42402      PORT_MODIFY("IN-20")
42403      // 0x0001 - "grnbut" // standard input (motherboard)
42404      // 0x0002 - "dorlok" // standard input (expected here)
42405      // 0x0004 - "serdor" // standard input (expected here)
42406      // 0x0008 - "cshdor" // standard input (expected here)
42407      // 0x0010 - "hopdmp" // standard input (expected here)
4240842408INPUT_PORTS_END
4240942409
4241042410// PR3031 AWP TAKE YOUR PICK S4         PR3001 TAKE YOUR PICK SOUNDS11    TAKE YOUR PICK  S.SITE
r31373r31374
4243042430}
4243142431
4243242432INPUT_PORTS_START( sc4trail ) // this structure is generated
42433        PORT_INCLUDE( sc4_base )
42434        PORT_MODIFY("IN-1")
42435        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
42436        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
42437        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
42438        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
42439        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
42440        PORT_MODIFY("IN-2")
42441        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
42442        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
42443        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42444        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42445        PORT_MODIFY("IN-8")
42446        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("step OR tke ft")
42447        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nuds")
42448        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
42449        PORT_MODIFY("IN-16")
42450        // 0x0001 - "dil 1" // standard input (motherboard)
42451        // 0x0002 - "dil 2" // standard input (motherboard)
42452        // 0x0004 - "dil 3" // standard input (motherboard)
42453        // 0x0008 - "dil 4" // standard input (motherboard)
42454        // 0x0010 - "dil 5" // standard input (motherboard)
42455        // 0x0100 - "top up" // known extended input, usually 'top up'
42456        PORT_MODIFY("IN-17")
42457        // 0x0001 - "dil 6" // standard input (motherboard)
42458        // 0x0002 - "dil 7" // standard input (motherboard)
42459        // 0x0004 - "dil 8" // standard input (motherboard)
42460        // 0x0008 - "dil 9" // standard input (motherboard)
42461        // 0x0010 - "dil10" // standard input (motherboard)
42462        PORT_MODIFY("IN-18")
42463        // 0x0001 - "dil11" // standard input (motherboard)
42464        // 0x0002 - "dil12" // standard input (motherboard)
42465        // 0x0004 - "dil13" // standard input (motherboard)
42466        // 0x0008 - "dil14" // standard input (motherboard)
42467        // 0x0010 - "dil15" // standard input (motherboard)
42468        PORT_MODIFY("IN-19")
42469        // 0x0001 - "dil16" // standard input (motherboard)
42470        PORT_MODIFY("IN-20")
42471        // 0x0001 - "test" // standard input (motherboard)
42472        // 0x0002 - "dor lk" // standard input (expected here)
42473        // 0x0004 - "tp dor" // standard input (expected here)
42474        // 0x0008 - "csh bx" // standard input (expected here)
42475        // 0x0010 - "deflt" // standard input (expected here)
42433      PORT_INCLUDE( sc4_base )
42434      PORT_MODIFY("IN-1")
42435      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
42436      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
42437      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
42438      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
42439      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
42440      PORT_MODIFY("IN-2")
42441      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
42442      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
42443      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42444      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42445      PORT_MODIFY("IN-8")
42446      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("step OR tke ft")
42447      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nuds")
42448      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
42449      PORT_MODIFY("IN-16")
42450      // 0x0001 - "dil 1" // standard input (motherboard)
42451      // 0x0002 - "dil 2" // standard input (motherboard)
42452      // 0x0004 - "dil 3" // standard input (motherboard)
42453      // 0x0008 - "dil 4" // standard input (motherboard)
42454      // 0x0010 - "dil 5" // standard input (motherboard)
42455      // 0x0100 - "top up" // known extended input, usually 'top up'
42456      PORT_MODIFY("IN-17")
42457      // 0x0001 - "dil 6" // standard input (motherboard)
42458      // 0x0002 - "dil 7" // standard input (motherboard)
42459      // 0x0004 - "dil 8" // standard input (motherboard)
42460      // 0x0008 - "dil 9" // standard input (motherboard)
42461      // 0x0010 - "dil10" // standard input (motherboard)
42462      PORT_MODIFY("IN-18")
42463      // 0x0001 - "dil11" // standard input (motherboard)
42464      // 0x0002 - "dil12" // standard input (motherboard)
42465      // 0x0004 - "dil13" // standard input (motherboard)
42466      // 0x0008 - "dil14" // standard input (motherboard)
42467      // 0x0010 - "dil15" // standard input (motherboard)
42468      PORT_MODIFY("IN-19")
42469      // 0x0001 - "dil16" // standard input (motherboard)
42470      PORT_MODIFY("IN-20")
42471      // 0x0001 - "test" // standard input (motherboard)
42472      // 0x0002 - "dor lk" // standard input (expected here)
42473      // 0x0004 - "tp dor" // standard input (expected here)
42474      // 0x0008 - "csh bx" // standard input (expected here)
42475      // 0x0010 - "deflt" // standard input (expected here)
4247642476INPUT_PORTS_END
4247742477
4247842478// PR2170 TRAIL BLAZER         TRAB SOUNDS                  TRAIL BLAZER
r31373r31374
4250042500}
4250142501
4250242502INPUT_PORTS_START( sc4bpb ) // this structure is generated
42503        PORT_INCLUDE( sc4_base )
42504        PORT_MODIFY("IN-1")
42505        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
42506        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
42507        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
42508        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
42509        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
42510        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42511        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42512        PORT_MODIFY("IN-2")
42513        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
42514        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
42515        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42516        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42517        PORT_MODIFY("IN-3")
42518        // 0x0004 - "stk 4" // standard input (expected here)
42519        // 0x0008 - "stk 2" // standard input (expected here)
42520        // 0x0010 - "stk 3" // standard input (expected here)
42521        PORT_MODIFY("IN-5")
42522        // 0x0001 - "priz4" // standard input (expected here)
42523        // 0x0002 - "priz3" // standard input (expected here)
42524        // 0x0004 - "priz2" // standard input (expected here)
42525        // 0x0008 - "priz1" // standard input (expected here)
42526        PORT_MODIFY("IN-6")
42527        // 0x0001 - "perc1" // standard input (expected here)
42528        // 0x0002 - "perc2" // standard input (expected here)
42529        // 0x0004 - "perc3" // standard input (expected here)
42530        // 0x0008 - "perc4" // standard input (expected here)
42531        PORT_MODIFY("IN-8")
42532        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("gamble")
42533        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("throws")
42534        PORT_MODIFY("IN-16")
42535        // 0x0001 - "dil1" // standard input (motherboard)
42536        // 0x0002 - "dil2" // standard input (motherboard)
42537        // 0x0004 - "dil3" // standard input (motherboard)
42538        // 0x0008 - "dil4" // standard input (motherboard)
42539        // 0x0010 - "dil5" // standard input (motherboard)
42540        // 0x0100 - "top up" // known extended input, usually 'top up'
42541        PORT_MODIFY("IN-17")
42542        // 0x0001 - "dil6" // standard input (motherboard)
42543        // 0x0002 - "dil7" // standard input (motherboard)
42544        // 0x0004 - "dil8" // standard input (motherboard)
42545        // 0x0008 - "dil9" // standard input (motherboard)
42546        // 0x0010 - "dil10" // standard input (motherboard)
42547        PORT_MODIFY("IN-18")
42548        // 0x0001 - "dil11" // standard input (motherboard)
42549        // 0x0002 - "dil12" // standard input (motherboard)
42550        // 0x0004 - "dil13" // standard input (motherboard)
42551        // 0x0008 - "dil14" // standard input (motherboard)
42552        // 0x0010 - "dil15" // standard input (motherboard)
42553        PORT_MODIFY("IN-19")
42554        // 0x0001 - "dil16" // standard input (motherboard)
42555        PORT_MODIFY("IN-20")
42556        // 0x0001 - "grnbut" // standard input (motherboard)
42557        // 0x0002 - "dorlok" // standard input (expected here)
42558        // 0x0004 - "serdor" // standard input (expected here)
42559        // 0x0008 - "cshdor" // standard input (expected here)
42560        // 0x0010 - "hopdmp" // standard input (expected here)
42503      PORT_INCLUDE( sc4_base )
42504      PORT_MODIFY("IN-1")
42505      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
42506      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
42507      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
42508      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
42509      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
42510      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42511      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42512      PORT_MODIFY("IN-2")
42513      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
42514      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
42515      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42516      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42517      PORT_MODIFY("IN-3")
42518      // 0x0004 - "stk 4" // standard input (expected here)
42519      // 0x0008 - "stk 2" // standard input (expected here)
42520      // 0x0010 - "stk 3" // standard input (expected here)
42521      PORT_MODIFY("IN-5")
42522      // 0x0001 - "priz4" // standard input (expected here)
42523      // 0x0002 - "priz3" // standard input (expected here)
42524      // 0x0004 - "priz2" // standard input (expected here)
42525      // 0x0008 - "priz1" // standard input (expected here)
42526      PORT_MODIFY("IN-6")
42527      // 0x0001 - "perc1" // standard input (expected here)
42528      // 0x0002 - "perc2" // standard input (expected here)
42529      // 0x0004 - "perc3" // standard input (expected here)
42530      // 0x0008 - "perc4" // standard input (expected here)
42531      PORT_MODIFY("IN-8")
42532      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("gamble")
42533      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("throws")
42534      PORT_MODIFY("IN-16")
42535      // 0x0001 - "dil1" // standard input (motherboard)
42536      // 0x0002 - "dil2" // standard input (motherboard)
42537      // 0x0004 - "dil3" // standard input (motherboard)
42538      // 0x0008 - "dil4" // standard input (motherboard)
42539      // 0x0010 - "dil5" // standard input (motherboard)
42540      // 0x0100 - "top up" // known extended input, usually 'top up'
42541      PORT_MODIFY("IN-17")
42542      // 0x0001 - "dil6" // standard input (motherboard)
42543      // 0x0002 - "dil7" // standard input (motherboard)
42544      // 0x0004 - "dil8" // standard input (motherboard)
42545      // 0x0008 - "dil9" // standard input (motherboard)
42546      // 0x0010 - "dil10" // standard input (motherboard)
42547      PORT_MODIFY("IN-18")
42548      // 0x0001 - "dil11" // standard input (motherboard)
42549      // 0x0002 - "dil12" // standard input (motherboard)
42550      // 0x0004 - "dil13" // standard input (motherboard)
42551      // 0x0008 - "dil14" // standard input (motherboard)
42552      // 0x0010 - "dil15" // standard input (motherboard)
42553      PORT_MODIFY("IN-19")
42554      // 0x0001 - "dil16" // standard input (motherboard)
42555      PORT_MODIFY("IN-20")
42556      // 0x0001 - "grnbut" // standard input (motherboard)
42557      // 0x0002 - "dorlok" // standard input (expected here)
42558      // 0x0004 - "serdor" // standard input (expected here)
42559      // 0x0008 - "cshdor" // standard input (expected here)
42560      // 0x0010 - "hopdmp" // standard input (expected here)
4256142561INPUT_PORTS_END
4256242562
4256342563// PR1728 AWP BULLY'S PRIZE BOARD         PR1708 B PRIZE BOARD SOUNDS11     BULLYSPRIZEBOARD  S.SITE
r31373r31374
4258742587}
4258842588
4258942589INPUT_PORTS_START( sc4bsp ) // this structure is generated
42590        PORT_INCLUDE( sc4_base )
42591        PORT_MODIFY("IN-1")
42592        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
42593        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
42594        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
42595        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
42596        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
42597        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42598        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42599        PORT_MODIFY("IN-2")
42600        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
42601        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("tra/ex")
42602        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("sta/ga")
42603        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42604        PORT_MODIFY("IN-3")
42605        // 0x0004 - "stk 4" // standard input (expected here)
42606        // 0x0008 - "stk 3" // standard input (expected here)
42607        // 0x0010 - "stk 2" // standard input (expected here)
42608        PORT_MODIFY("IN-5")
42609        // 0x0001 - "priz4" // standard input (expected here)
42610        // 0x0002 - "priz3" // standard input (expected here)
42611        // 0x0004 - "priz2" // standard input (expected here)
42612        // 0x0008 - "priz1" // standard input (expected here)
42613        PORT_MODIFY("IN-6")
42614        // 0x0001 - "perc1" // standard input (expected here)
42615        // 0x0002 - "perc2" // standard input (expected here)
42616        // 0x0004 - "perc3" // standard input (expected here)
42617        // 0x0008 - "perc4" // standard input (expected here)
42618        PORT_MODIFY("IN-8")
42619        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bankit")
42620        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bns")
42621        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk csh")
42622        PORT_MODIFY("IN-16")
42623        // 0x0001 - "dil1" // standard input (motherboard)
42624        // 0x0002 - "dil2" // standard input (motherboard)
42625        // 0x0004 - "dil3" // standard input (motherboard)
42626        // 0x0008 - "dil4" // standard input (motherboard)
42627        // 0x0010 - "dil5" // standard input (motherboard)
42628        // 0x0100 - "top up" // known extended input, usually 'top up'
42629        PORT_MODIFY("IN-17")
42630        // 0x0001 - "dil6" // standard input (motherboard)
42631        // 0x0002 - "dil7" // standard input (motherboard)
42632        // 0x0004 - "dil8" // standard input (motherboard)
42633        // 0x0008 - "dil9" // standard input (motherboard)
42634        // 0x0010 - "dil10" // standard input (motherboard)
42635        PORT_MODIFY("IN-18")
42636        // 0x0001 - "dil11" // standard input (motherboard)
42637        // 0x0002 - "dil12" // standard input (motherboard)
42638        // 0x0004 - "dil13" // standard input (motherboard)
42639        // 0x0008 - "dil14" // standard input (motherboard)
42640        // 0x0010 - "dil15" // standard input (motherboard)
42641        PORT_MODIFY("IN-19")
42642        // 0x0001 - "dil16" // standard input (motherboard)
42643        PORT_MODIFY("IN-20")
42644        // 0x0001 - "grnbut" // standard input (motherboard)
42645        // 0x0002 - "dorlok" // standard input (expected here)
42646        // 0x0004 - "serdor" // standard input (expected here)
42647        // 0x0008 - "cshdor" // standard input (expected here)
42648        // 0x0010 - "hopdmp" // standard input (expected here)
42590      PORT_INCLUDE( sc4_base )
42591      PORT_MODIFY("IN-1")
42592      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
42593      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
42594      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
42595      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
42596      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
42597      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42598      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42599      PORT_MODIFY("IN-2")
42600      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
42601      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("tra/ex")
42602      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("sta/ga")
42603      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42604      PORT_MODIFY("IN-3")
42605      // 0x0004 - "stk 4" // standard input (expected here)
42606      // 0x0008 - "stk 3" // standard input (expected here)
42607      // 0x0010 - "stk 2" // standard input (expected here)
42608      PORT_MODIFY("IN-5")
42609      // 0x0001 - "priz4" // standard input (expected here)
42610      // 0x0002 - "priz3" // standard input (expected here)
42611      // 0x0004 - "priz2" // standard input (expected here)
42612      // 0x0008 - "priz1" // standard input (expected here)
42613      PORT_MODIFY("IN-6")
42614      // 0x0001 - "perc1" // standard input (expected here)
42615      // 0x0002 - "perc2" // standard input (expected here)
42616      // 0x0004 - "perc3" // standard input (expected here)
42617      // 0x0008 - "perc4" // standard input (expected here)
42618      PORT_MODIFY("IN-8")
42619      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bankit")
42620      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bns")
42621      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk csh")
42622      PORT_MODIFY("IN-16")
42623      // 0x0001 - "dil1" // standard input (motherboard)
42624      // 0x0002 - "dil2" // standard input (motherboard)
42625      // 0x0004 - "dil3" // standard input (motherboard)
42626      // 0x0008 - "dil4" // standard input (motherboard)
42627      // 0x0010 - "dil5" // standard input (motherboard)
42628      // 0x0100 - "top up" // known extended input, usually 'top up'
42629      PORT_MODIFY("IN-17")
42630      // 0x0001 - "dil6" // standard input (motherboard)
42631      // 0x0002 - "dil7" // standard input (motherboard)
42632      // 0x0004 - "dil8" // standard input (motherboard)
42633      // 0x0008 - "dil9" // standard input (motherboard)
42634      // 0x0010 - "dil10" // standard input (motherboard)
42635      PORT_MODIFY("IN-18")
42636      // 0x0001 - "dil11" // standard input (motherboard)
42637      // 0x0002 - "dil12" // standard input (motherboard)
42638      // 0x0004 - "dil13" // standard input (motherboard)
42639      // 0x0008 - "dil14" // standard input (motherboard)
42640      // 0x0010 - "dil15" // standard input (motherboard)
42641      PORT_MODIFY("IN-19")
42642      // 0x0001 - "dil16" // standard input (motherboard)
42643      PORT_MODIFY("IN-20")
42644      // 0x0001 - "grnbut" // standard input (motherboard)
42645      // 0x0002 - "dorlok" // standard input (expected here)
42646      // 0x0004 - "serdor" // standard input (expected here)
42647      // 0x0008 - "cshdor" // standard input (expected here)
42648      // 0x0010 - "hopdmp" // standard input (expected here)
4264942649INPUT_PORTS_END
4265042650
4265142651// PR3040 AWP BULLYS STAR PRIZE SCORP4         PR3012 BULLYS STAR P SOUNDS11     BULLYS STARPRIZE  S.SITE
r31373r31374
4267742677}
4267842678
4267942679INPUT_PORTS_START( sc4chain ) // this structure is generated
42680        PORT_INCLUDE( sc4_base )
42681        PORT_MODIFY("IN-1")
42682        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
42683        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
42684        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
42685        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
42686        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
42687        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42688        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42689        PORT_MODIFY("IN-2")
42690        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42691        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42692        PORT_MODIFY("IN-3")
42693        // 0x0004 - "stk 4" // standard input (expected here)
42694        // 0x0008 - "stk 2" // standard input (expected here)
42695        // 0x0010 - "stk 3" // standard input (expected here)
42696        PORT_MODIFY("IN-5")
42697        // 0x0001 - "priz4" // standard input (expected here)
42698        // 0x0002 - "priz3" // standard input (expected here)
42699        // 0x0004 - "priz2" // standard input (expected here)
42700        // 0x0008 - "priz1" // standard input (expected here)
42701        PORT_MODIFY("IN-6")
42702        // 0x0001 - "perc1" // standard input (expected here)
42703        // 0x0002 - "perc2" // standard input (expected here)
42704        // 0x0004 - "perc3" // standard input (expected here)
42705        // 0x0008 - "perc4" // standard input (expected here)
42706        PORT_MODIFY("IN-8")
42707        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
42708        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cas lo")
42709        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("ch stp")
42710        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("db gam")
42711        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("ft stp")
42712        PORT_MODIFY("IN-9")
42713        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("fet lo")
42714        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c feat")
42715        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("cas hi")
42716        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("c doub")
42717        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("fet hi")
42718        PORT_MODIFY("IN-16")
42719        // 0x0001 - "dil 1" // standard input (motherboard)
42720        // 0x0002 - "dil 2" // standard input (motherboard)
42721        // 0x0004 - "dil 3" // standard input (motherboard)
42722        // 0x0008 - "dil 4" // standard input (motherboard)
42723        // 0x0010 - "dil 5" // standard input (motherboard)
42724        // 0x0100 - "htopup" // known extended input, usually 'top up'
42725        PORT_MODIFY("IN-17")
42726        // 0x0001 - "dil 6" // standard input (motherboard)
42727        // 0x0002 - "dil 7" // standard input (motherboard)
42728        // 0x0004 - "dil 8" // standard input (motherboard)
42729        // 0x0008 - "dil 9" // standard input (motherboard)
42730        // 0x0010 - "dil 10" // standard input (motherboard)
42731        PORT_MODIFY("IN-18")
42732        // 0x0001 - "dil 11" // standard input (motherboard)
42733        // 0x0002 - "dil 12" // standard input (motherboard)
42734        // 0x0004 - "dil 13" // standard input (motherboard)
42735        // 0x0008 - "dil 14" // standard input (motherboard)
42736        // 0x0010 - "dil 15" // standard input (motherboard)
42737        PORT_MODIFY("IN-19")
42738        // 0x0001 - "dil 16" // standard input (motherboard)
42739        PORT_MODIFY("IN-20")
42740        // 0x0001 - "grnbut" // standard input (motherboard)
42741        // 0x0002 - "dorlok" // standard input (expected here)
42742        // 0x0004 - "serdor" // standard input (expected here)
42743        // 0x0008 - "cshdor" // standard input (expected here)
42744        // 0x0010 - "hopdmp" // standard input (expected here)
42680      PORT_INCLUDE( sc4_base )
42681      PORT_MODIFY("IN-1")
42682      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
42683      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
42684      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
42685      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
42686      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
42687      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42688      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42689      PORT_MODIFY("IN-2")
42690      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42691      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42692      PORT_MODIFY("IN-3")
42693      // 0x0004 - "stk 4" // standard input (expected here)
42694      // 0x0008 - "stk 2" // standard input (expected here)
42695      // 0x0010 - "stk 3" // standard input (expected here)
42696      PORT_MODIFY("IN-5")
42697      // 0x0001 - "priz4" // standard input (expected here)
42698      // 0x0002 - "priz3" // standard input (expected here)
42699      // 0x0004 - "priz2" // standard input (expected here)
42700      // 0x0008 - "priz1" // standard input (expected here)
42701      PORT_MODIFY("IN-6")
42702      // 0x0001 - "perc1" // standard input (expected here)
42703      // 0x0002 - "perc2" // standard input (expected here)
42704      // 0x0004 - "perc3" // standard input (expected here)
42705      // 0x0008 - "perc4" // standard input (expected here)
42706      PORT_MODIFY("IN-8")
42707      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
42708      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cas lo")
42709      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("ch stp")
42710      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("db gam")
42711      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("ft stp")
42712      PORT_MODIFY("IN-9")
42713      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("fet lo")
42714      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c feat")
42715      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("cas hi")
42716      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("c doub")
42717      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("fet hi")
42718      PORT_MODIFY("IN-16")
42719      // 0x0001 - "dil 1" // standard input (motherboard)
42720      // 0x0002 - "dil 2" // standard input (motherboard)
42721      // 0x0004 - "dil 3" // standard input (motherboard)
42722      // 0x0008 - "dil 4" // standard input (motherboard)
42723      // 0x0010 - "dil 5" // standard input (motherboard)
42724      // 0x0100 - "htopup" // known extended input, usually 'top up'
42725      PORT_MODIFY("IN-17")
42726      // 0x0001 - "dil 6" // standard input (motherboard)
42727      // 0x0002 - "dil 7" // standard input (motherboard)
42728      // 0x0004 - "dil 8" // standard input (motherboard)
42729      // 0x0008 - "dil 9" // standard input (motherboard)
42730      // 0x0010 - "dil 10" // standard input (motherboard)
42731      PORT_MODIFY("IN-18")
42732      // 0x0001 - "dil 11" // standard input (motherboard)
42733      // 0x0002 - "dil 12" // standard input (motherboard)
42734      // 0x0004 - "dil 13" // standard input (motherboard)
42735      // 0x0008 - "dil 14" // standard input (motherboard)
42736      // 0x0010 - "dil 15" // standard input (motherboard)
42737      PORT_MODIFY("IN-19")
42738      // 0x0001 - "dil 16" // standard input (motherboard)
42739      PORT_MODIFY("IN-20")
42740      // 0x0001 - "grnbut" // standard input (motherboard)
42741      // 0x0002 - "dorlok" // standard input (expected here)
42742      // 0x0004 - "serdor" // standard input (expected here)
42743      // 0x0008 - "cshdor" // standard input (expected here)
42744      // 0x0010 - "hopdmp" // standard input (expected here)
4274542745INPUT_PORTS_END
4274642746
4274742747// PR1316 AWP CHAIN REACTION         PR1312 CHAIN REACT SOUNDS11
r31373r31374
4276842768}
4276942769
4277042770INPUT_PORTS_START( sc4clown ) // this structure is generated
42771        PORT_INCLUDE( sc4_base )
42772        PORT_MODIFY("IN-1")
42773        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR coll")
42774        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
42775        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
42776        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
42777        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
42778        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42779        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42780        PORT_MODIFY("IN-2")
42781        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
42782        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
42783        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42784        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42785        PORT_MODIFY("IN-3")
42786        // 0x0004 - "stk 4" // standard input (expected here)
42787        // 0x0008 - "stk 3" // standard input (expected here)
42788        // 0x0010 - "stk 2" // standard input (expected here)
42789        PORT_MODIFY("IN-5")
42790        // 0x0001 - "priz4" // standard input (expected here)
42791        // 0x0002 - "priz3" // standard input (expected here)
42792        // 0x0004 - "priz2" // standard input (expected here)
42793        // 0x0008 - "priz1" // standard input (expected here)
42794        PORT_MODIFY("IN-6")
42795        // 0x0001 - "perc1" // standard input (expected here)
42796        // 0x0002 - "perc2" // standard input (expected here)
42797        // 0x0004 - "perc3" // standard input (expected here)
42798        // 0x0008 - "perc4" // standard input (expected here)
42799        PORT_MODIFY("IN-8")
42800        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkstep")
42801        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lorght")
42802        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lomid")
42803        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("loleft")
42804        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hirght")
42805        PORT_MODIFY("IN-9")
42806        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("himid")
42807        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hileft")
42808        PORT_MODIFY("IN-16")
42809        // 0x0001 - "dil1" // standard input (motherboard)
42810        // 0x0002 - "dil2" // standard input (motherboard)
42811        // 0x0004 - "dil3" // standard input (motherboard)
42812        // 0x0008 - "dil4" // standard input (motherboard)
42813        // 0x0010 - "dil5" // standard input (motherboard)
42814        // 0x0100 - "top up" // known extended input, usually 'top up'
42815        PORT_MODIFY("IN-17")
42816        // 0x0001 - "dil6" // standard input (motherboard)
42817        // 0x0002 - "dil7" // standard input (motherboard)
42818        // 0x0004 - "dil8" // standard input (motherboard)
42819        // 0x0008 - "dil9" // standard input (motherboard)
42820        // 0x0010 - "dil10" // standard input (motherboard)
42821        PORT_MODIFY("IN-18")
42822        // 0x0001 - "dil11" // standard input (motherboard)
42823        // 0x0002 - "dil12" // standard input (motherboard)
42824        // 0x0004 - "dil13" // standard input (motherboard)
42825        // 0x0008 - "dil14" // standard input (motherboard)
42826        // 0x0010 - "dil15" // standard input (motherboard)
42827        PORT_MODIFY("IN-19")
42828        // 0x0001 - "dil16" // standard input (motherboard)
42829        PORT_MODIFY("IN-20")
42830        // 0x0001 - "grnbut" // standard input (motherboard)
42831        // 0x0002 - "dorlok" // standard input (expected here)
42832        // 0x0004 - "serdor" // standard input (expected here)
42833        // 0x0008 - "cshdor" // standard input (expected here)
42834        // 0x0010 - "hopdmp" // standard input (expected here)
42771      PORT_INCLUDE( sc4_base )
42772      PORT_MODIFY("IN-1")
42773      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel OR coll")
42774      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
42775      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
42776      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
42777      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("ch stk")
42778      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42779      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42780      PORT_MODIFY("IN-2")
42781      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
42782      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
42783      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42784      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42785      PORT_MODIFY("IN-3")
42786      // 0x0004 - "stk 4" // standard input (expected here)
42787      // 0x0008 - "stk 3" // standard input (expected here)
42788      // 0x0010 - "stk 2" // standard input (expected here)
42789      PORT_MODIFY("IN-5")
42790      // 0x0001 - "priz4" // standard input (expected here)
42791      // 0x0002 - "priz3" // standard input (expected here)
42792      // 0x0004 - "priz2" // standard input (expected here)
42793      // 0x0008 - "priz1" // standard input (expected here)
42794      PORT_MODIFY("IN-6")
42795      // 0x0001 - "perc1" // standard input (expected here)
42796      // 0x0002 - "perc2" // standard input (expected here)
42797      // 0x0004 - "perc3" // standard input (expected here)
42798      // 0x0008 - "perc4" // standard input (expected here)
42799      PORT_MODIFY("IN-8")
42800      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkstep")
42801      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lorght")
42802      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lomid")
42803      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("loleft")
42804      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hirght")
42805      PORT_MODIFY("IN-9")
42806      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("himid")
42807      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("hileft")
42808      PORT_MODIFY("IN-16")
42809      // 0x0001 - "dil1" // standard input (motherboard)
42810      // 0x0002 - "dil2" // standard input (motherboard)
42811      // 0x0004 - "dil3" // standard input (motherboard)
42812      // 0x0008 - "dil4" // standard input (motherboard)
42813      // 0x0010 - "dil5" // standard input (motherboard)
42814      // 0x0100 - "top up" // known extended input, usually 'top up'
42815      PORT_MODIFY("IN-17")
42816      // 0x0001 - "dil6" // standard input (motherboard)
42817      // 0x0002 - "dil7" // standard input (motherboard)
42818      // 0x0004 - "dil8" // standard input (motherboard)
42819      // 0x0008 - "dil9" // standard input (motherboard)
42820      // 0x0010 - "dil10" // standard input (motherboard)
42821      PORT_MODIFY("IN-18")
42822      // 0x0001 - "dil11" // standard input (motherboard)
42823      // 0x0002 - "dil12" // standard input (motherboard)
42824      // 0x0004 - "dil13" // standard input (motherboard)
42825      // 0x0008 - "dil14" // standard input (motherboard)
42826      // 0x0010 - "dil15" // standard input (motherboard)
42827      PORT_MODIFY("IN-19")
42828      // 0x0001 - "dil16" // standard input (motherboard)
42829      PORT_MODIFY("IN-20")
42830      // 0x0001 - "grnbut" // standard input (motherboard)
42831      // 0x0002 - "dorlok" // standard input (expected here)
42832      // 0x0004 - "serdor" // standard input (expected here)
42833      // 0x0008 - "cshdor" // standard input (expected here)
42834      // 0x0010 - "hopdmp" // standard input (expected here)
4283542835INPUT_PORTS_END
4283642836
4283742837// PR1727 AWP CLOWN AROUND SCORP4         PR1707 CLOWN AROUND SOUNDS11      CLOWN AROUND  S.SITE
r31373r31374
4284542845GAMEL( 200?, sc4clowng   ,sc4clown,  sc4, sc4clown, sc4_state, sc4clown, ROT0, "BFM","Clown Around (Bellfruit) (Scorpion 4) (set 8)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4284642846
4284742847INPUT_PORTS_START( sc4mowow ) // this structure is generated
42848        PORT_INCLUDE( sc4_base )
42849        PORT_MODIFY("IN-1")
42850        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
42851        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
42852        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
42853        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
42854        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
42855        PORT_MODIFY("IN-2")
42856        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
42857        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
42858        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42859        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42860        PORT_MODIFY("IN-8")
42861        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("h cash")
42862        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("h nuds")
42863        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkspin")
42864        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tkcpot")
42865        PORT_MODIFY("IN-16")
42866        // 0x0001 - "dil 1" // standard input (motherboard)
42867        // 0x0002 - "dil 2" // standard input (motherboard)
42868        // 0x0004 - "dil 3" // standard input (motherboard)
42869        // 0x0008 - "dil 4" // standard input (motherboard)
42870        // 0x0010 - "dil 5" // standard input (motherboard)
42871        // 0x0100 - "topup" // known extended input, usually 'top up'
42872        PORT_MODIFY("IN-17")
42873        // 0x0001 - "dil 6" // standard input (motherboard)
42874        // 0x0002 - "dil 7" // standard input (motherboard)
42875        // 0x0004 - "dil 8" // standard input (motherboard)
42876        // 0x0008 - "dil 9" // standard input (motherboard)
42877        // 0x0010 - "dil10" // standard input (motherboard)
42878        PORT_MODIFY("IN-18")
42879        // 0x0001 - "dil11" // standard input (motherboard)
42880        // 0x0002 - "dil12" // standard input (motherboard)
42881        // 0x0004 - "dil13" // standard input (motherboard)
42882        // 0x0008 - "dil14" // standard input (motherboard)
42883        // 0x0010 - "dil15" // standard input (motherboard)
42884        PORT_MODIFY("IN-19")
42885        // 0x0001 - "dil16" // standard input (motherboard)
42886        PORT_MODIFY("IN-20")
42887        // 0x0001 - "test" // standard input (motherboard)
42888        // 0x0002 - "dor lk" // standard input (expected here)
42889        // 0x0004 - "tp dor" // standard input (expected here)
42890        // 0x0008 - "csh bx" // standard input (expected here)
42891        // 0x0010 - "deflt" // standard input (expected here)
42848      PORT_INCLUDE( sc4_base )
42849      PORT_MODIFY("IN-1")
42850      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
42851      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
42852      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
42853      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
42854      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
42855      PORT_MODIFY("IN-2")
42856      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
42857      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
42858      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42859      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42860      PORT_MODIFY("IN-8")
42861      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("h cash")
42862      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("h nuds")
42863      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkspin")
42864      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tkcpot")
42865      PORT_MODIFY("IN-16")
42866      // 0x0001 - "dil 1" // standard input (motherboard)
42867      // 0x0002 - "dil 2" // standard input (motherboard)
42868      // 0x0004 - "dil 3" // standard input (motherboard)
42869      // 0x0008 - "dil 4" // standard input (motherboard)
42870      // 0x0010 - "dil 5" // standard input (motherboard)
42871      // 0x0100 - "topup" // known extended input, usually 'top up'
42872      PORT_MODIFY("IN-17")
42873      // 0x0001 - "dil 6" // standard input (motherboard)
42874      // 0x0002 - "dil 7" // standard input (motherboard)
42875      // 0x0004 - "dil 8" // standard input (motherboard)
42876      // 0x0008 - "dil 9" // standard input (motherboard)
42877      // 0x0010 - "dil10" // standard input (motherboard)
42878      PORT_MODIFY("IN-18")
42879      // 0x0001 - "dil11" // standard input (motherboard)
42880      // 0x0002 - "dil12" // standard input (motherboard)
42881      // 0x0004 - "dil13" // standard input (motherboard)
42882      // 0x0008 - "dil14" // standard input (motherboard)
42883      // 0x0010 - "dil15" // standard input (motherboard)
42884      PORT_MODIFY("IN-19")
42885      // 0x0001 - "dil16" // standard input (motherboard)
42886      PORT_MODIFY("IN-20")
42887      // 0x0001 - "test" // standard input (motherboard)
42888      // 0x0002 - "dor lk" // standard input (expected here)
42889      // 0x0004 - "tp dor" // standard input (expected here)
42890      // 0x0008 - "csh bx" // standard input (expected here)
42891      // 0x0010 - "deflt" // standard input (expected here)
4289242892INPUT_PORTS_END
4289342893
4289442894/* wrong sound roms */
r31373r31374
4292142921}
4292242922
4292342923INPUT_PORTS_START( sc4bwow ) // this structure is generated
42924        PORT_INCLUDE( sc4_base )
42925        PORT_MODIFY("IN-1")
42926        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
42927        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
42928        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
42929        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
42930        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
42931        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42932        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42933        PORT_MODIFY("IN-2")
42934        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
42935        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
42936        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42937        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42938        PORT_MODIFY("IN-3")
42939        // 0x0004 - "stk 4" // standard input (expected here)
42940        // 0x0008 - "stk 2" // standard input (expected here)
42941        // 0x0010 - "stk 3" // standard input (expected here)
42942        PORT_MODIFY("IN-5")
42943        // 0x0001 - "priz4" // standard input (expected here)
42944        // 0x0002 - "priz3" // standard input (expected here)
42945        // 0x0004 - "priz2" // standard input (expected here)
42946        // 0x0008 - "priz1" // standard input (expected here)
42947        PORT_MODIFY("IN-6")
42948        // 0x0001 - "perc1" // standard input (expected here)
42949        // 0x0002 - "perc2" // standard input (expected here)
42950        // 0x0004 - "perc3" // standard input (expected here)
42951        // 0x0008 - "perc4" // standard input (expected here)
42952        PORT_MODIFY("IN-8")
42953        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("r or d")
42954        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("w of w")
42955        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("featur")
42956        PORT_MODIFY("IN-16")
42957        // 0x0001 - "dil1" // standard input (motherboard)
42958        // 0x0002 - "dil2" // standard input (motherboard)
42959        // 0x0004 - "dil3" // standard input (motherboard)
42960        // 0x0008 - "dil4" // standard input (motherboard)
42961        // 0x0010 - "dil5" // standard input (motherboard)
42962        // 0x0100 - "top up" // known extended input, usually 'top up'
42963        PORT_MODIFY("IN-17")
42964        // 0x0001 - "dil6" // standard input (motherboard)
42965        // 0x0002 - "dil7" // standard input (motherboard)
42966        // 0x0004 - "dil8" // standard input (motherboard)
42967        // 0x0008 - "dil9" // standard input (motherboard)
42968        // 0x0010 - "dil10" // standard input (motherboard)
42969        PORT_MODIFY("IN-18")
42970        // 0x0001 - "dil11" // standard input (motherboard)
42971        // 0x0002 - "dil12" // standard input (motherboard)
42972        // 0x0004 - "dil13" // standard input (motherboard)
42973        // 0x0008 - "dil14" // standard input (motherboard)
42974        // 0x0010 - "dil15" // standard input (motherboard)
42975        PORT_MODIFY("IN-19")
42976        // 0x0001 - "dil16" // standard input (motherboard)
42977        PORT_MODIFY("IN-20")
42978        // 0x0001 - "grnbut" // standard input (motherboard)
42979        // 0x0002 - "dorlok" // standard input (expected here)
42980        // 0x0004 - "serdor" // standard input (expected here)
42981        // 0x0008 - "cshdor" // standard input (expected here)
42982        // 0x0010 - "hopdmp" // standard input (expected here)
42924      PORT_INCLUDE( sc4_base )
42925      PORT_MODIFY("IN-1")
42926      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
42927      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
42928      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
42929      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
42930      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
42931      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
42932      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
42933      PORT_MODIFY("IN-2")
42934      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
42935      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
42936      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
42937      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
42938      PORT_MODIFY("IN-3")
42939      // 0x0004 - "stk 4" // standard input (expected here)
42940      // 0x0008 - "stk 2" // standard input (expected here)
42941      // 0x0010 - "stk 3" // standard input (expected here)
42942      PORT_MODIFY("IN-5")
42943      // 0x0001 - "priz4" // standard input (expected here)
42944      // 0x0002 - "priz3" // standard input (expected here)
42945      // 0x0004 - "priz2" // standard input (expected here)
42946      // 0x0008 - "priz1" // standard input (expected here)
42947      PORT_MODIFY("IN-6")
42948      // 0x0001 - "perc1" // standard input (expected here)
42949      // 0x0002 - "perc2" // standard input (expected here)
42950      // 0x0004 - "perc3" // standard input (expected here)
42951      // 0x0008 - "perc4" // standard input (expected here)
42952      PORT_MODIFY("IN-8")
42953      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("r or d")
42954      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("w of w")
42955      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("featur")
42956      PORT_MODIFY("IN-16")
42957      // 0x0001 - "dil1" // standard input (motherboard)
42958      // 0x0002 - "dil2" // standard input (motherboard)
42959      // 0x0004 - "dil3" // standard input (motherboard)
42960      // 0x0008 - "dil4" // standard input (motherboard)
42961      // 0x0010 - "dil5" // standard input (motherboard)
42962      // 0x0100 - "top up" // known extended input, usually 'top up'
42963      PORT_MODIFY("IN-17")
42964      // 0x0001 - "dil6" // standard input (motherboard)
42965      // 0x0002 - "dil7" // standard input (motherboard)
42966      // 0x0004 - "dil8" // standard input (motherboard)
42967      // 0x0008 - "dil9" // standard input (motherboard)
42968      // 0x0010 - "dil10" // standard input (motherboard)
42969      PORT_MODIFY("IN-18")
42970      // 0x0001 - "dil11" // standard input (motherboard)
42971      // 0x0002 - "dil12" // standard input (motherboard)
42972      // 0x0004 - "dil13" // standard input (motherboard)
42973      // 0x0008 - "dil14" // standard input (motherboard)
42974      // 0x0010 - "dil15" // standard input (motherboard)
42975      PORT_MODIFY("IN-19")
42976      // 0x0001 - "dil16" // standard input (motherboard)
42977      PORT_MODIFY("IN-20")
42978      // 0x0001 - "grnbut" // standard input (motherboard)
42979      // 0x0002 - "dorlok" // standard input (expected here)
42980      // 0x0004 - "serdor" // standard input (expected here)
42981      // 0x0008 - "cshdor" // standard input (expected here)
42982      // 0x0010 - "hopdmp" // standard input (expected here)
4298342983INPUT_PORTS_END
4298442984
4298542985GAMEL( 200?, sc4bwow   ,0,       sc4, sc4bwow, sc4_state, sc4bwow, ROT0, "BFM","Wheel Of Wealth (Bellfruit) (PR1726) (Scorpion 4) (WHEL013, set 1)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 ) // PR1726 AWP WHEEL OF WEALTH         PR1706 WHEEL OF WEALTH SOUNDS11   WHEEL OF WEALTH S.SITE
r31373r31374
4300343003}
4300443004
4300543005INPUT_PORTS_START( sc4nunsm ) // this structure is generated
43006        PORT_INCLUDE( sc4_base )
43007        PORT_MODIFY("IN-1")
43008        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
43009        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
43010        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
43011        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
43012        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
43013        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
43014        PORT_MODIFY("IN-2")
43015        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
43016        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
43017        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43018        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43019        PORT_MODIFY("IN-8")
43020        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
43021        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
43022        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
43023        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
43024        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
43025        PORT_MODIFY("IN-9")
43026        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
43027        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
43028        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
43029        PORT_MODIFY("IN-16")
43030        // 0x0001 - "dil 1" // standard input (motherboard)
43031        // 0x0002 - "dil 2" // standard input (motherboard)
43032        // 0x0004 - "dil 3" // standard input (motherboard)
43033        // 0x0008 - "dil 4" // standard input (motherboard)
43034        // 0x0010 - "dil 5" // standard input (motherboard)
43035        // 0x0100 - "topup" // known extended input, usually 'top up'
43036        PORT_MODIFY("IN-17")
43037        // 0x0001 - "dil 6" // standard input (motherboard)
43038        // 0x0002 - "dil 7" // standard input (motherboard)
43039        // 0x0004 - "dil 8" // standard input (motherboard)
43040        // 0x0008 - "dil 9" // standard input (motherboard)
43041        // 0x0010 - "dil10" // standard input (motherboard)
43042        PORT_MODIFY("IN-18")
43043        // 0x0001 - "dil11" // standard input (motherboard)
43044        // 0x0002 - "dil12" // standard input (motherboard)
43045        // 0x0004 - "dil13" // standard input (motherboard)
43046        // 0x0008 - "dil14" // standard input (motherboard)
43047        // 0x0010 - "dil15" // standard input (motherboard)
43048        PORT_MODIFY("IN-19")
43049        // 0x0001 - "dil16" // standard input (motherboard)
43050        PORT_MODIFY("IN-20")
43051        // 0x0001 - "test" // standard input (motherboard)
43052        // 0x0002 - "dorlk" // standard input (expected here)
43053        // 0x0004 - "tpdor" // standard input (expected here)
43054        // 0x0008 - "cshbx" // standard input (expected here)
43055        // 0x0010 - "deflt" // standard input (expected here)
43006      PORT_INCLUDE( sc4_base )
43007      PORT_MODIFY("IN-1")
43008      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
43009      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
43010      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
43011      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
43012      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
43013      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
43014      PORT_MODIFY("IN-2")
43015      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
43016      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
43017      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43018      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43019      PORT_MODIFY("IN-8")
43020      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
43021      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
43022      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
43023      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
43024      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
43025      PORT_MODIFY("IN-9")
43026      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
43027      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
43028      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
43029      PORT_MODIFY("IN-16")
43030      // 0x0001 - "dil 1" // standard input (motherboard)
43031      // 0x0002 - "dil 2" // standard input (motherboard)
43032      // 0x0004 - "dil 3" // standard input (motherboard)
43033      // 0x0008 - "dil 4" // standard input (motherboard)
43034      // 0x0010 - "dil 5" // standard input (motherboard)
43035      // 0x0100 - "topup" // known extended input, usually 'top up'
43036      PORT_MODIFY("IN-17")
43037      // 0x0001 - "dil 6" // standard input (motherboard)
43038      // 0x0002 - "dil 7" // standard input (motherboard)
43039      // 0x0004 - "dil 8" // standard input (motherboard)
43040      // 0x0008 - "dil 9" // standard input (motherboard)
43041      // 0x0010 - "dil10" // standard input (motherboard)
43042      PORT_MODIFY("IN-18")
43043      // 0x0001 - "dil11" // standard input (motherboard)
43044      // 0x0002 - "dil12" // standard input (motherboard)
43045      // 0x0004 - "dil13" // standard input (motherboard)
43046      // 0x0008 - "dil14" // standard input (motherboard)
43047      // 0x0010 - "dil15" // standard input (motherboard)
43048      PORT_MODIFY("IN-19")
43049      // 0x0001 - "dil16" // standard input (motherboard)
43050      PORT_MODIFY("IN-20")
43051      // 0x0001 - "test" // standard input (motherboard)
43052      // 0x0002 - "dorlk" // standard input (expected here)
43053      // 0x0004 - "tpdor" // standard input (expected here)
43054      // 0x0008 - "cshbx" // standard input (expected here)
43055      // 0x0010 - "deflt" // standard input (expected here)
4305643056INPUT_PORTS_END
4305743057
4305843058// PR2166 NUN N ROSES          NANR SOUNDS         NUNS N ROSES
r31373r31374
4308543085}
4308643086
4308743087INPUT_PORTS_START( sc4acesh ) // this structure is generated
43088        PORT_INCLUDE( sc4_base )
43089        PORT_MODIFY("IN-1")
43090        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43091        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stop")
43092        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold a")
43093        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold b")
43094        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold c")
43095        PORT_MODIFY("IN-2")
43096        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("xchnge")
43097        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43098        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43099        PORT_MODIFY("IN-8")
43100        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("take")
43101        PORT_MODIFY("IN-16")
43102        // 0x0001 - "dil  1" // standard input (motherboard)
43103        // 0x0002 - "dil  2" // standard input (motherboard)
43104        // 0x0004 - "dil  3" // standard input (motherboard)
43105        // 0x0008 - "dil  4" // standard input (motherboard)
43106        // 0x0010 - "dil  5" // standard input (motherboard)
43107        // 0x0100 - "top up" // known extended input, usually 'top up'
43108        PORT_MODIFY("IN-17")
43109        // 0x0001 - "dil  6" // standard input (motherboard)
43110        // 0x0002 - "dil  7" // standard input (motherboard)
43111        // 0x0004 - "dil  8" // standard input (motherboard)
43112        // 0x0008 - "dil  9" // standard input (motherboard)
43113        // 0x0010 - "dil 10" // standard input (motherboard)
43114        PORT_MODIFY("IN-18")
43115        // 0x0001 - "dil 11" // standard input (motherboard)
43116        // 0x0002 - "dil 12" // standard input (motherboard)
43117        // 0x0004 - "dil 13" // standard input (motherboard)
43118        // 0x0008 - "dil 14" // standard input (motherboard)
43119        // 0x0010 - "dil 15" // standard input (motherboard)
43120        PORT_MODIFY("IN-19")
43121        // 0x0001 - "dil 16" // standard input (motherboard)
43122        PORT_MODIFY("IN-20")
43123        // 0x0001 - "testsw" // standard input (motherboard)
43124        // 0x0002 - "dor lk" // standard input (expected here)
43125        // 0x0004 - "tp dor" // standard input (expected here)
43126        // 0x0008 - "csh bx" // standard input (expected here)
43127        // 0x0010 - "deflt" // standard input (expected here)
43088      PORT_INCLUDE( sc4_base )
43089      PORT_MODIFY("IN-1")
43090      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43091      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stop")
43092      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold a")
43093      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold b")
43094      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold c")
43095      PORT_MODIFY("IN-2")
43096      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("xchnge")
43097      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43098      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43099      PORT_MODIFY("IN-8")
43100      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("take")
43101      PORT_MODIFY("IN-16")
43102      // 0x0001 - "dil  1" // standard input (motherboard)
43103      // 0x0002 - "dil  2" // standard input (motherboard)
43104      // 0x0004 - "dil  3" // standard input (motherboard)
43105      // 0x0008 - "dil  4" // standard input (motherboard)
43106      // 0x0010 - "dil  5" // standard input (motherboard)
43107      // 0x0100 - "top up" // known extended input, usually 'top up'
43108      PORT_MODIFY("IN-17")
43109      // 0x0001 - "dil  6" // standard input (motherboard)
43110      // 0x0002 - "dil  7" // standard input (motherboard)
43111      // 0x0004 - "dil  8" // standard input (motherboard)
43112      // 0x0008 - "dil  9" // standard input (motherboard)
43113      // 0x0010 - "dil 10" // standard input (motherboard)
43114      PORT_MODIFY("IN-18")
43115      // 0x0001 - "dil 11" // standard input (motherboard)
43116      // 0x0002 - "dil 12" // standard input (motherboard)
43117      // 0x0004 - "dil 13" // standard input (motherboard)
43118      // 0x0008 - "dil 14" // standard input (motherboard)
43119      // 0x0010 - "dil 15" // standard input (motherboard)
43120      PORT_MODIFY("IN-19")
43121      // 0x0001 - "dil 16" // standard input (motherboard)
43122      PORT_MODIFY("IN-20")
43123      // 0x0001 - "testsw" // standard input (motherboard)
43124      // 0x0002 - "dor lk" // standard input (expected here)
43125      // 0x0004 - "tp dor" // standard input (expected here)
43126      // 0x0008 - "csh bx" // standard input (expected here)
43127      // 0x0010 - "deflt" // standard input (expected here)
4312843128INPUT_PORTS_END
4312943129
4313043130// PR2070 ACES HIGH         ACEHI SOUNDS            ACES HIGH
r31373r31374
4315143151}
4315243152
4315343153INPUT_PORTS_START( sc4bed ) // this structure is generated
43154        PORT_INCLUDE( sc4_base )
43155        PORT_MODIFY("IN-1")
43156        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43157        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
43158        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
43159        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
43160        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
43161        PORT_MODIFY("IN-2")
43162        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
43163        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43164        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43165        PORT_MODIFY("IN-8")
43166        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk cas")
43167        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk nud")
43168        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk pic")
43169        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("move u")
43170        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lef hi")
43171        PORT_MODIFY("IN-9")
43172        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("mid hi")
43173        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("rgt hi")
43174        PORT_MODIFY("IN-16")
43175        // 0x0001 - "dil  1" // standard input (motherboard)
43176        // 0x0002 - "dil  2" // standard input (motherboard)
43177        // 0x0004 - "dil  3" // standard input (motherboard)
43178        // 0x0008 - "dil  4" // standard input (motherboard)
43179        // 0x0010 - "dil  5" // standard input (motherboard)
43180        // 0x0100 - "top up" // known extended input, usually 'top up'
43181        PORT_MODIFY("IN-17")
43182        // 0x0001 - "dil  6" // standard input (motherboard)
43183        // 0x0002 - "dil  7" // standard input (motherboard)
43184        // 0x0004 - "dil  8" // standard input (motherboard)
43185        // 0x0008 - "dil  9" // standard input (motherboard)
43186        // 0x0010 - "dil 10" // standard input (motherboard)
43187        PORT_MODIFY("IN-18")
43188        // 0x0001 - "dil 11" // standard input (motherboard)
43189        // 0x0002 - "dil 12" // standard input (motherboard)
43190        // 0x0004 - "dil 13" // standard input (motherboard)
43191        // 0x0008 - "dil 14" // standard input (motherboard)
43192        // 0x0010 - "dil 15" // standard input (motherboard)
43193        PORT_MODIFY("IN-19")
43194        // 0x0001 - "dil 16" // standard input (motherboard)
43195        PORT_MODIFY("IN-20")
43196        // 0x0001 - "testsw" // standard input (motherboard)
43197        // 0x0002 - "dor lk" // standard input (expected here)
43198        // 0x0004 - "tp dor" // standard input (expected here)
43199        // 0x0008 - "csh bx" // standard input (expected here)
43200        // 0x0010 - "deflt" // standard input (expected here)
43154      PORT_INCLUDE( sc4_base )
43155      PORT_MODIFY("IN-1")
43156      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43157      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
43158      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
43159      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
43160      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
43161      PORT_MODIFY("IN-2")
43162      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
43163      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43164      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43165      PORT_MODIFY("IN-8")
43166      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk cas")
43167      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk nud")
43168      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk pic")
43169      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("move u")
43170      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lef hi")
43171      PORT_MODIFY("IN-9")
43172      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("mid hi")
43173      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("rgt hi")
43174      PORT_MODIFY("IN-16")
43175      // 0x0001 - "dil  1" // standard input (motherboard)
43176      // 0x0002 - "dil  2" // standard input (motherboard)
43177      // 0x0004 - "dil  3" // standard input (motherboard)
43178      // 0x0008 - "dil  4" // standard input (motherboard)
43179      // 0x0010 - "dil  5" // standard input (motherboard)
43180      // 0x0100 - "top up" // known extended input, usually 'top up'
43181      PORT_MODIFY("IN-17")
43182      // 0x0001 - "dil  6" // standard input (motherboard)
43183      // 0x0002 - "dil  7" // standard input (motherboard)
43184      // 0x0004 - "dil  8" // standard input (motherboard)
43185      // 0x0008 - "dil  9" // standard input (motherboard)
43186      // 0x0010 - "dil 10" // standard input (motherboard)
43187      PORT_MODIFY("IN-18")
43188      // 0x0001 - "dil 11" // standard input (motherboard)
43189      // 0x0002 - "dil 12" // standard input (motherboard)
43190      // 0x0004 - "dil 13" // standard input (motherboard)
43191      // 0x0008 - "dil 14" // standard input (motherboard)
43192      // 0x0010 - "dil 15" // standard input (motherboard)
43193      PORT_MODIFY("IN-19")
43194      // 0x0001 - "dil 16" // standard input (motherboard)
43195      PORT_MODIFY("IN-20")
43196      // 0x0001 - "testsw" // standard input (motherboard)
43197      // 0x0002 - "dor lk" // standard input (expected here)
43198      // 0x0004 - "tp dor" // standard input (expected here)
43199      // 0x0008 - "csh bx" // standard input (expected here)
43200      // 0x0010 - "deflt" // standard input (expected here)
4320143201INPUT_PORTS_END
4320243202
4320343203// PR2094 BEDAZZLED         BEDZ SOUNDS         BEDAZZLED
r31373r31374
4322543225}
4322643226
4322743227INPUT_PORTS_START( sc4bedcl ) // this structure is generated
43228        PORT_INCLUDE( sc4_base )
43229        PORT_MODIFY("IN-1")
43230        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
43231        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
43232        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
43233        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
43234        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
43235        PORT_MODIFY("IN-2")
43236        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
43237        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("xfer")
43238        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
43239        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43240        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
43241        PORT_MODIFY("IN-3")
43242        // 0x0004 - "stk 4" // standard input (expected here)
43243        // 0x0008 - "stk 3" // standard input (expected here)
43244        // 0x0010 - "stk 2" // standard input (expected here)
43245        PORT_MODIFY("IN-4")
43246        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
43247        PORT_MODIFY("IN-5")
43248        // 0x0001 - "priz4" // standard input (expected here)
43249        // 0x0002 - "priz3" // standard input (expected here)
43250        // 0x0004 - "priz2" // standard input (expected here)
43251        // 0x0008 - "priz1" // standard input (expected here)
43252        PORT_MODIFY("IN-8")
43253        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
43254        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("pick")
43255        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("mov up")
43256        PORT_MODIFY("IN-16")
43257        // 0x0001 - "dil 1" // standard input (motherboard)
43258        // 0x0002 - "dil 2" // standard input (motherboard)
43259        // 0x0004 - "dil 3" // standard input (motherboard)
43260        // 0x0008 - "dil 4" // standard input (motherboard)
43261        // 0x0010 - "dil 5" // standard input (motherboard)
43262        // 0x0100 - "top up" // known extended input, usually 'top up'
43263        PORT_MODIFY("IN-17")
43264        // 0x0001 - "dil 6" // standard input (motherboard)
43265        // 0x0002 - "dil 7" // standard input (motherboard)
43266        // 0x0004 - "dil 8" // standard input (motherboard)
43267        // 0x0008 - "dil 9" // standard input (motherboard)
43268        // 0x0010 - "dil10" // standard input (motherboard)
43269        PORT_MODIFY("IN-18")
43270        // 0x0001 - "dil11" // standard input (motherboard)
43271        // 0x0002 - "dil12" // standard input (motherboard)
43272        // 0x0004 - "dil13" // standard input (motherboard)
43273        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
43274        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
43275        PORT_MODIFY("IN-19")
43276        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
43277        PORT_MODIFY("IN-20")
43278        // 0x0001 - "grnbut" // standard input (motherboard)
43279        // 0x0002 - "dorlok" // standard input (expected here)
43280        // 0x0004 - "topdor" // standard input (expected here)
43281        // 0x0008 - "botdor" // standard input (expected here)
43282        // 0x0010 - "hopdmp" // standard input (expected here)
43228      PORT_INCLUDE( sc4_base )
43229      PORT_MODIFY("IN-1")
43230      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
43231      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
43232      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
43233      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
43234      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
43235      PORT_MODIFY("IN-2")
43236      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
43237      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("xfer")
43238      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
43239      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43240      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
43241      PORT_MODIFY("IN-3")
43242      // 0x0004 - "stk 4" // standard input (expected here)
43243      // 0x0008 - "stk 3" // standard input (expected here)
43244      // 0x0010 - "stk 2" // standard input (expected here)
43245      PORT_MODIFY("IN-4")
43246      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
43247      PORT_MODIFY("IN-5")
43248      // 0x0001 - "priz4" // standard input (expected here)
43249      // 0x0002 - "priz3" // standard input (expected here)
43250      // 0x0004 - "priz2" // standard input (expected here)
43251      // 0x0008 - "priz1" // standard input (expected here)
43252      PORT_MODIFY("IN-8")
43253      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
43254      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("pick")
43255      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("mov up")
43256      PORT_MODIFY("IN-16")
43257      // 0x0001 - "dil 1" // standard input (motherboard)
43258      // 0x0002 - "dil 2" // standard input (motherboard)
43259      // 0x0004 - "dil 3" // standard input (motherboard)
43260      // 0x0008 - "dil 4" // standard input (motherboard)
43261      // 0x0010 - "dil 5" // standard input (motherboard)
43262      // 0x0100 - "top up" // known extended input, usually 'top up'
43263      PORT_MODIFY("IN-17")
43264      // 0x0001 - "dil 6" // standard input (motherboard)
43265      // 0x0002 - "dil 7" // standard input (motherboard)
43266      // 0x0004 - "dil 8" // standard input (motherboard)
43267      // 0x0008 - "dil 9" // standard input (motherboard)
43268      // 0x0010 - "dil10" // standard input (motherboard)
43269      PORT_MODIFY("IN-18")
43270      // 0x0001 - "dil11" // standard input (motherboard)
43271      // 0x0002 - "dil12" // standard input (motherboard)
43272      // 0x0004 - "dil13" // standard input (motherboard)
43273      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
43274      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
43275      PORT_MODIFY("IN-19")
43276      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
43277      PORT_MODIFY("IN-20")
43278      // 0x0001 - "grnbut" // standard input (motherboard)
43279      // 0x0002 - "dorlok" // standard input (expected here)
43280      // 0x0004 - "topdor" // standard input (expected here)
43281      // 0x0008 - "botdor" // standard input (expected here)
43282      // 0x0010 - "hopdmp" // standard input (expected here)
4328343283INPUT_PORTS_END
4328443284
4328543285// PR2102 CLUB BEDAZZLED         CBED SOUNDS         CLUB BEDAZZLED
r31373r31374
4331343313}
4331443314
4331543315INPUT_PORTS_START( sc4bblas ) // this structure is generated
43316        PORT_INCLUDE( sc4_base )
43317        PORT_MODIFY("IN-1")
43318        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43319        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
43320        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
43321        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
43322        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
43323        PORT_MODIFY("IN-2")
43324        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
43325        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43326        PORT_MODIFY("IN-8")
43327        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
43328        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk cas")
43329        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("blast")
43330        PORT_MODIFY("IN-16")
43331        // 0x0001 - "dil  1" // standard input (motherboard)
43332        // 0x0002 - "dil  2" // standard input (motherboard)
43333        // 0x0004 - "dil  3" // standard input (motherboard)
43334        // 0x0008 - "dil  4" // standard input (motherboard)
43335        // 0x0010 - "dil  5" // standard input (motherboard)
43336        // 0x0100 - "top up" // known extended input, usually 'top up'
43337        PORT_MODIFY("IN-17")
43338        // 0x0001 - "dil  6" // standard input (motherboard)
43339        // 0x0002 - "dil  7" // standard input (motherboard)
43340        // 0x0004 - "dil  8" // standard input (motherboard)
43341        // 0x0008 - "dil  9" // standard input (motherboard)
43342        // 0x0010 - "dil 10" // standard input (motherboard)
43343        PORT_MODIFY("IN-18")
43344        // 0x0001 - "dil 11" // standard input (motherboard)
43345        // 0x0002 - "dil 12" // standard input (motherboard)
43346        // 0x0004 - "dil 13" // standard input (motherboard)
43347        // 0x0008 - "dil 14" // standard input (motherboard)
43348        // 0x0010 - "dil 15" // standard input (motherboard)
43349        PORT_MODIFY("IN-19")
43350        // 0x0001 - "dil 16" // standard input (motherboard)
43351        PORT_MODIFY("IN-20")
43352        // 0x0001 - "testsw" // standard input (motherboard)
43353        // 0x0002 - "dor lk" // standard input (expected here)
43354        // 0x0004 - "tp dor" // standard input (expected here)
43355        // 0x0008 - "csh bx" // standard input (expected here)
43356        // 0x0010 - "deflt" // standard input (expected here)
43316      PORT_INCLUDE( sc4_base )
43317      PORT_MODIFY("IN-1")
43318      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43319      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
43320      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
43321      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
43322      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
43323      PORT_MODIFY("IN-2")
43324      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
43325      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43326      PORT_MODIFY("IN-8")
43327      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
43328      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk cas")
43329      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("blast")
43330      PORT_MODIFY("IN-16")
43331      // 0x0001 - "dil  1" // standard input (motherboard)
43332      // 0x0002 - "dil  2" // standard input (motherboard)
43333      // 0x0004 - "dil  3" // standard input (motherboard)
43334      // 0x0008 - "dil  4" // standard input (motherboard)
43335      // 0x0010 - "dil  5" // standard input (motherboard)
43336      // 0x0100 - "top up" // known extended input, usually 'top up'
43337      PORT_MODIFY("IN-17")
43338      // 0x0001 - "dil  6" // standard input (motherboard)
43339      // 0x0002 - "dil  7" // standard input (motherboard)
43340      // 0x0004 - "dil  8" // standard input (motherboard)
43341      // 0x0008 - "dil  9" // standard input (motherboard)
43342      // 0x0010 - "dil 10" // standard input (motherboard)
43343      PORT_MODIFY("IN-18")
43344      // 0x0001 - "dil 11" // standard input (motherboard)
43345      // 0x0002 - "dil 12" // standard input (motherboard)
43346      // 0x0004 - "dil 13" // standard input (motherboard)
43347      // 0x0008 - "dil 14" // standard input (motherboard)
43348      // 0x0010 - "dil 15" // standard input (motherboard)
43349      PORT_MODIFY("IN-19")
43350      // 0x0001 - "dil 16" // standard input (motherboard)
43351      PORT_MODIFY("IN-20")
43352      // 0x0001 - "testsw" // standard input (motherboard)
43353      // 0x0002 - "dor lk" // standard input (expected here)
43354      // 0x0004 - "tp dor" // standard input (expected here)
43355      // 0x0008 - "csh bx" // standard input (expected here)
43356      // 0x0010 - "deflt" // standard input (expected here)
4335743357INPUT_PORTS_END
4335843358
4335943359// PR2083 BIG BLASTER         BBST SOUNDS         BIG BLASTER
r31373r31374
4338343383}
4338443384
4338543385INPUT_PORTS_START( sc4bankb ) // this structure is generated
43386        PORT_INCLUDE( sc4_base )
43387        PORT_MODIFY("IN-1")
43388        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43389        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
43390        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
43391        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
43392        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
43393        PORT_MODIFY("IN-2")
43394        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
43395        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43396        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43397        PORT_MODIFY("IN-8")
43398        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
43399        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
43400        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spin")
43401        PORT_MODIFY("IN-16")
43402        // 0x0001 - "dil  1" // standard input (motherboard)
43403        // 0x0002 - "dil  2" // standard input (motherboard)
43404        // 0x0004 - "dil  3" // standard input (motherboard)
43405        // 0x0008 - "dil  4" // standard input (motherboard)
43406        // 0x0010 - "dil  5" // standard input (motherboard)
43407        // 0x0100 - "topup" // known extended input, usually 'top up'
43408        PORT_MODIFY("IN-17")
43409        // 0x0001 - "dil  6" // standard input (motherboard)
43410        // 0x0002 - "dil  7" // standard input (motherboard)
43411        // 0x0004 - "dil  8" // standard input (motherboard)
43412        // 0x0008 - "dil  9" // standard input (motherboard)
43413        // 0x0010 - "dil 10" // standard input (motherboard)
43414        PORT_MODIFY("IN-18")
43415        // 0x0001 - "dil 11" // standard input (motherboard)
43416        // 0x0002 - "dil 12" // standard input (motherboard)
43417        // 0x0004 - "dil 13" // standard input (motherboard)
43418        // 0x0008 - "dil 14" // standard input (motherboard)
43419        // 0x0010 - "dil 15" // standard input (motherboard)
43420        PORT_MODIFY("IN-19")
43421        // 0x0001 - "dil 16" // standard input (motherboard)
43422        PORT_MODIFY("IN-20")
43423        // 0x0001 - "test" // standard input (motherboard)
43424        // 0x0002 - "lock" // standard input (expected here)
43425        // 0x0004 - "topdor" // standard input (expected here)
43426        // 0x0008 - "botdor" // standard input (expected here)
43427        // 0x0010 - "hopdmp" // standard input (expected here)
43386      PORT_INCLUDE( sc4_base )
43387      PORT_MODIFY("IN-1")
43388      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43389      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
43390      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
43391      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
43392      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
43393      PORT_MODIFY("IN-2")
43394      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
43395      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43396      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43397      PORT_MODIFY("IN-8")
43398      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("shoot")
43399      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
43400      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("spin")
43401      PORT_MODIFY("IN-16")
43402      // 0x0001 - "dil  1" // standard input (motherboard)
43403      // 0x0002 - "dil  2" // standard input (motherboard)
43404      // 0x0004 - "dil  3" // standard input (motherboard)
43405      // 0x0008 - "dil  4" // standard input (motherboard)
43406      // 0x0010 - "dil  5" // standard input (motherboard)
43407      // 0x0100 - "topup" // known extended input, usually 'top up'
43408      PORT_MODIFY("IN-17")
43409      // 0x0001 - "dil  6" // standard input (motherboard)
43410      // 0x0002 - "dil  7" // standard input (motherboard)
43411      // 0x0004 - "dil  8" // standard input (motherboard)
43412      // 0x0008 - "dil  9" // standard input (motherboard)
43413      // 0x0010 - "dil 10" // standard input (motherboard)
43414      PORT_MODIFY("IN-18")
43415      // 0x0001 - "dil 11" // standard input (motherboard)
43416      // 0x0002 - "dil 12" // standard input (motherboard)
43417      // 0x0004 - "dil 13" // standard input (motherboard)
43418      // 0x0008 - "dil 14" // standard input (motherboard)
43419      // 0x0010 - "dil 15" // standard input (motherboard)
43420      PORT_MODIFY("IN-19")
43421      // 0x0001 - "dil 16" // standard input (motherboard)
43422      PORT_MODIFY("IN-20")
43423      // 0x0001 - "test" // standard input (motherboard)
43424      // 0x0002 - "lock" // standard input (expected here)
43425      // 0x0004 - "topdor" // standard input (expected here)
43426      // 0x0008 - "botdor" // standard input (expected here)
43427      // 0x0010 - "hopdmp" // standard input (expected here)
4342843428INPUT_PORTS_END
4342943429
4343043430// PR???? BANKETYBANK V1.0         BANKETYBANKSND           BANKETY BANK
r31373r31374
4345143451}
4345243452
4345343453INPUT_PORTS_START( sc4bobcl ) // this structure is generated
43454        PORT_INCLUDE( sc4_base )
43455        PORT_MODIFY("IN-1")
43456        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
43457        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
43458        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
43459        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
43460        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
43461        PORT_MODIFY("IN-2")
43462        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
43463        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
43464        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
43465        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43466        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
43467        PORT_MODIFY("IN-3")
43468        // 0x0004 - "stk 4" // standard input (expected here)
43469        // 0x0008 - "stk 3" // standard input (expected here)
43470        // 0x0010 - "stk 2" // standard input (expected here)
43471        PORT_MODIFY("IN-4")
43472        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
43473        PORT_MODIFY("IN-5")
43474        // 0x0001 - "priz4" // standard input (expected here)
43475        // 0x0002 - "priz3" // standard input (expected here)
43476        // 0x0004 - "priz2" // standard input (expected here)
43477        // 0x0008 - "priz1" // standard input (expected here)
43478        PORT_MODIFY("IN-8")
43479        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
43480        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
43481        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("level1")
43482        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("level2")
43483        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("level3")
43484        PORT_MODIFY("IN-9")
43485        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("level4")
43486        PORT_MODIFY("IN-16")
43487        // 0x0001 - "dil 1" // standard input (motherboard)
43488        // 0x0002 - "dil 2" // standard input (motherboard)
43489        // 0x0004 - "dil 3" // standard input (motherboard)
43490        // 0x0008 - "dil 4" // standard input (motherboard)
43491        // 0x0010 - "dil 5" // standard input (motherboard)
43492        // 0x0100 - "top up" // known extended input, usually 'top up'
43493        PORT_MODIFY("IN-17")
43494        // 0x0001 - "dil 6" // standard input (motherboard)
43495        // 0x0002 - "dil 7" // standard input (motherboard)
43496        // 0x0004 - "dil 8" // standard input (motherboard)
43497        // 0x0008 - "dil 9" // standard input (motherboard)
43498        // 0x0010 - "dil10" // standard input (motherboard)
43499        PORT_MODIFY("IN-18")
43500        // 0x0001 - "dil11" // standard input (motherboard)
43501        // 0x0002 - "dil12" // standard input (motherboard)
43502        // 0x0004 - "dil13" // standard input (motherboard)
43503        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
43504        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
43505        PORT_MODIFY("IN-19")
43506        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
43507        PORT_MODIFY("IN-20")
43508        // 0x0001 - "grnbut" // standard input (motherboard)
43509        // 0x0002 - "dorlok" // standard input (expected here)
43510        // 0x0004 - "topdor" // standard input (expected here)
43511        // 0x0008 - "botdor" // standard input (expected here)
43512        // 0x0010 - "hopdmp" // standard input (expected here)
43454      PORT_INCLUDE( sc4_base )
43455      PORT_MODIFY("IN-1")
43456      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
43457      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
43458      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
43459      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
43460      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
43461      PORT_MODIFY("IN-2")
43462      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
43463      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
43464      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
43465      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43466      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
43467      PORT_MODIFY("IN-3")
43468      // 0x0004 - "stk 4" // standard input (expected here)
43469      // 0x0008 - "stk 3" // standard input (expected here)
43470      // 0x0010 - "stk 2" // standard input (expected here)
43471      PORT_MODIFY("IN-4")
43472      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
43473      PORT_MODIFY("IN-5")
43474      // 0x0001 - "priz4" // standard input (expected here)
43475      // 0x0002 - "priz3" // standard input (expected here)
43476      // 0x0004 - "priz2" // standard input (expected here)
43477      // 0x0008 - "priz1" // standard input (expected here)
43478      PORT_MODIFY("IN-8")
43479      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
43480      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
43481      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("level1")
43482      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("level2")
43483      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("level3")
43484      PORT_MODIFY("IN-9")
43485      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("level4")
43486      PORT_MODIFY("IN-16")
43487      // 0x0001 - "dil 1" // standard input (motherboard)
43488      // 0x0002 - "dil 2" // standard input (motherboard)
43489      // 0x0004 - "dil 3" // standard input (motherboard)
43490      // 0x0008 - "dil 4" // standard input (motherboard)
43491      // 0x0010 - "dil 5" // standard input (motherboard)
43492      // 0x0100 - "top up" // known extended input, usually 'top up'
43493      PORT_MODIFY("IN-17")
43494      // 0x0001 - "dil 6" // standard input (motherboard)
43495      // 0x0002 - "dil 7" // standard input (motherboard)
43496      // 0x0004 - "dil 8" // standard input (motherboard)
43497      // 0x0008 - "dil 9" // standard input (motherboard)
43498      // 0x0010 - "dil10" // standard input (motherboard)
43499      PORT_MODIFY("IN-18")
43500      // 0x0001 - "dil11" // standard input (motherboard)
43501      // 0x0002 - "dil12" // standard input (motherboard)
43502      // 0x0004 - "dil13" // standard input (motherboard)
43503      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
43504      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
43505      PORT_MODIFY("IN-19")
43506      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
43507      PORT_MODIFY("IN-20")
43508      // 0x0001 - "grnbut" // standard input (motherboard)
43509      // 0x0002 - "dorlok" // standard input (expected here)
43510      // 0x0004 - "topdor" // standard input (expected here)
43511      // 0x0008 - "botdor" // standard input (expected here)
43512      // 0x0010 - "hopdmp" // standard input (expected here)
4351343513INPUT_PORTS_END
4351443514
4351543515// PR2298 CLUB BOBBY DAZZLER         CLUB BOB DAZZLER  CLUB  CLUBBOBD SOUNDS
r31373r31374
4353343533}
4353443534
4353543535INPUT_PORTS_START( sc4brksp ) // this structure is generated
43536        PORT_INCLUDE( sc4_base )
43537        PORT_MODIFY("IN-1")
43538        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43539        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
43540        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
43541        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
43542        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
43543        PORT_MODIFY("IN-2")
43544        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("excnge")
43545        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43546        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43547        PORT_MODIFY("IN-8")
43548        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fet")
43549        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("mv rht")
43550        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("mv lft")
43551        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk stp")
43552        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
43553        PORT_MODIFY("IN-16")
43554        // 0x0001 - "dil  1" // standard input (motherboard)
43555        // 0x0002 - "dil  2" // standard input (motherboard)
43556        // 0x0004 - "dil  3" // standard input (motherboard)
43557        // 0x0008 - "dil  4" // standard input (motherboard)
43558        // 0x0010 - "dil  5" // standard input (motherboard)
43559        // 0x0100 - "top up" // known extended input, usually 'top up'
43560        PORT_MODIFY("IN-17")
43561        // 0x0001 - "dil  6" // standard input (motherboard)
43562        // 0x0002 - "dil  7" // standard input (motherboard)
43563        // 0x0004 - "dil  8" // standard input (motherboard)
43564        // 0x0008 - "dil  9" // standard input (motherboard)
43565        // 0x0010 - "dil 10" // standard input (motherboard)
43566        PORT_MODIFY("IN-18")
43567        // 0x0001 - "dil 11" // standard input (motherboard)
43568        // 0x0002 - "dil 12" // standard input (motherboard)
43569        // 0x0004 - "dil 13" // standard input (motherboard)
43570        // 0x0008 - "dil 14" // standard input (motherboard)
43571        // 0x0010 - "dil 15" // standard input (motherboard)
43572        PORT_MODIFY("IN-19")
43573        // 0x0001 - "dil 16" // standard input (motherboard)
43574        PORT_MODIFY("IN-20")
43575        // 0x0001 - "testsw" // standard input (motherboard)
43576        // 0x0002 - "dor lk" // standard input (expected here)
43577        // 0x0004 - "tp dor" // standard input (expected here)
43578        // 0x0008 - "csh bx" // standard input (expected here)
43579        // 0x0010 - "deflt" // standard input (expected here)
43536      PORT_INCLUDE( sc4_base )
43537      PORT_MODIFY("IN-1")
43538      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43539      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
43540      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
43541      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
43542      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
43543      PORT_MODIFY("IN-2")
43544      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("excnge")
43545      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43546      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43547      PORT_MODIFY("IN-8")
43548      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fet")
43549      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("mv rht")
43550      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("mv lft")
43551      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk stp")
43552      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
43553      PORT_MODIFY("IN-16")
43554      // 0x0001 - "dil  1" // standard input (motherboard)
43555      // 0x0002 - "dil  2" // standard input (motherboard)
43556      // 0x0004 - "dil  3" // standard input (motherboard)
43557      // 0x0008 - "dil  4" // standard input (motherboard)
43558      // 0x0010 - "dil  5" // standard input (motherboard)
43559      // 0x0100 - "top up" // known extended input, usually 'top up'
43560      PORT_MODIFY("IN-17")
43561      // 0x0001 - "dil  6" // standard input (motherboard)
43562      // 0x0002 - "dil  7" // standard input (motherboard)
43563      // 0x0004 - "dil  8" // standard input (motherboard)
43564      // 0x0008 - "dil  9" // standard input (motherboard)
43565      // 0x0010 - "dil 10" // standard input (motherboard)
43566      PORT_MODIFY("IN-18")
43567      // 0x0001 - "dil 11" // standard input (motherboard)
43568      // 0x0002 - "dil 12" // standard input (motherboard)
43569      // 0x0004 - "dil 13" // standard input (motherboard)
43570      // 0x0008 - "dil 14" // standard input (motherboard)
43571      // 0x0010 - "dil 15" // standard input (motherboard)
43572      PORT_MODIFY("IN-19")
43573      // 0x0001 - "dil 16" // standard input (motherboard)
43574      PORT_MODIFY("IN-20")
43575      // 0x0001 - "testsw" // standard input (motherboard)
43576      // 0x0002 - "dor lk" // standard input (expected here)
43577      // 0x0004 - "tp dor" // standard input (expected here)
43578      // 0x0008 - "csh bx" // standard input (expected here)
43579      // 0x0010 - "deflt" // standard input (expected here)
4358043580INPUT_PORTS_END
4358143581
4358243582// PR2033 BREAK THE SPELL         SPELL SOUNDS         BREAK THE SPELL
r31373r31374
4360043600}
4360143601
4360243602INPUT_PORTS_START( sc4bulcl ) // this structure is generated
43603        PORT_INCLUDE( sc4_base )
43604        PORT_MODIFY("IN-1")
43605        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43606        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
43607        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
43608        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
43609        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
43610        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
43611        PORT_MODIFY("IN-2")
43612        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("st/col")
43613        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
43614        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
43615        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43616        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
43617        PORT_MODIFY("IN-3")
43618        // 0x0004 - "stk 4" // standard input (expected here)
43619        // 0x0008 - "stk 3" // standard input (expected here)
43620        // 0x0010 - "stk 2" // standard input (expected here)
43621        PORT_MODIFY("IN-4")
43622        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
43623        PORT_MODIFY("IN-5")
43624        // 0x0001 - "priz4" // standard input (expected here)
43625        // 0x0002 - "priz3" // standard input (expected here)
43626        // 0x0004 - "priz2" // standard input (expected here)
43627        // 0x0008 - "priz1" // standard input (expected here)
43628        PORT_MODIFY("IN-8")
43629        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk win")
43630        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk nud")
43631        PORT_MODIFY("IN-16")
43632        // 0x0001 - "dil 1" // standard input (motherboard)
43633        // 0x0002 - "dil 2" // standard input (motherboard)
43634        // 0x0004 - "dil 3" // standard input (motherboard)
43635        // 0x0008 - "dil 4" // standard input (motherboard)
43636        // 0x0010 - "dil 5" // standard input (motherboard)
43637        // 0x0100 - "top up" // known extended input, usually 'top up'
43638        PORT_MODIFY("IN-17")
43639        // 0x0001 - "dil 6" // standard input (motherboard)
43640        // 0x0002 - "dil 7" // standard input (motherboard)
43641        // 0x0004 - "dil 8" // standard input (motherboard)
43642        // 0x0008 - "dil 9" // standard input (motherboard)
43643        // 0x0010 - "dil10" // standard input (motherboard)
43644        PORT_MODIFY("IN-18")
43645        // 0x0001 - "dil11" // standard input (motherboard)
43646        // 0x0002 - "dil12" // standard input (motherboard)
43647        // 0x0004 - "dil13" // standard input (motherboard)
43648        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
43649        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
43650        PORT_MODIFY("IN-19")
43651        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
43652        PORT_MODIFY("IN-20")
43653        // 0x0001 - "grnbut" // standard input (motherboard)
43654        // 0x0002 - "dorlok" // standard input (expected here)
43655        // 0x0004 - "topdor" // standard input (expected here)
43656        // 0x0008 - "botdor" // standard input (expected here)
43657        // 0x0010 - "hopdmp" // standard input (expected here)
43603      PORT_INCLUDE( sc4_base )
43604      PORT_MODIFY("IN-1")
43605      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43606      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
43607      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
43608      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
43609      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
43610      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
43611      PORT_MODIFY("IN-2")
43612      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("st/col")
43613      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trnsfr")
43614      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
43615      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43616      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
43617      PORT_MODIFY("IN-3")
43618      // 0x0004 - "stk 4" // standard input (expected here)
43619      // 0x0008 - "stk 3" // standard input (expected here)
43620      // 0x0010 - "stk 2" // standard input (expected here)
43621      PORT_MODIFY("IN-4")
43622      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
43623      PORT_MODIFY("IN-5")
43624      // 0x0001 - "priz4" // standard input (expected here)
43625      // 0x0002 - "priz3" // standard input (expected here)
43626      // 0x0004 - "priz2" // standard input (expected here)
43627      // 0x0008 - "priz1" // standard input (expected here)
43628      PORT_MODIFY("IN-8")
43629      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk win")
43630      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk nud")
43631      PORT_MODIFY("IN-16")
43632      // 0x0001 - "dil 1" // standard input (motherboard)
43633      // 0x0002 - "dil 2" // standard input (motherboard)
43634      // 0x0004 - "dil 3" // standard input (motherboard)
43635      // 0x0008 - "dil 4" // standard input (motherboard)
43636      // 0x0010 - "dil 5" // standard input (motherboard)
43637      // 0x0100 - "top up" // known extended input, usually 'top up'
43638      PORT_MODIFY("IN-17")
43639      // 0x0001 - "dil 6" // standard input (motherboard)
43640      // 0x0002 - "dil 7" // standard input (motherboard)
43641      // 0x0004 - "dil 8" // standard input (motherboard)
43642      // 0x0008 - "dil 9" // standard input (motherboard)
43643      // 0x0010 - "dil10" // standard input (motherboard)
43644      PORT_MODIFY("IN-18")
43645      // 0x0001 - "dil11" // standard input (motherboard)
43646      // 0x0002 - "dil12" // standard input (motherboard)
43647      // 0x0004 - "dil13" // standard input (motherboard)
43648      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
43649      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
43650      PORT_MODIFY("IN-19")
43651      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
43652      PORT_MODIFY("IN-20")
43653      // 0x0001 - "grnbut" // standard input (motherboard)
43654      // 0x0002 - "dorlok" // standard input (expected here)
43655      // 0x0004 - "topdor" // standard input (expected here)
43656      // 0x0008 - "botdor" // standard input (expected here)
43657      // 0x0010 - "hopdmp" // standard input (expected here)
4365843658INPUT_PORTS_END
4365943659
4366043660// PR1753 CLUB BULLSEYE         BULLSEYE  CLUB  PR1751 BULLSEYE SOUNDS11         BULLSYE
r31373r31374
4368643686}
4368743687
4368843688INPUT_PORTS_START( sc4carry ) // this structure is generated
43689        PORT_INCLUDE( sc4_base )
43690        PORT_MODIFY("IN-1")
43691        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43692        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colect")
43693        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1 OR high")
43694        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2 OR low")
43695        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
43696        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
43697        PORT_MODIFY("IN-2")
43698        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("bonus")
43699        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43700        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43701        PORT_MODIFY("IN-3")
43702        // 0x0004 - "stk 4" // standard input (expected here)
43703        // 0x0008 - "stk 3" // standard input (expected here)
43704        // 0x0010 - "stk 2" // standard input (expected here)
43705        PORT_MODIFY("IN-5")
43706        // 0x0001 - "priz4" // standard input (expected here)
43707        // 0x0002 - "priz3" // standard input (expected here)
43708        // 0x0004 - "priz2" // standard input (expected here)
43709        // 0x0008 - "priz1" // standard input (expected here)
43710        PORT_MODIFY("IN-6")
43711        // 0x0001 - "perc1" // standard input (expected here)
43712        // 0x0002 - "perc2" // standard input (expected here)
43713        // 0x0004 - "perc3" // standard input (expected here)
43714        // 0x0008 - "perc4" // standard input (expected here)
43715        PORT_MODIFY("IN-8")
43716        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkcash")
43717        PORT_MODIFY("IN-16")
43718        // 0x0001 - "dil 1" // standard input (motherboard)
43719        // 0x0002 - "dil 2" // standard input (motherboard)
43720        // 0x0004 - "dil 3" // standard input (motherboard)
43721        // 0x0008 - "dil 4" // standard input (motherboard)
43722        // 0x0010 - "dil 5" // standard input (motherboard)
43723        // 0x0100 - "top up" // known extended input, usually 'top up'
43724        PORT_MODIFY("IN-17")
43725        // 0x0001 - "dil 6" // standard input (motherboard)
43726        // 0x0002 - "dil 7" // standard input (motherboard)
43727        // 0x0004 - "dil 8" // standard input (motherboard)
43728        // 0x0008 - "dil 9" // standard input (motherboard)
43729        // 0x0010 - "dil10" // standard input (motherboard)
43730        PORT_MODIFY("IN-18")
43731        // 0x0001 - "dil11" // standard input (motherboard)
43732        // 0x0002 - "dil12" // standard input (motherboard)
43733        // 0x0004 - "dil13" // standard input (motherboard)
43734        // 0x0008 - "dil14" // standard input (motherboard)
43735        // 0x0010 - "dil15" // standard input (motherboard)
43736        PORT_MODIFY("IN-19")
43737        // 0x0001 - "dil16" // standard input (motherboard)
43738        PORT_MODIFY("IN-20")
43739        // 0x0001 - "grnbut" // standard input (motherboard)
43740        // 0x0002 - "dorlok" // standard input (expected here)
43741        // 0x0004 - "topdor" // standard input (expected here)
43742        // 0x0008 - "botdor" // standard input (expected here)
43743        // 0x0010 - "hopdmp" // standard input (expected here)
43689      PORT_INCLUDE( sc4_base )
43690      PORT_MODIFY("IN-1")
43691      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43692      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colect")
43693      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1 OR high")
43694      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2 OR low")
43695      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
43696      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
43697      PORT_MODIFY("IN-2")
43698      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("bonus")
43699      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43700      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43701      PORT_MODIFY("IN-3")
43702      // 0x0004 - "stk 4" // standard input (expected here)
43703      // 0x0008 - "stk 3" // standard input (expected here)
43704      // 0x0010 - "stk 2" // standard input (expected here)
43705      PORT_MODIFY("IN-5")
43706      // 0x0001 - "priz4" // standard input (expected here)
43707      // 0x0002 - "priz3" // standard input (expected here)
43708      // 0x0004 - "priz2" // standard input (expected here)
43709      // 0x0008 - "priz1" // standard input (expected here)
43710      PORT_MODIFY("IN-6")
43711      // 0x0001 - "perc1" // standard input (expected here)
43712      // 0x0002 - "perc2" // standard input (expected here)
43713      // 0x0004 - "perc3" // standard input (expected here)
43714      // 0x0008 - "perc4" // standard input (expected here)
43715      PORT_MODIFY("IN-8")
43716      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkcash")
43717      PORT_MODIFY("IN-16")
43718      // 0x0001 - "dil 1" // standard input (motherboard)
43719      // 0x0002 - "dil 2" // standard input (motherboard)
43720      // 0x0004 - "dil 3" // standard input (motherboard)
43721      // 0x0008 - "dil 4" // standard input (motherboard)
43722      // 0x0010 - "dil 5" // standard input (motherboard)
43723      // 0x0100 - "top up" // known extended input, usually 'top up'
43724      PORT_MODIFY("IN-17")
43725      // 0x0001 - "dil 6" // standard input (motherboard)
43726      // 0x0002 - "dil 7" // standard input (motherboard)
43727      // 0x0004 - "dil 8" // standard input (motherboard)
43728      // 0x0008 - "dil 9" // standard input (motherboard)
43729      // 0x0010 - "dil10" // standard input (motherboard)
43730      PORT_MODIFY("IN-18")
43731      // 0x0001 - "dil11" // standard input (motherboard)
43732      // 0x0002 - "dil12" // standard input (motherboard)
43733      // 0x0004 - "dil13" // standard input (motherboard)
43734      // 0x0008 - "dil14" // standard input (motherboard)
43735      // 0x0010 - "dil15" // standard input (motherboard)
43736      PORT_MODIFY("IN-19")
43737      // 0x0001 - "dil16" // standard input (motherboard)
43738      PORT_MODIFY("IN-20")
43739      // 0x0001 - "grnbut" // standard input (motherboard)
43740      // 0x0002 - "dorlok" // standard input (expected here)
43741      // 0x0004 - "topdor" // standard input (expected here)
43742      // 0x0008 - "botdor" // standard input (expected here)
43743      // 0x0010 - "hopdmp" // standard input (expected here)
4374443744INPUT_PORTS_END
4374543745
4374643746// PR1113 CARRY ON WINNING         PR1113 CARRY ON WINNING SOUNDS11
r31373r31374
4374843748GAMEL( 200?, sc4carrya   ,sc4carry,  sc4, sc4carry, sc4_state, sc4carry, ROT0, "BFM","Carry On Winning (Bellfruit) (Scorpion 4) (set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4374943749
4375043750INPUT_PORTS_START( sc4cbaz ) // this structure is generated
43751        PORT_INCLUDE( sc4_base )
43752        PORT_MODIFY("IN-1")
43753        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
43754        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
43755        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
43756        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR high")
43757        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4 OR low")
43758        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
43759        PORT_MODIFY("IN-2")
43760        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
43761        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
43762        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43763        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43764        PORT_MODIFY("IN-3")
43765        // 0x0004 - "stk 4" // standard input (expected here)
43766        // 0x0008 - "stk 3" // standard input (expected here)
43767        // 0x0010 - "stk 2" // standard input (expected here)
43768        PORT_MODIFY("IN-4")
43769        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
43770        PORT_MODIFY("IN-5")
43771        // 0x0001 - "priz4" // standard input (expected here)
43772        // 0x0002 - "priz3" // standard input (expected here)
43773        // 0x0004 - "priz2" // standard input (expected here)
43774        // 0x0008 - "priz1" // standard input (expected here)
43775        PORT_MODIFY("IN-8")
43776        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
43777        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk cml")
43778        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bon")
43779        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
43780        PORT_MODIFY("IN-16")
43781        // 0x0001 - "dil 1" // standard input (motherboard)
43782        // 0x0002 - "dil 2" // standard input (motherboard)
43783        // 0x0004 - "dil 3" // standard input (motherboard)
43784        // 0x0008 - "dil 4" // standard input (motherboard)
43785        // 0x0010 - "dil 5" // standard input (motherboard)
43786        // 0x0100 - "top up" // known extended input, usually 'top up'
43787        PORT_MODIFY("IN-17")
43788        // 0x0001 - "dil 6" // standard input (motherboard)
43789        // 0x0002 - "dil 7" // standard input (motherboard)
43790        // 0x0004 - "dil 8" // standard input (motherboard)
43791        // 0x0008 - "dil 9" // standard input (motherboard)
43792        // 0x0010 - "dil10" // standard input (motherboard)
43793        PORT_MODIFY("IN-18")
43794        // 0x0001 - "dil11" // standard input (motherboard)
43795        // 0x0002 - "dil12" // standard input (motherboard)
43796        // 0x0004 - "dil13" // standard input (motherboard)
43797        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
43798        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
43799        PORT_MODIFY("IN-19")
43800        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
43801        PORT_MODIFY("IN-20")
43802        // 0x0001 - "grnbut" // standard input (motherboard)
43803        // 0x0002 - "dorlok" // standard input (expected here)
43804        // 0x0004 - "topdor" // standard input (expected here)
43805        // 0x0008 - "botdor" // standard input (expected here)
43806        // 0x0010 - "hopdmp" // standard input (expected here)
43751      PORT_INCLUDE( sc4_base )
43752      PORT_MODIFY("IN-1")
43753      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
43754      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
43755      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
43756      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR high")
43757      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4 OR low")
43758      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
43759      PORT_MODIFY("IN-2")
43760      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
43761      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
43762      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43763      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43764      PORT_MODIFY("IN-3")
43765      // 0x0004 - "stk 4" // standard input (expected here)
43766      // 0x0008 - "stk 3" // standard input (expected here)
43767      // 0x0010 - "stk 2" // standard input (expected here)
43768      PORT_MODIFY("IN-4")
43769      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
43770      PORT_MODIFY("IN-5")
43771      // 0x0001 - "priz4" // standard input (expected here)
43772      // 0x0002 - "priz3" // standard input (expected here)
43773      // 0x0004 - "priz2" // standard input (expected here)
43774      // 0x0008 - "priz1" // standard input (expected here)
43775      PORT_MODIFY("IN-8")
43776      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
43777      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk cml")
43778      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk bon")
43779      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
43780      PORT_MODIFY("IN-16")
43781      // 0x0001 - "dil 1" // standard input (motherboard)
43782      // 0x0002 - "dil 2" // standard input (motherboard)
43783      // 0x0004 - "dil 3" // standard input (motherboard)
43784      // 0x0008 - "dil 4" // standard input (motherboard)
43785      // 0x0010 - "dil 5" // standard input (motherboard)
43786      // 0x0100 - "top up" // known extended input, usually 'top up'
43787      PORT_MODIFY("IN-17")
43788      // 0x0001 - "dil 6" // standard input (motherboard)
43789      // 0x0002 - "dil 7" // standard input (motherboard)
43790      // 0x0004 - "dil 8" // standard input (motherboard)
43791      // 0x0008 - "dil 9" // standard input (motherboard)
43792      // 0x0010 - "dil10" // standard input (motherboard)
43793      PORT_MODIFY("IN-18")
43794      // 0x0001 - "dil11" // standard input (motherboard)
43795      // 0x0002 - "dil12" // standard input (motherboard)
43796      // 0x0004 - "dil13" // standard input (motherboard)
43797      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
43798      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
43799      PORT_MODIFY("IN-19")
43800      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
43801      PORT_MODIFY("IN-20")
43802      // 0x0001 - "grnbut" // standard input (motherboard)
43803      // 0x0002 - "dorlok" // standard input (expected here)
43804      // 0x0004 - "topdor" // standard input (expected here)
43805      // 0x0008 - "botdor" // standard input (expected here)
43806      // 0x0010 - "hopdmp" // standard input (expected here)
4380743807INPUT_PORTS_END
4380843808
4380943809// PR1349 CLUB CASH BAZAAR         PR1349 CLUB CASH BAZAAR SOUNDS11
r31373r31374
4382543825
4382643826
4382743827INPUT_PORTS_START( sc4clash ) // this structure is generated
43828        PORT_INCLUDE( sc4_base )
43829        PORT_MODIFY("IN-1")
43830        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
43831        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
43832        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
43833        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
43834        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
43835        PORT_MODIFY("IN-2")
43836        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
43837        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43838        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43839        PORT_MODIFY("IN-8")
43840        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkcash")
43841        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("moveup")
43842        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkpick")
43843        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tknuds")
43844        PORT_MODIFY("IN-16")
43845        // 0x0001 - "dil 1" // standard input (motherboard)
43846        // 0x0002 - "dil 2" // standard input (motherboard)
43847        // 0x0004 - "dil 3" // standard input (motherboard)
43848        // 0x0008 - "dil 4" // standard input (motherboard)
43849        // 0x0010 - "dil 5" // standard input (motherboard)
43850        // 0x0100 - "topup" // known extended input, usually 'top up'
43851        PORT_MODIFY("IN-17")
43852        // 0x0001 - "dil 6" // standard input (motherboard)
43853        // 0x0002 - "dil 7" // standard input (motherboard)
43854        // 0x0004 - "dil 8" // standard input (motherboard)
43855        // 0x0008 - "dil 9" // standard input (motherboard)
43856        // 0x0010 - "dil10" // standard input (motherboard)
43857        PORT_MODIFY("IN-18")
43858        // 0x0001 - "dil11" // standard input (motherboard)
43859        // 0x0002 - "dil12" // standard input (motherboard)
43860        // 0x0004 - "dil13" // standard input (motherboard)
43861        // 0x0008 - "dil14" // standard input (motherboard)
43862        // 0x0010 - "dil15" // standard input (motherboard)
43863        PORT_MODIFY("IN-19")
43864        // 0x0001 - "dil16" // standard input (motherboard)
43865        PORT_MODIFY("IN-20")
43866        // 0x0001 - "test" // standard input (motherboard)
43867        // 0x0002 - "dor lk" // standard input (expected here)
43868        // 0x0004 - "tp dor" // standard input (expected here)
43869        // 0x0008 - "csh bx" // standard input (expected here)
43870        // 0x0010 - "deflt" // standard input (expected here)
43828      PORT_INCLUDE( sc4_base )
43829      PORT_MODIFY("IN-1")
43830      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
43831      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
43832      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
43833      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
43834      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
43835      PORT_MODIFY("IN-2")
43836      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
43837      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
43838      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43839      PORT_MODIFY("IN-8")
43840      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkcash")
43841      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("moveup")
43842      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkpick")
43843      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tknuds")
43844      PORT_MODIFY("IN-16")
43845      // 0x0001 - "dil 1" // standard input (motherboard)
43846      // 0x0002 - "dil 2" // standard input (motherboard)
43847      // 0x0004 - "dil 3" // standard input (motherboard)
43848      // 0x0008 - "dil 4" // standard input (motherboard)
43849      // 0x0010 - "dil 5" // standard input (motherboard)
43850      // 0x0100 - "topup" // known extended input, usually 'top up'
43851      PORT_MODIFY("IN-17")
43852      // 0x0001 - "dil 6" // standard input (motherboard)
43853      // 0x0002 - "dil 7" // standard input (motherboard)
43854      // 0x0004 - "dil 8" // standard input (motherboard)
43855      // 0x0008 - "dil 9" // standard input (motherboard)
43856      // 0x0010 - "dil10" // standard input (motherboard)
43857      PORT_MODIFY("IN-18")
43858      // 0x0001 - "dil11" // standard input (motherboard)
43859      // 0x0002 - "dil12" // standard input (motherboard)
43860      // 0x0004 - "dil13" // standard input (motherboard)
43861      // 0x0008 - "dil14" // standard input (motherboard)
43862      // 0x0010 - "dil15" // standard input (motherboard)
43863      PORT_MODIFY("IN-19")
43864      // 0x0001 - "dil16" // standard input (motherboard)
43865      PORT_MODIFY("IN-20")
43866      // 0x0001 - "test" // standard input (motherboard)
43867      // 0x0002 - "dor lk" // standard input (expected here)
43868      // 0x0004 - "tp dor" // standard input (expected here)
43869      // 0x0008 - "csh bx" // standard input (expected here)
43870      // 0x0010 - "deflt" // standard input (expected here)
4387143871INPUT_PORTS_END
4387243872
4387343873// PR2118 CASH ON THE LASH         COTL SOUNDS         CASH ON THE LASH
r31373r31374
4388243882
4388343883
4388443884INPUT_PORTS_START( sc4cckey ) // this structure is generated
43885        PORT_INCLUDE( sc4_base )
43886        PORT_MODIFY("IN-1")
43887        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43888        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
43889        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
43890        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
43891        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
43892        PORT_MODIFY("IN-2")
43893        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
43894        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
43895        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43896        PORT_MODIFY("IN-3")
43897        // 0x0004 - "stk 4" // standard input (expected here)
43898        // 0x0008 - "stk 3" // standard input (expected here)
43899        // 0x0010 - "stk 2" // standard input (expected here)
43900        PORT_MODIFY("IN-4")
43901        // 0x0002 - "hop hi" // known extended(?) input, sometimes 'hop hi'
43902        // 0x0008 - "htopup" // known extended(?) input, sometimes 'hop top'
43903        PORT_MODIFY("IN-5")
43904        // 0x0001 - "priz4" // standard input (expected here)
43905        // 0x0002 - "priz3" // standard input (expected here)
43906        // 0x0004 - "priz2" // standard input (expected here)
43907        // 0x0008 - "priz1" // standard input (expected here)
43908        PORT_MODIFY("IN-6")
43909        // 0x0001 - "perc1" // standard input (expected here)
43910        // 0x0002 - "perc2" // standard input (expected here)
43911        // 0x0004 - "perc3" // standard input (expected here)
43912        // 0x0008 - "perc4" // standard input (expected here)
43913        PORT_MODIFY("IN-16")
43914        // 0x0001 - "dil 1" // standard input (motherboard)
43915        // 0x0002 - "dil 2" // standard input (motherboard)
43916        // 0x0004 - "dil 3" // standard input (motherboard)
43917        // 0x0008 - "dil 4" // standard input (motherboard)
43918        // 0x0010 - "dil 5" // standard input (motherboard)
43919        PORT_MODIFY("IN-17")
43920        // 0x0001 - "dil 6" // standard input (motherboard)
43921        // 0x0002 - "dil 7" // standard input (motherboard)
43922        // 0x0004 - "dil 8" // standard input (motherboard)
43923        // 0x0008 - "dil 9" // standard input (motherboard)
43924        // 0x0010 - "dil10" // standard input (motherboard)
43925        PORT_MODIFY("IN-18")
43926        // 0x0001 - "dil11" // standard input (motherboard)
43927        // 0x0002 - "dil12" // standard input (motherboard)
43928        // 0x0004 - "dil13" // standard input (motherboard)
43929        // 0x0008 - "dil14" // standard input (motherboard)
43930        // 0x0010 - "dil15" // standard input (motherboard)
43931        PORT_MODIFY("IN-19")
43932        // 0x0001 - "dil16" // standard input (motherboard)
43933        PORT_MODIFY("IN-20")
43934        // 0x0001 - "grnbut" // standard input (motherboard)
43935        // 0x0002 - "cshdor" // standard input (expected here)
43936        // 0x0004 - "serdor" // standard input (expected here)
43937        // 0x0008 - "hopdmp" // standard input (expected here)
43885      PORT_INCLUDE( sc4_base )
43886      PORT_MODIFY("IN-1")
43887      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
43888      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
43889      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
43890      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
43891      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
43892      PORT_MODIFY("IN-2")
43893      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
43894      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
43895      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43896      PORT_MODIFY("IN-3")
43897      // 0x0004 - "stk 4" // standard input (expected here)
43898      // 0x0008 - "stk 3" // standard input (expected here)
43899      // 0x0010 - "stk 2" // standard input (expected here)
43900      PORT_MODIFY("IN-4")
43901      // 0x0002 - "hop hi" // known extended(?) input, sometimes 'hop hi'
43902      // 0x0008 - "htopup" // known extended(?) input, sometimes 'hop top'
43903      PORT_MODIFY("IN-5")
43904      // 0x0001 - "priz4" // standard input (expected here)
43905      // 0x0002 - "priz3" // standard input (expected here)
43906      // 0x0004 - "priz2" // standard input (expected here)
43907      // 0x0008 - "priz1" // standard input (expected here)
43908      PORT_MODIFY("IN-6")
43909      // 0x0001 - "perc1" // standard input (expected here)
43910      // 0x0002 - "perc2" // standard input (expected here)
43911      // 0x0004 - "perc3" // standard input (expected here)
43912      // 0x0008 - "perc4" // standard input (expected here)
43913      PORT_MODIFY("IN-16")
43914      // 0x0001 - "dil 1" // standard input (motherboard)
43915      // 0x0002 - "dil 2" // standard input (motherboard)
43916      // 0x0004 - "dil 3" // standard input (motherboard)
43917      // 0x0008 - "dil 4" // standard input (motherboard)
43918      // 0x0010 - "dil 5" // standard input (motherboard)
43919      PORT_MODIFY("IN-17")
43920      // 0x0001 - "dil 6" // standard input (motherboard)
43921      // 0x0002 - "dil 7" // standard input (motherboard)
43922      // 0x0004 - "dil 8" // standard input (motherboard)
43923      // 0x0008 - "dil 9" // standard input (motherboard)
43924      // 0x0010 - "dil10" // standard input (motherboard)
43925      PORT_MODIFY("IN-18")
43926      // 0x0001 - "dil11" // standard input (motherboard)
43927      // 0x0002 - "dil12" // standard input (motherboard)
43928      // 0x0004 - "dil13" // standard input (motherboard)
43929      // 0x0008 - "dil14" // standard input (motherboard)
43930      // 0x0010 - "dil15" // standard input (motherboard)
43931      PORT_MODIFY("IN-19")
43932      // 0x0001 - "dil16" // standard input (motherboard)
43933      PORT_MODIFY("IN-20")
43934      // 0x0001 - "grnbut" // standard input (motherboard)
43935      // 0x0002 - "cshdor" // standard input (expected here)
43936      // 0x0004 - "serdor" // standard input (expected here)
43937      // 0x0008 - "hopdmp" // standard input (expected here)
4393843938INPUT_PORTS_END
4393943939
4394043940// PR1426 CASINO CRAZY FRUITS GOLD         PR1426 CRAZY F GOLD SOUNDS11      CRAZY FRUIT GOLD  S.SITE  (set was marked as Casino Crazy Keys)
r31373r31374
4397243972}
4397343973
4397443974INPUT_PORTS_START( sc4clclo ) // this structure is generated
43975        PORT_INCLUDE( sc4_base )
43976        PORT_MODIFY("IN-1")
43977        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
43978        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
43979        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
43980        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
43981        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
43982        PORT_MODIFY("IN-2")
43983        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
43984        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
43985        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
43986        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43987        PORT_MODIFY("IN-3")
43988        // 0x0004 - "stk 4" // standard input (expected here)
43989        // 0x0008 - "stk 3" // standard input (expected here)
43990        // 0x0010 - "stk 2" // standard input (expected here)
43991        PORT_MODIFY("IN-4")
43992        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
43993        PORT_MODIFY("IN-5")
43994        // 0x0001 - "priz4" // standard input (expected here)
43995        // 0x0002 - "priz3" // standard input (expected here)
43996        // 0x0004 - "priz2" // standard input (expected here)
43997        // 0x0008 - "priz1" // standard input (expected here)
43998        PORT_MODIFY("IN-8")
43999        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("level1")
44000        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("level3")
44001        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("level2")
44002        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk csh")
44003        PORT_MODIFY("IN-16")
44004        // 0x0001 - "dil 1" // standard input (motherboard)
44005        // 0x0002 - "dil 2" // standard input (motherboard)
44006        // 0x0004 - "dil 3" // standard input (motherboard)
44007        // 0x0008 - "dil 4" // standard input (motherboard)
44008        // 0x0010 - "dil 5" // standard input (motherboard)
44009        // 0x0100 - "top up" // known extended input, usually 'top up'
44010        PORT_MODIFY("IN-17")
44011        // 0x0001 - "dil 6" // standard input (motherboard)
44012        // 0x0002 - "dil 7" // standard input (motherboard)
44013        // 0x0004 - "dil 8" // standard input (motherboard)
44014        // 0x0008 - "dil 9" // standard input (motherboard)
44015        // 0x0010 - "dil10" // standard input (motherboard)
44016        PORT_MODIFY("IN-18")
44017        // 0x0001 - "dil11" // standard input (motherboard)
44018        // 0x0002 - "dil12" // standard input (motherboard)
44019        // 0x0004 - "dil13" // standard input (motherboard)
44020        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
44021        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
44022        PORT_MODIFY("IN-19")
44023        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
44024        PORT_MODIFY("IN-20")
44025        // 0x0001 - "grnbut" // standard input (motherboard)
44026        // 0x0002 - "dorlok" // standard input (expected here)
44027        // 0x0004 - "topdor" // standard input (expected here)
44028        // 0x0008 - "botdor" // standard input (expected here)
44029        // 0x0010 - "hopdmp" // standard input (expected here)
43975      PORT_INCLUDE( sc4_base )
43976      PORT_MODIFY("IN-1")
43977      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("lh1")
43978      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("lh2")
43979      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("lh3")
43980      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("lh4")
43981      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("rh4")
43982      PORT_MODIFY("IN-2")
43983      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("rh3")
43984      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("rh2")
43985      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("rh1")
43986      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
43987      PORT_MODIFY("IN-3")
43988      // 0x0004 - "stk 4" // standard input (expected here)
43989      // 0x0008 - "stk 3" // standard input (expected here)
43990      // 0x0010 - "stk 2" // standard input (expected here)
43991      PORT_MODIFY("IN-4")
43992      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
43993      PORT_MODIFY("IN-5")
43994      // 0x0001 - "priz4" // standard input (expected here)
43995      // 0x0002 - "priz3" // standard input (expected here)
43996      // 0x0004 - "priz2" // standard input (expected here)
43997      // 0x0008 - "priz1" // standard input (expected here)
43998      PORT_MODIFY("IN-8")
43999      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("level1")
44000      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("level3")
44001      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("level2")
44002      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk csh")
44003      PORT_MODIFY("IN-16")
44004      // 0x0001 - "dil 1" // standard input (motherboard)
44005      // 0x0002 - "dil 2" // standard input (motherboard)
44006      // 0x0004 - "dil 3" // standard input (motherboard)
44007      // 0x0008 - "dil 4" // standard input (motherboard)
44008      // 0x0010 - "dil 5" // standard input (motherboard)
44009      // 0x0100 - "top up" // known extended input, usually 'top up'
44010      PORT_MODIFY("IN-17")
44011      // 0x0001 - "dil 6" // standard input (motherboard)
44012      // 0x0002 - "dil 7" // standard input (motherboard)
44013      // 0x0004 - "dil 8" // standard input (motherboard)
44014      // 0x0008 - "dil 9" // standard input (motherboard)
44015      // 0x0010 - "dil10" // standard input (motherboard)
44016      PORT_MODIFY("IN-18")
44017      // 0x0001 - "dil11" // standard input (motherboard)
44018      // 0x0002 - "dil12" // standard input (motherboard)
44019      // 0x0004 - "dil13" // standard input (motherboard)
44020      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
44021      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
44022      PORT_MODIFY("IN-19")
44023      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
44024      PORT_MODIFY("IN-20")
44025      // 0x0001 - "grnbut" // standard input (motherboard)
44026      // 0x0002 - "dorlok" // standard input (expected here)
44027      // 0x0004 - "topdor" // standard input (expected here)
44028      // 0x0008 - "botdor" // standard input (expected here)
44029      // 0x0010 - "hopdmp" // standard input (expected here)
4403044030INPUT_PORTS_END
4403144031
4403244032// PR2383 CLUBCLOUSEAU         CLUBCLOUSEAU  CLUB  CCLOU SOUNDS         CLUB CLOSEAU
r31373r31374
4404944049}
4405044050
4405144051INPUT_PORTS_START( sc4cjcl ) // this structure is generated
44052        PORT_INCLUDE( sc4_base )
44053        PORT_MODIFY("IN-1")
44054        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
44055        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
44056        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
44057        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
44058        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
44059        PORT_MODIFY("IN-2")
44060        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
44061        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
44062        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
44063        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44064        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
44065        PORT_MODIFY("IN-3")
44066        // 0x0004 - "stk 4" // standard input (expected here)
44067        // 0x0008 - "stk 3" // standard input (expected here)
44068        // 0x0010 - "stk 2" // standard input (expected here)
44069        PORT_MODIFY("IN-4")
44070        // 0x0001 - "hop2lo" // unexpected here
44071        // 0x0002 - "hop1lo OR hop lo" // known extended(?) input, sometimes 'hop hi'
44072        PORT_MODIFY("IN-5")
44073        // 0x0001 - "priz4" // standard input (expected here)
44074        // 0x0002 - "priz3" // standard input (expected here)
44075        // 0x0004 - "priz2" // standard input (expected here)
44076        // 0x0008 - "priz1" // standard input (expected here)
44077        PORT_MODIFY("IN-8")
44078        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudges")
44079        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shots")
44080        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
44081        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spr mt")
44082        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("bell")
44083        PORT_MODIFY("IN-16")
44084        // 0x0001 - "dil 1" // standard input (motherboard)
44085        // 0x0002 - "dil 2" // standard input (motherboard)
44086        // 0x0004 - "dil 3" // standard input (motherboard)
44087        // 0x0008 - "dil 4" // standard input (motherboard)
44088        // 0x0010 - "dil 5" // standard input (motherboard)
44089        // 0x0100 - "top up" // known extended input, usually 'top up'
44090        PORT_MODIFY("IN-17")
44091        // 0x0001 - "dil 6" // standard input (motherboard)
44092        // 0x0002 - "dil 7" // standard input (motherboard)
44093        // 0x0004 - "dil 8" // standard input (motherboard)
44094        // 0x0008 - "dil 9" // standard input (motherboard)
44095        // 0x0010 - "dil10" // standard input (motherboard)
44096        PORT_MODIFY("IN-18")
44097        // 0x0001 - "dil11" // standard input (motherboard)
44098        // 0x0002 - "dil12" // standard input (motherboard)
44099        // 0x0004 - "dil13" // standard input (motherboard)
44100        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
44101        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
44102        PORT_MODIFY("IN-19")
44103        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
44104        PORT_MODIFY("IN-20")
44105        // 0x0001 - "grnbut" // standard input (motherboard)
44106        // 0x0002 - "dorlok" // standard input (expected here)
44107        // 0x0004 - "topdor" // standard input (expected here)
44108        // 0x0008 - "botdor" // standard input (expected here)
44109        // 0x0010 - "hopdmp" // standard input (expected here)
44052      PORT_INCLUDE( sc4_base )
44053      PORT_MODIFY("IN-1")
44054      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
44055      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
44056      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
44057      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
44058      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
44059      PORT_MODIFY("IN-2")
44060      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
44061      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
44062      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
44063      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44064      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
44065      PORT_MODIFY("IN-3")
44066      // 0x0004 - "stk 4" // standard input (expected here)
44067      // 0x0008 - "stk 3" // standard input (expected here)
44068      // 0x0010 - "stk 2" // standard input (expected here)
44069      PORT_MODIFY("IN-4")
44070      // 0x0001 - "hop2lo" // unexpected here
44071      // 0x0002 - "hop1lo OR hop lo" // known extended(?) input, sometimes 'hop hi'
44072      PORT_MODIFY("IN-5")
44073      // 0x0001 - "priz4" // standard input (expected here)
44074      // 0x0002 - "priz3" // standard input (expected here)
44075      // 0x0004 - "priz2" // standard input (expected here)
44076      // 0x0008 - "priz1" // standard input (expected here)
44077      PORT_MODIFY("IN-8")
44078      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudges")
44079      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shots")
44080      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
44081      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spr mt")
44082      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("bell")
44083      PORT_MODIFY("IN-16")
44084      // 0x0001 - "dil 1" // standard input (motherboard)
44085      // 0x0002 - "dil 2" // standard input (motherboard)
44086      // 0x0004 - "dil 3" // standard input (motherboard)
44087      // 0x0008 - "dil 4" // standard input (motherboard)
44088      // 0x0010 - "dil 5" // standard input (motherboard)
44089      // 0x0100 - "top up" // known extended input, usually 'top up'
44090      PORT_MODIFY("IN-17")
44091      // 0x0001 - "dil 6" // standard input (motherboard)
44092      // 0x0002 - "dil 7" // standard input (motherboard)
44093      // 0x0004 - "dil 8" // standard input (motherboard)
44094      // 0x0008 - "dil 9" // standard input (motherboard)
44095      // 0x0010 - "dil10" // standard input (motherboard)
44096      PORT_MODIFY("IN-18")
44097      // 0x0001 - "dil11" // standard input (motherboard)
44098      // 0x0002 - "dil12" // standard input (motherboard)
44099      // 0x0004 - "dil13" // standard input (motherboard)
44100      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
44101      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
44102      PORT_MODIFY("IN-19")
44103      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
44104      PORT_MODIFY("IN-20")
44105      // 0x0001 - "grnbut" // standard input (motherboard)
44106      // 0x0002 - "dorlok" // standard input (expected here)
44107      // 0x0004 - "topdor" // standard input (expected here)
44108      // 0x0008 - "botdor" // standard input (expected here)
44109      // 0x0010 - "hopdmp" // standard input (expected here)
4411044110INPUT_PORTS_END
4411144111
4411244112// PR1621 CLUB COOL JEWELS         PR1621 COOL SOUNDS11         CLUB COOL JEWELS  CLUB
r31373r31374
4412044120
4412144121
4412244122INPUT_PORTS_START( sc4crcp ) // this structure is generated
44123        PORT_INCLUDE( sc4_base )
44124        PORT_MODIFY("IN-1")
44125        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
44126        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
44127        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
44128        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
44129        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
44130        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
44131        PORT_MODIFY("IN-2")
44132        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
44133        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ex/tra")
44134        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44135        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44136        PORT_MODIFY("IN-3")
44137        // 0x0004 - "stk 4" // standard input (expected here)
44138        // 0x0008 - "stk 3" // standard input (expected here)
44139        // 0x0010 - "stk 2" // standard input (expected here)
44140        PORT_MODIFY("IN-4")
44141        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
44142        PORT_MODIFY("IN-5")
44143        // 0x0001 - "priz4" // standard input (expected here)
44144        // 0x0002 - "priz3" // standard input (expected here)
44145        // 0x0004 - "priz2" // standard input (expected here)
44146        // 0x0008 - "priz1" // standard input (expected here)
44147        PORT_MODIFY("IN-8")
44148        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
44149        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk swg")
44150        PORT_MODIFY("IN-16")
44151        // 0x0001 - "dil 1" // standard input (motherboard)
44152        // 0x0002 - "dil 2" // standard input (motherboard)
44153        // 0x0004 - "dil 3" // standard input (motherboard)
44154        // 0x0008 - "dil 4" // standard input (motherboard)
44155        // 0x0010 - "dil 5" // standard input (motherboard)
44156        // 0x0100 - "top up" // known extended input, usually 'top up'
44157        PORT_MODIFY("IN-17")
44158        // 0x0001 - "dil 6" // standard input (motherboard)
44159        // 0x0002 - "dil 7" // standard input (motherboard)
44160        // 0x0004 - "dil 8" // standard input (motherboard)
44161        // 0x0008 - "dil 9" // standard input (motherboard)
44162        // 0x0010 - "dil10" // standard input (motherboard)
44163        PORT_MODIFY("IN-18")
44164        // 0x0001 - "dil11" // standard input (motherboard)
44165        // 0x0002 - "dil12" // standard input (motherboard)
44166        // 0x0004 - "dil13" // standard input (motherboard)
44167        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
44168        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
44169        PORT_MODIFY("IN-19")
44170        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
44171        PORT_MODIFY("IN-20")
44172        // 0x0001 - "grnbut" // standard input (motherboard)
44173        // 0x0002 - "dorlok" // standard input (expected here)
44174        // 0x0004 - "topdor" // standard input (expected here)
44175        // 0x0008 - "botdor" // standard input (expected here)
44176        // 0x0010 - "hopdmp" // standard input (expected here)
44123      PORT_INCLUDE( sc4_base )
44124      PORT_MODIFY("IN-1")
44125      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
44126      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
44127      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
44128      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
44129      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
44130      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
44131      PORT_MODIFY("IN-2")
44132      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
44133      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("ex/tra")
44134      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44135      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44136      PORT_MODIFY("IN-3")
44137      // 0x0004 - "stk 4" // standard input (expected here)
44138      // 0x0008 - "stk 3" // standard input (expected here)
44139      // 0x0010 - "stk 2" // standard input (expected here)
44140      PORT_MODIFY("IN-4")
44141      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
44142      PORT_MODIFY("IN-5")
44143      // 0x0001 - "priz4" // standard input (expected here)
44144      // 0x0002 - "priz3" // standard input (expected here)
44145      // 0x0004 - "priz2" // standard input (expected here)
44146      // 0x0008 - "priz1" // standard input (expected here)
44147      PORT_MODIFY("IN-8")
44148      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
44149      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk swg")
44150      PORT_MODIFY("IN-16")
44151      // 0x0001 - "dil 1" // standard input (motherboard)
44152      // 0x0002 - "dil 2" // standard input (motherboard)
44153      // 0x0004 - "dil 3" // standard input (motherboard)
44154      // 0x0008 - "dil 4" // standard input (motherboard)
44155      // 0x0010 - "dil 5" // standard input (motherboard)
44156      // 0x0100 - "top up" // known extended input, usually 'top up'
44157      PORT_MODIFY("IN-17")
44158      // 0x0001 - "dil 6" // standard input (motherboard)
44159      // 0x0002 - "dil 7" // standard input (motherboard)
44160      // 0x0004 - "dil 8" // standard input (motherboard)
44161      // 0x0008 - "dil 9" // standard input (motherboard)
44162      // 0x0010 - "dil10" // standard input (motherboard)
44163      PORT_MODIFY("IN-18")
44164      // 0x0001 - "dil11" // standard input (motherboard)
44165      // 0x0002 - "dil12" // standard input (motherboard)
44166      // 0x0004 - "dil13" // standard input (motherboard)
44167      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
44168      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
44169      PORT_MODIFY("IN-19")
44170      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
44171      PORT_MODIFY("IN-20")
44172      // 0x0001 - "grnbut" // standard input (motherboard)
44173      // 0x0002 - "dorlok" // standard input (expected here)
44174      // 0x0004 - "topdor" // standard input (expected here)
44175      // 0x0008 - "botdor" // standard input (expected here)
44176      // 0x0010 - "hopdmp" // standard input (expected here)
4417744177INPUT_PORTS_END
4417844178
4417944179// PR3241 CLUB COPS AND ROBBERS PLATINUM SCORP4         COPS & ROBRS PLT  CLUB  PR3241 C N R PLATINUM SOUNDS11      COPS AND ROBBERS
r31373r31374
4418944189GAMEL( 200?, sc4crcpj    ,sc4crcp,   sc4, sc4crcp, sc4_state, sc4mbus, ROT0, "BFM","Cops 'n' Robbers Club Platinum (Bellfruit) (Scorpion 4) (set 10)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4419044190
4419144191INPUT_PORTS_START( sc4crgc ) // this structure is generated
44192        PORT_INCLUDE( sc4_base )
44193        PORT_MODIFY("IN-1")
44194        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
44195        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
44196        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
44197        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
44198        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
44199        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
44200        PORT_MODIFY("IN-2")
44201        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
44202        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
44203        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44204        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44205        PORT_MODIFY("IN-3")
44206        // 0x0004 - "stk 4" // standard input (expected here)
44207        // 0x0008 - "stk 3" // standard input (expected here)
44208        // 0x0010 - "stk 2" // standard input (expected here)
44209        PORT_MODIFY("IN-4")
44210        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
44211        PORT_MODIFY("IN-5")
44212        // 0x0001 - "priz4" // standard input (expected here)
44213        // 0x0002 - "priz3" // standard input (expected here)
44214        // 0x0004 - "priz2" // standard input (expected here)
44215        // 0x0008 - "priz1" // standard input (expected here)
44216        PORT_MODIFY("IN-8")
44217        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
44218        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk swg")
44219        PORT_MODIFY("IN-16")
44220        // 0x0001 - "dil 1" // standard input (motherboard)
44221        // 0x0002 - "dil 2" // standard input (motherboard)
44222        // 0x0004 - "dil 3" // standard input (motherboard)
44223        // 0x0008 - "dil 4" // standard input (motherboard)
44224        // 0x0010 - "dil 5" // standard input (motherboard)
44225        // 0x0100 - "top up" // known extended input, usually 'top up'
44226        PORT_MODIFY("IN-17")
44227        // 0x0001 - "dil 6" // standard input (motherboard)
44228        // 0x0002 - "dil 7" // standard input (motherboard)
44229        // 0x0004 - "dil 8" // standard input (motherboard)
44230        // 0x0008 - "dil 9" // standard input (motherboard)
44231        // 0x0010 - "dil10" // standard input (motherboard)
44232        PORT_MODIFY("IN-18")
44233        // 0x0001 - "dil11" // standard input (motherboard)
44234        // 0x0002 - "dil12" // standard input (motherboard)
44235        // 0x0004 - "dil13" // standard input (motherboard)
44236        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
44237        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
44238        PORT_MODIFY("IN-19")
44239        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
44240        PORT_MODIFY("IN-20")
44241        // 0x0001 - "grnbut" // standard input (motherboard)
44242        // 0x0002 - "dorlok" // standard input (expected here)
44243        // 0x0004 - "topdor" // standard input (expected here)
44244        // 0x0008 - "botdor" // standard input (expected here)
44245        // 0x0010 - "hopdmp" // standard input (expected here)
44192      PORT_INCLUDE( sc4_base )
44193      PORT_MODIFY("IN-1")
44194      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
44195      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
44196      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
44197      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
44198      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
44199      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
44200      PORT_MODIFY("IN-2")
44201      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
44202      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
44203      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44204      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44205      PORT_MODIFY("IN-3")
44206      // 0x0004 - "stk 4" // standard input (expected here)
44207      // 0x0008 - "stk 3" // standard input (expected here)
44208      // 0x0010 - "stk 2" // standard input (expected here)
44209      PORT_MODIFY("IN-4")
44210      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
44211      PORT_MODIFY("IN-5")
44212      // 0x0001 - "priz4" // standard input (expected here)
44213      // 0x0002 - "priz3" // standard input (expected here)
44214      // 0x0004 - "priz2" // standard input (expected here)
44215      // 0x0008 - "priz1" // standard input (expected here)
44216      PORT_MODIFY("IN-8")
44217      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
44218      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk swg")
44219      PORT_MODIFY("IN-16")
44220      // 0x0001 - "dil 1" // standard input (motherboard)
44221      // 0x0002 - "dil 2" // standard input (motherboard)
44222      // 0x0004 - "dil 3" // standard input (motherboard)
44223      // 0x0008 - "dil 4" // standard input (motherboard)
44224      // 0x0010 - "dil 5" // standard input (motherboard)
44225      // 0x0100 - "top up" // known extended input, usually 'top up'
44226      PORT_MODIFY("IN-17")
44227      // 0x0001 - "dil 6" // standard input (motherboard)
44228      // 0x0002 - "dil 7" // standard input (motherboard)
44229      // 0x0004 - "dil 8" // standard input (motherboard)
44230      // 0x0008 - "dil 9" // standard input (motherboard)
44231      // 0x0010 - "dil10" // standard input (motherboard)
44232      PORT_MODIFY("IN-18")
44233      // 0x0001 - "dil11" // standard input (motherboard)
44234      // 0x0002 - "dil12" // standard input (motherboard)
44235      // 0x0004 - "dil13" // standard input (motherboard)
44236      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
44237      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
44238      PORT_MODIFY("IN-19")
44239      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
44240      PORT_MODIFY("IN-20")
44241      // 0x0001 - "grnbut" // standard input (motherboard)
44242      // 0x0002 - "dorlok" // standard input (expected here)
44243      // 0x0004 - "topdor" // standard input (expected here)
44244      // 0x0008 - "botdor" // standard input (expected here)
44245      // 0x0010 - "hopdmp" // standard input (expected here)
4424644246INPUT_PORTS_END
4424744247
4424844248// PR1348 CLUB COPS AND ROBBERS GOLD         PR1348 CCRG SOUNDS11         COPS AND ROBBERS
r31373r31374
4429344293}
4429444294
4429544295INPUT_PORTS_START( sc4cfcla ) // this structure is generated
44296        PORT_INCLUDE( sc4_base )
44297        PORT_MODIFY("IN-1")
44298        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44299        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
44300        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
44301        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
44302        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
44303        // 0x0100 - "pndlow" // known extended input, usually 'hopper fit'
44304        PORT_MODIFY("IN-2")
44305        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44306        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44307        // 0x0100 - "10plow" // unexpected here
44308        PORT_MODIFY("IN-3")
44309        // 0x0004 - "stk 4" // standard input (expected here)
44310        // 0x0008 - "stk 3" // standard input (expected here)
44311        // 0x0010 - "stk 2" // standard input (expected here)
44312        PORT_MODIFY("IN-5")
44313        // 0x0001 - "priz4" // standard input (expected here)
44314        // 0x0002 - "priz3" // standard input (expected here)
44315        // 0x0004 - "priz2" // standard input (expected here)
44316        // 0x0008 - "priz1" // standard input (expected here)
44317        PORT_MODIFY("IN-6")
44318        // 0x0001 - "perc1" // standard input (expected here)
44319        // 0x0002 - "perc2" // standard input (expected here)
44320        // 0x0004 - "perc3" // standard input (expected here)
44321        // 0x0008 - "perc4" // standard input (expected here)
44322        PORT_MODIFY("IN-16")
44323        // 0x0001 - "dil 1" // standard input (motherboard)
44324        // 0x0002 - "dil 2" // standard input (motherboard)
44325        // 0x0004 - "dil 3" // standard input (motherboard)
44326        // 0x0008 - "dil 4" // standard input (motherboard)
44327        // 0x0010 - "dil 5" // standard input (motherboard)
44328        // 0x0100 - "htopup" // known extended input, usually 'top up'
44329        PORT_MODIFY("IN-17")
44330        // 0x0001 - "dil 6" // standard input (motherboard)
44331        // 0x0002 - "dil 7" // standard input (motherboard)
44332        // 0x0004 - "dil 8" // standard input (motherboard)
44333        // 0x0008 - "dil 9" // standard input (motherboard)
44334        // 0x0010 - "dil 10" // standard input (motherboard)
44335        PORT_MODIFY("IN-18")
44336        // 0x0001 - "dil 11" // standard input (motherboard)
44337        // 0x0002 - "dil 12" // standard input (motherboard)
44338        // 0x0004 - "dil 13" // standard input (motherboard)
44339        // 0x0008 - "dil 14" // standard input (motherboard)
44340        // 0x0010 - "dil 15" // standard input (motherboard)
44341        PORT_MODIFY("IN-19")
44342        // 0x0001 - "dil 16" // standard input (motherboard)
44343        PORT_MODIFY("IN-20")
44344        // 0x0001 - "grnbut" // standard input (motherboard)
44345        // 0x0002 - "dorlok" // standard input (expected here)
44346        // 0x0004 - "serdor" // standard input (expected here)
44347        // 0x0008 - "cshdor" // standard input (expected here)
44348        // 0x0010 - "hopdmp" // standard input (expected here)
44296      PORT_INCLUDE( sc4_base )
44297      PORT_MODIFY("IN-1")
44298      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44299      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
44300      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
44301      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
44302      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
44303      // 0x0100 - "pndlow" // known extended input, usually 'hopper fit'
44304      PORT_MODIFY("IN-2")
44305      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44306      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44307      // 0x0100 - "10plow" // unexpected here
44308      PORT_MODIFY("IN-3")
44309      // 0x0004 - "stk 4" // standard input (expected here)
44310      // 0x0008 - "stk 3" // standard input (expected here)
44311      // 0x0010 - "stk 2" // standard input (expected here)
44312      PORT_MODIFY("IN-5")
44313      // 0x0001 - "priz4" // standard input (expected here)
44314      // 0x0002 - "priz3" // standard input (expected here)
44315      // 0x0004 - "priz2" // standard input (expected here)
44316      // 0x0008 - "priz1" // standard input (expected here)
44317      PORT_MODIFY("IN-6")
44318      // 0x0001 - "perc1" // standard input (expected here)
44319      // 0x0002 - "perc2" // standard input (expected here)
44320      // 0x0004 - "perc3" // standard input (expected here)
44321      // 0x0008 - "perc4" // standard input (expected here)
44322      PORT_MODIFY("IN-16")
44323      // 0x0001 - "dil 1" // standard input (motherboard)
44324      // 0x0002 - "dil 2" // standard input (motherboard)
44325      // 0x0004 - "dil 3" // standard input (motherboard)
44326      // 0x0008 - "dil 4" // standard input (motherboard)
44327      // 0x0010 - "dil 5" // standard input (motherboard)
44328      // 0x0100 - "htopup" // known extended input, usually 'top up'
44329      PORT_MODIFY("IN-17")
44330      // 0x0001 - "dil 6" // standard input (motherboard)
44331      // 0x0002 - "dil 7" // standard input (motherboard)
44332      // 0x0004 - "dil 8" // standard input (motherboard)
44333      // 0x0008 - "dil 9" // standard input (motherboard)
44334      // 0x0010 - "dil 10" // standard input (motherboard)
44335      PORT_MODIFY("IN-18")
44336      // 0x0001 - "dil 11" // standard input (motherboard)
44337      // 0x0002 - "dil 12" // standard input (motherboard)
44338      // 0x0004 - "dil 13" // standard input (motherboard)
44339      // 0x0008 - "dil 14" // standard input (motherboard)
44340      // 0x0010 - "dil 15" // standard input (motherboard)
44341      PORT_MODIFY("IN-19")
44342      // 0x0001 - "dil 16" // standard input (motherboard)
44343      PORT_MODIFY("IN-20")
44344      // 0x0001 - "grnbut" // standard input (motherboard)
44345      // 0x0002 - "dorlok" // standard input (expected here)
44346      // 0x0004 - "serdor" // standard input (expected here)
44347      // 0x0008 - "cshdor" // standard input (expected here)
44348      // 0x0010 - "hopdmp" // standard input (expected here)
4434944349INPUT_PORTS_END
4435044350
4435144351// PR1396 CLASSIC CRAZY FRUITS         PR1396 CLSIC CRAZY FRUITS SND11
r31373r31374
4437344373}
4437444374
4437544375INPUT_PORTS_START( sc4cfdu ) // this structure is generated
44376        PORT_INCLUDE( sc4_base )
44377        PORT_MODIFY("IN-1")
44378        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44379        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
44380        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
44381        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
44382        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
44383        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
44384        PORT_MODIFY("IN-2")
44385        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
44386        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44387        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44388        PORT_MODIFY("IN-3")
44389        // 0x0004 - "stk 4" // standard input (expected here)
44390        // 0x0008 - "stk 3" // standard input (expected here)
44391        // 0x0010 - "stk 2" // standard input (expected here)
44392        PORT_MODIFY("IN-5")
44393        // 0x0001 - "priz4" // standard input (expected here)
44394        // 0x0002 - "priz3" // standard input (expected here)
44395        // 0x0004 - "priz2" // standard input (expected here)
44396        // 0x0008 - "priz1" // standard input (expected here)
44397        PORT_MODIFY("IN-6")
44398        // 0x0001 - "perc1" // standard input (expected here)
44399        // 0x0002 - "perc2" // standard input (expected here)
44400        // 0x0004 - "perc3" // standard input (expected here)
44401        // 0x0008 - "perc4" // standard input (expected here)
44402        PORT_MODIFY("IN-16")
44403        // 0x0001 - "dil 1" // standard input (motherboard)
44404        // 0x0002 - "dil 2" // standard input (motherboard)
44405        // 0x0004 - "dil 3" // standard input (motherboard)
44406        // 0x0008 - "dil 4" // standard input (motherboard)
44407        // 0x0010 - "dil 5" // standard input (motherboard)
44408        // 0x0100 - "top up" // known extended input, usually 'top up'
44409        PORT_MODIFY("IN-17")
44410        // 0x0001 - "dil 6" // standard input (motherboard)
44411        // 0x0002 - "dil 7" // standard input (motherboard)
44412        // 0x0004 - "dil 8" // standard input (motherboard)
44413        // 0x0008 - "dil 9" // standard input (motherboard)
44414        // 0x0010 - "dil10" // standard input (motherboard)
44415        PORT_MODIFY("IN-18")
44416        // 0x0001 - "dil11" // standard input (motherboard)
44417        // 0x0002 - "dil12" // standard input (motherboard)
44418        // 0x0004 - "dil13" // standard input (motherboard)
44419        // 0x0008 - "dil14" // standard input (motherboard)
44420        // 0x0010 - "dil15" // standard input (motherboard)
44421        PORT_MODIFY("IN-19")
44422        // 0x0001 - "dil16" // standard input (motherboard)
44423        PORT_MODIFY("IN-20")
44424        // 0x0001 - "grnbut" // standard input (motherboard)
44425        // 0x0002 - "dorlok" // standard input (expected here)
44426        // 0x0004 - "topdor" // standard input (expected here)
44427        // 0x0008 - "botdor" // standard input (expected here)
44428        // 0x0010 - "hopdmp" // standard input (expected here)
44376      PORT_INCLUDE( sc4_base )
44377      PORT_MODIFY("IN-1")
44378      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44379      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
44380      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
44381      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
44382      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
44383      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
44384      PORT_MODIFY("IN-2")
44385      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
44386      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44387      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44388      PORT_MODIFY("IN-3")
44389      // 0x0004 - "stk 4" // standard input (expected here)
44390      // 0x0008 - "stk 3" // standard input (expected here)
44391      // 0x0010 - "stk 2" // standard input (expected here)
44392      PORT_MODIFY("IN-5")
44393      // 0x0001 - "priz4" // standard input (expected here)
44394      // 0x0002 - "priz3" // standard input (expected here)
44395      // 0x0004 - "priz2" // standard input (expected here)
44396      // 0x0008 - "priz1" // standard input (expected here)
44397      PORT_MODIFY("IN-6")
44398      // 0x0001 - "perc1" // standard input (expected here)
44399      // 0x0002 - "perc2" // standard input (expected here)
44400      // 0x0004 - "perc3" // standard input (expected here)
44401      // 0x0008 - "perc4" // standard input (expected here)
44402      PORT_MODIFY("IN-16")
44403      // 0x0001 - "dil 1" // standard input (motherboard)
44404      // 0x0002 - "dil 2" // standard input (motherboard)
44405      // 0x0004 - "dil 3" // standard input (motherboard)
44406      // 0x0008 - "dil 4" // standard input (motherboard)
44407      // 0x0010 - "dil 5" // standard input (motherboard)
44408      // 0x0100 - "top up" // known extended input, usually 'top up'
44409      PORT_MODIFY("IN-17")
44410      // 0x0001 - "dil 6" // standard input (motherboard)
44411      // 0x0002 - "dil 7" // standard input (motherboard)
44412      // 0x0004 - "dil 8" // standard input (motherboard)
44413      // 0x0008 - "dil 9" // standard input (motherboard)
44414      // 0x0010 - "dil10" // standard input (motherboard)
44415      PORT_MODIFY("IN-18")
44416      // 0x0001 - "dil11" // standard input (motherboard)
44417      // 0x0002 - "dil12" // standard input (motherboard)
44418      // 0x0004 - "dil13" // standard input (motherboard)
44419      // 0x0008 - "dil14" // standard input (motherboard)
44420      // 0x0010 - "dil15" // standard input (motherboard)
44421      PORT_MODIFY("IN-19")
44422      // 0x0001 - "dil16" // standard input (motherboard)
44423      PORT_MODIFY("IN-20")
44424      // 0x0001 - "grnbut" // standard input (motherboard)
44425      // 0x0002 - "dorlok" // standard input (expected here)
44426      // 0x0004 - "topdor" // standard input (expected here)
44427      // 0x0008 - "botdor" // standard input (expected here)
44428      // 0x0010 - "hopdmp" // standard input (expected here)
4442944429INPUT_PORTS_END
4443044430
4443144431//  PR1107 CRAZY FRUITS DOWNUNDER         PR1107 DOWN UNDER SOUNDS11
r31373r31374
4445244452}
4445344453
4445444454INPUT_PORTS_START( sc4cfgcl ) // this structure is generated
44455        PORT_INCLUDE( sc4_base )
44456        PORT_MODIFY("IN-1")
44457        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
44458        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
44459        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
44460        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
44461        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
44462        PORT_MODIFY("IN-2")
44463        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
44464        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
44465        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
44466        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44467        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
44468        PORT_MODIFY("IN-3")
44469        // 0x0004 - "stk 4" // standard input (expected here)
44470        // 0x0008 - "stk 3" // standard input (expected here)
44471        // 0x0010 - "stk 2" // standard input (expected here)
44472        PORT_MODIFY("IN-4")
44473        // 0x0001 - "hop2lo" // unexpected here
44474        // 0x0002 - "hop1lo OR hop lo" // known extended(?) input, sometimes 'hop hi'
44475        PORT_MODIFY("IN-5")
44476        // 0x0001 - "priz4" // standard input (expected here)
44477        // 0x0002 - "priz3" // standard input (expected here)
44478        // 0x0004 - "priz2" // standard input (expected here)
44479        // 0x0008 - "priz1" // standard input (expected here)
44480        PORT_MODIFY("IN-8")
44481        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudges")
44482        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shots")
44483        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
44484        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spr mt")
44485        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("bell")
44486        PORT_MODIFY("IN-16")
44487        // 0x0001 - "dil 1" // standard input (motherboard)
44488        // 0x0002 - "dil 2" // standard input (motherboard)
44489        // 0x0004 - "dil 3" // standard input (motherboard)
44490        // 0x0008 - "dil 4" // standard input (motherboard)
44491        // 0x0010 - "dil 5" // standard input (motherboard)
44492        // 0x0100 - "top up" // known extended input, usually 'top up'
44493        PORT_MODIFY("IN-17")
44494        // 0x0001 - "dil 6" // standard input (motherboard)
44495        // 0x0002 - "dil 7" // standard input (motherboard)
44496        // 0x0004 - "dil 8" // standard input (motherboard)
44497        // 0x0008 - "dil 9" // standard input (motherboard)
44498        // 0x0010 - "dil10" // standard input (motherboard)
44499        PORT_MODIFY("IN-18")
44500        // 0x0001 - "dil11" // standard input (motherboard)
44501        // 0x0002 - "dil12" // standard input (motherboard)
44502        // 0x0004 - "dil13" // standard input (motherboard)
44503        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
44504        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
44505        PORT_MODIFY("IN-19")
44506        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
44507        PORT_MODIFY("IN-20")
44508        // 0x0001 - "grnbut" // standard input (motherboard)
44509        // 0x0002 - "dorlok" // standard input (expected here)
44510        // 0x0004 - "topdor" // standard input (expected here)
44511        // 0x0008 - "botdor" // standard input (expected here)
44512        // 0x0010 - "hopdmp" // standard input (expected here)
44455      PORT_INCLUDE( sc4_base )
44456      PORT_MODIFY("IN-1")
44457      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
44458      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
44459      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
44460      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
44461      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
44462      PORT_MODIFY("IN-2")
44463      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
44464      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
44465      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
44466      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44467      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
44468      PORT_MODIFY("IN-3")
44469      // 0x0004 - "stk 4" // standard input (expected here)
44470      // 0x0008 - "stk 3" // standard input (expected here)
44471      // 0x0010 - "stk 2" // standard input (expected here)
44472      PORT_MODIFY("IN-4")
44473      // 0x0001 - "hop2lo" // unexpected here
44474      // 0x0002 - "hop1lo OR hop lo" // known extended(?) input, sometimes 'hop hi'
44475      PORT_MODIFY("IN-5")
44476      // 0x0001 - "priz4" // standard input (expected here)
44477      // 0x0002 - "priz3" // standard input (expected here)
44478      // 0x0004 - "priz2" // standard input (expected here)
44479      // 0x0008 - "priz1" // standard input (expected here)
44480      PORT_MODIFY("IN-8")
44481      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudges")
44482      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shots")
44483      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
44484      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spr mt")
44485      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("bell")
44486      PORT_MODIFY("IN-16")
44487      // 0x0001 - "dil 1" // standard input (motherboard)
44488      // 0x0002 - "dil 2" // standard input (motherboard)
44489      // 0x0004 - "dil 3" // standard input (motherboard)
44490      // 0x0008 - "dil 4" // standard input (motherboard)
44491      // 0x0010 - "dil 5" // standard input (motherboard)
44492      // 0x0100 - "top up" // known extended input, usually 'top up'
44493      PORT_MODIFY("IN-17")
44494      // 0x0001 - "dil 6" // standard input (motherboard)
44495      // 0x0002 - "dil 7" // standard input (motherboard)
44496      // 0x0004 - "dil 8" // standard input (motherboard)
44497      // 0x0008 - "dil 9" // standard input (motherboard)
44498      // 0x0010 - "dil10" // standard input (motherboard)
44499      PORT_MODIFY("IN-18")
44500      // 0x0001 - "dil11" // standard input (motherboard)
44501      // 0x0002 - "dil12" // standard input (motherboard)
44502      // 0x0004 - "dil13" // standard input (motherboard)
44503      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
44504      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
44505      PORT_MODIFY("IN-19")
44506      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
44507      PORT_MODIFY("IN-20")
44508      // 0x0001 - "grnbut" // standard input (motherboard)
44509      // 0x0002 - "dorlok" // standard input (expected here)
44510      // 0x0004 - "topdor" // standard input (expected here)
44511      // 0x0008 - "botdor" // standard input (expected here)
44512      // 0x0010 - "hopdmp" // standard input (expected here)
4451344513INPUT_PORTS_END
4451444514
4451544515// PR1620 CLUB CRAZY FRUITS GOLD         PR1620 CRAZY SOUNDS11         CRAZY FRUITS  CLUB
r31373r31374
4453644536}
4453744537
4453844538INPUT_PORTS_START( sc4derby ) // this structure is generated
44539        PORT_INCLUDE( sc4_base )
44540        PORT_MODIFY("IN-1")
44541        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44542        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
44543        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
44544        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
44545        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
44546        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
44547        PORT_MODIFY("IN-2")
44548        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
44549        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44550        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44551        PORT_MODIFY("IN-3")
44552        // 0x0004 - "stk 4" // standard input (expected here)
44553        // 0x0008 - "stk 3" // standard input (expected here)
44554        // 0x0010 - "stk 2" // standard input (expected here)
44555        PORT_MODIFY("IN-5")
44556        // 0x0001 - "priz4" // standard input (expected here)
44557        // 0x0002 - "priz3" // standard input (expected here)
44558        // 0x0004 - "priz2" // standard input (expected here)
44559        // 0x0008 - "priz1" // standard input (expected here)
44560        PORT_MODIFY("IN-6")
44561        // 0x0001 - "perc1" // standard input (expected here)
44562        // 0x0002 - "perc2" // standard input (expected here)
44563        // 0x0004 - "perc3" // standard input (expected here)
44564        // 0x0008 - "perc4" // standard input (expected here)
44565        PORT_MODIFY("IN-8")
44566        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk prz")
44567        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
44568        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mat")
44569        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fea")
44570        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
44571        PORT_MODIFY("IN-16")
44572        // 0x0001 - "dil 1" // standard input (motherboard)
44573        // 0x0002 - "dil 2" // standard input (motherboard)
44574        // 0x0004 - "dil 3" // standard input (motherboard)
44575        // 0x0008 - "dil 4" // standard input (motherboard)
44576        // 0x0010 - "dil 5" // standard input (motherboard)
44577        // 0x0100 - "top up" // known extended input, usually 'top up'
44578        PORT_MODIFY("IN-17")
44579        // 0x0001 - "dil 6" // standard input (motherboard)
44580        // 0x0002 - "dil 7" // standard input (motherboard)
44581        // 0x0004 - "dil 8" // standard input (motherboard)
44582        // 0x0008 - "dil 9" // standard input (motherboard)
44583        // 0x0010 - "dil10" // standard input (motherboard)
44584        PORT_MODIFY("IN-18")
44585        // 0x0001 - "dil11" // standard input (motherboard)
44586        // 0x0002 - "dil12" // standard input (motherboard)
44587        // 0x0004 - "dil13" // standard input (motherboard)
44588        // 0x0008 - "dil14" // standard input (motherboard)
44589        // 0x0010 - "dil15" // standard input (motherboard)
44590        PORT_MODIFY("IN-19")
44591        // 0x0001 - "dil16" // standard input (motherboard)
44592        PORT_MODIFY("IN-20")
44593        // 0x0001 - "grnbut" // standard input (motherboard)
44594        // 0x0002 - "dorlok" // standard input (expected here)
44595        // 0x0004 - "topdor" // standard input (expected here)
44596        // 0x0008 - "botdor" // standard input (expected here)
44597        // 0x0010 - "hopdmp" // standard input (expected here)
44539      PORT_INCLUDE( sc4_base )
44540      PORT_MODIFY("IN-1")
44541      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44542      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
44543      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
44544      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
44545      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
44546      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
44547      PORT_MODIFY("IN-2")
44548      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
44549      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44550      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44551      PORT_MODIFY("IN-3")
44552      // 0x0004 - "stk 4" // standard input (expected here)
44553      // 0x0008 - "stk 3" // standard input (expected here)
44554      // 0x0010 - "stk 2" // standard input (expected here)
44555      PORT_MODIFY("IN-5")
44556      // 0x0001 - "priz4" // standard input (expected here)
44557      // 0x0002 - "priz3" // standard input (expected here)
44558      // 0x0004 - "priz2" // standard input (expected here)
44559      // 0x0008 - "priz1" // standard input (expected here)
44560      PORT_MODIFY("IN-6")
44561      // 0x0001 - "perc1" // standard input (expected here)
44562      // 0x0002 - "perc2" // standard input (expected here)
44563      // 0x0004 - "perc3" // standard input (expected here)
44564      // 0x0008 - "perc4" // standard input (expected here)
44565      PORT_MODIFY("IN-8")
44566      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk prz")
44567      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
44568      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk mat")
44569      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fea")
44570      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
44571      PORT_MODIFY("IN-16")
44572      // 0x0001 - "dil 1" // standard input (motherboard)
44573      // 0x0002 - "dil 2" // standard input (motherboard)
44574      // 0x0004 - "dil 3" // standard input (motherboard)
44575      // 0x0008 - "dil 4" // standard input (motherboard)
44576      // 0x0010 - "dil 5" // standard input (motherboard)
44577      // 0x0100 - "top up" // known extended input, usually 'top up'
44578      PORT_MODIFY("IN-17")
44579      // 0x0001 - "dil 6" // standard input (motherboard)
44580      // 0x0002 - "dil 7" // standard input (motherboard)
44581      // 0x0004 - "dil 8" // standard input (motherboard)
44582      // 0x0008 - "dil 9" // standard input (motherboard)
44583      // 0x0010 - "dil10" // standard input (motherboard)
44584      PORT_MODIFY("IN-18")
44585      // 0x0001 - "dil11" // standard input (motherboard)
44586      // 0x0002 - "dil12" // standard input (motherboard)
44587      // 0x0004 - "dil13" // standard input (motherboard)
44588      // 0x0008 - "dil14" // standard input (motherboard)
44589      // 0x0010 - "dil15" // standard input (motherboard)
44590      PORT_MODIFY("IN-19")
44591      // 0x0001 - "dil16" // standard input (motherboard)
44592      PORT_MODIFY("IN-20")
44593      // 0x0001 - "grnbut" // standard input (motherboard)
44594      // 0x0002 - "dorlok" // standard input (expected here)
44595      // 0x0004 - "topdor" // standard input (expected here)
44596      // 0x0008 - "botdor" // standard input (expected here)
44597      // 0x0010 - "hopdmp" // standard input (expected here)
4459844598INPUT_PORTS_END
4459944599
4460044600// PR1006  DEMOLITION DERBY         PR1006 DEMDERBY SOUNDS11
r31373r31374
4460644606GAMEL( 200?, sc4derbye   ,sc4derby,  sc4, sc4derby, sc4_state, sc4derby, ROT0, "BFM","Demolition Derby (Bellfruit) (Scorpion 4) (set 6)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4460744607
4460844608INPUT_PORTS_START( sc4dbldm ) // this structure is generated
44609        PORT_INCLUDE( sc4_base )
44610        PORT_MODIFY("IN-1")
44611        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44612        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("btn 2")
44613        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("btn 3")
44614        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("btn 4")
44615        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("btn 5")
44616        PORT_MODIFY("IN-2")
44617        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("max")
44618        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44619        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44620        PORT_MODIFY("IN-8")
44621        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bet2")
44622        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("bet1")
44623        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("bet3")
44624        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("bet5")
44625        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("bet4")
44626        PORT_MODIFY("IN-9")
44627        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("bet6")
44628        PORT_MODIFY("IN-16")
44629        // 0x0001 - "dil  1" // standard input (motherboard)
44630        // 0x0002 - "dil  2" // standard input (motherboard)
44631        // 0x0004 - "dil  3" // standard input (motherboard)
44632        // 0x0008 - "dil  4" // standard input (motherboard)
44633        // 0x0010 - "dil  5" // standard input (motherboard)
44634        // 0x0100 - "topup" // known extended input, usually 'top up'
44635        PORT_MODIFY("IN-17")
44636        // 0x0001 - "dil  6" // standard input (motherboard)
44637        // 0x0002 - "dil  7" // standard input (motherboard)
44638        // 0x0004 - "dil  8" // standard input (motherboard)
44639        // 0x0008 - "dil  9" // standard input (motherboard)
44640        // 0x0010 - "dil 10" // standard input (motherboard)
44641        PORT_MODIFY("IN-18")
44642        // 0x0001 - "dil 11" // standard input (motherboard)
44643        // 0x0002 - "dil 12" // standard input (motherboard)
44644        // 0x0004 - "dil 13" // standard input (motherboard)
44645        // 0x0008 - "dil 14" // standard input (motherboard)
44646        // 0x0010 - "dil 15" // standard input (motherboard)
44647        PORT_MODIFY("IN-19")
44648        // 0x0001 - "dil 16" // standard input (motherboard)
44649        PORT_MODIFY("IN-20")
44650        // 0x0001 - "test" // standard input (motherboard)
44651        // 0x0002 - "lock" // standard input (expected here)
44652        // 0x0004 - "topdor" // standard input (expected here)
44653        // 0x0008 - "botdor" // standard input (expected here)
44654        // 0x0010 - "hopdmp" // standard input (expected here)
44609      PORT_INCLUDE( sc4_base )
44610      PORT_MODIFY("IN-1")
44611      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44612      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("btn 2")
44613      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("btn 3")
44614      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("btn 4")
44615      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("btn 5")
44616      PORT_MODIFY("IN-2")
44617      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("max")
44618      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44619      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44620      PORT_MODIFY("IN-8")
44621      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bet2")
44622      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("bet1")
44623      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("bet3")
44624      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("bet5")
44625      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("bet4")
44626      PORT_MODIFY("IN-9")
44627      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("bet6")
44628      PORT_MODIFY("IN-16")
44629      // 0x0001 - "dil  1" // standard input (motherboard)
44630      // 0x0002 - "dil  2" // standard input (motherboard)
44631      // 0x0004 - "dil  3" // standard input (motherboard)
44632      // 0x0008 - "dil  4" // standard input (motherboard)
44633      // 0x0010 - "dil  5" // standard input (motherboard)
44634      // 0x0100 - "topup" // known extended input, usually 'top up'
44635      PORT_MODIFY("IN-17")
44636      // 0x0001 - "dil  6" // standard input (motherboard)
44637      // 0x0002 - "dil  7" // standard input (motherboard)
44638      // 0x0004 - "dil  8" // standard input (motherboard)
44639      // 0x0008 - "dil  9" // standard input (motherboard)
44640      // 0x0010 - "dil 10" // standard input (motherboard)
44641      PORT_MODIFY("IN-18")
44642      // 0x0001 - "dil 11" // standard input (motherboard)
44643      // 0x0002 - "dil 12" // standard input (motherboard)
44644      // 0x0004 - "dil 13" // standard input (motherboard)
44645      // 0x0008 - "dil 14" // standard input (motherboard)
44646      // 0x0010 - "dil 15" // standard input (motherboard)
44647      PORT_MODIFY("IN-19")
44648      // 0x0001 - "dil 16" // standard input (motherboard)
44649      PORT_MODIFY("IN-20")
44650      // 0x0001 - "test" // standard input (motherboard)
44651      // 0x0002 - "lock" // standard input (expected here)
44652      // 0x0004 - "topdor" // standard input (expected here)
44653      // 0x0008 - "botdor" // standard input (expected here)
44654      // 0x0010 - "hopdmp" // standard input (expected here)
4465544655INPUT_PORTS_END
4465644656
4465744657// PR2558 DOUBLE DIAMOND 011         DOUBLEDIAMONDSND          DOUBLE DIAMOND
4465844658GAMEL( 200?, sc4dbldm    ,0,         sc4, sc4dbldm, sc4_state, sc4, ROT0, "Qps","Double Diamond (Qps) (Scorpion 4)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4465944659
4466044660INPUT_PORTS_START( sc4dyna ) // this structure is generated
44661        PORT_INCLUDE( sc4_base )
44662        PORT_MODIFY("IN-1")
44663        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44664        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
44665        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
44666        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
44667        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
44668        PORT_MODIFY("IN-2")
44669        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
44670        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44671        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44672        PORT_MODIFY("IN-8")
44673        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
44674        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
44675        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("blast")
44676        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk skl")
44677        PORT_MODIFY("IN-16")
44678        // 0x0001 - "dils 1" // standard input (motherboard)
44679        // 0x0002 - "dils 2" // standard input (motherboard)
44680        // 0x0004 - "dils 3" // standard input (motherboard)
44681        // 0x0008 - "dils 4" // standard input (motherboard)
44682        // 0x0010 - "dils 5" // standard input (motherboard)
44683        PORT_MODIFY("IN-17")
44684        // 0x0001 - "dils 6" // standard input (motherboard)
44685        // 0x0002 - "dils 7" // standard input (motherboard)
44686        // 0x0004 - "dils 8" // standard input (motherboard)
44687        // 0x0008 - "dils 9" // standard input (motherboard)
44688        // 0x0010 - "dils10" // standard input (motherboard)
44689        PORT_MODIFY("IN-18")
44690        // 0x0001 - "dils11" // standard input (motherboard)
44691        // 0x0002 - "dils12" // standard input (motherboard)
44692        // 0x0004 - "dils13" // standard input (motherboard)
44693        // 0x0008 - "dils14" // standard input (motherboard)
44694        // 0x0010 - "dils15" // standard input (motherboard)
44695        PORT_MODIFY("IN-19")
44696        // 0x0001 - "dils16" // standard input (motherboard)
44697        PORT_MODIFY("IN-20")
44698        // 0x0001 - "grnbut" // standard input (motherboard)
44699        // 0x0002 - "dorlok" // standard input (expected here)
44700        // 0x0004 - "topdor" // standard input (expected here)
44701        // 0x0008 - "botdor" // standard input (expected here)
44661      PORT_INCLUDE( sc4_base )
44662      PORT_MODIFY("IN-1")
44663      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44664      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
44665      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
44666      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
44667      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
44668      PORT_MODIFY("IN-2")
44669      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
44670      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44671      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44672      PORT_MODIFY("IN-8")
44673      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
44674      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk bon")
44675      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("blast")
44676      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk skl")
44677      PORT_MODIFY("IN-16")
44678      // 0x0001 - "dils 1" // standard input (motherboard)
44679      // 0x0002 - "dils 2" // standard input (motherboard)
44680      // 0x0004 - "dils 3" // standard input (motherboard)
44681      // 0x0008 - "dils 4" // standard input (motherboard)
44682      // 0x0010 - "dils 5" // standard input (motherboard)
44683      PORT_MODIFY("IN-17")
44684      // 0x0001 - "dils 6" // standard input (motherboard)
44685      // 0x0002 - "dils 7" // standard input (motherboard)
44686      // 0x0004 - "dils 8" // standard input (motherboard)
44687      // 0x0008 - "dils 9" // standard input (motherboard)
44688      // 0x0010 - "dils10" // standard input (motherboard)
44689      PORT_MODIFY("IN-18")
44690      // 0x0001 - "dils11" // standard input (motherboard)
44691      // 0x0002 - "dils12" // standard input (motherboard)
44692      // 0x0004 - "dils13" // standard input (motherboard)
44693      // 0x0008 - "dils14" // standard input (motherboard)
44694      // 0x0010 - "dils15" // standard input (motherboard)
44695      PORT_MODIFY("IN-19")
44696      // 0x0001 - "dils16" // standard input (motherboard)
44697      PORT_MODIFY("IN-20")
44698      // 0x0001 - "grnbut" // standard input (motherboard)
44699      // 0x0002 - "dorlok" // standard input (expected here)
44700      // 0x0004 - "topdor" // standard input (expected here)
44701      // 0x0008 - "botdor" // standard input (expected here)
4470244702INPUT_PORTS_END
4470344703
4470444704// PR1104 DYNAMITE         PR1104 DYNAMITE SOUNDS11
r31373r31374
4470644706GAMEL( 200?, sc4dynaa    ,sc4dyna,   sc4, sc4dyna, sc4_state, sc4, ROT0, "BFM","Dynamite (Bellfruit) (Scorpion 4) (set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4470744707
4470844708INPUT_PORTS_START( sc4easy ) // this structure is generated
44709        PORT_INCLUDE( sc4_base )
44710        PORT_MODIFY("IN-1")
44711        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44712        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
44713        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
44714        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
44715        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
44716        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
44717        PORT_MODIFY("IN-2")
44718        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
44719        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44720        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44721        PORT_MODIFY("IN-3")
44722        // 0x0004 - "stk 4" // standard input (expected here)
44723        // 0x0008 - "stk 3" // standard input (expected here)
44724        // 0x0010 - "stk 2" // standard input (expected here)
44725        PORT_MODIFY("IN-4")
44726        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
44727        PORT_MODIFY("IN-5")
44728        // 0x0001 - "priz4" // standard input (expected here)
44729        // 0x0002 - "priz3" // standard input (expected here)
44730        // 0x0004 - "priz2" // standard input (expected here)
44731        // 0x0008 - "priz1" // standard input (expected here)
44732        PORT_MODIFY("IN-6")
44733        // 0x0001 - "perc1" // standard input (expected here)
44734        // 0x0002 - "perc2" // standard input (expected here)
44735        // 0x0004 - "perc3" // standard input (expected here)
44736        // 0x0008 - "perc4" // standard input (expected here)
44737        PORT_MODIFY("IN-8")
44738        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
44739        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
44740        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("shoot")
44741        PORT_MODIFY("IN-16")
44742        // 0x0001 - "dil 1" // standard input (motherboard)
44743        // 0x0002 - "dil 2" // standard input (motherboard)
44744        // 0x0004 - "dil 3" // standard input (motherboard)
44745        // 0x0008 - "dil 4" // standard input (motherboard)
44746        // 0x0010 - "dil 5" // standard input (motherboard)
44747        // 0x0100 - "htopup" // known extended input, usually 'top up'
44748        PORT_MODIFY("IN-17")
44749        // 0x0001 - "dil 6" // standard input (motherboard)
44750        // 0x0002 - "dil 7" // standard input (motherboard)
44751        // 0x0004 - "dil 8" // standard input (motherboard)
44752        // 0x0008 - "dil 9" // standard input (motherboard)
44753        // 0x0010 - "dil 10" // standard input (motherboard)
44754        PORT_MODIFY("IN-18")
44755        // 0x0001 - "dil 11" // standard input (motherboard)
44756        // 0x0002 - "dil 12" // standard input (motherboard)
44757        // 0x0004 - "dil 13" // standard input (motherboard)
44758        // 0x0008 - "dil 14" // standard input (motherboard)
44759        // 0x0010 - "dil 15" // standard input (motherboard)
44760        PORT_MODIFY("IN-19")
44761        // 0x0001 - "dil 16" // standard input (motherboard)
44762        PORT_MODIFY("IN-20")
44763        // 0x0001 - "grnbut" // standard input (motherboard)
44764        // 0x0002 - "dorlok" // standard input (expected here)
44765        // 0x0004 - "serdor" // standard input (expected here)
44766        // 0x0008 - "cshdor" // standard input (expected here)
44767        // 0x0010 - "hopdmp" // standard input (expected here)
44709      PORT_INCLUDE( sc4_base )
44710      PORT_MODIFY("IN-1")
44711      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44712      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
44713      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
44714      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
44715      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
44716      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
44717      PORT_MODIFY("IN-2")
44718      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
44719      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44720      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44721      PORT_MODIFY("IN-3")
44722      // 0x0004 - "stk 4" // standard input (expected here)
44723      // 0x0008 - "stk 3" // standard input (expected here)
44724      // 0x0010 - "stk 2" // standard input (expected here)
44725      PORT_MODIFY("IN-4")
44726      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
44727      PORT_MODIFY("IN-5")
44728      // 0x0001 - "priz4" // standard input (expected here)
44729      // 0x0002 - "priz3" // standard input (expected here)
44730      // 0x0004 - "priz2" // standard input (expected here)
44731      // 0x0008 - "priz1" // standard input (expected here)
44732      PORT_MODIFY("IN-6")
44733      // 0x0001 - "perc1" // standard input (expected here)
44734      // 0x0002 - "perc2" // standard input (expected here)
44735      // 0x0004 - "perc3" // standard input (expected here)
44736      // 0x0008 - "perc4" // standard input (expected here)
44737      PORT_MODIFY("IN-8")
44738      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk csh")
44739      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("step")
44740      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("shoot")
44741      PORT_MODIFY("IN-16")
44742      // 0x0001 - "dil 1" // standard input (motherboard)
44743      // 0x0002 - "dil 2" // standard input (motherboard)
44744      // 0x0004 - "dil 3" // standard input (motherboard)
44745      // 0x0008 - "dil 4" // standard input (motherboard)
44746      // 0x0010 - "dil 5" // standard input (motherboard)
44747      // 0x0100 - "htopup" // known extended input, usually 'top up'
44748      PORT_MODIFY("IN-17")
44749      // 0x0001 - "dil 6" // standard input (motherboard)
44750      // 0x0002 - "dil 7" // standard input (motherboard)
44751      // 0x0004 - "dil 8" // standard input (motherboard)
44752      // 0x0008 - "dil 9" // standard input (motherboard)
44753      // 0x0010 - "dil 10" // standard input (motherboard)
44754      PORT_MODIFY("IN-18")
44755      // 0x0001 - "dil 11" // standard input (motherboard)
44756      // 0x0002 - "dil 12" // standard input (motherboard)
44757      // 0x0004 - "dil 13" // standard input (motherboard)
44758      // 0x0008 - "dil 14" // standard input (motherboard)
44759      // 0x0010 - "dil 15" // standard input (motherboard)
44760      PORT_MODIFY("IN-19")
44761      // 0x0001 - "dil 16" // standard input (motherboard)
44762      PORT_MODIFY("IN-20")
44763      // 0x0001 - "grnbut" // standard input (motherboard)
44764      // 0x0002 - "dorlok" // standard input (expected here)
44765      // 0x0004 - "serdor" // standard input (expected here)
44766      // 0x0008 - "cshdor" // standard input (expected here)
44767      // 0x0010 - "hopdmp" // standard input (expected here)
4476844768INPUT_PORTS_END
4476944769
4477044770// PR1017 EASY STREAK         PR1017 EASY STREAK SOUNDS11           EASY STREAK
r31373r31374
4477744777GAMEL( 200?, sc4easyf    ,sc4easy,   sc4, sc4easy, sc4_state, sc4, ROT0, "BFM","Easy Streak (Bellfruit) (Scorpion 4) (set 11)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4477844778
4477944779INPUT_PORTS_START( sc4clbmn ) // this structure is generated
44780        PORT_INCLUDE( sc4_base )
44781        PORT_MODIFY("IN-1")
44782        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44783        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
44784        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
44785        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
44786        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
44787        // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
44788        PORT_MODIFY("IN-2")
44789        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake")
44790        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("takfet")
44791        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("trnsfr")
44792        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44793        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
44794        PORT_MODIFY("IN-3")
44795        // 0x0004 - "stk 4" // standard input (expected here)
44796        // 0x0008 - "stk 3" // standard input (expected here)
44797        // 0x0010 - "stk 2" // standard input (expected here)
44798        PORT_MODIFY("IN-4")
44799        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
44800        PORT_MODIFY("IN-5")
44801        // 0x0001 - "priz4" // standard input (expected here)
44802        // 0x0002 - "priz3" // standard input (expected here)
44803        // 0x0004 - "priz2" // standard input (expected here)
44804        // 0x0008 - "priz1" // standard input (expected here)
44805        PORT_MODIFY("IN-8")
44806        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("sneakp")
44807        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("gamfet")
44808        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("gambon")
44809        PORT_MODIFY("IN-16")
44810        // 0x0001 - "dil 1" // standard input (motherboard)
44811        // 0x0002 - "dil 2" // standard input (motherboard)
44812        // 0x0004 - "dil 3" // standard input (motherboard)
44813        // 0x0008 - "dil 4" // standard input (motherboard)
44814        // 0x0010 - "dil 5" // standard input (motherboard)
44815        // 0x0100 - "top up" // known extended input, usually 'top up'
44816        PORT_MODIFY("IN-17")
44817        // 0x0001 - "dil 6" // standard input (motherboard)
44818        // 0x0002 - "dil 7" // standard input (motherboard)
44819        // 0x0004 - "dil 8" // standard input (motherboard)
44820        // 0x0008 - "dil 9" // standard input (motherboard)
44821        // 0x0010 - "dil10" // standard input (motherboard)
44822        PORT_MODIFY("IN-18")
44823        // 0x0001 - "dil11" // standard input (motherboard)
44824        // 0x0002 - "dil12" // standard input (motherboard)
44825        // 0x0004 - "dil13" // standard input (motherboard)
44826        // 0x0008 - "dil14" // standard input (motherboard)
44827        // 0x0010 - "dil15" // standard input (motherboard)
44828        PORT_MODIFY("IN-19")
44829        // 0x0001 - "dil16" // standard input (motherboard)
44830        PORT_MODIFY("IN-20")
44831        // 0x0001 - "grnbut" // standard input (motherboard)
44832        // 0x0002 - "dorlok" // standard input (expected here)
44833        // 0x0004 - "topdor" // standard input (expected here)
44834        // 0x0008 - "botdor" // standard input (expected here)
44835        // 0x0010 - "hopdmp" // standard input (expected here)
44780      PORT_INCLUDE( sc4_base )
44781      PORT_MODIFY("IN-1")
44782      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44783      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
44784      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
44785      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
44786      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
44787      // 0x0100 - "hopfit" // known extended input, usually 'hopper fit'
44788      PORT_MODIFY("IN-2")
44789      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake")
44790      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("takfet")
44791      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("trnsfr")
44792      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44793      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
44794      PORT_MODIFY("IN-3")
44795      // 0x0004 - "stk 4" // standard input (expected here)
44796      // 0x0008 - "stk 3" // standard input (expected here)
44797      // 0x0010 - "stk 2" // standard input (expected here)
44798      PORT_MODIFY("IN-4")
44799      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
44800      PORT_MODIFY("IN-5")
44801      // 0x0001 - "priz4" // standard input (expected here)
44802      // 0x0002 - "priz3" // standard input (expected here)
44803      // 0x0004 - "priz2" // standard input (expected here)
44804      // 0x0008 - "priz1" // standard input (expected here)
44805      PORT_MODIFY("IN-8")
44806      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("sneakp")
44807      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("gamfet")
44808      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("gambon")
44809      PORT_MODIFY("IN-16")
44810      // 0x0001 - "dil 1" // standard input (motherboard)
44811      // 0x0002 - "dil 2" // standard input (motherboard)
44812      // 0x0004 - "dil 3" // standard input (motherboard)
44813      // 0x0008 - "dil 4" // standard input (motherboard)
44814      // 0x0010 - "dil 5" // standard input (motherboard)
44815      // 0x0100 - "top up" // known extended input, usually 'top up'
44816      PORT_MODIFY("IN-17")
44817      // 0x0001 - "dil 6" // standard input (motherboard)
44818      // 0x0002 - "dil 7" // standard input (motherboard)
44819      // 0x0004 - "dil 8" // standard input (motherboard)
44820      // 0x0008 - "dil 9" // standard input (motherboard)
44821      // 0x0010 - "dil10" // standard input (motherboard)
44822      PORT_MODIFY("IN-18")
44823      // 0x0001 - "dil11" // standard input (motherboard)
44824      // 0x0002 - "dil12" // standard input (motherboard)
44825      // 0x0004 - "dil13" // standard input (motherboard)
44826      // 0x0008 - "dil14" // standard input (motherboard)
44827      // 0x0010 - "dil15" // standard input (motherboard)
44828      PORT_MODIFY("IN-19")
44829      // 0x0001 - "dil16" // standard input (motherboard)
44830      PORT_MODIFY("IN-20")
44831      // 0x0001 - "grnbut" // standard input (motherboard)
44832      // 0x0002 - "dorlok" // standard input (expected here)
44833      // 0x0004 - "topdor" // standard input (expected here)
44834      // 0x0008 - "botdor" // standard input (expected here)
44835      // 0x0010 - "hopdmp" // standard input (expected here)
4483644836INPUT_PORTS_END
4483744837
4483844838//PROJECT NUMBER PR1955 CLUB MONEYBAGS         MONEY BAGS  CLUB  PR1955 C M MONEYBAGS SOUNDS11       DEAL OR NO DEAL   5-10-20   10-20-30   20-30-50  30-50-100
r31373r31374
4485944859}
4486044860
4486144861INPUT_PORTS_START( sc4boomb ) // this structure is generated
44862        PORT_INCLUDE( sc4_base )
44863        PORT_MODIFY("IN-1")
44864        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44865        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
44866        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
44867        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
44868        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
44869        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
44870        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
44871        PORT_MODIFY("IN-2")
44872        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
44873        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
44874        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44875        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44876        PORT_MODIFY("IN-3")
44877        // 0x0004 - "stk 4" // standard input (expected here)
44878        // 0x0008 - "stk 3" // standard input (expected here)
44879        // 0x0010 - "stk 2" // standard input (expected here)
44880        PORT_MODIFY("IN-5")
44881        // 0x0001 - "priz4" // standard input (expected here)
44882        // 0x0002 - "priz3" // standard input (expected here)
44883        // 0x0004 - "priz2" // standard input (expected here)
44884        // 0x0008 - "priz1" // standard input (expected here)
44885        PORT_MODIFY("IN-6")
44886        // 0x0001 - "perc1" // standard input (expected here)
44887        // 0x0002 - "perc2" // standard input (expected here)
44888        // 0x0004 - "perc3" // standard input (expected here)
44889        // 0x0008 - "perc4" // standard input (expected here)
44890        PORT_MODIFY("IN-8")
44891        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("auctio")
44892        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("leave")
44893        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("take")
44894        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c or b")
44895        PORT_MODIFY("IN-16")
44896        // 0x0001 - "dil1" // standard input (motherboard)
44897        // 0x0002 - "dil2" // standard input (motherboard)
44898        // 0x0004 - "dil3" // standard input (motherboard)
44899        // 0x0008 - "dil4" // standard input (motherboard)
44900        // 0x0010 - "dil5" // standard input (motherboard)
44901        // 0x0100 - "top up" // known extended input, usually 'top up'
44902        PORT_MODIFY("IN-17")
44903        // 0x0001 - "dil6" // standard input (motherboard)
44904        // 0x0002 - "dil7" // standard input (motherboard)
44905        // 0x0004 - "dil8" // standard input (motherboard)
44906        // 0x0008 - "dil9" // standard input (motherboard)
44907        // 0x0010 - "dil10" // standard input (motherboard)
44908        PORT_MODIFY("IN-18")
44909        // 0x0001 - "dil11" // standard input (motherboard)
44910        // 0x0002 - "dil12" // standard input (motherboard)
44911        // 0x0004 - "dil13" // standard input (motherboard)
44912        // 0x0008 - "dil14" // standard input (motherboard)
44913        // 0x0010 - "dil15" // standard input (motherboard)
44914        PORT_MODIFY("IN-19")
44915        // 0x0001 - "dil16" // standard input (motherboard)
44916        PORT_MODIFY("IN-20")
44917        // 0x0001 - "grnbut" // standard input (motherboard)
44918        // 0x0002 - "dorlok" // standard input (expected here)
44919        // 0x0004 - "serdor" // standard input (expected here)
44920        // 0x0008 - "cshdor" // standard input (expected here)
44921        // 0x0010 - "hopdmp" // standard input (expected here)
44862      PORT_INCLUDE( sc4_base )
44863      PORT_MODIFY("IN-1")
44864      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44865      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
44866      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
44867      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
44868      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
44869      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
44870      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
44871      PORT_MODIFY("IN-2")
44872      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
44873      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
44874      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44875      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44876      PORT_MODIFY("IN-3")
44877      // 0x0004 - "stk 4" // standard input (expected here)
44878      // 0x0008 - "stk 3" // standard input (expected here)
44879      // 0x0010 - "stk 2" // standard input (expected here)
44880      PORT_MODIFY("IN-5")
44881      // 0x0001 - "priz4" // standard input (expected here)
44882      // 0x0002 - "priz3" // standard input (expected here)
44883      // 0x0004 - "priz2" // standard input (expected here)
44884      // 0x0008 - "priz1" // standard input (expected here)
44885      PORT_MODIFY("IN-6")
44886      // 0x0001 - "perc1" // standard input (expected here)
44887      // 0x0002 - "perc2" // standard input (expected here)
44888      // 0x0004 - "perc3" // standard input (expected here)
44889      // 0x0008 - "perc4" // standard input (expected here)
44890      PORT_MODIFY("IN-8")
44891      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("auctio")
44892      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("leave")
44893      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("take")
44894      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("c or b")
44895      PORT_MODIFY("IN-16")
44896      // 0x0001 - "dil1" // standard input (motherboard)
44897      // 0x0002 - "dil2" // standard input (motherboard)
44898      // 0x0004 - "dil3" // standard input (motherboard)
44899      // 0x0008 - "dil4" // standard input (motherboard)
44900      // 0x0010 - "dil5" // standard input (motherboard)
44901      // 0x0100 - "top up" // known extended input, usually 'top up'
44902      PORT_MODIFY("IN-17")
44903      // 0x0001 - "dil6" // standard input (motherboard)
44904      // 0x0002 - "dil7" // standard input (motherboard)
44905      // 0x0004 - "dil8" // standard input (motherboard)
44906      // 0x0008 - "dil9" // standard input (motherboard)
44907      // 0x0010 - "dil10" // standard input (motherboard)
44908      PORT_MODIFY("IN-18")
44909      // 0x0001 - "dil11" // standard input (motherboard)
44910      // 0x0002 - "dil12" // standard input (motherboard)
44911      // 0x0004 - "dil13" // standard input (motherboard)
44912      // 0x0008 - "dil14" // standard input (motherboard)
44913      // 0x0010 - "dil15" // standard input (motherboard)
44914      PORT_MODIFY("IN-19")
44915      // 0x0001 - "dil16" // standard input (motherboard)
44916      PORT_MODIFY("IN-20")
44917      // 0x0001 - "grnbut" // standard input (motherboard)
44918      // 0x0002 - "dorlok" // standard input (expected here)
44919      // 0x0004 - "serdor" // standard input (expected here)
44920      // 0x0008 - "cshdor" // standard input (expected here)
44921      // 0x0010 - "hopdmp" // standard input (expected here)
4492244922INPUT_PORTS_END
4492344923
4492444924//PROJECT NUMBER PR3332 AWP MONOPOLY BOOM OR BUST S4         PR3307 MPOLY BOOM OR B SOUNDS11   BOOM OR BUST  S.SITE
r31373r31374
4494444944}
4494544945
4494644946INPUT_PORTS_START( sc4fever ) // this structure is generated
44947        PORT_INCLUDE( sc4_base )
44948        PORT_MODIFY("IN-1")
44949        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44950        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
44951        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
44952        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
44953        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
44954        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
44955        PORT_MODIFY("IN-2")
44956        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
44957        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44958        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44959        PORT_MODIFY("IN-3")
44960        // 0x0004 - "stk 4" // standard input (expected here)
44961        // 0x0008 - "stk 3" // standard input (expected here)
44962        // 0x0010 - "stk 2" // standard input (expected here)
44963        PORT_MODIFY("IN-4")
44964        // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
44965        PORT_MODIFY("IN-5")
44966        // 0x0001 - "pzkey1" // standard input (expected here)
44967        // 0x0002 - "pzkey2" // standard input (expected here)
44968        // 0x0004 - "pzkey3" // standard input (expected here)
44969        // 0x0008 - "pzkey4" // standard input (expected here)
44970        PORT_MODIFY("IN-6")
44971        // 0x0001 - "pckey1" // standard input (expected here)
44972        // 0x0002 - "pckey2" // standard input (expected here)
44973        // 0x0004 - "pckey3" // standard input (expected here)
44974        // 0x0008 - "pckey4" // standard input (expected here)
44975        PORT_MODIFY("IN-8")
44976        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("t blts")
44977        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("t feat")
44978        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("t nuds")
44979        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("t ko")
44980        PORT_MODIFY("IN-16")
44981        // 0x0001 - "dil  1" // standard input (motherboard)
44982        // 0x0002 - "dil  2" // standard input (motherboard)
44983        // 0x0004 - "dil  3" // standard input (motherboard)
44984        // 0x0008 - "dil  4" // standard input (motherboard)
44985        // 0x0010 - "dil  5" // standard input (motherboard)
44986        // 0x0100 - "htopup" // known extended input, usually 'top up'
44987        PORT_MODIFY("IN-17")
44988        // 0x0001 - "dil  6" // standard input (motherboard)
44989        // 0x0002 - "dil  7" // standard input (motherboard)
44990        // 0x0004 - "dil  8" // standard input (motherboard)
44991        // 0x0008 - "dil  9" // standard input (motherboard)
44992        // 0x0010 - "dil 10" // standard input (motherboard)
44993        PORT_MODIFY("IN-18")
44994        // 0x0001 - "dil 11" // standard input (motherboard)
44995        // 0x0002 - "dil 12" // standard input (motherboard)
44996        // 0x0004 - "dil 13" // standard input (motherboard)
44997        // 0x0008 - "dil 14" // standard input (motherboard)
44998        // 0x0010 - "dil 15" // standard input (motherboard)
44999        PORT_MODIFY("IN-19")
45000        // 0x0001 - "dil 16" // standard input (motherboard)
45001        PORT_MODIFY("IN-20")
45002        // 0x0001 - "green" // standard input (motherboard)
45003        // 0x0002 - "dorlok" // standard input (expected here)
45004        // 0x0004 - "serdor" // standard input (expected here)
45005        // 0x0008 - "cshdor" // standard input (expected here)
45006        // 0x0010 - "hopdmp" // standard input (expected here)
44947      PORT_INCLUDE( sc4_base )
44948      PORT_MODIFY("IN-1")
44949      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
44950      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
44951      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
44952      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
44953      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
44954      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
44955      PORT_MODIFY("IN-2")
44956      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
44957      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
44958      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
44959      PORT_MODIFY("IN-3")
44960      // 0x0004 - "stk 4" // standard input (expected here)
44961      // 0x0008 - "stk 3" // standard input (expected here)
44962      // 0x0010 - "stk 2" // standard input (expected here)
44963      PORT_MODIFY("IN-4")
44964      // 0x0002 - "hoplow" // known extended(?) input, sometimes 'hop hi'
44965      PORT_MODIFY("IN-5")
44966      // 0x0001 - "pzkey1" // standard input (expected here)
44967      // 0x0002 - "pzkey2" // standard input (expected here)
44968      // 0x0004 - "pzkey3" // standard input (expected here)
44969      // 0x0008 - "pzkey4" // standard input (expected here)
44970      PORT_MODIFY("IN-6")
44971      // 0x0001 - "pckey1" // standard input (expected here)
44972      // 0x0002 - "pckey2" // standard input (expected here)
44973      // 0x0004 - "pckey3" // standard input (expected here)
44974      // 0x0008 - "pckey4" // standard input (expected here)
44975      PORT_MODIFY("IN-8")
44976      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("t blts")
44977      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("t feat")
44978      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("t nuds")
44979      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("t ko")
44980      PORT_MODIFY("IN-16")
44981      // 0x0001 - "dil  1" // standard input (motherboard)
44982      // 0x0002 - "dil  2" // standard input (motherboard)
44983      // 0x0004 - "dil  3" // standard input (motherboard)
44984      // 0x0008 - "dil  4" // standard input (motherboard)
44985      // 0x0010 - "dil  5" // standard input (motherboard)
44986      // 0x0100 - "htopup" // known extended input, usually 'top up'
44987      PORT_MODIFY("IN-17")
44988      // 0x0001 - "dil  6" // standard input (motherboard)
44989      // 0x0002 - "dil  7" // standard input (motherboard)
44990      // 0x0004 - "dil  8" // standard input (motherboard)
44991      // 0x0008 - "dil  9" // standard input (motherboard)
44992      // 0x0010 - "dil 10" // standard input (motherboard)
44993      PORT_MODIFY("IN-18")
44994      // 0x0001 - "dil 11" // standard input (motherboard)
44995      // 0x0002 - "dil 12" // standard input (motherboard)
44996      // 0x0004 - "dil 13" // standard input (motherboard)
44997      // 0x0008 - "dil 14" // standard input (motherboard)
44998      // 0x0010 - "dil 15" // standard input (motherboard)
44999      PORT_MODIFY("IN-19")
45000      // 0x0001 - "dil 16" // standard input (motherboard)
45001      PORT_MODIFY("IN-20")
45002      // 0x0001 - "green" // standard input (motherboard)
45003      // 0x0002 - "dorlok" // standard input (expected here)
45004      // 0x0004 - "serdor" // standard input (expected here)
45005      // 0x0008 - "cshdor" // standard input (expected here)
45006      // 0x0010 - "hopdmp" // standard input (expected here)
4500745007INPUT_PORTS_END
4500845008
4500945009// we have FEVER SOUNDS12 but it accepts those?
r31373r31374
4504345043}
4504445044
4504545045INPUT_PORTS_START( sc4aztec ) // this structure is generated
45046        PORT_INCLUDE( sc4_base )
45047        PORT_MODIFY("IN-1")
45048        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45049        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45050        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45051        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45052        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kop")
45053        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("zijdeu OR l hop OR r hop")
45054        PORT_MODIFY("IN-2")
45055        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("munt")
45056        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
45057        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45058        PORT_MODIFY("IN-3")
45059        // 0x0001 - "uitbet" // unexpected here
45060        // 0x0002 - "n club" // unexpected here
45061        // 0x0010 - "roep" // standard input (expected here)
45062        PORT_MODIFY("IN-4")
45063        // 0x0001 - "l hop" // unexpected here
45064        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45065        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45066        PORT_MODIFY("IN-5")
45067        // 0x0001 - "l lege" // standard input (expected here)
45068        // 0x0002 - "r lege" // standard input (expected here)
45069        PORT_MODIFY("IN-16")
45070        // 0x0001 - "dil sw" // standard input (motherboard)
45071        // 0x0002 - "dil sw" // standard input (motherboard)
45072        // 0x0004 - "dil sw" // standard input (motherboard)
45073        // 0x0008 - "dil sw" // standard input (motherboard)
45074        // 0x0010 - "dil sw" // standard input (motherboard)
45075        PORT_MODIFY("IN-17")
45076        // 0x0001 - "dil sw" // standard input (motherboard)
45077        // 0x0002 - "dil sw" // standard input (motherboard)
45078        // 0x0004 - "dil sw" // standard input (motherboard)
45079        // 0x0008 - "dil sw" // standard input (motherboard)
45080        // 0x0010 - "dil sw" // standard input (motherboard)
45081        PORT_MODIFY("IN-18")
45082        // 0x0001 - "dil sw" // standard input (motherboard)
45083        // 0x0002 - "dil sw" // standard input (motherboard)
45084        // 0x0004 - "dil sw" // standard input (motherboard)
45085        // 0x0008 - "dil sw" // standard input (motherboard)
45086        // 0x0010 - "dil sw" // standard input (motherboard)
45087        PORT_MODIFY("IN-19")
45088        // 0x0001 - "dil sw" // standard input (motherboard)
45089        PORT_MODIFY("IN-20")
45090        // 0x0001 - "green" // standard input (motherboard)
45091        // 0x0002 - "cashbo" // standard input (expected here)
45092        // 0x0008 - "dump" // standard input (expected here)
45093        // 0x0010 - "boekho" // standard input (expected here)
45046      PORT_INCLUDE( sc4_base )
45047      PORT_MODIFY("IN-1")
45048      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45049      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45050      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45051      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45052      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kop")
45053      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("zijdeu OR l hop OR r hop")
45054      PORT_MODIFY("IN-2")
45055      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("munt")
45056      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
45057      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45058      PORT_MODIFY("IN-3")
45059      // 0x0001 - "uitbet" // unexpected here
45060      // 0x0002 - "n club" // unexpected here
45061      // 0x0010 - "roep" // standard input (expected here)
45062      PORT_MODIFY("IN-4")
45063      // 0x0001 - "l hop" // unexpected here
45064      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45065      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45066      PORT_MODIFY("IN-5")
45067      // 0x0001 - "l lege" // standard input (expected here)
45068      // 0x0002 - "r lege" // standard input (expected here)
45069      PORT_MODIFY("IN-16")
45070      // 0x0001 - "dil sw" // standard input (motherboard)
45071      // 0x0002 - "dil sw" // standard input (motherboard)
45072      // 0x0004 - "dil sw" // standard input (motherboard)
45073      // 0x0008 - "dil sw" // standard input (motherboard)
45074      // 0x0010 - "dil sw" // standard input (motherboard)
45075      PORT_MODIFY("IN-17")
45076      // 0x0001 - "dil sw" // standard input (motherboard)
45077      // 0x0002 - "dil sw" // standard input (motherboard)
45078      // 0x0004 - "dil sw" // standard input (motherboard)
45079      // 0x0008 - "dil sw" // standard input (motherboard)
45080      // 0x0010 - "dil sw" // standard input (motherboard)
45081      PORT_MODIFY("IN-18")
45082      // 0x0001 - "dil sw" // standard input (motherboard)
45083      // 0x0002 - "dil sw" // standard input (motherboard)
45084      // 0x0004 - "dil sw" // standard input (motherboard)
45085      // 0x0008 - "dil sw" // standard input (motherboard)
45086      // 0x0010 - "dil sw" // standard input (motherboard)
45087      PORT_MODIFY("IN-19")
45088      // 0x0001 - "dil sw" // standard input (motherboard)
45089      PORT_MODIFY("IN-20")
45090      // 0x0001 - "green" // standard input (motherboard)
45091      // 0x0002 - "cashbo" // standard input (expected here)
45092      // 0x0008 - "dump" // standard input (expected here)
45093      // 0x0010 - "boekho" // standard input (expected here)
4509445094INPUT_PORTS_END
4509545095
4509645096GAMEL( 200?, sc4aztec    ,0,         sc4, sc4aztec, sc4_state, sc4aztec, ROT0, "BFG / Eurocoin","Aztec Casino (Dutch) (Bellfruit) (Scorpion 4)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )// PR1225 AZTEC CASINO
r31373r31374
4511445114}
4511545115
4511645116INPUT_PORTS_START( sc4helrd ) // this structure is generated
45117        PORT_INCLUDE( sc4_base )
45118        PORT_MODIFY("IN-1")
45119        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45120        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45121        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45122        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45123        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("vast 4")
45124        PORT_MODIFY("IN-2")
45125        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kop")
45126        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("munt")
45127        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45128        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45129        PORT_MODIFY("IN-3")
45130        // 0x0001 - "uitbet" // unexpected here
45131        // 0x0002 - "n club" // unexpected here
45132        // 0x0010 - "player" // standard input (expected here)
45133        PORT_MODIFY("IN-4")
45134        // 0x0001 - "l hop" // unexpected here
45135        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45136        // 0x0004 - "l hop" // unexpected here
45137        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45138        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45139        PORT_MODIFY("IN-5")
45140        // 0x0001 - "l lege" // standard input (expected here)
45141        // 0x0002 - "r lege" // standard input (expected here)
45142        // 0x0004 - "dump" // standard input (expected here)
45143        PORT_MODIFY("IN-16")
45144        // 0x0001 - "dil sw" // standard input (motherboard)
45145        // 0x0002 - "dil sw" // standard input (motherboard)
45146        // 0x0004 - "dil sw" // standard input (motherboard)
45147        // 0x0008 - "dil sw" // standard input (motherboard)
45148        // 0x0010 - "dil sw" // standard input (motherboard)
45149        PORT_MODIFY("IN-17")
45150        // 0x0001 - "dil sw" // standard input (motherboard)
45151        // 0x0002 - "dil sw" // standard input (motherboard)
45152        // 0x0004 - "dil sw" // standard input (motherboard)
45153        // 0x0008 - "dil sw" // standard input (motherboard)
45154        // 0x0010 - "dil sw" // standard input (motherboard)
45155        PORT_MODIFY("IN-18")
45156        // 0x0001 - "dil sw" // standard input (motherboard)
45157        // 0x0002 - "dil sw" // standard input (motherboard)
45158        // 0x0004 - "dil sw" // standard input (motherboard)
45159        // 0x0008 - "dil sw" // standard input (motherboard)
45160        // 0x0010 - "dil sw" // standard input (motherboard)
45161        PORT_MODIFY("IN-19")
45162        // 0x0001 - "dil sw" // standard input (motherboard)
45163        PORT_MODIFY("IN-20")
45164        // 0x0001 - "green" // standard input (motherboard)
45165        // 0x0002 - "cashbo" // standard input (expected here)
45166        // 0x0008 - "zijdeu" // standard input (expected here)
45167        // 0x0010 - "boekho" // standard input (expected here)
45117      PORT_INCLUDE( sc4_base )
45118      PORT_MODIFY("IN-1")
45119      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45120      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45121      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45122      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45123      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("vast 4")
45124      PORT_MODIFY("IN-2")
45125      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kop")
45126      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("munt")
45127      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45128      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45129      PORT_MODIFY("IN-3")
45130      // 0x0001 - "uitbet" // unexpected here
45131      // 0x0002 - "n club" // unexpected here
45132      // 0x0010 - "player" // standard input (expected here)
45133      PORT_MODIFY("IN-4")
45134      // 0x0001 - "l hop" // unexpected here
45135      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45136      // 0x0004 - "l hop" // unexpected here
45137      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45138      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45139      PORT_MODIFY("IN-5")
45140      // 0x0001 - "l lege" // standard input (expected here)
45141      // 0x0002 - "r lege" // standard input (expected here)
45142      // 0x0004 - "dump" // standard input (expected here)
45143      PORT_MODIFY("IN-16")
45144      // 0x0001 - "dil sw" // standard input (motherboard)
45145      // 0x0002 - "dil sw" // standard input (motherboard)
45146      // 0x0004 - "dil sw" // standard input (motherboard)
45147      // 0x0008 - "dil sw" // standard input (motherboard)
45148      // 0x0010 - "dil sw" // standard input (motherboard)
45149      PORT_MODIFY("IN-17")
45150      // 0x0001 - "dil sw" // standard input (motherboard)
45151      // 0x0002 - "dil sw" // standard input (motherboard)
45152      // 0x0004 - "dil sw" // standard input (motherboard)
45153      // 0x0008 - "dil sw" // standard input (motherboard)
45154      // 0x0010 - "dil sw" // standard input (motherboard)
45155      PORT_MODIFY("IN-18")
45156      // 0x0001 - "dil sw" // standard input (motherboard)
45157      // 0x0002 - "dil sw" // standard input (motherboard)
45158      // 0x0004 - "dil sw" // standard input (motherboard)
45159      // 0x0008 - "dil sw" // standard input (motherboard)
45160      // 0x0010 - "dil sw" // standard input (motherboard)
45161      PORT_MODIFY("IN-19")
45162      // 0x0001 - "dil sw" // standard input (motherboard)
45163      PORT_MODIFY("IN-20")
45164      // 0x0001 - "green" // standard input (motherboard)
45165      // 0x0002 - "cashbo" // standard input (expected here)
45166      // 0x0008 - "zijdeu" // standard input (expected here)
45167      // 0x0010 - "boekho" // standard input (expected here)
4516845168INPUT_PORTS_END
4516945169
4517045170// PR1254 HELLRAISER ART12         95004326 HELLRAISER PR1254
r31373r31374
4518945189}
4519045190
4519145191INPUT_PORTS_START( sc4heatw ) // this structure is generated
45192        PORT_INCLUDE( sc4_base )
45193        PORT_MODIFY("IN-1")
45194        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45195        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45196        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45197        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45198        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("k inze")
45199        PORT_MODIFY("IN-2")
45200        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("munt")
45201        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45202        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45203        PORT_MODIFY("IN-3")
45204        // 0x0001 - "uitbet" // unexpected here
45205        // 0x0002 - "n club" // unexpected here
45206        // 0x0010 - "player" // standard input (expected here)
45207        PORT_MODIFY("IN-4")
45208        // 0x0001 - "l hop" // unexpected here
45209        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45210        // 0x0004 - "l hop" // unexpected here
45211        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45212        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45213        PORT_MODIFY("IN-5")
45214        // 0x0001 - "l lege" // standard input (expected here)
45215        // 0x0002 - "r lege" // standard input (expected here)
45216        // 0x0004 - "dump" // standard input (expected here)
45217        PORT_MODIFY("IN-16")
45218        // 0x0001 - "dil sw" // standard input (motherboard)
45219        // 0x0002 - "dil sw" // standard input (motherboard)
45220        // 0x0004 - "dil sw" // standard input (motherboard)
45221        // 0x0008 - "dil sw" // standard input (motherboard)
45222        // 0x0010 - "dil sw" // standard input (motherboard)
45223        PORT_MODIFY("IN-17")
45224        // 0x0001 - "dil sw" // standard input (motherboard)
45225        // 0x0002 - "dil sw" // standard input (motherboard)
45226        // 0x0004 - "dil sw" // standard input (motherboard)
45227        // 0x0008 - "dil sw" // standard input (motherboard)
45228        // 0x0010 - "dil sw" // standard input (motherboard)
45229        PORT_MODIFY("IN-18")
45230        // 0x0001 - "dil sw" // standard input (motherboard)
45231        // 0x0002 - "dil sw" // standard input (motherboard)
45232        // 0x0004 - "dil sw" // standard input (motherboard)
45233        // 0x0008 - "dil sw" // standard input (motherboard)
45234        // 0x0010 - "dil sw" // standard input (motherboard)
45235        PORT_MODIFY("IN-19")
45236        // 0x0001 - "dil sw" // standard input (motherboard)
45237        PORT_MODIFY("IN-20")
45238        // 0x0001 - "green" // standard input (motherboard)
45239        // 0x0002 - "cashbo" // standard input (expected here)
45240        // 0x0008 - "zijdeu" // standard input (expected here)
45241        // 0x0010 - "boekho" // standard input (expected here)
45192      PORT_INCLUDE( sc4_base )
45193      PORT_MODIFY("IN-1")
45194      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45195      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45196      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45197      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45198      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("k inze")
45199      PORT_MODIFY("IN-2")
45200      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("munt")
45201      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45202      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45203      PORT_MODIFY("IN-3")
45204      // 0x0001 - "uitbet" // unexpected here
45205      // 0x0002 - "n club" // unexpected here
45206      // 0x0010 - "player" // standard input (expected here)
45207      PORT_MODIFY("IN-4")
45208      // 0x0001 - "l hop" // unexpected here
45209      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45210      // 0x0004 - "l hop" // unexpected here
45211      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45212      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45213      PORT_MODIFY("IN-5")
45214      // 0x0001 - "l lege" // standard input (expected here)
45215      // 0x0002 - "r lege" // standard input (expected here)
45216      // 0x0004 - "dump" // standard input (expected here)
45217      PORT_MODIFY("IN-16")
45218      // 0x0001 - "dil sw" // standard input (motherboard)
45219      // 0x0002 - "dil sw" // standard input (motherboard)
45220      // 0x0004 - "dil sw" // standard input (motherboard)
45221      // 0x0008 - "dil sw" // standard input (motherboard)
45222      // 0x0010 - "dil sw" // standard input (motherboard)
45223      PORT_MODIFY("IN-17")
45224      // 0x0001 - "dil sw" // standard input (motherboard)
45225      // 0x0002 - "dil sw" // standard input (motherboard)
45226      // 0x0004 - "dil sw" // standard input (motherboard)
45227      // 0x0008 - "dil sw" // standard input (motherboard)
45228      // 0x0010 - "dil sw" // standard input (motherboard)
45229      PORT_MODIFY("IN-18")
45230      // 0x0001 - "dil sw" // standard input (motherboard)
45231      // 0x0002 - "dil sw" // standard input (motherboard)
45232      // 0x0004 - "dil sw" // standard input (motherboard)
45233      // 0x0008 - "dil sw" // standard input (motherboard)
45234      // 0x0010 - "dil sw" // standard input (motherboard)
45235      PORT_MODIFY("IN-19")
45236      // 0x0001 - "dil sw" // standard input (motherboard)
45237      PORT_MODIFY("IN-20")
45238      // 0x0001 - "green" // standard input (motherboard)
45239      // 0x0002 - "cashbo" // standard input (expected here)
45240      // 0x0008 - "zijdeu" // standard input (expected here)
45241      // 0x0010 - "boekho" // standard input (expected here)
4524245242INPUT_PORTS_END
4524345243
4524445244// PR1216 HEATWAVE ART 12         95004287 HEATWAVE PR1156
r31373r31374
4526245262}
4526345263
4526445264INPUT_PORTS_START( sc4colos ) // this structure is generated
45265        PORT_INCLUDE( sc4_base )
45266        PORT_MODIFY("IN-1")
45267        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
45268        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45269        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45270        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45271        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies m")
45272        PORT_MODIFY("IN-2")
45273        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies b")
45274        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies c")
45275        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45276        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45277        PORT_MODIFY("IN-3")
45278        // 0x0001 - "uitbet" // unexpected here
45279        // 0x0002 - "neem m" // unexpected here
45280        // 0x0004 - "neem w" // standard input (expected here)
45281        // 0x0010 - "roep" // standard input (expected here)
45282        PORT_MODIFY("IN-4")
45283        // 0x0001 - "l hop" // unexpected here
45284        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45285        // 0x0004 - "l hop" // unexpected here
45286        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45287        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45288        PORT_MODIFY("IN-5")
45289        // 0x0001 - "l lege" // standard input (expected here)
45290        // 0x0002 - "r lege" // standard input (expected here)
45291        // 0x0004 - "dump" // standard input (expected here)
45292        PORT_MODIFY("IN-16")
45293        // 0x0001 - "dil sw" // standard input (motherboard)
45294        // 0x0002 - "dil sw" // standard input (motherboard)
45295        // 0x0004 - "dil sw" // standard input (motherboard)
45296        // 0x0008 - "dil sw" // standard input (motherboard)
45297        // 0x0010 - "dil sw" // standard input (motherboard)
45298        PORT_MODIFY("IN-17")
45299        // 0x0001 - "dil sw" // standard input (motherboard)
45300        // 0x0002 - "dil sw" // standard input (motherboard)
45301        // 0x0004 - "dil sw" // standard input (motherboard)
45302        // 0x0008 - "dil sw" // standard input (motherboard)
45303        // 0x0010 - "dil sw" // standard input (motherboard)
45304        PORT_MODIFY("IN-18")
45305        // 0x0001 - "dil sw" // standard input (motherboard)
45306        // 0x0002 - "dil sw" // standard input (motherboard)
45307        // 0x0004 - "dil sw" // standard input (motherboard)
45308        // 0x0008 - "dil sw" // standard input (motherboard)
45309        // 0x0010 - "dil sw" // standard input (motherboard)
45310        PORT_MODIFY("IN-19")
45311        // 0x0001 - "dil sw" // standard input (motherboard)
45312        PORT_MODIFY("IN-20")
45313        // 0x0001 - "green" // standard input (motherboard)
45314        // 0x0002 - "cashbo" // standard input (expected here)
45315        // 0x0008 - "zijdeu" // standard input (expected here)
45316        // 0x0010 - "boekho" // standard input (expected here)
45265      PORT_INCLUDE( sc4_base )
45266      PORT_MODIFY("IN-1")
45267      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
45268      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45269      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45270      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45271      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies m")
45272      PORT_MODIFY("IN-2")
45273      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies b")
45274      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies c")
45275      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45276      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45277      PORT_MODIFY("IN-3")
45278      // 0x0001 - "uitbet" // unexpected here
45279      // 0x0002 - "neem m" // unexpected here
45280      // 0x0004 - "neem w" // standard input (expected here)
45281      // 0x0010 - "roep" // standard input (expected here)
45282      PORT_MODIFY("IN-4")
45283      // 0x0001 - "l hop" // unexpected here
45284      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45285      // 0x0004 - "l hop" // unexpected here
45286      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45287      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45288      PORT_MODIFY("IN-5")
45289      // 0x0001 - "l lege" // standard input (expected here)
45290      // 0x0002 - "r lege" // standard input (expected here)
45291      // 0x0004 - "dump" // standard input (expected here)
45292      PORT_MODIFY("IN-16")
45293      // 0x0001 - "dil sw" // standard input (motherboard)
45294      // 0x0002 - "dil sw" // standard input (motherboard)
45295      // 0x0004 - "dil sw" // standard input (motherboard)
45296      // 0x0008 - "dil sw" // standard input (motherboard)
45297      // 0x0010 - "dil sw" // standard input (motherboard)
45298      PORT_MODIFY("IN-17")
45299      // 0x0001 - "dil sw" // standard input (motherboard)
45300      // 0x0002 - "dil sw" // standard input (motherboard)
45301      // 0x0004 - "dil sw" // standard input (motherboard)
45302      // 0x0008 - "dil sw" // standard input (motherboard)
45303      // 0x0010 - "dil sw" // standard input (motherboard)
45304      PORT_MODIFY("IN-18")
45305      // 0x0001 - "dil sw" // standard input (motherboard)
45306      // 0x0002 - "dil sw" // standard input (motherboard)
45307      // 0x0004 - "dil sw" // standard input (motherboard)
45308      // 0x0008 - "dil sw" // standard input (motherboard)
45309      // 0x0010 - "dil sw" // standard input (motherboard)
45310      PORT_MODIFY("IN-19")
45311      // 0x0001 - "dil sw" // standard input (motherboard)
45312      PORT_MODIFY("IN-20")
45313      // 0x0001 - "green" // standard input (motherboard)
45314      // 0x0002 - "cashbo" // standard input (expected here)
45315      // 0x0008 - "zijdeu" // standard input (expected here)
45316      // 0x0010 - "boekho" // standard input (expected here)
4531745317INPUT_PORTS_END
4531845318
4531945319// PR1208 COLOSSUS         95004235 COLOSSUS PR7155             COLOSSUS
r31373r31374
4533645336}
4533745337
4533845338INPUT_PORTS_START( sc4fevdt ) // this structure is generated
45339        PORT_INCLUDE( sc4_base )
45340        PORT_MODIFY("IN-1")
45341        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
45342        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45343        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45344        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45345        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies i")
45346        PORT_MODIFY("IN-2")
45347        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies s")
45348        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45349        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45350        PORT_MODIFY("IN-3")
45351        // 0x0001 - "uitbet" // unexpected here
45352        // 0x0002 - "n hoog" // unexpected here
45353        // 0x0004 - "n winb" // standard input (expected here)
45354        PORT_MODIFY("IN-4")
45355        // 0x0001 - "l hop" // unexpected here
45356        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45357        // 0x0004 - "l hop" // unexpected here
45358        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45359        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45360        PORT_MODIFY("IN-5")
45361        // 0x0001 - "l lege" // standard input (expected here)
45362        // 0x0002 - "r lege" // standard input (expected here)
45363        // 0x0004 - "dump" // standard input (expected here)
45364        PORT_MODIFY("IN-16")
45365        // 0x0001 - "dil sw" // standard input (motherboard)
45366        // 0x0002 - "dil sw" // standard input (motherboard)
45367        // 0x0004 - "dil sw" // standard input (motherboard)
45368        // 0x0008 - "dil sw" // standard input (motherboard)
45369        // 0x0010 - "dil sw" // standard input (motherboard)
45370        PORT_MODIFY("IN-17")
45371        // 0x0001 - "dil sw" // standard input (motherboard)
45372        // 0x0002 - "dil sw" // standard input (motherboard)
45373        // 0x0004 - "dil sw" // standard input (motherboard)
45374        // 0x0008 - "dil sw" // standard input (motherboard)
45375        // 0x0010 - "dil sw" // standard input (motherboard)
45376        PORT_MODIFY("IN-18")
45377        // 0x0001 - "dil sw" // standard input (motherboard)
45378        // 0x0002 - "dil sw" // standard input (motherboard)
45379        // 0x0004 - "dil sw" // standard input (motherboard)
45380        // 0x0008 - "dil sw" // standard input (motherboard)
45381        // 0x0010 - "dil sw" // standard input (motherboard)
45382        PORT_MODIFY("IN-19")
45383        // 0x0001 - "dil sw" // standard input (motherboard)
45384        PORT_MODIFY("IN-20")
45385        // 0x0001 - "green" // standard input (motherboard)
45386        // 0x0002 - "cashbo" // standard input (expected here)
45387        // 0x0008 - "zijdeu" // standard input (expected here)
45388        // 0x0010 - "boekho" // standard input (expected here)
45339      PORT_INCLUDE( sc4_base )
45340      PORT_MODIFY("IN-1")
45341      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
45342      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45343      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45344      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45345      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies i")
45346      PORT_MODIFY("IN-2")
45347      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies s")
45348      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45349      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45350      PORT_MODIFY("IN-3")
45351      // 0x0001 - "uitbet" // unexpected here
45352      // 0x0002 - "n hoog" // unexpected here
45353      // 0x0004 - "n winb" // standard input (expected here)
45354      PORT_MODIFY("IN-4")
45355      // 0x0001 - "l hop" // unexpected here
45356      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45357      // 0x0004 - "l hop" // unexpected here
45358      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45359      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45360      PORT_MODIFY("IN-5")
45361      // 0x0001 - "l lege" // standard input (expected here)
45362      // 0x0002 - "r lege" // standard input (expected here)
45363      // 0x0004 - "dump" // standard input (expected here)
45364      PORT_MODIFY("IN-16")
45365      // 0x0001 - "dil sw" // standard input (motherboard)
45366      // 0x0002 - "dil sw" // standard input (motherboard)
45367      // 0x0004 - "dil sw" // standard input (motherboard)
45368      // 0x0008 - "dil sw" // standard input (motherboard)
45369      // 0x0010 - "dil sw" // standard input (motherboard)
45370      PORT_MODIFY("IN-17")
45371      // 0x0001 - "dil sw" // standard input (motherboard)
45372      // 0x0002 - "dil sw" // standard input (motherboard)
45373      // 0x0004 - "dil sw" // standard input (motherboard)
45374      // 0x0008 - "dil sw" // standard input (motherboard)
45375      // 0x0010 - "dil sw" // standard input (motherboard)
45376      PORT_MODIFY("IN-18")
45377      // 0x0001 - "dil sw" // standard input (motherboard)
45378      // 0x0002 - "dil sw" // standard input (motherboard)
45379      // 0x0004 - "dil sw" // standard input (motherboard)
45380      // 0x0008 - "dil sw" // standard input (motherboard)
45381      // 0x0010 - "dil sw" // standard input (motherboard)
45382      PORT_MODIFY("IN-19")
45383      // 0x0001 - "dil sw" // standard input (motherboard)
45384      PORT_MODIFY("IN-20")
45385      // 0x0001 - "green" // standard input (motherboard)
45386      // 0x0002 - "cashbo" // standard input (expected here)
45387      // 0x0008 - "zijdeu" // standard input (expected here)
45388      // 0x0010 - "boekho" // standard input (expected here)
4538945389INPUT_PORTS_END
4539045390
4539145391//  PR1202 FEVER         95004239 FEVER PR7157
r31373r31374
4541045410}
4541145411
4541245412INPUT_PORTS_START( sc4fevnx ) // this structure is generated
45413        PORT_INCLUDE( sc4_base )
45414        PORT_MODIFY("IN-1")
45415        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
45416        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45417        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45418        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45419        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("k inze")
45420        PORT_MODIFY("IN-2")
45421        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("k spel")
45422        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("key/go")
45423        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45424        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45425        PORT_MODIFY("IN-3")
45426        // 0x0001 - "uitbet" // unexpected here
45427        // 0x0002 - "n club" // unexpected here
45428        // 0x0010 - "player" // standard input (expected here)
45429        PORT_MODIFY("IN-4")
45430        // 0x0001 - "l hop" // unexpected here
45431        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45432        // 0x0004 - "l hop" // unexpected here
45433        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45434        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45435        PORT_MODIFY("IN-5")
45436        // 0x0001 - "l lege" // standard input (expected here)
45437        // 0x0002 - "r lege" // standard input (expected here)
45438        // 0x0004 - "dump" // standard input (expected here)
45439        PORT_MODIFY("IN-16")
45440        // 0x0001 - "dil sw" // standard input (motherboard)
45441        // 0x0002 - "dil sw" // standard input (motherboard)
45442        // 0x0004 - "dil sw" // standard input (motherboard)
45443        // 0x0008 - "dil sw" // standard input (motherboard)
45444        // 0x0010 - "dil sw" // standard input (motherboard)
45445        PORT_MODIFY("IN-17")
45446        // 0x0001 - "dil sw" // standard input (motherboard)
45447        // 0x0002 - "dil sw" // standard input (motherboard)
45448        // 0x0004 - "dil sw" // standard input (motherboard)
45449        // 0x0008 - "dil sw" // standard input (motherboard)
45450        // 0x0010 - "dil sw" // standard input (motherboard)
45451        PORT_MODIFY("IN-18")
45452        // 0x0001 - "dil sw" // standard input (motherboard)
45453        // 0x0002 - "dil sw" // standard input (motherboard)
45454        // 0x0004 - "dil sw" // standard input (motherboard)
45455        // 0x0008 - "dil sw" // standard input (motherboard)
45456        // 0x0010 - "dil sw" // standard input (motherboard)
45457        PORT_MODIFY("IN-19")
45458        // 0x0001 - "dil sw" // standard input (motherboard)
45459        PORT_MODIFY("IN-20")
45460        // 0x0001 - "green" // standard input (motherboard)
45461        // 0x0002 - "cashbo" // standard input (expected here)
45462        // 0x0008 - "zijdeu" // standard input (expected here)
45463        // 0x0010 - "boekho" // standard input (expected here)
45413      PORT_INCLUDE( sc4_base )
45414      PORT_MODIFY("IN-1")
45415      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
45416      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45417      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45418      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45419      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("k inze")
45420      PORT_MODIFY("IN-2")
45421      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("k spel")
45422      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("key/go")
45423      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45424      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45425      PORT_MODIFY("IN-3")
45426      // 0x0001 - "uitbet" // unexpected here
45427      // 0x0002 - "n club" // unexpected here
45428      // 0x0010 - "player" // standard input (expected here)
45429      PORT_MODIFY("IN-4")
45430      // 0x0001 - "l hop" // unexpected here
45431      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45432      // 0x0004 - "l hop" // unexpected here
45433      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45434      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45435      PORT_MODIFY("IN-5")
45436      // 0x0001 - "l lege" // standard input (expected here)
45437      // 0x0002 - "r lege" // standard input (expected here)
45438      // 0x0004 - "dump" // standard input (expected here)
45439      PORT_MODIFY("IN-16")
45440      // 0x0001 - "dil sw" // standard input (motherboard)
45441      // 0x0002 - "dil sw" // standard input (motherboard)
45442      // 0x0004 - "dil sw" // standard input (motherboard)
45443      // 0x0008 - "dil sw" // standard input (motherboard)
45444      // 0x0010 - "dil sw" // standard input (motherboard)
45445      PORT_MODIFY("IN-17")
45446      // 0x0001 - "dil sw" // standard input (motherboard)
45447      // 0x0002 - "dil sw" // standard input (motherboard)
45448      // 0x0004 - "dil sw" // standard input (motherboard)
45449      // 0x0008 - "dil sw" // standard input (motherboard)
45450      // 0x0010 - "dil sw" // standard input (motherboard)
45451      PORT_MODIFY("IN-18")
45452      // 0x0001 - "dil sw" // standard input (motherboard)
45453      // 0x0002 - "dil sw" // standard input (motherboard)
45454      // 0x0004 - "dil sw" // standard input (motherboard)
45455      // 0x0008 - "dil sw" // standard input (motherboard)
45456      // 0x0010 - "dil sw" // standard input (motherboard)
45457      PORT_MODIFY("IN-19")
45458      // 0x0001 - "dil sw" // standard input (motherboard)
45459      PORT_MODIFY("IN-20")
45460      // 0x0001 - "green" // standard input (motherboard)
45461      // 0x0002 - "cashbo" // standard input (expected here)
45462      // 0x0008 - "zijdeu" // standard input (expected here)
45463      // 0x0010 - "boekho" // standard input (expected here)
4546445464INPUT_PORTS_END
4546545465
4546645466// PR1216 FEVER ART12         95004318 FEVER T N PR1251
r31373r31374
4548445484}
4548545485
4548645486INPUT_PORTS_START( sc4gamcs ) // this structure is generated
45487        PORT_INCLUDE( sc4_base )
45488        PORT_MODIFY("IN-1")
45489        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45490        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45491        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45492        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45493        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kop")
45494        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("zijdeu OR l hop OR r hop")
45495        PORT_MODIFY("IN-2")
45496        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("munt")
45497        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
45498        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45499        PORT_MODIFY("IN-3")
45500        // 0x0001 - "uitbet" // unexpected here
45501        // 0x0002 - "n club" // unexpected here
45502        // 0x0004 - "n winb" // standard input (expected here)
45503        // 0x0010 - "roep" // standard input (expected here)
45504        PORT_MODIFY("IN-4")
45505        // 0x0001 - "l hop" // unexpected here
45506        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45507        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45508        PORT_MODIFY("IN-16")
45509        // 0x0001 - "dil sw" // standard input (motherboard)
45510        // 0x0002 - "dil sw" // standard input (motherboard)
45511        // 0x0004 - "dil sw" // standard input (motherboard)
45512        // 0x0008 - "dil sw" // standard input (motherboard)
45513        // 0x0010 - "dil sw" // standard input (motherboard)
45514        PORT_MODIFY("IN-17")
45515        // 0x0001 - "dil sw" // standard input (motherboard)
45516        // 0x0002 - "dil sw" // standard input (motherboard)
45517        // 0x0004 - "dil sw" // standard input (motherboard)
45518        // 0x0008 - "dil sw" // standard input (motherboard)
45519        // 0x0010 - "dil sw" // standard input (motherboard)
45520        PORT_MODIFY("IN-18")
45521        // 0x0001 - "dil sw" // standard input (motherboard)
45522        // 0x0002 - "dil sw" // standard input (motherboard)
45523        // 0x0004 - "dil sw" // standard input (motherboard)
45524        // 0x0008 - "dil sw" // standard input (motherboard)
45525        // 0x0010 - "dil sw" // standard input (motherboard)
45526        PORT_MODIFY("IN-19")
45527        // 0x0001 - "dil sw" // standard input (motherboard)
45528        PORT_MODIFY("IN-20")
45529        // 0x0001 - "green" // standard input (motherboard)
45530        // 0x0002 - "cashbo" // standard input (expected here)
45531        // 0x0008 - "dump" // standard input (expected here)
45532        // 0x0010 - "boekho" // standard input (expected here)
45487      PORT_INCLUDE( sc4_base )
45488      PORT_MODIFY("IN-1")
45489      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45490      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45491      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45492      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45493      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kop")
45494      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("zijdeu OR l hop OR r hop")
45495      PORT_MODIFY("IN-2")
45496      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("munt")
45497      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
45498      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45499      PORT_MODIFY("IN-3")
45500      // 0x0001 - "uitbet" // unexpected here
45501      // 0x0002 - "n club" // unexpected here
45502      // 0x0004 - "n winb" // standard input (expected here)
45503      // 0x0010 - "roep" // standard input (expected here)
45504      PORT_MODIFY("IN-4")
45505      // 0x0001 - "l hop" // unexpected here
45506      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45507      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45508      PORT_MODIFY("IN-16")
45509      // 0x0001 - "dil sw" // standard input (motherboard)
45510      // 0x0002 - "dil sw" // standard input (motherboard)
45511      // 0x0004 - "dil sw" // standard input (motherboard)
45512      // 0x0008 - "dil sw" // standard input (motherboard)
45513      // 0x0010 - "dil sw" // standard input (motherboard)
45514      PORT_MODIFY("IN-17")
45515      // 0x0001 - "dil sw" // standard input (motherboard)
45516      // 0x0002 - "dil sw" // standard input (motherboard)
45517      // 0x0004 - "dil sw" // standard input (motherboard)
45518      // 0x0008 - "dil sw" // standard input (motherboard)
45519      // 0x0010 - "dil sw" // standard input (motherboard)
45520      PORT_MODIFY("IN-18")
45521      // 0x0001 - "dil sw" // standard input (motherboard)
45522      // 0x0002 - "dil sw" // standard input (motherboard)
45523      // 0x0004 - "dil sw" // standard input (motherboard)
45524      // 0x0008 - "dil sw" // standard input (motherboard)
45525      // 0x0010 - "dil sw" // standard input (motherboard)
45526      PORT_MODIFY("IN-19")
45527      // 0x0001 - "dil sw" // standard input (motherboard)
45528      PORT_MODIFY("IN-20")
45529      // 0x0001 - "green" // standard input (motherboard)
45530      // 0x0002 - "cashbo" // standard input (expected here)
45531      // 0x0008 - "dump" // standard input (expected here)
45532      // 0x0010 - "boekho" // standard input (expected here)
4553345533INPUT_PORTS_END
4553445534
4553545535INPUT_PORTS_START( sc4game ) // this structure is generated
45536        PORT_INCLUDE( sc4_base )
45537        PORT_MODIFY("IN-1")
45538        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
45539        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45540        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45541        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45542        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kop")
45543        PORT_MODIFY("IN-2")
45544        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("munt")
45545        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45546        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45547        PORT_MODIFY("IN-3")
45548        // 0x0001 - "uitbet" // unexpected here
45549        // 0x0002 - "neem c" // unexpected here
45550        // 0x0004 - "neem w" // standard input (expected here)
45551        // 0x0010 - "info/l" // standard input (expected here)
45552        PORT_MODIFY("IN-4")
45553        // 0x0001 - "l hop" // unexpected here
45554        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45555        // 0x0004 - "l hop" // unexpected here
45556        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45557        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45558        PORT_MODIFY("IN-5")
45559        // 0x0001 - "l lege" // standard input (expected here)
45560        // 0x0002 - "r lege" // standard input (expected here)
45561        // 0x0004 - "dump" // standard input (expected here)
45562        PORT_MODIFY("IN-16")
45563        // 0x0001 - "dil sw" // standard input (motherboard)
45564        // 0x0002 - "dil sw" // standard input (motherboard)
45565        // 0x0004 - "dil sw" // standard input (motherboard)
45566        // 0x0008 - "dil sw" // standard input (motherboard)
45567        // 0x0010 - "dil sw" // standard input (motherboard)
45568        PORT_MODIFY("IN-17")
45569        // 0x0001 - "dil sw" // standard input (motherboard)
45570        // 0x0002 - "dil sw" // standard input (motherboard)
45571        // 0x0004 - "dil sw" // standard input (motherboard)
45572        // 0x0008 - "dil sw" // standard input (motherboard)
45573        // 0x0010 - "dil sw" // standard input (motherboard)
45574        PORT_MODIFY("IN-18")
45575        // 0x0001 - "dil sw" // standard input (motherboard)
45576        // 0x0002 - "dil sw" // standard input (motherboard)
45577        // 0x0004 - "dil sw" // standard input (motherboard)
45578        // 0x0008 - "dil sw" // standard input (motherboard)
45579        // 0x0010 - "dil sw" // standard input (motherboard)
45580        PORT_MODIFY("IN-19")
45581        // 0x0001 - "dil sw" // standard input (motherboard)
45582        PORT_MODIFY("IN-20")
45583        // 0x0001 - "green" // standard input (motherboard)
45584        // 0x0002 - "cashbo" // standard input (expected here)
45585        // 0x0008 - "zijdeu" // standard input (expected here)
45586        // 0x0010 - "boekho" // standard input (expected here)
45536      PORT_INCLUDE( sc4_base )
45537      PORT_MODIFY("IN-1")
45538      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
45539      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45540      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45541      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45542      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kop")
45543      PORT_MODIFY("IN-2")
45544      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("munt")
45545      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45546      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45547      PORT_MODIFY("IN-3")
45548      // 0x0001 - "uitbet" // unexpected here
45549      // 0x0002 - "neem c" // unexpected here
45550      // 0x0004 - "neem w" // standard input (expected here)
45551      // 0x0010 - "info/l" // standard input (expected here)
45552      PORT_MODIFY("IN-4")
45553      // 0x0001 - "l hop" // unexpected here
45554      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45555      // 0x0004 - "l hop" // unexpected here
45556      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45557      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45558      PORT_MODIFY("IN-5")
45559      // 0x0001 - "l lege" // standard input (expected here)
45560      // 0x0002 - "r lege" // standard input (expected here)
45561      // 0x0004 - "dump" // standard input (expected here)
45562      PORT_MODIFY("IN-16")
45563      // 0x0001 - "dil sw" // standard input (motherboard)
45564      // 0x0002 - "dil sw" // standard input (motherboard)
45565      // 0x0004 - "dil sw" // standard input (motherboard)
45566      // 0x0008 - "dil sw" // standard input (motherboard)
45567      // 0x0010 - "dil sw" // standard input (motherboard)
45568      PORT_MODIFY("IN-17")
45569      // 0x0001 - "dil sw" // standard input (motherboard)
45570      // 0x0002 - "dil sw" // standard input (motherboard)
45571      // 0x0004 - "dil sw" // standard input (motherboard)
45572      // 0x0008 - "dil sw" // standard input (motherboard)
45573      // 0x0010 - "dil sw" // standard input (motherboard)
45574      PORT_MODIFY("IN-18")
45575      // 0x0001 - "dil sw" // standard input (motherboard)
45576      // 0x0002 - "dil sw" // standard input (motherboard)
45577      // 0x0004 - "dil sw" // standard input (motherboard)
45578      // 0x0008 - "dil sw" // standard input (motherboard)
45579      // 0x0010 - "dil sw" // standard input (motherboard)
45580      PORT_MODIFY("IN-19")
45581      // 0x0001 - "dil sw" // standard input (motherboard)
45582      PORT_MODIFY("IN-20")
45583      // 0x0001 - "green" // standard input (motherboard)
45584      // 0x0002 - "cashbo" // standard input (expected here)
45585      // 0x0008 - "zijdeu" // standard input (expected here)
45586      // 0x0010 - "boekho" // standard input (expected here)
4558745587INPUT_PORTS_END
4558845588
4558945589GAMEL( 200?, sc4gamcs    ,0,         sc4, sc4gamcs, sc4_state, sc4game, ROT0, "BFM","The Game Casino (Dutch) (Bellfruit) (Scorpion 4)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 ) // PR1224 THE GAME CASINO         95004285 THEGAME PR1153
r31373r31374
4560645606}
4560745607
4560845608INPUT_PORTS_START( sc4goud ) // this structure is generated
45609        PORT_INCLUDE( sc4_base )
45610        PORT_MODIFY("IN-1")
45611        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("vast 1")
45612        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 2")
45613        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 3")
45614        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 4")
45615        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("herste")
45616        PORT_MODIFY("IN-2")
45617        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("neem p")
45618        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stop OR wissel")
45619        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45620        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45621        PORT_MODIFY("IN-4")
45622        // 0x0001 - "l hop" // unexpected here
45623        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45624        // 0x0004 - "l hop" // unexpected here
45625        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45626        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45627        PORT_MODIFY("IN-5")
45628        // 0x0001 - "l lege" // standard input (expected here)
45629        // 0x0002 - "r lege" // standard input (expected here)
45630        // 0x0004 - "dump" // standard input (expected here)
45631        PORT_MODIFY("IN-8")
45632        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("uitbet")
45633        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("player")
45634        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi lef")
45635        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi mid")
45636        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi rig")
45637        PORT_MODIFY("IN-9")
45638        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("neem g")
45639        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("lo lef")
45640        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("lo mid")
45641        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("lo rig")
45642        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("neem s")
45643        PORT_MODIFY("IN-16")
45644        // 0x0001 - "dil sw" // standard input (motherboard)
45645        // 0x0002 - "dil sw" // standard input (motherboard)
45646        // 0x0004 - "dil sw" // standard input (motherboard)
45647        // 0x0008 - "dil sw" // standard input (motherboard)
45648        // 0x0010 - "dil sw" // standard input (motherboard)
45649        PORT_MODIFY("IN-17")
45650        // 0x0001 - "dil sw" // standard input (motherboard)
45651        // 0x0002 - "dil sw" // standard input (motherboard)
45652        // 0x0004 - "dil sw" // standard input (motherboard)
45653        // 0x0008 - "dil sw" // standard input (motherboard)
45654        // 0x0010 - "dil sw" // standard input (motherboard)
45655        PORT_MODIFY("IN-18")
45656        // 0x0001 - "dil sw" // standard input (motherboard)
45657        // 0x0002 - "dil sw" // standard input (motherboard)
45658        // 0x0004 - "dil sw" // standard input (motherboard)
45659        // 0x0008 - "dil sw" // standard input (motherboard)
45660        // 0x0010 - "dil sw" // standard input (motherboard)
45661        PORT_MODIFY("IN-19")
45662        // 0x0001 - "dil sw" // standard input (motherboard)
45663        PORT_MODIFY("IN-20")
45664        // 0x0001 - "green" // standard input (motherboard)
45665        // 0x0002 - "cashbo" // standard input (expected here)
45666        // 0x0008 - "zijdeu" // standard input (expected here)
45667        // 0x0010 - "boekho" // standard input (expected here)
45609      PORT_INCLUDE( sc4_base )
45610      PORT_MODIFY("IN-1")
45611      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("vast 1")
45612      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 2")
45613      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 3")
45614      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 4")
45615      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("herste")
45616      PORT_MODIFY("IN-2")
45617      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("neem p")
45618      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("stop OR wissel")
45619      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45620      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45621      PORT_MODIFY("IN-4")
45622      // 0x0001 - "l hop" // unexpected here
45623      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45624      // 0x0004 - "l hop" // unexpected here
45625      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45626      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45627      PORT_MODIFY("IN-5")
45628      // 0x0001 - "l lege" // standard input (expected here)
45629      // 0x0002 - "r lege" // standard input (expected here)
45630      // 0x0004 - "dump" // standard input (expected here)
45631      PORT_MODIFY("IN-8")
45632      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("uitbet")
45633      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("player")
45634      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("hi lef")
45635      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi mid")
45636      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi rig")
45637      PORT_MODIFY("IN-9")
45638      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("neem g")
45639      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("lo lef")
45640      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("lo mid")
45641      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("lo rig")
45642      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_4 ) PORT_NAME("neem s")
45643      PORT_MODIFY("IN-16")
45644      // 0x0001 - "dil sw" // standard input (motherboard)
45645      // 0x0002 - "dil sw" // standard input (motherboard)
45646      // 0x0004 - "dil sw" // standard input (motherboard)
45647      // 0x0008 - "dil sw" // standard input (motherboard)
45648      // 0x0010 - "dil sw" // standard input (motherboard)
45649      PORT_MODIFY("IN-17")
45650      // 0x0001 - "dil sw" // standard input (motherboard)
45651      // 0x0002 - "dil sw" // standard input (motherboard)
45652      // 0x0004 - "dil sw" // standard input (motherboard)
45653      // 0x0008 - "dil sw" // standard input (motherboard)
45654      // 0x0010 - "dil sw" // standard input (motherboard)
45655      PORT_MODIFY("IN-18")
45656      // 0x0001 - "dil sw" // standard input (motherboard)
45657      // 0x0002 - "dil sw" // standard input (motherboard)
45658      // 0x0004 - "dil sw" // standard input (motherboard)
45659      // 0x0008 - "dil sw" // standard input (motherboard)
45660      // 0x0010 - "dil sw" // standard input (motherboard)
45661      PORT_MODIFY("IN-19")
45662      // 0x0001 - "dil sw" // standard input (motherboard)
45663      PORT_MODIFY("IN-20")
45664      // 0x0001 - "green" // standard input (motherboard)
45665      // 0x0002 - "cashbo" // standard input (expected here)
45666      // 0x0008 - "zijdeu" // standard input (expected here)
45667      // 0x0010 - "boekho" // standard input (expected here)
4566845668INPUT_PORTS_END
4566945669
4567045670
r31373r31374
4568945689}
4569045690
4569145691INPUT_PORTS_START( sc4lasv ) // this structure is generated
45692        PORT_INCLUDE( sc4_base )
45693        PORT_MODIFY("IN-1")
45694        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45695        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45696        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45697        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45698        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("k inze")
45699        PORT_MODIFY("IN-2")
45700        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("k spel")
45701        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45702        PORT_MODIFY("IN-3")
45703        // 0x0001 - "uitbet" // unexpected here
45704        // 0x0002 - "n hoog" // unexpected here
45705        // 0x0004 - "n winb" // standard input (expected here)
45706        // 0x0008 - "vegas" // standard input (expected here)
45707        // 0x0010 - "call a" // standard input (expected here)
45708        PORT_MODIFY("IN-5")
45709        // 0x0004 - "black" // standard input (expected here)
45710        PORT_MODIFY("IN-16")
45711        // 0x0001 - "dil sw" // standard input (motherboard)
45712        // 0x0002 - "dil sw" // standard input (motherboard)
45713        // 0x0004 - "dil sw" // standard input (motherboard)
45714        // 0x0008 - "dil sw" // standard input (motherboard)
45715        // 0x0010 - "dil sw" // standard input (motherboard)
45716        PORT_MODIFY("IN-17")
45717        // 0x0001 - "dil sw" // standard input (motherboard)
45718        // 0x0002 - "dil sw" // standard input (motherboard)
45719        // 0x0004 - "dil sw" // standard input (motherboard)
45720        // 0x0008 - "dil sw" // standard input (motherboard)
45721        // 0x0010 - "dil sw" // standard input (motherboard)
45722        PORT_MODIFY("IN-18")
45723        // 0x0001 - "dil sw" // standard input (motherboard)
45724        // 0x0002 - "dil sw" // standard input (motherboard)
45725        // 0x0004 - "dil sw" // standard input (motherboard)
45726        // 0x0008 - "dil sw" // standard input (motherboard)
45727        // 0x0010 - "dil sw" // standard input (motherboard)
45728        PORT_MODIFY("IN-19")
45729        // 0x0001 - "dil sw" // standard input (motherboard)
45730        PORT_MODIFY("IN-20")
45731        // 0x0001 - "green" // standard input (motherboard)
45732        // 0x0002 - "cashbo" // standard input (expected here)
45692      PORT_INCLUDE( sc4_base )
45693      PORT_MODIFY("IN-1")
45694      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45695      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45696      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45697      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45698      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("k inze")
45699      PORT_MODIFY("IN-2")
45700      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("k spel")
45701      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45702      PORT_MODIFY("IN-3")
45703      // 0x0001 - "uitbet" // unexpected here
45704      // 0x0002 - "n hoog" // unexpected here
45705      // 0x0004 - "n winb" // standard input (expected here)
45706      // 0x0008 - "vegas" // standard input (expected here)
45707      // 0x0010 - "call a" // standard input (expected here)
45708      PORT_MODIFY("IN-5")
45709      // 0x0004 - "black" // standard input (expected here)
45710      PORT_MODIFY("IN-16")
45711      // 0x0001 - "dil sw" // standard input (motherboard)
45712      // 0x0002 - "dil sw" // standard input (motherboard)
45713      // 0x0004 - "dil sw" // standard input (motherboard)
45714      // 0x0008 - "dil sw" // standard input (motherboard)
45715      // 0x0010 - "dil sw" // standard input (motherboard)
45716      PORT_MODIFY("IN-17")
45717      // 0x0001 - "dil sw" // standard input (motherboard)
45718      // 0x0002 - "dil sw" // standard input (motherboard)
45719      // 0x0004 - "dil sw" // standard input (motherboard)
45720      // 0x0008 - "dil sw" // standard input (motherboard)
45721      // 0x0010 - "dil sw" // standard input (motherboard)
45722      PORT_MODIFY("IN-18")
45723      // 0x0001 - "dil sw" // standard input (motherboard)
45724      // 0x0002 - "dil sw" // standard input (motherboard)
45725      // 0x0004 - "dil sw" // standard input (motherboard)
45726      // 0x0008 - "dil sw" // standard input (motherboard)
45727      // 0x0010 - "dil sw" // standard input (motherboard)
45728      PORT_MODIFY("IN-19")
45729      // 0x0001 - "dil sw" // standard input (motherboard)
45730      PORT_MODIFY("IN-20")
45731      // 0x0001 - "green" // standard input (motherboard)
45732      // 0x0002 - "cashbo" // standard input (expected here)
4573345733INPUT_PORTS_END
4573445734
4573545735// PR1209 LAS VEGAS         95004261 LASVEGAS PR7159
r31373r31374
4575345753}
4575445754
4575545755INPUT_PORTS_START( sc4miljo ) // this structure is generated
45756        PORT_INCLUDE( sc4_base )
45757        PORT_MODIFY("IN-1")
45758        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45759        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45760        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45761        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45762        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("k inze")
45763        PORT_MODIFY("IN-2")
45764        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("munt")
45765        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45766        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45767        PORT_MODIFY("IN-3")
45768        // 0x0001 - "uitbet" // unexpected here
45769        // 0x0002 - "n club" // unexpected here
45770        // 0x0010 - "player" // standard input (expected here)
45771        PORT_MODIFY("IN-4")
45772        // 0x0001 - "l hop" // unexpected here
45773        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45774        // 0x0004 - "l hop" // unexpected here
45775        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45776        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45777        PORT_MODIFY("IN-5")
45778        // 0x0001 - "l lege" // standard input (expected here)
45779        // 0x0002 - "r lege" // standard input (expected here)
45780        // 0x0004 - "dump" // standard input (expected here)
45781        PORT_MODIFY("IN-16")
45782        // 0x0001 - "dil sw" // standard input (motherboard)
45783        // 0x0002 - "dil sw" // standard input (motherboard)
45784        // 0x0004 - "dil sw" // standard input (motherboard)
45785        // 0x0008 - "dil sw" // standard input (motherboard)
45786        // 0x0010 - "dil sw" // standard input (motherboard)
45787        PORT_MODIFY("IN-17")
45788        // 0x0001 - "dil sw" // standard input (motherboard)
45789        // 0x0002 - "dil sw" // standard input (motherboard)
45790        // 0x0004 - "dil sw" // standard input (motherboard)
45791        // 0x0008 - "dil sw" // standard input (motherboard)
45792        // 0x0010 - "dil sw" // standard input (motherboard)
45793        PORT_MODIFY("IN-18")
45794        // 0x0001 - "dil sw" // standard input (motherboard)
45795        // 0x0002 - "dil sw" // standard input (motherboard)
45796        // 0x0004 - "dil sw" // standard input (motherboard)
45797        // 0x0008 - "dil sw" // standard input (motherboard)
45798        // 0x0010 - "dil sw" // standard input (motherboard)
45799        PORT_MODIFY("IN-19")
45800        // 0x0001 - "dil sw" // standard input (motherboard)
45801        PORT_MODIFY("IN-20")
45802        // 0x0001 - "green" // standard input (motherboard)
45803        // 0x0002 - "cashbo" // standard input (expected here)
45804        // 0x0008 - "zijdeu" // standard input (expected here)
45805        // 0x0010 - "boekho" // standard input (expected here)
45756      PORT_INCLUDE( sc4_base )
45757      PORT_MODIFY("IN-1")
45758      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45759      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45760      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45761      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45762      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("k inze")
45763      PORT_MODIFY("IN-2")
45764      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("munt")
45765      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45766      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45767      PORT_MODIFY("IN-3")
45768      // 0x0001 - "uitbet" // unexpected here
45769      // 0x0002 - "n club" // unexpected here
45770      // 0x0010 - "player" // standard input (expected here)
45771      PORT_MODIFY("IN-4")
45772      // 0x0001 - "l hop" // unexpected here
45773      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45774      // 0x0004 - "l hop" // unexpected here
45775      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45776      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45777      PORT_MODIFY("IN-5")
45778      // 0x0001 - "l lege" // standard input (expected here)
45779      // 0x0002 - "r lege" // standard input (expected here)
45780      // 0x0004 - "dump" // standard input (expected here)
45781      PORT_MODIFY("IN-16")
45782      // 0x0001 - "dil sw" // standard input (motherboard)
45783      // 0x0002 - "dil sw" // standard input (motherboard)
45784      // 0x0004 - "dil sw" // standard input (motherboard)
45785      // 0x0008 - "dil sw" // standard input (motherboard)
45786      // 0x0010 - "dil sw" // standard input (motherboard)
45787      PORT_MODIFY("IN-17")
45788      // 0x0001 - "dil sw" // standard input (motherboard)
45789      // 0x0002 - "dil sw" // standard input (motherboard)
45790      // 0x0004 - "dil sw" // standard input (motherboard)
45791      // 0x0008 - "dil sw" // standard input (motherboard)
45792      // 0x0010 - "dil sw" // standard input (motherboard)
45793      PORT_MODIFY("IN-18")
45794      // 0x0001 - "dil sw" // standard input (motherboard)
45795      // 0x0002 - "dil sw" // standard input (motherboard)
45796      // 0x0004 - "dil sw" // standard input (motherboard)
45797      // 0x0008 - "dil sw" // standard input (motherboard)
45798      // 0x0010 - "dil sw" // standard input (motherboard)
45799      PORT_MODIFY("IN-19")
45800      // 0x0001 - "dil sw" // standard input (motherboard)
45801      PORT_MODIFY("IN-20")
45802      // 0x0001 - "green" // standard input (motherboard)
45803      // 0x0002 - "cashbo" // standard input (expected here)
45804      // 0x0008 - "zijdeu" // standard input (expected here)
45805      // 0x0010 - "boekho" // standard input (expected here)
4580645806INPUT_PORTS_END
4580745807
4580845808INPUT_PORTS_START( sc4milja ) // this structure is generated
45809        PORT_INCLUDE( sc4_base )
45810        PORT_MODIFY("IN-1")
45811        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45812        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45813        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45814        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45815        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("k inze")
45816        PORT_MODIFY("IN-2")
45817        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("k spel")
45818        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45819        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45820        PORT_MODIFY("IN-3")
45821        // 0x0001 - "uitbet" // unexpected here
45822        // 0x0002 - "n hoog" // unexpected here
45823        // 0x0004 - "n winb" // standard input (expected here)
45824        // 0x0010 - "roep b" // standard input (expected here)
45825        PORT_MODIFY("IN-4")
45826        // 0x0001 - "l hop" // unexpected here
45827        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45828        // 0x0004 - "l hop" // unexpected here
45829        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45830        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45831        PORT_MODIFY("IN-5")
45832        // 0x0001 - "l lege" // standard input (expected here)
45833        // 0x0002 - "r lege" // standard input (expected here)
45834        // 0x0004 - "dump" // standard input (expected here)
45835        PORT_MODIFY("IN-16")
45836        // 0x0001 - "dil sw" // standard input (motherboard)
45837        // 0x0002 - "dil sw" // standard input (motherboard)
45838        // 0x0004 - "dil sw" // standard input (motherboard)
45839        // 0x0008 - "dil sw" // standard input (motherboard)
45840        // 0x0010 - "dil sw" // standard input (motherboard)
45841        PORT_MODIFY("IN-17")
45842        // 0x0001 - "dil sw" // standard input (motherboard)
45843        // 0x0002 - "dil sw" // standard input (motherboard)
45844        // 0x0004 - "dil sw" // standard input (motherboard)
45845        // 0x0008 - "dil sw" // standard input (motherboard)
45846        // 0x0010 - "dil sw" // standard input (motherboard)
45847        PORT_MODIFY("IN-18")
45848        // 0x0001 - "dil sw" // standard input (motherboard)
45849        // 0x0002 - "dil sw" // standard input (motherboard)
45850        // 0x0004 - "dil sw" // standard input (motherboard)
45851        // 0x0008 - "dil sw" // standard input (motherboard)
45852        // 0x0010 - "dil sw" // standard input (motherboard)
45853        PORT_MODIFY("IN-19")
45854        // 0x0001 - "dil sw" // standard input (motherboard)
45855        PORT_MODIFY("IN-20")
45856        // 0x0001 - "green" // standard input (motherboard)
45857        // 0x0002 - "cashbo" // standard input (expected here)
45858        // 0x0008 - "zijdeu" // standard input (expected here)
45859        // 0x0010 - "boekho" // standard input (expected here)
45809      PORT_INCLUDE( sc4_base )
45810      PORT_MODIFY("IN-1")
45811      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45812      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45813      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45814      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45815      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("k inze")
45816      PORT_MODIFY("IN-2")
45817      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("k spel")
45818      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45819      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45820      PORT_MODIFY("IN-3")
45821      // 0x0001 - "uitbet" // unexpected here
45822      // 0x0002 - "n hoog" // unexpected here
45823      // 0x0004 - "n winb" // standard input (expected here)
45824      // 0x0010 - "roep b" // standard input (expected here)
45825      PORT_MODIFY("IN-4")
45826      // 0x0001 - "l hop" // unexpected here
45827      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45828      // 0x0004 - "l hop" // unexpected here
45829      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45830      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45831      PORT_MODIFY("IN-5")
45832      // 0x0001 - "l lege" // standard input (expected here)
45833      // 0x0002 - "r lege" // standard input (expected here)
45834      // 0x0004 - "dump" // standard input (expected here)
45835      PORT_MODIFY("IN-16")
45836      // 0x0001 - "dil sw" // standard input (motherboard)
45837      // 0x0002 - "dil sw" // standard input (motherboard)
45838      // 0x0004 - "dil sw" // standard input (motherboard)
45839      // 0x0008 - "dil sw" // standard input (motherboard)
45840      // 0x0010 - "dil sw" // standard input (motherboard)
45841      PORT_MODIFY("IN-17")
45842      // 0x0001 - "dil sw" // standard input (motherboard)
45843      // 0x0002 - "dil sw" // standard input (motherboard)
45844      // 0x0004 - "dil sw" // standard input (motherboard)
45845      // 0x0008 - "dil sw" // standard input (motherboard)
45846      // 0x0010 - "dil sw" // standard input (motherboard)
45847      PORT_MODIFY("IN-18")
45848      // 0x0001 - "dil sw" // standard input (motherboard)
45849      // 0x0002 - "dil sw" // standard input (motherboard)
45850      // 0x0004 - "dil sw" // standard input (motherboard)
45851      // 0x0008 - "dil sw" // standard input (motherboard)
45852      // 0x0010 - "dil sw" // standard input (motherboard)
45853      PORT_MODIFY("IN-19")
45854      // 0x0001 - "dil sw" // standard input (motherboard)
45855      PORT_MODIFY("IN-20")
45856      // 0x0001 - "green" // standard input (motherboard)
45857      // 0x0002 - "cashbo" // standard input (expected here)
45858      // 0x0008 - "zijdeu" // standard input (expected here)
45859      // 0x0010 - "boekho" // standard input (expected here)
4586045860INPUT_PORTS_END
4586145861
4586245862GAMEL( 200?, sc4miljo    ,0,         sc4, sc4miljo, sc4_state, sc4miljo, ROT0, "BFM","Miljonairs (Dutch) (Bellfruit) (Scorpion 4) (set 1)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 ) // PR1217 MILJONAIRSART12         95004305 MILJONAIRE PR1157
r31373r31374
4587945879}
4588045880
4588145881INPUT_PORTS_START( sc4paytm ) // this structure is generated
45882        PORT_INCLUDE( sc4_base )
45883        PORT_MODIFY("IN-1")
45884        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
45885        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45886        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45887        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45888        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies i")
45889        PORT_MODIFY("IN-2")
45890        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies s")
45891        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45892        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45893        PORT_MODIFY("IN-3")
45894        // 0x0001 - "uitbet" // unexpected here
45895        // 0x0002 - "n hoog" // unexpected here
45896        // 0x0004 - "n winb" // standard input (expected here)
45897        // 0x0010 - "roep b" // standard input (expected here)
45898        PORT_MODIFY("IN-4")
45899        // 0x0001 - "l hop" // unexpected here
45900        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45901        // 0x0004 - "l hop" // unexpected here
45902        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45903        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45904        PORT_MODIFY("IN-5")
45905        // 0x0001 - "l lege" // standard input (expected here)
45906        // 0x0002 - "r lege" // standard input (expected here)
45907        // 0x0004 - "dump" // standard input (expected here)
45908        PORT_MODIFY("IN-16")
45909        // 0x0001 - "dil sw" // standard input (motherboard)
45910        // 0x0002 - "dil sw" // standard input (motherboard)
45911        // 0x0004 - "dil sw" // standard input (motherboard)
45912        // 0x0008 - "dil sw" // standard input (motherboard)
45913        // 0x0010 - "dil sw" // standard input (motherboard)
45914        PORT_MODIFY("IN-17")
45915        // 0x0001 - "dil sw" // standard input (motherboard)
45916        // 0x0002 - "dil sw" // standard input (motherboard)
45917        // 0x0004 - "dil sw" // standard input (motherboard)
45918        // 0x0008 - "dil sw" // standard input (motherboard)
45919        // 0x0010 - "dil sw" // standard input (motherboard)
45920        PORT_MODIFY("IN-18")
45921        // 0x0001 - "dil sw" // standard input (motherboard)
45922        // 0x0002 - "dil sw" // standard input (motherboard)
45923        // 0x0004 - "dil sw" // standard input (motherboard)
45924        // 0x0008 - "dil sw" // standard input (motherboard)
45925        // 0x0010 - "dil sw" // standard input (motherboard)
45926        PORT_MODIFY("IN-19")
45927        // 0x0001 - "dil sw" // standard input (motherboard)
45928        PORT_MODIFY("IN-20")
45929        // 0x0001 - "green" // standard input (motherboard)
45930        // 0x0002 - "cashbo" // standard input (expected here)
45931        // 0x0008 - "zijdeu" // standard input (expected here)
45932        // 0x0010 - "boekho" // standard input (expected here)
45882      PORT_INCLUDE( sc4_base )
45883      PORT_MODIFY("IN-1")
45884      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
45885      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45886      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45887      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45888      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies i")
45889      PORT_MODIFY("IN-2")
45890      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies s")
45891      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
45892      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45893      PORT_MODIFY("IN-3")
45894      // 0x0001 - "uitbet" // unexpected here
45895      // 0x0002 - "n hoog" // unexpected here
45896      // 0x0004 - "n winb" // standard input (expected here)
45897      // 0x0010 - "roep b" // standard input (expected here)
45898      PORT_MODIFY("IN-4")
45899      // 0x0001 - "l hop" // unexpected here
45900      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45901      // 0x0004 - "l hop" // unexpected here
45902      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
45903      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45904      PORT_MODIFY("IN-5")
45905      // 0x0001 - "l lege" // standard input (expected here)
45906      // 0x0002 - "r lege" // standard input (expected here)
45907      // 0x0004 - "dump" // standard input (expected here)
45908      PORT_MODIFY("IN-16")
45909      // 0x0001 - "dil sw" // standard input (motherboard)
45910      // 0x0002 - "dil sw" // standard input (motherboard)
45911      // 0x0004 - "dil sw" // standard input (motherboard)
45912      // 0x0008 - "dil sw" // standard input (motherboard)
45913      // 0x0010 - "dil sw" // standard input (motherboard)
45914      PORT_MODIFY("IN-17")
45915      // 0x0001 - "dil sw" // standard input (motherboard)
45916      // 0x0002 - "dil sw" // standard input (motherboard)
45917      // 0x0004 - "dil sw" // standard input (motherboard)
45918      // 0x0008 - "dil sw" // standard input (motherboard)
45919      // 0x0010 - "dil sw" // standard input (motherboard)
45920      PORT_MODIFY("IN-18")
45921      // 0x0001 - "dil sw" // standard input (motherboard)
45922      // 0x0002 - "dil sw" // standard input (motherboard)
45923      // 0x0004 - "dil sw" // standard input (motherboard)
45924      // 0x0008 - "dil sw" // standard input (motherboard)
45925      // 0x0010 - "dil sw" // standard input (motherboard)
45926      PORT_MODIFY("IN-19")
45927      // 0x0001 - "dil sw" // standard input (motherboard)
45928      PORT_MODIFY("IN-20")
45929      // 0x0001 - "green" // standard input (motherboard)
45930      // 0x0002 - "cashbo" // standard input (expected here)
45931      // 0x0008 - "zijdeu" // standard input (expected here)
45932      // 0x0010 - "boekho" // standard input (expected here)
4593345933INPUT_PORTS_END
4593445934
4593545935//  PR1205 PAY TIME         95004224 PAYTIME PR7156             PAY TIME
r31373r31374
4595345953}
4595445954
4595545955INPUT_PORTS_START( sc4pglcs ) // this structure is generated
45956        PORT_INCLUDE( sc4_base )
45957        PORT_MODIFY("IN-1")
45958        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45959        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45960        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45961        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45962        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kop")
45963        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("zijdeu OR l hop OR r hop")
45964        PORT_MODIFY("IN-2")
45965        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("munt")
45966        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
45967        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45968        PORT_MODIFY("IN-3")
45969        // 0x0001 - "uitbet" // unexpected here
45970        // 0x0002 - "n hgst" // unexpected here
45971        // 0x0004 - "n winb" // standard input (expected here)
45972        // 0x0010 - "roep" // standard input (expected here)
45973        PORT_MODIFY("IN-4")
45974        // 0x0001 - "l hop" // unexpected here
45975        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45976        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45977        PORT_MODIFY("IN-16")
45978        // 0x0001 - "dil sw" // standard input (motherboard)
45979        // 0x0002 - "dil sw" // standard input (motherboard)
45980        // 0x0004 - "dil sw" // standard input (motherboard)
45981        // 0x0008 - "dil sw" // standard input (motherboard)
45982        // 0x0010 - "dil sw" // standard input (motherboard)
45983        PORT_MODIFY("IN-17")
45984        // 0x0001 - "dil sw" // standard input (motherboard)
45985        // 0x0002 - "dil sw" // standard input (motherboard)
45986        // 0x0004 - "dil sw" // standard input (motherboard)
45987        // 0x0008 - "dil sw" // standard input (motherboard)
45988        // 0x0010 - "dil sw" // standard input (motherboard)
45989        PORT_MODIFY("IN-18")
45990        // 0x0001 - "dil sw" // standard input (motherboard)
45991        // 0x0002 - "dil sw" // standard input (motherboard)
45992        // 0x0004 - "dil sw" // standard input (motherboard)
45993        // 0x0008 - "dil sw" // standard input (motherboard)
45994        // 0x0010 - "dil sw" // standard input (motherboard)
45995        PORT_MODIFY("IN-19")
45996        // 0x0001 - "dil sw" // standard input (motherboard)
45997        PORT_MODIFY("IN-20")
45998        // 0x0001 - "green" // standard input (motherboard)
45999        // 0x0002 - "cashbo" // standard input (expected here)
46000        // 0x0008 - "dump" // standard input (expected here)
46001        // 0x0010 - "boekho" // standard input (expected here)
45956      PORT_INCLUDE( sc4_base )
45957      PORT_MODIFY("IN-1")
45958      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
45959      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
45960      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
45961      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
45962      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kop")
45963      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("zijdeu OR l hop OR r hop")
45964      PORT_MODIFY("IN-2")
45965      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("munt")
45966      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
45967      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
45968      PORT_MODIFY("IN-3")
45969      // 0x0001 - "uitbet" // unexpected here
45970      // 0x0002 - "n hgst" // unexpected here
45971      // 0x0004 - "n winb" // standard input (expected here)
45972      // 0x0010 - "roep" // standard input (expected here)
45973      PORT_MODIFY("IN-4")
45974      // 0x0001 - "l hop" // unexpected here
45975      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
45976      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
45977      PORT_MODIFY("IN-16")
45978      // 0x0001 - "dil sw" // standard input (motherboard)
45979      // 0x0002 - "dil sw" // standard input (motherboard)
45980      // 0x0004 - "dil sw" // standard input (motherboard)
45981      // 0x0008 - "dil sw" // standard input (motherboard)
45982      // 0x0010 - "dil sw" // standard input (motherboard)
45983      PORT_MODIFY("IN-17")
45984      // 0x0001 - "dil sw" // standard input (motherboard)
45985      // 0x0002 - "dil sw" // standard input (motherboard)
45986      // 0x0004 - "dil sw" // standard input (motherboard)
45987      // 0x0008 - "dil sw" // standard input (motherboard)
45988      // 0x0010 - "dil sw" // standard input (motherboard)
45989      PORT_MODIFY("IN-18")
45990      // 0x0001 - "dil sw" // standard input (motherboard)
45991      // 0x0002 - "dil sw" // standard input (motherboard)
45992      // 0x0004 - "dil sw" // standard input (motherboard)
45993      // 0x0008 - "dil sw" // standard input (motherboard)
45994      // 0x0010 - "dil sw" // standard input (motherboard)
45995      PORT_MODIFY("IN-19")
45996      // 0x0001 - "dil sw" // standard input (motherboard)
45997      PORT_MODIFY("IN-20")
45998      // 0x0001 - "green" // standard input (motherboard)
45999      // 0x0002 - "cashbo" // standard input (expected here)
46000      // 0x0008 - "dump" // standard input (expected here)
46001      // 0x0010 - "boekho" // standard input (expected here)
4600246002INPUT_PORTS_END
4600346003
4600446004//  PR1261 PHARAOH'S GOLD         95004316 CAS PHAR GOLD PR1261
r31373r31374
4602346023}
4602446024
4602546025INPUT_PORTS_START( sc4redad ) // this structure is generated
46026        PORT_INCLUDE( sc4_base )
46027        PORT_MODIFY("IN-1")
46028        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46029        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46030        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46031        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46032        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies i")
46033        PORT_MODIFY("IN-2")
46034        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies s")
46035        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46036        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46037        PORT_MODIFY("IN-3")
46038        // 0x0001 - "uitbet" // unexpected here
46039        // 0x0002 - "naar c" // unexpected here
46040        // 0x0004 - "neem w" // standard input (expected here)
46041        // 0x0010 - "roep" // standard input (expected here)
46042        PORT_MODIFY("IN-4")
46043        // 0x0001 - "l hop" // unexpected here
46044        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46045        // 0x0004 - "l hop" // unexpected here
46046        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46047        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46048        PORT_MODIFY("IN-5")
46049        // 0x0001 - "l lege" // standard input (expected here)
46050        // 0x0002 - "r lege" // standard input (expected here)
46051        // 0x0004 - "dump" // standard input (expected here)
46052        PORT_MODIFY("IN-16")
46053        // 0x0001 - "dil sw" // standard input (motherboard)
46054        // 0x0002 - "dil sw" // standard input (motherboard)
46055        // 0x0004 - "dil sw" // standard input (motherboard)
46056        // 0x0008 - "dil sw" // standard input (motherboard)
46057        // 0x0010 - "dil sw" // standard input (motherboard)
46058        PORT_MODIFY("IN-17")
46059        // 0x0001 - "dil sw" // standard input (motherboard)
46060        // 0x0002 - "dil sw" // standard input (motherboard)
46061        // 0x0004 - "dil sw" // standard input (motherboard)
46062        // 0x0008 - "dil sw" // standard input (motherboard)
46063        // 0x0010 - "dil sw" // standard input (motherboard)
46064        PORT_MODIFY("IN-18")
46065        // 0x0001 - "dil sw" // standard input (motherboard)
46066        // 0x0002 - "dil sw" // standard input (motherboard)
46067        // 0x0004 - "dil sw" // standard input (motherboard)
46068        // 0x0008 - "dil sw" // standard input (motherboard)
46069        // 0x0010 - "dil sw" // standard input (motherboard)
46070        PORT_MODIFY("IN-19")
46071        // 0x0001 - "dil sw" // standard input (motherboard)
46072        PORT_MODIFY("IN-20")
46073        // 0x0001 - "green" // standard input (motherboard)
46074        // 0x0002 - "cashbo" // standard input (expected here)
46075        // 0x0008 - "zijdeu" // standard input (expected here)
46076        // 0x0010 - "boekho" // standard input (expected here)
46026      PORT_INCLUDE( sc4_base )
46027      PORT_MODIFY("IN-1")
46028      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46029      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46030      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46031      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46032      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies i")
46033      PORT_MODIFY("IN-2")
46034      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies s")
46035      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46036      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46037      PORT_MODIFY("IN-3")
46038      // 0x0001 - "uitbet" // unexpected here
46039      // 0x0002 - "naar c" // unexpected here
46040      // 0x0004 - "neem w" // standard input (expected here)
46041      // 0x0010 - "roep" // standard input (expected here)
46042      PORT_MODIFY("IN-4")
46043      // 0x0001 - "l hop" // unexpected here
46044      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46045      // 0x0004 - "l hop" // unexpected here
46046      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46047      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46048      PORT_MODIFY("IN-5")
46049      // 0x0001 - "l lege" // standard input (expected here)
46050      // 0x0002 - "r lege" // standard input (expected here)
46051      // 0x0004 - "dump" // standard input (expected here)
46052      PORT_MODIFY("IN-16")
46053      // 0x0001 - "dil sw" // standard input (motherboard)
46054      // 0x0002 - "dil sw" // standard input (motherboard)
46055      // 0x0004 - "dil sw" // standard input (motherboard)
46056      // 0x0008 - "dil sw" // standard input (motherboard)
46057      // 0x0010 - "dil sw" // standard input (motherboard)
46058      PORT_MODIFY("IN-17")
46059      // 0x0001 - "dil sw" // standard input (motherboard)
46060      // 0x0002 - "dil sw" // standard input (motherboard)
46061      // 0x0004 - "dil sw" // standard input (motherboard)
46062      // 0x0008 - "dil sw" // standard input (motherboard)
46063      // 0x0010 - "dil sw" // standard input (motherboard)
46064      PORT_MODIFY("IN-18")
46065      // 0x0001 - "dil sw" // standard input (motherboard)
46066      // 0x0002 - "dil sw" // standard input (motherboard)
46067      // 0x0004 - "dil sw" // standard input (motherboard)
46068      // 0x0008 - "dil sw" // standard input (motherboard)
46069      // 0x0010 - "dil sw" // standard input (motherboard)
46070      PORT_MODIFY("IN-19")
46071      // 0x0001 - "dil sw" // standard input (motherboard)
46072      PORT_MODIFY("IN-20")
46073      // 0x0001 - "green" // standard input (motherboard)
46074      // 0x0002 - "cashbo" // standard input (expected here)
46075      // 0x0008 - "zijdeu" // standard input (expected here)
46076      // 0x0010 - "boekho" // standard input (expected here)
4607746077INPUT_PORTS_END
4607846078
4607946079// PR1206 RED ALERT         95004266 REDALERT PR1051
r31373r31374
4609846098}
4609946099
4610046100INPUT_PORTS_START( sc4rvlnx ) // this structure is generated
46101        PORT_INCLUDE( sc4_base )
46102        PORT_MODIFY("IN-1")
46103        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("vast 1")
46104        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 2")
46105        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 3")
46106        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 4")
46107        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("herste")
46108        PORT_MODIFY("IN-2")
46109        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46110        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46111        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46112        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46113        PORT_MODIFY("IN-3")
46114        // 0x0001 - "uitbet" // unexpected here
46115        // 0x0002 - "neem c" // unexpected here
46116        // 0x0010 - "info/l" // standard input (expected here)
46117        PORT_MODIFY("IN-4")
46118        // 0x0001 - "l hop" // unexpected here
46119        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46120        // 0x0004 - "l hop" // unexpected here
46121        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46122        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46123        PORT_MODIFY("IN-5")
46124        // 0x0004 - "dump" // standard input (expected here)
46125        PORT_MODIFY("IN-16")
46126        // 0x0001 - "dil sw" // standard input (motherboard)
46127        // 0x0002 - "dil sw" // standard input (motherboard)
46128        // 0x0004 - "dil sw" // standard input (motherboard)
46129        // 0x0008 - "dil sw" // standard input (motherboard)
46130        // 0x0010 - "dil sw" // standard input (motherboard)
46131        PORT_MODIFY("IN-17")
46132        // 0x0001 - "dil sw" // standard input (motherboard)
46133        // 0x0002 - "dil sw" // standard input (motherboard)
46134        // 0x0004 - "dil sw" // standard input (motherboard)
46135        // 0x0008 - "dil sw" // standard input (motherboard)
46136        // 0x0010 - "dil sw" // standard input (motherboard)
46137        PORT_MODIFY("IN-18")
46138        // 0x0001 - "dil sw" // standard input (motherboard)
46139        // 0x0002 - "dil sw" // standard input (motherboard)
46140        // 0x0004 - "dil sw" // standard input (motherboard)
46141        // 0x0008 - "dil sw" // standard input (motherboard)
46142        // 0x0010 - "dil sw" // standard input (motherboard)
46143        PORT_MODIFY("IN-19")
46144        // 0x0001 - "dil sw" // standard input (motherboard)
46145        PORT_MODIFY("IN-20")
46146        // 0x0001 - "green" // standard input (motherboard)
46147        // 0x0002 - "cashbo" // standard input (expected here)
46148        // 0x0008 - "zijdeu" // standard input (expected here)
46149        // 0x0010 - "boekho" // standard input (expected here)
46101      PORT_INCLUDE( sc4_base )
46102      PORT_MODIFY("IN-1")
46103      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("vast 1")
46104      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 2")
46105      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 3")
46106      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 4")
46107      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("herste")
46108      PORT_MODIFY("IN-2")
46109      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46110      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46111      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46112      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46113      PORT_MODIFY("IN-3")
46114      // 0x0001 - "uitbet" // unexpected here
46115      // 0x0002 - "neem c" // unexpected here
46116      // 0x0010 - "info/l" // standard input (expected here)
46117      PORT_MODIFY("IN-4")
46118      // 0x0001 - "l hop" // unexpected here
46119      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46120      // 0x0004 - "l hop" // unexpected here
46121      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46122      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46123      PORT_MODIFY("IN-5")
46124      // 0x0004 - "dump" // standard input (expected here)
46125      PORT_MODIFY("IN-16")
46126      // 0x0001 - "dil sw" // standard input (motherboard)
46127      // 0x0002 - "dil sw" // standard input (motherboard)
46128      // 0x0004 - "dil sw" // standard input (motherboard)
46129      // 0x0008 - "dil sw" // standard input (motherboard)
46130      // 0x0010 - "dil sw" // standard input (motherboard)
46131      PORT_MODIFY("IN-17")
46132      // 0x0001 - "dil sw" // standard input (motherboard)
46133      // 0x0002 - "dil sw" // standard input (motherboard)
46134      // 0x0004 - "dil sw" // standard input (motherboard)
46135      // 0x0008 - "dil sw" // standard input (motherboard)
46136      // 0x0010 - "dil sw" // standard input (motherboard)
46137      PORT_MODIFY("IN-18")
46138      // 0x0001 - "dil sw" // standard input (motherboard)
46139      // 0x0002 - "dil sw" // standard input (motherboard)
46140      // 0x0004 - "dil sw" // standard input (motherboard)
46141      // 0x0008 - "dil sw" // standard input (motherboard)
46142      // 0x0010 - "dil sw" // standard input (motherboard)
46143      PORT_MODIFY("IN-19")
46144      // 0x0001 - "dil sw" // standard input (motherboard)
46145      PORT_MODIFY("IN-20")
46146      // 0x0001 - "green" // standard input (motherboard)
46147      // 0x0002 - "cashbo" // standard input (expected here)
46148      // 0x0008 - "zijdeu" // standard input (expected here)
46149      // 0x0010 - "boekho" // standard input (expected here)
4615046150INPUT_PORTS_END
4615146151
4615246152// PR1252 REVOLUTION  NEXT         95004320 REVOLUTIONTN PR1252
r31373r31374
4616946169}
4617046170
4617146171INPUT_PORTS_START( sc4rvl ) // this structure is generated
46172        PORT_INCLUDE( sc4_base )
46173        PORT_MODIFY("IN-1")
46174        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("vast 1")
46175        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 2")
46176        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 3")
46177        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 4")
46178        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("herste")
46179        PORT_MODIFY("IN-2")
46180        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46181        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46182        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46183        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46184        PORT_MODIFY("IN-3")
46185        // 0x0001 - "uitbet" // unexpected here
46186        // 0x0002 - "n hoog" // unexpected here
46187        // 0x0004 - "n winb" // standard input (expected here)
46188        // 0x0010 - "r behe" // standard input (expected here)
46189        PORT_MODIFY("IN-4")
46190        // 0x0001 - "l hop" // unexpected here
46191        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46192        // 0x0004 - "l hop" // unexpected here
46193        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46194        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46195        PORT_MODIFY("IN-5")
46196        // 0x0001 - "l lege" // standard input (expected here)
46197        // 0x0002 - "r lege" // standard input (expected here)
46198        // 0x0004 - "dump" // standard input (expected here)
46199        PORT_MODIFY("IN-16")
46200        // 0x0001 - "dil sw" // standard input (motherboard)
46201        // 0x0002 - "dil sw" // standard input (motherboard)
46202        // 0x0004 - "dil sw" // standard input (motherboard)
46203        // 0x0008 - "dil sw" // standard input (motherboard)
46204        // 0x0010 - "dil sw" // standard input (motherboard)
46205        PORT_MODIFY("IN-17")
46206        // 0x0001 - "dil sw" // standard input (motherboard)
46207        // 0x0002 - "dil sw" // standard input (motherboard)
46208        // 0x0004 - "dil sw" // standard input (motherboard)
46209        // 0x0008 - "dil sw" // standard input (motherboard)
46210        // 0x0010 - "dil sw" // standard input (motherboard)
46211        PORT_MODIFY("IN-18")
46212        // 0x0001 - "dil sw" // standard input (motherboard)
46213        // 0x0002 - "dil sw" // standard input (motherboard)
46214        // 0x0004 - "dil sw" // standard input (motherboard)
46215        // 0x0008 - "dil sw" // standard input (motherboard)
46216        // 0x0010 - "dil sw" // standard input (motherboard)
46217        PORT_MODIFY("IN-19")
46218        // 0x0001 - "dil sw" // standard input (motherboard)
46219        PORT_MODIFY("IN-20")
46220        // 0x0001 - "green" // standard input (motherboard)
46221        // 0x0002 - "cashbo" // standard input (expected here)
46222        // 0x0008 - "zijdeu" // standard input (expected here)
46223        // 0x0010 - "boekho" // standard input (expected here)
46172      PORT_INCLUDE( sc4_base )
46173      PORT_MODIFY("IN-1")
46174      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("vast 1")
46175      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 2")
46176      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 3")
46177      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 4")
46178      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("herste")
46179      PORT_MODIFY("IN-2")
46180      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46181      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46182      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46183      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46184      PORT_MODIFY("IN-3")
46185      // 0x0001 - "uitbet" // unexpected here
46186      // 0x0002 - "n hoog" // unexpected here
46187      // 0x0004 - "n winb" // standard input (expected here)
46188      // 0x0010 - "r behe" // standard input (expected here)
46189      PORT_MODIFY("IN-4")
46190      // 0x0001 - "l hop" // unexpected here
46191      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46192      // 0x0004 - "l hop" // unexpected here
46193      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46194      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46195      PORT_MODIFY("IN-5")
46196      // 0x0001 - "l lege" // standard input (expected here)
46197      // 0x0002 - "r lege" // standard input (expected here)
46198      // 0x0004 - "dump" // standard input (expected here)
46199      PORT_MODIFY("IN-16")
46200      // 0x0001 - "dil sw" // standard input (motherboard)
46201      // 0x0002 - "dil sw" // standard input (motherboard)
46202      // 0x0004 - "dil sw" // standard input (motherboard)
46203      // 0x0008 - "dil sw" // standard input (motherboard)
46204      // 0x0010 - "dil sw" // standard input (motherboard)
46205      PORT_MODIFY("IN-17")
46206      // 0x0001 - "dil sw" // standard input (motherboard)
46207      // 0x0002 - "dil sw" // standard input (motherboard)
46208      // 0x0004 - "dil sw" // standard input (motherboard)
46209      // 0x0008 - "dil sw" // standard input (motherboard)
46210      // 0x0010 - "dil sw" // standard input (motherboard)
46211      PORT_MODIFY("IN-18")
46212      // 0x0001 - "dil sw" // standard input (motherboard)
46213      // 0x0002 - "dil sw" // standard input (motherboard)
46214      // 0x0004 - "dil sw" // standard input (motherboard)
46215      // 0x0008 - "dil sw" // standard input (motherboard)
46216      // 0x0010 - "dil sw" // standard input (motherboard)
46217      PORT_MODIFY("IN-19")
46218      // 0x0001 - "dil sw" // standard input (motherboard)
46219      PORT_MODIFY("IN-20")
46220      // 0x0001 - "green" // standard input (motherboard)
46221      // 0x0002 - "cashbo" // standard input (expected here)
46222      // 0x0008 - "zijdeu" // standard input (expected here)
46223      // 0x0010 - "boekho" // standard input (expected here)
4622446224INPUT_PORTS_END
4622546225
4622646226// PR1203 REVOLUTION         95004259 REVOLUTION PR7158
r31373r31374
4624346243}
4624446244
4624546245INPUT_PORTS_START( sc4rio ) // this structure is generated
46246        PORT_INCLUDE( sc4_base )
46247        PORT_MODIFY("IN-1")
46248        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46249        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46250        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46251        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46252        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies i")
46253        PORT_MODIFY("IN-2")
46254        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies s")
46255        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46256        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46257        PORT_MODIFY("IN-3")
46258        // 0x0001 - "neem w" // unexpected here
46259        // 0x0002 - "neem h" // unexpected here
46260        // 0x0004 - "uitbet" // standard input (expected here)
46261        // 0x0010 - "roep" // standard input (expected here)
46262        PORT_MODIFY("IN-4")
46263        // 0x0001 - "l hop" // unexpected here
46264        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46265        // 0x0004 - "l hop" // unexpected here
46266        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46267        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46268        PORT_MODIFY("IN-5")
46269        // 0x0001 - "l lege" // standard input (expected here)
46270        // 0x0002 - "r lege" // standard input (expected here)
46271        // 0x0004 - "black" // standard input (expected here)
46272        PORT_MODIFY("IN-16")
46273        // 0x0001 - "dil sw" // standard input (motherboard)
46274        // 0x0002 - "dil sw" // standard input (motherboard)
46275        // 0x0004 - "dil sw" // standard input (motherboard)
46276        // 0x0008 - "dil sw" // standard input (motherboard)
46277        // 0x0010 - "dil sw" // standard input (motherboard)
46278        PORT_MODIFY("IN-17")
46279        // 0x0001 - "dil sw" // standard input (motherboard)
46280        // 0x0002 - "dil sw" // standard input (motherboard)
46281        // 0x0004 - "dil sw" // standard input (motherboard)
46282        // 0x0008 - "dil sw" // standard input (motherboard)
46283        // 0x0010 - "dil sw" // standard input (motherboard)
46284        PORT_MODIFY("IN-18")
46285        // 0x0001 - "dil sw" // standard input (motherboard)
46286        // 0x0002 - "dil sw" // standard input (motherboard)
46287        // 0x0004 - "dil sw" // standard input (motherboard)
46288        // 0x0008 - "dil sw" // standard input (motherboard)
46289        // 0x0010 - "dil sw" // standard input (motherboard)
46290        PORT_MODIFY("IN-19")
46291        // 0x0001 - "dil sw" // standard input (motherboard)
46292        PORT_MODIFY("IN-20")
46293        // 0x0001 - "green" // standard input (motherboard)
46294        // 0x0002 - "cashbo" // standard input (expected here)
46295        // 0x0008 - "zijdeu" // standard input (expected here)
46296        // 0x0010 - "boekho" // standard input (expected here)
46246      PORT_INCLUDE( sc4_base )
46247      PORT_MODIFY("IN-1")
46248      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46249      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46250      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46251      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46252      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies i")
46253      PORT_MODIFY("IN-2")
46254      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies s")
46255      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46256      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46257      PORT_MODIFY("IN-3")
46258      // 0x0001 - "neem w" // unexpected here
46259      // 0x0002 - "neem h" // unexpected here
46260      // 0x0004 - "uitbet" // standard input (expected here)
46261      // 0x0010 - "roep" // standard input (expected here)
46262      PORT_MODIFY("IN-4")
46263      // 0x0001 - "l hop" // unexpected here
46264      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46265      // 0x0004 - "l hop" // unexpected here
46266      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46267      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46268      PORT_MODIFY("IN-5")
46269      // 0x0001 - "l lege" // standard input (expected here)
46270      // 0x0002 - "r lege" // standard input (expected here)
46271      // 0x0004 - "black" // standard input (expected here)
46272      PORT_MODIFY("IN-16")
46273      // 0x0001 - "dil sw" // standard input (motherboard)
46274      // 0x0002 - "dil sw" // standard input (motherboard)
46275      // 0x0004 - "dil sw" // standard input (motherboard)
46276      // 0x0008 - "dil sw" // standard input (motherboard)
46277      // 0x0010 - "dil sw" // standard input (motherboard)
46278      PORT_MODIFY("IN-17")
46279      // 0x0001 - "dil sw" // standard input (motherboard)
46280      // 0x0002 - "dil sw" // standard input (motherboard)
46281      // 0x0004 - "dil sw" // standard input (motherboard)
46282      // 0x0008 - "dil sw" // standard input (motherboard)
46283      // 0x0010 - "dil sw" // standard input (motherboard)
46284      PORT_MODIFY("IN-18")
46285      // 0x0001 - "dil sw" // standard input (motherboard)
46286      // 0x0002 - "dil sw" // standard input (motherboard)
46287      // 0x0004 - "dil sw" // standard input (motherboard)
46288      // 0x0008 - "dil sw" // standard input (motherboard)
46289      // 0x0010 - "dil sw" // standard input (motherboard)
46290      PORT_MODIFY("IN-19")
46291      // 0x0001 - "dil sw" // standard input (motherboard)
46292      PORT_MODIFY("IN-20")
46293      // 0x0001 - "green" // standard input (motherboard)
46294      // 0x0002 - "cashbo" // standard input (expected here)
46295      // 0x0008 - "zijdeu" // standard input (expected here)
46296      // 0x0010 - "boekho" // standard input (expected here)
4629746297INPUT_PORTS_END
4629846298
4629946299// PR1222    RIO GRANDE         95004309 RIO GRANDE SOUNDS11
r31373r31374
4631746317}
4631846318
4631946319INPUT_PORTS_START( sc4strbr ) // this structure is generated
46320        PORT_INCLUDE( sc4_base )
46321        PORT_MODIFY("IN-1")
46322        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46323        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46324        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46325        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46326        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies i")
46327        PORT_MODIFY("IN-2")
46328        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies s")
46329        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46330        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46331        PORT_MODIFY("IN-3")
46332        // 0x0001 - "uitbet" // unexpected here
46333        // 0x0002 - "neem c" // unexpected here
46334        // 0x0004 - "neem s" // standard input (expected here)
46335        // 0x0010 - "info/l" // standard input (expected here)
46336        PORT_MODIFY("IN-4")
46337        // 0x0001 - "l hop" // unexpected here
46338        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46339        // 0x0004 - "l hop" // unexpected here
46340        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46341        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46342        PORT_MODIFY("IN-5")
46343        // 0x0001 - "l lege" // standard input (expected here)
46344        // 0x0002 - "r lege" // standard input (expected here)
46345        // 0x0004 - "dump" // standard input (expected here)
46346        PORT_MODIFY("IN-16")
46347        // 0x0001 - "dil sw" // standard input (motherboard)
46348        // 0x0002 - "dil sw" // standard input (motherboard)
46349        // 0x0004 - "dil sw" // standard input (motherboard)
46350        // 0x0008 - "dil sw" // standard input (motherboard)
46351        // 0x0010 - "dil sw" // standard input (motherboard)
46352        PORT_MODIFY("IN-17")
46353        // 0x0001 - "dil sw" // standard input (motherboard)
46354        // 0x0002 - "dil sw" // standard input (motherboard)
46355        // 0x0004 - "dil sw" // standard input (motherboard)
46356        // 0x0008 - "dil sw" // standard input (motherboard)
46357        // 0x0010 - "dil sw" // standard input (motherboard)
46358        PORT_MODIFY("IN-18")
46359        // 0x0001 - "dil sw" // standard input (motherboard)
46360        // 0x0002 - "dil sw" // standard input (motherboard)
46361        // 0x0004 - "dil sw" // standard input (motherboard)
46362        // 0x0008 - "dil sw" // standard input (motherboard)
46363        // 0x0010 - "dil sw" // standard input (motherboard)
46364        PORT_MODIFY("IN-19")
46365        // 0x0001 - "dil sw" // standard input (motherboard)
46366        PORT_MODIFY("IN-20")
46367        // 0x0001 - "green" // standard input (motherboard)
46368        // 0x0002 - "cashbo" // standard input (expected here)
46369        // 0x0008 - "zijdeu" // standard input (expected here)
46370        // 0x0010 - "boekho" // standard input (expected here)
46320      PORT_INCLUDE( sc4_base )
46321      PORT_MODIFY("IN-1")
46322      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46323      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46324      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46325      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46326      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies i")
46327      PORT_MODIFY("IN-2")
46328      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies s")
46329      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46330      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46331      PORT_MODIFY("IN-3")
46332      // 0x0001 - "uitbet" // unexpected here
46333      // 0x0002 - "neem c" // unexpected here
46334      // 0x0004 - "neem s" // standard input (expected here)
46335      // 0x0010 - "info/l" // standard input (expected here)
46336      PORT_MODIFY("IN-4")
46337      // 0x0001 - "l hop" // unexpected here
46338      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46339      // 0x0004 - "l hop" // unexpected here
46340      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46341      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46342      PORT_MODIFY("IN-5")
46343      // 0x0001 - "l lege" // standard input (expected here)
46344      // 0x0002 - "r lege" // standard input (expected here)
46345      // 0x0004 - "dump" // standard input (expected here)
46346      PORT_MODIFY("IN-16")
46347      // 0x0001 - "dil sw" // standard input (motherboard)
46348      // 0x0002 - "dil sw" // standard input (motherboard)
46349      // 0x0004 - "dil sw" // standard input (motherboard)
46350      // 0x0008 - "dil sw" // standard input (motherboard)
46351      // 0x0010 - "dil sw" // standard input (motherboard)
46352      PORT_MODIFY("IN-17")
46353      // 0x0001 - "dil sw" // standard input (motherboard)
46354      // 0x0002 - "dil sw" // standard input (motherboard)
46355      // 0x0004 - "dil sw" // standard input (motherboard)
46356      // 0x0008 - "dil sw" // standard input (motherboard)
46357      // 0x0010 - "dil sw" // standard input (motherboard)
46358      PORT_MODIFY("IN-18")
46359      // 0x0001 - "dil sw" // standard input (motherboard)
46360      // 0x0002 - "dil sw" // standard input (motherboard)
46361      // 0x0004 - "dil sw" // standard input (motherboard)
46362      // 0x0008 - "dil sw" // standard input (motherboard)
46363      // 0x0010 - "dil sw" // standard input (motherboard)
46364      PORT_MODIFY("IN-19")
46365      // 0x0001 - "dil sw" // standard input (motherboard)
46366      PORT_MODIFY("IN-20")
46367      // 0x0001 - "green" // standard input (motherboard)
46368      // 0x0002 - "cashbo" // standard input (expected here)
46369      // 0x0008 - "zijdeu" // standard input (expected here)
46370      // 0x0010 - "boekho" // standard input (expected here)
4637146371INPUT_PORTS_END
4637246372
4637346373INPUT_PORTS_START( sc4strbra ) // this structure is generated
46374        PORT_INCLUDE( sc4_base )
46375        PORT_MODIFY("IN-1")
46376        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46377        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46378        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46379        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46380        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("neem s")
46381        PORT_MODIFY("IN-2")
46382        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46383        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46384        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46385        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46386        PORT_MODIFY("IN-3")
46387        // 0x0001 - "uitbet" // unexpected here
46388        // 0x0002 - "neem h" // unexpected here
46389        // 0x0004 - "neem w" // standard input (expected here)
46390        // 0x0010 - "roep" // standard input (expected here)
46391        PORT_MODIFY("IN-4")
46392        // 0x0001 - "l hop" // unexpected here
46393        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46394        // 0x0004 - "l hop" // unexpected here
46395        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46396        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46397        PORT_MODIFY("IN-5")
46398        // 0x0001 - "l lege" // standard input (expected here)
46399        // 0x0002 - "r lege" // standard input (expected here)
46400        // 0x0004 - "dump" // standard input (expected here)
46401        PORT_MODIFY("IN-16")
46402        // 0x0001 - "dil sw" // standard input (motherboard)
46403        // 0x0002 - "dil sw" // standard input (motherboard)
46404        // 0x0004 - "dil sw" // standard input (motherboard)
46405        // 0x0008 - "dil sw" // standard input (motherboard)
46406        // 0x0010 - "dil sw" // standard input (motherboard)
46407        PORT_MODIFY("IN-17")
46408        // 0x0001 - "dil sw" // standard input (motherboard)
46409        // 0x0002 - "dil sw" // standard input (motherboard)
46410        // 0x0004 - "dil sw" // standard input (motherboard)
46411        // 0x0008 - "dil sw" // standard input (motherboard)
46412        // 0x0010 - "dil sw" // standard input (motherboard)
46413        PORT_MODIFY("IN-18")
46414        // 0x0001 - "dil sw" // standard input (motherboard)
46415        // 0x0002 - "dil sw" // standard input (motherboard)
46416        // 0x0004 - "dil sw" // standard input (motherboard)
46417        // 0x0008 - "dil sw" // standard input (motherboard)
46418        // 0x0010 - "dil sw" // standard input (motherboard)
46419        PORT_MODIFY("IN-19")
46420        // 0x0001 - "dil sw" // standard input (motherboard)
46421        PORT_MODIFY("IN-20")
46422        // 0x0001 - "green" // standard input (motherboard)
46423        // 0x0002 - "cashbo" // standard input (expected here)
46424        // 0x0008 - "zijdeu" // standard input (expected here)
46425        // 0x0010 - "boekho" // standard input (expected here)
46374      PORT_INCLUDE( sc4_base )
46375      PORT_MODIFY("IN-1")
46376      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46377      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46378      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46379      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46380      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("neem s")
46381      PORT_MODIFY("IN-2")
46382      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46383      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46384      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46385      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46386      PORT_MODIFY("IN-3")
46387      // 0x0001 - "uitbet" // unexpected here
46388      // 0x0002 - "neem h" // unexpected here
46389      // 0x0004 - "neem w" // standard input (expected here)
46390      // 0x0010 - "roep" // standard input (expected here)
46391      PORT_MODIFY("IN-4")
46392      // 0x0001 - "l hop" // unexpected here
46393      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46394      // 0x0004 - "l hop" // unexpected here
46395      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46396      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46397      PORT_MODIFY("IN-5")
46398      // 0x0001 - "l lege" // standard input (expected here)
46399      // 0x0002 - "r lege" // standard input (expected here)
46400      // 0x0004 - "dump" // standard input (expected here)
46401      PORT_MODIFY("IN-16")
46402      // 0x0001 - "dil sw" // standard input (motherboard)
46403      // 0x0002 - "dil sw" // standard input (motherboard)
46404      // 0x0004 - "dil sw" // standard input (motherboard)
46405      // 0x0008 - "dil sw" // standard input (motherboard)
46406      // 0x0010 - "dil sw" // standard input (motherboard)
46407      PORT_MODIFY("IN-17")
46408      // 0x0001 - "dil sw" // standard input (motherboard)
46409      // 0x0002 - "dil sw" // standard input (motherboard)
46410      // 0x0004 - "dil sw" // standard input (motherboard)
46411      // 0x0008 - "dil sw" // standard input (motherboard)
46412      // 0x0010 - "dil sw" // standard input (motherboard)
46413      PORT_MODIFY("IN-18")
46414      // 0x0001 - "dil sw" // standard input (motherboard)
46415      // 0x0002 - "dil sw" // standard input (motherboard)
46416      // 0x0004 - "dil sw" // standard input (motherboard)
46417      // 0x0008 - "dil sw" // standard input (motherboard)
46418      // 0x0010 - "dil sw" // standard input (motherboard)
46419      PORT_MODIFY("IN-19")
46420      // 0x0001 - "dil sw" // standard input (motherboard)
46421      PORT_MODIFY("IN-20")
46422      // 0x0001 - "green" // standard input (motherboard)
46423      // 0x0002 - "cashbo" // standard input (expected here)
46424      // 0x0008 - "zijdeu" // standard input (expected here)
46425      // 0x0010 - "boekho" // standard input (expected here)
4642646426INPUT_PORTS_END
4642746427
4642846428// PR1219 STARS 'N BARS         95004290 STARSNBARS PR1159
r31373r31374
4645146451
4645246452
4645346453INPUT_PORTS_START( sc4twilt ) // this structure is generated
46454        PORT_INCLUDE( sc4_base )
46455        PORT_MODIFY("IN-1")
46456        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46457        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46458        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46459        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46460        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("vast 4")
46461        PORT_MODIFY("IN-2")
46462        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46463        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46464        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46465        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46466        PORT_MODIFY("IN-3")
46467        // 0x0001 - "uitbet" // unexpected here
46468        // 0x0002 - "neem c" // unexpected here
46469        // 0x0010 - "info/l" // standard input (expected here)
46470        PORT_MODIFY("IN-4")
46471        // 0x0001 - "l hop" // unexpected here
46472        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46473        // 0x0004 - "l hop" // unexpected here
46474        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46475        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46476        PORT_MODIFY("IN-5")
46477        // 0x0001 - "l lege" // standard input (expected here)
46478        // 0x0002 - "r lege" // standard input (expected here)
46479        // 0x0004 - "dump" // standard input (expected here)
46480        PORT_MODIFY("IN-16")
46481        // 0x0001 - "dil sw" // standard input (motherboard)
46482        // 0x0002 - "dil sw" // standard input (motherboard)
46483        // 0x0004 - "dil sw" // standard input (motherboard)
46484        // 0x0008 - "dil sw" // standard input (motherboard)
46485        // 0x0010 - "dil sw" // standard input (motherboard)
46486        PORT_MODIFY("IN-17")
46487        // 0x0001 - "dil sw" // standard input (motherboard)
46488        // 0x0002 - "dil sw" // standard input (motherboard)
46489        // 0x0004 - "dil sw" // standard input (motherboard)
46490        // 0x0008 - "dil sw" // standard input (motherboard)
46491        // 0x0010 - "dil sw" // standard input (motherboard)
46492        PORT_MODIFY("IN-18")
46493        // 0x0001 - "dil sw" // standard input (motherboard)
46494        // 0x0002 - "dil sw" // standard input (motherboard)
46495        // 0x0004 - "dil sw" // standard input (motherboard)
46496        // 0x0008 - "dil sw" // standard input (motherboard)
46497        // 0x0010 - "dil sw" // standard input (motherboard)
46498        PORT_MODIFY("IN-19")
46499        // 0x0001 - "dil sw" // standard input (motherboard)
46500        PORT_MODIFY("IN-20")
46501        // 0x0001 - "green" // standard input (motherboard)
46502        // 0x0002 - "cashbo" // standard input (expected here)
46503        // 0x0008 - "zijdeu" // standard input (expected here)
46504        // 0x0010 - "boekho" // standard input (expected here)
46454      PORT_INCLUDE( sc4_base )
46455      PORT_MODIFY("IN-1")
46456      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46457      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46458      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46459      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46460      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("vast 4")
46461      PORT_MODIFY("IN-2")
46462      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46463      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46464      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46465      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46466      PORT_MODIFY("IN-3")
46467      // 0x0001 - "uitbet" // unexpected here
46468      // 0x0002 - "neem c" // unexpected here
46469      // 0x0010 - "info/l" // standard input (expected here)
46470      PORT_MODIFY("IN-4")
46471      // 0x0001 - "l hop" // unexpected here
46472      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46473      // 0x0004 - "l hop" // unexpected here
46474      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46475      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46476      PORT_MODIFY("IN-5")
46477      // 0x0001 - "l lege" // standard input (expected here)
46478      // 0x0002 - "r lege" // standard input (expected here)
46479      // 0x0004 - "dump" // standard input (expected here)
46480      PORT_MODIFY("IN-16")
46481      // 0x0001 - "dil sw" // standard input (motherboard)
46482      // 0x0002 - "dil sw" // standard input (motherboard)
46483      // 0x0004 - "dil sw" // standard input (motherboard)
46484      // 0x0008 - "dil sw" // standard input (motherboard)
46485      // 0x0010 - "dil sw" // standard input (motherboard)
46486      PORT_MODIFY("IN-17")
46487      // 0x0001 - "dil sw" // standard input (motherboard)
46488      // 0x0002 - "dil sw" // standard input (motherboard)
46489      // 0x0004 - "dil sw" // standard input (motherboard)
46490      // 0x0008 - "dil sw" // standard input (motherboard)
46491      // 0x0010 - "dil sw" // standard input (motherboard)
46492      PORT_MODIFY("IN-18")
46493      // 0x0001 - "dil sw" // standard input (motherboard)
46494      // 0x0002 - "dil sw" // standard input (motherboard)
46495      // 0x0004 - "dil sw" // standard input (motherboard)
46496      // 0x0008 - "dil sw" // standard input (motherboard)
46497      // 0x0010 - "dil sw" // standard input (motherboard)
46498      PORT_MODIFY("IN-19")
46499      // 0x0001 - "dil sw" // standard input (motherboard)
46500      PORT_MODIFY("IN-20")
46501      // 0x0001 - "green" // standard input (motherboard)
46502      // 0x0002 - "cashbo" // standard input (expected here)
46503      // 0x0008 - "zijdeu" // standard input (expected here)
46504      // 0x0010 - "boekho" // standard input (expected here)
4650546505INPUT_PORTS_END
4650646506
4650746507// PR1214 TWILIGHT         95004299 TWILIGHT PR1154
r31373r31374
4652546525}
4652646526
4652746527INPUT_PORTS_START( sc4monsp ) // this structure is generated
46528        PORT_INCLUDE( sc4_base )
46529        PORT_MODIFY("IN-1")
46530        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("vast 1")
46531        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 2")
46532        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 3")
46533        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 4")
46534        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("herst")
46535        PORT_MODIFY("IN-2")
46536        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kop")
46537        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("munt")
46538        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46539        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46540        PORT_MODIFY("IN-3")
46541        // 0x0001 - "uitbet" // unexpected here
46542        // 0x0002 - "n club" // unexpected here
46543        // 0x0010 - "player" // standard input (expected here)
46544        PORT_MODIFY("IN-4")
46545        // 0x0001 - "l hop" // unexpected here
46546        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46547        // 0x0004 - "l hop" // unexpected here
46548        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46549        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46550        PORT_MODIFY("IN-5")
46551        // 0x0001 - "l lege" // standard input (expected here)
46552        // 0x0002 - "r lege" // standard input (expected here)
46553        // 0x0004 - "dump" // standard input (expected here)
46554        PORT_MODIFY("IN-16")
46555        // 0x0001 - "dil sw" // standard input (motherboard)
46556        // 0x0002 - "dil sw" // standard input (motherboard)
46557        // 0x0004 - "dil sw" // standard input (motherboard)
46558        // 0x0008 - "dil sw" // standard input (motherboard)
46559        // 0x0010 - "dil sw" // standard input (motherboard)
46560        PORT_MODIFY("IN-17")
46561        // 0x0001 - "dil sw" // standard input (motherboard)
46562        // 0x0002 - "dil sw" // standard input (motherboard)
46563        // 0x0004 - "dil sw" // standard input (motherboard)
46564        // 0x0008 - "dil sw" // standard input (motherboard)
46565        // 0x0010 - "dil sw" // standard input (motherboard)
46566        PORT_MODIFY("IN-18")
46567        // 0x0001 - "dil sw" // standard input (motherboard)
46568        // 0x0002 - "dil sw" // standard input (motherboard)
46569        // 0x0004 - "dil sw" // standard input (motherboard)
46570        // 0x0008 - "dil sw" // standard input (motherboard)
46571        // 0x0010 - "dil sw" // standard input (motherboard)
46572        PORT_MODIFY("IN-19")
46573        // 0x0001 - "dil sw" // standard input (motherboard)
46574        PORT_MODIFY("IN-20")
46575        // 0x0001 - "green" // standard input (motherboard)
46576        // 0x0002 - "cashbo" // standard input (expected here)
46577        // 0x0008 - "zijdeu" // standard input (expected here)
46578        // 0x0010 - "boekho" // standard input (expected here)
46528      PORT_INCLUDE( sc4_base )
46529      PORT_MODIFY("IN-1")
46530      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("vast 1")
46531      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 2")
46532      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 3")
46533      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 4")
46534      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("herst")
46535      PORT_MODIFY("IN-2")
46536      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kop")
46537      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("munt")
46538      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46539      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46540      PORT_MODIFY("IN-3")
46541      // 0x0001 - "uitbet" // unexpected here
46542      // 0x0002 - "n club" // unexpected here
46543      // 0x0010 - "player" // standard input (expected here)
46544      PORT_MODIFY("IN-4")
46545      // 0x0001 - "l hop" // unexpected here
46546      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46547      // 0x0004 - "l hop" // unexpected here
46548      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46549      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46550      PORT_MODIFY("IN-5")
46551      // 0x0001 - "l lege" // standard input (expected here)
46552      // 0x0002 - "r lege" // standard input (expected here)
46553      // 0x0004 - "dump" // standard input (expected here)
46554      PORT_MODIFY("IN-16")
46555      // 0x0001 - "dil sw" // standard input (motherboard)
46556      // 0x0002 - "dil sw" // standard input (motherboard)
46557      // 0x0004 - "dil sw" // standard input (motherboard)
46558      // 0x0008 - "dil sw" // standard input (motherboard)
46559      // 0x0010 - "dil sw" // standard input (motherboard)
46560      PORT_MODIFY("IN-17")
46561      // 0x0001 - "dil sw" // standard input (motherboard)
46562      // 0x0002 - "dil sw" // standard input (motherboard)
46563      // 0x0004 - "dil sw" // standard input (motherboard)
46564      // 0x0008 - "dil sw" // standard input (motherboard)
46565      // 0x0010 - "dil sw" // standard input (motherboard)
46566      PORT_MODIFY("IN-18")
46567      // 0x0001 - "dil sw" // standard input (motherboard)
46568      // 0x0002 - "dil sw" // standard input (motherboard)
46569      // 0x0004 - "dil sw" // standard input (motherboard)
46570      // 0x0008 - "dil sw" // standard input (motherboard)
46571      // 0x0010 - "dil sw" // standard input (motherboard)
46572      PORT_MODIFY("IN-19")
46573      // 0x0001 - "dil sw" // standard input (motherboard)
46574      PORT_MODIFY("IN-20")
46575      // 0x0001 - "green" // standard input (motherboard)
46576      // 0x0002 - "cashbo" // standard input (expected here)
46577      // 0x0008 - "zijdeu" // standard input (expected here)
46578      // 0x0010 - "boekho" // standard input (expected here)
4657946579INPUT_PORTS_END
4658046580
4658146581// PR1218 MONEY SPINNER ART12         95004291 MONEYSPINNER PR1158
r31373r31374
4659946599}
4660046600
4660146601INPUT_PORTS_START( sc4ivply ) // this structure is generated
46602        PORT_INCLUDE( sc4_base )
46603        PORT_MODIFY("IN-1")
46604        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46605        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46606        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46607        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46608        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("vast 4")
46609        PORT_MODIFY("IN-2")
46610        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46611        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46612        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46613        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46614        PORT_MODIFY("IN-3")
46615        // 0x0001 - "uitbet" // unexpected here
46616        // 0x0002 - "n hoog" // unexpected here
46617        // 0x0004 - "n winb" // standard input (expected here)
46618        // 0x0010 - "roep" // standard input (expected here)
46619        PORT_MODIFY("IN-4")
46620        // 0x0001 - "l hop" // unexpected here
46621        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46622        // 0x0004 - "l hop" // unexpected here
46623        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46624        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46625        PORT_MODIFY("IN-5")
46626        // 0x0001 - "l lege" // standard input (expected here)
46627        // 0x0002 - "r lege" // standard input (expected here)
46628        // 0x0004 - "dump" // standard input (expected here)
46629        PORT_MODIFY("IN-16")
46630        // 0x0001 - "dil sw" // standard input (motherboard)
46631        // 0x0002 - "dil sw" // standard input (motherboard)
46632        // 0x0004 - "dil sw" // standard input (motherboard)
46633        // 0x0008 - "dil sw" // standard input (motherboard)
46634        // 0x0010 - "dil sw" // standard input (motherboard)
46635        PORT_MODIFY("IN-17")
46636        // 0x0001 - "dil sw" // standard input (motherboard)
46637        // 0x0002 - "dil sw" // standard input (motherboard)
46638        // 0x0004 - "dil sw" // standard input (motherboard)
46639        // 0x0008 - "dil sw" // standard input (motherboard)
46640        // 0x0010 - "dil sw" // standard input (motherboard)
46641        PORT_MODIFY("IN-18")
46642        // 0x0001 - "dil sw" // standard input (motherboard)
46643        // 0x0002 - "dil sw" // standard input (motherboard)
46644        // 0x0004 - "dil sw" // standard input (motherboard)
46645        // 0x0008 - "dil sw" // standard input (motherboard)
46646        // 0x0010 - "dil sw" // standard input (motherboard)
46647        PORT_MODIFY("IN-19")
46648        // 0x0001 - "dil sw" // standard input (motherboard)
46649        PORT_MODIFY("IN-20")
46650        // 0x0001 - "green" // standard input (motherboard)
46651        // 0x0002 - "cashbo" // standard input (expected here)
46652        // 0x0008 - "zijdeu" // standard input (expected here)
46653        // 0x0010 - "boekho" // standard input (expected here)
46602      PORT_INCLUDE( sc4_base )
46603      PORT_MODIFY("IN-1")
46604      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46605      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46606      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46607      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46608      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("vast 4")
46609      PORT_MODIFY("IN-2")
46610      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46611      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46612      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46613      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46614      PORT_MODIFY("IN-3")
46615      // 0x0001 - "uitbet" // unexpected here
46616      // 0x0002 - "n hoog" // unexpected here
46617      // 0x0004 - "n winb" // standard input (expected here)
46618      // 0x0010 - "roep" // standard input (expected here)
46619      PORT_MODIFY("IN-4")
46620      // 0x0001 - "l hop" // unexpected here
46621      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46622      // 0x0004 - "l hop" // unexpected here
46623      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46624      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46625      PORT_MODIFY("IN-5")
46626      // 0x0001 - "l lege" // standard input (expected here)
46627      // 0x0002 - "r lege" // standard input (expected here)
46628      // 0x0004 - "dump" // standard input (expected here)
46629      PORT_MODIFY("IN-16")
46630      // 0x0001 - "dil sw" // standard input (motherboard)
46631      // 0x0002 - "dil sw" // standard input (motherboard)
46632      // 0x0004 - "dil sw" // standard input (motherboard)
46633      // 0x0008 - "dil sw" // standard input (motherboard)
46634      // 0x0010 - "dil sw" // standard input (motherboard)
46635      PORT_MODIFY("IN-17")
46636      // 0x0001 - "dil sw" // standard input (motherboard)
46637      // 0x0002 - "dil sw" // standard input (motherboard)
46638      // 0x0004 - "dil sw" // standard input (motherboard)
46639      // 0x0008 - "dil sw" // standard input (motherboard)
46640      // 0x0010 - "dil sw" // standard input (motherboard)
46641      PORT_MODIFY("IN-18")
46642      // 0x0001 - "dil sw" // standard input (motherboard)
46643      // 0x0002 - "dil sw" // standard input (motherboard)
46644      // 0x0004 - "dil sw" // standard input (motherboard)
46645      // 0x0008 - "dil sw" // standard input (motherboard)
46646      // 0x0010 - "dil sw" // standard input (motherboard)
46647      PORT_MODIFY("IN-19")
46648      // 0x0001 - "dil sw" // standard input (motherboard)
46649      PORT_MODIFY("IN-20")
46650      // 0x0001 - "green" // standard input (motherboard)
46651      // 0x0002 - "cashbo" // standard input (expected here)
46652      // 0x0008 - "zijdeu" // standard input (expected here)
46653      // 0x0010 - "boekho" // standard input (expected here)
4665446654INPUT_PORTS_END
4665546655
4665646656
r31373r31374
4667546675
4667646676
4667746677INPUT_PORTS_START( sc4ccc ) // this structure is generated
46678        PORT_INCLUDE( sc4_base )
46679        PORT_MODIFY("IN-1")
46680        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46681        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46682        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46683        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46684        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("vast 4")
46685        PORT_MODIFY("IN-2")
46686        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46687        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46688        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46689        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46690        PORT_MODIFY("IN-3")
46691        // 0x0001 - "uitbet" // unexpected here
46692        // 0x0002 - "n hoog" // unexpected here
46693        // 0x0004 - "n winb" // standard input (expected here)
46694        // 0x0010 - "roep" // standard input (expected here)
46695        PORT_MODIFY("IN-4")
46696        // 0x0001 - "l hop" // unexpected here
46697        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46698        // 0x0004 - "l hop" // unexpected here
46699        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46700        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46701        PORT_MODIFY("IN-5")
46702        // 0x0001 - "l lege" // standard input (expected here)
46703        // 0x0002 - "r lege" // standard input (expected here)
46704        // 0x0004 - "dump" // standard input (expected here)
46705        PORT_MODIFY("IN-16")
46706        // 0x0001 - "dil sw" // standard input (motherboard)
46707        // 0x0002 - "dil sw" // standard input (motherboard)
46708        // 0x0004 - "dil sw" // standard input (motherboard)
46709        // 0x0008 - "dil sw" // standard input (motherboard)
46710        // 0x0010 - "dil sw" // standard input (motherboard)
46711        PORT_MODIFY("IN-17")
46712        // 0x0001 - "dil sw" // standard input (motherboard)
46713        // 0x0002 - "dil sw" // standard input (motherboard)
46714        // 0x0004 - "dil sw" // standard input (motherboard)
46715        // 0x0008 - "dil sw" // standard input (motherboard)
46716        // 0x0010 - "dil sw" // standard input (motherboard)
46717        PORT_MODIFY("IN-18")
46718        // 0x0001 - "dil sw" // standard input (motherboard)
46719        // 0x0002 - "dil sw" // standard input (motherboard)
46720        // 0x0004 - "dil sw" // standard input (motherboard)
46721        // 0x0008 - "dil sw" // standard input (motherboard)
46722        // 0x0010 - "dil sw" // standard input (motherboard)
46723        PORT_MODIFY("IN-19")
46724        // 0x0001 - "dil sw" // standard input (motherboard)
46725        PORT_MODIFY("IN-20")
46726        // 0x0001 - "green" // standard input (motherboard)
46727        // 0x0002 - "cashbo" // standard input (expected here)
46728        // 0x0008 - "zijdeu" // standard input (expected here)
46729        // 0x0010 - "boekho" // standard input (expected here)
46678      PORT_INCLUDE( sc4_base )
46679      PORT_MODIFY("IN-1")
46680      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46681      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46682      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46683      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46684      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("vast 4")
46685      PORT_MODIFY("IN-2")
46686      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46687      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46688      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46689      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46690      PORT_MODIFY("IN-3")
46691      // 0x0001 - "uitbet" // unexpected here
46692      // 0x0002 - "n hoog" // unexpected here
46693      // 0x0004 - "n winb" // standard input (expected here)
46694      // 0x0010 - "roep" // standard input (expected here)
46695      PORT_MODIFY("IN-4")
46696      // 0x0001 - "l hop" // unexpected here
46697      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46698      // 0x0004 - "l hop" // unexpected here
46699      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46700      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46701      PORT_MODIFY("IN-5")
46702      // 0x0001 - "l lege" // standard input (expected here)
46703      // 0x0002 - "r lege" // standard input (expected here)
46704      // 0x0004 - "dump" // standard input (expected here)
46705      PORT_MODIFY("IN-16")
46706      // 0x0001 - "dil sw" // standard input (motherboard)
46707      // 0x0002 - "dil sw" // standard input (motherboard)
46708      // 0x0004 - "dil sw" // standard input (motherboard)
46709      // 0x0008 - "dil sw" // standard input (motherboard)
46710      // 0x0010 - "dil sw" // standard input (motherboard)
46711      PORT_MODIFY("IN-17")
46712      // 0x0001 - "dil sw" // standard input (motherboard)
46713      // 0x0002 - "dil sw" // standard input (motherboard)
46714      // 0x0004 - "dil sw" // standard input (motherboard)
46715      // 0x0008 - "dil sw" // standard input (motherboard)
46716      // 0x0010 - "dil sw" // standard input (motherboard)
46717      PORT_MODIFY("IN-18")
46718      // 0x0001 - "dil sw" // standard input (motherboard)
46719      // 0x0002 - "dil sw" // standard input (motherboard)
46720      // 0x0004 - "dil sw" // standard input (motherboard)
46721      // 0x0008 - "dil sw" // standard input (motherboard)
46722      // 0x0010 - "dil sw" // standard input (motherboard)
46723      PORT_MODIFY("IN-19")
46724      // 0x0001 - "dil sw" // standard input (motherboard)
46725      PORT_MODIFY("IN-20")
46726      // 0x0001 - "green" // standard input (motherboard)
46727      // 0x0002 - "cashbo" // standard input (expected here)
46728      // 0x0008 - "zijdeu" // standard input (expected here)
46729      // 0x0010 - "boekho" // standard input (expected here)
4673046730INPUT_PORTS_END
4673146731
4673246732// PR1221 CRISSCROSSCRAZY  ART13         95004282 CRISSCROSS PR1161
r31373r31374
4674946749}
4675046750
4675146751INPUT_PORTS_START( sc4valqp ) // this structure is generated
46752        PORT_INCLUDE( sc4_base )
46753        PORT_MODIFY("IN-1")
46754        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
46755        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46756        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46757        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46758        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("spel")
46759        PORT_MODIFY("IN-2")
46760        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("inzet")
46761        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46762        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46763        PORT_MODIFY("IN-3")
46764        // 0x0001 - "uitbet" // unexpected here
46765        // 0x0002 - "n club" // unexpected here
46766        // 0x0010 - "player" // standard input (expected here)
46767        PORT_MODIFY("IN-4")
46768        // 0x0001 - "l hop" // unexpected here
46769        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46770        // 0x0004 - "l hop" // unexpected here
46771        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46772        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46773        PORT_MODIFY("IN-5")
46774        // 0x0001 - "l lege" // standard input (expected here)
46775        // 0x0002 - "r lege" // standard input (expected here)
46776        // 0x0004 - "dump" // standard input (expected here)
46777        PORT_MODIFY("IN-16")
46778        // 0x0001 - "dil sw" // standard input (motherboard)
46779        // 0x0002 - "dil sw" // standard input (motherboard)
46780        // 0x0004 - "dil sw" // standard input (motherboard)
46781        // 0x0008 - "dil sw" // standard input (motherboard)
46782        // 0x0010 - "dil sw" // standard input (motherboard)
46783        PORT_MODIFY("IN-17")
46784        // 0x0001 - "dil sw" // standard input (motherboard)
46785        // 0x0002 - "dil sw" // standard input (motherboard)
46786        // 0x0004 - "dil sw" // standard input (motherboard)
46787        // 0x0008 - "dil sw" // standard input (motherboard)
46788        // 0x0010 - "dil sw" // standard input (motherboard)
46789        PORT_MODIFY("IN-18")
46790        // 0x0001 - "dil sw" // standard input (motherboard)
46791        // 0x0002 - "dil sw" // standard input (motherboard)
46792        // 0x0004 - "dil sw" // standard input (motherboard)
46793        // 0x0008 - "dil sw" // standard input (motherboard)
46794        // 0x0010 - "dil sw" // standard input (motherboard)
46795        PORT_MODIFY("IN-19")
46796        // 0x0001 - "dil sw" // standard input (motherboard)
46797        PORT_MODIFY("IN-20")
46798        // 0x0001 - "green" // standard input (motherboard)
46799        // 0x0002 - "cashbo" // standard input (expected here)
46800        // 0x0008 - "zijdeu" // standard input (expected here)
46801        // 0x0010 - "boekho" // standard input (expected here)
46752      PORT_INCLUDE( sc4_base )
46753      PORT_MODIFY("IN-1")
46754      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
46755      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46756      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46757      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46758      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("spel")
46759      PORT_MODIFY("IN-2")
46760      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("inzet")
46761      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46762      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46763      PORT_MODIFY("IN-3")
46764      // 0x0001 - "uitbet" // unexpected here
46765      // 0x0002 - "n club" // unexpected here
46766      // 0x0010 - "player" // standard input (expected here)
46767      PORT_MODIFY("IN-4")
46768      // 0x0001 - "l hop" // unexpected here
46769      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46770      // 0x0004 - "l hop" // unexpected here
46771      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46772      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46773      PORT_MODIFY("IN-5")
46774      // 0x0001 - "l lege" // standard input (expected here)
46775      // 0x0002 - "r lege" // standard input (expected here)
46776      // 0x0004 - "dump" // standard input (expected here)
46777      PORT_MODIFY("IN-16")
46778      // 0x0001 - "dil sw" // standard input (motherboard)
46779      // 0x0002 - "dil sw" // standard input (motherboard)
46780      // 0x0004 - "dil sw" // standard input (motherboard)
46781      // 0x0008 - "dil sw" // standard input (motherboard)
46782      // 0x0010 - "dil sw" // standard input (motherboard)
46783      PORT_MODIFY("IN-17")
46784      // 0x0001 - "dil sw" // standard input (motherboard)
46785      // 0x0002 - "dil sw" // standard input (motherboard)
46786      // 0x0004 - "dil sw" // standard input (motherboard)
46787      // 0x0008 - "dil sw" // standard input (motherboard)
46788      // 0x0010 - "dil sw" // standard input (motherboard)
46789      PORT_MODIFY("IN-18")
46790      // 0x0001 - "dil sw" // standard input (motherboard)
46791      // 0x0002 - "dil sw" // standard input (motherboard)
46792      // 0x0004 - "dil sw" // standard input (motherboard)
46793      // 0x0008 - "dil sw" // standard input (motherboard)
46794      // 0x0010 - "dil sw" // standard input (motherboard)
46795      PORT_MODIFY("IN-19")
46796      // 0x0001 - "dil sw" // standard input (motherboard)
46797      PORT_MODIFY("IN-20")
46798      // 0x0001 - "green" // standard input (motherboard)
46799      // 0x0002 - "cashbo" // standard input (expected here)
46800      // 0x0008 - "zijdeu" // standard input (expected here)
46801      // 0x0010 - "boekho" // standard input (expected here)
4680246802INPUT_PORTS_END
4680346803
4680446804// PR2040E VALHALLA...PR2040 SOUNDS V1.... (non-standard header)
r31373r31374
4682246822}
4682346823
4682446824INPUT_PORTS_START( sc4winxp ) // this structure is generated
46825        PORT_INCLUDE( sc4_base )
46826        PORT_MODIFY("IN-1")
46827        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46828        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46829        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46830        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46831        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("vast 4")
46832        PORT_MODIFY("IN-2")
46833        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46834        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46835        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46836        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46837        PORT_MODIFY("IN-3")
46838        // 0x0001 - "uitbet" // unexpected here
46839        // 0x0002 - "n hoog" // unexpected here
46840        // 0x0004 - "n winb" // standard input (expected here)
46841        PORT_MODIFY("IN-4")
46842        // 0x0001 - "l hop" // unexpected here
46843        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46844        // 0x0004 - "l hop" // unexpected here
46845        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46846        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46847        PORT_MODIFY("IN-5")
46848        // 0x0001 - "l lege" // standard input (expected here)
46849        // 0x0002 - "r lege" // standard input (expected here)
46850        // 0x0004 - "dump" // standard input (expected here)
46851        PORT_MODIFY("IN-16")
46852        // 0x0001 - "dil sw" // standard input (motherboard)
46853        // 0x0002 - "dil sw" // standard input (motherboard)
46854        // 0x0004 - "dil sw" // standard input (motherboard)
46855        // 0x0008 - "dil sw" // standard input (motherboard)
46856        // 0x0010 - "dil sw" // standard input (motherboard)
46857        PORT_MODIFY("IN-17")
46858        // 0x0001 - "dil sw" // standard input (motherboard)
46859        // 0x0002 - "dil sw" // standard input (motherboard)
46860        // 0x0004 - "dil sw" // standard input (motherboard)
46861        // 0x0008 - "dil sw" // standard input (motherboard)
46862        // 0x0010 - "dil sw" // standard input (motherboard)
46863        PORT_MODIFY("IN-18")
46864        // 0x0001 - "dil sw" // standard input (motherboard)
46865        // 0x0002 - "dil sw" // standard input (motherboard)
46866        // 0x0004 - "dil sw" // standard input (motherboard)
46867        // 0x0008 - "dil sw" // standard input (motherboard)
46868        // 0x0010 - "dil sw" // standard input (motherboard)
46869        PORT_MODIFY("IN-19")
46870        // 0x0001 - "dil sw" // standard input (motherboard)
46871        PORT_MODIFY("IN-20")
46872        // 0x0001 - "green" // standard input (motherboard)
46873        // 0x0002 - "cashbo" // standard input (expected here)
46874        // 0x0008 - "zijdeu" // standard input (expected here)
46875        // 0x0010 - "boekho" // standard input (expected here)
46825      PORT_INCLUDE( sc4_base )
46826      PORT_MODIFY("IN-1")
46827      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46828      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46829      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46830      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46831      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("vast 4")
46832      PORT_MODIFY("IN-2")
46833      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("kies i")
46834      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("kies s")
46835      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46836      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46837      PORT_MODIFY("IN-3")
46838      // 0x0001 - "uitbet" // unexpected here
46839      // 0x0002 - "n hoog" // unexpected here
46840      // 0x0004 - "n winb" // standard input (expected here)
46841      PORT_MODIFY("IN-4")
46842      // 0x0001 - "l hop" // unexpected here
46843      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46844      // 0x0004 - "l hop" // unexpected here
46845      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46846      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46847      PORT_MODIFY("IN-5")
46848      // 0x0001 - "l lege" // standard input (expected here)
46849      // 0x0002 - "r lege" // standard input (expected here)
46850      // 0x0004 - "dump" // standard input (expected here)
46851      PORT_MODIFY("IN-16")
46852      // 0x0001 - "dil sw" // standard input (motherboard)
46853      // 0x0002 - "dil sw" // standard input (motherboard)
46854      // 0x0004 - "dil sw" // standard input (motherboard)
46855      // 0x0008 - "dil sw" // standard input (motherboard)
46856      // 0x0010 - "dil sw" // standard input (motherboard)
46857      PORT_MODIFY("IN-17")
46858      // 0x0001 - "dil sw" // standard input (motherboard)
46859      // 0x0002 - "dil sw" // standard input (motherboard)
46860      // 0x0004 - "dil sw" // standard input (motherboard)
46861      // 0x0008 - "dil sw" // standard input (motherboard)
46862      // 0x0010 - "dil sw" // standard input (motherboard)
46863      PORT_MODIFY("IN-18")
46864      // 0x0001 - "dil sw" // standard input (motherboard)
46865      // 0x0002 - "dil sw" // standard input (motherboard)
46866      // 0x0004 - "dil sw" // standard input (motherboard)
46867      // 0x0008 - "dil sw" // standard input (motherboard)
46868      // 0x0010 - "dil sw" // standard input (motherboard)
46869      PORT_MODIFY("IN-19")
46870      // 0x0001 - "dil sw" // standard input (motherboard)
46871      PORT_MODIFY("IN-20")
46872      // 0x0001 - "green" // standard input (motherboard)
46873      // 0x0002 - "cashbo" // standard input (expected here)
46874      // 0x0008 - "zijdeu" // standard input (expected here)
46875      // 0x0010 - "boekho" // standard input (expected here)
4687646876INPUT_PORTS_END
4687746877
4687846878// PR1207 WIN XPLOSION         95004265 WINXPLOSION PR1053
r31373r31374
4689646896}
4689746897
4689846898INPUT_PORTS_START( sc4xcash ) // this structure is generated
46899        PORT_INCLUDE( sc4_base )
46900        PORT_MODIFY("IN-1")
46901        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("uitbet")
46902        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("test s")
46903        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("test s")
46904        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("test s")
46905        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("test s")
46906        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("zijdeu OR l hop OR r hop")
46907        PORT_MODIFY("IN-2")
46908        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("test s")
46909        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
46910        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46911        PORT_MODIFY("IN-3")
46912        // 0x0010 - "roep b" // standard input (expected here)
46913        PORT_MODIFY("IN-4")
46914        // 0x0001 - "l hop" // unexpected here
46915        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46916        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46917        PORT_MODIFY("IN-5")
46918        // 0x0001 - "l lege" // standard input (expected here)
46919        // 0x0002 - "r lege" // standard input (expected here)
46920        PORT_MODIFY("IN-16")
46921        // 0x0001 - "dil sw" // standard input (motherboard)
46922        // 0x0002 - "dil sw" // standard input (motherboard)
46923        // 0x0004 - "dil sw" // standard input (motherboard)
46924        // 0x0008 - "dil sw" // standard input (motherboard)
46925        // 0x0010 - "dil sw" // standard input (motherboard)
46926        PORT_MODIFY("IN-17")
46927        // 0x0001 - "dil sw" // standard input (motherboard)
46928        // 0x0002 - "dil sw" // standard input (motherboard)
46929        // 0x0004 - "dil sw" // standard input (motherboard)
46930        // 0x0008 - "dil sw" // standard input (motherboard)
46931        // 0x0010 - "dil sw" // standard input (motherboard)
46932        PORT_MODIFY("IN-18")
46933        // 0x0001 - "dil sw" // standard input (motherboard)
46934        // 0x0002 - "dil sw" // standard input (motherboard)
46935        // 0x0004 - "dil sw" // standard input (motherboard)
46936        // 0x0008 - "dil sw" // standard input (motherboard)
46937        // 0x0010 - "dil sw" // standard input (motherboard)
46938        PORT_MODIFY("IN-19")
46939        // 0x0001 - "dil sw" // standard input (motherboard)
46940        PORT_MODIFY("IN-20")
46941        // 0x0001 - "green" // standard input (motherboard)
46942        // 0x0002 - "cashbo" // standard input (expected here)
46943        // 0x0008 - "dump" // standard input (expected here)
46944        // 0x0010 - "boekho" // standard input (expected here)
46899      PORT_INCLUDE( sc4_base )
46900      PORT_MODIFY("IN-1")
46901      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("uitbet")
46902      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("test s")
46903      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("test s")
46904      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("test s")
46905      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("test s")
46906      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("zijdeu OR l hop OR r hop")
46907      PORT_MODIFY("IN-2")
46908      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("test s")
46909      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
46910      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46911      PORT_MODIFY("IN-3")
46912      // 0x0010 - "roep b" // standard input (expected here)
46913      PORT_MODIFY("IN-4")
46914      // 0x0001 - "l hop" // unexpected here
46915      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46916      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46917      PORT_MODIFY("IN-5")
46918      // 0x0001 - "l lege" // standard input (expected here)
46919      // 0x0002 - "r lege" // standard input (expected here)
46920      PORT_MODIFY("IN-16")
46921      // 0x0001 - "dil sw" // standard input (motherboard)
46922      // 0x0002 - "dil sw" // standard input (motherboard)
46923      // 0x0004 - "dil sw" // standard input (motherboard)
46924      // 0x0008 - "dil sw" // standard input (motherboard)
46925      // 0x0010 - "dil sw" // standard input (motherboard)
46926      PORT_MODIFY("IN-17")
46927      // 0x0001 - "dil sw" // standard input (motherboard)
46928      // 0x0002 - "dil sw" // standard input (motherboard)
46929      // 0x0004 - "dil sw" // standard input (motherboard)
46930      // 0x0008 - "dil sw" // standard input (motherboard)
46931      // 0x0010 - "dil sw" // standard input (motherboard)
46932      PORT_MODIFY("IN-18")
46933      // 0x0001 - "dil sw" // standard input (motherboard)
46934      // 0x0002 - "dil sw" // standard input (motherboard)
46935      // 0x0004 - "dil sw" // standard input (motherboard)
46936      // 0x0008 - "dil sw" // standard input (motherboard)
46937      // 0x0010 - "dil sw" // standard input (motherboard)
46938      PORT_MODIFY("IN-19")
46939      // 0x0001 - "dil sw" // standard input (motherboard)
46940      PORT_MODIFY("IN-20")
46941      // 0x0001 - "green" // standard input (motherboard)
46942      // 0x0002 - "cashbo" // standard input (expected here)
46943      // 0x0008 - "dump" // standard input (expected here)
46944      // 0x0010 - "boekho" // standard input (expected here)
4694546945INPUT_PORTS_END
4694646946
4694746947// PR1264 XTRA CASH ART13 XTRA CASH CASINO (LOTECH) - ART13         95004321 XTRACASH PR1264
r31373r31374
4696446964}
4696546965
4696646966INPUT_PORTS_START( sc4helld ) // this structure is generated
46967        PORT_INCLUDE( sc4_base )
46968        PORT_MODIFY("IN-1")
46969        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46970        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46971        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46972        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46973        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies m")
46974        PORT_MODIFY("IN-2")
46975        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("k basi")
46976        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("k club")
46977        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46978        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46979        PORT_MODIFY("IN-3")
46980        // 0x0001 - "uitbet" // unexpected here
46981        // 0x0002 - "neem m" // unexpected here
46982        // 0x0004 - "neem w" // standard input (expected here)
46983        PORT_MODIFY("IN-4")
46984        // 0x0001 - "l hop" // unexpected here
46985        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46986        // 0x0004 - "l hop" // unexpected here
46987        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46988        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46989        PORT_MODIFY("IN-5")
46990        // 0x0001 - "l lege" // standard input (expected here)
46991        // 0x0002 - "r lege" // standard input (expected here)
46992        // 0x0004 - "dump" // standard input (expected here)
46993        PORT_MODIFY("IN-16")
46994        // 0x0001 - "dil sw" // standard input (motherboard)
46995        // 0x0002 - "dil sw" // standard input (motherboard)
46996        // 0x0004 - "dil sw" // standard input (motherboard)
46997        // 0x0008 - "dil sw" // standard input (motherboard)
46998        // 0x0010 - "dil sw" // standard input (motherboard)
46999        PORT_MODIFY("IN-17")
47000        // 0x0001 - "dil sw" // standard input (motherboard)
47001        // 0x0002 - "dil sw" // standard input (motherboard)
47002        // 0x0004 - "dil sw" // standard input (motherboard)
47003        // 0x0008 - "dil sw" // standard input (motherboard)
47004        // 0x0010 - "dil sw" // standard input (motherboard)
47005        PORT_MODIFY("IN-18")
47006        // 0x0001 - "dil sw" // standard input (motherboard)
47007        // 0x0002 - "dil sw" // standard input (motherboard)
47008        // 0x0004 - "dil sw" // standard input (motherboard)
47009        // 0x0008 - "dil sw" // standard input (motherboard)
47010        // 0x0010 - "dil sw" // standard input (motherboard)
47011        PORT_MODIFY("IN-19")
47012        // 0x0001 - "dil sw" // standard input (motherboard)
47013        PORT_MODIFY("IN-20")
47014        // 0x0001 - "green" // standard input (motherboard)
47015        // 0x0002 - "cashbo" // standard input (expected here)
47016        // 0x0008 - "zijdeu" // standard input (expected here)
47017        // 0x0010 - "boekho" // standard input (expected here)
46967      PORT_INCLUDE( sc4_base )
46968      PORT_MODIFY("IN-1")
46969      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herste")
46970      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
46971      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
46972      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
46973      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("kies m")
46974      PORT_MODIFY("IN-2")
46975      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("k basi")
46976      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("k club")
46977      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
46978      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
46979      PORT_MODIFY("IN-3")
46980      // 0x0001 - "uitbet" // unexpected here
46981      // 0x0002 - "neem m" // unexpected here
46982      // 0x0004 - "neem w" // standard input (expected here)
46983      PORT_MODIFY("IN-4")
46984      // 0x0001 - "l hop" // unexpected here
46985      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
46986      // 0x0004 - "l hop" // unexpected here
46987      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
46988      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
46989      PORT_MODIFY("IN-5")
46990      // 0x0001 - "l lege" // standard input (expected here)
46991      // 0x0002 - "r lege" // standard input (expected here)
46992      // 0x0004 - "dump" // standard input (expected here)
46993      PORT_MODIFY("IN-16")
46994      // 0x0001 - "dil sw" // standard input (motherboard)
46995      // 0x0002 - "dil sw" // standard input (motherboard)
46996      // 0x0004 - "dil sw" // standard input (motherboard)
46997      // 0x0008 - "dil sw" // standard input (motherboard)
46998      // 0x0010 - "dil sw" // standard input (motherboard)
46999      PORT_MODIFY("IN-17")
47000      // 0x0001 - "dil sw" // standard input (motherboard)
47001      // 0x0002 - "dil sw" // standard input (motherboard)
47002      // 0x0004 - "dil sw" // standard input (motherboard)
47003      // 0x0008 - "dil sw" // standard input (motherboard)
47004      // 0x0010 - "dil sw" // standard input (motherboard)
47005      PORT_MODIFY("IN-18")
47006      // 0x0001 - "dil sw" // standard input (motherboard)
47007      // 0x0002 - "dil sw" // standard input (motherboard)
47008      // 0x0004 - "dil sw" // standard input (motherboard)
47009      // 0x0008 - "dil sw" // standard input (motherboard)
47010      // 0x0010 - "dil sw" // standard input (motherboard)
47011      PORT_MODIFY("IN-19")
47012      // 0x0001 - "dil sw" // standard input (motherboard)
47013      PORT_MODIFY("IN-20")
47014      // 0x0001 - "green" // standard input (motherboard)
47015      // 0x0002 - "cashbo" // standard input (expected here)
47016      // 0x0008 - "zijdeu" // standard input (expected here)
47017      // 0x0010 - "boekho" // standard input (expected here)
4701847018INPUT_PORTS_END
4701947019
4702047020// PR1201 HELLS BELLS         95004211 HELLS BELLS PR6945         HELLS  BELLS  (non english?)
r31373r31374
4703747037}
4703847038
4703947039INPUT_PORTS_START( sc4cashn ) // this structure is generated
47040        PORT_INCLUDE( sc4_base )
47041        PORT_MODIFY("IN-1")
47042        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
47043        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
47044        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
47045        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
47046        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("inzet")
47047        PORT_MODIFY("IN-2")
47048        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
47049        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
47050        PORT_MODIFY("IN-3")
47051        // 0x0001 - "uitbet" // unexpected here
47052        // 0x0002 - "n club" // unexpected here
47053        // 0x0010 - "player" // standard input (expected here)
47054        PORT_MODIFY("IN-4")
47055        // 0x0001 - "l hop" // unexpected here
47056        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
47057        // 0x0004 - "l hop" // unexpected here
47058        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
47059        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
47060        PORT_MODIFY("IN-5")
47061        // 0x0001 - "l lege" // standard input (expected here)
47062        // 0x0002 - "r lege" // standard input (expected here)
47063        // 0x0004 - "dump" // standard input (expected here)
47064        PORT_MODIFY("IN-16")
47065        // 0x0001 - "dil sw" // standard input (motherboard)
47066        // 0x0002 - "dil sw" // standard input (motherboard)
47067        // 0x0004 - "dil sw" // standard input (motherboard)
47068        // 0x0008 - "dil sw" // standard input (motherboard)
47069        // 0x0010 - "dil sw" // standard input (motherboard)
47070        PORT_MODIFY("IN-17")
47071        // 0x0001 - "dil sw" // standard input (motherboard)
47072        // 0x0002 - "dil sw" // standard input (motherboard)
47073        // 0x0004 - "dil sw" // standard input (motherboard)
47074        // 0x0008 - "dil sw" // standard input (motherboard)
47075        // 0x0010 - "dil sw" // standard input (motherboard)
47076        PORT_MODIFY("IN-18")
47077        // 0x0001 - "dil sw" // standard input (motherboard)
47078        // 0x0002 - "dil sw" // standard input (motherboard)
47079        // 0x0004 - "dil sw" // standard input (motherboard)
47080        // 0x0008 - "dil sw" // standard input (motherboard)
47081        // 0x0010 - "dil sw" // standard input (motherboard)
47082        PORT_MODIFY("IN-19")
47083        // 0x0001 - "dil sw" // standard input (motherboard)
47084        PORT_MODIFY("IN-20")
47085        // 0x0001 - "green" // standard input (motherboard)
47086        // 0x0002 - "cashbo" // standard input (expected here)
47087        // 0x0008 - "zijdeu" // standard input (expected here)
47088        // 0x0010 - "boekho" // standard input (expected here)
47040      PORT_INCLUDE( sc4_base )
47041      PORT_MODIFY("IN-1")
47042      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("herst")
47043      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 1")
47044      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 2")
47045      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("vast 3")
47046      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("inzet")
47047      PORT_MODIFY("IN-2")
47048      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
47049      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
47050      PORT_MODIFY("IN-3")
47051      // 0x0001 - "uitbet" // unexpected here
47052      // 0x0002 - "n club" // unexpected here
47053      // 0x0010 - "player" // standard input (expected here)
47054      PORT_MODIFY("IN-4")
47055      // 0x0001 - "l hop" // unexpected here
47056      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
47057      // 0x0004 - "l hop" // unexpected here
47058      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
47059      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
47060      PORT_MODIFY("IN-5")
47061      // 0x0001 - "l lege" // standard input (expected here)
47062      // 0x0002 - "r lege" // standard input (expected here)
47063      // 0x0004 - "dump" // standard input (expected here)
47064      PORT_MODIFY("IN-16")
47065      // 0x0001 - "dil sw" // standard input (motherboard)
47066      // 0x0002 - "dil sw" // standard input (motherboard)
47067      // 0x0004 - "dil sw" // standard input (motherboard)
47068      // 0x0008 - "dil sw" // standard input (motherboard)
47069      // 0x0010 - "dil sw" // standard input (motherboard)
47070      PORT_MODIFY("IN-17")
47071      // 0x0001 - "dil sw" // standard input (motherboard)
47072      // 0x0002 - "dil sw" // standard input (motherboard)
47073      // 0x0004 - "dil sw" // standard input (motherboard)
47074      // 0x0008 - "dil sw" // standard input (motherboard)
47075      // 0x0010 - "dil sw" // standard input (motherboard)
47076      PORT_MODIFY("IN-18")
47077      // 0x0001 - "dil sw" // standard input (motherboard)
47078      // 0x0002 - "dil sw" // standard input (motherboard)
47079      // 0x0004 - "dil sw" // standard input (motherboard)
47080      // 0x0008 - "dil sw" // standard input (motherboard)
47081      // 0x0010 - "dil sw" // standard input (motherboard)
47082      PORT_MODIFY("IN-19")
47083      // 0x0001 - "dil sw" // standard input (motherboard)
47084      PORT_MODIFY("IN-20")
47085      // 0x0001 - "green" // standard input (motherboard)
47086      // 0x0002 - "cashbo" // standard input (expected here)
47087      // 0x0008 - "zijdeu" // standard input (expected here)
47088      // 0x0010 - "boekho" // standard input (expected here)
4708947089INPUT_PORTS_END
4709047090
4709147091
r31373r31374
4711047110}
4711147111
4711247112INPUT_PORTS_START( sc4czfra ) // this structure is generated
47113        PORT_INCLUDE( sc4_base )
47114        PORT_MODIFY("IN-1")
47115        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("vast 1")
47116        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 2")
47117        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 3")
47118        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("herste")
47119        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stop")
47120        PORT_MODIFY("IN-2")
47121        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ruilen")
47122        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
47123        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
47124        PORT_MODIFY("IN-3")
47125        // 0x0001 - "uitbet" // unexpected here
47126        // 0x0002 - "neem w" // unexpected here
47127        // 0x0004 - "neem l" // standard input (expected here)
47128        // 0x0008 - "neem s" // standard input (expected here)
47129        // 0x0010 - "info/l" // standard input (expected here)
47130        PORT_MODIFY("IN-4")
47131        // 0x0001 - "l hop" // unexpected here
47132        // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
47133        // 0x0004 - "l hop" // unexpected here
47134        // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
47135        // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
47136        PORT_MODIFY("IN-5")
47137        // 0x0001 - "l lege" // standard input (expected here)
47138        // 0x0002 - "r lege" // standard input (expected here)
47139        // 0x0004 - "dump" // standard input (expected here)
47140        PORT_MODIFY("IN-16")
47141        // 0x0001 - "dil sw" // standard input (motherboard)
47142        // 0x0002 - "dil sw" // standard input (motherboard)
47143        // 0x0004 - "dil sw" // standard input (motherboard)
47144        // 0x0008 - "dil sw" // standard input (motherboard)
47145        // 0x0010 - "dil sw" // standard input (motherboard)
47146        PORT_MODIFY("IN-17")
47147        // 0x0001 - "dil sw" // standard input (motherboard)
47148        // 0x0002 - "dil sw" // standard input (motherboard)
47149        // 0x0004 - "dil sw" // standard input (motherboard)
47150        // 0x0008 - "dil sw" // standard input (motherboard)
47151        // 0x0010 - "dil sw" // standard input (motherboard)
47152        PORT_MODIFY("IN-18")
47153        // 0x0001 - "dil sw" // standard input (motherboard)
47154        // 0x0002 - "dil sw" // standard input (motherboard)
47155        // 0x0004 - "dil sw" // standard input (motherboard)
47156        // 0x0008 - "dil sw" // standard input (motherboard)
47157        // 0x0010 - "dil sw" // standard input (motherboard)
47158        PORT_MODIFY("IN-19")
47159        // 0x0001 - "dil sw" // standard input (motherboard)
47160        PORT_MODIFY("IN-20")
47161        // 0x0001 - "green" // standard input (motherboard)
47162        // 0x0002 - "cashbo" // standard input (expected here)
47163        // 0x0008 - "zijdeu" // standard input (expected here)
47164        // 0x0010 - "boekho" // standard input (expected here)
47113      PORT_INCLUDE( sc4_base )
47114      PORT_MODIFY("IN-1")
47115      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("vast 1")
47116      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("vast 2")
47117      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("vast 3")
47118      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("herste")
47119      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stop")
47120      PORT_MODIFY("IN-2")
47121      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ruilen")
47122      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("start")
47123      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("bijvul")
47124      PORT_MODIFY("IN-3")
47125      // 0x0001 - "uitbet" // unexpected here
47126      // 0x0002 - "neem w" // unexpected here
47127      // 0x0004 - "neem l" // standard input (expected here)
47128      // 0x0008 - "neem s" // standard input (expected here)
47129      // 0x0010 - "info/l" // standard input (expected here)
47130      PORT_MODIFY("IN-4")
47131      // 0x0001 - "l hop" // unexpected here
47132      // 0x0002 - "r hop" // known extended(?) input, sometimes 'hop hi'
47133      // 0x0004 - "l hop" // unexpected here
47134      // 0x0008 - "r hop" // known extended(?) input, sometimes 'hop top'
47135      // 0x0010 - "hopper" // known extended(?) input, sometimes 'top up'
47136      PORT_MODIFY("IN-5")
47137      // 0x0001 - "l lege" // standard input (expected here)
47138      // 0x0002 - "r lege" // standard input (expected here)
47139      // 0x0004 - "dump" // standard input (expected here)
47140      PORT_MODIFY("IN-16")
47141      // 0x0001 - "dil sw" // standard input (motherboard)
47142      // 0x0002 - "dil sw" // standard input (motherboard)
47143      // 0x0004 - "dil sw" // standard input (motherboard)
47144      // 0x0008 - "dil sw" // standard input (motherboard)
47145      // 0x0010 - "dil sw" // standard input (motherboard)
47146      PORT_MODIFY("IN-17")
47147      // 0x0001 - "dil sw" // standard input (motherboard)
47148      // 0x0002 - "dil sw" // standard input (motherboard)
47149      // 0x0004 - "dil sw" // standard input (motherboard)
47150      // 0x0008 - "dil sw" // standard input (motherboard)
47151      // 0x0010 - "dil sw" // standard input (motherboard)
47152      PORT_MODIFY("IN-18")
47153      // 0x0001 - "dil sw" // standard input (motherboard)
47154      // 0x0002 - "dil sw" // standard input (motherboard)
47155      // 0x0004 - "dil sw" // standard input (motherboard)
47156      // 0x0008 - "dil sw" // standard input (motherboard)
47157      // 0x0010 - "dil sw" // standard input (motherboard)
47158      PORT_MODIFY("IN-19")
47159      // 0x0001 - "dil sw" // standard input (motherboard)
47160      PORT_MODIFY("IN-20")
47161      // 0x0001 - "green" // standard input (motherboard)
47162      // 0x0002 - "cashbo" // standard input (expected here)
47163      // 0x0008 - "zijdeu" // standard input (expected here)
47164      // 0x0010 - "boekho" // standard input (expected here)
4716547165INPUT_PORTS_END
4716647166
4716747167// PR1212 CRAZY FRUITS          PR1152 CRAZY FRUITS SOUNDS11
r31373r31374
4717447174/**********************************************************************************************************************************/
4717547175
4717647176INPUT_PORTS_START( sc4adsnt ) // this structure is generated
47177        PORT_INCLUDE( sc4_base )
47178        PORT_MODIFY("IN-1")
47179        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47180        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47181        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47182        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47183        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
47184        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
47185        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
47186        PORT_MODIFY("IN-2")
47187        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
47188        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
47189        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47190        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47191        PORT_MODIFY("IN-3")
47192        // 0x0004 - "stk 4" // standard input (expected here)
47193        // 0x0008 - "stk 2" // standard input (expected here)
47194        // 0x0010 - "stk 3" // standard input (expected here)
47195        PORT_MODIFY("IN-4")
47196        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
47197        PORT_MODIFY("IN-5")
47198        // 0x0001 - "priz4" // standard input (expected here)
47199        // 0x0002 - "priz3" // standard input (expected here)
47200        // 0x0004 - "priz2" // standard input (expected here)
47201        // 0x0008 - "priz1" // standard input (expected here)
47202        PORT_MODIFY("IN-6")
47203        // 0x0001 - "perc1" // standard input (expected here)
47204        // 0x0002 - "perc2" // standard input (expected here)
47205        // 0x0004 - "perc3" // standard input (expected here)
47206        // 0x0008 - "perc4" // standard input (expected here)
47207        PORT_MODIFY("IN-8")
47208        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("gamble")
47209        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("grabs")
47210        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("featur")
47211        PORT_MODIFY("IN-16")
47212        // 0x0001 - "dil1" // standard input (motherboard)
47213        // 0x0002 - "dil2" // standard input (motherboard)
47214        // 0x0004 - "dil3" // standard input (motherboard)
47215        // 0x0008 - "dil4" // standard input (motherboard)
47216        // 0x0010 - "dil5" // standard input (motherboard)
47217        PORT_MODIFY("IN-17")
47218        // 0x0001 - "dil6" // standard input (motherboard)
47219        // 0x0002 - "dil7" // standard input (motherboard)
47220        // 0x0004 - "dil8" // standard input (motherboard)
47221        // 0x0008 - "dil9" // standard input (motherboard)
47222        // 0x0010 - "dil10" // standard input (motherboard)
47223        PORT_MODIFY("IN-18")
47224        // 0x0001 - "dil11" // standard input (motherboard)
47225        // 0x0002 - "dil12" // standard input (motherboard)
47226        // 0x0004 - "dil13" // standard input (motherboard)
47227        // 0x0008 - "dil14" // standard input (motherboard)
47228        // 0x0010 - "dil15" // standard input (motherboard)
47229        PORT_MODIFY("IN-19")
47230        // 0x0001 - "dil16" // standard input (motherboard)
47231        PORT_MODIFY("IN-20")
47232        // 0x0001 - "grnbut" // standard input (motherboard)
47233        // 0x0002 - "dorlok" // standard input (expected here)
47234        // 0x0004 - "serdor" // standard input (expected here)
47235        // 0x0008 - "cshdor" // standard input (expected here)
47236        // 0x0010 - "hopdmp" // standard input (expected here)
47177      PORT_INCLUDE( sc4_base )
47178      PORT_MODIFY("IN-1")
47179      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47180      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47181      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47182      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47183      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
47184      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
47185      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
47186      PORT_MODIFY("IN-2")
47187      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
47188      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
47189      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47190      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47191      PORT_MODIFY("IN-3")
47192      // 0x0004 - "stk 4" // standard input (expected here)
47193      // 0x0008 - "stk 2" // standard input (expected here)
47194      // 0x0010 - "stk 3" // standard input (expected here)
47195      PORT_MODIFY("IN-4")
47196      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
47197      PORT_MODIFY("IN-5")
47198      // 0x0001 - "priz4" // standard input (expected here)
47199      // 0x0002 - "priz3" // standard input (expected here)
47200      // 0x0004 - "priz2" // standard input (expected here)
47201      // 0x0008 - "priz1" // standard input (expected here)
47202      PORT_MODIFY("IN-6")
47203      // 0x0001 - "perc1" // standard input (expected here)
47204      // 0x0002 - "perc2" // standard input (expected here)
47205      // 0x0004 - "perc3" // standard input (expected here)
47206      // 0x0008 - "perc4" // standard input (expected here)
47207      PORT_MODIFY("IN-8")
47208      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("gamble")
47209      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("grabs")
47210      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("featur")
47211      PORT_MODIFY("IN-16")
47212      // 0x0001 - "dil1" // standard input (motherboard)
47213      // 0x0002 - "dil2" // standard input (motherboard)
47214      // 0x0004 - "dil3" // standard input (motherboard)
47215      // 0x0008 - "dil4" // standard input (motherboard)
47216      // 0x0010 - "dil5" // standard input (motherboard)
47217      PORT_MODIFY("IN-17")
47218      // 0x0001 - "dil6" // standard input (motherboard)
47219      // 0x0002 - "dil7" // standard input (motherboard)
47220      // 0x0004 - "dil8" // standard input (motherboard)
47221      // 0x0008 - "dil9" // standard input (motherboard)
47222      // 0x0010 - "dil10" // standard input (motherboard)
47223      PORT_MODIFY("IN-18")
47224      // 0x0001 - "dil11" // standard input (motherboard)
47225      // 0x0002 - "dil12" // standard input (motherboard)
47226      // 0x0004 - "dil13" // standard input (motherboard)
47227      // 0x0008 - "dil14" // standard input (motherboard)
47228      // 0x0010 - "dil15" // standard input (motherboard)
47229      PORT_MODIFY("IN-19")
47230      // 0x0001 - "dil16" // standard input (motherboard)
47231      PORT_MODIFY("IN-20")
47232      // 0x0001 - "grnbut" // standard input (motherboard)
47233      // 0x0002 - "dorlok" // standard input (expected here)
47234      // 0x0004 - "serdor" // standard input (expected here)
47235      // 0x0008 - "cshdor" // standard input (expected here)
47236      // 0x0010 - "hopdmp" // standard input (expected here)
4723747237INPUT_PORTS_END
4723847238
4723947239// PAY UNIT ERR 17
r31373r31374
4724247242GAMEL( 200?, sc4adsnta   ,sc4adsnt,  sc4, sc4adsnt, sc4_state, sc4, ROT0, "BFM","Ant & Dec's Saturday Night Takeaway (Bellfruit) (Scorpion 4) (set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4724347243
4724447244INPUT_PORTS_START( sc4slad ) // this structure is generated
47245        PORT_INCLUDE( sc4_base )
47246        PORT_MODIFY("IN-1")
47247        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47248        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
47249        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
47250        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
47251        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
47252        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
47253        PORT_MODIFY("IN-2")
47254        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
47255        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
47256        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47257        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47258        PORT_MODIFY("IN-3")
47259        // 0x0004 - "stk 4" // standard input (expected here)
47260        // 0x0008 - "stk 3" // standard input (expected here)
47261        // 0x0010 - "stk 2" // standard input (expected here)
47262        PORT_MODIFY("IN-5")
47263        // 0x0001 - "priz4" // standard input (expected here)
47264        // 0x0002 - "priz3" // standard input (expected here)
47265        // 0x0004 - "priz2" // standard input (expected here)
47266        // 0x0008 - "priz1" // standard input (expected here)
47267        PORT_MODIFY("IN-6")
47268        // 0x0001 - "perc1" // standard input (expected here)
47269        // 0x0002 - "perc2" // standard input (expected here)
47270        // 0x0004 - "perc3" // standard input (expected here)
47271        // 0x0008 - "perc4" // standard input (expected here)
47272        PORT_MODIFY("IN-16")
47273        // 0x0001 - "dil 1" // standard input (motherboard)
47274        // 0x0002 - "dil 2" // standard input (motherboard)
47275        // 0x0004 - "dil 3" // standard input (motherboard)
47276        // 0x0008 - "dil 4" // standard input (motherboard)
47277        // 0x0010 - "dil 5" // standard input (motherboard)
47278        PORT_MODIFY("IN-17")
47279        // 0x0001 - "dil 6" // standard input (motherboard)
47280        // 0x0002 - "dil 7" // standard input (motherboard)
47281        // 0x0004 - "dil 8" // standard input (motherboard)
47282        // 0x0008 - "dil 9" // standard input (motherboard)
47283        // 0x0010 - "dil 10" // standard input (motherboard)
47284        PORT_MODIFY("IN-18")
47285        // 0x0001 - "dil 11" // standard input (motherboard)
47286        // 0x0002 - "dil 12" // standard input (motherboard)
47287        // 0x0004 - "dil 13" // standard input (motherboard)
47288        // 0x0008 - "dil 14" // standard input (motherboard)
47289        // 0x0010 - "dil 15" // standard input (motherboard)
47290        PORT_MODIFY("IN-19")
47291        // 0x0001 - "dil 16" // standard input (motherboard)
47292        PORT_MODIFY("IN-20")
47293        // 0x0001 - "grnbut" // standard input (motherboard)
47294        // 0x0002 - "dorlok" // standard input (expected here)
47295        // 0x0004 - "serdor" // standard input (expected here)
47296        // 0x0008 - "cshdor" // standard input (expected here)
47297        // 0x0010 - "hopdmp" // standard input (expected here)
47245      PORT_INCLUDE( sc4_base )
47246      PORT_MODIFY("IN-1")
47247      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47248      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
47249      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
47250      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
47251      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
47252      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
47253      PORT_MODIFY("IN-2")
47254      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
47255      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
47256      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47257      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47258      PORT_MODIFY("IN-3")
47259      // 0x0004 - "stk 4" // standard input (expected here)
47260      // 0x0008 - "stk 3" // standard input (expected here)
47261      // 0x0010 - "stk 2" // standard input (expected here)
47262      PORT_MODIFY("IN-5")
47263      // 0x0001 - "priz4" // standard input (expected here)
47264      // 0x0002 - "priz3" // standard input (expected here)
47265      // 0x0004 - "priz2" // standard input (expected here)
47266      // 0x0008 - "priz1" // standard input (expected here)
47267      PORT_MODIFY("IN-6")
47268      // 0x0001 - "perc1" // standard input (expected here)
47269      // 0x0002 - "perc2" // standard input (expected here)
47270      // 0x0004 - "perc3" // standard input (expected here)
47271      // 0x0008 - "perc4" // standard input (expected here)
47272      PORT_MODIFY("IN-16")
47273      // 0x0001 - "dil 1" // standard input (motherboard)
47274      // 0x0002 - "dil 2" // standard input (motherboard)
47275      // 0x0004 - "dil 3" // standard input (motherboard)
47276      // 0x0008 - "dil 4" // standard input (motherboard)
47277      // 0x0010 - "dil 5" // standard input (motherboard)
47278      PORT_MODIFY("IN-17")
47279      // 0x0001 - "dil 6" // standard input (motherboard)
47280      // 0x0002 - "dil 7" // standard input (motherboard)
47281      // 0x0004 - "dil 8" // standard input (motherboard)
47282      // 0x0008 - "dil 9" // standard input (motherboard)
47283      // 0x0010 - "dil 10" // standard input (motherboard)
47284      PORT_MODIFY("IN-18")
47285      // 0x0001 - "dil 11" // standard input (motherboard)
47286      // 0x0002 - "dil 12" // standard input (motherboard)
47287      // 0x0004 - "dil 13" // standard input (motherboard)
47288      // 0x0008 - "dil 14" // standard input (motherboard)
47289      // 0x0010 - "dil 15" // standard input (motherboard)
47290      PORT_MODIFY("IN-19")
47291      // 0x0001 - "dil 16" // standard input (motherboard)
47292      PORT_MODIFY("IN-20")
47293      // 0x0001 - "grnbut" // standard input (motherboard)
47294      // 0x0002 - "dorlok" // standard input (expected here)
47295      // 0x0004 - "serdor" // standard input (expected here)
47296      // 0x0008 - "cshdor" // standard input (expected here)
47297      // 0x0010 - "hopdmp" // standard input (expected here)
4729847298INPUT_PORTS_END
4729947299
4730047300// PAY UNIT ERR 17
r31373r31374
4731047310GAMEL( 200?, sc4sladh    ,sc4slad,   sc4, sc4slad, sc4_state, sc4, ROT0, "BFM","Snakes & Ladders (Bellfruit) (Scorpion 4) (set 9)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4731147311
4731247312INPUT_PORTS_START( sc4magci ) // this structure is generated
47313        PORT_INCLUDE( sc4_base )
47314        PORT_MODIFY("IN-1")
47315        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47316        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47317        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47318        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47319        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("magic")
47320        PORT_MODIFY("IN-2")
47321        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
47322        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
47323        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47324        PORT_MODIFY("IN-4")
47325        // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
47326        PORT_MODIFY("IN-16")
47327        // 0x0001 - "dil 1" // standard input (motherboard)
47328        // 0x0002 - "dil 2" // standard input (motherboard)
47329        // 0x0004 - "dil 3" // standard input (motherboard)
47330        // 0x0008 - "dil 4" // standard input (motherboard)
47331        // 0x0010 - "dil 5" // standard input (motherboard)
47332        PORT_MODIFY("IN-17")
47333        // 0x0001 - "dil 6" // standard input (motherboard)
47334        // 0x0002 - "dil 7" // standard input (motherboard)
47335        // 0x0004 - "dil 8" // standard input (motherboard)
47336        // 0x0008 - "dil 9" // standard input (motherboard)
47337        // 0x0010 - "dil 10" // standard input (motherboard)
47338        PORT_MODIFY("IN-18")
47339        // 0x0001 - "dil 11" // standard input (motherboard)
47340        // 0x0002 - "dil 12" // standard input (motherboard)
47341        // 0x0004 - "dil 13" // standard input (motherboard)
47342        // 0x0008 - "dil 14" // standard input (motherboard)
47343        // 0x0010 - "dil 15" // standard input (motherboard)
47344        PORT_MODIFY("IN-19")
47345        // 0x0001 - "dil 16" // standard input (motherboard)
47346        PORT_MODIFY("IN-20")
47347        // 0x0001 - "test" // standard input (motherboard)
47348        // 0x0002 - "botdor" // standard input (expected here)
47349        // 0x0004 - "topdor" // standard input (expected here)
47350        // 0x0008 - "hopdmp" // standard input (expected here)
47313      PORT_INCLUDE( sc4_base )
47314      PORT_MODIFY("IN-1")
47315      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47316      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47317      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47318      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47319      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("magic")
47320      PORT_MODIFY("IN-2")
47321      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
47322      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
47323      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47324      PORT_MODIFY("IN-4")
47325      // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
47326      PORT_MODIFY("IN-16")
47327      // 0x0001 - "dil 1" // standard input (motherboard)
47328      // 0x0002 - "dil 2" // standard input (motherboard)
47329      // 0x0004 - "dil 3" // standard input (motherboard)
47330      // 0x0008 - "dil 4" // standard input (motherboard)
47331      // 0x0010 - "dil 5" // standard input (motherboard)
47332      PORT_MODIFY("IN-17")
47333      // 0x0001 - "dil 6" // standard input (motherboard)
47334      // 0x0002 - "dil 7" // standard input (motherboard)
47335      // 0x0004 - "dil 8" // standard input (motherboard)
47336      // 0x0008 - "dil 9" // standard input (motherboard)
47337      // 0x0010 - "dil 10" // standard input (motherboard)
47338      PORT_MODIFY("IN-18")
47339      // 0x0001 - "dil 11" // standard input (motherboard)
47340      // 0x0002 - "dil 12" // standard input (motherboard)
47341      // 0x0004 - "dil 13" // standard input (motherboard)
47342      // 0x0008 - "dil 14" // standard input (motherboard)
47343      // 0x0010 - "dil 15" // standard input (motherboard)
47344      PORT_MODIFY("IN-19")
47345      // 0x0001 - "dil 16" // standard input (motherboard)
47346      PORT_MODIFY("IN-20")
47347      // 0x0001 - "test" // standard input (motherboard)
47348      // 0x0002 - "botdor" // standard input (expected here)
47349      // 0x0004 - "topdor" // standard input (expected here)
47350      // 0x0008 - "hopdmp" // standard input (expected here)
4735147351INPUT_PORTS_END
4735247352
4735347353// PAY UNIT ERR 17
r31373r31374
4738547385GAMEL( 200?, sc4magciu   ,sc4magci,  sc4, sc4magci, sc4_state, sc4, ROT0, "Qps","Magic Circle (034) (Qps) (Scorpion 4) (set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4738647386
4738747387INPUT_PORTS_START( sc4dcrls ) // this structure is generated
47388        PORT_INCLUDE( sc4_base )
47389        PORT_MODIFY("IN-1")
47390        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47391        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47392        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47393        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47394        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("streak")
47395        PORT_MODIFY("IN-2")
47396        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
47397        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
47398        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47399        PORT_MODIFY("IN-4")
47400        // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
47401        PORT_MODIFY("IN-16")
47402        // 0x0001 - "dil sw" // standard input (motherboard)
47403        // 0x0002 - "dil sw" // standard input (motherboard)
47404        // 0x0004 - "dil sw" // standard input (motherboard)
47405        // 0x0008 - "dil sw" // standard input (motherboard)
47406        // 0x0010 - "dil sw" // standard input (motherboard)
47407        PORT_MODIFY("IN-17")
47408        // 0x0001 - "dil sw" // standard input (motherboard)
47409        // 0x0002 - "dil sw" // standard input (motherboard)
47410        // 0x0004 - "dil sw" // standard input (motherboard)
47411        // 0x0008 - "dil sw" // standard input (motherboard)
47412        // 0x0010 - "dil sw" // standard input (motherboard)
47413        PORT_MODIFY("IN-18")
47414        // 0x0001 - "dil sw" // standard input (motherboard)
47415        // 0x0002 - "dil sw" // standard input (motherboard)
47416        // 0x0004 - "dil sw" // standard input (motherboard)
47417        // 0x0008 - "dil sw" // standard input (motherboard)
47418        // 0x0010 - "dil sw" // standard input (motherboard)
47419        PORT_MODIFY("IN-19")
47420        // 0x0001 - "dil sw" // standard input (motherboard)
47421        PORT_MODIFY("IN-20")
47422        // 0x0001 - "test" // standard input (motherboard)
47423        // 0x0002 - "botdor" // standard input (expected here)
47424        // 0x0004 - "topdor" // standard input (expected here)
47425        // 0x0008 - "hopdmp" // standard input (expected here)
47388      PORT_INCLUDE( sc4_base )
47389      PORT_MODIFY("IN-1")
47390      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47391      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47392      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47393      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47394      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("streak")
47395      PORT_MODIFY("IN-2")
47396      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
47397      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
47398      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47399      PORT_MODIFY("IN-4")
47400      // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
47401      PORT_MODIFY("IN-16")
47402      // 0x0001 - "dil sw" // standard input (motherboard)
47403      // 0x0002 - "dil sw" // standard input (motherboard)
47404      // 0x0004 - "dil sw" // standard input (motherboard)
47405      // 0x0008 - "dil sw" // standard input (motherboard)
47406      // 0x0010 - "dil sw" // standard input (motherboard)
47407      PORT_MODIFY("IN-17")
47408      // 0x0001 - "dil sw" // standard input (motherboard)
47409      // 0x0002 - "dil sw" // standard input (motherboard)
47410      // 0x0004 - "dil sw" // standard input (motherboard)
47411      // 0x0008 - "dil sw" // standard input (motherboard)
47412      // 0x0010 - "dil sw" // standard input (motherboard)
47413      PORT_MODIFY("IN-18")
47414      // 0x0001 - "dil sw" // standard input (motherboard)
47415      // 0x0002 - "dil sw" // standard input (motherboard)
47416      // 0x0004 - "dil sw" // standard input (motherboard)
47417      // 0x0008 - "dil sw" // standard input (motherboard)
47418      // 0x0010 - "dil sw" // standard input (motherboard)
47419      PORT_MODIFY("IN-19")
47420      // 0x0001 - "dil sw" // standard input (motherboard)
47421      PORT_MODIFY("IN-20")
47422      // 0x0001 - "test" // standard input (motherboard)
47423      // 0x0002 - "botdor" // standard input (expected here)
47424      // 0x0004 - "topdor" // standard input (expected here)
47425      // 0x0008 - "hopdmp" // standard input (expected here)
4742647426INPUT_PORTS_END
4742747427
4742847428// PAY UNIT ERR 17
r31373r31374
4744647446GAMEL( 200?, sc4dcrlsk   ,sc4dcrls,  sc4, sc4dcrls, sc4_state, sc4, ROT0, "Mazooma","Double Crazy Reels (033) (Mazooma) (Scorpion 4) (set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4744747447
4744847448INPUT_PORTS_START( sc4gshot ) // this structure is generated
47449        PORT_INCLUDE( sc4_base )
47450        PORT_MODIFY("IN-1")
47451        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47452        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
47453        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
47454        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
47455        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("auto")
47456        PORT_MODIFY("IN-2")
47457        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
47458        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
47459        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47460        PORT_MODIFY("IN-4")
47461        // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
47462        PORT_MODIFY("IN-16")
47463        // 0x0001 - "dil  1" // standard input (motherboard)
47464        // 0x0002 - "dil  2" // standard input (motherboard)
47465        // 0x0004 - "dil  3" // standard input (motherboard)
47466        // 0x0008 - "dil  4" // standard input (motherboard)
47467        // 0x0010 - "dil  5" // standard input (motherboard)
47468        PORT_MODIFY("IN-17")
47469        // 0x0001 - "dil  6" // standard input (motherboard)
47470        // 0x0002 - "dil  7" // standard input (motherboard)
47471        // 0x0004 - "dil  8" // standard input (motherboard)
47472        // 0x0008 - "dil  9" // standard input (motherboard)
47473        // 0x0010 - "dil 10" // standard input (motherboard)
47474        PORT_MODIFY("IN-18")
47475        // 0x0001 - "dil 11" // standard input (motherboard)
47476        // 0x0002 - "dil 12" // standard input (motherboard)
47477        // 0x0004 - "dil 13" // standard input (motherboard)
47478        // 0x0008 - "dil 14" // standard input (motherboard)
47479        // 0x0010 - "dil 15" // standard input (motherboard)
47480        PORT_MODIFY("IN-19")
47481        // 0x0001 - "dil 16" // standard input (motherboard)
47482        PORT_MODIFY("IN-20")
47483        // 0x0001 - "test" // standard input (motherboard)
47484        // 0x0002 - "botdor" // standard input (expected here)
47485        // 0x0004 - "topdor" // standard input (expected here)
47486        // 0x0008 - "hopdmp" // standard input (expected here)
47449      PORT_INCLUDE( sc4_base )
47450      PORT_MODIFY("IN-1")
47451      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47452      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
47453      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
47454      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
47455      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("auto")
47456      PORT_MODIFY("IN-2")
47457      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
47458      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
47459      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47460      PORT_MODIFY("IN-4")
47461      // 0x0008 - "topup" // known extended(?) input, sometimes 'hop top'
47462      PORT_MODIFY("IN-16")
47463      // 0x0001 - "dil  1" // standard input (motherboard)
47464      // 0x0002 - "dil  2" // standard input (motherboard)
47465      // 0x0004 - "dil  3" // standard input (motherboard)
47466      // 0x0008 - "dil  4" // standard input (motherboard)
47467      // 0x0010 - "dil  5" // standard input (motherboard)
47468      PORT_MODIFY("IN-17")
47469      // 0x0001 - "dil  6" // standard input (motherboard)
47470      // 0x0002 - "dil  7" // standard input (motherboard)
47471      // 0x0004 - "dil  8" // standard input (motherboard)
47472      // 0x0008 - "dil  9" // standard input (motherboard)
47473      // 0x0010 - "dil 10" // standard input (motherboard)
47474      PORT_MODIFY("IN-18")
47475      // 0x0001 - "dil 11" // standard input (motherboard)
47476      // 0x0002 - "dil 12" // standard input (motherboard)
47477      // 0x0004 - "dil 13" // standard input (motherboard)
47478      // 0x0008 - "dil 14" // standard input (motherboard)
47479      // 0x0010 - "dil 15" // standard input (motherboard)
47480      PORT_MODIFY("IN-19")
47481      // 0x0001 - "dil 16" // standard input (motherboard)
47482      PORT_MODIFY("IN-20")
47483      // 0x0001 - "test" // standard input (motherboard)
47484      // 0x0002 - "botdor" // standard input (expected here)
47485      // 0x0004 - "topdor" // standard input (expected here)
47486      // 0x0008 - "hopdmp" // standard input (expected here)
4748747487INPUT_PORTS_END
4748847488
4748947489// PAY UNIT ERR 17
r31373r31374
4749547495GAMEL( 200?, sc4gshotc   ,sc4gshot,  sc4, sc4gshot, sc4_state, sc4, ROT0, "Qps","Golden Shot Arcade (Qps) (Scorpion 4) (set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4749647496
4749747497INPUT_PORTS_START( sc4cj ) // this structure is generated
47498        PORT_INCLUDE( sc4_base )
47499        PORT_MODIFY("IN-1")
47500        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47501        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47502        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47503        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47504        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
47505        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
47506        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
47507        PORT_MODIFY("IN-2")
47508        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
47509        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
47510        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47511        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47512        PORT_MODIFY("IN-3")
47513        // 0x0004 - "stk 4" // standard input (expected here)
47514        // 0x0008 - "stk 3" // standard input (expected here)
47515        // 0x0010 - "stk 2" // standard input (expected here)
47516        PORT_MODIFY("IN-4")
47517        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
47518        PORT_MODIFY("IN-5")
47519        // 0x0001 - "priz4" // standard input (expected here)
47520        // 0x0002 - "priz3" // standard input (expected here)
47521        // 0x0004 - "priz2" // standard input (expected here)
47522        // 0x0008 - "priz1" // standard input (expected here)
47523        PORT_MODIFY("IN-6")
47524        // 0x0001 - "perc1" // standard input (expected here)
47525        // 0x0002 - "perc2" // standard input (expected here)
47526        // 0x0004 - "perc3" // standard input (expected here)
47527        // 0x0008 - "perc4" // standard input (expected here)
47528        PORT_MODIFY("IN-8")
47529        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
47530        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c feat")
47531        PORT_MODIFY("IN-16")
47532        // 0x0001 - "dil1" // standard input (motherboard)
47533        // 0x0002 - "dil2" // standard input (motherboard)
47534        // 0x0004 - "dil3" // standard input (motherboard)
47535        // 0x0008 - "dil4" // standard input (motherboard)
47536        // 0x0010 - "dil5" // standard input (motherboard)
47537        // 0x0100 - "htopup" // known extended input, usually 'top up'
47538        PORT_MODIFY("IN-17")
47539        // 0x0001 - "dil6" // standard input (motherboard)
47540        // 0x0002 - "dil7" // standard input (motherboard)
47541        // 0x0004 - "dil8" // standard input (motherboard)
47542        // 0x0008 - "dil9" // standard input (motherboard)
47543        // 0x0010 - "dil10" // standard input (motherboard)
47544        PORT_MODIFY("IN-18")
47545        // 0x0001 - "dil11" // standard input (motherboard)
47546        // 0x0002 - "dil12" // standard input (motherboard)
47547        // 0x0004 - "dil13" // standard input (motherboard)
47548        // 0x0008 - "dil14" // standard input (motherboard)
47549        // 0x0010 - "dil15" // standard input (motherboard)
47550        PORT_MODIFY("IN-19")
47551        // 0x0001 - "dil16" // standard input (motherboard)
47552        PORT_MODIFY("IN-20")
47553        // 0x0001 - "grnbut" // standard input (motherboard)
47554        // 0x0002 - "dorlok" // standard input (expected here)
47555        // 0x0004 - "serdor" // standard input (expected here)
47556        // 0x0008 - "cshdor" // standard input (expected here)
47557        // 0x0010 - "hopdmp" // standard input (expected here)
47498      PORT_INCLUDE( sc4_base )
47499      PORT_MODIFY("IN-1")
47500      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47501      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47502      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47503      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47504      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
47505      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
47506      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
47507      PORT_MODIFY("IN-2")
47508      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
47509      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
47510      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47511      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47512      PORT_MODIFY("IN-3")
47513      // 0x0004 - "stk 4" // standard input (expected here)
47514      // 0x0008 - "stk 3" // standard input (expected here)
47515      // 0x0010 - "stk 2" // standard input (expected here)
47516      PORT_MODIFY("IN-4")
47517      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
47518      PORT_MODIFY("IN-5")
47519      // 0x0001 - "priz4" // standard input (expected here)
47520      // 0x0002 - "priz3" // standard input (expected here)
47521      // 0x0004 - "priz2" // standard input (expected here)
47522      // 0x0008 - "priz1" // standard input (expected here)
47523      PORT_MODIFY("IN-6")
47524      // 0x0001 - "perc1" // standard input (expected here)
47525      // 0x0002 - "perc2" // standard input (expected here)
47526      // 0x0004 - "perc3" // standard input (expected here)
47527      // 0x0008 - "perc4" // standard input (expected here)
47528      PORT_MODIFY("IN-8")
47529      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c cash")
47530      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c feat")
47531      PORT_MODIFY("IN-16")
47532      // 0x0001 - "dil1" // standard input (motherboard)
47533      // 0x0002 - "dil2" // standard input (motherboard)
47534      // 0x0004 - "dil3" // standard input (motherboard)
47535      // 0x0008 - "dil4" // standard input (motherboard)
47536      // 0x0010 - "dil5" // standard input (motherboard)
47537      // 0x0100 - "htopup" // known extended input, usually 'top up'
47538      PORT_MODIFY("IN-17")
47539      // 0x0001 - "dil6" // standard input (motherboard)
47540      // 0x0002 - "dil7" // standard input (motherboard)
47541      // 0x0004 - "dil8" // standard input (motherboard)
47542      // 0x0008 - "dil9" // standard input (motherboard)
47543      // 0x0010 - "dil10" // standard input (motherboard)
47544      PORT_MODIFY("IN-18")
47545      // 0x0001 - "dil11" // standard input (motherboard)
47546      // 0x0002 - "dil12" // standard input (motherboard)
47547      // 0x0004 - "dil13" // standard input (motherboard)
47548      // 0x0008 - "dil14" // standard input (motherboard)
47549      // 0x0010 - "dil15" // standard input (motherboard)
47550      PORT_MODIFY("IN-19")
47551      // 0x0001 - "dil16" // standard input (motherboard)
47552      PORT_MODIFY("IN-20")
47553      // 0x0001 - "grnbut" // standard input (motherboard)
47554      // 0x0002 - "dorlok" // standard input (expected here)
47555      // 0x0004 - "serdor" // standard input (expected here)
47556      // 0x0008 - "cshdor" // standard input (expected here)
47557      // 0x0010 - "hopdmp" // standard input (expected here)
4755847558INPUT_PORTS_END
4755947559
4756047560// PAY UNIT ERR 17
r31373r31374
4756647566GAMEL( 200?, sc4cjd      ,sc4cj,     sc4, sc4cj, sc4_state, sc4, ROT0, "BFM","Cool Jewels (Bellfruit) (Scorpion 4) (set 5)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 ) // incomplete pairing
4756747567
4756847568INPUT_PORTS_START( sc4crnjw ) // this structure is generated
47569        PORT_INCLUDE( sc4_base )
47570        PORT_MODIFY("IN-1")
47571        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47572        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47573        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47574        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47575        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
47576        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
47577        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
47578        PORT_MODIFY("IN-2")
47579        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
47580        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
47581        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47582        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47583        PORT_MODIFY("IN-3")
47584        // 0x0004 - "stk 4" // standard input (expected here)
47585        // 0x0008 - "stk 2" // standard input (expected here)
47586        // 0x0010 - "stk 3" // standard input (expected here)
47587        PORT_MODIFY("IN-4")
47588        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
47589        PORT_MODIFY("IN-5")
47590        // 0x0001 - "priz4" // standard input (expected here)
47591        // 0x0002 - "priz3" // standard input (expected here)
47592        // 0x0004 - "priz2" // standard input (expected here)
47593        // 0x0008 - "priz1" // standard input (expected here)
47594        PORT_MODIFY("IN-6")
47595        // 0x0001 - "perc1" // standard input (expected here)
47596        // 0x0002 - "perc2" // standard input (expected here)
47597        // 0x0004 - "perc3" // standard input (expected here)
47598        // 0x0008 - "perc4" // standard input (expected here)
47599        PORT_MODIFY("IN-8")
47600        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("red  b")
47601        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("oran b")
47602        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("bonus")
47603        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("blue b")
47604        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("gren b")
47605        PORT_MODIFY("IN-16")
47606        // 0x0001 - "dil1" // standard input (motherboard)
47607        // 0x0002 - "dil2" // standard input (motherboard)
47608        // 0x0004 - "dil3" // standard input (motherboard)
47609        // 0x0008 - "dil4" // standard input (motherboard)
47610        // 0x0010 - "dil5" // standard input (motherboard)
47611        PORT_MODIFY("IN-17")
47612        // 0x0001 - "dil6" // standard input (motherboard)
47613        // 0x0002 - "dil7" // standard input (motherboard)
47614        // 0x0004 - "dil8" // standard input (motherboard)
47615        // 0x0008 - "dil9" // standard input (motherboard)
47616        // 0x0010 - "dil10" // standard input (motherboard)
47617        PORT_MODIFY("IN-18")
47618        // 0x0001 - "dil11" // standard input (motherboard)
47619        // 0x0002 - "dil12" // standard input (motherboard)
47620        // 0x0004 - "dil13" // standard input (motherboard)
47621        // 0x0008 - "dil14" // standard input (motherboard)
47622        // 0x0010 - "dil15" // standard input (motherboard)
47623        PORT_MODIFY("IN-19")
47624        // 0x0001 - "dil16" // standard input (motherboard)
47625        PORT_MODIFY("IN-20")
47626        // 0x0001 - "grnbut" // standard input (motherboard)
47627        // 0x0002 - "dorlok" // standard input (expected here)
47628        // 0x0004 - "serdor" // standard input (expected here)
47629        // 0x0008 - "cshdor" // standard input (expected here)
47630        // 0x0010 - "hopdmp" // standard input (expected here)
47569      PORT_INCLUDE( sc4_base )
47570      PORT_MODIFY("IN-1")
47571      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47572      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47573      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47574      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47575      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
47576      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
47577      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
47578      PORT_MODIFY("IN-2")
47579      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
47580      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
47581      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47582      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47583      PORT_MODIFY("IN-3")
47584      // 0x0004 - "stk 4" // standard input (expected here)
47585      // 0x0008 - "stk 2" // standard input (expected here)
47586      // 0x0010 - "stk 3" // standard input (expected here)
47587      PORT_MODIFY("IN-4")
47588      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
47589      PORT_MODIFY("IN-5")
47590      // 0x0001 - "priz4" // standard input (expected here)
47591      // 0x0002 - "priz3" // standard input (expected here)
47592      // 0x0004 - "priz2" // standard input (expected here)
47593      // 0x0008 - "priz1" // standard input (expected here)
47594      PORT_MODIFY("IN-6")
47595      // 0x0001 - "perc1" // standard input (expected here)
47596      // 0x0002 - "perc2" // standard input (expected here)
47597      // 0x0004 - "perc3" // standard input (expected here)
47598      // 0x0008 - "perc4" // standard input (expected here)
47599      PORT_MODIFY("IN-8")
47600      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("red  b")
47601      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("oran b")
47602      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("bonus")
47603      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("blue b")
47604      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("gren b")
47605      PORT_MODIFY("IN-16")
47606      // 0x0001 - "dil1" // standard input (motherboard)
47607      // 0x0002 - "dil2" // standard input (motherboard)
47608      // 0x0004 - "dil3" // standard input (motherboard)
47609      // 0x0008 - "dil4" // standard input (motherboard)
47610      // 0x0010 - "dil5" // standard input (motherboard)
47611      PORT_MODIFY("IN-17")
47612      // 0x0001 - "dil6" // standard input (motherboard)
47613      // 0x0002 - "dil7" // standard input (motherboard)
47614      // 0x0004 - "dil8" // standard input (motherboard)
47615      // 0x0008 - "dil9" // standard input (motherboard)
47616      // 0x0010 - "dil10" // standard input (motherboard)
47617      PORT_MODIFY("IN-18")
47618      // 0x0001 - "dil11" // standard input (motherboard)
47619      // 0x0002 - "dil12" // standard input (motherboard)
47620      // 0x0004 - "dil13" // standard input (motherboard)
47621      // 0x0008 - "dil14" // standard input (motherboard)
47622      // 0x0010 - "dil15" // standard input (motherboard)
47623      PORT_MODIFY("IN-19")
47624      // 0x0001 - "dil16" // standard input (motherboard)
47625      PORT_MODIFY("IN-20")
47626      // 0x0001 - "grnbut" // standard input (motherboard)
47627      // 0x0002 - "dorlok" // standard input (expected here)
47628      // 0x0004 - "serdor" // standard input (expected here)
47629      // 0x0008 - "cshdor" // standard input (expected here)
47630      // 0x0010 - "hopdmp" // standard input (expected here)
4763147631INPUT_PORTS_END
4763247632
4763347633// PAY UNIT ERROR 17
r31373r31374
4763647636GAMEL( 200?, sc4crnjwa   ,sc4crnjw,  sc4, sc4crnjw, sc4_state, sc4, ROT0, "BFM","Crown Jewels (Bellfruit) (Scorpion 4) (set 2)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4763747637
4763847638INPUT_PORTS_START( sc4jjok ) // this structure is generated
47639        PORT_INCLUDE( sc4_base )
47640        PORT_MODIFY("IN-1")
47641        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47642        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47643        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47644        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47645        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
47646        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
47647        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
47648        PORT_MODIFY("IN-2")
47649        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
47650        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
47651        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47652        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47653        PORT_MODIFY("IN-3")
47654        // 0x0004 - "stk 4" // standard input (expected here)
47655        // 0x0008 - "stk 2" // standard input (expected here)
47656        // 0x0010 - "stk 3" // standard input (expected here)
47657        PORT_MODIFY("IN-5")
47658        // 0x0001 - "priz4" // standard input (expected here)
47659        // 0x0002 - "priz3" // standard input (expected here)
47660        // 0x0004 - "priz2" // standard input (expected here)
47661        // 0x0008 - "priz1" // standard input (expected here)
47662        PORT_MODIFY("IN-6")
47663        // 0x0001 - "perc1" // standard input (expected here)
47664        // 0x0002 - "perc2" // standard input (expected here)
47665        // 0x0004 - "perc3" // standard input (expected here)
47666        // 0x0008 - "perc4" // standard input (expected here)
47667        PORT_MODIFY("IN-8")
47668        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("lo nud")
47669        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lo csh")
47670        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lo fet")
47671        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi nud")
47672        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi csh")
47673        PORT_MODIFY("IN-9")
47674        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hi fet")
47675        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("bonus")
47676        PORT_MODIFY("IN-16")
47677        // 0x0001 - "dil1" // standard input (motherboard)
47678        // 0x0002 - "dil2" // standard input (motherboard)
47679        // 0x0004 - "dil3" // standard input (motherboard)
47680        // 0x0008 - "dil4" // standard input (motherboard)
47681        // 0x0010 - "dil5" // standard input (motherboard)
47682        // 0x0100 - "htopup" // known extended input, usually 'top up'
47683        PORT_MODIFY("IN-17")
47684        // 0x0001 - "dil6" // standard input (motherboard)
47685        // 0x0002 - "dil7" // standard input (motherboard)
47686        // 0x0004 - "dil8" // standard input (motherboard)
47687        // 0x0008 - "dil9" // standard input (motherboard)
47688        // 0x0010 - "dil10" // standard input (motherboard)
47689        PORT_MODIFY("IN-18")
47690        // 0x0001 - "dil11" // standard input (motherboard)
47691        // 0x0002 - "dil12" // standard input (motherboard)
47692        // 0x0004 - "dil13" // standard input (motherboard)
47693        // 0x0008 - "dil14" // standard input (motherboard)
47694        // 0x0010 - "dil15" // standard input (motherboard)
47695        PORT_MODIFY("IN-19")
47696        // 0x0001 - "dil16" // standard input (motherboard)
47697        PORT_MODIFY("IN-20")
47698        // 0x0001 - "grnbut" // standard input (motherboard)
47699        // 0x0002 - "dorlok" // standard input (expected here)
47700        // 0x0004 - "serdor" // standard input (expected here)
47701        // 0x0008 - "cshdor" // standard input (expected here)
47702        // 0x0010 - "hopdmp" // standard input (expected here)
47639      PORT_INCLUDE( sc4_base )
47640      PORT_MODIFY("IN-1")
47641      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47642      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47643      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47644      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47645      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
47646      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
47647      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
47648      PORT_MODIFY("IN-2")
47649      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
47650      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
47651      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47652      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47653      PORT_MODIFY("IN-3")
47654      // 0x0004 - "stk 4" // standard input (expected here)
47655      // 0x0008 - "stk 2" // standard input (expected here)
47656      // 0x0010 - "stk 3" // standard input (expected here)
47657      PORT_MODIFY("IN-5")
47658      // 0x0001 - "priz4" // standard input (expected here)
47659      // 0x0002 - "priz3" // standard input (expected here)
47660      // 0x0004 - "priz2" // standard input (expected here)
47661      // 0x0008 - "priz1" // standard input (expected here)
47662      PORT_MODIFY("IN-6")
47663      // 0x0001 - "perc1" // standard input (expected here)
47664      // 0x0002 - "perc2" // standard input (expected here)
47665      // 0x0004 - "perc3" // standard input (expected here)
47666      // 0x0008 - "perc4" // standard input (expected here)
47667      PORT_MODIFY("IN-8")
47668      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("lo nud")
47669      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("lo csh")
47670      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lo fet")
47671      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("hi nud")
47672      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi csh")
47673      PORT_MODIFY("IN-9")
47674      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("hi fet")
47675      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("bonus")
47676      PORT_MODIFY("IN-16")
47677      // 0x0001 - "dil1" // standard input (motherboard)
47678      // 0x0002 - "dil2" // standard input (motherboard)
47679      // 0x0004 - "dil3" // standard input (motherboard)
47680      // 0x0008 - "dil4" // standard input (motherboard)
47681      // 0x0010 - "dil5" // standard input (motherboard)
47682      // 0x0100 - "htopup" // known extended input, usually 'top up'
47683      PORT_MODIFY("IN-17")
47684      // 0x0001 - "dil6" // standard input (motherboard)
47685      // 0x0002 - "dil7" // standard input (motherboard)
47686      // 0x0004 - "dil8" // standard input (motherboard)
47687      // 0x0008 - "dil9" // standard input (motherboard)
47688      // 0x0010 - "dil10" // standard input (motherboard)
47689      PORT_MODIFY("IN-18")
47690      // 0x0001 - "dil11" // standard input (motherboard)
47691      // 0x0002 - "dil12" // standard input (motherboard)
47692      // 0x0004 - "dil13" // standard input (motherboard)
47693      // 0x0008 - "dil14" // standard input (motherboard)
47694      // 0x0010 - "dil15" // standard input (motherboard)
47695      PORT_MODIFY("IN-19")
47696      // 0x0001 - "dil16" // standard input (motherboard)
47697      PORT_MODIFY("IN-20")
47698      // 0x0001 - "grnbut" // standard input (motherboard)
47699      // 0x0002 - "dorlok" // standard input (expected here)
47700      // 0x0004 - "serdor" // standard input (expected here)
47701      // 0x0008 - "cshdor" // standard input (expected here)
47702      // 0x0010 - "hopdmp" // standard input (expected here)
4770347703INPUT_PORTS_END
4770447704
4770547705// PAY UNIT ERR 17
r31373r31374
4770947709
4771047710
4771147711INPUT_PORTS_START( sc4copsr ) // this structure is generated
47712        PORT_INCLUDE( sc4_base )
47713        PORT_MODIFY("IN-1")
47714        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47715        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
47716        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
47717        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
47718        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
47719        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
47720        PORT_MODIFY("IN-2")
47721        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
47722        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
47723        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47724        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47725        PORT_MODIFY("IN-3")
47726        // 0x0004 - "stk 4" // standard input (expected here)
47727        // 0x0008 - "stk 3" // standard input (expected here)
47728        // 0x0010 - "stk 2" // standard input (expected here)
47729        PORT_MODIFY("IN-5")
47730        // 0x0001 - "priz4" // standard input (expected here)
47731        // 0x0002 - "priz3" // standard input (expected here)
47732        // 0x0004 - "priz2" // standard input (expected here)
47733        // 0x0008 - "priz1" // standard input (expected here)
47734        PORT_MODIFY("IN-6")
47735        // 0x0001 - "perc1" // standard input (expected here)
47736        // 0x0002 - "perc2" // standard input (expected here)
47737        // 0x0004 - "perc3" // standard input (expected here)
47738        // 0x0008 - "perc4" // standard input (expected here)
47739        PORT_MODIFY("IN-16")
47740        // 0x0001 - "dil 1" // standard input (motherboard)
47741        // 0x0002 - "dil 2" // standard input (motherboard)
47742        // 0x0004 - "dil 3" // standard input (motherboard)
47743        // 0x0008 - "dil 4" // standard input (motherboard)
47744        // 0x0010 - "dil 5" // standard input (motherboard)
47745        PORT_MODIFY("IN-17")
47746        // 0x0001 - "dil 6" // standard input (motherboard)
47747        // 0x0002 - "dil 7" // standard input (motherboard)
47748        // 0x0004 - "dil 8" // standard input (motherboard)
47749        // 0x0008 - "dil 9" // standard input (motherboard)
47750        // 0x0010 - "dil 10" // standard input (motherboard)
47751        PORT_MODIFY("IN-18")
47752        // 0x0001 - "dil 11" // standard input (motherboard)
47753        // 0x0002 - "dil 12" // standard input (motherboard)
47754        // 0x0004 - "dil 13" // standard input (motherboard)
47755        // 0x0008 - "dil 14" // standard input (motherboard)
47756        // 0x0010 - "dil 15" // standard input (motherboard)
47757        PORT_MODIFY("IN-19")
47758        // 0x0001 - "dil 16" // standard input (motherboard)
47759        PORT_MODIFY("IN-20")
47760        // 0x0001 - "grnbut" // standard input (motherboard)
47761        // 0x0002 - "dorlok" // standard input (expected here)
47762        // 0x0004 - "serdor" // standard input (expected here)
47763        // 0x0008 - "cshdor" // standard input (expected here)
47764        // 0x0010 - "hopdmp" // standard input (expected here)
47712      PORT_INCLUDE( sc4_base )
47713      PORT_MODIFY("IN-1")
47714      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47715      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
47716      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
47717      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
47718      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
47719      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
47720      PORT_MODIFY("IN-2")
47721      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
47722      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
47723      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47724      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47725      PORT_MODIFY("IN-3")
47726      // 0x0004 - "stk 4" // standard input (expected here)
47727      // 0x0008 - "stk 3" // standard input (expected here)
47728      // 0x0010 - "stk 2" // standard input (expected here)
47729      PORT_MODIFY("IN-5")
47730      // 0x0001 - "priz4" // standard input (expected here)
47731      // 0x0002 - "priz3" // standard input (expected here)
47732      // 0x0004 - "priz2" // standard input (expected here)
47733      // 0x0008 - "priz1" // standard input (expected here)
47734      PORT_MODIFY("IN-6")
47735      // 0x0001 - "perc1" // standard input (expected here)
47736      // 0x0002 - "perc2" // standard input (expected here)
47737      // 0x0004 - "perc3" // standard input (expected here)
47738      // 0x0008 - "perc4" // standard input (expected here)
47739      PORT_MODIFY("IN-16")
47740      // 0x0001 - "dil 1" // standard input (motherboard)
47741      // 0x0002 - "dil 2" // standard input (motherboard)
47742      // 0x0004 - "dil 3" // standard input (motherboard)
47743      // 0x0008 - "dil 4" // standard input (motherboard)
47744      // 0x0010 - "dil 5" // standard input (motherboard)
47745      PORT_MODIFY("IN-17")
47746      // 0x0001 - "dil 6" // standard input (motherboard)
47747      // 0x0002 - "dil 7" // standard input (motherboard)
47748      // 0x0004 - "dil 8" // standard input (motherboard)
47749      // 0x0008 - "dil 9" // standard input (motherboard)
47750      // 0x0010 - "dil 10" // standard input (motherboard)
47751      PORT_MODIFY("IN-18")
47752      // 0x0001 - "dil 11" // standard input (motherboard)
47753      // 0x0002 - "dil 12" // standard input (motherboard)
47754      // 0x0004 - "dil 13" // standard input (motherboard)
47755      // 0x0008 - "dil 14" // standard input (motherboard)
47756      // 0x0010 - "dil 15" // standard input (motherboard)
47757      PORT_MODIFY("IN-19")
47758      // 0x0001 - "dil 16" // standard input (motherboard)
47759      PORT_MODIFY("IN-20")
47760      // 0x0001 - "grnbut" // standard input (motherboard)
47761      // 0x0002 - "dorlok" // standard input (expected here)
47762      // 0x0004 - "serdor" // standard input (expected here)
47763      // 0x0008 - "cshdor" // standard input (expected here)
47764      // 0x0010 - "hopdmp" // standard input (expected here)
4776547765INPUT_PORTS_END
4776647766
4776747767// PAY UNIT ERR 17
r31373r31374
4777847778GAMEL( 200?, sc4copsri   ,sc4copsr,  sc4, sc4copsr, sc4_state, sc4, ROT0, "BFM","Cops 'n' Robbers (Bellfruit) (Scorpion 4) (set 10)", GAME_NOT_WORKING | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4777947779
4778047780INPUT_PORTS_START( sc4druby ) // this structure is generated
47781        PORT_INCLUDE( sc4_base )
47782        PORT_MODIFY("IN-1")
47783        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
47784        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47785        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47786        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47787        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("autopl")
47788        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("pndlow OR 10plow")
47789        PORT_MODIFY("IN-2")
47790        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
47791        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
47792        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47793        PORT_MODIFY("IN-3")
47794        // 0x0004 - "stk 4" // standard input (expected here)
47795        // 0x0008 - "stk 3" // standard input (expected here)
47796        // 0x0010 - "stk 2" // standard input (expected here)
47797        PORT_MODIFY("IN-4")
47798        // 0x0008 - "htopup" // known extended(?) input, sometimes 'hop top'
47799        PORT_MODIFY("IN-5")
47800        // 0x0001 - "priz4" // standard input (expected here)
47801        // 0x0002 - "priz3" // standard input (expected here)
47802        // 0x0004 - "priz2" // standard input (expected here)
47803        // 0x0008 - "priz1" // standard input (expected here)
47804        PORT_MODIFY("IN-6")
47805        // 0x0001 - "perc1" // standard input (expected here)
47806        // 0x0002 - "perc2" // standard input (expected here)
47807        // 0x0004 - "perc3" // standard input (expected here)
47808        // 0x0008 - "perc4" // standard input (expected here)
47809        PORT_MODIFY("IN-16")
47810        // 0x0001 - "dil 1" // standard input (motherboard)
47811        // 0x0002 - "dil 2" // standard input (motherboard)
47812        // 0x0004 - "dil 3" // standard input (motherboard)
47813        // 0x0008 - "dil 4" // standard input (motherboard)
47814        // 0x0010 - "dil 5" // standard input (motherboard)
47815        PORT_MODIFY("IN-17")
47816        // 0x0001 - "dil 6" // standard input (motherboard)
47817        // 0x0002 - "dil 7" // standard input (motherboard)
47818        // 0x0004 - "dil 8" // standard input (motherboard)
47819        // 0x0008 - "dil 9" // standard input (motherboard)
47820        // 0x0010 - "dil 10" // standard input (motherboard)
47821        PORT_MODIFY("IN-18")
47822        // 0x0001 - "dil 11" // standard input (motherboard)
47823        // 0x0002 - "dil 12" // standard input (motherboard)
47824        // 0x0004 - "dil 13" // standard input (motherboard)
47825        // 0x0008 - "dil 14" // standard input (motherboard)
47826        // 0x0010 - "dil 15" // standard input (motherboard)
47827        PORT_MODIFY("IN-19")
47828        // 0x0001 - "dil 16" // standard input (motherboard)
47829        PORT_MODIFY("IN-20")
47830        // 0x0001 - "grnbut" // standard input (motherboard)
47831        // 0x0002 - "cshdor" // standard input (expected here)
47832        // 0x0004 - "serdor" // standard input (expected here)
47833        // 0x0008 - "hopdmp" // standard input (expected here)
47781      PORT_INCLUDE( sc4_base )
47782      PORT_MODIFY("IN-1")
47783      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
47784      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
47785      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
47786      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
47787      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("autopl")
47788      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("pndlow OR 10plow")
47789      PORT_MODIFY("IN-2")
47790      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("transf")
47791      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("start")
47792      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
47793      PORT_MODIFY("IN-3")
47794      // 0x0004 - "stk 4" // standard input (expected here)
47795      // 0x0008 - "stk 3" // standard input (expected here)
47796      // 0x0010 - "stk 2" // standard input (expected here)
47797      PORT_MODIFY("IN-4")
47798      // 0x0008 - "htopup" // known extended(?) input, sometimes 'hop top'
47799      PORT_MODIFY("IN-5")
47800      // 0x0001 - "priz4" // standard input (expected here)
47801      // 0x0002 - "priz3" // standard input (expected here)
47802      // 0x0004 - "priz2" // standard input (expected here)
47803      // 0x0008 - "priz1" // standard input (expected here)
47804      PORT_MODIFY("IN-6")
47805      // 0x0001 - "perc1" // standard input (expected here)
47806      // 0x0002 - "perc2" // standard input (expected here)
47807      // 0x0004 - "perc3" // standard input (expected here)
47808      // 0x0008 - "perc4" // standard input (expected here)
47809      PORT_MODIFY("IN-16")
47810      // 0x0001 - "dil 1" // standard input (motherboard)
47811      // 0x0002 - "dil 2" // standard input (motherboard)
47812      // 0x0004 - "dil 3" // standard input (motherboard)
47813      // 0x0008 - "dil 4" // standard input (motherboard)
47814      // 0x0010 - "dil 5" // standard input (motherboard)
47815      PORT_MODIFY("IN-17")
47816      // 0x0001 - "dil 6" // standard input (motherboard)
47817      // 0x0002 - "dil 7" // standard input (motherboard)
47818      // 0x0004 - "dil 8" // standard input (motherboard)
47819      // 0x0008 - "dil 9" // standard input (motherboard)
47820      // 0x0010 - "dil 10" // standard input (motherboard)
47821      PORT_MODIFY("IN-18")
47822      // 0x0001 - "dil 11" // standard input (motherboard)
47823      // 0x0002 - "dil 12" // standard input (motherboard)
47824      // 0x0004 - "dil 13" // standard input (motherboard)
47825      // 0x0008 - "dil 14" // standard input (motherboard)
47826      // 0x0010 - "dil 15" // standard input (motherboard)
47827      PORT_MODIFY("IN-19")
47828      // 0x0001 - "dil 16" // standard input (motherboard)
47829      PORT_MODIFY("IN-20")
47830      // 0x0001 - "grnbut" // standard input (motherboard)
47831      // 0x0002 - "cshdor" // standard input (expected here)
47832      // 0x0004 - "serdor" // standard input (expected here)
47833      // 0x0008 - "hopdmp" // standard input (expected here)
4783447834INPUT_PORTS_END
4783547835
4783647836// gives an 'init comms' countdown
r31373r31374
4787047870}
4787147871
4787247872INPUT_PORTS_START( sc4abra ) // this structure is generated
47873        PORT_INCLUDE( sc4_base )
47874        PORT_MODIFY("IN-1")
47875        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
47876        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
47877        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
47878        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
47879        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stake")
47880        PORT_MODIFY("IN-2")
47881        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
47882        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("xfer")
47883        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47884        PORT_MODIFY("IN-8")
47885        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
47886        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
47887        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
47888        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
47889        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
47890        PORT_MODIFY("IN-9")
47891        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
47892        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
47893        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
47894        PORT_MODIFY("IN-16")
47895        // 0x0001 - "dil 1" // standard input (motherboard)
47896        // 0x0002 - "dil 2" // standard input (motherboard)
47897        // 0x0004 - "dil 3" // standard input (motherboard)
47898        // 0x0008 - "dil 4" // standard input (motherboard)
47899        // 0x0010 - "dil 5" // standard input (motherboard)
47900        // 0x0100 - "topup" // known extended input, usually 'top up'
47901        PORT_MODIFY("IN-17")
47902        // 0x0001 - "dil 6" // standard input (motherboard)
47903        // 0x0002 - "dil 7" // standard input (motherboard)
47904        // 0x0004 - "dil 8" // standard input (motherboard)
47905        // 0x0008 - "dil 9" // standard input (motherboard)
47906        // 0x0010 - "dil10" // standard input (motherboard)
47907        PORT_MODIFY("IN-18")
47908        // 0x0001 - "dil11" // standard input (motherboard)
47909        // 0x0002 - "dil12" // standard input (motherboard)
47910        // 0x0004 - "dil13" // standard input (motherboard)
47911        // 0x0008 - "dil14" // standard input (motherboard)
47912        // 0x0010 - "dil15" // standard input (motherboard)
47913        PORT_MODIFY("IN-19")
47914        // 0x0001 - "dil16" // standard input (motherboard)
47915        PORT_MODIFY("IN-20")
47916        // 0x0001 - "test" // standard input (motherboard)
47917        // 0x0002 - "dorlk" // standard input (expected here)
47918        // 0x0004 - "tpdor" // standard input (expected here)
47919        // 0x0008 - "cshbx" // standard input (expected here)
47920        // 0x0010 - "deflt" // standard input (expected here)
47873      PORT_INCLUDE( sc4_base )
47874      PORT_MODIFY("IN-1")
47875      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
47876      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
47877      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
47878      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
47879      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stake")
47880      PORT_MODIFY("IN-2")
47881      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
47882      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("xfer")
47883      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47884      PORT_MODIFY("IN-8")
47885      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
47886      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
47887      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
47888      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
47889      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
47890      PORT_MODIFY("IN-9")
47891      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
47892      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
47893      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
47894      PORT_MODIFY("IN-16")
47895      // 0x0001 - "dil 1" // standard input (motherboard)
47896      // 0x0002 - "dil 2" // standard input (motherboard)
47897      // 0x0004 - "dil 3" // standard input (motherboard)
47898      // 0x0008 - "dil 4" // standard input (motherboard)
47899      // 0x0010 - "dil 5" // standard input (motherboard)
47900      // 0x0100 - "topup" // known extended input, usually 'top up'
47901      PORT_MODIFY("IN-17")
47902      // 0x0001 - "dil 6" // standard input (motherboard)
47903      // 0x0002 - "dil 7" // standard input (motherboard)
47904      // 0x0004 - "dil 8" // standard input (motherboard)
47905      // 0x0008 - "dil 9" // standard input (motherboard)
47906      // 0x0010 - "dil10" // standard input (motherboard)
47907      PORT_MODIFY("IN-18")
47908      // 0x0001 - "dil11" // standard input (motherboard)
47909      // 0x0002 - "dil12" // standard input (motherboard)
47910      // 0x0004 - "dil13" // standard input (motherboard)
47911      // 0x0008 - "dil14" // standard input (motherboard)
47912      // 0x0010 - "dil15" // standard input (motherboard)
47913      PORT_MODIFY("IN-19")
47914      // 0x0001 - "dil16" // standard input (motherboard)
47915      PORT_MODIFY("IN-20")
47916      // 0x0001 - "test" // standard input (motherboard)
47917      // 0x0002 - "dorlk" // standard input (expected here)
47918      // 0x0004 - "tpdor" // standard input (expected here)
47919      // 0x0008 - "cshbx" // standard input (expected here)
47920      // 0x0010 - "deflt" // standard input (expected here)
4792147921INPUT_PORTS_END
4792247922
4792347923// missing sound roms
r31373r31374
4793147931
4793247932
4793347933INPUT_PORTS_START( sc4alad ) // this structure is generated
47934        PORT_INCLUDE( sc4_base )
47935        PORT_MODIFY("IN-1")
47936        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47937        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
47938        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
47939        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
47940        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("take")
47941        PORT_MODIFY("IN-2")
47942        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
47943        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47944        PORT_MODIFY("IN-8")
47945        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("ko")
47946        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("blast")
47947        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
47948        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("winspn")
47949        PORT_MODIFY("IN-16")
47950        // 0x0001 - "dil 1" // standard input (motherboard)
47951        // 0x0002 - "dil 2" // standard input (motherboard)
47952        // 0x0004 - "dil 3" // standard input (motherboard)
47953        // 0x0008 - "dil 4" // standard input (motherboard)
47954        // 0x0010 - "dil 5" // standard input (motherboard)
47955        PORT_MODIFY("IN-17")
47956        // 0x0001 - "dil 6" // standard input (motherboard)
47957        // 0x0002 - "dil 7" // standard input (motherboard)
47958        // 0x0004 - "dil 8" // standard input (motherboard)
47959        // 0x0008 - "dil 9" // standard input (motherboard)
47960        // 0x0010 - "dil 10" // standard input (motherboard)
47961        PORT_MODIFY("IN-18")
47962        // 0x0001 - "dil 11" // standard input (motherboard)
47963        // 0x0002 - "dil 12" // standard input (motherboard)
47964        // 0x0004 - "dil 13" // standard input (motherboard)
47965        // 0x0008 - "dil 14" // standard input (motherboard)
47966        // 0x0010 - "dil 15" // standard input (motherboard)
47967        PORT_MODIFY("IN-19")
47968        // 0x0001 - "dil 16" // standard input (motherboard)
47969        PORT_MODIFY("IN-20")
47970        // 0x0001 - "testsw" // standard input (motherboard)
47934      PORT_INCLUDE( sc4_base )
47935      PORT_MODIFY("IN-1")
47936      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
47937      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
47938      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
47939      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
47940      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("take")
47941      PORT_MODIFY("IN-2")
47942      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
47943      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
47944      PORT_MODIFY("IN-8")
47945      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("ko")
47946      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("blast")
47947      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("cash")
47948      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("winspn")
47949      PORT_MODIFY("IN-16")
47950      // 0x0001 - "dil 1" // standard input (motherboard)
47951      // 0x0002 - "dil 2" // standard input (motherboard)
47952      // 0x0004 - "dil 3" // standard input (motherboard)
47953      // 0x0008 - "dil 4" // standard input (motherboard)
47954      // 0x0010 - "dil 5" // standard input (motherboard)
47955      PORT_MODIFY("IN-17")
47956      // 0x0001 - "dil 6" // standard input (motherboard)
47957      // 0x0002 - "dil 7" // standard input (motherboard)
47958      // 0x0004 - "dil 8" // standard input (motherboard)
47959      // 0x0008 - "dil 9" // standard input (motherboard)
47960      // 0x0010 - "dil 10" // standard input (motherboard)
47961      PORT_MODIFY("IN-18")
47962      // 0x0001 - "dil 11" // standard input (motherboard)
47963      // 0x0002 - "dil 12" // standard input (motherboard)
47964      // 0x0004 - "dil 13" // standard input (motherboard)
47965      // 0x0008 - "dil 14" // standard input (motherboard)
47966      // 0x0010 - "dil 15" // standard input (motherboard)
47967      PORT_MODIFY("IN-19")
47968      // 0x0001 - "dil 16" // standard input (motherboard)
47969      PORT_MODIFY("IN-20")
47970      // 0x0001 - "testsw" // standard input (motherboard)
4797147971INPUT_PORTS_END
4797247972
4797347973// bad / missing sound roms
r31373r31374
4799547995}
4799647996
4799747997INPUT_PORTS_START( sc4bigdl ) // this structure is generated
47998        PORT_INCLUDE( sc4_base )
47999        PORT_MODIFY("IN-1")
48000        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48001        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48002        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48003        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48004        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
48005        PORT_MODIFY("IN-2")
48006        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
48007        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48008        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48009        PORT_MODIFY("IN-8")
48010        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudges")
48011        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("feats")
48012        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("knock")
48013        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("cash")
48014        PORT_MODIFY("IN-16")
48015        // 0x0001 - "dil  1" // standard input (motherboard)
48016        // 0x0002 - "dil  2" // standard input (motherboard)
48017        // 0x0004 - "dil  3" // standard input (motherboard)
48018        // 0x0008 - "dil  4" // standard input (motherboard)
48019        // 0x0010 - "dil  5" // standard input (motherboard)
48020        // 0x0100 - "topup" // known extended input, usually 'top up'
48021        PORT_MODIFY("IN-17")
48022        // 0x0001 - "dil  6" // standard input (motherboard)
48023        // 0x0002 - "dil  7" // standard input (motherboard)
48024        // 0x0004 - "dil  8" // standard input (motherboard)
48025        // 0x0008 - "dil  9" // standard input (motherboard)
48026        // 0x0010 - "dil 10" // standard input (motherboard)
48027        PORT_MODIFY("IN-18")
48028        // 0x0001 - "dil 11" // standard input (motherboard)
48029        // 0x0002 - "dil 12" // standard input (motherboard)
48030        // 0x0004 - "dil 13" // standard input (motherboard)
48031        // 0x0008 - "dil 14" // standard input (motherboard)
48032        // 0x0010 - "dil 15" // standard input (motherboard)
48033        PORT_MODIFY("IN-19")
48034        // 0x0001 - "dil 16" // standard input (motherboard)
48035        PORT_MODIFY("IN-20")
48036        // 0x0001 - "test" // standard input (motherboard)
48037        // 0x0002 - "lock" // standard input (expected here)
48038        // 0x0004 - "topdor" // standard input (expected here)
48039        // 0x0008 - "botdor" // standard input (expected here)
48040        // 0x0010 - "hopdmp" // standard input (expected here)
47998      PORT_INCLUDE( sc4_base )
47999      PORT_MODIFY("IN-1")
48000      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48001      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48002      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48003      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48004      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collet")
48005      PORT_MODIFY("IN-2")
48006      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
48007      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48008      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48009      PORT_MODIFY("IN-8")
48010      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nudges")
48011      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("feats")
48012      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("knock")
48013      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("cash")
48014      PORT_MODIFY("IN-16")
48015      // 0x0001 - "dil  1" // standard input (motherboard)
48016      // 0x0002 - "dil  2" // standard input (motherboard)
48017      // 0x0004 - "dil  3" // standard input (motherboard)
48018      // 0x0008 - "dil  4" // standard input (motherboard)
48019      // 0x0010 - "dil  5" // standard input (motherboard)
48020      // 0x0100 - "topup" // known extended input, usually 'top up'
48021      PORT_MODIFY("IN-17")
48022      // 0x0001 - "dil  6" // standard input (motherboard)
48023      // 0x0002 - "dil  7" // standard input (motherboard)
48024      // 0x0004 - "dil  8" // standard input (motherboard)
48025      // 0x0008 - "dil  9" // standard input (motherboard)
48026      // 0x0010 - "dil 10" // standard input (motherboard)
48027      PORT_MODIFY("IN-18")
48028      // 0x0001 - "dil 11" // standard input (motherboard)
48029      // 0x0002 - "dil 12" // standard input (motherboard)
48030      // 0x0004 - "dil 13" // standard input (motherboard)
48031      // 0x0008 - "dil 14" // standard input (motherboard)
48032      // 0x0010 - "dil 15" // standard input (motherboard)
48033      PORT_MODIFY("IN-19")
48034      // 0x0001 - "dil 16" // standard input (motherboard)
48035      PORT_MODIFY("IN-20")
48036      // 0x0001 - "test" // standard input (motherboard)
48037      // 0x0002 - "lock" // standard input (expected here)
48038      // 0x0004 - "topdor" // standard input (expected here)
48039      // 0x0008 - "botdor" // standard input (expected here)
48040      // 0x0010 - "hopdmp" // standard input (expected here)
4804148041INPUT_PORTS_END
4804248042
4804348043// missing sound roms, doesn't play
r31373r31374
4810148101}
4810248102
4810348103INPUT_PORTS_START( sc4cconxd ) // this structure is generated
48104        PORT_INCLUDE( sc4_base )
48105        PORT_MODIFY("IN-1")
48106        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48107        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48108        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48109        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48110        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("take")
48111        PORT_MODIFY("IN-2")
48112        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto")
48113        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchge")
48114        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48115        PORT_MODIFY("IN-8")
48116        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonusn")
48117        PORT_MODIFY("IN-16")
48118        // 0x0001 - "dil 1" // standard input (motherboard)
48119        // 0x0002 - "dil 2" // standard input (motherboard)
48120        // 0x0004 - "dil 3" // standard input (motherboard)
48121        // 0x0008 - "dil 4" // standard input (motherboard)
48122        // 0x0010 - "dil 5" // standard input (motherboard)
48123        PORT_MODIFY("IN-17")
48124        // 0x0001 - "dil 6" // standard input (motherboard)
48125        // 0x0002 - "dil 7" // standard input (motherboard)
48126        // 0x0004 - "dil 8" // standard input (motherboard)
48127        // 0x0008 - "dil 9" // standard input (motherboard)
48128        // 0x0010 - "dil 10" // standard input (motherboard)
48129        PORT_MODIFY("IN-18")
48130        // 0x0001 - "dil 11" // standard input (motherboard)
48131        // 0x0002 - "dil 12" // standard input (motherboard)
48132        // 0x0004 - "dil 13" // standard input (motherboard)
48133        // 0x0008 - "dil 14" // standard input (motherboard)
48134        // 0x0010 - "dil 15" // standard input (motherboard)
48135        PORT_MODIFY("IN-19")
48136        // 0x0001 - "dil 16" // standard input (motherboard)
48137        PORT_MODIFY("IN-20")
48138        // 0x0001 - "testsw" // standard input (motherboard)
48104      PORT_INCLUDE( sc4_base )
48105      PORT_MODIFY("IN-1")
48106      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48107      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48108      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48109      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48110      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("take")
48111      PORT_MODIFY("IN-2")
48112      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto")
48113      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchge")
48114      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48115      PORT_MODIFY("IN-8")
48116      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonusn")
48117      PORT_MODIFY("IN-16")
48118      // 0x0001 - "dil 1" // standard input (motherboard)
48119      // 0x0002 - "dil 2" // standard input (motherboard)
48120      // 0x0004 - "dil 3" // standard input (motherboard)
48121      // 0x0008 - "dil 4" // standard input (motherboard)
48122      // 0x0010 - "dil 5" // standard input (motherboard)
48123      PORT_MODIFY("IN-17")
48124      // 0x0001 - "dil 6" // standard input (motherboard)
48125      // 0x0002 - "dil 7" // standard input (motherboard)
48126      // 0x0004 - "dil 8" // standard input (motherboard)
48127      // 0x0008 - "dil 9" // standard input (motherboard)
48128      // 0x0010 - "dil 10" // standard input (motherboard)
48129      PORT_MODIFY("IN-18")
48130      // 0x0001 - "dil 11" // standard input (motherboard)
48131      // 0x0002 - "dil 12" // standard input (motherboard)
48132      // 0x0004 - "dil 13" // standard input (motherboard)
48133      // 0x0008 - "dil 14" // standard input (motherboard)
48134      // 0x0010 - "dil 15" // standard input (motherboard)
48135      PORT_MODIFY("IN-19")
48136      // 0x0001 - "dil 16" // standard input (motherboard)
48137      PORT_MODIFY("IN-20")
48138      // 0x0001 - "testsw" // standard input (motherboard)
4813948139INPUT_PORTS_END
4814048140
4814148141// no sound roms
r31373r31374
4816348163}
4816448164
4816548165INPUT_PORTS_START( sc4ccrus ) // this structure is generated
48166        PORT_INCLUDE( sc4_base )
48167        PORT_MODIFY("IN-1")
48168        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48169        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("excnge")
48170        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
48171        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
48172        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
48173        PORT_MODIFY("IN-2")
48174        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("higher")
48175        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("lower")
48176        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48177        PORT_MODIFY("IN-4")
48178        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
48179        PORT_MODIFY("IN-8")
48180        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fet")
48181        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
48182        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk zpb")
48183        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk zpr")
48184        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk p r")
48185        PORT_MODIFY("IN-9")
48186        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("tk p b")
48187        PORT_MODIFY("IN-16")
48188        // 0x0001 - "dil  1" // standard input (motherboard)
48189        // 0x0002 - "dil  2" // standard input (motherboard)
48190        // 0x0004 - "dil  3" // standard input (motherboard)
48191        // 0x0008 - "dil  4" // standard input (motherboard)
48192        // 0x0010 - "dil  5" // standard input (motherboard)
48193        PORT_MODIFY("IN-17")
48194        // 0x0001 - "dil  6" // standard input (motherboard)
48195        // 0x0002 - "dil  7" // standard input (motherboard)
48196        // 0x0004 - "dil  8" // standard input (motherboard)
48197        // 0x0008 - "dil  9" // standard input (motherboard)
48198        // 0x0010 - "dil 10" // standard input (motherboard)
48199        PORT_MODIFY("IN-18")
48200        // 0x0001 - "dil 11" // standard input (motherboard)
48201        // 0x0002 - "dil 12" // standard input (motherboard)
48202        // 0x0004 - "dil 13" // standard input (motherboard)
48203        // 0x0008 - "dil 14" // standard input (motherboard)
48204        // 0x0010 - "dil 15" // standard input (motherboard)
48205        PORT_MODIFY("IN-19")
48206        // 0x0001 - "dil 16" // standard input (motherboard)
48207        PORT_MODIFY("IN-20")
48208        // 0x0001 - "testsw" // standard input (motherboard)
48209        // 0x0002 - "dor lk" // standard input (expected here)
48210        // 0x0004 - "tp dor" // standard input (expected here)
48211        // 0x0008 - "csh bx" // standard input (expected here)
48212        // 0x0010 - "deflt" // standard input (expected here)
48166      PORT_INCLUDE( sc4_base )
48167      PORT_MODIFY("IN-1")
48168      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48169      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("excnge")
48170      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
48171      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
48172      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
48173      PORT_MODIFY("IN-2")
48174      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("higher")
48175      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("lower")
48176      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48177      PORT_MODIFY("IN-4")
48178      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
48179      PORT_MODIFY("IN-8")
48180      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fet")
48181      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
48182      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk zpb")
48183      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk zpr")
48184      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk p r")
48185      PORT_MODIFY("IN-9")
48186      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("tk p b")
48187      PORT_MODIFY("IN-16")
48188      // 0x0001 - "dil  1" // standard input (motherboard)
48189      // 0x0002 - "dil  2" // standard input (motherboard)
48190      // 0x0004 - "dil  3" // standard input (motherboard)
48191      // 0x0008 - "dil  4" // standard input (motherboard)
48192      // 0x0010 - "dil  5" // standard input (motherboard)
48193      PORT_MODIFY("IN-17")
48194      // 0x0001 - "dil  6" // standard input (motherboard)
48195      // 0x0002 - "dil  7" // standard input (motherboard)
48196      // 0x0004 - "dil  8" // standard input (motherboard)
48197      // 0x0008 - "dil  9" // standard input (motherboard)
48198      // 0x0010 - "dil 10" // standard input (motherboard)
48199      PORT_MODIFY("IN-18")
48200      // 0x0001 - "dil 11" // standard input (motherboard)
48201      // 0x0002 - "dil 12" // standard input (motherboard)
48202      // 0x0004 - "dil 13" // standard input (motherboard)
48203      // 0x0008 - "dil 14" // standard input (motherboard)
48204      // 0x0010 - "dil 15" // standard input (motherboard)
48205      PORT_MODIFY("IN-19")
48206      // 0x0001 - "dil 16" // standard input (motherboard)
48207      PORT_MODIFY("IN-20")
48208      // 0x0001 - "testsw" // standard input (motherboard)
48209      // 0x0002 - "dor lk" // standard input (expected here)
48210      // 0x0004 - "tp dor" // standard input (expected here)
48211      // 0x0008 - "csh bx" // standard input (expected here)
48212      // 0x0010 - "deflt" // standard input (expected here)
4821348213INPUT_PORTS_END
4821448214
4821548215
r31373r31374
4823948239}
4824048240
4824148241INPUT_PORTS_START( sc4jjc ) // this structure is generated
48242        PORT_INCLUDE( sc4_base )
48243        PORT_MODIFY("IN-1")
48244        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
48245        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
48246        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
48247        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
48248        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
48249        PORT_MODIFY("IN-2")
48250        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
48251        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("xfer")
48252        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48253        PORT_MODIFY("IN-8")
48254        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
48255        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
48256        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
48257        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
48258        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
48259        PORT_MODIFY("IN-9")
48260        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
48261        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
48262        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
48263        PORT_MODIFY("IN-16")
48264        // 0x0001 - "dil 1" // standard input (motherboard)
48265        // 0x0002 - "dil 2" // standard input (motherboard)
48266        // 0x0004 - "dil 3" // standard input (motherboard)
48267        // 0x0008 - "dil 4" // standard input (motherboard)
48268        // 0x0010 - "dil 5" // standard input (motherboard)
48269        // 0x0100 - "topup" // known extended input, usually 'top up'
48270        PORT_MODIFY("IN-17")
48271        // 0x0001 - "dil 6" // standard input (motherboard)
48272        // 0x0002 - "dil 7" // standard input (motherboard)
48273        // 0x0004 - "dil 8" // standard input (motherboard)
48274        // 0x0008 - "dil 9" // standard input (motherboard)
48275        // 0x0010 - "dil10" // standard input (motherboard)
48276        PORT_MODIFY("IN-18")
48277        // 0x0001 - "dil11" // standard input (motherboard)
48278        // 0x0002 - "dil12" // standard input (motherboard)
48279        // 0x0004 - "dil13" // standard input (motherboard)
48280        // 0x0008 - "dil14" // standard input (motherboard)
48281        // 0x0010 - "dil15" // standard input (motherboard)
48282        PORT_MODIFY("IN-19")
48283        // 0x0001 - "dil16" // standard input (motherboard)
48284        PORT_MODIFY("IN-20")
48285        // 0x0001 - "test" // standard input (motherboard)
48286        // 0x0002 - "dorlk" // standard input (expected here)
48287        // 0x0004 - "tpdor" // standard input (expected here)
48288        // 0x0008 - "cshbx" // standard input (expected here)
48289        // 0x0010 - "deflt" // standard input (expected here)
48242      PORT_INCLUDE( sc4_base )
48243      PORT_MODIFY("IN-1")
48244      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
48245      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
48246      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
48247      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
48248      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
48249      PORT_MODIFY("IN-2")
48250      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
48251      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("xfer")
48252      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48253      PORT_MODIFY("IN-8")
48254      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
48255      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
48256      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
48257      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
48258      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
48259      PORT_MODIFY("IN-9")
48260      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
48261      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
48262      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
48263      PORT_MODIFY("IN-16")
48264      // 0x0001 - "dil 1" // standard input (motherboard)
48265      // 0x0002 - "dil 2" // standard input (motherboard)
48266      // 0x0004 - "dil 3" // standard input (motherboard)
48267      // 0x0008 - "dil 4" // standard input (motherboard)
48268      // 0x0010 - "dil 5" // standard input (motherboard)
48269      // 0x0100 - "topup" // known extended input, usually 'top up'
48270      PORT_MODIFY("IN-17")
48271      // 0x0001 - "dil 6" // standard input (motherboard)
48272      // 0x0002 - "dil 7" // standard input (motherboard)
48273      // 0x0004 - "dil 8" // standard input (motherboard)
48274      // 0x0008 - "dil 9" // standard input (motherboard)
48275      // 0x0010 - "dil10" // standard input (motherboard)
48276      PORT_MODIFY("IN-18")
48277      // 0x0001 - "dil11" // standard input (motherboard)
48278      // 0x0002 - "dil12" // standard input (motherboard)
48279      // 0x0004 - "dil13" // standard input (motherboard)
48280      // 0x0008 - "dil14" // standard input (motherboard)
48281      // 0x0010 - "dil15" // standard input (motherboard)
48282      PORT_MODIFY("IN-19")
48283      // 0x0001 - "dil16" // standard input (motherboard)
48284      PORT_MODIFY("IN-20")
48285      // 0x0001 - "test" // standard input (motherboard)
48286      // 0x0002 - "dorlk" // standard input (expected here)
48287      // 0x0004 - "tpdor" // standard input (expected here)
48288      // 0x0008 - "cshbx" // standard input (expected here)
48289      // 0x0010 - "deflt" // standard input (expected here)
4829048290INPUT_PORTS_END
4829148291
4829248292// PR2152 JUMPIN JACK CASH         JACK SOUNDS         JUMPIN JACK CASH
r31373r31374
4830348303
4830448304
4830548305INPUT_PORTS_START( sc4kkong ) // this structure is generated
48306        PORT_INCLUDE( sc4_base )
48307        PORT_MODIFY("IN-1")
48308        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48309        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48310        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48311        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48312        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
48313        PORT_MODIFY("IN-2")
48314        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
48315        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
48316        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48317        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48318        PORT_MODIFY("IN-8")
48319        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
48320        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c pot")
48321        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("dice")
48322        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nudge")
48323        PORT_MODIFY("IN-16")
48324        // 0x0001 - "dil  1" // standard input (motherboard)
48325        // 0x0002 - "dil  2" // standard input (motherboard)
48326        // 0x0004 - "dil  3" // standard input (motherboard)
48327        // 0x0008 - "dil  4" // standard input (motherboard)
48328        // 0x0010 - "dil  5" // standard input (motherboard)
48329        // 0x0100 - "topup" // known extended input, usually 'top up'
48330        PORT_MODIFY("IN-17")
48331        // 0x0001 - "dil  6" // standard input (motherboard)
48332        // 0x0002 - "dil  7" // standard input (motherboard)
48333        // 0x0004 - "dil  8" // standard input (motherboard)
48334        // 0x0008 - "dil  9" // standard input (motherboard)
48335        // 0x0010 - "dil 10" // standard input (motherboard)
48336        PORT_MODIFY("IN-18")
48337        // 0x0001 - "dil 11" // standard input (motherboard)
48338        // 0x0002 - "dil 12" // standard input (motherboard)
48339        // 0x0004 - "dil 13" // standard input (motherboard)
48340        // 0x0008 - "dil 14" // standard input (motherboard)
48341        // 0x0010 - "dil 15" // standard input (motherboard)
48342        PORT_MODIFY("IN-19")
48343        // 0x0001 - "dil 16" // standard input (motherboard)
48344        PORT_MODIFY("IN-20")
48345        // 0x0001 - "test" // standard input (motherboard)
48346        // 0x0002 - "lock" // standard input (expected here)
48347        // 0x0004 - "topdor" // standard input (expected here)
48348        // 0x0008 - "botdor" // standard input (expected here)
48349        // 0x0010 - "hopdmp" // standard input (expected here)
48306      PORT_INCLUDE( sc4_base )
48307      PORT_MODIFY("IN-1")
48308      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48309      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48310      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48311      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48312      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
48313      PORT_MODIFY("IN-2")
48314      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
48315      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("transf")
48316      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48317      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48318      PORT_MODIFY("IN-8")
48319      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
48320      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("c pot")
48321      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("dice")
48322      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nudge")
48323      PORT_MODIFY("IN-16")
48324      // 0x0001 - "dil  1" // standard input (motherboard)
48325      // 0x0002 - "dil  2" // standard input (motherboard)
48326      // 0x0004 - "dil  3" // standard input (motherboard)
48327      // 0x0008 - "dil  4" // standard input (motherboard)
48328      // 0x0010 - "dil  5" // standard input (motherboard)
48329      // 0x0100 - "topup" // known extended input, usually 'top up'
48330      PORT_MODIFY("IN-17")
48331      // 0x0001 - "dil  6" // standard input (motherboard)
48332      // 0x0002 - "dil  7" // standard input (motherboard)
48333      // 0x0004 - "dil  8" // standard input (motherboard)
48334      // 0x0008 - "dil  9" // standard input (motherboard)
48335      // 0x0010 - "dil 10" // standard input (motherboard)
48336      PORT_MODIFY("IN-18")
48337      // 0x0001 - "dil 11" // standard input (motherboard)
48338      // 0x0002 - "dil 12" // standard input (motherboard)
48339      // 0x0004 - "dil 13" // standard input (motherboard)
48340      // 0x0008 - "dil 14" // standard input (motherboard)
48341      // 0x0010 - "dil 15" // standard input (motherboard)
48342      PORT_MODIFY("IN-19")
48343      // 0x0001 - "dil 16" // standard input (motherboard)
48344      PORT_MODIFY("IN-20")
48345      // 0x0001 - "test" // standard input (motherboard)
48346      // 0x0002 - "lock" // standard input (expected here)
48347      // 0x0004 - "topdor" // standard input (expected here)
48348      // 0x0008 - "botdor" // standard input (expected here)
48349      // 0x0010 - "hopdmp" // standard input (expected here)
4835048350INPUT_PORTS_END
4835148351
4835248352// PR2161 KING KONG CASH 000         KKCSH SOUNDS          KING KONG CASH
r31373r31374
4839648396}
4839748397
4839848398INPUT_PORTS_START( sc4knok ) // this structure is generated
48399        PORT_INCLUDE( sc4_base )
48400        PORT_MODIFY("IN-1")
48401        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48402        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48403        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48404        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48405        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
48406        PORT_MODIFY("IN-2")
48407        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto n")
48408        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("take f")
48409        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48410        PORT_MODIFY("IN-8")
48411        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("ko")
48412        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("hi c")
48413        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lo c")
48414        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lo n")
48415        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi n")
48416        PORT_MODIFY("IN-16")
48417        // 0x0001 - "dil 1" // standard input (motherboard)
48418        // 0x0002 - "dil 2" // standard input (motherboard)
48419        // 0x0004 - "dil 3" // standard input (motherboard)
48420        // 0x0008 - "dil 4" // standard input (motherboard)
48421        // 0x0010 - "dil 5" // standard input (motherboard)
48422        PORT_MODIFY("IN-17")
48423        // 0x0001 - "dil 6" // standard input (motherboard)
48424        // 0x0002 - "dil 7" // standard input (motherboard)
48425        // 0x0004 - "dil 8" // standard input (motherboard)
48426        // 0x0008 - "dil 9" // standard input (motherboard)
48427        // 0x0010 - "dil 10" // standard input (motherboard)
48428        PORT_MODIFY("IN-18")
48429        // 0x0001 - "dil 11" // standard input (motherboard)
48430        // 0x0002 - "dil 12" // standard input (motherboard)
48431        // 0x0004 - "dil 13" // standard input (motherboard)
48432        // 0x0008 - "dil 14" // standard input (motherboard)
48433        // 0x0010 - "dil 15" // standard input (motherboard)
48434        PORT_MODIFY("IN-19")
48435        // 0x0001 - "dil 16" // standard input (motherboard)
48436        PORT_MODIFY("IN-20")
48437        // 0x0001 - "testsw" // standard input (motherboard)
48399      PORT_INCLUDE( sc4_base )
48400      PORT_MODIFY("IN-1")
48401      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48402      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48403      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48404      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48405      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
48406      PORT_MODIFY("IN-2")
48407      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("auto n")
48408      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("take f")
48409      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48410      PORT_MODIFY("IN-8")
48411      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("ko")
48412      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("hi c")
48413      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lo c")
48414      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lo n")
48415      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("hi n")
48416      PORT_MODIFY("IN-16")
48417      // 0x0001 - "dil 1" // standard input (motherboard)
48418      // 0x0002 - "dil 2" // standard input (motherboard)
48419      // 0x0004 - "dil 3" // standard input (motherboard)
48420      // 0x0008 - "dil 4" // standard input (motherboard)
48421      // 0x0010 - "dil 5" // standard input (motherboard)
48422      PORT_MODIFY("IN-17")
48423      // 0x0001 - "dil 6" // standard input (motherboard)
48424      // 0x0002 - "dil 7" // standard input (motherboard)
48425      // 0x0004 - "dil 8" // standard input (motherboard)
48426      // 0x0008 - "dil 9" // standard input (motherboard)
48427      // 0x0010 - "dil 10" // standard input (motherboard)
48428      PORT_MODIFY("IN-18")
48429      // 0x0001 - "dil 11" // standard input (motherboard)
48430      // 0x0002 - "dil 12" // standard input (motherboard)
48431      // 0x0004 - "dil 13" // standard input (motherboard)
48432      // 0x0008 - "dil 14" // standard input (motherboard)
48433      // 0x0010 - "dil 15" // standard input (motherboard)
48434      PORT_MODIFY("IN-19")
48435      // 0x0001 - "dil 16" // standard input (motherboard)
48436      PORT_MODIFY("IN-20")
48437      // 0x0001 - "testsw" // standard input (motherboard)
4843848438INPUT_PORTS_END
4843948439
4844048440
r31373r31374
4844448444
4844548445
4844648446INPUT_PORTS_START( sc4knokb ) // this structure is generated
48447        PORT_INCLUDE( sc4_base )
48448        PORT_MODIFY("IN-1")
48449        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48450        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold a")
48451        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold b")
48452        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold c")
48453        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stop")
48454        PORT_MODIFY("IN-2")
48455        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("xchnge")
48456        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48457        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48458        PORT_MODIFY("IN-8")
48459        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("take")
48460        PORT_MODIFY("IN-16")
48461        // 0x0001 - "dil  1" // standard input (motherboard)
48462        // 0x0002 - "dil  2" // standard input (motherboard)
48463        // 0x0004 - "dil  3" // standard input (motherboard)
48464        // 0x0008 - "dil  4" // standard input (motherboard)
48465        // 0x0010 - "dil  5" // standard input (motherboard)
48466        // 0x0100 - "top up" // known extended input, usually 'top up'
48467        PORT_MODIFY("IN-17")
48468        // 0x0001 - "dil  6" // standard input (motherboard)
48469        // 0x0002 - "dil  7" // standard input (motherboard)
48470        // 0x0004 - "dil  8" // standard input (motherboard)
48471        // 0x0008 - "dil  9" // standard input (motherboard)
48472        // 0x0010 - "dil 10" // standard input (motherboard)
48473        PORT_MODIFY("IN-18")
48474        // 0x0001 - "dil 11" // standard input (motherboard)
48475        // 0x0002 - "dil 12" // standard input (motherboard)
48476        // 0x0004 - "dil 13" // standard input (motherboard)
48477        // 0x0008 - "dil 14" // standard input (motherboard)
48478        // 0x0010 - "dil 15" // standard input (motherboard)
48479        PORT_MODIFY("IN-19")
48480        // 0x0001 - "dil 16" // standard input (motherboard)
48481        PORT_MODIFY("IN-20")
48482        // 0x0001 - "testsw" // standard input (motherboard)
48483        // 0x0002 - "dor lk" // standard input (expected here)
48484        // 0x0004 - "tp dor" // standard input (expected here)
48485        // 0x0008 - "csh bx" // standard input (expected here)
48486        // 0x0010 - "deflt" // standard input (expected here)
48447      PORT_INCLUDE( sc4_base )
48448      PORT_MODIFY("IN-1")
48449      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48450      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold a")
48451      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold b")
48452      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold c")
48453      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stop")
48454      PORT_MODIFY("IN-2")
48455      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("xchnge")
48456      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48457      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48458      PORT_MODIFY("IN-8")
48459      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("take")
48460      PORT_MODIFY("IN-16")
48461      // 0x0001 - "dil  1" // standard input (motherboard)
48462      // 0x0002 - "dil  2" // standard input (motherboard)
48463      // 0x0004 - "dil  3" // standard input (motherboard)
48464      // 0x0008 - "dil  4" // standard input (motherboard)
48465      // 0x0010 - "dil  5" // standard input (motherboard)
48466      // 0x0100 - "top up" // known extended input, usually 'top up'
48467      PORT_MODIFY("IN-17")
48468      // 0x0001 - "dil  6" // standard input (motherboard)
48469      // 0x0002 - "dil  7" // standard input (motherboard)
48470      // 0x0004 - "dil  8" // standard input (motherboard)
48471      // 0x0008 - "dil  9" // standard input (motherboard)
48472      // 0x0010 - "dil 10" // standard input (motherboard)
48473      PORT_MODIFY("IN-18")
48474      // 0x0001 - "dil 11" // standard input (motherboard)
48475      // 0x0002 - "dil 12" // standard input (motherboard)
48476      // 0x0004 - "dil 13" // standard input (motherboard)
48477      // 0x0008 - "dil 14" // standard input (motherboard)
48478      // 0x0010 - "dil 15" // standard input (motherboard)
48479      PORT_MODIFY("IN-19")
48480      // 0x0001 - "dil 16" // standard input (motherboard)
48481      PORT_MODIFY("IN-20")
48482      // 0x0001 - "testsw" // standard input (motherboard)
48483      // 0x0002 - "dor lk" // standard input (expected here)
48484      // 0x0004 - "tp dor" // standard input (expected here)
48485      // 0x0008 - "csh bx" // standard input (expected here)
48486      // 0x0010 - "deflt" // standard input (expected here)
4848748487INPUT_PORTS_END
4848848488
4848948489// This is a different game
r31373r31374
4851048510}
4851148511
4851248512INPUT_PORTS_START( sc4maxcc ) // this structure is generated
48513        PORT_INCLUDE( sc4_base )
48514        PORT_MODIFY("IN-1")
48515        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
48516        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48517        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48518        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48519        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
48520        PORT_MODIFY("IN-2")
48521        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
48522        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
48523        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48524        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48525        PORT_MODIFY("IN-3")
48526        // 0x0004 - "stk 4" // standard input (expected here)
48527        // 0x0008 - "stk 3" // standard input (expected here)
48528        // 0x0010 - "stk 2" // standard input (expected here)
48529        PORT_MODIFY("IN-4")
48530        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
48531        PORT_MODIFY("IN-5")
48532        // 0x0001 - "priz4" // standard input (expected here)
48533        // 0x0002 - "priz3" // standard input (expected here)
48534        // 0x0004 - "priz2" // standard input (expected here)
48535        // 0x0008 - "priz1" // standard input (expected here)
48536        PORT_MODIFY("IN-8")
48537        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nud lo")
48538        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("fet lo")
48539        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("knk lo")
48540        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("knk hi")
48541        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("fet hi")
48542        PORT_MODIFY("IN-9")
48543        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nud hi")
48544        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("tk nud")
48545        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("tk fet")
48546        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("tk knk")
48547        PORT_MODIFY("IN-16")
48548        // 0x0001 - "dil 1" // standard input (motherboard)
48549        // 0x0002 - "dil 2" // standard input (motherboard)
48550        // 0x0004 - "dil 3" // standard input (motherboard)
48551        // 0x0008 - "dil 4" // standard input (motherboard)
48552        // 0x0010 - "dil 5" // standard input (motherboard)
48553        // 0x0100 - "top up" // known extended input, usually 'top up'
48554        PORT_MODIFY("IN-17")
48555        // 0x0001 - "dil 6" // standard input (motherboard)
48556        // 0x0002 - "dil 7" // standard input (motherboard)
48557        // 0x0004 - "dil 8" // standard input (motherboard)
48558        // 0x0008 - "dil 9" // standard input (motherboard)
48559        // 0x0010 - "dil10" // standard input (motherboard)
48560        PORT_MODIFY("IN-18")
48561        // 0x0001 - "dil11" // standard input (motherboard)
48562        // 0x0002 - "dil12" // standard input (motherboard)
48563        // 0x0004 - "dil13" // standard input (motherboard)
48564        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
48565        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
48566        PORT_MODIFY("IN-19")
48567        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
48568        PORT_MODIFY("IN-20")
48569        // 0x0001 - "grnbut" // standard input (motherboard)
48570        // 0x0002 - "dorlok" // standard input (expected here)
48571        // 0x0004 - "topdor" // standard input (expected here)
48572        // 0x0008 - "botdor" // standard input (expected here)
48573        // 0x0010 - "hopdmp" // standard input (expected here)
48513      PORT_INCLUDE( sc4_base )
48514      PORT_MODIFY("IN-1")
48515      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
48516      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48517      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48518      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48519      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
48520      PORT_MODIFY("IN-2")
48521      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
48522      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
48523      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48524      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48525      PORT_MODIFY("IN-3")
48526      // 0x0004 - "stk 4" // standard input (expected here)
48527      // 0x0008 - "stk 3" // standard input (expected here)
48528      // 0x0010 - "stk 2" // standard input (expected here)
48529      PORT_MODIFY("IN-4")
48530      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
48531      PORT_MODIFY("IN-5")
48532      // 0x0001 - "priz4" // standard input (expected here)
48533      // 0x0002 - "priz3" // standard input (expected here)
48534      // 0x0004 - "priz2" // standard input (expected here)
48535      // 0x0008 - "priz1" // standard input (expected here)
48536      PORT_MODIFY("IN-8")
48537      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nud lo")
48538      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("fet lo")
48539      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("knk lo")
48540      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("knk hi")
48541      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("fet hi")
48542      PORT_MODIFY("IN-9")
48543      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nud hi")
48544      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("tk nud")
48545      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("tk fet")
48546      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("tk knk")
48547      PORT_MODIFY("IN-16")
48548      // 0x0001 - "dil 1" // standard input (motherboard)
48549      // 0x0002 - "dil 2" // standard input (motherboard)
48550      // 0x0004 - "dil 3" // standard input (motherboard)
48551      // 0x0008 - "dil 4" // standard input (motherboard)
48552      // 0x0010 - "dil 5" // standard input (motherboard)
48553      // 0x0100 - "top up" // known extended input, usually 'top up'
48554      PORT_MODIFY("IN-17")
48555      // 0x0001 - "dil 6" // standard input (motherboard)
48556      // 0x0002 - "dil 7" // standard input (motherboard)
48557      // 0x0004 - "dil 8" // standard input (motherboard)
48558      // 0x0008 - "dil 9" // standard input (motherboard)
48559      // 0x0010 - "dil10" // standard input (motherboard)
48560      PORT_MODIFY("IN-18")
48561      // 0x0001 - "dil11" // standard input (motherboard)
48562      // 0x0002 - "dil12" // standard input (motherboard)
48563      // 0x0004 - "dil13" // standard input (motherboard)
48564      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
48565      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
48566      PORT_MODIFY("IN-19")
48567      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
48568      PORT_MODIFY("IN-20")
48569      // 0x0001 - "grnbut" // standard input (motherboard)
48570      // 0x0002 - "dorlok" // standard input (expected here)
48571      // 0x0004 - "topdor" // standard input (expected here)
48572      // 0x0008 - "botdor" // standard input (expected here)
48573      // 0x0010 - "hopdmp" // standard input (expected here)
4857448574INPUT_PORTS_END
4857548575
4857648576// PR2130 CLUB MAXIMUS CASH         MAXIMUS CASH  CLUB  CMAX SOUNDS         MAXIMUS CASH
r31373r31374
4859648596}
4859748597
4859848598INPUT_PORTS_START( sc4wadzl ) // this structure is generated
48599        PORT_INCLUDE( sc4_base )
48600        PORT_MODIFY("IN-1")
48601        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48602        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colect")
48603        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
48604        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
48605        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
48606        PORT_MODIFY("IN-2")
48607        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
48608        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48609        PORT_MODIFY("IN-8")
48610        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("yel lo")
48611        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("csh lo")
48612        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("fet lo")
48613        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("fet hi")
48614        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("csh hi")
48615        PORT_MODIFY("IN-9")
48616        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("yel hi")
48617        PORT_MODIFY("IN-16")
48618        // 0x0001 - "dil  1" // standard input (motherboard)
48619        // 0x0002 - "dil  2" // standard input (motherboard)
48620        // 0x0004 - "dil  3" // standard input (motherboard)
48621        // 0x0008 - "dil  4" // standard input (motherboard)
48622        // 0x0010 - "dil  5" // standard input (motherboard)
48623        // 0x0100 - "top up" // known extended input, usually 'top up'
48624        PORT_MODIFY("IN-17")
48625        // 0x0001 - "dil  6" // standard input (motherboard)
48626        // 0x0002 - "dil  7" // standard input (motherboard)
48627        // 0x0004 - "dil  8" // standard input (motherboard)
48628        // 0x0008 - "dil  9" // standard input (motherboard)
48629        // 0x0010 - "dil 10" // standard input (motherboard)
48630        PORT_MODIFY("IN-18")
48631        // 0x0001 - "dil 11" // standard input (motherboard)
48632        // 0x0002 - "dil 12" // standard input (motherboard)
48633        // 0x0004 - "dil 13" // standard input (motherboard)
48634        // 0x0008 - "dil 14" // standard input (motherboard)
48635        // 0x0010 - "dil 15" // standard input (motherboard)
48636        PORT_MODIFY("IN-19")
48637        // 0x0001 - "dil 16" // standard input (motherboard)
48638        PORT_MODIFY("IN-20")
48639        // 0x0001 - "testsw" // standard input (motherboard)
48640        // 0x0002 - "dor lk" // standard input (expected here)
48641        // 0x0004 - "tp dor" // standard input (expected here)
48642        // 0x0008 - "csh bx" // standard input (expected here)
48643        // 0x0010 - "deflt" // standard input (expected here)
48599      PORT_INCLUDE( sc4_base )
48600      PORT_MODIFY("IN-1")
48601      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48602      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colect")
48603      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
48604      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
48605      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
48606      PORT_MODIFY("IN-2")
48607      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
48608      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48609      PORT_MODIFY("IN-8")
48610      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("yel lo")
48611      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("csh lo")
48612      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("fet lo")
48613      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("fet hi")
48614      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("csh hi")
48615      PORT_MODIFY("IN-9")
48616      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("yel hi")
48617      PORT_MODIFY("IN-16")
48618      // 0x0001 - "dil  1" // standard input (motherboard)
48619      // 0x0002 - "dil  2" // standard input (motherboard)
48620      // 0x0004 - "dil  3" // standard input (motherboard)
48621      // 0x0008 - "dil  4" // standard input (motherboard)
48622      // 0x0010 - "dil  5" // standard input (motherboard)
48623      // 0x0100 - "top up" // known extended input, usually 'top up'
48624      PORT_MODIFY("IN-17")
48625      // 0x0001 - "dil  6" // standard input (motherboard)
48626      // 0x0002 - "dil  7" // standard input (motherboard)
48627      // 0x0004 - "dil  8" // standard input (motherboard)
48628      // 0x0008 - "dil  9" // standard input (motherboard)
48629      // 0x0010 - "dil 10" // standard input (motherboard)
48630      PORT_MODIFY("IN-18")
48631      // 0x0001 - "dil 11" // standard input (motherboard)
48632      // 0x0002 - "dil 12" // standard input (motherboard)
48633      // 0x0004 - "dil 13" // standard input (motherboard)
48634      // 0x0008 - "dil 14" // standard input (motherboard)
48635      // 0x0010 - "dil 15" // standard input (motherboard)
48636      PORT_MODIFY("IN-19")
48637      // 0x0001 - "dil 16" // standard input (motherboard)
48638      PORT_MODIFY("IN-20")
48639      // 0x0001 - "testsw" // standard input (motherboard)
48640      // 0x0002 - "dor lk" // standard input (expected here)
48641      // 0x0004 - "tp dor" // standard input (expected here)
48642      // 0x0008 - "csh bx" // standard input (expected here)
48643      // 0x0010 - "deflt" // standard input (expected here)
4864448644INPUT_PORTS_END
4864548645
4864648646// PR2052 WADZILLA         WADZ SOUNDS         WADZILLA
r31373r31374
4864948649
4865048650
4865148651INPUT_PORTS_START( sc4s16 ) // this structure is generated
48652        PORT_INCLUDE( sc4_base )
48653        PORT_MODIFY("IN-1")
48654        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("coll")
48655        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("trans")
48656        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("blnk1")
48657        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("blnk2")
48658        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("blnk3")
48659        PORT_MODIFY("IN-2")
48660        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("max be")
48661        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48662        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48663        PORT_MODIFY("IN-8")
48664        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("stake3")
48665        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("stake1")
48666        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("stake2")
48667        PORT_MODIFY("IN-16")
48668        // 0x0001 - "dil 1" // standard input (motherboard)
48669        // 0x0002 - "dil 2" // standard input (motherboard)
48670        // 0x0004 - "dil 3" // standard input (motherboard)
48671        // 0x0008 - "dil 4" // standard input (motherboard)
48672        // 0x0010 - "dil 5" // standard input (motherboard)
48673        // 0x0100 - "topup" // known extended input, usually 'top up'
48674        PORT_MODIFY("IN-17")
48675        // 0x0001 - "dil 6" // standard input (motherboard)
48676        // 0x0002 - "dil 7" // standard input (motherboard)
48677        // 0x0004 - "dil 8" // standard input (motherboard)
48678        // 0x0008 - "dil 9" // standard input (motherboard)
48679        // 0x0010 - "dil 10" // standard input (motherboard)
48680        PORT_MODIFY("IN-18")
48681        // 0x0001 - "dil 11" // standard input (motherboard)
48682        // 0x0002 - "dil 12" // standard input (motherboard)
48683        // 0x0004 - "dil 13" // standard input (motherboard)
48684        // 0x0008 - "dil 14" // standard input (motherboard)
48685        // 0x0010 - "dil 15" // standard input (motherboard)
48686        PORT_MODIFY("IN-19")
48687        // 0x0001 - "dil 16" // standard input (motherboard)
48688        PORT_MODIFY("IN-20")
48689        // 0x0001 - "test" // standard input (motherboard)
48690        // 0x0002 - "dor lk" // standard input (expected here)
48691        // 0x0004 - "tp dor" // standard input (expected here)
48692        // 0x0008 - "csh bx" // standard input (expected here)
48693        // 0x0010 - "deflt" // standard input (expected here)
48652      PORT_INCLUDE( sc4_base )
48653      PORT_MODIFY("IN-1")
48654      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("coll")
48655      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("trans")
48656      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("blnk1")
48657      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("blnk2")
48658      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("blnk3")
48659      PORT_MODIFY("IN-2")
48660      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("max be")
48661      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48662      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48663      PORT_MODIFY("IN-8")
48664      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("stake3")
48665      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("stake1")
48666      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("stake2")
48667      PORT_MODIFY("IN-16")
48668      // 0x0001 - "dil 1" // standard input (motherboard)
48669      // 0x0002 - "dil 2" // standard input (motherboard)
48670      // 0x0004 - "dil 3" // standard input (motherboard)
48671      // 0x0008 - "dil 4" // standard input (motherboard)
48672      // 0x0010 - "dil 5" // standard input (motherboard)
48673      // 0x0100 - "topup" // known extended input, usually 'top up'
48674      PORT_MODIFY("IN-17")
48675      // 0x0001 - "dil 6" // standard input (motherboard)
48676      // 0x0002 - "dil 7" // standard input (motherboard)
48677      // 0x0004 - "dil 8" // standard input (motherboard)
48678      // 0x0008 - "dil 9" // standard input (motherboard)
48679      // 0x0010 - "dil 10" // standard input (motherboard)
48680      PORT_MODIFY("IN-18")
48681      // 0x0001 - "dil 11" // standard input (motherboard)
48682      // 0x0002 - "dil 12" // standard input (motherboard)
48683      // 0x0004 - "dil 13" // standard input (motherboard)
48684      // 0x0008 - "dil 14" // standard input (motherboard)
48685      // 0x0010 - "dil 15" // standard input (motherboard)
48686      PORT_MODIFY("IN-19")
48687      // 0x0001 - "dil 16" // standard input (motherboard)
48688      PORT_MODIFY("IN-20")
48689      // 0x0001 - "test" // standard input (motherboard)
48690      // 0x0002 - "dor lk" // standard input (expected here)
48691      // 0x0004 - "tp dor" // standard input (expected here)
48692      // 0x0008 - "csh bx" // standard input (expected here)
48693      // 0x0010 - "deflt" // standard input (expected here)
4869448694INPUT_PORTS_END
4869548695
4869648696// RNG ERR 99
r31373r31374
4870048700
4870148701
4870248702INPUT_PORTS_START( sc4bob ) // this structure is generated
48703        PORT_INCLUDE( sc4_base )
48704        PORT_MODIFY("IN-1")
48705        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
48706        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
48707        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
48708        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
48709        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
48710        PORT_MODIFY("IN-2")
48711        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
48712        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
48713        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48714        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48715        PORT_MODIFY("IN-8")
48716        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash OR tke ft")
48717        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nuds")
48718        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("step")
48719        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("levl1")
48720        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("levl2")
48721        PORT_MODIFY("IN-9")
48722        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("levl3")
48723        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("levl4")
48724        PORT_MODIFY("IN-16")
48725        // 0x0001 - "dil 1" // standard input (motherboard)
48726        // 0x0002 - "dil 2" // standard input (motherboard)
48727        // 0x0004 - "dil 3" // standard input (motherboard)
48728        // 0x0008 - "dil 4" // standard input (motherboard)
48729        // 0x0010 - "dil 5" // standard input (motherboard)
48730        // 0x0100 - "top up" // known extended input, usually 'top up'
48731        PORT_MODIFY("IN-17")
48732        // 0x0001 - "dil 6" // standard input (motherboard)
48733        // 0x0002 - "dil 7" // standard input (motherboard)
48734        // 0x0004 - "dil 8" // standard input (motherboard)
48735        // 0x0008 - "dil 9" // standard input (motherboard)
48736        // 0x0010 - "dil10" // standard input (motherboard)
48737        PORT_MODIFY("IN-18")
48738        // 0x0001 - "dil11" // standard input (motherboard)
48739        // 0x0002 - "dil12" // standard input (motherboard)
48740        // 0x0004 - "dil13" // standard input (motherboard)
48741        // 0x0008 - "dil14" // standard input (motherboard)
48742        // 0x0010 - "dil15" // standard input (motherboard)
48743        PORT_MODIFY("IN-19")
48744        // 0x0001 - "dil16" // standard input (motherboard)
48745        PORT_MODIFY("IN-20")
48746        // 0x0001 - "test" // standard input (motherboard)
48747        // 0x0002 - "dor lk" // standard input (expected here)
48748        // 0x0004 - "tp dor" // standard input (expected here)
48749        // 0x0008 - "csh bx" // standard input (expected here)
48750        // 0x0010 - "deflt" // standard input (expected here)
48703      PORT_INCLUDE( sc4_base )
48704      PORT_MODIFY("IN-1")
48705      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
48706      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
48707      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
48708      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
48709      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
48710      PORT_MODIFY("IN-2")
48711      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
48712      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
48713      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48714      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48715      PORT_MODIFY("IN-8")
48716      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash OR tke ft")
48717      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nuds")
48718      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("step")
48719      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("levl1")
48720      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("levl2")
48721      PORT_MODIFY("IN-9")
48722      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("levl3")
48723      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("levl4")
48724      PORT_MODIFY("IN-16")
48725      // 0x0001 - "dil 1" // standard input (motherboard)
48726      // 0x0002 - "dil 2" // standard input (motherboard)
48727      // 0x0004 - "dil 3" // standard input (motherboard)
48728      // 0x0008 - "dil 4" // standard input (motherboard)
48729      // 0x0010 - "dil 5" // standard input (motherboard)
48730      // 0x0100 - "top up" // known extended input, usually 'top up'
48731      PORT_MODIFY("IN-17")
48732      // 0x0001 - "dil 6" // standard input (motherboard)
48733      // 0x0002 - "dil 7" // standard input (motherboard)
48734      // 0x0004 - "dil 8" // standard input (motherboard)
48735      // 0x0008 - "dil 9" // standard input (motherboard)
48736      // 0x0010 - "dil10" // standard input (motherboard)
48737      PORT_MODIFY("IN-18")
48738      // 0x0001 - "dil11" // standard input (motherboard)
48739      // 0x0002 - "dil12" // standard input (motherboard)
48740      // 0x0004 - "dil13" // standard input (motherboard)
48741      // 0x0008 - "dil14" // standard input (motherboard)
48742      // 0x0010 - "dil15" // standard input (motherboard)
48743      PORT_MODIFY("IN-19")
48744      // 0x0001 - "dil16" // standard input (motherboard)
48745      PORT_MODIFY("IN-20")
48746      // 0x0001 - "test" // standard input (motherboard)
48747      // 0x0002 - "dor lk" // standard input (expected here)
48748      // 0x0004 - "tp dor" // standard input (expected here)
48749      // 0x0008 - "csh bx" // standard input (expected here)
48750      // 0x0010 - "deflt" // standard input (expected here)
4875148751INPUT_PORTS_END
4875248752
4875348753// PR2170 BOBBY DAZZLER         BOBD SOUNDS                 BOBBY  DAZZLER
r31373r31374
4876348763GAMEL( 200?, sc4bobi     ,sc4bob,    sc4, sc4bob, sc4_state, sc4, ROT0, "Mazooma","Bobby Dazzler (Mazooma) (Scorpion 4) (set 10)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4876448764
4876548765INPUT_PORTS_START( sc4clue ) // this structure is generated
48766        PORT_INCLUDE( sc4_base )
48767        PORT_MODIFY("IN-1")
48768        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
48769        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48770        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48771        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48772        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
48773        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
48774        PORT_MODIFY("IN-2")
48775        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
48776        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
48777        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48778        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48779        PORT_MODIFY("IN-3")
48780        // 0x0004 - "stk3" // standard input (expected here)
48781        // 0x0008 - "stk1" // standard input (expected here)
48782        // 0x0010 - "stk2" // standard input (expected here)
48783        PORT_MODIFY("IN-5")
48784        // 0x0001 - "jp 1" // standard input (expected here)
48785        // 0x0002 - "jp 2" // standard input (expected here)
48786        // 0x0004 - "jp 3" // standard input (expected here)
48787        // 0x0008 - "jp 4" // standard input (expected here)
48788        PORT_MODIFY("IN-6")
48789        // 0x0001 - "pc 1" // standard input (expected here)
48790        // 0x0002 - "pc 2" // standard input (expected here)
48791        // 0x0004 - "pc 3" // standard input (expected here)
48792        // 0x0008 - "pc 4" // standard input (expected here)
48793        PORT_MODIFY("IN-8")
48794        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("h cash")
48795        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("h nuds")
48796        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkcpot")
48797        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tkspin")
48798        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("fastpy")
48799        PORT_MODIFY("IN-16")
48800        // 0x0001 - "dil  1" // standard input (motherboard)
48801        // 0x0002 - "dil  2" // standard input (motherboard)
48802        // 0x0004 - "dil  3" // standard input (motherboard)
48803        // 0x0008 - "dil  4" // standard input (motherboard)
48804        // 0x0010 - "dil  5" // standard input (motherboard)
48805        // 0x0100 - "top up" // known extended input, usually 'top up'
48806        PORT_MODIFY("IN-17")
48807        // 0x0001 - "dil  6" // standard input (motherboard)
48808        // 0x0002 - "dil  7" // standard input (motherboard)
48809        // 0x0004 - "dil  8" // standard input (motherboard)
48810        // 0x0008 - "dil  9" // standard input (motherboard)
48811        // 0x0010 - "dil 10" // standard input (motherboard)
48812        PORT_MODIFY("IN-18")
48813        // 0x0001 - "dil 11" // standard input (motherboard)
48814        // 0x0002 - "dil 12" // standard input (motherboard)
48815        // 0x0004 - "dil 13" // standard input (motherboard)
48816        // 0x0008 - "dil 14" // standard input (motherboard)
48817        // 0x0010 - "dil 15" // standard input (motherboard)
48818        PORT_MODIFY("IN-19")
48819        // 0x0001 - "dil 16" // standard input (motherboard)
48820        PORT_MODIFY("IN-20")
48821        // 0x0001 - "test" // standard input (motherboard)
48822        // 0x0002 - "dorlk" // standard input (expected here)
48823        // 0x0004 - "topdr" // standard input (expected here)
48824        // 0x0008 - "cshbx" // standard input (expected here)
48825        // 0x0010 - "dump" // standard input (expected here)
48766      PORT_INCLUDE( sc4_base )
48767      PORT_MODIFY("IN-1")
48768      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
48769      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48770      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48771      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48772      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
48773      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
48774      PORT_MODIFY("IN-2")
48775      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
48776      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
48777      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48778      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48779      PORT_MODIFY("IN-3")
48780      // 0x0004 - "stk3" // standard input (expected here)
48781      // 0x0008 - "stk1" // standard input (expected here)
48782      // 0x0010 - "stk2" // standard input (expected here)
48783      PORT_MODIFY("IN-5")
48784      // 0x0001 - "jp 1" // standard input (expected here)
48785      // 0x0002 - "jp 2" // standard input (expected here)
48786      // 0x0004 - "jp 3" // standard input (expected here)
48787      // 0x0008 - "jp 4" // standard input (expected here)
48788      PORT_MODIFY("IN-6")
48789      // 0x0001 - "pc 1" // standard input (expected here)
48790      // 0x0002 - "pc 2" // standard input (expected here)
48791      // 0x0004 - "pc 3" // standard input (expected here)
48792      // 0x0008 - "pc 4" // standard input (expected here)
48793      PORT_MODIFY("IN-8")
48794      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("h cash")
48795      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("h nuds")
48796      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkcpot")
48797      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tkspin")
48798      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("fastpy")
48799      PORT_MODIFY("IN-16")
48800      // 0x0001 - "dil  1" // standard input (motherboard)
48801      // 0x0002 - "dil  2" // standard input (motherboard)
48802      // 0x0004 - "dil  3" // standard input (motherboard)
48803      // 0x0008 - "dil  4" // standard input (motherboard)
48804      // 0x0010 - "dil  5" // standard input (motherboard)
48805      // 0x0100 - "top up" // known extended input, usually 'top up'
48806      PORT_MODIFY("IN-17")
48807      // 0x0001 - "dil  6" // standard input (motherboard)
48808      // 0x0002 - "dil  7" // standard input (motherboard)
48809      // 0x0004 - "dil  8" // standard input (motherboard)
48810      // 0x0008 - "dil  9" // standard input (motherboard)
48811      // 0x0010 - "dil 10" // standard input (motherboard)
48812      PORT_MODIFY("IN-18")
48813      // 0x0001 - "dil 11" // standard input (motherboard)
48814      // 0x0002 - "dil 12" // standard input (motherboard)
48815      // 0x0004 - "dil 13" // standard input (motherboard)
48816      // 0x0008 - "dil 14" // standard input (motherboard)
48817      // 0x0010 - "dil 15" // standard input (motherboard)
48818      PORT_MODIFY("IN-19")
48819      // 0x0001 - "dil 16" // standard input (motherboard)
48820      PORT_MODIFY("IN-20")
48821      // 0x0001 - "test" // standard input (motherboard)
48822      // 0x0002 - "dorlk" // standard input (expected here)
48823      // 0x0004 - "topdr" // standard input (expected here)
48824      // 0x0008 - "cshbx" // standard input (expected here)
48825      // 0x0010 - "dump" // standard input (expected here)
4882648826INPUT_PORTS_END
4882748827
4882848828// PR2230 CLUEDO         CLUE SOUNDS              CLUEDO
r31373r31374
4883648836GAMEL( 200?, sc4clueg    ,sc4clue,   sc4, sc4clue, sc4_state, sc4, ROT0, "Mazooma","Cluedo (Mazooma) (Scorpion 4) (set 8)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4883748837
4883848838INPUT_PORTS_START( sc4ducks ) // this structure is generated
48839        PORT_INCLUDE( sc4_base )
48840        PORT_MODIFY("IN-1")
48841        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc OR coll")
48842        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48843        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48844        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48845        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exch")
48846        PORT_MODIFY("IN-2")
48847        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
48848        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("turbo")
48849        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48850        PORT_MODIFY("IN-8")
48851        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkcpot")
48852        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("carry")
48853        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkwins")
48854        PORT_MODIFY("IN-16")
48855        // 0x0001 - "dil 1" // standard input (motherboard)
48856        // 0x0002 - "dil 2" // standard input (motherboard)
48857        // 0x0004 - "dil 3" // standard input (motherboard)
48858        // 0x0008 - "dil 4" // standard input (motherboard)
48859        // 0x0010 - "dil 5" // standard input (motherboard)
48860        // 0x0100 - "topup" // known extended input, usually 'top up'
48861        PORT_MODIFY("IN-17")
48862        // 0x0001 - "dil 6" // standard input (motherboard)
48863        // 0x0002 - "dil 7" // standard input (motherboard)
48864        // 0x0004 - "dil 8" // standard input (motherboard)
48865        // 0x0008 - "dil 9" // standard input (motherboard)
48866        // 0x0010 - "dil10" // standard input (motherboard)
48867        PORT_MODIFY("IN-18")
48868        // 0x0001 - "dil11" // standard input (motherboard)
48869        // 0x0002 - "dil12" // standard input (motherboard)
48870        // 0x0004 - "dil13" // standard input (motherboard)
48871        // 0x0008 - "dil14" // standard input (motherboard)
48872        // 0x0010 - "dil15" // standard input (motherboard)
48873        PORT_MODIFY("IN-19")
48874        // 0x0001 - "dil16" // standard input (motherboard)
48875        PORT_MODIFY("IN-20")
48876        // 0x0001 - "test" // standard input (motherboard)
48877        // 0x0002 - "dor lk" // standard input (expected here)
48878        // 0x0004 - "tp dor" // standard input (expected here)
48879        // 0x0008 - "csh bx" // standard input (expected here)
48880        // 0x0010 - "hp dmp" // standard input (expected here)
48839      PORT_INCLUDE( sc4_base )
48840      PORT_MODIFY("IN-1")
48841      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc OR coll")
48842      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48843      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48844      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48845      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("exch")
48846      PORT_MODIFY("IN-2")
48847      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
48848      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("turbo")
48849      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48850      PORT_MODIFY("IN-8")
48851      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tkcpot")
48852      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("carry")
48853      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkwins")
48854      PORT_MODIFY("IN-16")
48855      // 0x0001 - "dil 1" // standard input (motherboard)
48856      // 0x0002 - "dil 2" // standard input (motherboard)
48857      // 0x0004 - "dil 3" // standard input (motherboard)
48858      // 0x0008 - "dil 4" // standard input (motherboard)
48859      // 0x0010 - "dil 5" // standard input (motherboard)
48860      // 0x0100 - "topup" // known extended input, usually 'top up'
48861      PORT_MODIFY("IN-17")
48862      // 0x0001 - "dil 6" // standard input (motherboard)
48863      // 0x0002 - "dil 7" // standard input (motherboard)
48864      // 0x0004 - "dil 8" // standard input (motherboard)
48865      // 0x0008 - "dil 9" // standard input (motherboard)
48866      // 0x0010 - "dil10" // standard input (motherboard)
48867      PORT_MODIFY("IN-18")
48868      // 0x0001 - "dil11" // standard input (motherboard)
48869      // 0x0002 - "dil12" // standard input (motherboard)
48870      // 0x0004 - "dil13" // standard input (motherboard)
48871      // 0x0008 - "dil14" // standard input (motherboard)
48872      // 0x0010 - "dil15" // standard input (motherboard)
48873      PORT_MODIFY("IN-19")
48874      // 0x0001 - "dil16" // standard input (motherboard)
48875      PORT_MODIFY("IN-20")
48876      // 0x0001 - "test" // standard input (motherboard)
48877      // 0x0002 - "dor lk" // standard input (expected here)
48878      // 0x0004 - "tp dor" // standard input (expected here)
48879      // 0x0008 - "csh bx" // standard input (expected here)
48880      // 0x0010 - "hp dmp" // standard input (expected here)
4888148881INPUT_PORTS_END
4888248882
4888348883// PR2118 DUCKS OF HAZZARD         DUCKSOFHAZZARDSND         DUCKS OF HAZZARD
r31373r31374
4890348903}
4890448904
4890548905INPUT_PORTS_START( sc4glad ) // this structure is generated
48906        PORT_INCLUDE( sc4_base )
48907        PORT_MODIFY("IN-1")
48908        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
48909        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48910        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48911        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48912        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
48913        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
48914        PORT_MODIFY("IN-2")
48915        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
48916        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
48917        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48918        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
48919        PORT_MODIFY("IN-3")
48920        // 0x0004 - "stk3" // standard input (expected here)
48921        // 0x0008 - "stk1" // standard input (expected here)
48922        // 0x0010 - "stk2" // standard input (expected here)
48923        PORT_MODIFY("IN-4")
48924        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
48925        PORT_MODIFY("IN-5")
48926        // 0x0001 - "jp 1" // standard input (expected here)
48927        // 0x0002 - "jp 2" // standard input (expected here)
48928        // 0x0004 - "jp 3" // standard input (expected here)
48929        // 0x0008 - "jp 4" // standard input (expected here)
48930        PORT_MODIFY("IN-6")
48931        // 0x0001 - "pc 1" // standard input (expected here)
48932        // 0x0002 - "pc 2" // standard input (expected here)
48933        // 0x0004 - "pc 3" // standard input (expected here)
48934        // 0x0008 - "pc 4" // standard input (expected here)
48935        PORT_MODIFY("IN-8")
48936        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("f lo")
48937        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
48938        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c lo")
48939        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
48940        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c hi")
48941        PORT_MODIFY("IN-9")
48942        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
48943        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("f hi")
48944        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
48945        PORT_MODIFY("IN-16")
48946        // 0x0001 - "dil 1" // standard input (motherboard)
48947        // 0x0002 - "dil 2" // standard input (motherboard)
48948        // 0x0004 - "dil 3" // standard input (motherboard)
48949        // 0x0008 - "dil 4" // standard input (motherboard)
48950        // 0x0010 - "dil 5" // standard input (motherboard)
48951        PORT_MODIFY("IN-17")
48952        // 0x0001 - "dil 6" // standard input (motherboard)
48953        // 0x0002 - "dil 7" // standard input (motherboard)
48954        // 0x0004 - "dil 8" // standard input (motherboard)
48955        // 0x0008 - "dil 9" // standard input (motherboard)
48956        // 0x0010 - "dil10" // standard input (motherboard)
48957        PORT_MODIFY("IN-18")
48958        // 0x0001 - "dil11" // standard input (motherboard)
48959        // 0x0002 - "dil12 OR dorlk" // standard input (motherboard)
48960        // 0x0004 - "dil13 OR topdr" // standard input (motherboard)
48961        // 0x0008 - "dil14 OR cshbx" // standard input (motherboard)
48962        // 0x0010 - "dil15 OR dump" // standard input (motherboard)
48963        PORT_MODIFY("IN-19")
48964        // 0x0001 - "dil16" // standard input (motherboard)
48965        PORT_MODIFY("IN-20")
48966        // 0x0001 - "test" // standard input (motherboard)
48906      PORT_INCLUDE( sc4_base )
48907      PORT_MODIFY("IN-1")
48908      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
48909      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
48910      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
48911      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
48912      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
48913      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
48914      PORT_MODIFY("IN-2")
48915      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
48916      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
48917      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48918      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
48919      PORT_MODIFY("IN-3")
48920      // 0x0004 - "stk3" // standard input (expected here)
48921      // 0x0008 - "stk1" // standard input (expected here)
48922      // 0x0010 - "stk2" // standard input (expected here)
48923      PORT_MODIFY("IN-4")
48924      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
48925      PORT_MODIFY("IN-5")
48926      // 0x0001 - "jp 1" // standard input (expected here)
48927      // 0x0002 - "jp 2" // standard input (expected here)
48928      // 0x0004 - "jp 3" // standard input (expected here)
48929      // 0x0008 - "jp 4" // standard input (expected here)
48930      PORT_MODIFY("IN-6")
48931      // 0x0001 - "pc 1" // standard input (expected here)
48932      // 0x0002 - "pc 2" // standard input (expected here)
48933      // 0x0004 - "pc 3" // standard input (expected here)
48934      // 0x0008 - "pc 4" // standard input (expected here)
48935      PORT_MODIFY("IN-8")
48936      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("f lo")
48937      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
48938      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c lo")
48939      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
48940      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c hi")
48941      PORT_MODIFY("IN-9")
48942      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
48943      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("f hi")
48944      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
48945      PORT_MODIFY("IN-16")
48946      // 0x0001 - "dil 1" // standard input (motherboard)
48947      // 0x0002 - "dil 2" // standard input (motherboard)
48948      // 0x0004 - "dil 3" // standard input (motherboard)
48949      // 0x0008 - "dil 4" // standard input (motherboard)
48950      // 0x0010 - "dil 5" // standard input (motherboard)
48951      PORT_MODIFY("IN-17")
48952      // 0x0001 - "dil 6" // standard input (motherboard)
48953      // 0x0002 - "dil 7" // standard input (motherboard)
48954      // 0x0004 - "dil 8" // standard input (motherboard)
48955      // 0x0008 - "dil 9" // standard input (motherboard)
48956      // 0x0010 - "dil10" // standard input (motherboard)
48957      PORT_MODIFY("IN-18")
48958      // 0x0001 - "dil11" // standard input (motherboard)
48959      // 0x0002 - "dil12 OR dorlk" // standard input (motherboard)
48960      // 0x0004 - "dil13 OR topdr" // standard input (motherboard)
48961      // 0x0008 - "dil14 OR cshbx" // standard input (motherboard)
48962      // 0x0010 - "dil15 OR dump" // standard input (motherboard)
48963      PORT_MODIFY("IN-19")
48964      // 0x0001 - "dil16" // standard input (motherboard)
48965      PORT_MODIFY("IN-20")
48966      // 0x0001 - "test" // standard input (motherboard)
4896748967INPUT_PORTS_END
4896848968
4896948969// PR2255 GLADIATOR         GLAD SOUNDS         GLADIATOR
r31373r31374
4897848978
4897948979
4898048980INPUT_PORTS_START( sc4hotdg ) // this structure is generated
48981        PORT_INCLUDE( sc4_base )
48982        PORT_MODIFY("IN-1")
48983        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48984        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
48985        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
48986        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
48987        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
48988        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
48989        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
48990        PORT_MODIFY("IN-2")
48991        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
48992        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trf/ex")
48993        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48994        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48995        PORT_MODIFY("IN-3")
48996        // 0x0004 - "stk 4" // standard input (expected here)
48997        // 0x0008 - "stk 3" // standard input (expected here)
48998        // 0x0010 - "stk 2" // standard input (expected here)
48999        PORT_MODIFY("IN-5")
49000        // 0x0001 - "priz4" // standard input (expected here)
49001        // 0x0002 - "priz3" // standard input (expected here)
49002        // 0x0004 - "priz2" // standard input (expected here)
49003        // 0x0008 - "priz1" // standard input (expected here)
49004        PORT_MODIFY("IN-6")
49005        // 0x0001 - "perc1" // standard input (expected here)
49006        // 0x0002 - "perc2" // standard input (expected here)
49007        // 0x0004 - "perc3" // standard input (expected here)
49008        // 0x0008 - "perc4" // standard input (expected here)
49009        PORT_MODIFY("IN-16")
49010        // 0x0001 - "dil1" // standard input (motherboard)
49011        // 0x0002 - "dil2" // standard input (motherboard)
49012        // 0x0004 - "dil3" // standard input (motherboard)
49013        // 0x0008 - "dil4" // standard input (motherboard)
49014        // 0x0010 - "dil5" // standard input (motherboard)
49015        // 0x0100 - "top up" // known extended input, usually 'top up'
49016        PORT_MODIFY("IN-17")
49017        // 0x0001 - "dil6" // standard input (motherboard)
49018        // 0x0002 - "dil7" // standard input (motherboard)
49019        // 0x0004 - "dil8" // standard input (motherboard)
49020        // 0x0008 - "dil9" // standard input (motherboard)
49021        // 0x0010 - "dil10" // standard input (motherboard)
49022        PORT_MODIFY("IN-18")
49023        // 0x0001 - "dil11" // standard input (motherboard)
49024        // 0x0002 - "dil12" // standard input (motherboard)
49025        // 0x0004 - "dil13" // standard input (motherboard)
49026        // 0x0008 - "dil14" // standard input (motherboard)
49027        // 0x0010 - "dil15" // standard input (motherboard)
49028        PORT_MODIFY("IN-19")
49029        // 0x0001 - "dil16" // standard input (motherboard)
49030        PORT_MODIFY("IN-20")
49031        // 0x0001 - "grnbut" // standard input (motherboard)
49032        // 0x0002 - "dorlok" // standard input (expected here)
49033        // 0x0004 - "serdor" // standard input (expected here)
49034        // 0x0008 - "cshdor" // standard input (expected here)
49035        // 0x0010 - "hopdmp" // standard input (expected here)
48981      PORT_INCLUDE( sc4_base )
48982      PORT_MODIFY("IN-1")
48983      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
48984      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
48985      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
48986      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
48987      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
48988      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
48989      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
48990      PORT_MODIFY("IN-2")
48991      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
48992      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trf/ex")
48993      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
48994      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
48995      PORT_MODIFY("IN-3")
48996      // 0x0004 - "stk 4" // standard input (expected here)
48997      // 0x0008 - "stk 3" // standard input (expected here)
48998      // 0x0010 - "stk 2" // standard input (expected here)
48999      PORT_MODIFY("IN-5")
49000      // 0x0001 - "priz4" // standard input (expected here)
49001      // 0x0002 - "priz3" // standard input (expected here)
49002      // 0x0004 - "priz2" // standard input (expected here)
49003      // 0x0008 - "priz1" // standard input (expected here)
49004      PORT_MODIFY("IN-6")
49005      // 0x0001 - "perc1" // standard input (expected here)
49006      // 0x0002 - "perc2" // standard input (expected here)
49007      // 0x0004 - "perc3" // standard input (expected here)
49008      // 0x0008 - "perc4" // standard input (expected here)
49009      PORT_MODIFY("IN-16")
49010      // 0x0001 - "dil1" // standard input (motherboard)
49011      // 0x0002 - "dil2" // standard input (motherboard)
49012      // 0x0004 - "dil3" // standard input (motherboard)
49013      // 0x0008 - "dil4" // standard input (motherboard)
49014      // 0x0010 - "dil5" // standard input (motherboard)
49015      // 0x0100 - "top up" // known extended input, usually 'top up'
49016      PORT_MODIFY("IN-17")
49017      // 0x0001 - "dil6" // standard input (motherboard)
49018      // 0x0002 - "dil7" // standard input (motherboard)
49019      // 0x0004 - "dil8" // standard input (motherboard)
49020      // 0x0008 - "dil9" // standard input (motherboard)
49021      // 0x0010 - "dil10" // standard input (motherboard)
49022      PORT_MODIFY("IN-18")
49023      // 0x0001 - "dil11" // standard input (motherboard)
49024      // 0x0002 - "dil12" // standard input (motherboard)
49025      // 0x0004 - "dil13" // standard input (motherboard)
49026      // 0x0008 - "dil14" // standard input (motherboard)
49027      // 0x0010 - "dil15" // standard input (motherboard)
49028      PORT_MODIFY("IN-19")
49029      // 0x0001 - "dil16" // standard input (motherboard)
49030      PORT_MODIFY("IN-20")
49031      // 0x0001 - "grnbut" // standard input (motherboard)
49032      // 0x0002 - "dorlok" // standard input (expected here)
49033      // 0x0004 - "serdor" // standard input (expected here)
49034      // 0x0008 - "cshdor" // standard input (expected here)
49035      // 0x0010 - "hopdmp" // standard input (expected here)
4903649036INPUT_PORTS_END
4903749037
4903849038// PR1936 AWP HOT DOG SCORP4         PR1916 HOT DOG SOUNDS11         HOT DOG S.SITE
r31373r31374
4905949059}
4906049060
4906149061INPUT_PORTS_START( sc4pp ) // this structure is generated
49062        PORT_INCLUDE( sc4_base )
49063        PORT_MODIFY("IN-1")
49064        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
49065        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
49066        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
49067        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
49068        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
49069        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
49070        PORT_MODIFY("IN-2")
49071        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49072        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
49073        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49074        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49075        PORT_MODIFY("IN-3")
49076        // 0x0004 - "stk3" // standard input (expected here)
49077        // 0x0008 - "stk1" // standard input (expected here)
49078        // 0x0010 - "stk2" // standard input (expected here)
49079        PORT_MODIFY("IN-5")
49080        // 0x0001 - "jp 1" // standard input (expected here)
49081        // 0x0002 - "jp 2" // standard input (expected here)
49082        // 0x0004 - "jp 3" // standard input (expected here)
49083        // 0x0008 - "jp 4" // standard input (expected here)
49084        PORT_MODIFY("IN-6")
49085        // 0x0001 - "pc 1" // standard input (expected here)
49086        // 0x0002 - "pc 2" // standard input (expected here)
49087        // 0x0004 - "pc 3" // standard input (expected here)
49088        // 0x0008 - "pc 4" // standard input (expected here)
49089        PORT_MODIFY("IN-8")
49090        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("f lo")
49091        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
49092        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c lo")
49093        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
49094        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c hi")
49095        PORT_MODIFY("IN-9")
49096        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
49097        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("f hi")
49098        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("step")
49099        PORT_MODIFY("IN-16")
49100        // 0x0001 - "dil  1" // standard input (motherboard)
49101        // 0x0002 - "dil  2" // standard input (motherboard)
49102        // 0x0004 - "dil  3" // standard input (motherboard)
49103        // 0x0008 - "dil  4" // standard input (motherboard)
49104        // 0x0010 - "dil  5" // standard input (motherboard)
49105        // 0x0100 - "top up OR top up" // known extended input, usually 'top up'
49106        PORT_MODIFY("IN-17")
49107        // 0x0001 - "dil  6" // standard input (motherboard)
49108        // 0x0002 - "dil  7" // standard input (motherboard)
49109        // 0x0004 - "dil  8" // standard input (motherboard)
49110        // 0x0008 - "dil  9" // standard input (motherboard)
49111        // 0x0010 - "dil 10" // standard input (motherboard)
49112        PORT_MODIFY("IN-18")
49113        // 0x0001 - "dil 11" // standard input (motherboard)
49114        // 0x0002 - "dil 12" // standard input (motherboard)
49115        // 0x0004 - "dil 13" // standard input (motherboard)
49116        // 0x0008 - "dil 14" // standard input (motherboard)
49117        // 0x0010 - "dil 15" // standard input (motherboard)
49118        PORT_MODIFY("IN-19")
49119        // 0x0001 - "dil 16" // standard input (motherboard)
49120        PORT_MODIFY("IN-20")
49121        // 0x0001 - "test" // standard input (motherboard)
49122        // 0x0002 - "dorlk" // standard input (expected here)
49123        // 0x0004 - "topdr" // standard input (expected here)
49124        // 0x0008 - "cshbx" // standard input (expected here)
49125        // 0x0010 - "dump" // standard input (expected here)
49062      PORT_INCLUDE( sc4_base )
49063      PORT_MODIFY("IN-1")
49064      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
49065      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
49066      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
49067      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
49068      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
49069      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
49070      PORT_MODIFY("IN-2")
49071      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49072      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
49073      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49074      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49075      PORT_MODIFY("IN-3")
49076      // 0x0004 - "stk3" // standard input (expected here)
49077      // 0x0008 - "stk1" // standard input (expected here)
49078      // 0x0010 - "stk2" // standard input (expected here)
49079      PORT_MODIFY("IN-5")
49080      // 0x0001 - "jp 1" // standard input (expected here)
49081      // 0x0002 - "jp 2" // standard input (expected here)
49082      // 0x0004 - "jp 3" // standard input (expected here)
49083      // 0x0008 - "jp 4" // standard input (expected here)
49084      PORT_MODIFY("IN-6")
49085      // 0x0001 - "pc 1" // standard input (expected here)
49086      // 0x0002 - "pc 2" // standard input (expected here)
49087      // 0x0004 - "pc 3" // standard input (expected here)
49088      // 0x0008 - "pc 4" // standard input (expected here)
49089      PORT_MODIFY("IN-8")
49090      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("f lo")
49091      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
49092      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("c lo")
49093      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("shoot")
49094      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("c hi")
49095      PORT_MODIFY("IN-9")
49096      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
49097      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("f hi")
49098      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("step")
49099      PORT_MODIFY("IN-16")
49100      // 0x0001 - "dil  1" // standard input (motherboard)
49101      // 0x0002 - "dil  2" // standard input (motherboard)
49102      // 0x0004 - "dil  3" // standard input (motherboard)
49103      // 0x0008 - "dil  4" // standard input (motherboard)
49104      // 0x0010 - "dil  5" // standard input (motherboard)
49105      // 0x0100 - "top up OR top up" // known extended input, usually 'top up'
49106      PORT_MODIFY("IN-17")
49107      // 0x0001 - "dil  6" // standard input (motherboard)
49108      // 0x0002 - "dil  7" // standard input (motherboard)
49109      // 0x0004 - "dil  8" // standard input (motherboard)
49110      // 0x0008 - "dil  9" // standard input (motherboard)
49111      // 0x0010 - "dil 10" // standard input (motherboard)
49112      PORT_MODIFY("IN-18")
49113      // 0x0001 - "dil 11" // standard input (motherboard)
49114      // 0x0002 - "dil 12" // standard input (motherboard)
49115      // 0x0004 - "dil 13" // standard input (motherboard)
49116      // 0x0008 - "dil 14" // standard input (motherboard)
49117      // 0x0010 - "dil 15" // standard input (motherboard)
49118      PORT_MODIFY("IN-19")
49119      // 0x0001 - "dil 16" // standard input (motherboard)
49120      PORT_MODIFY("IN-20")
49121      // 0x0001 - "test" // standard input (motherboard)
49122      // 0x0002 - "dorlk" // standard input (expected here)
49123      // 0x0004 - "topdr" // standard input (expected here)
49124      // 0x0008 - "cshbx" // standard input (expected here)
49125      // 0x0010 - "dump" // standard input (expected here)
4912649126INPUT_PORTS_END
4912749127
4912849128// doesn't like any of the sound roms we have
r31373r31374
4913549135
4913649136
4913749137INPUT_PORTS_START( sc4ppsag ) // this structure is generated
49138        PORT_INCLUDE( sc4_base )
49139        PORT_MODIFY("IN-1")
49140        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
49141        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
49142        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
49143        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
49144        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
49145        PORT_MODIFY("IN-2")
49146        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49147        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
49148        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49149        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
49150        PORT_MODIFY("IN-8")
49151        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("game")
49152        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
49153        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nuds")
49154        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
49155        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("levl1")
49156        PORT_MODIFY("IN-9")
49157        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("levl2")
49158        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("levl3")
49159        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("levl4")
49160        PORT_MODIFY("IN-16")
49161        // 0x0001 - "dil 1" // standard input (motherboard)
49162        // 0x0002 - "dil 2" // standard input (motherboard)
49163        // 0x0004 - "dil 3" // standard input (motherboard)
49164        // 0x0008 - "dil 4" // standard input (motherboard)
49165        // 0x0010 - "dil 5" // standard input (motherboard)
49166        // 0x0100 - "topup" // known extended input, usually 'top up'
49167        PORT_MODIFY("IN-17")
49168        // 0x0001 - "dil 6" // standard input (motherboard)
49169        // 0x0002 - "dil 7" // standard input (motherboard)
49170        // 0x0004 - "dil 8" // standard input (motherboard)
49171        // 0x0008 - "dil 9" // standard input (motherboard)
49172        // 0x0010 - "dil10" // standard input (motherboard)
49173        PORT_MODIFY("IN-18")
49174        // 0x0001 - "dil11" // standard input (motherboard)
49175        // 0x0002 - "dil12" // standard input (motherboard)
49176        // 0x0004 - "dil13" // standard input (motherboard)
49177        // 0x0008 - "dil14" // standard input (motherboard)
49178        // 0x0010 - "dil15 OR deflt" // standard input (motherboard)
49179        PORT_MODIFY("IN-19")
49180        // 0x0001 - "dil16" // standard input (motherboard)
49181        PORT_MODIFY("IN-20")
49182        // 0x0001 - "test" // standard input (motherboard)
49183        // 0x0002 - "dorlk" // standard input (expected here)
49184        // 0x0004 - "topdr" // standard input (expected here)
49185        // 0x0008 - "cshbx" // standard input (expected here)
49186        // 0x0010 - "hoplo" // standard input (expected here)
49138      PORT_INCLUDE( sc4_base )
49139      PORT_MODIFY("IN-1")
49140      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
49141      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
49142      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
49143      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
49144      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
49145      PORT_MODIFY("IN-2")
49146      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49147      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
49148      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49149      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
49150      PORT_MODIFY("IN-8")
49151      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("game")
49152      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("cash")
49153      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nuds")
49154      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
49155      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("levl1")
49156      PORT_MODIFY("IN-9")
49157      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("levl2")
49158      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("levl3")
49159      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("levl4")
49160      PORT_MODIFY("IN-16")
49161      // 0x0001 - "dil 1" // standard input (motherboard)
49162      // 0x0002 - "dil 2" // standard input (motherboard)
49163      // 0x0004 - "dil 3" // standard input (motherboard)
49164      // 0x0008 - "dil 4" // standard input (motherboard)
49165      // 0x0010 - "dil 5" // standard input (motherboard)
49166      // 0x0100 - "topup" // known extended input, usually 'top up'
49167      PORT_MODIFY("IN-17")
49168      // 0x0001 - "dil 6" // standard input (motherboard)
49169      // 0x0002 - "dil 7" // standard input (motherboard)
49170      // 0x0004 - "dil 8" // standard input (motherboard)
49171      // 0x0008 - "dil 9" // standard input (motherboard)
49172      // 0x0010 - "dil10" // standard input (motherboard)
49173      PORT_MODIFY("IN-18")
49174      // 0x0001 - "dil11" // standard input (motherboard)
49175      // 0x0002 - "dil12" // standard input (motherboard)
49176      // 0x0004 - "dil13" // standard input (motherboard)
49177      // 0x0008 - "dil14" // standard input (motherboard)
49178      // 0x0010 - "dil15 OR deflt" // standard input (motherboard)
49179      PORT_MODIFY("IN-19")
49180      // 0x0001 - "dil16" // standard input (motherboard)
49181      PORT_MODIFY("IN-20")
49182      // 0x0001 - "test" // standard input (motherboard)
49183      // 0x0002 - "dorlk" // standard input (expected here)
49184      // 0x0004 - "topdr" // standard input (expected here)
49185      // 0x0008 - "cshbx" // standard input (expected here)
49186      // 0x0010 - "hoplo" // standard input (expected here)
4918749187INPUT_PORTS_END
4918849188
4918949189// PR2303 STRIKES AGAIN         PPSA SOUNDS         STRIKES AGAIN
r31373r31374
4919949199GAMEL( 200?, sc4ppsagi   ,sc4ppsag,  sc4, sc4ppsag, sc4_state, sc4, ROT0, "Mazooma","Pink Panther Strikes Again (Mazooma) (Scorpion 4) (set 10)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4920049200
4920149201INPUT_PORTS_START( sc4pog ) // this structure is generated
49202        PORT_INCLUDE( sc4_base )
49203        PORT_MODIFY("IN-1")
49204        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
49205        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
49206        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
49207        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
49208        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
49209        PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
49210        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
49211        PORT_MODIFY("IN-2")
49212        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
49213        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
49214        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("trnsfr")
49215        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49216        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
49217        PORT_MODIFY("IN-3")
49218        // 0x0004 - "stk 4" // standard input (expected here)
49219        // 0x0008 - "stk 3" // standard input (expected here)
49220        // 0x0010 - "stk 2" // standard input (expected here)
49221        PORT_MODIFY("IN-5")
49222        // 0x0001 - "priz4" // standard input (expected here)
49223        // 0x0002 - "priz3" // standard input (expected here)
49224        // 0x0004 - "priz2" // standard input (expected here)
49225        // 0x0008 - "priz1" // standard input (expected here)
49226        PORT_MODIFY("IN-6")
49227        // 0x0001 - "perc1" // standard input (expected here)
49228        // 0x0002 - "perc2" // standard input (expected here)
49229        // 0x0004 - "perc3" // standard input (expected here)
49230        // 0x0008 - "perc4" // standard input (expected here)
49231        PORT_MODIFY("IN-8")
49232        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk bns")
49233        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
49234        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("bronze")
49235        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("silver")
49236        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("gold")
49237        PORT_MODIFY("IN-16")
49238        // 0x0001 - "dil1" // standard input (motherboard)
49239        // 0x0002 - "dil2" // standard input (motherboard)
49240        // 0x0004 - "dil3" // standard input (motherboard)
49241        // 0x0008 - "dil4" // standard input (motherboard)
49242        // 0x0010 - "dil5" // standard input (motherboard)
49243        // 0x0100 - "top up" // known extended input, usually 'top up'
49244        PORT_MODIFY("IN-17")
49245        // 0x0001 - "dil6" // standard input (motherboard)
49246        // 0x0002 - "dil7" // standard input (motherboard)
49247        // 0x0004 - "dil8" // standard input (motherboard)
49248        // 0x0008 - "dil9" // standard input (motherboard)
49249        // 0x0010 - "dil10" // standard input (motherboard)
49250        PORT_MODIFY("IN-18")
49251        // 0x0001 - "dil11" // standard input (motherboard)
49252        // 0x0002 - "dil12" // standard input (motherboard)
49253        // 0x0004 - "dil13" // standard input (motherboard)
49254        // 0x0008 - "dil14" // standard input (motherboard)
49255        // 0x0010 - "dil15" // standard input (motherboard)
49256        PORT_MODIFY("IN-19")
49257        // 0x0001 - "dil16" // standard input (motherboard)
49258        PORT_MODIFY("IN-20")
49259        // 0x0001 - "grnbut" // standard input (motherboard)
49260        // 0x0002 - "dorlok" // standard input (expected here)
49261        // 0x0004 - "serdor" // standard input (expected here)
49262        // 0x0008 - "cshdor" // standard input (expected here)
49263        // 0x0010 - "hopdmp" // standard input (expected here)
49202      PORT_INCLUDE( sc4_base )
49203      PORT_MODIFY("IN-1")
49204      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
49205      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
49206      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
49207      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
49208      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collct")
49209      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_5 ) PORT_NAME("hpunit")
49210      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
49211      PORT_MODIFY("IN-2")
49212      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("ch stk")
49213      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
49214      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("trnsfr")
49215      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49216      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
49217      PORT_MODIFY("IN-3")
49218      // 0x0004 - "stk 4" // standard input (expected here)
49219      // 0x0008 - "stk 3" // standard input (expected here)
49220      // 0x0010 - "stk 2" // standard input (expected here)
49221      PORT_MODIFY("IN-5")
49222      // 0x0001 - "priz4" // standard input (expected here)
49223      // 0x0002 - "priz3" // standard input (expected here)
49224      // 0x0004 - "priz2" // standard input (expected here)
49225      // 0x0008 - "priz1" // standard input (expected here)
49226      PORT_MODIFY("IN-6")
49227      // 0x0001 - "perc1" // standard input (expected here)
49228      // 0x0002 - "perc2" // standard input (expected here)
49229      // 0x0004 - "perc3" // standard input (expected here)
49230      // 0x0008 - "perc4" // standard input (expected here)
49231      PORT_MODIFY("IN-8")
49232      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk bns")
49233      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk csh")
49234      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("bronze")
49235      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("silver")
49236      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("gold")
49237      PORT_MODIFY("IN-16")
49238      // 0x0001 - "dil1" // standard input (motherboard)
49239      // 0x0002 - "dil2" // standard input (motherboard)
49240      // 0x0004 - "dil3" // standard input (motherboard)
49241      // 0x0008 - "dil4" // standard input (motherboard)
49242      // 0x0010 - "dil5" // standard input (motherboard)
49243      // 0x0100 - "top up" // known extended input, usually 'top up'
49244      PORT_MODIFY("IN-17")
49245      // 0x0001 - "dil6" // standard input (motherboard)
49246      // 0x0002 - "dil7" // standard input (motherboard)
49247      // 0x0004 - "dil8" // standard input (motherboard)
49248      // 0x0008 - "dil9" // standard input (motherboard)
49249      // 0x0010 - "dil10" // standard input (motherboard)
49250      PORT_MODIFY("IN-18")
49251      // 0x0001 - "dil11" // standard input (motherboard)
49252      // 0x0002 - "dil12" // standard input (motherboard)
49253      // 0x0004 - "dil13" // standard input (motherboard)
49254      // 0x0008 - "dil14" // standard input (motherboard)
49255      // 0x0010 - "dil15" // standard input (motherboard)
49256      PORT_MODIFY("IN-19")
49257      // 0x0001 - "dil16" // standard input (motherboard)
49258      PORT_MODIFY("IN-20")
49259      // 0x0001 - "grnbut" // standard input (motherboard)
49260      // 0x0002 - "dorlok" // standard input (expected here)
49261      // 0x0004 - "serdor" // standard input (expected here)
49262      // 0x0008 - "cshdor" // standard input (expected here)
49263      // 0x0010 - "hopdmp" // standard input (expected here)
4926449264INPUT_PORTS_END
4926549265
4926649266// PR1938 AWP POTS OF GOLD SCORP4         PR1918 POTS OF GOLD SOUNDS11      POTS OF GOLD  S.SITE
r31373r31374
4927649276GAMEL( 200?, sc4pogi     ,sc4pog,    sc4, sc4pog, sc4_state, sc4mbus, ROT0, "BFM","Pots Of Gold (Bellfruit) (Scorpion 4) (set 10)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4927749277
4927849278INPUT_PORTS_START( sc4pwrpl ) // this structure is generated
49279        PORT_INCLUDE( sc4_base )
49280        PORT_MODIFY("IN-1")
49281        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
49282        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("power")
49283        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
49284        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
49285        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
49286        // 0x0100 - "hoplw" // known extended input, usually 'hopper fit'
49287        PORT_MODIFY("IN-2")
49288        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49289        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("suph")
49290        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49291        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
49292        PORT_MODIFY("IN-8")
49293        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
49294        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nuds")
49295        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("step")
49296        PORT_MODIFY("IN-16")
49297        // 0x0001 - "dil 1" // standard input (motherboard)
49298        // 0x0002 - "dil 2" // standard input (motherboard)
49299        // 0x0004 - "dil 3" // standard input (motherboard)
49300        // 0x0008 - "dil 4" // standard input (motherboard)
49301        // 0x0010 - "dil 5" // standard input (motherboard)
49302        // 0x0100 - "topup" // known extended input, usually 'top up'
49303        PORT_MODIFY("IN-17")
49304        // 0x0001 - "dil 6" // standard input (motherboard)
49305        // 0x0002 - "dil 7" // standard input (motherboard)
49306        // 0x0004 - "dil 8" // standard input (motherboard)
49307        // 0x0008 - "dil 9" // standard input (motherboard)
49308        // 0x0010 - "dil10" // standard input (motherboard)
49309        PORT_MODIFY("IN-18")
49310        // 0x0001 - "dil11" // standard input (motherboard)
49311        // 0x0002 - "dil12" // standard input (motherboard)
49312        // 0x0004 - "dil13" // standard input (motherboard)
49313        // 0x0008 - "dil14" // standard input (motherboard)
49314        // 0x0010 - "dil15" // standard input (motherboard)
49315        PORT_MODIFY("IN-19")
49316        // 0x0001 - "dil16" // standard input (motherboard)
49317        PORT_MODIFY("IN-20")
49318        // 0x0001 - "test" // standard input (motherboard)
49319        // 0x0002 - "dorlk" // standard input (expected here)
49320        // 0x0004 - "topdr" // standard input (expected here)
49321        // 0x0008 - "cshbx" // standard input (expected here)
49322        // 0x0010 - "deflt" // standard input (expected here)
49279      PORT_INCLUDE( sc4_base )
49280      PORT_MODIFY("IN-1")
49281      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
49282      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("power")
49283      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
49284      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
49285      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
49286      // 0x0100 - "hoplw" // known extended input, usually 'hopper fit'
49287      PORT_MODIFY("IN-2")
49288      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49289      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("suph")
49290      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49291      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
49292      PORT_MODIFY("IN-8")
49293      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash")
49294      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("nuds")
49295      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("step")
49296      PORT_MODIFY("IN-16")
49297      // 0x0001 - "dil 1" // standard input (motherboard)
49298      // 0x0002 - "dil 2" // standard input (motherboard)
49299      // 0x0004 - "dil 3" // standard input (motherboard)
49300      // 0x0008 - "dil 4" // standard input (motherboard)
49301      // 0x0010 - "dil 5" // standard input (motherboard)
49302      // 0x0100 - "topup" // known extended input, usually 'top up'
49303      PORT_MODIFY("IN-17")
49304      // 0x0001 - "dil 6" // standard input (motherboard)
49305      // 0x0002 - "dil 7" // standard input (motherboard)
49306      // 0x0004 - "dil 8" // standard input (motherboard)
49307      // 0x0008 - "dil 9" // standard input (motherboard)
49308      // 0x0010 - "dil10" // standard input (motherboard)
49309      PORT_MODIFY("IN-18")
49310      // 0x0001 - "dil11" // standard input (motherboard)
49311      // 0x0002 - "dil12" // standard input (motherboard)
49312      // 0x0004 - "dil13" // standard input (motherboard)
49313      // 0x0008 - "dil14" // standard input (motherboard)
49314      // 0x0010 - "dil15" // standard input (motherboard)
49315      PORT_MODIFY("IN-19")
49316      // 0x0001 - "dil16" // standard input (motherboard)
49317      PORT_MODIFY("IN-20")
49318      // 0x0001 - "test" // standard input (motherboard)
49319      // 0x0002 - "dorlk" // standard input (expected here)
49320      // 0x0004 - "topdr" // standard input (expected here)
49321      // 0x0008 - "cshbx" // standard input (expected here)
49322      // 0x0010 - "deflt" // standard input (expected here)
4932349323INPUT_PORTS_END
4932449324
4932549325// PR2272 POWER PLAY         PPLY SOUNDS
r31373r31374
4934649346}
4934749347
4934849348INPUT_PORTS_START( sc4swywm ) // this structure is generated
49349        PORT_INCLUDE( sc4_base )
49350        PORT_MODIFY("IN-1")
49351        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
49352        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
49353        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
49354        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
49355        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
49356        PORT_MODIFY("IN-2")
49357        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49358        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
49359        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49360        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49361        PORT_MODIFY("IN-8")
49362        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash OR tke ft")
49363        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("feat")
49364        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("move")
49365        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spin")
49366        PORT_MODIFY("IN-16")
49367        // 0x0001 - "dil 1" // standard input (motherboard)
49368        // 0x0002 - "dil 2" // standard input (motherboard)
49369        // 0x0004 - "dil 3" // standard input (motherboard)
49370        // 0x0008 - "dil 4" // standard input (motherboard)
49371        // 0x0010 - "dil 5" // standard input (motherboard)
49372        // 0x0100 - "top up" // known extended input, usually 'top up'
49373        PORT_MODIFY("IN-17")
49374        // 0x0001 - "dil 6" // standard input (motherboard)
49375        // 0x0002 - "dil 7" // standard input (motherboard)
49376        // 0x0004 - "dil 8" // standard input (motherboard)
49377        // 0x0008 - "dil 9" // standard input (motherboard)
49378        // 0x0010 - "dil10" // standard input (motherboard)
49379        PORT_MODIFY("IN-18")
49380        // 0x0001 - "dil11" // standard input (motherboard)
49381        // 0x0002 - "dil12" // standard input (motherboard)
49382        // 0x0004 - "dil13" // standard input (motherboard)
49383        // 0x0008 - "dil14" // standard input (motherboard)
49384        // 0x0010 - "dil15" // standard input (motherboard)
49385        PORT_MODIFY("IN-19")
49386        // 0x0001 - "dil16" // standard input (motherboard)
49387        PORT_MODIFY("IN-20")
49388        // 0x0001 - "test" // standard input (motherboard)
49389        // 0x0002 - "dor lk" // standard input (expected here)
49390        // 0x0004 - "tp dor" // standard input (expected here)
49391        // 0x0008 - "csh bx" // standard input (expected here)
49392        // 0x0010 - "deflt" // standard input (expected here)
49349      PORT_INCLUDE( sc4_base )
49350      PORT_MODIFY("IN-1")
49351      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
49352      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
49353      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
49354      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
49355      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
49356      PORT_MODIFY("IN-2")
49357      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49358      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
49359      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49360      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49361      PORT_MODIFY("IN-8")
49362      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("cash OR tke ft")
49363      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("feat")
49364      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("move")
49365      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spin")
49366      PORT_MODIFY("IN-16")
49367      // 0x0001 - "dil 1" // standard input (motherboard)
49368      // 0x0002 - "dil 2" // standard input (motherboard)
49369      // 0x0004 - "dil 3" // standard input (motherboard)
49370      // 0x0008 - "dil 4" // standard input (motherboard)
49371      // 0x0010 - "dil 5" // standard input (motherboard)
49372      // 0x0100 - "top up" // known extended input, usually 'top up'
49373      PORT_MODIFY("IN-17")
49374      // 0x0001 - "dil 6" // standard input (motherboard)
49375      // 0x0002 - "dil 7" // standard input (motherboard)
49376      // 0x0004 - "dil 8" // standard input (motherboard)
49377      // 0x0008 - "dil 9" // standard input (motherboard)
49378      // 0x0010 - "dil10" // standard input (motherboard)
49379      PORT_MODIFY("IN-18")
49380      // 0x0001 - "dil11" // standard input (motherboard)
49381      // 0x0002 - "dil12" // standard input (motherboard)
49382      // 0x0004 - "dil13" // standard input (motherboard)
49383      // 0x0008 - "dil14" // standard input (motherboard)
49384      // 0x0010 - "dil15" // standard input (motherboard)
49385      PORT_MODIFY("IN-19")
49386      // 0x0001 - "dil16" // standard input (motherboard)
49387      PORT_MODIFY("IN-20")
49388      // 0x0001 - "test" // standard input (motherboard)
49389      // 0x0002 - "dor lk" // standard input (expected here)
49390      // 0x0004 - "tp dor" // standard input (expected here)
49391      // 0x0008 - "csh bx" // standard input (expected here)
49392      // 0x0010 - "deflt" // standard input (expected here)
4939349393INPUT_PORTS_END
4939449394
4939549395
r31373r31374
4942049420}
4942149421
4942249422INPUT_PORTS_START( sc4sumit ) // this structure is generated
49423        PORT_INCLUDE( sc4_base )
49424        PORT_MODIFY("IN-1")
49425        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
49426        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
49427        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
49428        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
49429        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stake")
49430        // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
49431        PORT_MODIFY("IN-2")
49432        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49433        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
49434        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49435        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49436        PORT_MODIFY("IN-3")
49437        // 0x0004 - "stk3" // standard input (expected here)
49438        // 0x0008 - "stk1" // standard input (expected here)
49439        // 0x0010 - "stk2" // standard input (expected here)
49440        PORT_MODIFY("IN-5")
49441        // 0x0001 - "jp 1" // standard input (expected here)
49442        // 0x0002 - "jp 2" // standard input (expected here)
49443        // 0x0004 - "jp 3" // standard input (expected here)
49444        // 0x0008 - "jp 4" // standard input (expected here)
49445        PORT_MODIFY("IN-6")
49446        // 0x0001 - "pc 1" // standard input (expected here)
49447        // 0x0002 - "pc 2" // standard input (expected here)
49448        // 0x0004 - "pc 3" // standard input (expected here)
49449        // 0x0008 - "pc 4" // standard input (expected here)
49450        PORT_MODIFY("IN-8")
49451        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
49452        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
49453        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
49454        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
49455        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
49456        PORT_MODIFY("IN-9")
49457        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
49458        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
49459        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
49460        PORT_MODIFY("IN-16")
49461        // 0x0001 - "dil 1" // standard input (motherboard)
49462        // 0x0002 - "dil 2" // standard input (motherboard)
49463        // 0x0004 - "dil 3" // standard input (motherboard)
49464        // 0x0008 - "dil 4" // standard input (motherboard)
49465        // 0x0010 - "dil 5" // standard input (motherboard)
49466        // 0x0100 - "top up" // known extended input, usually 'top up'
49467        PORT_MODIFY("IN-17")
49468        // 0x0001 - "dil 6" // standard input (motherboard)
49469        // 0x0002 - "dil 7" // standard input (motherboard)
49470        // 0x0004 - "dil 8" // standard input (motherboard)
49471        // 0x0008 - "dil 9" // standard input (motherboard)
49472        // 0x0010 - "dil10" // standard input (motherboard)
49473        PORT_MODIFY("IN-18")
49474        // 0x0001 - "dil11" // standard input (motherboard)
49475        // 0x0002 - "dil12" // standard input (motherboard)
49476        // 0x0004 - "dil13" // standard input (motherboard)
49477        // 0x0008 - "dil14" // standard input (motherboard)
49478        // 0x0010 - "dil15" // standard input (motherboard)
49479        PORT_MODIFY("IN-19")
49480        // 0x0001 - "dil16" // standard input (motherboard)
49481        PORT_MODIFY("IN-20")
49482        // 0x0001 - "test" // standard input (motherboard)
49483        // 0x0002 - "dorlk" // standard input (expected here)
49484        // 0x0004 - "topdr" // standard input (expected here)
49485        // 0x0008 - "cshbx" // standard input (expected here)
49486        // 0x0010 - "dump" // standard input (expected here)
49423      PORT_INCLUDE( sc4_base )
49424      PORT_MODIFY("IN-1")
49425      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
49426      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
49427      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
49428      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
49429      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stake")
49430      // 0x0100 - "hoplo" // known extended input, usually 'hopper fit'
49431      PORT_MODIFY("IN-2")
49432      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49433      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
49434      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49435      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49436      PORT_MODIFY("IN-3")
49437      // 0x0004 - "stk3" // standard input (expected here)
49438      // 0x0008 - "stk1" // standard input (expected here)
49439      // 0x0010 - "stk2" // standard input (expected here)
49440      PORT_MODIFY("IN-5")
49441      // 0x0001 - "jp 1" // standard input (expected here)
49442      // 0x0002 - "jp 2" // standard input (expected here)
49443      // 0x0004 - "jp 3" // standard input (expected here)
49444      // 0x0008 - "jp 4" // standard input (expected here)
49445      PORT_MODIFY("IN-6")
49446      // 0x0001 - "pc 1" // standard input (expected here)
49447      // 0x0002 - "pc 2" // standard input (expected here)
49448      // 0x0004 - "pc 3" // standard input (expected here)
49449      // 0x0008 - "pc 4" // standard input (expected here)
49450      PORT_MODIFY("IN-8")
49451      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
49452      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
49453      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
49454      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
49455      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
49456      PORT_MODIFY("IN-9")
49457      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
49458      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
49459      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
49460      PORT_MODIFY("IN-16")
49461      // 0x0001 - "dil 1" // standard input (motherboard)
49462      // 0x0002 - "dil 2" // standard input (motherboard)
49463      // 0x0004 - "dil 3" // standard input (motherboard)
49464      // 0x0008 - "dil 4" // standard input (motherboard)
49465      // 0x0010 - "dil 5" // standard input (motherboard)
49466      // 0x0100 - "top up" // known extended input, usually 'top up'
49467      PORT_MODIFY("IN-17")
49468      // 0x0001 - "dil 6" // standard input (motherboard)
49469      // 0x0002 - "dil 7" // standard input (motherboard)
49470      // 0x0004 - "dil 8" // standard input (motherboard)
49471      // 0x0008 - "dil 9" // standard input (motherboard)
49472      // 0x0010 - "dil10" // standard input (motherboard)
49473      PORT_MODIFY("IN-18")
49474      // 0x0001 - "dil11" // standard input (motherboard)
49475      // 0x0002 - "dil12" // standard input (motherboard)
49476      // 0x0004 - "dil13" // standard input (motherboard)
49477      // 0x0008 - "dil14" // standard input (motherboard)
49478      // 0x0010 - "dil15" // standard input (motherboard)
49479      PORT_MODIFY("IN-19")
49480      // 0x0001 - "dil16" // standard input (motherboard)
49481      PORT_MODIFY("IN-20")
49482      // 0x0001 - "test" // standard input (motherboard)
49483      // 0x0002 - "dorlk" // standard input (expected here)
49484      // 0x0004 - "topdr" // standard input (expected here)
49485      // 0x0008 - "cshbx" // standard input (expected here)
49486      // 0x0010 - "dump" // standard input (expected here)
4948749487INPUT_PORTS_END
4948849488
4948949489// PR2176 SUMMIT UP         SUMMIT SOUNDS         SUMMIT UP    (was in the Suits U Sir set)
r31373r31374
4949349493GAMEL( 200?, sc4sumitc   ,sc4sus,    sc4, sc4sumit, sc4_state, sc4sumit, ROT0, "Mazooma","Summit Up (Mazooma) (Scorpion 4) (set 4)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4949449494
4949549495INPUT_PORTS_START( sc4tpsht ) // this structure is generated
49496        PORT_INCLUDE( sc4_base )
49497        PORT_MODIFY("IN-1")
49498        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
49499        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
49500        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
49501        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
49502        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
49503        PORT_MODIFY("IN-2")
49504        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49505        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
49506        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49507        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
49508        PORT_MODIFY("IN-8")
49509        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("lo")
49510        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("hi")
49511        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("step")
49512        PORT_MODIFY("IN-16")
49513        // 0x0001 - "dil 1" // standard input (motherboard)
49514        // 0x0002 - "dil 2" // standard input (motherboard)
49515        // 0x0004 - "dil 3" // standard input (motherboard)
49516        // 0x0008 - "dil 4" // standard input (motherboard)
49517        // 0x0010 - "dil 5" // standard input (motherboard)
49518        // 0x0100 - "top up" // known extended input, usually 'top up'
49519        PORT_MODIFY("IN-17")
49520        // 0x0001 - "dil 6" // standard input (motherboard)
49521        // 0x0002 - "dil 7" // standard input (motherboard)
49522        // 0x0004 - "dil 8" // standard input (motherboard)
49523        // 0x0008 - "dil 9" // standard input (motherboard)
49524        // 0x0010 - "dil10" // standard input (motherboard)
49525        PORT_MODIFY("IN-18")
49526        // 0x0001 - "dil11" // standard input (motherboard)
49527        // 0x0002 - "dil12" // standard input (motherboard)
49528        // 0x0004 - "dil13" // standard input (motherboard)
49529        // 0x0008 - "dil14" // standard input (motherboard)
49530        // 0x0010 - "dil15" // standard input (motherboard)
49531        PORT_MODIFY("IN-19")
49532        // 0x0001 - "dil16" // standard input (motherboard)
49533        PORT_MODIFY("IN-20")
49534        // 0x0001 - "test" // standard input (motherboard)
49535        // 0x0002 - "lock" // standard input (expected here)
49536        // 0x0004 - "topdor" // standard input (expected here)
49537        // 0x0008 - "botdor" // standard input (expected here)
49538        // 0x0010 - "hopdmp" // standard input (expected here)
49496      PORT_INCLUDE( sc4_base )
49497      PORT_MODIFY("IN-1")
49498      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
49499      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
49500      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
49501      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
49502      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
49503      PORT_MODIFY("IN-2")
49504      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49505      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
49506      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49507      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
49508      PORT_MODIFY("IN-8")
49509      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("lo")
49510      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("hi")
49511      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("step")
49512      PORT_MODIFY("IN-16")
49513      // 0x0001 - "dil 1" // standard input (motherboard)
49514      // 0x0002 - "dil 2" // standard input (motherboard)
49515      // 0x0004 - "dil 3" // standard input (motherboard)
49516      // 0x0008 - "dil 4" // standard input (motherboard)
49517      // 0x0010 - "dil 5" // standard input (motherboard)
49518      // 0x0100 - "top up" // known extended input, usually 'top up'
49519      PORT_MODIFY("IN-17")
49520      // 0x0001 - "dil 6" // standard input (motherboard)
49521      // 0x0002 - "dil 7" // standard input (motherboard)
49522      // 0x0004 - "dil 8" // standard input (motherboard)
49523      // 0x0008 - "dil 9" // standard input (motherboard)
49524      // 0x0010 - "dil10" // standard input (motherboard)
49525      PORT_MODIFY("IN-18")
49526      // 0x0001 - "dil11" // standard input (motherboard)
49527      // 0x0002 - "dil12" // standard input (motherboard)
49528      // 0x0004 - "dil13" // standard input (motherboard)
49529      // 0x0008 - "dil14" // standard input (motherboard)
49530      // 0x0010 - "dil15" // standard input (motherboard)
49531      PORT_MODIFY("IN-19")
49532      // 0x0001 - "dil16" // standard input (motherboard)
49533      PORT_MODIFY("IN-20")
49534      // 0x0001 - "test" // standard input (motherboard)
49535      // 0x0002 - "lock" // standard input (expected here)
49536      // 0x0004 - "topdor" // standard input (expected here)
49537      // 0x0008 - "botdor" // standard input (expected here)
49538      // 0x0010 - "hopdmp" // standard input (expected here)
4953949539INPUT_PORTS_END
4954049540
4954149541// PR2211 TOP OF THE SHOTS         TOTS SOUNDS         TOP OF THE SHOTS
r31373r31374
4955049550
4955149551
4955249552INPUT_PORTS_START( sc4adren ) // this structure is generated
49553        PORT_INCLUDE( sc4_base )
49554        PORT_MODIFY("IN-1")
49555        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
49556        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
49557        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
49558        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
49559        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
49560        PORT_MODIFY("IN-2")
49561        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49562        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
49563        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49564        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49565        PORT_MODIFY("IN-8")
49566        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("usebon")
49567        PORT_MODIFY("IN-16")
49568        // 0x0001 - "dil 1" // standard input (motherboard)
49569        // 0x0002 - "dil 2" // standard input (motherboard)
49570        // 0x0004 - "dil 3" // standard input (motherboard)
49571        // 0x0008 - "dil 4" // standard input (motherboard)
49572        // 0x0010 - "dil 5" // standard input (motherboard)
49573        // 0x0100 - "topup" // known extended input, usually 'top up'
49574        PORT_MODIFY("IN-17")
49575        // 0x0001 - "dil 6" // standard input (motherboard)
49576        // 0x0002 - "dil 7" // standard input (motherboard)
49577        // 0x0004 - "dil 8" // standard input (motherboard)
49578        // 0x0008 - "dil 9" // standard input (motherboard)
49579        // 0x0010 - "dil10" // standard input (motherboard)
49580        PORT_MODIFY("IN-18")
49581        // 0x0001 - "dil11" // standard input (motherboard)
49582        // 0x0002 - "dil12" // standard input (motherboard)
49583        // 0x0004 - "dil13" // standard input (motherboard)
49584        // 0x0008 - "dil14" // standard input (motherboard)
49585        // 0x0010 - "dil15" // standard input (motherboard)
49586        PORT_MODIFY("IN-19")
49587        // 0x0001 - "dil16" // standard input (motherboard)
49588        PORT_MODIFY("IN-20")
49589        // 0x0001 - "test" // standard input (motherboard)
49590        // 0x0002 - "dor lk" // standard input (expected here)
49591        // 0x0004 - "tp dor" // standard input (expected here)
49592        // 0x0008 - "csh bx" // standard input (expected here)
49593        // 0x0010 - "deflt" // standard input (expected here)
49553      PORT_INCLUDE( sc4_base )
49554      PORT_MODIFY("IN-1")
49555      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
49556      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("coll")
49557      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
49558      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
49559      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
49560      PORT_MODIFY("IN-2")
49561      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("trans")
49562      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
49563      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49564      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49565      PORT_MODIFY("IN-8")
49566      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("usebon")
49567      PORT_MODIFY("IN-16")
49568      // 0x0001 - "dil 1" // standard input (motherboard)
49569      // 0x0002 - "dil 2" // standard input (motherboard)
49570      // 0x0004 - "dil 3" // standard input (motherboard)
49571      // 0x0008 - "dil 4" // standard input (motherboard)
49572      // 0x0010 - "dil 5" // standard input (motherboard)
49573      // 0x0100 - "topup" // known extended input, usually 'top up'
49574      PORT_MODIFY("IN-17")
49575      // 0x0001 - "dil 6" // standard input (motherboard)
49576      // 0x0002 - "dil 7" // standard input (motherboard)
49577      // 0x0004 - "dil 8" // standard input (motherboard)
49578      // 0x0008 - "dil 9" // standard input (motherboard)
49579      // 0x0010 - "dil10" // standard input (motherboard)
49580      PORT_MODIFY("IN-18")
49581      // 0x0001 - "dil11" // standard input (motherboard)
49582      // 0x0002 - "dil12" // standard input (motherboard)
49583      // 0x0004 - "dil13" // standard input (motherboard)
49584      // 0x0008 - "dil14" // standard input (motherboard)
49585      // 0x0010 - "dil15" // standard input (motherboard)
49586      PORT_MODIFY("IN-19")
49587      // 0x0001 - "dil16" // standard input (motherboard)
49588      PORT_MODIFY("IN-20")
49589      // 0x0001 - "test" // standard input (motherboard)
49590      // 0x0002 - "dor lk" // standard input (expected here)
49591      // 0x0004 - "tp dor" // standard input (expected here)
49592      // 0x0008 - "csh bx" // standard input (expected here)
49593      // 0x0010 - "deflt" // standard input (expected here)
4959449594INPUT_PORTS_END
4959549595
4959649596// does not want the 'COTL SOUNDS' from Cash On The Lash
r31373r31374
4960249602
4960349603
4960449604INPUT_PORTS_START( sc4bingb ) // this structure is generated
49605        PORT_INCLUDE( sc4_base )
49606        PORT_MODIFY("IN-1")
49607        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("coll")
49608        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("trans")
49609        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
49610        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
49611        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("maxbet")
49612        PORT_MODIFY("IN-2")
49613        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("fast")
49614        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49615        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49616        PORT_MODIFY("IN-8")
49617        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("stake6")
49618        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("stake3")
49619        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("stake2")
49620        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("stake5")
49621        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("stake4")
49622        PORT_MODIFY("IN-9")
49623        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("stake1")
49624        PORT_MODIFY("IN-16")
49625        // 0x0001 - "dil 1" // standard input (motherboard)
49626        // 0x0002 - "dil 2" // standard input (motherboard)
49627        // 0x0004 - "dil 3" // standard input (motherboard)
49628        // 0x0008 - "dil 4" // standard input (motherboard)
49629        // 0x0010 - "dil 5" // standard input (motherboard)
49630        // 0x0100 - "topup" // known extended input, usually 'top up'
49631        PORT_MODIFY("IN-17")
49632        // 0x0001 - "dil 6" // standard input (motherboard)
49633        // 0x0002 - "dil 7" // standard input (motherboard)
49634        // 0x0004 - "dil 8" // standard input (motherboard)
49635        // 0x0008 - "dil 9" // standard input (motherboard)
49636        // 0x0010 - "dil10" // standard input (motherboard)
49637        PORT_MODIFY("IN-18")
49638        // 0x0001 - "dil11" // standard input (motherboard)
49639        // 0x0002 - "dil12" // standard input (motherboard)
49640        // 0x0004 - "dil13" // standard input (motherboard)
49641        // 0x0008 - "dil14" // standard input (motherboard)
49642        // 0x0010 - "dil15" // standard input (motherboard)
49643        PORT_MODIFY("IN-19")
49644        // 0x0001 - "dil16" // standard input (motherboard)
49645        PORT_MODIFY("IN-20")
49646        // 0x0001 - "test" // standard input (motherboard)
49647        // 0x0002 - "dor lk" // standard input (expected here)
49648        // 0x0004 - "tp dor" // standard input (expected here)
49649        // 0x0008 - "csh bx" // standard input (expected here)
49650        // 0x0010 - "deflt" // standard input (expected here)
49605      PORT_INCLUDE( sc4_base )
49606      PORT_MODIFY("IN-1")
49607      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("coll")
49608      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("trans")
49609      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
49610      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
49611      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("maxbet")
49612      PORT_MODIFY("IN-2")
49613      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("fast")
49614      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49615      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49616      PORT_MODIFY("IN-8")
49617      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("stake6")
49618      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("stake3")
49619      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("stake2")
49620      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("stake5")
49621      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("stake4")
49622      PORT_MODIFY("IN-9")
49623      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("stake1")
49624      PORT_MODIFY("IN-16")
49625      // 0x0001 - "dil 1" // standard input (motherboard)
49626      // 0x0002 - "dil 2" // standard input (motherboard)
49627      // 0x0004 - "dil 3" // standard input (motherboard)
49628      // 0x0008 - "dil 4" // standard input (motherboard)
49629      // 0x0010 - "dil 5" // standard input (motherboard)
49630      // 0x0100 - "topup" // known extended input, usually 'top up'
49631      PORT_MODIFY("IN-17")
49632      // 0x0001 - "dil 6" // standard input (motherboard)
49633      // 0x0002 - "dil 7" // standard input (motherboard)
49634      // 0x0004 - "dil 8" // standard input (motherboard)
49635      // 0x0008 - "dil 9" // standard input (motherboard)
49636      // 0x0010 - "dil10" // standard input (motherboard)
49637      PORT_MODIFY("IN-18")
49638      // 0x0001 - "dil11" // standard input (motherboard)
49639      // 0x0002 - "dil12" // standard input (motherboard)
49640      // 0x0004 - "dil13" // standard input (motherboard)
49641      // 0x0008 - "dil14" // standard input (motherboard)
49642      // 0x0010 - "dil15" // standard input (motherboard)
49643      PORT_MODIFY("IN-19")
49644      // 0x0001 - "dil16" // standard input (motherboard)
49645      PORT_MODIFY("IN-20")
49646      // 0x0001 - "test" // standard input (motherboard)
49647      // 0x0002 - "dor lk" // standard input (expected here)
49648      // 0x0004 - "tp dor" // standard input (expected here)
49649      // 0x0008 - "csh bx" // standard input (expected here)
49650      // 0x0010 - "deflt" // standard input (expected here)
4965149651INPUT_PORTS_END
4965249652
4965349653// check if Side Splitter sound is correct
r31373r31374
4965749657GAMEL( 200?, sc4bingba   ,sc4bingb,  sc4, sc4bingb, sc4_state, sc4, ROT0, "Mazooma","Bingo Belle (Mazooma) (Scorpion 4) (set 2)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4965849658
4965949659INPUT_PORTS_START( sc4cerup ) // this structure is generated
49660        PORT_INCLUDE( sc4_base )
49661        PORT_MODIFY("IN-1")
49662        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
49663        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
49664        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
49665        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
49666        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
49667        PORT_MODIFY("IN-2")
49668        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("a ndge")
49669        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("tk ftr")
49670        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49671        PORT_MODIFY("IN-8")
49672        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("csh hi")
49673        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("ndg hi")
49674        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("ndg lo")
49675        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("csh lo")
49676        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
49677        PORT_MODIFY("IN-16")
49678        // 0x0001 - "dil  1" // standard input (motherboard)
49679        // 0x0002 - "dil  2" // standard input (motherboard)
49680        // 0x0004 - "dil  3" // standard input (motherboard)
49681        // 0x0008 - "dil  4" // standard input (motherboard)
49682        // 0x0010 - "dil  5" // standard input (motherboard)
49683        // 0x0100 - "top up" // known extended input, usually 'top up'
49684        PORT_MODIFY("IN-17")
49685        // 0x0001 - "dil  6" // standard input (motherboard)
49686        // 0x0002 - "dil  7" // standard input (motherboard)
49687        // 0x0004 - "dil  8" // standard input (motherboard)
49688        // 0x0008 - "dil  9" // standard input (motherboard)
49689        // 0x0010 - "dil 10" // standard input (motherboard)
49690        PORT_MODIFY("IN-18")
49691        // 0x0001 - "dil 11" // standard input (motherboard)
49692        // 0x0002 - "dil 12" // standard input (motherboard)
49693        // 0x0004 - "dil 13" // standard input (motherboard)
49694        // 0x0008 - "dil 14" // standard input (motherboard)
49695        // 0x0010 - "dil 15" // standard input (motherboard)
49696        PORT_MODIFY("IN-19")
49697        // 0x0001 - "dil 16" // standard input (motherboard)
49698        PORT_MODIFY("IN-20")
49699        // 0x0001 - "testsw" // standard input (motherboard)
49700        // 0x0002 - "dor lk" // standard input (expected here)
49701        // 0x0004 - "tp dor" // standard input (expected here)
49702        // 0x0008 - "csh bx" // standard input (expected here)
49703        // 0x0010 - "deflt" // standard input (expected here)
49660      PORT_INCLUDE( sc4_base )
49661      PORT_MODIFY("IN-1")
49662      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
49663      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
49664      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
49665      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
49666      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("coll")
49667      PORT_MODIFY("IN-2")
49668      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("a ndge")
49669      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("tk ftr")
49670      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49671      PORT_MODIFY("IN-8")
49672      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("csh hi")
49673      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("ndg hi")
49674      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("ndg lo")
49675      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("csh lo")
49676      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
49677      PORT_MODIFY("IN-16")
49678      // 0x0001 - "dil  1" // standard input (motherboard)
49679      // 0x0002 - "dil  2" // standard input (motherboard)
49680      // 0x0004 - "dil  3" // standard input (motherboard)
49681      // 0x0008 - "dil  4" // standard input (motherboard)
49682      // 0x0010 - "dil  5" // standard input (motherboard)
49683      // 0x0100 - "top up" // known extended input, usually 'top up'
49684      PORT_MODIFY("IN-17")
49685      // 0x0001 - "dil  6" // standard input (motherboard)
49686      // 0x0002 - "dil  7" // standard input (motherboard)
49687      // 0x0004 - "dil  8" // standard input (motherboard)
49688      // 0x0008 - "dil  9" // standard input (motherboard)
49689      // 0x0010 - "dil 10" // standard input (motherboard)
49690      PORT_MODIFY("IN-18")
49691      // 0x0001 - "dil 11" // standard input (motherboard)
49692      // 0x0002 - "dil 12" // standard input (motherboard)
49693      // 0x0004 - "dil 13" // standard input (motherboard)
49694      // 0x0008 - "dil 14" // standard input (motherboard)
49695      // 0x0010 - "dil 15" // standard input (motherboard)
49696      PORT_MODIFY("IN-19")
49697      // 0x0001 - "dil 16" // standard input (motherboard)
49698      PORT_MODIFY("IN-20")
49699      // 0x0001 - "testsw" // standard input (motherboard)
49700      // 0x0002 - "dor lk" // standard input (expected here)
49701      // 0x0004 - "tp dor" // standard input (expected here)
49702      // 0x0008 - "csh bx" // standard input (expected here)
49703      // 0x0010 - "deflt" // standard input (expected here)
4970449704INPUT_PORTS_END
4970549705
4970649706
r31373r31374
4970849708GAMEL( 200?, sc4cerup    ,0,         sc4, sc4cerup, sc4_state, sc4, ROT0, "Mazooma","Cash Eruption (Mazooma) (Scorpion 4)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4970949709
4971049710INPUT_PORTS_START( sc4cexpl ) // this structure is generated
49711        PORT_INCLUDE( sc4_base )
49712        PORT_MODIFY("IN-1")
49713        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
49714        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
49715        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
49716        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
49717        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
49718        PORT_MODIFY("IN-2")
49719        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
49720        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49721        PORT_MODIFY("IN-8")
49722        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk cas")
49723        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk nud")
49724        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk pic")
49725        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("move u")
49726        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lef hi")
49727        PORT_MODIFY("IN-9")
49728        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("mid hi")
49729        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("rgt hi")
49730        PORT_MODIFY("IN-16")
49731        // 0x0001 - "dil  1" // standard input (motherboard)
49732        // 0x0002 - "dil  2" // standard input (motherboard)
49733        // 0x0004 - "dil  3" // standard input (motherboard)
49734        // 0x0008 - "dil  4" // standard input (motherboard)
49735        // 0x0010 - "dil  5" // standard input (motherboard)
49736        // 0x0100 - "top up" // known extended input, usually 'top up'
49737        PORT_MODIFY("IN-17")
49738        // 0x0001 - "dil  6" // standard input (motherboard)
49739        // 0x0002 - "dil  7" // standard input (motherboard)
49740        // 0x0004 - "dil  8" // standard input (motherboard)
49741        // 0x0008 - "dil  9" // standard input (motherboard)
49742        // 0x0010 - "dil 10" // standard input (motherboard)
49743        PORT_MODIFY("IN-18")
49744        // 0x0001 - "dil 11" // standard input (motherboard)
49745        // 0x0002 - "dil 12" // standard input (motherboard)
49746        // 0x0004 - "dil 13" // standard input (motherboard)
49747        // 0x0008 - "dil 14" // standard input (motherboard)
49748        // 0x0010 - "dil 15" // standard input (motherboard)
49749        PORT_MODIFY("IN-19")
49750        // 0x0001 - "dil 16" // standard input (motherboard)
49751        PORT_MODIFY("IN-20")
49752        // 0x0001 - "testsw" // standard input (motherboard)
49753        // 0x0002 - "dor lk" // standard input (expected here)
49754        // 0x0004 - "tp dor" // standard input (expected here)
49755        // 0x0008 - "csh bx" // standard input (expected here)
49756        // 0x0010 - "deflt" // standard input (expected here)
49711      PORT_INCLUDE( sc4_base )
49712      PORT_MODIFY("IN-1")
49713      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
49714      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("collec")
49715      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
49716      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
49717      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
49718      PORT_MODIFY("IN-2")
49719      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
49720      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49721      PORT_MODIFY("IN-8")
49722      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk cas")
49723      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk nud")
49724      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk pic")
49725      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("move u")
49726      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("lef hi")
49727      PORT_MODIFY("IN-9")
49728      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("mid hi")
49729      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("rgt hi")
49730      PORT_MODIFY("IN-16")
49731      // 0x0001 - "dil  1" // standard input (motherboard)
49732      // 0x0002 - "dil  2" // standard input (motherboard)
49733      // 0x0004 - "dil  3" // standard input (motherboard)
49734      // 0x0008 - "dil  4" // standard input (motherboard)
49735      // 0x0010 - "dil  5" // standard input (motherboard)
49736      // 0x0100 - "top up" // known extended input, usually 'top up'
49737      PORT_MODIFY("IN-17")
49738      // 0x0001 - "dil  6" // standard input (motherboard)
49739      // 0x0002 - "dil  7" // standard input (motherboard)
49740      // 0x0004 - "dil  8" // standard input (motherboard)
49741      // 0x0008 - "dil  9" // standard input (motherboard)
49742      // 0x0010 - "dil 10" // standard input (motherboard)
49743      PORT_MODIFY("IN-18")
49744      // 0x0001 - "dil 11" // standard input (motherboard)
49745      // 0x0002 - "dil 12" // standard input (motherboard)
49746      // 0x0004 - "dil 13" // standard input (motherboard)
49747      // 0x0008 - "dil 14" // standard input (motherboard)
49748      // 0x0010 - "dil 15" // standard input (motherboard)
49749      PORT_MODIFY("IN-19")
49750      // 0x0001 - "dil 16" // standard input (motherboard)
49751      PORT_MODIFY("IN-20")
49752      // 0x0001 - "testsw" // standard input (motherboard)
49753      // 0x0002 - "dor lk" // standard input (expected here)
49754      // 0x0004 - "tp dor" // standard input (expected here)
49755      // 0x0008 - "csh bx" // standard input (expected here)
49756      // 0x0010 - "deflt" // standard input (expected here)
4975749757INPUT_PORTS_END
4975849758
4975949759// PR2076 CASH EXPLOSION         CEXP SOUNDS         CASH EXPLSION
r31373r31374
4977649776
4977749777// I guess this isn't a fruit machine
4977849778INPUT_PORTS_START( sc4casrya ) // this structure is generated
49779        PORT_INCLUDE( sc4_base )
49780        PORT_MODIFY("IN-1")
49781        // 0x0100 - "esc" // known extended input, usually 'hopper fit'
49782        PORT_MODIFY("IN-2")
49783        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("tilt")
49784        // 0x0100 - "c hop" // unexpected here
49785        PORT_MODIFY("IN-4")
49786        // 0x0100 - "vib" // known extended input, usually 'hopper low'
49787        PORT_MODIFY("IN-6")
49788        // 0x0001 - "arm l" // standard input (expected here)
49789        PORT_MODIFY("IN-8")
49790        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("arm r")
49791        PORT_MODIFY("IN-16")
49792        // 0x0001 - "dil sw" // standard input (motherboard)
49793        // 0x0002 - "dil sw" // standard input (motherboard)
49794        // 0x0004 - "dil sw" // standard input (motherboard)
49795        // 0x0008 - "dil sw" // standard input (motherboard)
49796        // 0x0010 - "dil sw" // standard input (motherboard)
49797        PORT_MODIFY("IN-17")
49798        // 0x0001 - "dil sw" // standard input (motherboard)
49799        // 0x0002 - "dil sw" // standard input (motherboard)
49800        // 0x0004 - "dil sw" // standard input (motherboard)
49801        // 0x0008 - "dil sw" // standard input (motherboard)
49802        // 0x0010 - "dil sw" // standard input (motherboard)
49803        PORT_MODIFY("IN-18")
49804        // 0x0001 - "dil sw" // standard input (motherboard)
49805        // 0x0002 - "dil sw" // standard input (motherboard)
49806        // 0x0004 - "dil sw" // standard input (motherboard)
49807        // 0x0008 - "dil sw" // standard input (motherboard)
49808        // 0x0010 - "dil sw" // standard input (motherboard)
49809        PORT_MODIFY("IN-19")
49810        // 0x0001 - "dil sw" // standard input (motherboard)
49811        PORT_MODIFY("IN-20")
49812        // 0x0001 - "green OR t bot" // standard input (motherboard)
49813        // 0x0002 - "door l" // standard input (expected here)
49814        // 0x0004 - "top do" // standard input (expected here)
49815        // 0x0008 - "cashbo OR cash b" // standard input (expected here)
49816        // 0x0010 - "defloa" // standard input (expected here)
49779      PORT_INCLUDE( sc4_base )
49780      PORT_MODIFY("IN-1")
49781      // 0x0100 - "esc" // known extended input, usually 'hopper fit'
49782      PORT_MODIFY("IN-2")
49783      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("tilt")
49784      // 0x0100 - "c hop" // unexpected here
49785      PORT_MODIFY("IN-4")
49786      // 0x0100 - "vib" // known extended input, usually 'hopper low'
49787      PORT_MODIFY("IN-6")
49788      // 0x0001 - "arm l" // standard input (expected here)
49789      PORT_MODIFY("IN-8")
49790      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("arm r")
49791      PORT_MODIFY("IN-16")
49792      // 0x0001 - "dil sw" // standard input (motherboard)
49793      // 0x0002 - "dil sw" // standard input (motherboard)
49794      // 0x0004 - "dil sw" // standard input (motherboard)
49795      // 0x0008 - "dil sw" // standard input (motherboard)
49796      // 0x0010 - "dil sw" // standard input (motherboard)
49797      PORT_MODIFY("IN-17")
49798      // 0x0001 - "dil sw" // standard input (motherboard)
49799      // 0x0002 - "dil sw" // standard input (motherboard)
49800      // 0x0004 - "dil sw" // standard input (motherboard)
49801      // 0x0008 - "dil sw" // standard input (motherboard)
49802      // 0x0010 - "dil sw" // standard input (motherboard)
49803      PORT_MODIFY("IN-18")
49804      // 0x0001 - "dil sw" // standard input (motherboard)
49805      // 0x0002 - "dil sw" // standard input (motherboard)
49806      // 0x0004 - "dil sw" // standard input (motherboard)
49807      // 0x0008 - "dil sw" // standard input (motherboard)
49808      // 0x0010 - "dil sw" // standard input (motherboard)
49809      PORT_MODIFY("IN-19")
49810      // 0x0001 - "dil sw" // standard input (motherboard)
49811      PORT_MODIFY("IN-20")
49812      // 0x0001 - "green OR t bot" // standard input (motherboard)
49813      // 0x0002 - "door l" // standard input (expected here)
49814      // 0x0004 - "top do" // standard input (expected here)
49815      // 0x0008 - "cashbo OR cash b" // standard input (expected here)
49816      // 0x0010 - "defloa" // standard input (expected here)
4981749817INPUT_PORTS_END
4981849818
4981949819// PR2073, CZECH CASINO ROYALE.......................CROY SOUNDS... (not standard header)
r31373r31374
4982149821GAMEL( 200?, sc4casryb   ,sc4casry,  sc4, sc4casrya, sc4_state, sc4, ROT0, "Mazooma","Casino Royale (PR2073) (Czech) (Mazooma) (Scorpion 4) (set 2)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4982249822
4982349823INPUT_PORTS_START( sc4clucl ) // this structure is generated
49824        PORT_INCLUDE( sc4_base )
49825        PORT_MODIFY("IN-1")
49826        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
49827        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
49828        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
49829        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
49830        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
49831        PORT_MODIFY("IN-2")
49832        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
49833        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
49834        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
49835        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49836        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
49837        PORT_MODIFY("IN-3")
49838        // 0x0004 - "stk 4" // standard input (expected here)
49839        // 0x0008 - "stk 3" // standard input (expected here)
49840        // 0x0010 - "stk 2" // standard input (expected here)
49841        PORT_MODIFY("IN-4")
49842        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
49843        PORT_MODIFY("IN-5")
49844        // 0x0001 - "priz4" // standard input (expected here)
49845        // 0x0002 - "priz3" // standard input (expected here)
49846        // 0x0004 - "priz2" // standard input (expected here)
49847        // 0x0008 - "priz1" // standard input (expected here)
49848        PORT_MODIFY("IN-8")
49849        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
49850        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk mtr")
49851        PORT_MODIFY("IN-16")
49852        // 0x0001 - "dil 1" // standard input (motherboard)
49853        // 0x0002 - "dil 2" // standard input (motherboard)
49854        // 0x0004 - "dil 3" // standard input (motherboard)
49855        // 0x0008 - "dil 4" // standard input (motherboard)
49856        // 0x0010 - "dil 5" // standard input (motherboard)
49857        // 0x0100 - "top up" // known extended input, usually 'top up'
49858        PORT_MODIFY("IN-17")
49859        // 0x0001 - "dil 6" // standard input (motherboard)
49860        // 0x0002 - "dil 7" // standard input (motherboard)
49861        // 0x0004 - "dil 8" // standard input (motherboard)
49862        // 0x0008 - "dil 9" // standard input (motherboard)
49863        // 0x0010 - "dil10" // standard input (motherboard)
49864        PORT_MODIFY("IN-18")
49865        // 0x0001 - "dil11" // standard input (motherboard)
49866        // 0x0002 - "dil12" // standard input (motherboard)
49867        // 0x0004 - "dil13" // standard input (motherboard)
49868        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
49869        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
49870        PORT_MODIFY("IN-19")
49871        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
49872        PORT_MODIFY("IN-20")
49873        // 0x0001 - "grnbut" // standard input (motherboard)
49874        // 0x0002 - "dorlok" // standard input (expected here)
49875        // 0x0004 - "topdor" // standard input (expected here)
49876        // 0x0008 - "botdor" // standard input (expected here)
49877        // 0x0010 - "hopdmp" // standard input (expected here)
49824      PORT_INCLUDE( sc4_base )
49825      PORT_MODIFY("IN-1")
49826      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
49827      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
49828      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
49829      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
49830      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
49831      PORT_MODIFY("IN-2")
49832      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
49833      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("trans")
49834      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
49835      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49836      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
49837      PORT_MODIFY("IN-3")
49838      // 0x0004 - "stk 4" // standard input (expected here)
49839      // 0x0008 - "stk 3" // standard input (expected here)
49840      // 0x0010 - "stk 2" // standard input (expected here)
49841      PORT_MODIFY("IN-4")
49842      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
49843      PORT_MODIFY("IN-5")
49844      // 0x0001 - "priz4" // standard input (expected here)
49845      // 0x0002 - "priz3" // standard input (expected here)
49846      // 0x0004 - "priz2" // standard input (expected here)
49847      // 0x0008 - "priz1" // standard input (expected here)
49848      PORT_MODIFY("IN-8")
49849      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
49850      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk mtr")
49851      PORT_MODIFY("IN-16")
49852      // 0x0001 - "dil 1" // standard input (motherboard)
49853      // 0x0002 - "dil 2" // standard input (motherboard)
49854      // 0x0004 - "dil 3" // standard input (motherboard)
49855      // 0x0008 - "dil 4" // standard input (motherboard)
49856      // 0x0010 - "dil 5" // standard input (motherboard)
49857      // 0x0100 - "top up" // known extended input, usually 'top up'
49858      PORT_MODIFY("IN-17")
49859      // 0x0001 - "dil 6" // standard input (motherboard)
49860      // 0x0002 - "dil 7" // standard input (motherboard)
49861      // 0x0004 - "dil 8" // standard input (motherboard)
49862      // 0x0008 - "dil 9" // standard input (motherboard)
49863      // 0x0010 - "dil10" // standard input (motherboard)
49864      PORT_MODIFY("IN-18")
49865      // 0x0001 - "dil11" // standard input (motherboard)
49866      // 0x0002 - "dil12" // standard input (motherboard)
49867      // 0x0004 - "dil13" // standard input (motherboard)
49868      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
49869      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
49870      PORT_MODIFY("IN-19")
49871      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
49872      PORT_MODIFY("IN-20")
49873      // 0x0001 - "grnbut" // standard input (motherboard)
49874      // 0x0002 - "dorlok" // standard input (expected here)
49875      // 0x0004 - "topdor" // standard input (expected here)
49876      // 0x0008 - "botdor" // standard input (expected here)
49877      // 0x0010 - "hopdmp" // standard input (expected here)
4987849878INPUT_PORTS_END
4987949879
4988049880// PR2237 CLUB CLUEDO         CLUB CLUEDO CLUB  CCLU SOUNDS         CLUB CLUEDO
r31373r31374
4988249882GAMEL( 200?, sc4clucla   ,sc4clucl,  sc4, sc4clucl, sc4_state, sc4, ROT0, "Mazooma","Cluedo Club (Mazooma) (Scorpion 4) (set 2)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4988349883
4988449884INPUT_PORTS_START( sc4cyc ) // this structure is generated
49885        PORT_INCLUDE( sc4_base )
49886        PORT_MODIFY("IN-1")
49887        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
49888        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
49889        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
49890        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
49891        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
49892        // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
49893        PORT_MODIFY("IN-2")
49894        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
49895        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49896        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49897        PORT_MODIFY("IN-3")
49898        // 0x0004 - "stk 4" // standard input (expected here)
49899        // 0x0008 - "stk 3" // standard input (expected here)
49900        // 0x0010 - "stk 2" // standard input (expected here)
49901        PORT_MODIFY("IN-5")
49902        // 0x0001 - "priz4" // standard input (expected here)
49903        // 0x0002 - "priz3" // standard input (expected here)
49904        // 0x0004 - "priz2" // standard input (expected here)
49905        // 0x0008 - "priz1" // standard input (expected here)
49906        PORT_MODIFY("IN-6")
49907        // 0x0001 - "perc1" // standard input (expected here)
49908        // 0x0002 - "perc2" // standard input (expected here)
49909        // 0x0004 - "perc3" // standard input (expected here)
49910        // 0x0008 - "perc4" // standard input (expected here)
49911        PORT_MODIFY("IN-8")
49912        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fea")
49913        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht")
49914        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk nud")
49915        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk ss")
49916        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk haz")
49917        PORT_MODIFY("IN-16")
49918        // 0x0001 - "dil 1" // standard input (motherboard)
49919        // 0x0002 - "dil 2" // standard input (motherboard)
49920        // 0x0004 - "dil 3" // standard input (motherboard)
49921        // 0x0008 - "dil 4" // standard input (motherboard)
49922        // 0x0010 - "dil 5" // standard input (motherboard)
49923        // 0x0100 - "top up" // known extended input, usually 'top up'
49924        PORT_MODIFY("IN-17")
49925        // 0x0001 - "dil 6" // standard input (motherboard)
49926        // 0x0002 - "dil 7" // standard input (motherboard)
49927        // 0x0004 - "dil 8" // standard input (motherboard)
49928        // 0x0008 - "dil 9" // standard input (motherboard)
49929        // 0x0010 - "dil10" // standard input (motherboard)
49930        PORT_MODIFY("IN-18")
49931        // 0x0001 - "dil11" // standard input (motherboard)
49932        // 0x0002 - "dil12" // standard input (motherboard)
49933        // 0x0004 - "dil13" // standard input (motherboard)
49934        // 0x0008 - "dil14" // standard input (motherboard)
49935        // 0x0010 - "dil15" // standard input (motherboard)
49936        PORT_MODIFY("IN-19")
49937        // 0x0001 - "dil16" // standard input (motherboard)
49938        PORT_MODIFY("IN-20")
49939        // 0x0001 - "grnbut" // standard input (motherboard)
49940        // 0x0002 - "dorlok" // standard input (expected here)
49941        // 0x0004 - "topdor" // standard input (expected here)
49942        // 0x0008 - "botdor" // standard input (expected here)
49943        // 0x0010 - "hopdmp" // standard input (expected here)
49885      PORT_INCLUDE( sc4_base )
49886      PORT_MODIFY("IN-1")
49887      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
49888      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
49889      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2 OR high")
49890      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3 OR low")
49891      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("colect")
49892      // 0x0100 - "hoplow" // known extended input, usually 'hopper fit'
49893      PORT_MODIFY("IN-2")
49894      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchng")
49895      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49896      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49897      PORT_MODIFY("IN-3")
49898      // 0x0004 - "stk 4" // standard input (expected here)
49899      // 0x0008 - "stk 3" // standard input (expected here)
49900      // 0x0010 - "stk 2" // standard input (expected here)
49901      PORT_MODIFY("IN-5")
49902      // 0x0001 - "priz4" // standard input (expected here)
49903      // 0x0002 - "priz3" // standard input (expected here)
49904      // 0x0004 - "priz2" // standard input (expected here)
49905      // 0x0008 - "priz1" // standard input (expected here)
49906      PORT_MODIFY("IN-6")
49907      // 0x0001 - "perc1" // standard input (expected here)
49908      // 0x0002 - "perc2" // standard input (expected here)
49909      // 0x0004 - "perc3" // standard input (expected here)
49910      // 0x0008 - "perc4" // standard input (expected here)
49911      PORT_MODIFY("IN-8")
49912      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk fea")
49913      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk sht")
49914      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tk nud")
49915      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk ss")
49916      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk haz")
49917      PORT_MODIFY("IN-16")
49918      // 0x0001 - "dil 1" // standard input (motherboard)
49919      // 0x0002 - "dil 2" // standard input (motherboard)
49920      // 0x0004 - "dil 3" // standard input (motherboard)
49921      // 0x0008 - "dil 4" // standard input (motherboard)
49922      // 0x0010 - "dil 5" // standard input (motherboard)
49923      // 0x0100 - "top up" // known extended input, usually 'top up'
49924      PORT_MODIFY("IN-17")
49925      // 0x0001 - "dil 6" // standard input (motherboard)
49926      // 0x0002 - "dil 7" // standard input (motherboard)
49927      // 0x0004 - "dil 8" // standard input (motherboard)
49928      // 0x0008 - "dil 9" // standard input (motherboard)
49929      // 0x0010 - "dil10" // standard input (motherboard)
49930      PORT_MODIFY("IN-18")
49931      // 0x0001 - "dil11" // standard input (motherboard)
49932      // 0x0002 - "dil12" // standard input (motherboard)
49933      // 0x0004 - "dil13" // standard input (motherboard)
49934      // 0x0008 - "dil14" // standard input (motherboard)
49935      // 0x0010 - "dil15" // standard input (motherboard)
49936      PORT_MODIFY("IN-19")
49937      // 0x0001 - "dil16" // standard input (motherboard)
49938      PORT_MODIFY("IN-20")
49939      // 0x0001 - "grnbut" // standard input (motherboard)
49940      // 0x0002 - "dorlok" // standard input (expected here)
49941      // 0x0004 - "topdor" // standard input (expected here)
49942      // 0x0008 - "botdor" // standard input (expected here)
49943      // 0x0010 - "hopdmp" // standard input (expected here)
4994449944INPUT_PORTS_END
4994549945
4994649946// half size sound rom, or missing a rom
r31373r31374
4995249952GAMEL( 200?, sc4cycd     ,sc4cyc,    sc4, sc4cyc, sc4_state, sc4, ROT0, "Mazooma","Count Yer Cash (Mazooma) (Scorpion 4) (set 5)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
4995349953
4995449954INPUT_PORTS_START( sc4cyccl ) // this structure is generated
49955        PORT_INCLUDE( sc4_base )
49956        PORT_MODIFY("IN-1")
49957        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
49958        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
49959        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
49960        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
49961        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
49962        PORT_MODIFY("IN-2")
49963        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
49964        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
49965        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49966        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49967        PORT_MODIFY("IN-3")
49968        // 0x0004 - "stk 4" // standard input (expected here)
49969        // 0x0008 - "stk 3" // standard input (expected here)
49970        // 0x0010 - "stk 2" // standard input (expected here)
49971        PORT_MODIFY("IN-4")
49972        // 0x0001 - "hop2lo" // unexpected here
49973        // 0x0002 - "hop1lo OR hop lo" // known extended(?) input, sometimes 'hop hi'
49974        PORT_MODIFY("IN-5")
49975        // 0x0001 - "priz4" // standard input (expected here)
49976        // 0x0002 - "priz3" // standard input (expected here)
49977        // 0x0004 - "priz2" // standard input (expected here)
49978        // 0x0008 - "priz1" // standard input (expected here)
49979        PORT_MODIFY("IN-8")
49980        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("t fet")
49981        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("t sht")
49982        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("t nuds")
49983        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("t ssht")
49984        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("t sfet")
49985        PORT_MODIFY("IN-9")
49986        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("t hazd")
49987        PORT_MODIFY("IN-16")
49988        // 0x0001 - "dil 1" // standard input (motherboard)
49989        // 0x0002 - "dil 2" // standard input (motherboard)
49990        // 0x0004 - "dil 3" // standard input (motherboard)
49991        // 0x0008 - "dil 4" // standard input (motherboard)
49992        // 0x0010 - "dil 5" // standard input (motherboard)
49993        // 0x0100 - "top up" // known extended input, usually 'top up'
49994        PORT_MODIFY("IN-17")
49995        // 0x0001 - "dil 6" // standard input (motherboard)
49996        // 0x0002 - "dil 7" // standard input (motherboard)
49997        // 0x0004 - "dil 8" // standard input (motherboard)
49998        // 0x0008 - "dil 9" // standard input (motherboard)
49999        // 0x0010 - "dil10" // standard input (motherboard)
50000        PORT_MODIFY("IN-18")
50001        // 0x0001 - "dil11" // standard input (motherboard)
50002        // 0x0002 - "dil12" // standard input (motherboard)
50003        // 0x0004 - "dil13" // standard input (motherboard)
50004        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
50005        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
50006        PORT_MODIFY("IN-19")
50007        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
50008        PORT_MODIFY("IN-20")
50009        // 0x0001 - "grnbut" // standard input (motherboard)
50010        // 0x0002 - "dorlok" // standard input (expected here)
50011        // 0x0004 - "topdor" // standard input (expected here)
50012        // 0x0008 - "botdor" // standard input (expected here)
50013        // 0x0010 - "hopdmp" // standard input (expected here)
49955      PORT_INCLUDE( sc4_base )
49956      PORT_MODIFY("IN-1")
49957      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
49958      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
49959      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
49960      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
49961      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
49962      PORT_MODIFY("IN-2")
49963      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
49964      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
49965      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
49966      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
49967      PORT_MODIFY("IN-3")
49968      // 0x0004 - "stk 4" // standard input (expected here)
49969      // 0x0008 - "stk 3" // standard input (expected here)
49970      // 0x0010 - "stk 2" // standard input (expected here)
49971      PORT_MODIFY("IN-4")
49972      // 0x0001 - "hop2lo" // unexpected here
49973      // 0x0002 - "hop1lo OR hop lo" // known extended(?) input, sometimes 'hop hi'
49974      PORT_MODIFY("IN-5")
49975      // 0x0001 - "priz4" // standard input (expected here)
49976      // 0x0002 - "priz3" // standard input (expected here)
49977      // 0x0004 - "priz2" // standard input (expected here)
49978      // 0x0008 - "priz1" // standard input (expected here)
49979      PORT_MODIFY("IN-8")
49980      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("t fet")
49981      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("t sht")
49982      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("t nuds")
49983      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("t ssht")
49984      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("t sfet")
49985      PORT_MODIFY("IN-9")
49986      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("t hazd")
49987      PORT_MODIFY("IN-16")
49988      // 0x0001 - "dil 1" // standard input (motherboard)
49989      // 0x0002 - "dil 2" // standard input (motherboard)
49990      // 0x0004 - "dil 3" // standard input (motherboard)
49991      // 0x0008 - "dil 4" // standard input (motherboard)
49992      // 0x0010 - "dil 5" // standard input (motherboard)
49993      // 0x0100 - "top up" // known extended input, usually 'top up'
49994      PORT_MODIFY("IN-17")
49995      // 0x0001 - "dil 6" // standard input (motherboard)
49996      // 0x0002 - "dil 7" // standard input (motherboard)
49997      // 0x0004 - "dil 8" // standard input (motherboard)
49998      // 0x0008 - "dil 9" // standard input (motherboard)
49999      // 0x0010 - "dil10" // standard input (motherboard)
50000      PORT_MODIFY("IN-18")
50001      // 0x0001 - "dil11" // standard input (motherboard)
50002      // 0x0002 - "dil12" // standard input (motherboard)
50003      // 0x0004 - "dil13" // standard input (motherboard)
50004      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
50005      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
50006      PORT_MODIFY("IN-19")
50007      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
50008      PORT_MODIFY("IN-20")
50009      // 0x0001 - "grnbut" // standard input (motherboard)
50010      // 0x0002 - "dorlok" // standard input (expected here)
50011      // 0x0004 - "topdor" // standard input (expected here)
50012      // 0x0008 - "botdor" // standard input (expected here)
50013      // 0x0010 - "hopdmp" // standard input (expected here)
5001450014INPUT_PORTS_END
5001550015
5001650016// half size sound rom, or missing a rom
r31373r31374
5002150021GAMEL( 200?, sc4cycclc   ,sc4cyccl,  sc4, sc4cyccl, sc4_state, sc4, ROT0, "Mazooma","Count Yer Cash Club (Mazooma) (Scorpion 4) (set 4)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
5002250022
5002350023INPUT_PORTS_START( sc4supst ) // this structure is generated
50024        PORT_INCLUDE( sc4_base )
50025        PORT_MODIFY("IN-1")
50026        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("coll")
50027        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("trans")
50028        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("blnk1")
50029        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("blnk2")
50030        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("blnk3")
50031        PORT_MODIFY("IN-2")
50032        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake")
50033        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50034        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
50035        PORT_MODIFY("IN-16")
50036        // 0x0001 - "dil 1" // standard input (motherboard)
50037        // 0x0002 - "dil 2" // standard input (motherboard)
50038        // 0x0004 - "dil 3" // standard input (motherboard)
50039        // 0x0008 - "dil 4" // standard input (motherboard)
50040        // 0x0010 - "dil 5" // standard input (motherboard)
50041        // 0x0100 - "topup" // known extended input, usually 'top up'
50042        PORT_MODIFY("IN-17")
50043        // 0x0001 - "dil 6" // standard input (motherboard)
50044        // 0x0002 - "dil 7" // standard input (motherboard)
50045        // 0x0004 - "dil 8" // standard input (motherboard)
50046        // 0x0008 - "dil 9" // standard input (motherboard)
50047        // 0x0010 - "dil 10" // standard input (motherboard)
50048        PORT_MODIFY("IN-18")
50049        // 0x0001 - "dil 11" // standard input (motherboard)
50050        // 0x0002 - "dil 12" // standard input (motherboard)
50051        // 0x0004 - "dil 13" // standard input (motherboard)
50052        // 0x0008 - "dil 14" // standard input (motherboard)
50053        // 0x0010 - "dil 15" // standard input (motherboard)
50054        PORT_MODIFY("IN-19")
50055        // 0x0001 - "dil 16" // standard input (motherboard)
50056        PORT_MODIFY("IN-20")
50057        // 0x0001 - "test" // standard input (motherboard)
50058        // 0x0002 - "dor lk" // standard input (expected here)
50059        // 0x0004 - "tp dor" // standard input (expected here)
50060        // 0x0008 - "csh bx" // standard input (expected here)
50061        // 0x0010 - "hp dmp" // standard input (expected here)
50024      PORT_INCLUDE( sc4_base )
50025      PORT_MODIFY("IN-1")
50026      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("coll")
50027      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("trans")
50028      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("blnk1")
50029      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("blnk2")
50030      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("blnk3")
50031      PORT_MODIFY("IN-2")
50032      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stake")
50033      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50034      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
50035      PORT_MODIFY("IN-16")
50036      // 0x0001 - "dil 1" // standard input (motherboard)
50037      // 0x0002 - "dil 2" // standard input (motherboard)
50038      // 0x0004 - "dil 3" // standard input (motherboard)
50039      // 0x0008 - "dil 4" // standard input (motherboard)
50040      // 0x0010 - "dil 5" // standard input (motherboard)
50041      // 0x0100 - "topup" // known extended input, usually 'top up'
50042      PORT_MODIFY("IN-17")
50043      // 0x0001 - "dil 6" // standard input (motherboard)
50044      // 0x0002 - "dil 7" // standard input (motherboard)
50045      // 0x0004 - "dil 8" // standard input (motherboard)
50046      // 0x0008 - "dil 9" // standard input (motherboard)
50047      // 0x0010 - "dil 10" // standard input (motherboard)
50048      PORT_MODIFY("IN-18")
50049      // 0x0001 - "dil 11" // standard input (motherboard)
50050      // 0x0002 - "dil 12" // standard input (motherboard)
50051      // 0x0004 - "dil 13" // standard input (motherboard)
50052      // 0x0008 - "dil 14" // standard input (motherboard)
50053      // 0x0010 - "dil 15" // standard input (motherboard)
50054      PORT_MODIFY("IN-19")
50055      // 0x0001 - "dil 16" // standard input (motherboard)
50056      PORT_MODIFY("IN-20")
50057      // 0x0001 - "test" // standard input (motherboard)
50058      // 0x0002 - "dor lk" // standard input (expected here)
50059      // 0x0004 - "tp dor" // standard input (expected here)
50060      // 0x0008 - "csh bx" // standard input (expected here)
50061      // 0x0010 - "hp dmp" // standard input (expected here)
5006250062INPUT_PORTS_END
5006350063
5006450064//  PR2206 STREAKX         STRX SOUNDS         SUPER STREAX
r31373r31374
5006650066GAMEL( 200?, sc4supsta   ,sc4supst,  sc4, sc4supst, sc4_state, sc4, ROT0, "Mazooma","Super Streax (Mazooma) (Scorpion 4) (set 2)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
5006750067
5006850068INPUT_PORTS_START( sc4sf ) // this structure is generated
50069        PORT_INCLUDE( sc4_base )
50070        PORT_MODIFY("IN-1")
50071        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
50072        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("excnge")
50073        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
50074        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
50075        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
50076        PORT_MODIFY("IN-2")
50077        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("coll")
50078        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50079        PORT_MODIFY("IN-4")
50080        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
50081        PORT_MODIFY("IN-8")
50082        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("brd ex")
50083        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("higher")
50084        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lower")
50085        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fet")
50086        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
50087        PORT_MODIFY("IN-16")
50088        // 0x0001 - "dil  1" // standard input (motherboard)
50089        // 0x0002 - "dil  2" // standard input (motherboard)
50090        // 0x0004 - "dil  3" // standard input (motherboard)
50091        // 0x0008 - "dil  4" // standard input (motherboard)
50092        // 0x0010 - "dil  5" // standard input (motherboard)
50093        PORT_MODIFY("IN-17")
50094        // 0x0001 - "dil  6" // standard input (motherboard)
50095        // 0x0002 - "dil  7" // standard input (motherboard)
50096        // 0x0004 - "dil  8" // standard input (motherboard)
50097        // 0x0008 - "dil  9" // standard input (motherboard)
50098        // 0x0010 - "dil 10" // standard input (motherboard)
50099        PORT_MODIFY("IN-18")
50100        // 0x0001 - "dil 11" // standard input (motherboard)
50101        // 0x0002 - "dil 12" // standard input (motherboard)
50102        // 0x0004 - "dil 13" // standard input (motherboard)
50103        // 0x0008 - "dil 14" // standard input (motherboard)
50104        // 0x0010 - "dil 15" // standard input (motherboard)
50105        PORT_MODIFY("IN-19")
50106        // 0x0001 - "dil 16" // standard input (motherboard)
50107        PORT_MODIFY("IN-20")
50108        // 0x0001 - "testsw" // standard input (motherboard)
50109        // 0x0002 - "dor lk" // standard input (expected here)
50110        // 0x0004 - "tp dor" // standard input (expected here)
50111        // 0x0008 - "csh bx" // standard input (expected here)
50112        // 0x0010 - "deflt" // standard input (expected here)
50069      PORT_INCLUDE( sc4_base )
50070      PORT_MODIFY("IN-1")
50071      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
50072      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("excnge")
50073      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
50074      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
50075      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
50076      PORT_MODIFY("IN-2")
50077      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("coll")
50078      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50079      PORT_MODIFY("IN-4")
50080      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
50081      PORT_MODIFY("IN-8")
50082      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("brd ex")
50083      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("higher")
50084      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lower")
50085      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("tk fet")
50086      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("tk csh")
50087      PORT_MODIFY("IN-16")
50088      // 0x0001 - "dil  1" // standard input (motherboard)
50089      // 0x0002 - "dil  2" // standard input (motherboard)
50090      // 0x0004 - "dil  3" // standard input (motherboard)
50091      // 0x0008 - "dil  4" // standard input (motherboard)
50092      // 0x0010 - "dil  5" // standard input (motherboard)
50093      PORT_MODIFY("IN-17")
50094      // 0x0001 - "dil  6" // standard input (motherboard)
50095      // 0x0002 - "dil  7" // standard input (motherboard)
50096      // 0x0004 - "dil  8" // standard input (motherboard)
50097      // 0x0008 - "dil  9" // standard input (motherboard)
50098      // 0x0010 - "dil 10" // standard input (motherboard)
50099      PORT_MODIFY("IN-18")
50100      // 0x0001 - "dil 11" // standard input (motherboard)
50101      // 0x0002 - "dil 12" // standard input (motherboard)
50102      // 0x0004 - "dil 13" // standard input (motherboard)
50103      // 0x0008 - "dil 14" // standard input (motherboard)
50104      // 0x0010 - "dil 15" // standard input (motherboard)
50105      PORT_MODIFY("IN-19")
50106      // 0x0001 - "dil 16" // standard input (motherboard)
50107      PORT_MODIFY("IN-20")
50108      // 0x0001 - "testsw" // standard input (motherboard)
50109      // 0x0002 - "dor lk" // standard input (expected here)
50110      // 0x0004 - "tp dor" // standard input (expected here)
50111      // 0x0008 - "csh bx" // standard input (expected here)
50112      // 0x0010 - "deflt" // standard input (expected here)
5011350113INPUT_PORTS_END
5011450114
5011550115//  NUMBER PR2024 STREET FIGHTER         STRF SOUNDS          STREET FIGHTER
r31373r31374
5012050120GAMEL( 200?, sc4sfd      ,sc4sf,     sc4, sc4sf, sc4_state, sc4, ROT0, "Mazooma","Street Fighter (Mazooma) (Scorpion 4) (set 5)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
5012150121
5012250122INPUT_PORTS_START( sc4hyde ) // this structure is generated
50123        PORT_INCLUDE( sc4_base )
50124        PORT_MODIFY("IN-1")
50125        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
50126        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold a")
50127        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold b")
50128        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold c")
50129        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stop")
50130        PORT_MODIFY("IN-2")
50131        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("xchnge")
50132        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50133        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
50134        PORT_MODIFY("IN-8")
50135        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
50136        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shot")
50137        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("ftr")
50138        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spin")
50139        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("ko")
50140        PORT_MODIFY("IN-9")
50141        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("blast")
50142        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("cash")
50143        PORT_MODIFY("IN-16")
50144        // 0x0001 - "dil  1" // standard input (motherboard)
50145        // 0x0002 - "dil  2" // standard input (motherboard)
50146        // 0x0004 - "dil  3" // standard input (motherboard)
50147        // 0x0008 - "dil  4" // standard input (motherboard)
50148        // 0x0010 - "dil  5" // standard input (motherboard)
50149        // 0x0100 - "top up" // known extended input, usually 'top up'
50150        PORT_MODIFY("IN-17")
50151        // 0x0001 - "dil  6" // standard input (motherboard)
50152        // 0x0002 - "dil  7" // standard input (motherboard)
50153        // 0x0004 - "dil  8" // standard input (motherboard)
50154        // 0x0008 - "dil  9" // standard input (motherboard)
50155        // 0x0010 - "dil 10" // standard input (motherboard)
50156        PORT_MODIFY("IN-18")
50157        // 0x0001 - "dil 11" // standard input (motherboard)
50158        // 0x0002 - "dil 12" // standard input (motherboard)
50159        // 0x0004 - "dil 13" // standard input (motherboard)
50160        // 0x0008 - "dil 14" // standard input (motherboard)
50161        // 0x0010 - "dil 15" // standard input (motherboard)
50162        PORT_MODIFY("IN-19")
50163        // 0x0001 - "dil 16" // standard input (motherboard)
50164        PORT_MODIFY("IN-20")
50165        // 0x0001 - "testsw" // standard input (motherboard)
50166        // 0x0002 - "dor lk" // standard input (expected here)
50167        // 0x0004 - "tp dor" // standard input (expected here)
50168        // 0x0008 - "csh bx" // standard input (expected here)
50169        // 0x0010 - "deflt" // standard input (expected here)
50123      PORT_INCLUDE( sc4_base )
50124      PORT_MODIFY("IN-1")
50125      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
50126      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold a")
50127      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold b")
50128      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold c")
50129      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("stop")
50130      PORT_MODIFY("IN-2")
50131      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("xchnge")
50132      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50133      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
50134      PORT_MODIFY("IN-8")
50135      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
50136      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shot")
50137      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("ftr")
50138      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spin")
50139      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("ko")
50140      PORT_MODIFY("IN-9")
50141      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("blast")
50142      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("cash")
50143      PORT_MODIFY("IN-16")
50144      // 0x0001 - "dil  1" // standard input (motherboard)
50145      // 0x0002 - "dil  2" // standard input (motherboard)
50146      // 0x0004 - "dil  3" // standard input (motherboard)
50147      // 0x0008 - "dil  4" // standard input (motherboard)
50148      // 0x0010 - "dil  5" // standard input (motherboard)
50149      // 0x0100 - "top up" // known extended input, usually 'top up'
50150      PORT_MODIFY("IN-17")
50151      // 0x0001 - "dil  6" // standard input (motherboard)
50152      // 0x0002 - "dil  7" // standard input (motherboard)
50153      // 0x0004 - "dil  8" // standard input (motherboard)
50154      // 0x0008 - "dil  9" // standard input (motherboard)
50155      // 0x0010 - "dil 10" // standard input (motherboard)
50156      PORT_MODIFY("IN-18")
50157      // 0x0001 - "dil 11" // standard input (motherboard)
50158      // 0x0002 - "dil 12" // standard input (motherboard)
50159      // 0x0004 - "dil 13" // standard input (motherboard)
50160      // 0x0008 - "dil 14" // standard input (motherboard)
50161      // 0x0010 - "dil 15" // standard input (motherboard)
50162      PORT_MODIFY("IN-19")
50163      // 0x0001 - "dil 16" // standard input (motherboard)
50164      PORT_MODIFY("IN-20")
50165      // 0x0001 - "testsw" // standard input (motherboard)
50166      // 0x0002 - "dor lk" // standard input (expected here)
50167      // 0x0004 - "tp dor" // standard input (expected here)
50168      // 0x0008 - "csh bx" // standard input (expected here)
50169      // 0x0010 - "deflt" // standard input (expected here)
5017050170INPUT_PORTS_END
5017150171
5017250172// PR2036 HYDE & STREAK         HYDE SOUNDS          HYDE & STREAK
r31373r31374
5017650176GAMEL( 200?, sc4hydec    ,sc4hyde,   sc4, sc4hyde, sc4_state, sc4, ROT0, "Mazooma","Hyde & Streak (Mazooma) (Scorpion 4) (set 4)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
5017750177
5017850178INPUT_PORTS_START( sc4rtclb ) // this structure is generated
50179        PORT_INCLUDE( sc4_base )
50180        PORT_MODIFY("IN-1")
50181        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
50182        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
50183        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
50184        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
50185        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
50186        PORT_MODIFY("IN-2")
50187        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
50188        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
50189        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50190        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
50191        PORT_MODIFY("IN-3")
50192        // 0x0004 - "stk 4" // standard input (expected here)
50193        // 0x0008 - "stk 3" // standard input (expected here)
50194        // 0x0010 - "stk 2" // standard input (expected here)
50195        PORT_MODIFY("IN-4")
50196        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
50197        PORT_MODIFY("IN-5")
50198        // 0x0001 - "priz4" // standard input (expected here)
50199        // 0x0002 - "priz3" // standard input (expected here)
50200        // 0x0004 - "priz2" // standard input (expected here)
50201        // 0x0008 - "priz1" // standard input (expected here)
50202        PORT_MODIFY("IN-8")
50203        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("knk lo")
50204        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("fet lo")
50205        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nud lo")
50206        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nud hi")
50207        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("fet hi")
50208        PORT_MODIFY("IN-9")
50209        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("knk hi")
50210        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("tk knk")
50211        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("tk fet")
50212        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("tk nud")
50213        PORT_MODIFY("IN-16")
50214        // 0x0001 - "dil 1" // standard input (motherboard)
50215        // 0x0002 - "dil 2" // standard input (motherboard)
50216        // 0x0004 - "dil 3" // standard input (motherboard)
50217        // 0x0008 - "dil 4" // standard input (motherboard)
50218        // 0x0010 - "dil 5" // standard input (motherboard)
50219        // 0x0100 - "top up" // known extended input, usually 'top up'
50220        PORT_MODIFY("IN-17")
50221        // 0x0001 - "dil 6" // standard input (motherboard)
50222        // 0x0002 - "dil 7" // standard input (motherboard)
50223        // 0x0004 - "dil 8" // standard input (motherboard)
50224        // 0x0008 - "dil 9" // standard input (motherboard)
50225        // 0x0010 - "dil10" // standard input (motherboard)
50226        PORT_MODIFY("IN-18")
50227        // 0x0001 - "dil11" // standard input (motherboard)
50228        // 0x0002 - "dil12" // standard input (motherboard)
50229        // 0x0004 - "dil13" // standard input (motherboard)
50230        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
50231        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
50232        PORT_MODIFY("IN-19")
50233        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
50234        PORT_MODIFY("IN-20")
50235        // 0x0001 - "grnbut" // standard input (motherboard)
50236        // 0x0002 - "dorlok" // standard input (expected here)
50237        // 0x0004 - "topdor" // standard input (expected here)
50238        // 0x0008 - "botdor" // standard input (expected here)
50239        // 0x0010 - "hopdmp" // standard input (expected here)
50179      PORT_INCLUDE( sc4_base )
50180      PORT_MODIFY("IN-1")
50181      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
50182      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
50183      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
50184      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
50185      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
50186      PORT_MODIFY("IN-2")
50187      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
50188      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchng")
50189      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50190      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
50191      PORT_MODIFY("IN-3")
50192      // 0x0004 - "stk 4" // standard input (expected here)
50193      // 0x0008 - "stk 3" // standard input (expected here)
50194      // 0x0010 - "stk 2" // standard input (expected here)
50195      PORT_MODIFY("IN-4")
50196      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
50197      PORT_MODIFY("IN-5")
50198      // 0x0001 - "priz4" // standard input (expected here)
50199      // 0x0002 - "priz3" // standard input (expected here)
50200      // 0x0004 - "priz2" // standard input (expected here)
50201      // 0x0008 - "priz1" // standard input (expected here)
50202      PORT_MODIFY("IN-8")
50203      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("knk lo")
50204      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("fet lo")
50205      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("nud lo")
50206      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("nud hi")
50207      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("fet hi")
50208      PORT_MODIFY("IN-9")
50209      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("knk hi")
50210      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("tk knk")
50211      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("tk fet")
50212      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_3 ) PORT_NAME("tk nud")
50213      PORT_MODIFY("IN-16")
50214      // 0x0001 - "dil 1" // standard input (motherboard)
50215      // 0x0002 - "dil 2" // standard input (motherboard)
50216      // 0x0004 - "dil 3" // standard input (motherboard)
50217      // 0x0008 - "dil 4" // standard input (motherboard)
50218      // 0x0010 - "dil 5" // standard input (motherboard)
50219      // 0x0100 - "top up" // known extended input, usually 'top up'
50220      PORT_MODIFY("IN-17")
50221      // 0x0001 - "dil 6" // standard input (motherboard)
50222      // 0x0002 - "dil 7" // standard input (motherboard)
50223      // 0x0004 - "dil 8" // standard input (motherboard)
50224      // 0x0008 - "dil 9" // standard input (motherboard)
50225      // 0x0010 - "dil10" // standard input (motherboard)
50226      PORT_MODIFY("IN-18")
50227      // 0x0001 - "dil11" // standard input (motherboard)
50228      // 0x0002 - "dil12" // standard input (motherboard)
50229      // 0x0004 - "dil13" // standard input (motherboard)
50230      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
50231      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
50232      PORT_MODIFY("IN-19")
50233      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
50234      PORT_MODIFY("IN-20")
50235      // 0x0001 - "grnbut" // standard input (motherboard)
50236      // 0x0002 - "dorlok" // standard input (expected here)
50237      // 0x0004 - "topdor" // standard input (expected here)
50238      // 0x0008 - "botdor" // standard input (expected here)
50239      // 0x0010 - "hopdmp" // standard input (expected here)
5024050240INPUT_PORTS_END
5024150241
5024250242// PR2051 CLUB ROLLING THUNDER         CLRT SOUNDS         ROLLING THUNDER
r31373r31374
5025650256
5025750257// only sc4jive has this structure intact
5025850258INPUT_PORTS_START( sc4jive ) // this structure is generated
50259        PORT_INCLUDE( sc4_base )
50260        PORT_MODIFY("IN-1")
50261        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
50262        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
50263        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
50264        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
50265        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
50266        PORT_MODIFY("IN-2")
50267        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
50268        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50269        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
50270        PORT_MODIFY("IN-8")
50271        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tke cs")
50272        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tke sh")
50273        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("take_w")
50274        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spin")
50275        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("collec")
50276        PORT_MODIFY("IN-16")
50277        // 0x0001 - "dil  1" // standard input (motherboard)
50278        // 0x0002 - "dil  2" // standard input (motherboard)
50279        // 0x0004 - "dil  3" // standard input (motherboard)
50280        // 0x0008 - "dil  4" // standard input (motherboard)
50281        // 0x0010 - "dil  5" // standard input (motherboard)
50282        // 0x0100 - "top up" // known extended input, usually 'top up'
50283        PORT_MODIFY("IN-17")
50284        // 0x0001 - "dil  6" // standard input (motherboard)
50285        // 0x0002 - "dil  7" // standard input (motherboard)
50286        // 0x0004 - "dil  8" // standard input (motherboard)
50287        // 0x0008 - "dil  9" // standard input (motherboard)
50288        // 0x0010 - "dil 10" // standard input (motherboard)
50289        PORT_MODIFY("IN-18")
50290        // 0x0001 - "dil 11" // standard input (motherboard)
50291        // 0x0002 - "dil 12" // standard input (motherboard)
50292        // 0x0004 - "dil 13" // standard input (motherboard)
50293        // 0x0008 - "dil 14" // standard input (motherboard)
50294        // 0x0010 - "dil 15" // standard input (motherboard)
50295        PORT_MODIFY("IN-19")
50296        // 0x0001 - "dil 16" // standard input (motherboard)
50297        PORT_MODIFY("IN-20")
50298        // 0x0001 - "testsw" // standard input (motherboard)
50299        // 0x0002 - "dor lk" // standard input (expected here)
50300        // 0x0004 - "tp dor" // standard input (expected here)
50301        // 0x0008 - "csh bx" // standard input (expected here)
50302        // 0x0010 - "deflt" // standard input (expected here)
50259      PORT_INCLUDE( sc4_base )
50260      PORT_MODIFY("IN-1")
50261      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
50262      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold 1")
50263      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 2")
50264      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 3")
50265      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("collec")
50266      PORT_MODIFY("IN-2")
50267      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exchge")
50268      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50269      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
50270      PORT_MODIFY("IN-8")
50271      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tke cs")
50272      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tke sh")
50273      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("take_w")
50274      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("spin")
50275      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("collec")
50276      PORT_MODIFY("IN-16")
50277      // 0x0001 - "dil  1" // standard input (motherboard)
50278      // 0x0002 - "dil  2" // standard input (motherboard)
50279      // 0x0004 - "dil  3" // standard input (motherboard)
50280      // 0x0008 - "dil  4" // standard input (motherboard)
50281      // 0x0010 - "dil  5" // standard input (motherboard)
50282      // 0x0100 - "top up" // known extended input, usually 'top up'
50283      PORT_MODIFY("IN-17")
50284      // 0x0001 - "dil  6" // standard input (motherboard)
50285      // 0x0002 - "dil  7" // standard input (motherboard)
50286      // 0x0004 - "dil  8" // standard input (motherboard)
50287      // 0x0008 - "dil  9" // standard input (motherboard)
50288      // 0x0010 - "dil 10" // standard input (motherboard)
50289      PORT_MODIFY("IN-18")
50290      // 0x0001 - "dil 11" // standard input (motherboard)
50291      // 0x0002 - "dil 12" // standard input (motherboard)
50292      // 0x0004 - "dil 13" // standard input (motherboard)
50293      // 0x0008 - "dil 14" // standard input (motherboard)
50294      // 0x0010 - "dil 15" // standard input (motherboard)
50295      PORT_MODIFY("IN-19")
50296      // 0x0001 - "dil 16" // standard input (motherboard)
50297      PORT_MODIFY("IN-20")
50298      // 0x0001 - "testsw" // standard input (motherboard)
50299      // 0x0002 - "dor lk" // standard input (expected here)
50300      // 0x0004 - "tp dor" // standard input (expected here)
50301      // 0x0008 - "csh bx" // standard input (expected here)
50302      // 0x0010 - "deflt" // standard input (expected here)
5030350303INPUT_PORTS_END
5030450304
5030550305// PR2096 JIVE MONEY         JIVE SOUNDS         JIVE MONEY
r31373r31374
5031150311GAMEL( 200?, sc4jived    ,sc4jive,   sc4, sc4jive, sc4_state, sc4, ROT0, "Mazooma","Jive Money (PR2160) (Mazooma) (Scorpion 4) (set 4)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
5031250312
5031350313INPUT_PORTS_START( sc4mclb ) // this structure is generated
50314        PORT_INCLUDE( sc4_base )
50315        PORT_MODIFY("IN-1")
50316        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
50317        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
50318        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
50319        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
50320        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
50321        PORT_MODIFY("IN-2")
50322        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
50323        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("xfer")
50324        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
50325        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
50326        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
50327        PORT_MODIFY("IN-3")
50328        // 0x0004 - "stk 4" // standard input (expected here)
50329        // 0x0008 - "stk 3" // standard input (expected here)
50330        // 0x0010 - "stk 2" // standard input (expected here)
50331        PORT_MODIFY("IN-4")
50332        // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
50333        PORT_MODIFY("IN-5")
50334        // 0x0001 - "priz4" // standard input (expected here)
50335        // 0x0002 - "priz3" // standard input (expected here)
50336        // 0x0004 - "priz2" // standard input (expected here)
50337        // 0x0008 - "priz1" // standard input (expected here)
50338        PORT_MODIFY("IN-8")
50339        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
50340        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk mtr")
50341        PORT_MODIFY("IN-16")
50342        // 0x0001 - "dil 1" // standard input (motherboard)
50343        // 0x0002 - "dil 2" // standard input (motherboard)
50344        // 0x0004 - "dil 3" // standard input (motherboard)
50345        // 0x0008 - "dil 4" // standard input (motherboard)
50346        // 0x0010 - "dil 5" // standard input (motherboard)
50347        // 0x0100 - "top up" // known extended input, usually 'top up'
50348        PORT_MODIFY("IN-17")
50349        // 0x0001 - "dil 6" // standard input (motherboard)
50350        // 0x0002 - "dil 7" // standard input (motherboard)
50351        // 0x0004 - "dil 8" // standard input (motherboard)
50352        // 0x0008 - "dil 9" // standard input (motherboard)
50353        // 0x0010 - "dil10" // standard input (motherboard)
50354        PORT_MODIFY("IN-18")
50355        // 0x0001 - "dil11" // standard input (motherboard)
50356        // 0x0002 - "dil12" // standard input (motherboard)
50357        // 0x0004 - "dil13" // standard input (motherboard)
50358        // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
50359        // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
50360        PORT_MODIFY("IN-19")
50361        // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
50362        PORT_MODIFY("IN-20")
50363        // 0x0001 - "grnbut" // standard input (motherboard)
50364        // 0x0002 - "dorlok" // standard input (expected here)
50365        // 0x0004 - "topdor" // standard input (expected here)
50366        // 0x0008 - "botdor" // standard input (expected here)
50367        // 0x0010 - "hopdmp" // standard input (expected here)
50314      PORT_INCLUDE( sc4_base )
50315      PORT_MODIFY("IN-1")
50316      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cn/col")
50317      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("hold1")
50318      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold2")
50319      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold3")
50320      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold4")
50321      PORT_MODIFY("IN-2")
50322      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("stop")
50323      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("xfer")
50324      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("exchng")
50325      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
50326      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4 ) PORT_NAME("start")
50327      PORT_MODIFY("IN-3")
50328      // 0x0004 - "stk 4" // standard input (expected here)
50329      // 0x0008 - "stk 3" // standard input (expected here)
50330      // 0x0010 - "stk 2" // standard input (expected here)
50331      PORT_MODIFY("IN-4")
50332      // 0x0100 - "hoplow" // known extended input, usually 'hopper low'
50333      PORT_MODIFY("IN-5")
50334      // 0x0001 - "priz4" // standard input (expected here)
50335      // 0x0002 - "priz3" // standard input (expected here)
50336      // 0x0004 - "priz2" // standard input (expected here)
50337      // 0x0008 - "priz1" // standard input (expected here)
50338      PORT_MODIFY("IN-8")
50339      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("tk nud")
50340      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("tk mtr")
50341      PORT_MODIFY("IN-16")
50342      // 0x0001 - "dil 1" // standard input (motherboard)
50343      // 0x0002 - "dil 2" // standard input (motherboard)
50344      // 0x0004 - "dil 3" // standard input (motherboard)
50345      // 0x0008 - "dil 4" // standard input (motherboard)
50346      // 0x0010 - "dil 5" // standard input (motherboard)
50347      // 0x0100 - "top up" // known extended input, usually 'top up'
50348      PORT_MODIFY("IN-17")
50349      // 0x0001 - "dil 6" // standard input (motherboard)
50350      // 0x0002 - "dil 7" // standard input (motherboard)
50351      // 0x0004 - "dil 8" // standard input (motherboard)
50352      // 0x0008 - "dil 9" // standard input (motherboard)
50353      // 0x0010 - "dil10" // standard input (motherboard)
50354      PORT_MODIFY("IN-18")
50355      // 0x0001 - "dil11" // standard input (motherboard)
50356      // 0x0002 - "dil12" // standard input (motherboard)
50357      // 0x0004 - "dil13" // standard input (motherboard)
50358      // 0x0008 - "dil14 OR perc1" // standard input (motherboard)
50359      // 0x0010 - "dil15 OR perc2" // standard input (motherboard)
50360      PORT_MODIFY("IN-19")
50361      // 0x0001 - "dil16 OR perc3" // standard input (motherboard)
50362      PORT_MODIFY("IN-20")
50363      // 0x0001 - "grnbut" // standard input (motherboard)
50364      // 0x0002 - "dorlok" // standard input (expected here)
50365      // 0x0004 - "topdor" // standard input (expected here)
50366      // 0x0008 - "botdor" // standard input (expected here)
50367      // 0x0010 - "hopdmp" // standard input (expected here)
5036850368INPUT_PORTS_END
5036950369
5037050370// no sound roms
r31373r31374
5037850378
5037950379
5038050380INPUT_PORTS_START( sc4monot ) // this structure is generated
50381        PORT_INCLUDE( sc4_base )
50382        PORT_MODIFY("IN-1")
50383        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
50384        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
50385        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
50386        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
50387        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
50388        PORT_MODIFY("IN-2")
50389        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("streak")
50390        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50391        PORT_MODIFY("IN-16")
50392        // 0x0001 - "dil sw" // standard input (motherboard)
50393        // 0x0002 - "dil sw" // standard input (motherboard)
50394        // 0x0004 - "dil sw" // standard input (motherboard)
50395        // 0x0008 - "dil sw" // standard input (motherboard)
50396        // 0x0010 - "dil sw" // standard input (motherboard)
50397        // 0x0100 - "top up" // known extended input, usually 'top up'
50398        PORT_MODIFY("IN-17")
50399        // 0x0001 - "dil sw" // standard input (motherboard)
50400        // 0x0002 - "dil sw" // standard input (motherboard)
50401        // 0x0004 - "dil sw" // standard input (motherboard)
50402        // 0x0008 - "dil sw" // standard input (motherboard)
50403        // 0x0010 - "dil sw" // standard input (motherboard)
50404        PORT_MODIFY("IN-18")
50405        // 0x0001 - "dil sw" // standard input (motherboard)
50406        // 0x0002 - "dil sw" // standard input (motherboard)
50407        // 0x0004 - "dil sw" // standard input (motherboard)
50408        // 0x0008 - "dil sw" // standard input (motherboard)
50409        // 0x0010 - "dil sw" // standard input (motherboard)
50410        PORT_MODIFY("IN-19")
50411        // 0x0001 - "dil sw" // standard input (motherboard)
50412        PORT_MODIFY("IN-20")
50413        // 0x0001 - "green" // standard input (motherboard)
50414        // 0x0002 - "dor lk" // standard input (expected here)
50415        // 0x0004 - "tp dor" // standard input (expected here)
50416        // 0x0008 - "csh bx" // standard input (expected here)
50417        // 0x0010 - "deflt" // standard input (expected here)
50381      PORT_INCLUDE( sc4_base )
50382      PORT_MODIFY("IN-1")
50383      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
50384      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("transf")
50385      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
50386      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
50387      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
50388      PORT_MODIFY("IN-2")
50389      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("streak")
50390      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50391      PORT_MODIFY("IN-16")
50392      // 0x0001 - "dil sw" // standard input (motherboard)
50393      // 0x0002 - "dil sw" // standard input (motherboard)
50394      // 0x0004 - "dil sw" // standard input (motherboard)
50395      // 0x0008 - "dil sw" // standard input (motherboard)
50396      // 0x0010 - "dil sw" // standard input (motherboard)
50397      // 0x0100 - "top up" // known extended input, usually 'top up'
50398      PORT_MODIFY("IN-17")
50399      // 0x0001 - "dil sw" // standard input (motherboard)
50400      // 0x0002 - "dil sw" // standard input (motherboard)
50401      // 0x0004 - "dil sw" // standard input (motherboard)
50402      // 0x0008 - "dil sw" // standard input (motherboard)
50403      // 0x0010 - "dil sw" // standard input (motherboard)
50404      PORT_MODIFY("IN-18")
50405      // 0x0001 - "dil sw" // standard input (motherboard)
50406      // 0x0002 - "dil sw" // standard input (motherboard)
50407      // 0x0004 - "dil sw" // standard input (motherboard)
50408      // 0x0008 - "dil sw" // standard input (motherboard)
50409      // 0x0010 - "dil sw" // standard input (motherboard)
50410      PORT_MODIFY("IN-19")
50411      // 0x0001 - "dil sw" // standard input (motherboard)
50412      PORT_MODIFY("IN-20")
50413      // 0x0001 - "green" // standard input (motherboard)
50414      // 0x0002 - "dor lk" // standard input (expected here)
50415      // 0x0004 - "tp dor" // standard input (expected here)
50416      // 0x0008 - "csh bx" // standard input (expected here)
50417      // 0x0010 - "deflt" // standard input (expected here)
5041850418INPUT_PORTS_END
5041950419
5042050420GAMEL( 200?, sc4monot    ,0,         sc4, sc4monot, sc4_state, sc4, ROT0, "Mazooma","Monopoly TTT (PR2133) (Mazooma) (Scorpion 4) (set 1)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 ) // PR2133MONOPOLY TTT         MONOPOLY TTT  MAZ MONL SOUNDS         MONOPOLY
r31373r31374
5042350423GAMEL( 200?, sc4monotc   ,sc4monot,  sc4, sc4monot, sc4_state, sc4, ROT0, "Mazooma","Monopoly TTT (PR2133) (Mazooma) (Scorpion 4) (set 4)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 ) // PR2133MONOPOLY TTT         MONOPOLY TTT  ARCADE  MONL SOUNDS         MONOPOLY
5042450424
5042550425INPUT_PORTS_START( sc4r2r ) // this structure is generated
50426        PORT_INCLUDE( sc4_base )
50427        PORT_MODIFY("IN-1")
50428        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
50429        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("take f")
50430        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
50431        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
50432        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
50433        PORT_MODIFY("IN-2")
50434        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("a ndge")
50435        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("swop t")
50436        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50437        PORT_MODIFY("IN-7")
50438        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_0 ) PORT_NAME("tk pik")
50439        PORT_MODIFY("IN-8")
50440        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("rht lo")
50441        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("mid lo")
50442        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lef lo")
50443        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lef hi")
50444        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("mid hi")
50445        PORT_MODIFY("IN-9")
50446        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("rht hi")
50447        PORT_MODIFY("IN-16")
50448        // 0x0001 - "dil  1" // standard input (motherboard)
50449        // 0x0002 - "dil  2" // standard input (motherboard)
50450        // 0x0004 - "dil  3" // standard input (motherboard)
50451        // 0x0008 - "dil  4" // standard input (motherboard)
50452        // 0x0010 - "dil  5" // standard input (motherboard)
50453        // 0x0100 - "top up" // known extended input, usually 'top up'
50454        PORT_MODIFY("IN-17")
50455        // 0x0001 - "dil  6" // standard input (motherboard)
50456        // 0x0002 - "dil  7" // standard input (motherboard)
50457        // 0x0004 - "dil  8" // standard input (motherboard)
50458        // 0x0008 - "dil  9" // standard input (motherboard)
50459        // 0x0010 - "dil 10" // standard input (motherboard)
50460        PORT_MODIFY("IN-18")
50461        // 0x0001 - "dil 11" // standard input (motherboard)
50462        // 0x0002 - "dil 12" // standard input (motherboard)
50463        // 0x0004 - "dil 13" // standard input (motherboard)
50464        // 0x0008 - "dil 14" // standard input (motherboard)
50465        // 0x0010 - "dil 15" // standard input (motherboard)
50466        PORT_MODIFY("IN-19")
50467        // 0x0001 - "dil 16" // standard input (motherboard)
50468        PORT_MODIFY("IN-20")
50469        // 0x0001 - "testsw" // standard input (motherboard)
50470        // 0x0002 - "dor lk" // standard input (expected here)
50471        // 0x0004 - "tp dor" // standard input (expected here)
50472        // 0x0008 - "csh bx" // standard input (expected here)
50473        // 0x0010 - "deflt" // standard input (expected here)
50426      PORT_INCLUDE( sc4_base )
50427      PORT_MODIFY("IN-1")
50428      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
50429      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("take f")
50430      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
50431      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
50432      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
50433      PORT_MODIFY("IN-2")
50434      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("a ndge")
50435      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("swop t")
50436      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50437      PORT_MODIFY("IN-7")
50438      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_7_0 ) PORT_NAME("tk pik")
50439      PORT_MODIFY("IN-8")
50440      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("rht lo")
50441      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("mid lo")
50442      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("lef lo")
50443      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("lef hi")
50444      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("mid hi")
50445      PORT_MODIFY("IN-9")
50446      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("rht hi")
50447      PORT_MODIFY("IN-16")
50448      // 0x0001 - "dil  1" // standard input (motherboard)
50449      // 0x0002 - "dil  2" // standard input (motherboard)
50450      // 0x0004 - "dil  3" // standard input (motherboard)
50451      // 0x0008 - "dil  4" // standard input (motherboard)
50452      // 0x0010 - "dil  5" // standard input (motherboard)
50453      // 0x0100 - "top up" // known extended input, usually 'top up'
50454      PORT_MODIFY("IN-17")
50455      // 0x0001 - "dil  6" // standard input (motherboard)
50456      // 0x0002 - "dil  7" // standard input (motherboard)
50457      // 0x0004 - "dil  8" // standard input (motherboard)
50458      // 0x0008 - "dil  9" // standard input (motherboard)
50459      // 0x0010 - "dil 10" // standard input (motherboard)
50460      PORT_MODIFY("IN-18")
50461      // 0x0001 - "dil 11" // standard input (motherboard)
50462      // 0x0002 - "dil 12" // standard input (motherboard)
50463      // 0x0004 - "dil 13" // standard input (motherboard)
50464      // 0x0008 - "dil 14" // standard input (motherboard)
50465      // 0x0010 - "dil 15" // standard input (motherboard)
50466      PORT_MODIFY("IN-19")
50467      // 0x0001 - "dil 16" // standard input (motherboard)
50468      PORT_MODIFY("IN-20")
50469      // 0x0001 - "testsw" // standard input (motherboard)
50470      // 0x0002 - "dor lk" // standard input (expected here)
50471      // 0x0004 - "tp dor" // standard input (expected here)
50472      // 0x0008 - "csh bx" // standard input (expected here)
50473      // 0x0010 - "deflt" // standard input (expected here)
5047450474INPUT_PORTS_END
5047550475
5047650476// PR2037 REEL TO REEL         RTOR SOUNDS           REEL 2 REEL
r31373r31374
5048050480GAMEL( 200?, sc4r2rc     ,sc4r2r,    sc4, sc4r2r, sc4_state, sc4, ROT0, "Mazooma","Reel To Reel (Mazooma) (Scorpion 4) (set 4)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
5048150481
5048250482INPUT_PORTS_START( sc4revo ) // this structure is generated
50483        PORT_INCLUDE( sc4_base )
50484        PORT_MODIFY("IN-1")
50485        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
50486        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
50487        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
50488        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
50489        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
50490        PORT_MODIFY("IN-2")
50491        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("colect")
50492        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchge")
50493        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50494        PORT_MODIFY("IN-4")
50495        // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
50496        PORT_MODIFY("IN-8")
50497        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nge hi")
50498        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("wsp hi")
50499        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("csh hi")
50500        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("csh lo")
50501        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("wsp lo")
50502        PORT_MODIFY("IN-9")
50503        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nge lo")
50504        PORT_MODIFY("IN-16")
50505        // 0x0001 - "dil  1" // standard input (motherboard)
50506        // 0x0002 - "dil  2" // standard input (motherboard)
50507        // 0x0004 - "dil  3" // standard input (motherboard)
50508        // 0x0008 - "dil  4" // standard input (motherboard)
50509        // 0x0010 - "dil  5" // standard input (motherboard)
50510        PORT_MODIFY("IN-17")
50511        // 0x0001 - "dil  6" // standard input (motherboard)
50512        // 0x0002 - "dil  7" // standard input (motherboard)
50513        // 0x0004 - "dil  8" // standard input (motherboard)
50514        // 0x0008 - "dil  9" // standard input (motherboard)
50515        // 0x0010 - "dil 10" // standard input (motherboard)
50516        PORT_MODIFY("IN-18")
50517        // 0x0001 - "dil 11" // standard input (motherboard)
50518        // 0x0002 - "dil 12" // standard input (motherboard)
50519        // 0x0004 - "dil 13" // standard input (motherboard)
50520        // 0x0008 - "dil 14" // standard input (motherboard)
50521        // 0x0010 - "dil 15" // standard input (motherboard)
50522        PORT_MODIFY("IN-19")
50523        // 0x0001 - "dil 16" // standard input (motherboard)
50524        PORT_MODIFY("IN-20")
50525        // 0x0001 - "testsw" // standard input (motherboard)
50526        // 0x0002 - "dor lk" // standard input (expected here)
50527        // 0x0004 - "tp dor" // standard input (expected here)
50528        // 0x0008 - "csh bx" // standard input (expected here)
50529        // 0x0010 - "deflt" // standard input (expected here)
50483      PORT_INCLUDE( sc4_base )
50484      PORT_MODIFY("IN-1")
50485      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancel")
50486      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
50487      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold 1")
50488      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold 2")
50489      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold 3")
50490      PORT_MODIFY("IN-2")
50491      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("colect")
50492      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exchge")
50493      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50494      PORT_MODIFY("IN-4")
50495      // 0x0010 - "top up" // known extended(?) input, sometimes 'top up'
50496      PORT_MODIFY("IN-8")
50497      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("nge hi")
50498      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("wsp hi")
50499      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("csh hi")
50500      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("csh lo")
50501      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("wsp lo")
50502      PORT_MODIFY("IN-9")
50503      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("nge lo")
50504      PORT_MODIFY("IN-16")
50505      // 0x0001 - "dil  1" // standard input (motherboard)
50506      // 0x0002 - "dil  2" // standard input (motherboard)
50507      // 0x0004 - "dil  3" // standard input (motherboard)
50508      // 0x0008 - "dil  4" // standard input (motherboard)
50509      // 0x0010 - "dil  5" // standard input (motherboard)
50510      PORT_MODIFY("IN-17")
50511      // 0x0001 - "dil  6" // standard input (motherboard)
50512      // 0x0002 - "dil  7" // standard input (motherboard)
50513      // 0x0004 - "dil  8" // standard input (motherboard)
50514      // 0x0008 - "dil  9" // standard input (motherboard)
50515      // 0x0010 - "dil 10" // standard input (motherboard)
50516      PORT_MODIFY("IN-18")
50517      // 0x0001 - "dil 11" // standard input (motherboard)
50518      // 0x0002 - "dil 12" // standard input (motherboard)
50519      // 0x0004 - "dil 13" // standard input (motherboard)
50520      // 0x0008 - "dil 14" // standard input (motherboard)
50521      // 0x0010 - "dil 15" // standard input (motherboard)
50522      PORT_MODIFY("IN-19")
50523      // 0x0001 - "dil 16" // standard input (motherboard)
50524      PORT_MODIFY("IN-20")
50525      // 0x0001 - "testsw" // standard input (motherboard)
50526      // 0x0002 - "dor lk" // standard input (expected here)
50527      // 0x0004 - "tp dor" // standard input (expected here)
50528      // 0x0008 - "csh bx" // standard input (expected here)
50529      // 0x0010 - "deflt" // standard input (expected here)
5053050530INPUT_PORTS_END
5053150531
5053250532// PR2020 REVOLVER         REV SOUNDS               REVOLVER
r31373r31374
5053850538GAMEL( 200?, sc4revoe    ,sc4revo,   sc4, sc4revo, sc4_state, sc4, ROT0, "Mazooma","Revolver (Mazooma) (Scorpion 4) (set 6)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
5053950539
5054050540INPUT_PORTS_START( sc4slih ) // this structure is generated
50541        PORT_INCLUDE( sc4_base )
50542        PORT_MODIFY("IN-1")
50543        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
50544        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
50545        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
50546        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
50547        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
50548        PORT_MODIFY("IN-2")
50549        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("xfer")
50550        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
50551        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50552        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
50553        PORT_MODIFY("IN-8")
50554        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
50555        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shot")
50556        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkcsh")
50557        PORT_MODIFY("IN-16")
50558        // 0x0001 - "dil 1" // standard input (motherboard)
50559        // 0x0002 - "dil 2" // standard input (motherboard)
50560        // 0x0004 - "dil 3" // standard input (motherboard)
50561        // 0x0008 - "dil 4" // standard input (motherboard)
50562        // 0x0010 - "dil 5" // standard input (motherboard)
50563        // 0x0100 - "topup" // known extended input, usually 'top up'
50564        PORT_MODIFY("IN-17")
50565        // 0x0001 - "dil 6" // standard input (motherboard)
50566        // 0x0002 - "dil 7" // standard input (motherboard)
50567        // 0x0004 - "dil 8" // standard input (motherboard)
50568        // 0x0008 - "dil 9" // standard input (motherboard)
50569        // 0x0010 - "dil10" // standard input (motherboard)
50570        PORT_MODIFY("IN-18")
50571        // 0x0001 - "dil11" // standard input (motherboard)
50572        // 0x0002 - "dil12" // standard input (motherboard)
50573        // 0x0004 - "dil13" // standard input (motherboard)
50574        // 0x0008 - "dil14" // standard input (motherboard)
50575        // 0x0010 - "dil15" // standard input (motherboard)
50576        PORT_MODIFY("IN-19")
50577        // 0x0001 - "dil16" // standard input (motherboard)
50578        PORT_MODIFY("IN-20")
50579        // 0x0001 - "test" // standard input (motherboard)
50580        // 0x0002 - "dor lk" // standard input (expected here)
50581        // 0x0004 - "tp dor" // standard input (expected here)
50582        // 0x0008 - "csh bx" // standard input (expected here)
50583        // 0x0010 - "deflt" // standard input (expected here)
50541      PORT_INCLUDE( sc4_base )
50542      PORT_MODIFY("IN-1")
50543      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("canc")
50544      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("colct")
50545      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
50546      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
50547      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
50548      PORT_MODIFY("IN-2")
50549      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("xfer")
50550      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_1 ) PORT_NAME("exch")
50551      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50552      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refill")
50553      PORT_MODIFY("IN-8")
50554      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("bonus")
50555      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("shot")
50556      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("tkcsh")
50557      PORT_MODIFY("IN-16")
50558      // 0x0001 - "dil 1" // standard input (motherboard)
50559      // 0x0002 - "dil 2" // standard input (motherboard)
50560      // 0x0004 - "dil 3" // standard input (motherboard)
50561      // 0x0008 - "dil 4" // standard input (motherboard)
50562      // 0x0010 - "dil 5" // standard input (motherboard)
50563      // 0x0100 - "topup" // known extended input, usually 'top up'
50564      PORT_MODIFY("IN-17")
50565      // 0x0001 - "dil 6" // standard input (motherboard)
50566      // 0x0002 - "dil 7" // standard input (motherboard)
50567      // 0x0004 - "dil 8" // standard input (motherboard)
50568      // 0x0008 - "dil 9" // standard input (motherboard)
50569      // 0x0010 - "dil10" // standard input (motherboard)
50570      PORT_MODIFY("IN-18")
50571      // 0x0001 - "dil11" // standard input (motherboard)
50572      // 0x0002 - "dil12" // standard input (motherboard)
50573      // 0x0004 - "dil13" // standard input (motherboard)
50574      // 0x0008 - "dil14" // standard input (motherboard)
50575      // 0x0010 - "dil15" // standard input (motherboard)
50576      PORT_MODIFY("IN-19")
50577      // 0x0001 - "dil16" // standard input (motherboard)
50578      PORT_MODIFY("IN-20")
50579      // 0x0001 - "test" // standard input (motherboard)
50580      // 0x0002 - "dor lk" // standard input (expected here)
50581      // 0x0004 - "tp dor" // standard input (expected here)
50582      // 0x0008 - "csh bx" // standard input (expected here)
50583      // 0x0010 - "deflt" // standard input (expected here)
5058450584INPUT_PORTS_END
5058550585
5058650586// half size sound roms
r31373r31374
5059350593GAMEL( 200?, sc4slihe    ,sc4slih,   sc4, sc4slih, sc4_state, sc4, ROT0, "Mazooma","Some Like It Hot (Mazooma) (Scorpion 4) (set 6)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_CLICKABLE_ARTWORK, layout_bfm_sc4 )
5059450594
5059550595INPUT_PORTS_START( sc4gcb ) // this structure is generated
50596        PORT_INCLUDE( sc4_base )
50597        PORT_MODIFY("IN-1")
50598        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
50599        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
50600        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
50601        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
50602        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
50603        PORT_MODIFY("IN-2")
50604        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
50605        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50606        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
50607        PORT_MODIFY("IN-8")
50608        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
50609        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
50610        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
50611        PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
50612        PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
50613        PORT_MODIFY("IN-9")
50614        PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
50615        PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
50616        PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
50617        PORT_MODIFY("IN-16")
50618        // 0x0001 - "dil 1" // standard input (motherboard)
50619        // 0x0002 - "dil 2" // standard input (motherboard)
50620        // 0x0004 - "dil 3" // standard input (motherboard)
50621        // 0x0008 - "dil 4" // standard input (motherboard)
50622        // 0x0010 - "dil 5" // standard input (motherboard)
50623        // 0x0100 - "topup" // known extended input, usually 'top up'
50624        PORT_MODIFY("IN-17")
50625        // 0x0001 - "dil 6" // standard input (motherboard)
50626        // 0x0002 - "dil 7" // standard input (motherboard)
50627        // 0x0004 - "dil 8" // standard input (motherboard)
50628        // 0x0008 - "dil 9" // standard input (motherboard)
50629        // 0x0010 - "dil10" // standard input (motherboard)
50630        PORT_MODIFY("IN-18")
50631        // 0x0001 - "dil11" // standard input (motherboard)
50632        // 0x0002 - "dil12" // standard input (motherboard)
50633        // 0x0004 - "dil13" // standard input (motherboard)
50634        // 0x0008 - "dil14" // standard input (motherboard)
50635        // 0x0010 - "dil15" // standard input (motherboard)
50636        PORT_MODIFY("IN-19")
50637        // 0x0001 - "dil16" // standard input (motherboard)
50638        PORT_MODIFY("IN-20")
50639        // 0x0001 - "test" // standard input (motherboard)
50640        // 0x0002 - "dorlk" // standard input (expected here)
50641        // 0x0004 - "tpdor" // standard input (expected here)
50642        // 0x0008 - "cshbx" // standard input (expected here)
50643        // 0x0010 - "deflt" // standard input (expected here)
50596      PORT_INCLUDE( sc4_base )
50597      PORT_MODIFY("IN-1")
50598      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_0 ) PORT_NAME("cancl")
50599      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_1 ) PORT_NAME("stake")
50600      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_2 ) PORT_NAME("hold1")
50601      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_3 ) PORT_NAME("hold2")
50602      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_1_4 ) PORT_NAME("hold3")
50603      PORT_MODIFY("IN-2")
50604      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_0 ) PORT_NAME("exch")
50605      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_2 ) PORT_NAME("start")
50606      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3 ) PORT_NAME("refil")
50607      PORT_MODIFY("IN-8")
50608      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_0 ) PORT_NAME("c lo")
50609      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_1 ) PORT_NAME("b lo")
50610      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_2 ) PORT_NAME("f lo")
50611      PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_3 ) PORT_NAME("step")
50612      PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_8_4 ) PORT_NAME("f hi")
50613      PORT_MODIFY("IN-9")
50614      PORT_BIT( 0x0001, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_0 ) PORT_NAME("b hi")
50615      PORT_BIT( 0x0002, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_1 ) PORT_NAME("c hi")
50616      PORT_BIT( 0x0004, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_9_2 ) PORT_NAME("take")
50617      PORT_MODIFY("IN-16")
50618      // 0x0001 - "dil 1" // standard input (motherboard)
50619      // 0x0002 - "dil 2" // standard input (motherboard)
50620      // 0x0004 - "dil 3" // standard input (motherboard)
50621      // 0x0008 - "dil 4" // standard input (motherboard)
50622      // 0x0010 - "dil 5" // standard input (motherboard)
50623      // 0x0100 - "topup" // known extended input, usually 'top up'
50624      PORT_MODIFY("IN-17")
50625      // 0x0001 - "dil 6" // standard input (motherboard)
50626      // 0x0002 - "dil 7" // standard input (motherboard)
50627      // 0x0004 - "dil 8" // standard input (motherboard)
50628      // 0x0008 - "dil 9" // standard input (motherboard)
50629      // 0x0010 - "dil10" // standard input (motherboard)
50630      PORT_MODIFY("IN-18")
50631      // 0x0001 - "dil11" // standard input (motherboard)
50632      // 0x0002 - "dil12" // standard input (motherboard)
50633      // 0x0004 - "dil13" // standard input (motherboard)
50634      // 0x0008 - "dil14" // standard input (motherboard)
50635      // 0x0010 - "dil15" // standard input (motherboard)
50636      PORT_MODIFY("IN-19")
50637      // 0x0001 - "dil16" // standard input (motherboard)
50638      PORT_MODIFY("IN-20")
50639      // 0x0001 - "test" // standard input (motherboard)
50640      // 0x0002 - "dorlk" // standard input (expected here)
50641      // 0x0004 - "tpdor" // standard input (expected here)
50642      // 0x0008 - "cshbx" // standard input (expected here)
50643      // 0x0010 - "deflt" // standard input (expected here)
5064450644INPUT_PORTS_END
5064550645
5064650646// no sound roms
trunk/src/mame/drivers/pong.c
r31373r31374
207207   PORT_START( "PADDLE1" ) /* fake input port for player 2 paddle */
208208   PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_SENSITIVITY(2) PORT_KEYDELTA(100) PORT_CENTERDELTA(0) PORT_PLAYER(2) NETLIST_ANALOG_PORT_CHANGED("maincpu", "pot1")
209209
210    PORT_START( "PADDLE2" ) /* fake input port for player 3 paddle */
211    PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_SENSITIVITY(2) PORT_KEYDELTA(100) PORT_CENTERDELTA(0) PORT_PLAYER(3) NETLIST_ANALOG_PORT_CHANGED("maincpu", "pot2")
210   PORT_START( "PADDLE2" ) /* fake input port for player 3 paddle */
211   PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_SENSITIVITY(2) PORT_KEYDELTA(100) PORT_CENTERDELTA(0) PORT_PLAYER(3) NETLIST_ANALOG_PORT_CHANGED("maincpu", "pot2")
212212
213    PORT_START( "PADDLE3" ) /* fake input port for player 4 paddle */
214    PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_SENSITIVITY(2) PORT_KEYDELTA(100) PORT_CENTERDELTA(0) PORT_PLAYER(4) NETLIST_ANALOG_PORT_CHANGED("maincpu", "pot3")
213   PORT_START( "PADDLE3" ) /* fake input port for player 4 paddle */
214   PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_SENSITIVITY(2) PORT_KEYDELTA(100) PORT_CENTERDELTA(0) PORT_PLAYER(4) NETLIST_ANALOG_PORT_CHANGED("maincpu", "pot3")
215215
216216   PORT_START("IN0") /* fake as well */
217217   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )     NETLIST_LOGIC_PORT_CHANGED("maincpu", "coinsw")
r31373r31374
284284#endif
285285   MCFG_NETLIST_ANALOG_INPUT("maincpu", "pot0", "A10_POT.DIAL")
286286   MCFG_NETLIST_ANALOG_INPUT("maincpu", "pot1", "B10_POT.DIAL")
287    MCFG_NETLIST_ANALOG_INPUT("maincpu", "pot2", "B9B_POT.DIAL")
288    MCFG_NETLIST_ANALOG_INPUT("maincpu", "pot3", "B9A_POT.DIAL")
287   MCFG_NETLIST_ANALOG_INPUT("maincpu", "pot2", "B9B_POT.DIAL")
288   MCFG_NETLIST_ANALOG_INPUT("maincpu", "pot3", "B9A_POT.DIAL")
289289   MCFG_NETLIST_LOGIC_INPUT("maincpu", "sw1a", "DIPSW1.POS", 0, 0x01)
290290   MCFG_NETLIST_LOGIC_INPUT("maincpu", "sw1b", "DIPSW2.POS", 0, 0x01)
291291   MCFG_NETLIST_LOGIC_INPUT("maincpu", "coinsw", "COIN_SW.POS", 0, 0x01)
trunk/src/mame/drivers/nwk-tr.c
r31373r31374
750750   MCFG_VOODOO_TMUMEM(2,2)
751751   MCFG_VOODOO_SCREEN_TAG("screen")
752752   MCFG_VOODOO_CPU_TAG("dsp")
753   MCFG_VOODOO_VBLANK_CB(WRITELINE(nwktr_state,voodoo_vblank_0))   
753   MCFG_VOODOO_VBLANK_CB(WRITELINE(nwktr_state,voodoo_vblank_0))
754754
755755   MCFG_SCREEN_ADD("screen", RASTER)
756756   MCFG_SCREEN_REFRESH_RATE(60)
r31373r31374
767767   MCFG_K001604_GFX_INDEX2(1)
768768   MCFG_K001604_LAYER_SIZE(0)
769769   MCFG_K001604_ROZ_SIZE(1)
770   MCFG_K001604_TXT_OFFSET(0)   // correct?
771   MCFG_K001604_ROZ_OFFSET(0)   // correct?
770   MCFG_K001604_TXT_OFFSET(0)  // correct?
771   MCFG_K001604_ROZ_OFFSET(0)  // correct?
772772   MCFG_K001604_GFXDECODE("gfxdecode")
773773   MCFG_K001604_PALETTE("palette")
774774
r31373r31374
780780   MCFG_RF5C400_ADD("rfsnd", XTAL_16_9344MHz)  // as per Guru readme above
781781   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
782782   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
783   
783
784784   MCFG_DEVICE_ADD("konppc", KONPPC, 0)
785785   MCFG_KONPPC_CGBOARD_NUMBER(2)
786   MCFG_KONPPC_CGBOARD_TYPE(CGBOARD_TYPE_NWKTR)   
786   MCFG_KONPPC_CGBOARD_TYPE(CGBOARD_TYPE_NWKTR)
787787MACHINE_CONFIG_END
788788
789789static MACHINE_CONFIG_DERIVED( thrilld, nwktr )
r31373r31374
794794   MCFG_K001604_GFX_INDEX2(1)
795795   MCFG_K001604_LAYER_SIZE(1)
796796   MCFG_K001604_ROZ_SIZE(1)
797   MCFG_K001604_TXT_OFFSET(0)   // correct?
798   MCFG_K001604_ROZ_OFFSET(0)   // correct?
797   MCFG_K001604_TXT_OFFSET(0)  // correct?
798   MCFG_K001604_ROZ_OFFSET(0)  // correct?
799799   MCFG_K001604_GFXDECODE("gfxdecode")
800800   MCFG_K001604_PALETTE("palette")
801801MACHINE_CONFIG_END
trunk/src/mame/drivers/alvg.c
r31373r31374
204204   ROM_LOAD("u5.bin", 0x00000, 0x40000, CRC(e5126980) SHA1(2c6d412c87bf27098dae4351958d84e8f9348423))
205205   ROM_RELOAD( 0x80000, 0x40000)
206206   ROM_LOAD("u6.bin", 0x40000, 0x40000, CRC(eb241633) SHA1(8e5db75b32ed2ea74088615bbe1403d4c8feafbd))
207   ROM_RELOAD( 0xc0000, 0x40000)   
207   ROM_RELOAD( 0xc0000, 0x40000)
208208ROM_END
209209
210210/*-------------------------------------------------------------------
trunk/src/mame/drivers/naomi.c
r31373r31374
374374Notes:
375375      OSC1  - oscillator 20.000MHz
376376     JP1-7  - JUMPER unknown function
377      SW1  - PUSHBUTTON
378      SW2  - 8X2 DIPswitch
377       SW1  - PUSHBUTTON
378       SW2  - 8X2 DIPswitch
379379 SCSI-CTRL  - SCSI-II controller MB86604A
380380    CNDB25  - DB-25 SCSI-II connector
381381IC17S-IC38S - FlashROM (SOP56), 64Mb.
r31373r31374
386386   CN1/2/3  - connectors joining to main board
387387
388388Games known to use this PCB include....
389                                     Sticker  EPROM        MASKROMs   
389                                     Sticker  EPROM        MASKROMs
390390Game                                 on cart  IC16#        # of SOP56  Notes
391391----------------------------------------------------------------------------------------------------
392392Puyo Puyo Fever (prototype)          *        not present  22 (64Mb)   no cart, only development PCB
r31373r31374
57385738
57395739   ROM_REGION( 0x10000000, "rom_board", ROMREGION_ERASEFF)
57405740   // real encrypted ROM dump
5741   ROM_LOAD( "fpr-24423.ic8",  0x00000000, 0x4000000, CRC(c85513ce) SHA1(88490fe64c0866059492b0c1c714b50f3f270676) )
5741   ROM_LOAD( "fpr-24423.ic8",  0x00000000, 0x4000000, CRC(c85513ce) SHA1(88490fe64c0866059492b0c1c714b50f3f270676) )
57425742   // decrypted version of IC8
57435743   ROM_LOAD( "fpr-24423.ic8d", 0x00000000, 0x4000000, CRC(209a991c) SHA1(d76228a215c50ff3085708182b8e47fd2ebc6a47) )
5744   ROM_LOAD( "fpr-24424.ic9",  0x04000000, 0x4000000, CRC(7bba2402) SHA1(94d637969c58d5dfa3ee64bc3cfb9495dbb97511) )
5745   ROM_LOAD( "fpr-24425.ic10", 0x08000000, 0x4000000, CRC(6223ebac) SHA1(64c0ec61c108acbb557e7d3837f578deba832cb6) )
5746   ROM_LOAD( "fpr-24426.ic11", 0x0c000000, 0x4000000, CRC(c78b0981) SHA1(f889acf9065566e11ff985a3b6c4824e364d57ae) )
5744   ROM_LOAD( "fpr-24424.ic9",  0x04000000, 0x4000000, CRC(7bba2402) SHA1(94d637969c58d5dfa3ee64bc3cfb9495dbb97511) )
5745   ROM_LOAD( "fpr-24425.ic10", 0x08000000, 0x4000000, CRC(6223ebac) SHA1(64c0ec61c108acbb557e7d3837f578deba832cb6) )
5746   ROM_LOAD( "fpr-24426.ic11", 0x0c000000, 0x4000000, CRC(c78b0981) SHA1(f889acf9065566e11ff985a3b6c4824e364d57ae) )
57475747
57485748   ROM_REGION( 4, "rom_key", 0 )
5749   ROM_LOAD( "rhytngk-key.bin", 0x000000, 0x000004, CRC(e2560d28) SHA1(46fb9b47a0df3035f92db2b0c63a6e4e0745ad29) )
5749   ROM_LOAD( "rhytngk-key.bin", 0x000000, 0x000004, CRC(e2560d28) SHA1(46fb9b47a0df3035f92db2b0c63a6e4e0745ad29) )
57505750
57515751   ROM_REGION(0x4, "boardid", ROMREGION_ERASEVAL(0x04))
57525752ROM_END
r31373r31374
88378837/* 0170 */ GAME( 2007, manicpnc, naomi,    naomim4, naomi,   naomi_state, naomi,   ROT0, "Sega", "Manic Panic Ghosts!", GAME_FLAGS )
88388838/* 0170 */ GAME( 2007, pokasuka, manicpnc, naomim4, naomi,   naomi_state, naomi,   ROT0, "Sega", "Pokasuka Ghost", GAME_FLAGS )
88398839/* 0175 */ GAME( 2007, asndynmt, naomi,    naomim4, naomi,   naomi_state, naomi,   ROT0, "Sega", "Asian Dynamite", GAME_FLAGS )
8840/* 0177 */ GAME( 2007, rhytngk,  naomi,    naomim4, naomi,   naomi_state, naomi,   ROT0, "Sega/Nintendo", "Rhythm Tengoku", GAME_FLAGS )
8840/* 0177 */ GAME( 2007, rhytngk,  naomi,    naomim4, naomi,   naomi_state, naomi,   ROT0, "Sega/Nintendo", "Rhythm Tengoku", GAME_FLAGS )
88418841// 00xx Mayjinsen (Formation Battle in May) - prototype, never released
88428842
88438843/* Cartridge prototypes of games released on GD-ROM */
trunk/src/mame/drivers/dassault.c
r31373r31374
520520   MCFG_DECO16IC_BANK2_CB(dassault_state, bank_callback)
521521   MCFG_DECO16IC_PF12_8X8_BANK(0)
522522   MCFG_DECO16IC_PF12_16X16_BANK(2)
523   
523
524524   MCFG_DECO16IC_GFXDECODE("gfxdecode")
525525   MCFG_DECO16IC_PALETTE("palette")
526526
trunk/src/mame/drivers/gbusters.c
r31373r31374
262262{
263263   /* bits 0-3 ROM bank */
264264   membank("bank1")->set_entry(data & 0x0f);
265   
265
266266   if (data & 0xf0)
267267   {
268268      //logerror("%04x: (lines) write %02x\n",device->safe_pc(), data);
269269      //popmessage("lines = %02x", data);
270270   }
271   
271
272272   /* other bits unknown */
273273}
274274
r31373r31374
337337   ROM_LOAD32_WORD( "878c07.h27", 0x00000, 0x40000, CRC(eeed912c) SHA1(b2e27610b38f3fc9c2cdad600b03c8bae4fb9138) )
338338   ROM_LOAD32_WORD( "878c08.k27", 0x00002, 0x40000, CRC(4d14626d) SHA1(226b1d83fb82586302be0a67737a427475856537) )
339339
340   ROM_REGION( 0x80000, "k051960", 0 )      /* sprites */
341   ROM_LOAD32_WORD( "878c05.h5", 0x00000, 0x40000, CRC(01f4aea5) SHA1(124123823be6bd597805484539d821aaaadde2c0) )
340   ROM_REGION( 0x80000, "k051960", 0 )     /* sprites */
341   ROM_LOAD32_WORD( "878c05.h5", 0x00000, 0x40000, CRC(01f4aea5) SHA1(124123823be6bd597805484539d821aaaadde2c0) )
342342   ROM_LOAD32_WORD( "878c06.k5", 0x00002, 0x40000, CRC(edfaaaaf) SHA1(67468c4ce47e8d43d58de8d3b50b048c66508156) )
343343
344344   ROM_REGION( 0x0100, "proms", 0 )
r31373r31374
361361   ROM_LOAD32_WORD( "878c07.h27", 0x00000, 0x40000, CRC(eeed912c) SHA1(b2e27610b38f3fc9c2cdad600b03c8bae4fb9138) )
362362   ROM_LOAD32_WORD( "878c08.k27", 0x00002, 0x40000, CRC(4d14626d) SHA1(226b1d83fb82586302be0a67737a427475856537) )
363363
364   ROM_REGION( 0x80000, "k051960", 0 )      /* sprites */
364   ROM_REGION( 0x80000, "k051960", 0 )     /* sprites */
365365   ROM_LOAD32_WORD( "878c05.h5", 0x00000, 0x40000, CRC(01f4aea5) SHA1(124123823be6bd597805484539d821aaaadde2c0) )
366366   ROM_LOAD32_WORD( "878c06.k5", 0x00002, 0x40000, CRC(edfaaaaf) SHA1(67468c4ce47e8d43d58de8d3b50b048c66508156) )
367367
r31373r31374
385385   ROM_LOAD32_WORD( "878c07.h27", 0x00000, 0x40000, CRC(eeed912c) SHA1(b2e27610b38f3fc9c2cdad600b03c8bae4fb9138) )
386386   ROM_LOAD32_WORD( "878c08.k27", 0x00002, 0x40000, CRC(4d14626d) SHA1(226b1d83fb82586302be0a67737a427475856537) )
387387
388   ROM_REGION( 0x80000, "k051960", 0 )      /* sprites */
388   ROM_REGION( 0x80000, "k051960", 0 )     /* sprites */
389389   ROM_LOAD32_WORD( "878c05.h5", 0x00000, 0x40000, CRC(01f4aea5) SHA1(124123823be6bd597805484539d821aaaadde2c0) )
390390   ROM_LOAD32_WORD( "878c06.k5", 0x00002, 0x40000, CRC(edfaaaaf) SHA1(67468c4ce47e8d43d58de8d3b50b048c66508156) )
391391
trunk/src/mame/drivers/igs011.c
r31373r31374
208208   DECLARE_DRIVER_INIT(ryukobou);
209209   TIMER_DEVICE_CALLBACK_MEMBER(lev5_timer_irq_cb);
210210   TIMER_DEVICE_CALLBACK_MEMBER(lhb_timer_irq_cb);
211   TIMER_DEVICE_CALLBACK_MEMBER(lev3_timer_irq_cb);   
211   TIMER_DEVICE_CALLBACK_MEMBER(lev3_timer_irq_cb);
212212   virtual void video_start();
213213   UINT32 screen_update_igs011(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
214214   void screen_eof_vbowl(screen_device &screen, bool state);
trunk/src/mame/drivers/cubo.c
r31373r31374
359359   required_device<cdda_device> m_cdda;
360360
361361   typedef void (cubo_state::*input_hack_func)();
362    input_hack_func m_input_hack;
362   input_hack_func m_input_hack;
363363
364    void cndypuzl_input_hack();
365    void haremchl_input_hack();
366    void lsrquiz_input_hack();
367    void lsrquiz2_input_hack();
368    void lasstixx_input_hack();
369    void mgnumber_input_hack();
370    void mgprem11_input_hack();
364   void cndypuzl_input_hack();
365   void haremchl_input_hack();
366   void lsrquiz_input_hack();
367   void lsrquiz2_input_hack();
368   void lasstixx_input_hack();
369   void mgnumber_input_hack();
370   void mgprem11_input_hack();
371371};
372372
373373static void handle_cd32_joystick_cia(running_machine &machine, UINT8 pra, UINT8 dra);
trunk/src/mame/drivers/nyny.c
r31373r31374
624624   MCFG_TTL74123_B_PIN_VALUE(1)                  /* B pin - pulled high */
625625   MCFG_TTL74123_CLEAR_PIN_VALUE(1)                  /* Clear pin - pulled high */
626626   MCFG_TTL74123_OUTPUT_CHANGED_CB(WRITE8(nyny_state, ic48_1_74123_output_changed))
627   
627
628628   MCFG_DEVICE_ADD("pia1", PIA6821, 0)
629629   MCFG_PIA_READPA_HANDLER(IOPORT("IN0"))
630630   MCFG_PIA_READPB_HANDLER(IOPORT("IN1"))
trunk/src/mame/drivers/thunderx.c
r31373r31374
724724   ROM_REGION( 0x10000, "audiocpu", 0 )    /* 64k for the SOUND CPU */
725725   ROM_LOAD( "775-c01.bin", 0x00000, 0x08000, CRC(0ced785a) SHA1(1eebe005a968fbaac595c168499107e34763976c) )
726726
727   ROM_REGION( 0x100000, "k052109", 0 )   /* tiles */
727   ROM_REGION( 0x100000, "k052109", 0 )    /* tiles */
728728   ROM_LOAD32_BYTE( "775-a07a.bin", 0x00000, 0x20000, CRC(e716bdf3) SHA1(82e10132f248aed8cc1aea6bb7afe9a1479c8b59) )
729729   ROM_LOAD32_BYTE( "775-a07e.bin", 0x00001, 0x20000, CRC(0986e3a5) SHA1(61c33a3f2e4fde7d23d440b5c3151fe38e25716b) )
730730   ROM_LOAD32_BYTE( "775-a08a.bin", 0x00002, 0x20000, CRC(3ddd11a4) SHA1(4831a891d6cb4507053d576eddd658c338318176) )
r31373r31374
738738   ROM_LOAD32_BYTE( "775-f08d.bin", 0xc0002, 0x10000, CRC(102dcace) SHA1(03036b6d9d66a12cb3e97980f149c09d1efbd6d8) )
739739   ROM_LOAD32_BYTE( "775-f08h.bin", 0xc0003, 0x10000, CRC(ad9d7016) SHA1(91e9f279b781eefcafffc70afe207f35cc6f4d9d) )
740740
741   ROM_REGION( 0x100000, "k051960", 0 )      /* sprites */
741   ROM_REGION( 0x100000, "k051960", 0 )        /* sprites */
742742   ROM_LOAD32_BYTE( "775-a05a.bin", 0x00000, 0x10000, CRC(a0767045) SHA1(e6df0731a9fb3b3d918607de81844e1f9353aac7) )
743743   ROM_LOAD32_BYTE( "775-a05e.bin", 0x00001, 0x10000, CRC(2f656f08) SHA1(140e7948c45d27c6705622d588a65b59ebcc624c) )
744744   ROM_LOAD32_BYTE( "775-a06a.bin", 0x00002, 0x10000, CRC(77a34ad0) SHA1(3653fb8458c1e7eb7d83b5cd63f02343c0f2d93e) )
r31373r31374
779779   ROM_REGION( 0x10000, "audiocpu", 0 )    /* 64k for the SOUND CPU */
780780   ROM_LOAD( "775-c01.bin", 0x00000, 0x08000, CRC(0ced785a) SHA1(1eebe005a968fbaac595c168499107e34763976c) )
781781
782   ROM_REGION( 0x100000, "k052109", 0 )   /* tiles */
782   ROM_REGION( 0x100000, "k052109", 0 )    /* tiles */
783783   ROM_LOAD32_BYTE( "775-a07a.bin", 0x00000, 0x20000, CRC(e716bdf3) SHA1(82e10132f248aed8cc1aea6bb7afe9a1479c8b59) )
784784   ROM_LOAD32_BYTE( "775-a07e.bin", 0x00001, 0x20000, CRC(0986e3a5) SHA1(61c33a3f2e4fde7d23d440b5c3151fe38e25716b) )
785785   ROM_LOAD32_BYTE( "775-a08a.bin", 0x00002, 0x20000, CRC(3ddd11a4) SHA1(4831a891d6cb4507053d576eddd658c338318176) )
r31373r31374
793793   ROM_LOAD32_BYTE( "775-f08d.bin", 0xc0002, 0x10000, CRC(102dcace) SHA1(03036b6d9d66a12cb3e97980f149c09d1efbd6d8) )
794794   ROM_LOAD32_BYTE( "775-f08h.bin", 0xc0003, 0x10000, CRC(ad9d7016) SHA1(91e9f279b781eefcafffc70afe207f35cc6f4d9d) )
795795
796   ROM_REGION( 0x100000, "k051960", 0 )      /* sprites */
796   ROM_REGION( 0x100000, "k051960", 0 )        /* sprites */
797797   ROM_LOAD32_BYTE( "775-a05a.bin", 0x00000, 0x10000, CRC(a0767045) SHA1(e6df0731a9fb3b3d918607de81844e1f9353aac7) )
798798   ROM_LOAD32_BYTE( "775-a05e.bin", 0x00001, 0x10000, CRC(2f656f08) SHA1(140e7948c45d27c6705622d588a65b59ebcc624c) )
799799   ROM_LOAD32_BYTE( "775-a06a.bin", 0x00002, 0x10000, CRC(77a34ad0) SHA1(3653fb8458c1e7eb7d83b5cd63f02343c0f2d93e) )
r31373r31374
844844   ROM_LOAD32_BYTE( "873c07b.e4",   0x40002, 0x10000, CRC(12a2b8ba) SHA1(ffa32ca116e0b6ca65bb9ce83dd28f5c027956a5) )
845845   ROM_LOAD32_BYTE( "873c07d.e3",   0x40003, 0x10000, CRC(fae9f965) SHA1(780c234507835c37bde445ab34f069714cc7a506) )
846846
847   ROM_REGION( 0x80000, "k051960", 0 )      /* sprites */
847   ROM_REGION( 0x80000, "k051960", 0 )     /* sprites */
848848   ROM_LOAD32_BYTE( "873c04a.f11",  0x00000, 0x10000, CRC(f7740bf3) SHA1(f64b7e807f19a9523a517024a9eb56736cdda6bb) )
849849   ROM_LOAD32_BYTE( "873c04c.f10",  0x00001, 0x10000, CRC(5dacbd2b) SHA1(deb943b99fd296d20be9c4250b2348549f65ba37) )
850850   ROM_LOAD32_BYTE( "873c05a.f9",   0x00002, 0x10000, CRC(d73e107d) SHA1(ba63b195e20a98c476e7d0f8d0187bc3327a8822) )
r31373r31374
877877   ROM_LOAD32_BYTE( "873c07b.e4",   0x40002, 0x10000, CRC(12a2b8ba) SHA1(ffa32ca116e0b6ca65bb9ce83dd28f5c027956a5) )
878878   ROM_LOAD32_BYTE( "873c07d.e3",   0x40003, 0x10000, CRC(fae9f965) SHA1(780c234507835c37bde445ab34f069714cc7a506) )
879879
880   ROM_REGION( 0x80000, "k051960", 0 )      /* sprites */
880   ROM_REGION( 0x80000, "k051960", 0 )     /* sprites */
881881   ROM_LOAD32_BYTE( "873c04a.f11",  0x00000, 0x10000, CRC(f7740bf3) SHA1(f64b7e807f19a9523a517024a9eb56736cdda6bb) )
882882   ROM_LOAD32_BYTE( "873c04c.f10",  0x00001, 0x10000, CRC(5dacbd2b) SHA1(deb943b99fd296d20be9c4250b2348549f65ba37) )
883883   ROM_LOAD32_BYTE( "873c05a.f9",   0x00002, 0x10000, CRC(d73e107d) SHA1(ba63b195e20a98c476e7d0f8d0187bc3327a8822) )
r31373r31374
910910   ROM_LOAD32_BYTE( "873c07b.e4",   0x40002, 0x10000, CRC(12a2b8ba) SHA1(ffa32ca116e0b6ca65bb9ce83dd28f5c027956a5) )
911911   ROM_LOAD32_BYTE( "873c07d.e3",   0x40003, 0x10000, CRC(fae9f965) SHA1(780c234507835c37bde445ab34f069714cc7a506) )
912912
913   ROM_REGION( 0x80000, "k051960", 0 )      /* sprites */
913   ROM_REGION( 0x80000, "k051960", 0 )     /* sprites */
914914   ROM_LOAD32_BYTE( "873c04a.f11",  0x00000, 0x10000, CRC(f7740bf3) SHA1(f64b7e807f19a9523a517024a9eb56736cdda6bb) )
915915   ROM_LOAD32_BYTE( "873c04c.f10",  0x00001, 0x10000, CRC(5dacbd2b) SHA1(deb943b99fd296d20be9c4250b2348549f65ba37) )
916916   ROM_LOAD32_BYTE( "873c05a.f9",   0x00002, 0x10000, CRC(d73e107d) SHA1(ba63b195e20a98c476e7d0f8d0187bc3327a8822) )
r31373r31374
943943   ROM_LOAD32_BYTE( "873c07b.e4",   0x40002, 0x10000, CRC(12a2b8ba) SHA1(ffa32ca116e0b6ca65bb9ce83dd28f5c027956a5) )
944944   ROM_LOAD32_BYTE( "873c07d.e3",   0x40003, 0x10000, CRC(fae9f965) SHA1(780c234507835c37bde445ab34f069714cc7a506) )
945945
946   ROM_REGION( 0x80000, "k051960", 0 )      /* sprites */
946   ROM_REGION( 0x80000, "k051960", 0 )     /* sprites */
947947   ROM_LOAD32_BYTE( "873c04a.f11",  0x00000, 0x10000, CRC(f7740bf3) SHA1(f64b7e807f19a9523a517024a9eb56736cdda6bb) )
948948   ROM_LOAD32_BYTE( "873c04c.f10",  0x00001, 0x10000, CRC(5dacbd2b) SHA1(deb943b99fd296d20be9c4250b2348549f65ba37) )
949949   ROM_LOAD32_BYTE( "873c05a.f9",   0x00002, 0x10000, CRC(d73e107d) SHA1(ba63b195e20a98c476e7d0f8d0187bc3327a8822) )
trunk/src/mame/drivers/megaphx.c
r31373r31374
349349
350350
351351static ADDRESS_MAP_START( megaphx_pic_io_map, AS_IO, 8, megaphx_state )
352//   AM_RANGE(0x00, 0x00) AM_WRITE(playmark_oki_banking_w)
353//   AM_RANGE(0x01, 0x01) AM_READWRITE(playmark_snd_command_r, playmark_oki_w)
354//   AM_RANGE(0x02, 0x02) AM_READWRITE(playmark_snd_flag_r, playmark_snd_control_w)
355//   AM_RANGE(PIC16C5x_T0, PIC16C5x_T0) AM_READ(PIC16C5X_T0_clk_r)
352//  AM_RANGE(0x00, 0x00) AM_WRITE(playmark_oki_banking_w)
353//  AM_RANGE(0x01, 0x01) AM_READWRITE(playmark_snd_command_r, playmark_oki_w)
354//  AM_RANGE(0x02, 0x02) AM_READWRITE(playmark_snd_flag_r, playmark_snd_control_w)
355//  AM_RANGE(PIC16C5x_T0, PIC16C5x_T0) AM_READ(PIC16C5X_T0_clk_r)
356356ADDRESS_MAP_END
357357
358358
trunk/src/mame/drivers/kingdrby.c
r31373r31374
11561156   ROM_LOAD( "h6", 0x2000, 0x1000, CRC(257f4e0d) SHA1(cd61f3cf70c536aa207ebfdd28be54ac586b5249) ) // = im6_d.b6 kingdrby
11571157
11581158   ROM_REGION( 0x1000, "soundcpu", 0 )
1159   ROM_LOAD( "sg1_b.e1", 0x0000, 0x1000, BAD_DUMP CRC(92ef3c13) SHA1(1bf1e4106b37aadfc02822184510740e18a54d5c) )     // not in this set, using kingdrby one...
1159   ROM_LOAD( "sg1_b.e1", 0x0000, 0x1000, BAD_DUMP CRC(92ef3c13) SHA1(1bf1e4106b37aadfc02822184510740e18a54d5c) )  // not in this set, using kingdrby one...
11601160
11611161   ROM_REGION( 0x4000, "slave", 0 )
11621162   ROM_LOAD( "h1", 0x0000, 0x1000, CRC(444aa020) SHA1(0d40e9499892177b4d8123ad7b6909e8f6e0c8ab) )
trunk/src/mame/drivers/bfm_sc4h.c
r31373r31374
2222    see bfm_sc4.c
2323
2424    The hopper(s) are not currently emulated, many of the games can
25   be operated in 'Door Open' mode granting you free credits.
25    be operated in 'Door Open' mode granting you free credits.
2626
27   Most games will show a RAM error on first boot due, after that they
28   will initialize their NVRAM.
27    Most games will show a RAM error on first boot due, after that they
28    will initialize their NVRAM.
2929
30   If 'Read Meters' is shown press the 'Cancel' button (this moves around
31   per game, so where it maps might not be obvious)  Doing this will allow
32   the games to run in Door Open mode, pressing 'Start' (also moves around)
33   will allow you to test the game.  Not all games have this feature.
30    If 'Read Meters' is shown press the 'Cancel' button (this moves around
31    per game, so where it maps might not be obvious)  Doing this will allow
32    the games to run in Door Open mode, pressing 'Start' (also moves around)
33    will allow you to test the game.  Not all games have this feature.
3434
35   Pressing the service key ('Green Button') often allows test mode to be
36   entered, some games have more comprehensive tests than others.
35    Pressing the service key ('Green Button') often allows test mode to be
36    entered, some games have more comprehensive tests than others.
3737
38   Various (poorly programmed) sets require specific Jackpot 'keys' etc. to
39   boot and won't even warn you if they're invalid, others allow you to
40   set options if keys are not present. (again the buttons to do so move
41   between games)
38    Various (poorly programmed) sets require specific Jackpot 'keys' etc. to
39    boot and won't even warn you if they're invalid, others allow you to
40    set options if keys are not present. (again the buttons to do so move
41    between games)
4242
43   Many games have missing sound roms, incorrect sound roms, or badly
44   dumped sound roms.  We also have several dumps where only sound roms
45   are present.
43    Many games have missing sound roms, incorrect sound roms, or badly
44    dumped sound roms.  We also have several dumps where only sound roms
45    are present.
4646
47   Many of the titles here were also released on the SC5 platform.
47    Many of the titles here were also released on the SC5 platform.
4848
4949*/
5050
r31373r31374
723723
724724   MCFG_BFMBDA_ADD("vfd0",0)
725725
726//   MCFG_DEFAULT_LAYOUT(layout_bfm_sc4)
726//  MCFG_DEFAULT_LAYOUT(layout_bfm_sc4)
727727
728728   MCFG_SOUND_ADD("ymz", YMZ280B, 16000000) // ?? Mhz
729729   MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(sc4_state, bfm_sc4_irqhandler))
r31373r31374
942942   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
943943   PORT_BIT(           0xffe0, IP_ACTIVE_HIGH, IPT_UNUSED )
944944
945   PORT_START("IN-10")
945   PORT_START("IN-10")
946946   PORT_DIPNAME( 0x01, 0x00, "IN 10-0 (STRB 10 Data 0)" )
947947   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
948948   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r31373r31374
980980   PORT_BIT(           0xffe0, IP_ACTIVE_HIGH, IPT_UNUSED )
981981
982982   // where are 11,12,13,14,15 ?
983   
983
984984   PORT_START("IN-16")
985985   PORT_DIPNAME( 0x01, 0x00, "IN 16-0 (STRB 16 Data 0)" )
986986   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
r31373r31374
10981098   PORT_BIT( 0x0008, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_3) PORT_NAME("IN2-3")
10991099   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_4) PORT_NAME("IN2-4")
11001100   PORT_BIT( 0x0020, IP_ACTIVE_HIGH, SC45_BUTTON_MATRIX_2_5) PORT_NAME("IN2-5")
1101   
1101
11021102   PORT_MODIFY("IN-3")
11031103   PORT_DIPNAME( 0x04, 0x00, "IN 3-2 (STK 4  3.2)" )
11041104   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
11051105   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1106   PORT_DIPNAME( 0x08, 0x00, "IN 3-3 (STK 2  3.3)" )
1106   PORT_DIPNAME( 0x08, 0x00, "IN 3-3 (STK 2  3.3)" )
11071107   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
11081108   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
11091109   PORT_DIPNAME( 0x10, 0x00, "IN 3-4 (STK 3  3.4)" )
r31373r31374
11781178   PORT_DIPNAME( 0x0004, 0x0000, "Service Door" ) // SERDOR20.2
11791179   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
11801180   PORT_DIPSETTING(      0x0004, DEF_STR( On ) )
1181   PORT_DIPNAME( 0x0008, 0x0000, "Cashbox Door" ) // CSHDOR20.3   
1181   PORT_DIPNAME( 0x0008, 0x0000, "Cashbox Door" ) // CSHDOR20.3
11821182   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
11831183   PORT_DIPSETTING(      0x0008, DEF_STR( On ) )
11841184   PORT_DIPNAME( 0x0010, 0x0000, "Hopper DMP" ) // HOPDMP20.4
trunk/src/mame/drivers/tigeroad.c
r31373r31374
3131
3232The microcontroller mainly controls the animation of the enemy robots,
3333the communication between the 68000 and MCU is probably not emulated
34100% correct but it works.
34100% correct but it works.
3535
3636Emulation by Bryan McPhail, mish@tendril.co.uk
3737
r31373r31374
6868
6969static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, tigeroad_state )
7070   AM_RANGE(0x000000, 0x03ffff) AM_ROM
71   
71
7272   AM_RANGE(0xfe0800, 0xfe0cff) AM_RAM AM_SHARE("spriteram")
7373   AM_RANGE(0xfe0d00, 0xfe1807) AM_RAM     /* still part of OBJ RAM */
7474   AM_RANGE(0xfe4000, 0xfe4001) AM_READ_PORT("P1_P2") AM_WRITE(tigeroad_videoctrl_w)   /* char bank, coin counters, + ? */
r31373r31374
7777   AM_RANGE(0xfe8000, 0xfe8003) AM_WRITE(tigeroad_scroll_w)
7878   AM_RANGE(0xfe800e, 0xfe800f) AM_WRITEONLY    /* fe800e = watchdog or IRQ acknowledge */
7979   AM_RANGE(0xfec000, 0xfec7ff) AM_RAM_WRITE(tigeroad_videoram_w) AM_SHARE("videoram")
80   
80
8181   AM_RANGE(0xff8000, 0xff87ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
8282   AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_SHARE("ram16")
8383ADDRESS_MAP_END
r31373r31374
9393   AM_RANGE(0xe8000, 0xe8003) AM_WRITE(tigeroad_scroll_w)
9494   AM_RANGE(0xe800e, 0xe800f) AM_WRITENOP /* ? */
9595   AM_RANGE(0xec000, 0xec7ff) AM_RAM_WRITE(tigeroad_videoram_w) AM_SHARE("videoram")
96   
96
9797   AM_RANGE(0xf8000, 0xf87ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
9898   AM_RANGE(0xfc000, 0xfffff) AM_RAM AM_SHARE("ram16")
9999ADDRESS_MAP_END
r31373r31374
564564
565565static GFXDECODE_START( tigeroad )
566566   GFXDECODE_ENTRY( "text", 0, text_layout,      0x300, 16 )
567   GFXDECODE_ENTRY( "tiles", 0, tile_layout,     0x100, 16 )
567   GFXDECODE_ENTRY( "tiles", 0, tile_layout,     0x100, 16 )
568568   GFXDECODE_ENTRY( "sprites", 0, sprite_layout, 0x200, 16 )
569569GFXDECODE_END
570570
r31373r31374
11771177
11781178GAME( 1991, bballs,   0,       bballs,  bballs, tigeroad_state,  bballs, ROT0, "Comad", "Bouncing Balls", GAME_SUPPORTS_SAVE )
11791179GAME( 1991, bballsa,  bballs,  bballs,  bballs, tigeroad_state,  bballs, ROT0, "Comad", "Bouncing Balls (Adult)", GAME_SUPPORTS_SAVE )
1180
1181
trunk/src/mame/drivers/seattle.c
r31373r31374
31363136 *************************************/
31373137
31383138/* Atari */
3139GAME( 1996, wg3dh,    0,        wg3dh,               wg3dh, seattle_state,    wg3dh,    ROT0, "Atari Games",  "Wayne Gretzky's 3D Hockey", GAME_SUPPORTS_SAVE )
3140GAME( 1996, mace,     0,        mace,              mace, seattle_state,     mace,     ROT0, "Atari Games",  "Mace: The Dark Age (boot ROM 1.0ce, HDD 1.0b)", GAME_SUPPORTS_SAVE )
3141GAME( 1997, macea,    mace,     mace,             mace, seattle_state,     mace,     ROT0, "Atari Games",  "Mace: The Dark Age (HDD 1.0a)", GAME_SUPPORTS_SAVE )
3139GAME( 1996, wg3dh,    0,        wg3dh,             wg3dh, seattle_state,    wg3dh,    ROT0, "Atari Games",  "Wayne Gretzky's 3D Hockey", GAME_SUPPORTS_SAVE )
3140GAME( 1996, mace,     0,        mace,              mace, seattle_state,     mace,     ROT0, "Atari Games",  "Mace: The Dark Age (boot ROM 1.0ce, HDD 1.0b)", GAME_SUPPORTS_SAVE )
3141GAME( 1997, macea,    mace,     mace,              mace, seattle_state,     mace,     ROT0, "Atari Games",  "Mace: The Dark Age (HDD 1.0a)", GAME_SUPPORTS_SAVE )
31423142GAME( 1996, sfrush,   0,        sfrush,            sfrush, seattle_state,   sfrush,   ROT0, "Atari Games",  "San Francisco Rush", GAME_SUPPORTS_SAVE )
31433143GAME( 1996, sfrushrk, 0,        sfrushrk,          sfrushrk, seattle_state, sfrushrk, ROT0, "Atari Games",  "San Francisco Rush: The Rock", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
3144GAME( 1998, calspeed, 0,        calspeed,          calspeed, seattle_state, calspeed, ROT0, "Atari Games",  "California Speed (Version 2.1a, 4/17/98)", GAME_SUPPORTS_SAVE )
3145GAME( 1998, calspeeda,calspeed, calspeed,          calspeed, seattle_state, calspeed, ROT0, "Atari Games",  "California Speed (Version 1.0r7a 3/4/98)", GAME_SUPPORTS_SAVE )
3146GAME( 1998, vaportrx, 0,        vaportrx,          vaportrx, seattle_state, vaportrx, ROT0, "Atari Games",  "Vapor TRX", GAME_SUPPORTS_SAVE )
3147GAME( 1998, vaportrxp,vaportrx, vaportrx,          vaportrx, seattle_state, vaportrx, ROT0, "Atari Games",  "Vapor TRX (prototype)", GAME_SUPPORTS_SAVE )
3144GAME( 1998, calspeed, 0,        calspeed,          calspeed, seattle_state, calspeed, ROT0, "Atari Games",  "California Speed (Version 2.1a, 4/17/98)", GAME_SUPPORTS_SAVE )
3145GAME( 1998, calspeeda,calspeed, calspeed,          calspeed, seattle_state, calspeed, ROT0, "Atari Games",  "California Speed (Version 1.0r7a 3/4/98)", GAME_SUPPORTS_SAVE )
3146GAME( 1998, vaportrx, 0,        vaportrx,          vaportrx, seattle_state, vaportrx, ROT0, "Atari Games",  "Vapor TRX", GAME_SUPPORTS_SAVE )
3147GAME( 1998, vaportrxp,vaportrx, vaportrx,          vaportrx, seattle_state, vaportrx, ROT0, "Atari Games",  "Vapor TRX (prototype)", GAME_SUPPORTS_SAVE )
31483148
31493149/* Midway */
31503150GAME( 1997, biofreak, 0,        biofreak,          biofreak, seattle_state, biofreak, ROT0, "Midway Games", "BioFreaks (prototype)", GAME_SUPPORTS_SAVE )
3151GAME( 1997, blitz,    0,        blitz,              blitz, seattle_state,    blitz,    ROT0, "Midway Games", "NFL Blitz (boot ROM 1.2)", GAME_SUPPORTS_SAVE )
3152GAME( 1997, blitz11,  blitz,    blitz,              blitz, seattle_state,    blitz,    ROT0, "Midway Games", "NFL Blitz (boot ROM 1.1)", GAME_SUPPORTS_SAVE )
3151GAME( 1997, blitz,    0,        blitz,             blitz, seattle_state,    blitz,    ROT0, "Midway Games", "NFL Blitz (boot ROM 1.2)", GAME_SUPPORTS_SAVE )
3152GAME( 1997, blitz11,  blitz,    blitz,             blitz, seattle_state,    blitz,    ROT0, "Midway Games", "NFL Blitz (boot ROM 1.1)", GAME_SUPPORTS_SAVE )
31533153GAME( 1998, blitz99,  0,        blitz99,           blitz99, seattle_state,  blitz99,  ROT0, "Midway Games", "NFL Blitz '99", GAME_SUPPORTS_SAVE )
31543154GAME( 1999, blitz2k,  0,        blitz2k,           blitz99, seattle_state,  blitz2k,  ROT0, "Midway Games", "NFL Blitz 2000 Gold Edition", GAME_SUPPORTS_SAVE )
31553155GAME( 1998, carnevil, 0,        carnevil,          carnevil, seattle_state, carnevil, ROT0, "Midway Games", "CarnEvil (v1.0.3)", GAME_SUPPORTS_SAVE )
trunk/src/mame/drivers/astinvad.c
r31373r31374
337337   // d4: bonus sound generator
338338   // d5: sound enabled
339339   // other bits: unused
340   
340
341341   int bits_gone_hi = data & ~m_sound_state[0];
342342   m_sound_state[0] = data;
343343
r31373r31374
347347   if (bits_gone_hi & 0x04) m_samples->start(2, SND_BASEHIT);
348348   if (bits_gone_hi & 0x08) m_samples->start(3, SND_INVADERHIT);
349349   if (bits_gone_hi & 0x10) m_samples->start(3, SND_INVADERHIT);
350   
350
351351   machine().sound().system_enable(data & 0x20);
352352}
353353
r31373r31374
671671   MCFG_I8255_OUT_PORTA_CB(WRITE8(astinvad_state, spcking2_sound1_w))
672672   MCFG_I8255_OUT_PORTB_CB(WRITE8(astinvad_state, spcking2_sound2_w))
673673   MCFG_I8255_OUT_PORTC_CB(WRITE8(astinvad_state, spcking2_sound3_w))
674   
674
675675   /* video hardware */
676676   MCFG_SCREEN_MODIFY("screen")
677677   MCFG_SCREEN_RAW_PARAMS(VIDEO_CLOCK, 320, 0, 256, 256, 16, 240)
trunk/src/mame/drivers/neogeo_noslot.c
r31373r31374
1010static ADDRESS_MAP_START( main_map_noslot, AS_PROGRAM, 16, neogeo_state )
1111   AM_RANGE(0x000000, 0x00007f) AM_READ(banked_vectors_r)
1212   AM_RANGE(0x000080, 0x0fffff) AM_ROM
13//   AM_RANGE(0x200000, 0x2fffff) AM_ROMBANK("cartridge")
14//   AM_RANGE(0x2ffff0, 0x2fffff) AM_WRITE(main_cpu_bank_select_w)
13//  AM_RANGE(0x200000, 0x2fffff) AM_ROMBANK("cartridge")
14//  AM_RANGE(0x2ffff0, 0x2fffff) AM_WRITE(main_cpu_bank_select_w)
1515   AM_IMPORT_FROM( neogeo_main_map )
1616ADDRESS_MAP_END
1717
r31373r31374
84808480 *
84818481 *************************************/
84828482
8483 // macros allow code below to be copy+pasted into slot devices more easily
8483   // macros allow code below to be copy+pasted into slot devices more easily
84848484#define cpuregion memregion("maincpu")->base()
84858485#define cpuregion_size memregion("maincpu")->bytes()
84868486#define spr_region memregion("sprites")->base()
r31373r31374
98249824/* N.C.I - LE CORTEX */
98259825// Bang Bang Busters (c)2010 - MVS?/AES
98269826// Treasure of the Caribbean (c)2011 - MVS?/AES
9827
trunk/src/mame/drivers/boogwing.c
r31373r31374
342342   MCFG_DECO16IC_SPLIT(0)
343343   MCFG_DECO16IC_WIDTH12(1)
344344   MCFG_DECO16IC_PF1_TRANS_MASK(0x0f)
345   MCFG_DECO16IC_PF2_TRANS_MASK(0x1f)   // pf2 has 5bpp graphics
345   MCFG_DECO16IC_PF2_TRANS_MASK(0x1f)  // pf2 has 5bpp graphics
346346   MCFG_DECO16IC_PF1_COL_BANK(0)
347   MCFG_DECO16IC_PF2_COL_BANK(0)   // pf2 is non default
347   MCFG_DECO16IC_PF2_COL_BANK(0)   // pf2 is non default
348348   MCFG_DECO16IC_PF1_COL_MASK(0x0f)
349349   MCFG_DECO16IC_PF2_COL_MASK(0x0f)
350350   // no bank1 callback
trunk/src/mame/drivers/hornet.c
r31373r31374
984984   MCFG_VOODOO_TMUMEM(4,0)
985985   MCFG_VOODOO_SCREEN_TAG("screen")
986986   MCFG_VOODOO_CPU_TAG("dsp")
987   MCFG_VOODOO_VBLANK_CB(WRITELINE(hornet_state,voodoo_vblank_0))   
987   MCFG_VOODOO_VBLANK_CB(WRITELINE(hornet_state,voodoo_vblank_0))
988988
989989   MCFG_DEVICE_ADD("k033906_1", K033906, 0)
990990   MCFG_K033906_VOODOO("voodoo0")
r31373r31374
10171017
10181018   MCFG_DEVICE_ADD("adc12138", ADC12138, 0)
10191019   MCFG_ADC1213X_IPT_CONVERT_CB(hornet_state, adc12138_input_callback)
1020   
1020
10211021   MCFG_DEVICE_ADD("konppc", KONPPC, 0)
10221022   MCFG_KONPPC_CGBOARD_NUMBER(1)
10231023   MCFG_KONPPC_CGBOARD_TYPE(CGBOARD_TYPE_HORNET)
r31373r31374
10631063   MCFG_K037122_PALETTE("palette")
10641064
10651065   MCFG_DEVICE_REMOVE("voodoo0")
1066   
1066
10671067   MCFG_DEVICE_ADD("voodoo0", VOODOO_1, STD_VOODOO_1_CLOCK)
10681068   MCFG_VOODOO_FBMEM(2)
10691069   MCFG_VOODOO_TMUMEM(4,0)
10701070   MCFG_VOODOO_SCREEN_TAG("lscreen")
10711071   MCFG_VOODOO_CPU_TAG("dsp")
1072   MCFG_VOODOO_VBLANK_CB(WRITELINE(hornet_state,voodoo_vblank_0))   
1073   
1072   MCFG_VOODOO_VBLANK_CB(WRITELINE(hornet_state,voodoo_vblank_0))
1073
10741074   MCFG_DEVICE_ADD("voodoo1", VOODOO_1, STD_VOODOO_1_CLOCK)
10751075   MCFG_VOODOO_FBMEM(2)
10761076   MCFG_VOODOO_TMUMEM(4,0)
10771077   MCFG_VOODOO_SCREEN_TAG("rscreen")
10781078   MCFG_VOODOO_CPU_TAG("dsp2")
1079   MCFG_VOODOO_VBLANK_CB(WRITELINE(hornet_state,voodoo_vblank_1))   
1079   MCFG_VOODOO_VBLANK_CB(WRITELINE(hornet_state,voodoo_vblank_1))
10801080
10811081   MCFG_DEVICE_ADD("k033906_2", K033906, 0)
10821082   MCFG_K033906_VOODOO("voodoo1")
r31373r31374
10981098   MCFG_SCREEN_SIZE(512, 384)
10991099   MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383)
11001100   MCFG_SCREEN_UPDATE_DRIVER(hornet_state, screen_update_hornet_2board)
1101   
1101
11021102   MCFG_DEVICE_REMOVE("konppc")
11031103   MCFG_DEVICE_ADD("konppc", KONPPC, 0)
11041104   MCFG_KONPPC_CGBOARD_NUMBER(2)
r31373r31374
11181118   MCFG_VOODOO_TMUMEM(4,0)
11191119   MCFG_VOODOO_SCREEN_TAG("lscreen")
11201120   MCFG_VOODOO_CPU_TAG("dsp")
1121   MCFG_VOODOO_VBLANK_CB(WRITELINE(hornet_state,voodoo_vblank_0))   
1122   
1121   MCFG_VOODOO_VBLANK_CB(WRITELINE(hornet_state,voodoo_vblank_0))
1122
11231123   MCFG_DEVICE_REMOVE("voodoo1")
11241124   MCFG_DEVICE_ADD("voodoo1", VOODOO_2, STD_VOODOO_2_CLOCK)
11251125   MCFG_VOODOO_FBMEM(2)
11261126   MCFG_VOODOO_TMUMEM(4,0)
11271127   MCFG_VOODOO_SCREEN_TAG("rscreen")
11281128   MCFG_VOODOO_CPU_TAG("dsp2")
1129   MCFG_VOODOO_VBLANK_CB(WRITELINE(hornet_state,voodoo_vblank_1))     
1129   MCFG_VOODOO_VBLANK_CB(WRITELINE(hornet_state,voodoo_vblank_1))
11301130MACHINE_CONFIG_END
11311131
11321132static MACHINE_CONFIG_DERIVED( sscope2, hornet_2board_v2)
trunk/src/mame/drivers/mustache.c
r31373r31374
192192   MCFG_PALETTE_INIT_OWNER(mustache_state, mustache)
193193
194194   /* sound hardware */
195   MCFG_DEVICE_ADD("seibu_sound", SEIBU_SOUND, 0)   // for seibu_sound_decrypt on the MAIN cpu (not sound)
195   MCFG_DEVICE_ADD("seibu_sound", SEIBU_SOUND, 0)  // for seibu_sound_decrypt on the MAIN cpu (not sound)
196196
197197   MCFG_SPEAKER_STANDARD_MONO("mono")
198198
trunk/src/mame/drivers/statriv2.c
r31373r31374
582582
583583   MCFG_DEVICE_ADD("ppi8255", I8255A, 0)
584584   /* PPI 8255 group A & B set to Mode 0.
585     Port A, B and lower 4 bits of C set as Input.
586     High 4 bits of C set as Output */
585    Port A, B and lower 4 bits of C set as Input.
586    High 4 bits of C set as Output */
587587   MCFG_I8255_IN_PORTA_CB(IOPORT("IN0"))
588588   MCFG_I8255_IN_PORTB_CB(IOPORT("IN1"))
589589   MCFG_I8255_IN_PORTC_CB(IOPORT("IN2"))
trunk/src/mame/drivers/midas.c
r31373r31374
1616    VRAM        256kbyte (4Display/Access bank)
1717
1818    PaletteRAM  96kbyte
19   
19
2020    Display     320(x)*224(y)
2121
2222    Sprite      16(x)*240(y(max))*380(max) (96 sprite/line(max))
r31373r31374
605605
606606void midas_state::machine_reset()
607607{
608
609608}
610609
611   
612610
613611
612
614613WRITE_LINE_MEMBER(midas_state::livequiz_irqhandler)
615614{
616615   logerror("YMZ280 is generating an interrupt. State=%08x\n",state);
trunk/src/mame/drivers/kingpin.c
r31373r31374
152152   /* video hardware */
153153   MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 )
154154   MCFG_TMS9928A_VRAM_SIZE(0x4000)
155   MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(kingpin_state, vdp_interrupt))   
156   
155   MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(kingpin_state, vdp_interrupt))
156
157157   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
158158   MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update )
159159
trunk/src/mame/drivers/sanremo.c
r31373r31374
358358
359359   MCFG_MC6845_ADD("crtc", MC6845, "screen", CRTC_CLOCK)
360360   // *** MC6845 init ***
361   //
361   //
362362   // Register:   00    01    02    03    04    05    06    07    08    09    10    11    12    13    14    15    16    17
363363   // Value:     0x45  0x30  0x36  0x0A  0x28  0x00  0x26  0x27  0x00  0x07  0x20  0x0B  0x00  0x00  0x00  0x00  0x00  0x00.
364364   MCFG_MC6845_SHOW_BORDER_AREA(false)
trunk/src/mame/drivers/wpc_95.c
r31373r31374
1818public:
1919   wpc_95_state(const machine_config &mconfig, device_type type, const char *tag)
2020      : driver_device(mconfig, type, tag),
21        maincpu(*this, "maincpu"),
22        dcs(*this, "dcs"),
23        rombank(*this, "rombank"),
24        mainram(*this, "mainram"),
25        nvram(*this, "nvram"),
26        pic(*this, "pic"),
27        lamp(*this, "lamp"),
28        out(*this, "out")
21         maincpu(*this, "maincpu"),
22         dcs(*this, "dcs"),
23         rombank(*this, "rombank"),
24         mainram(*this, "mainram"),
25         nvram(*this, "nvram"),
26         pic(*this, "pic"),
27         lamp(*this, "lamp"),
28         out(*this, "out")
2929   { }
3030
3131   DECLARE_WRITE8_MEMBER(bank_w);
r31373r31374
509509
510510static INPUT_PORTS_START( afm )
511511   PORT_START("SW.0")
512    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
513    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
514    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
515    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
516    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
517    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
518    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
519    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
512   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
513   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
514   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
515   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
516   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
517   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
518   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
519   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
520520
521521   PORT_START("SW.1")
522    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
523    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
524    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
525    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
526    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
527    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
528    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
529    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
522   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
523   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
524   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
525   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
526   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
527   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
528   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
529   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
530530
531531   PORT_START("SW.2")
532    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
533    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
534    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
535    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
536    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
537    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
538    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
539    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
532   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
533   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
534   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
535   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
536   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
537   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
538   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
539   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
540540
541541   PORT_START("SW.3")
542    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
543    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
544    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IAN")
545    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
546    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
547    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
548    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
549    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
542   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
543   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
544   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IAN")
545   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
546   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
547   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
548   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
549   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
550550
551551   PORT_START("SW.4")
552    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
553    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
554    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
555    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
556    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
557    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
558    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
559    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
552   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
553   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
554   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
555   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
556   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
557   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
558   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
559   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
560560
561561   PORT_START("SW.5")
562    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
563    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
564    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
565    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
566    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
567    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
568    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
569    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
562   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
563   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
564   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
565   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
566   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
567   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
568   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
569   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
570570
571571   PORT_START("SW.6")
572    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
573    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
574    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
575    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
576    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
577    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
578    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
579    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
572   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
573   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
574   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
575   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
576   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
577   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
578   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
579   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
580580
581581   PORT_START("SW.7")
582    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
582   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
583583
584584   PORT_START("DOOR")
585    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
586    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
587    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
588    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
589    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
590    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
591    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
592    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
585   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
586   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
587   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
588   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
589   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
590   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
591   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
592   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
593593
594594   PORT_START("DSW")
595595   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
600600   PORT_DIPSETTING(   0xec, "Spain")
601601
602602   PORT_START("FLIPPERS")
603    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
604    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
605    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
606    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
607    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
608    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
609    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
610    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
603   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
604   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
605   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
606   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
607   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
608   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
609   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
610   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
611611INPUT_PORTS_END
612612
613613const char *const wpc_95_state::lamps_cc[64] = {
r31373r31374
634634
635635static INPUT_PORTS_START( cc )
636636   PORT_START("SW.0")
637    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
638    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
639    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
640    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
641    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Mine entrance")
642    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
643    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R return")
644    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
637   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
638   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
639   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
640   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
641   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Mine entrance")
642   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
643   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R return")
644   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
645645
646646   PORT_START("SW.1")
647    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
648    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
649    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
650    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
651    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
652    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L return")
653    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
654    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R standup (bot)")
647   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
648   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
649   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
650   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
651   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
652   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L return")
653   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
654   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R standup (bot)")
655655
656656   PORT_START("SW.2")
657    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
658    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
659    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
660    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
661    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
662    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L loop bottom")
663    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Rt loop bottom")
664    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
657   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
658   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
659   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
660   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
661   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
662   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L loop bottom")
663   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Rt loop bottom")
664   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
665665
666666   PORT_START("SW.3")
667    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Mine popper")
668    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Saloon popper")
669    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
670    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R standup (top)")
671    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
672    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Beer mug switch")
673    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L bonus X lane")
674    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Jet exit")
667   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Mine popper")
668   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Saloon popper")
669   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
670   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R standup (top)")
671   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
672   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Beer mug switch")
673   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L bonus X lane")
674   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Jet exit")
675675
676676   PORT_START("SW.4")
677    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L slingshot")
678    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R slingshot")
679    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
680    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
681    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
682    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop top")
683    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R bonus X lane")
684    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop top")
677   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L slingshot")
678   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R slingshot")
679   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
680   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
681   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
682   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop top")
683   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R bonus X lane")
684   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop top")
685685
686686   PORT_START("SW.5")
687    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop #1 (L)")
688    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop #2 (LC)")
689    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop #3 (RC)")
690    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop #4 (R)")
691    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp make")
692    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
693    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Skill bowl")
694    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bot R ramp")
687   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop #1 (L)")
688   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop #2 (LC)")
689   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop #3 (RC)")
690   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop #4 (R)")
691   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp make")
692   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
693   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Skill bowl")
694   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bot R ramp")
695695
696696   PORT_START("SW.6")
697    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Train encoder")
698    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Train home")
699    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Saloon gate")
700    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
701    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Saloon bart toy")
702    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
703    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Mine home")
704    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Mine encoder")
697   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Train encoder")
698   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Train home")
699   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Saloon gate")
700   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
701   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Saloon bart toy")
702   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
703   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Mine home")
704   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Mine encoder")
705705
706706   PORT_START("SW.7")
707707   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
708    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
709    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp make")
710    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp make")
711    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
712    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L standup (top)")
713    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L standup (bot)")
708   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
709   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp make")
710   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp make")
711   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
712   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L standup (top)")
713   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L standup (bot)")
714714   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
715715
716716   PORT_START("DOOR")
717    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
718    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
719    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
720    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
721    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
722    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
723    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
724    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
717   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
718   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
719   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
720   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
721   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
722   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
723   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
724   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
725725
726726   PORT_START("DSW")
727727   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
732732   PORT_DIPSETTING(   0xec, "Spain")
733733
734734   PORT_START("FLIPPERS")
735    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
736    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
737    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
738    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
739    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
740    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
741    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
742    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
735   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
736   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
737   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
738   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
739   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
740   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
741   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
742   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
743743INPUT_PORTS_END
744744
745745const char *const wpc_95_state::lamps_cv[64] = {
r31373r31374
766766
767767static INPUT_PORTS_START( cv )
768768   PORT_START("SW.0")
769    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Back box luck")
770    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Wire ramp enter")
771    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
772    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
773    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop upper")
774    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top Eddy")
775    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right inlane")
776    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
769   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Back box luck")
770   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Wire ramp enter")
771   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
772   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
773   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop upper")
774   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top Eddy")
775   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right inlane")
776   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
777777
778778   PORT_START("SW.1")
779    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
780    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
781    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop upper")
782    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
783    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop left")
784    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left inlane")
785    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
786    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop right")
779   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
780   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
781   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop upper")
782   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
783   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop left")
784   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left inlane")
785   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
786   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop right")
787787
788788   PORT_START("SW.2")
789    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
790    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
791    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
792    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
793    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
794    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Poppor opto")
795    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"WOW\" targets")
796    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top targets")
789   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
790   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
791   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
792   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
793   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
794   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Poppor opto")
795   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"WOW\" targets")
796   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top targets")
797797
798798   PORT_START("SW.3")
799    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left lane")
800    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ringmaster up")
801    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ringmaster mid")
802    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ringmaster down")
803    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp made")
804    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Trough upper")
805    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Trough middle")
806    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop enter")
799   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left lane")
800   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ringmaster up")
801   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ringmaster mid")
802   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ringmaster down")
803   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp made")
804   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Trough upper")
805   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Trough middle")
806   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop enter")
807807
808808   PORT_START("SW.4")
809    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left sling")
810    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right sling")
811    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Upper jet")
812    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle jet")
813    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lower jet")
814    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Skill shot")
815    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
816    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ring 'N', 'G'")
809   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left sling")
810   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right sling")
811   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Upper jet")
812   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle jet")
813   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lower jet")
814   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Skill shot")
815   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
816   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ring 'N', 'G'")
817817
818818   PORT_START("SW.5")
819    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Light\" standup")
820    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Lock\" standup")
821    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp enter")
822    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp magnet")
823    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp made")
824    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp lock low")
825    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp lock mid")
826    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp lock high")
819   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Light\" standup")
820   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Lock\" standup")
821   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp enter")
822   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp magnet")
823   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp made")
824   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp lock low")
825   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp lock mid")
826   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp lock high")
827827
828828   PORT_START("SW.6")
829    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left saucer")
830    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right saucer")
831    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
832    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Big ball rebound")
833    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Volt\" right")
834    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Volt\" left")
835    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
836    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
829   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left saucer")
830   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right saucer")
831   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
832   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Big ball rebound")
833   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Volt\" right")
834   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Volt\" left")
835   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
836   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
837837
838838   PORT_START("SW.7")
839    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
839   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
840840
841841   PORT_START("DOOR")
842    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
843    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
844    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
845    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
846    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
847    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
848    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
849    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
842   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
843   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
844   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
845   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
846   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
847   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
848   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
849   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
850850
851851   PORT_START("DSW")
852852   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
857857   PORT_DIPSETTING(   0xec, "Spain")
858858
859859   PORT_START("FLIPPERS")
860    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
861    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
862    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
863    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
864    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right spinner")
865    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
866    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left spinner")
867    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
860   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
861   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
862   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
863   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
864   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right spinner")
865   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
866   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left spinner")
867   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
868868INPUT_PORTS_END
869869
870870const char *const wpc_95_state::lamps_congo[64] = {
r31373r31374
891891
892892static INPUT_PORTS_START( congo )
893893   PORT_START("SW.0")
894    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner left loop")
895    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Upper loop")
896    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
897    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
898    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Jet exit")
899    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
900    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rt return lane")
901    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
894   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner left loop")
895   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Upper loop")
896   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
897   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
898   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Jet exit")
899   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
900   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rt return lane")
901   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
902902
903903   PORT_START("SW.1")
904    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
905    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
906    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
907    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
908    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rt eject rubber")
909    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lt return lane")
910    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
911    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"You\" standup")
904   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
905   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
906   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
907   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
908   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rt eject rubber")
909   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lt return lane")
910   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
911   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"You\" standup")
912912
913913   PORT_START("SW.2")
914    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
915    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
916    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
917    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
918    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
919    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Volcano stack")
920    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Mystery\" eject")
921    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right eject")
914   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
915   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
916   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
917   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
918   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
919   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Volcano stack")
920   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Mystery\" eject")
921   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right eject")
922922
923923   PORT_START("SW.3")
924    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lock ball 1")
925    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lock ball 2")
926    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lock ball 3")
927    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Mine shaft\"")
928    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
929    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left bank top")
930    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left bank center")
931    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left bank bottom")
924   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lock ball 1")
925   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lock ball 2")
926   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lock ball 3")
927   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Mine shaft\"")
928   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
929   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left bank top")
930   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left bank center")
931   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left bank bottom")
932932
933933   PORT_START("SW.4")
934    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Travi\"")
935    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Com\"")
936    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("2-way popper")
937    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"We are\" standup")
938    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Watching\" standup")
939    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Perimeter def\"")
940    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp enter")
941    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp exit")
934   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Travi\"")
935   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Com\"")
936   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("2-way popper")
937   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"We are\" standup")
938   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Watching\" standup")
939   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"Perimeter def\"")
940   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp enter")
941   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp exit")
942942
943943   PORT_START("SW.5")
944    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
945    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
946    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
947    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
948    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
949    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
950    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp enter")
951    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp exit")
944   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
945   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
946   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
947   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
948   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
949   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
950   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp enter")
951   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp exit")
952952
953953   PORT_START("SW.6")
954    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("(A)MY")
955    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("A(M)Y")
956    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("AM(Y)")
957    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("(C)ONGO")
958    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C(O)NGO")
959    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("CO(N)GO")
960    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("CON(G)O")
961    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("CONG(O)")
954   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("(A)MY")
955   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("A(M)Y")
956   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("AM(Y)")
957   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("(C)ONGO")
958   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C(O)NGO")
959   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("CO(N)GO")
960   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("CON(G)O")
961   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("CONG(O)")
962962
963963   PORT_START("SW.7")
964    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
964   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
965965
966966   PORT_START("DOOR")
967    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
968    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
969    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
970    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
971    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
972    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
973    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
974    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
967   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
968   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
969   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
970   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
971   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
972   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
973   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
974   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
975975
976976   PORT_START("DSW")
977977   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
982982   PORT_DIPSETTING(   0xec, "Spain")
983983
984984   PORT_START("FLIPPERS")
985    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
986    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
987    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
988    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
989    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
990    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
991    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper EOS")
992    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
985   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
986   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
987   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
988   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
989   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
990   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
991   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper EOS")
992   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
993993INPUT_PORTS_END
994994
995995const char *const wpc_95_state::lamps_jy[64] = {
r31373r31374
10161016
10171017static INPUT_PORTS_START( jy )
10181018   PORT_START("SW.0")
1019    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toaster gun")
1020    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rebound sw")
1021    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1022    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1023    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top left crane")
1024    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1025    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return lane")
1026    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1019   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Toaster gun")
1020   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rebound sw")
1021   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1022   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1023   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top left crane")
1024   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1025   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return lane")
1026   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
10271027
10281028   PORT_START("SW.1")
1029    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1030    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1031    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1032    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1033    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1034    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rght return lane")
1035    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1036    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Crane down")
1029   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1030   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1031   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1032   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1033   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1034   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rght return lane")
1035   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1036   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Crane down")
10371037
10381038   PORT_START("SW.2")
1039    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1040    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1041    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1042    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1043    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1044    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lock up 2")
1045    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lock up 1")
1046    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top right crane")
1039   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1040   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1041   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1042   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1043   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1044   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lock up 2")
1045   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lock up 1")
1046   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top right crane")
10471047
10481048   PORT_START("SW.3")
1049    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Past spinner")
1050    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("In the sewer")
1051    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lock jam")
1052    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Past crane")
1053    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp exit")
1054    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Car targ 1 left")
1055    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Car targ 2")
1056    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Car targ 3")
1049   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Past spinner")
1050   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("In the sewer")
1051   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lock jam")
1052   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Past crane")
1053   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp exit")
1054   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Car targ 1 left")
1055   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Car targ 2")
1056   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Car targ 3")
10571057
10581058   PORT_START("SW.4")
1059    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left sling")
1060    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right sling")
1061    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Car targ 4")
1062    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Car targ 5 rght")
1063    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1064    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L L 3 bank bot")
1065    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L L 3 bank mid")
1066    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L L 3 bank top")
1059   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left sling")
1060   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right sling")
1061   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Car targ 4")
1062   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Car targ 5 rght")
1063   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1064   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L L 3 bank bot")
1065   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L L 3 bank mid")
1066   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L L 3 bank top")
10671067
10681068   PORT_START("SW.5")
1069    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U R 3 bank bot")
1070    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U R 3 bank mid")
1071    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U R 3 bank top")
1072    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U L 3 bank bot")
1073    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U L 3 bank mid")
1074    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U L 3 bank top")
1075    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bowl entry")
1076    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bowl exit")
1069   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U R 3 bank bot")
1070   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U R 3 bank mid")
1071   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U R 3 bank top")
1072   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U L 3 bank bot")
1073   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U L 3 bank mid")
1074   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U L 3 bank top")
1075   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bowl entry")
1076   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bowl exit")
10771077
10781078   PORT_START("SW.6")
1079    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp entry")
1080    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Scoop down")
1081    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Scoop made")
1082    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Dog entry")
1083    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1084    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R 3 bank bottom")
1085    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R 3 bank middle")
1086    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R 3 bank top")
1079   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp entry")
1080   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Scoop down")
1081   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Scoop made")
1082   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Dog entry")
1083   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1084   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R 3 bank bottom")
1085   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R 3 bank middle")
1086   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R 3 bank top")
10871087
10881088   PORT_START("SW.7")
1089    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1089   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
10901090
10911091   PORT_START("DOOR")
1092    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1093    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1094    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1095    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1096    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1097    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1098    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1099    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1092   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1093   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1094   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1095   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1096   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1097   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1098   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1099   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
11001100
11011101   PORT_START("DSW")
11021102   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
11071107   PORT_DIPSETTING(   0xec, "Spain")
11081108
11091109   PORT_START("FLIPPERS")
1110    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1111    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1112    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1113    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1114    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Spinner")
1115    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1116    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1117    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1110   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1111   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1112   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1113   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1114   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Spinner")
1115   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1116   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1117   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
11181118INPUT_PORTS_END
11191119
11201120const char *const wpc_95_state::lamps_mm[64] = {
r31373r31374
11411141
11421142static INPUT_PORTS_START( mm )
11431143   PORT_START("SW.0")
1144    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1145    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Catapult target")
1146    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1147    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1148    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L troll target")
1149    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1150    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1151    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1144   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1145   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Catapult target")
1146   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1147   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1148   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L troll target")
1149   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1150   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1151   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
11521152
11531153   PORT_START("SW.1")
1154    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1155    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1156    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1157    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1158    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R troll target")
1159    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1160    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1161    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right eject")
1154   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1155   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1156   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1157   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1158   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R troll target")
1159   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1160   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1161   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right eject")
11621162
11631163   PORT_START("SW.2")
1164    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1165    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1166    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1167    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1168    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1169    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1170    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Castle gate")
1171    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Catapult")
1164   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1165   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1166   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1167   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1168   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1169   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
1170   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Castle gate")
1171   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Catapult")
11721172
11731173   PORT_START("SW.3")
1174    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Moat enter")
1175    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1176    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1177    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Castle lock")
1178    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L troll (U/pfld)")
1179    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R troll (U/pfld)")
1180    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
1181    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
1174   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Moat enter")
1175   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
1176   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1177   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Castle lock")
1178   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L troll (U/pfld)")
1179   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R troll (U/pfld)")
1180   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
1181   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
11821182
11831183   PORT_START("SW.4")
1184    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1185    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1186    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1187    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1188    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1189    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drawbridge up")
1190    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drawbridge down")
1191    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Tower exit")
1184   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1185   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1186   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1187   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1188   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1189   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drawbridge up")
1190   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drawbridge down")
1191   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Tower exit")
11921192
11931193   PORT_START("SW.5")
1194    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1195    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1196    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1197    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1198    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1199    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1200    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1201    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1194   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1195   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1196   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1197   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1198   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1199   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1200   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1201   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
12021202
12031203   PORT_START("SW.6")
1204    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right bank top")
1205    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right bank mid")
1206    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right bank bot")
1207    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L troll up")
1208    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R troll up")
1209    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
1210    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1211    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1204   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right bank top")
1205   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right bank mid")
1206   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right bank bot")
1207   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L troll up")
1208   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R troll up")
1209   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
1210   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1211   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
12121212
12131213   PORT_START("SW.7")
1214    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1214   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
12151215
12161216   PORT_START("DOOR")
1217    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1218    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1219    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1220    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1221    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1222    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1223    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1224    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1217   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1218   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1219   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1220   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1221   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1222   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1223   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1224   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
12251225
12261226   PORT_START("DSW")
12271227   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
12321232   PORT_DIPSETTING(   0xec, "Spain")
12331233
12341234   PORT_START("FLIPPERS")
1235    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1236    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1237    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1238    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1239    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1240    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1241    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1242    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1235   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1236   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1237   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1238   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1239   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1240   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1241   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1242   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
12431243INPUT_PORTS_END
12441244
12451245const char *const wpc_95_state::lamps_mb[64] = {
r31373r31374
12661266
12671267static INPUT_PORTS_START( mb )
12681268   PORT_START("SW.0")
1269    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1270    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac standup top")
1271    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1272    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1273    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac standup bot")
1274    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1275    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1276    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1269   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1270   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac standup top")
1271   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1272   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1273   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac standup bot")
1274   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1275   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1276   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
12771277
12781278   PORT_START("SW.1")
1279    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1280    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1281    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Tomb treasure")
1282    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1283    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Dracula target")
1284    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1285    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1286    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left eject")
1279   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1280   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1281   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Tomb treasure")
1282   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1283   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Dracula target")
1284   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1285   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1286   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left eject")
12871287
12881288   PORT_START("SW.2")
1289    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1290    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1291    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1292    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1293    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1294    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1295    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1296    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1289   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1290   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1291   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1292   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1293   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1294   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1295   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1296   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
12971297
12981298   PORT_START("SW.3")
1299    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
1300    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L flip opto")
1301    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R flip opto")
1302    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L blue tgt")
1303    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C blue tgt")
1304    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R blue tgt")
1305    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L flip prox")
1306    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R flip prox")
1299   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
1300   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L flip opto")
1301   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R flip opto")
1302   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L blue tgt")
1303   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C blue tgt")
1304   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R blue tgt")
1305   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L flip prox")
1306   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R flip prox")
13071307
13081308   PORT_START("SW.4")
1309    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1310    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1311    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1312    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1313    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1314    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
1315    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle top lane")
1316    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
1309   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1310   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1311   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1312   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1313   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1314   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
1315   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle top lane")
1316   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
13171317
13181318   PORT_START("SW.5")
1319    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1320    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1321    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1322    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1323    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center loop")
1324    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1325    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1326    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
1319   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
1320   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
1321   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
1322   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
1323   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center loop")
1324   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
1325   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
1326   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
13271327
13281328   PORT_START("SW.6")
1329    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1330    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1331    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp lock")
1332    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac position 5")
1333    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac position 4")
1334    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac position 3")
1335    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac position 2")
1336    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac position 1")
1329   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
1330   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
1331   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp lock")
1332   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac position 5")
1333   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac position 4")
1334   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac position 3")
1335   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac position 2")
1336   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drac position 1")
13371337
13381338   PORT_START("SW.7")
1339    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Up/dn bank up")
1340    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Up/dn bank down")
1341    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Frank table down")
1342    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Frank table up")
1343    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L up/dn bank tgt")
1344    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R up/dn bank tgt")
1345    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Frank hit")
1346    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1339   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Up/dn bank up")
1340   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Up/dn bank down")
1341   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Frank table down")
1342   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Frank table up")
1343   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L up/dn bank tgt")
1344   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R up/dn bank tgt")
1345   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Frank hit")
1346   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
13471347
13481348   PORT_START("DOOR")
1349    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1350    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1351    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1352    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1353    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1354    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1355    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1356    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1349   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1350   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1351   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1352   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1353   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1354   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1355   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1356   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
13571357
13581358   PORT_START("DSW")
13591359   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
13641364   PORT_DIPSETTING(   0xec, "Spain")
13651365
13661366   PORT_START("FLIPPERS")
1367    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1368    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1369    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1370    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1371    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1372    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1373    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Center spinner")
1374    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1367   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1368   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1369   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1370   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1371   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1372   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1373   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Center spinner")
1374   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
13751375INPUT_PORTS_END
13761376
13771377const char *const wpc_95_state::lamps_nbaf[64] = {
r31373r31374
13981398
13991399static INPUT_PORTS_START( nbaf )
14001400   PORT_START("SW.0")
1401    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1402    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Backbos basket")
1403    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1404    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1405    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shhoter lane")
1406    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lt return lane")
1407    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rt return lane")
1408    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L R standup")
1401   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
1402   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Backbos basket")
1403   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1404   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1405   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shhoter lane")
1406   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lt return lane")
1407   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rt return lane")
1408   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L R standup")
14091409
14101410   PORT_START("SW.1")
1411    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1412    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1413    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1414    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1415    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Eject hole")
1416    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1417    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1418    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U R standup")
1411   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1412   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1413   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1414   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1415   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Eject hole")
1416   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1417   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1418   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("U R standup")
14191419
14201420   PORT_START("SW.2")
1421    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1422    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1423    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1424    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1425    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1426    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Center ramp opto")
1427    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R loop ent opto")
1428    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop exit")
1421   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1422   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1423   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1424   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1425   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1426   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Center ramp opto")
1427   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R loop ent opto")
1428   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop exit")
14291429
14301430   PORT_START("SW.3")
1431    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup '3'")
1432    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 'P'")
1433    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 'T'")
1434    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp enter")
1435    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp enter")
1436    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp made")
1437    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop enter")
1438    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop made")
1431   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup '3'")
1432   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 'P'")
1433   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Standup 'T'")
1434   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp enter")
1435   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp enter")
1436   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp made")
1437   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop enter")
1438   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop made")
14391439
14401440   PORT_START("SW.4")
1441    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Defender pos 4")
1442    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Defender pos 4")
1443    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Defender lock pos")
1444    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Defender pos 2")
1445    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Defender pos 1")
1446    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Jets ball drain")
1447    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L slingshot")
1448    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R slingshot")
1441   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Defender pos 4")
1442   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Defender pos 4")
1443   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Defender lock pos")
1444   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Defender pos 2")
1445   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Defender pos 1")
1446   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Jets ball drain")
1447   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L slingshot")
1448   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R slingshot")
14491449
14501450   PORT_START("SW.5")
1451    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1452    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle jet")
1453    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L loop ramp exit")
1454    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp made")
1455    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"In the paint\" 4")
1456    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"In the paint\" 3")
1457    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"In the paint\" 2")
1458    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"In the paint\" 1")
1451   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1452   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle jet")
1453   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L loop ramp exit")
1454   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp made")
1455   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"In the paint\" 4")
1456   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"In the paint\" 3")
1457   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"In the paint\" 2")
1458   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"In the paint\" 1")
14591459
14601460   PORT_START("SW.6")
1461    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1461   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
14621462
14631463   PORT_START("SW.7")
1464    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1464   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
14651465
14661466   PORT_START("DOOR")
1467    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1468    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1469    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1470    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1471    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1472    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1473    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1474    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1467   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1468   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1469   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1470   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1471   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1472   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1473   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1474   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
14751475
14761476   PORT_START("DSW")
14771477   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
14821482   PORT_DIPSETTING(   0xec, "Spain")
14831483
14841484   PORT_START("FLIPPERS")
1485    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1486    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1487    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1488    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1489    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Basket made")
1490    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1491    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Basket hold")
1492    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1485   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1486   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1487   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1488   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1489   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Basket made")
1490   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1491   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Basket hold")
1492   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
14931493INPUT_PORTS_END
14941494
14951495const char *const wpc_95_state::lamps_ngg[64] = {
r31373r31374
15161516
15171517static INPUT_PORTS_START( ngg )
15181518   PORT_START("SW.0")
1519    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
1520    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp make")
1521    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1522    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1523    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center ramp make")
1524    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1525    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right inlane")
1526    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter groove")
1519   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
1520   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp make")
1521   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1522   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1523   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center ramp make")
1524   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1525   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right inlane")
1526   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter groove")
15271527
15281528   PORT_START("SW.1")
1529    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1530    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1531    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Jet adv standup")
1532    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1533    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Underground pass")
1534    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left inlane")
1535    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1536    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Kickback")
1529   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1530   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1531   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Jet adv standup")
1532   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1533   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Underground pass")
1534   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left inlane")
1535   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1536   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Kickback")
15371537
15381538   PORT_START("SW.2")
1539    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1540    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1541    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1542    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1543    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1544    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 5")
1545    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 6")
1546    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Jet popper")
1539   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1540   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1541   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1542   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1543   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1544   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 5")
1545   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 6")
1546   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Jet popper")
15471547
15481548   PORT_START("SW.3")
1549    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L gofer down")
1550    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R gofer down")
1551    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1552    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Putt out popper")
1553    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Rt popper jam")
1554    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1555    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp down")
1556    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp down")
1549   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L gofer down")
1550   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R gofer down")
1551   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1552   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Putt out popper")
1553   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Rt popper jam")
1554   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1555   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left ramp down")
1556   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp down")
15571557
15581558   PORT_START("SW.4")
1559    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1560    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1561    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top jet")
1562    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle jet")
1563    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1564    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top skill shot")
1565    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Mid skill shot")
1566    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lower skill shot")
1559   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1560   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1561   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top jet")
1562   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle jet")
1563   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
1564   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top skill shot")
1565   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Mid skill shot")
1566   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lower skill shot")
15671567
15681568   PORT_START("SW.5")
1569    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left spinner")
1570    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right spinner")
1571    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner wheel opto")
1572    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Outer wheel opto")
1573    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left gofer 1")
1574    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left gofer 2")
1575    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Behind L gofer")
1576    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hole in 1 made")
1569   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left spinner")
1570   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right spinner")
1571   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner wheel opto")
1572   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Outer wheel opto")
1573   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left gofer 1")
1574   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left gofer 2")
1575   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Behind L gofer")
1576   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Hole in 1 made")
15771577
15781578   PORT_START("SW.6")
1579    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left cart path")
1580    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right cart path")
1581    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp make")
1582    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Golf cart")
1583    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right gofer 1")
1584    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right gofer 2")
1585    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Adv trap value")
1586    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Sand trap eject")
1579   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left cart path")
1580   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right cart path")
1581   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right ramp make")
1582   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Golf cart")
1583   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right gofer 1")
1584   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right gofer 2")
1585   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Adv trap value")
1586   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Sand trap eject")
15871587
15881588   PORT_START("SW.7")
1589    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("K-I-C-K advance")
1590    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("(K)ICK")
1591    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("K(I)CK")
1592    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("KI(C)K")
1593    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("KIC(K)")
1594    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Captive ball")
1595    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1596    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
1589   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("K-I-C-K advance")
1590   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("(K)ICK")
1591   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("K(I)CK")
1592   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("KI(C)K")
1593   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("KIC(K)")
1594   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Captive ball")
1595   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1596   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
15971597
15981598   PORT_START("DOOR")
1599    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1600    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1601    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1602    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1603    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1604    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1605    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1606    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1599   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1600   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1601   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1602   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1603   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1604   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1605   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1606   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
16071607
16081608   PORT_START("DSW")
16091609   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
16141614   PORT_DIPSETTING(   0xec, "Spain")
16151615
16161616   PORT_START("FLIPPERS")
1617    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1618    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1619    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1620    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1621    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper EOS")
1622    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1623    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1617   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1618   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1619   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1620   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1621   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper EOS")
1622   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1623   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
16241624INPUT_PORTS_END
16251625
16261626const char *const wpc_95_state::lamps_sc[64] = {
r31373r31374
16561656
16571657static INPUT_PORTS_START( sc )
16581658   PORT_START("SW.0")
1659    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("TP trough (roof)")
1660    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("TP trough (move)")
1661    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1662    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1663    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right orbit")
1664    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1665    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1666    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ballshooter")
1659   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("TP trough (roof)")
1660   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("TP trough (move)")
1661   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1662   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1663   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right orbit")
1664   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1665   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1666   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ballshooter")
16671667
16681668   PORT_START("SW.1")
1669    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1670    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1671    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1672    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1673    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("UR flip rollover")
1674    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1675    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1676    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left orbit")
1669   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1670   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1671   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1672   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1673   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("UR flip rollover")
1674   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
1675   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
1676   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left orbit")
16771677
16781678   PORT_START("SW.2")
1679    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1680    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1681    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1682    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1683    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1684    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lockup 1 front")
1685    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lockup 2 rear")
1686    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1679   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1680   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1681   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1682   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1683   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1684   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lockup 1 front")
1685   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Lockup 2 rear")
1686   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
16871687
16881688   PORT_START("SW.3")
1689    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Kickback")
1690    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left big kick")
1691    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Tokn chute exit")
1692    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1693    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1694    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top jet")
1695    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1696    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1689   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Kickback")
1690   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left big kick")
1691   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Tokn chute exit")
1692   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1693   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1694   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top jet")
1695   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1696   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
16971697
16981698   PORT_START("SW.4")
1699    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("(A)LARM standup")
1700    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("A(L)ARM standup")
1701    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("AL(A)RM standup")
1702    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("ALA(R)M standup")
1703    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("ALAR(M) standup")
1704    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Movng target C")
1705    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Movng target B")
1706    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Movng target A")
1699   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("(A)LARM standup")
1700   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("A(L)ARM standup")
1701   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("AL(A)RM standup")
1702   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("ALA(R)M standup")
1703   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("ALAR(M) standup")
1704   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Movng target C")
1705   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Movng target B")
1706   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Movng target A")
17071707
17081708   PORT_START("SW.5")
1709    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL 3bank top")
1710    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL 3bank middle")
1711    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL 3bank bottom")
1712    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TR 3bank bottom")
1713    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TR 3bank middle")
1714    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TR 3bank top")
1715    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top left lane")
1716    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top popper")
1709   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL 3bank top")
1710   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL 3bank middle")
1711   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL 3bank bottom")
1712   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TR 3bank bottom")
1713   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TR 3bank middle")
1714   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TR 3bank top")
1715   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top left lane")
1716   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top popper")
17171717
17181718   PORT_START("SW.6")
1719    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("BL 3bank top")
1720    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("BL 3bank middle")
1721    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("BL 3bank bottom")
1722    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("BR 3bank bottom")
1723    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("BR 3bank middle")
1724    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("BR 3bank top")
1725    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bank kickout")
1726    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top right lane")
1719   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("BL 3bank top")
1720   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("BL 3bank middle")
1721   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("BL 3bank bottom")
1722   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("BR 3bank bottom")
1723   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("BR 3bank middle")
1724   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("BR 3bank top")
1725   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bank kickout")
1726   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top right lane")
17271727
17281728   PORT_START("SW.7")
1729    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left token lvl")
1730    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right token lvl")
1731    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp entrance")
1732    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp made")
1733    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Wheel channel A")
1734    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Wheel channel B")
1735    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1736    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1729   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left token lvl")
1730   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right token lvl")
1731   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp entrance")
1732   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp made")
1733   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Wheel channel A")
1734   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Wheel channel B")
1735   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1736   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
17371737
17381738   PORT_START("DOOR")
1739    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1740    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1741    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1742    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1743    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1744    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1745    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1746    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1739   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1740   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1741   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1742   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1743   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1744   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1745   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1746   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
17471747
17481748   PORT_START("DSW")
17491749   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
17541754   PORT_DIPSETTING(   0xec, "Spain")
17551755
17561756   PORT_START("FLIPPERS")
1757    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1758    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1759    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1760    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1761    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper EOS")
1762    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1763    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Token coin slot")
1764    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1757   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1758   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1759   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1760   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1761   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper EOS")
1762   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1763   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Token coin slot")
1764   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
17651765INPUT_PORTS_END
17661766
17671767const char *const wpc_95_state::lamps_ss[64] = {
r31373r31374
17881788
17891789static INPUT_PORTS_START( ss )
17901790   PORT_START("SW.0")
1791    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
1792    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Wheel index")
1793    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1794    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1795    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1796    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1797    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rt flipper lane")
1798    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
1791   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
1792   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Wheel index")
1793   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1794   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1795   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1796   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1797   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rt flipper lane")
1798   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
17991799
18001800   PORT_START("SW.1")
1801    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1802    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1803    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1804    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1805    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Extra ball lane")
1806    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lft flipper lane")
1807    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1808    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Single standup")
1801   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1802   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1803   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
1804   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1805   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Extra ball lane")
1806   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lft flipper lane")
1807   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1808   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Single standup")
18091809
18101810   PORT_START("SW.2")
1811    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1812    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1813    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1814    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1815    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1816    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1817    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left kickout")
1818    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Crate entrance")
1811   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1812   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1813   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1814   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1815   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1816   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
1817   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left kickout")
1818   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Crate entrance")
18191819
18201820   PORT_START("SW.3")
1821    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coffin left")
1822    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coffin center")
1823    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coffin right")
1824    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left ramp enter")
1825    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right ramp enter")
1826    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left ramp made")
1827    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right ramp made")
1828    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coffin entrance")
1821   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coffin left")
1822   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coffin center")
1823   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coffin right")
1824   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left ramp enter")
1825   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right ramp enter")
1826   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left ramp made")
1827   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right ramp made")
1828   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coffin entrance")
18291829
18301830   PORT_START("SW.4")
1831    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1832    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1833    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Upper jet")
1834    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center jet")
1835    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lower jet")
1836    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Upper slingshot")
1837    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Crate sensor")
1838    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
1831   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
1832   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
1833   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Upper jet")
1834   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center jet")
1835   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lower jet")
1836   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Upper slingshot")
1837   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Crate sensor")
1838   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
18391839
18401840   PORT_START("SW.5")
1841    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank upper")
1842    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank mid")
1843    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank lower")
1844    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left leaper")
1845    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center leaper")
1846    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right leaper")
1847    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rt ramp 10 point")
1848    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop")
1841   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank upper")
1842   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank mid")
1843   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank lower")
1844   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left leaper")
1845   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center leaper")
1846   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right leaper")
1847   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rt ramp 10 point")
1848   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop")
18491849
18501850   PORT_START("SW.6")
1851    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left skull lane")
1852    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center skull lane")
1853    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right skull lane")
1854    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Secret passage")
1855    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1856    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
1857    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1858    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
1851   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left skull lane")
1852   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center skull lane")
1853   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right skull lane")
1854   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Secret passage")
1855   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
1856   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
1857   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
1858   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
18591859
18601860   PORT_START("SW.7")
1861    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1861   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
18621862
18631863   PORT_START("DOOR")
1864    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1865    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1866    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1867    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1868    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1869    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1870    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1871    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1864   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1865   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1866   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1867   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1868   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1869   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1870   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1871   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
18721872
18731873   PORT_START("DSW")
18741874   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
18791879   PORT_DIPSETTING(   0xec, "Spain")
18801880
18811881   PORT_START("FLIPPERS")
1882    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1883    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1884    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1885    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1886    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1887    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1888    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1889    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
1882   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
1883   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
1884   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
1885   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
1886   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
1887   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
1888   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
1889   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
18901890INPUT_PORTS_END
18911891
18921892const char *const wpc_95_state::lamps_totan[64] = {
r31373r31374
19131913
19141914static INPUT_PORTS_START( totan )
19151915   PORT_START("SW.0")
1916    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Harem passage")
1917    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Vanish tunnel")
1918    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1919    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1920    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp enter")
1921    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1922    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right inlane")
1923    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ball shooter")
1916   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Harem passage")
1917   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Vanish tunnel")
1918   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
1919   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
1920   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp enter")
1921   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
1922   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right inlane")
1923   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ball shooter")
19241924
19251925   PORT_START("SW.1")
1926    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1927    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1928    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Genie standup")
1929    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1930    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bazaar eject")
1931    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left inlane")
1932    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1933    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left wire make")
1926   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
1927   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
1928   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Genie standup")
1929   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1930   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bazaar eject")
1931   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left inlane")
1932   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
1933   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left wire make")
19341934
19351935   PORT_START("SW.2")
1936    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1937    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1938    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1939    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1940    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1941    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left cage opto")
1942    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right cage opto")
1943    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left eject")
1936   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
1937   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
1938   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
1939   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
1940   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
1941   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left cage opto")
1942   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right cage opto")
1943   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left eject")
19441944
19451945   PORT_START("SW.3")
1946    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp made left")
1947    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Genie target")
1948    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
1949    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop left")
1950    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop right")
1951    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Mini standups")
1952    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp made right")
1953    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right captive ball")
1946   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp made left")
1947   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Genie target")
1948   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop")
1949   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop left")
1950   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inner loop right")
1951   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Mini standups")
1952   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ramp made right")
1953   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right captive ball")
19541954
19551955   PORT_START("SW.4")
1956    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left sling")
1957    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slign")
1958    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1959    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1960    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle jet")
1961    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lamp spin CCW")
1962    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lamp spin CW")
1963    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left captive ball")
1956   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left sling")
1957   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slign")
1958   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
1959   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
1960   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle jet")
1961   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lamp spin CCW")
1962   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lamp spin CW")
1963   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left captive ball")
19641964
19651965   PORT_START("SW.5")
1966    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left standups")
1967    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right standups")
1968    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top skill")
1969    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle skill")
1970    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom skill")
1971    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lock 1 (bot)")
1972    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lock 2")
1973    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lock 3 (top)")
1966   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left standups")
1967   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right standups")
1968   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top skill")
1969   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Middle skill")
1970   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom skill")
1971   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lock 1 (bot)")
1972   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lock 2")
1973   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lock 3 (top)")
19741974
19751975   PORT_START("SW.6")
1976    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1976   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
19771977
19781978   PORT_START("SW.7")
1979    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
1979   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
19801980
19811981   PORT_START("DOOR")
1982    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1983    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1984    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1985    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1986    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1987    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1988    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1989    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
1982   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
1983   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
1984   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
1985   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
1986   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
1987   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
1988   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
1989   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
19901990
19911991   PORT_START("DSW")
19921992   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
19971997   PORT_DIPSETTING(   0xec, "Spain")
19981998
19991999   PORT_START("FLIPPERS")
2000    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
2001    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
2002    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
2003    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
2004    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
2005    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
2006    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
2007    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
2000   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
2001   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
2002   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
2003   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
2004   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
2005   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
2006   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
2007   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
20082008INPUT_PORTS_END
20092009
20102010const char *const wpc_95_state::lamps_cp[64] = {
r31373r31374
20312031
20322032static INPUT_PORTS_START( cp )
20332033   PORT_START("SW.0")
2034    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Made ramp")
2035    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Heavy bag")
2036    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
2037    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
2038    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lock up 1")
2039    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
2040    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
2041    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
2034   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Made ramp")
2035   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Heavy bag")
2036   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
2037   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
2038   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lock up 1")
2039   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
2040   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
2041   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
20422042
20432043   PORT_START("SW.1")
2044    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
2045    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
2046    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Ball launch")
2047    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
2048    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank mid")
2049    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
2050    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
2051    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Popper")
2044   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
2045   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
2046   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Ball launch")
2047   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
2048   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank mid")
2049   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
2050   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
2051   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Popper")
20522052
20532053   PORT_START("SW.2")
2054    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
2055    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
2056    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
2057    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
2058    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
2059    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left jab made")
2060    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Corner eject")
2061    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right jab made")
2054   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
2055   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
2056   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
2057   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
2058   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
2059   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left jab made")
2060   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Corner eject")
2061   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right jab made")
20622062
20632063   PORT_START("SW.3")
2064    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Boxer pole cntr")
2065    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Behnd left scoop")
2066    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Behnd rght scoop")
2067    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Enter ramp")
2068    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Jump rope")
2069    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bag pole center")
2070    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Boxer pole right")
2071    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Boxer pole left")
2064   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Boxer pole cntr")
2065   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Behnd left scoop")
2066   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Behnd rght scoop")
2067   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Enter ramp")
2068   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Jump rope")
2069   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bag pole center")
2070   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Boxer pole right")
2071   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Boxer pole left")
20722072
20732073   PORT_START("SW.4")
2074    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left sling")
2075    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right sling")
2076    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank bottom")
2077    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank top")
2078    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left half guy")
2079    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rght half guy")
2080    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lock up 2")
2081    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lock up 3")
2074   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left sling")
2075   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right sling")
2076   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank bottom")
2077   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Three bank top")
2078   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left half guy")
2079   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rght half guy")
2080   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lock up 2")
2081   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Lock up 3")
20822082
20832083   PORT_START("SW.5")
2084    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left scoop up")
2085    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right scoop up")
2086    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Power shot")
2087    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rope cam")
2088    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Speed bag")
2089    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Boxer gut 1")
2090    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Boxer gut 2")
2091    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Boxer head")
2084   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left scoop up")
2085   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right scoop up")
2086   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Power shot")
2087   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Rope cam")
2088   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Speed bag")
2089   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Boxer gut 1")
2090   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Boxer gut 2")
2091   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Boxer head")
20922092
20932093   PORT_START("SW.6")
2094    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Exit rope")
2095    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Enter speed bag")
2096    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
2097    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Enter lockup")
2098    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2099    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top of ramp")
2100    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
2101    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Enter rope")
2094   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Exit rope")
2095   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Enter speed bag")
2096   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
2097   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Enter lockup")
2098   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2099   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top of ramp")
2100   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
2101   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Enter rope")
21022102
21032103   PORT_START("SW.7")
2104    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
2104   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
21052105
21062106   PORT_START("DOOR")
2107    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
2108    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
2109    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
2110    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
2111    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
2112    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
2113    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
2114    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
2107   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
2108   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
2109   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
2110   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
2111   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
2112   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
2113   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
2114   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
21152115
21162116   PORT_START("DSW")
21172117   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
21222122   PORT_DIPSETTING(   0xec, "Spain")
21232123
21242124   PORT_START("FLIPPERS")
2125    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
2126    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
2127    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
2128    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
2129    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
2130    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
2131    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
2132    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
2125   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
2126   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
2127   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
2128   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
2129   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
2130   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
2131   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
2132   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
21332133INPUT_PORTS_END
21342134
21352135const char *const wpc_95_state::lamps_ttt[64] = {
r31373r31374
21562156
21572157static INPUT_PORTS_START( ttt )
21582158   PORT_START("SW.0")
2159    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
2160    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
2161    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
2162    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
2163    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2164    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right sling")
2165    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right post")
2166    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
2159   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED)
2160   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
2161   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
2162   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
2163   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2164   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right sling")
2165   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right post")
2166   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
21672167
21682168   PORT_START("SW.1")
2169    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
2170    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
2171    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
2172    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
2173    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2174    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left post")
2175    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left sling")
2176    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
2169   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
2170   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
2171   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
2172   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
2173   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2174   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left post")
2175   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left sling")
2176   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
21772177
21782178   PORT_START("SW.2")
2179    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"9\"")
2180    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"8\"")
2181    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"7\"")
2182    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"6\"")
2183    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"5\"")
2184    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Kicker opto")
2185    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
2186    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
2179   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"9\"")
2180   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"8\"")
2181   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"7\"")
2182   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"6\"")
2183   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"5\"")
2184   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Kicker opto")
2185   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
2186   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
21872187
21882188   PORT_START("SW.3")
2189    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"4\"")
2190    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"3\"")
2191    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"2\"")
2192    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"1\"")
2193    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2194    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
2195    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
2196    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
2189   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"4\"")
2190   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"3\"")
2191   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"2\"")
2192   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Hole \"1\"")
2193   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2194   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
2195   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
2196   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
21972197
21982198   PORT_START("SW.4")
2199    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ticket opto")
2200    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Tickets low")
2201    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ticket test")
2202    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
2203    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2204    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
2205    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
2206    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
2199   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ticket opto")
2200   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Tickets low")
2201   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Ticket test")
2202   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED)
2203   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
2204   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED)
2205   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED)
2206   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
22072207
22082208   PORT_START("SW.5")
2209    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
2209   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
22102210
22112211   PORT_START("SW.6")
2212    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
2212   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
22132213
22142214   PORT_START("SW.7")
2215    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
2215   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
22162216
22172217   PORT_START("DOOR")
2218    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
2219    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
2220    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
2221    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
2222    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
2223    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
2224    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
2225    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
2218   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
2219   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
2220   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
2221   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
2222   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
2223   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
2224   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
2225   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
22262226
22272227   PORT_START("DSW")
22282228   PORT_DIPNAME(0xff, 0xfc, "Country") PORT_DIPLOCATION("SW1:1,2,3,4,5,6,7,8")
r31373r31374
22332233   PORT_DIPSETTING(   0xec, "Spain")
22342234
22352235   PORT_START("FLIPPERS")
2236    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
2237    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
2238    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
2239    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
2240    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
2241    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
2242    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
2243    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
2236   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
2237   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
2238   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
2239   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
2240   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
2241   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
2242   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
2243   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
22442244INPUT_PORTS_END
22452245
22462246static MACHINE_CONFIG_START( wpc_95, wpc_95_state )
trunk/src/mame/drivers/ghosteo.c
r31373r31374
635635   MCFG_S3C2410_NAND_DATA_W_CB(WRITE8(ghosteo_state, s3c2410_nand_data_w))
636636
637637//  MCFG_DEVICE_ADD("nand", NAND, 0)
638//  MCFG_NAND_TYPE(NAND_CHIP_K9F5608U0D)   // or another variant with ID 0xEC 0x75 ?
638//  MCFG_NAND_TYPE(NAND_CHIP_K9F5608U0D)    // or another variant with ID 0xEC 0x75 ?
639639//  MCFG_DEVICE_CONFIG(bballoon_nand_intf)
640640
641641//  MCFG_I2CMEM_ADD("i2cmem", 0xA0, 0, 0x100, NULL)
trunk/src/mame/drivers/malzak.c
r31373r31374
343343
344344   MCFG_DEVICE_ADD("s2636_0", S2636, 0)
345345   MCFG_S2636_WORKRAM_SIZE(0x100)
346   MCFG_S2636_OFFSETS(0, -16)   // -8, -16
346   MCFG_S2636_OFFSETS(0, -16)  // -8, -16
347347   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
348348
349349   MCFG_DEVICE_ADD("s2636_1", S2636, 0)
350350   MCFG_S2636_WORKRAM_SIZE(0x100)
351   MCFG_S2636_OFFSETS(0, -16)   // -9, -16
351   MCFG_S2636_OFFSETS(0, -16)  // -9, -16
352352   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
353353
354354   MCFG_DEVICE_ADD("saa5050", SAA5050, 6000000)
trunk/src/mame/drivers/deco32.c
r31373r31374
17121712   MCFG_DECO16IC_GFXDECODE("gfxdecode")
17131713   MCFG_DECO16IC_PALETTE("palette")
17141714
1715   MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)   // pf3 is in 8bpp mode, pf4 is not used
1715   MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)    // pf3 is in 8bpp mode, pf4 is not used
17161716   MCFG_DECO16IC_SPLIT(0)
17171717   MCFG_DECO16IC_WIDTH12(0)
17181718   MCFG_DECO16IC_PF1_TRANS_MASK(0xff)
r31373r31374
17771777{
17781778   bank = bank >> 4;
17791779   bank = (bank & 1) | ((bank & 4) >> 1) | ((bank & 2) << 1);
1780   
1780
17811781   return bank * 0x1000;
17821782}
17831783
r31373r31374
21292129
21302130   MCFG_DEVICE_ADD("tilegen2", DECO16IC, 0)
21312131   MCFG_DECO16IC_SPLIT(0)
2132   MCFG_DECO16IC_WIDTH12(0)   // lockload definitely wants pf34 half width..
2132   MCFG_DECO16IC_WIDTH12(0)    // lockload definitely wants pf34 half width..
21332133   MCFG_DECO16IC_PF1_TRANS_MASK(0xff)
21342134   MCFG_DECO16IC_PF2_TRANS_MASK(0xff)
21352135   MCFG_DECO16IC_PF1_COL_BANK(0x04)
r31373r31374
21462146   MCFG_DEVICE_ADD("spritegen_zoom", DECO_ZOOMSPR, 0)
21472147   MCFG_DECO_ZOOMSPR_GFXDECODE("gfxdecode")
21482148   MCFG_DECO_ZOOMSPR_PALETTE("palette")
2149   
2149
21502150   MCFG_DECO146_ADD("ioprot")
21512151   MCFG_DECO146_SET_SOUNDLATCH_CALLBACK(deco32_state, deco32_sound_cb)
21522152   MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE
trunk/src/mame/drivers/fortecar.c
r31373r31374
659659
660660   MCFG_DEVICE_ADD("fcppi0", I8255A, 0)
661661   /*  Init with 0x9a... A, B and high C as input
662    Serial Eprom connected to Port C */
662    Serial Eprom connected to Port C */
663663   MCFG_I8255_IN_PORTA_CB(IOPORT("SYSTEM"))
664664   MCFG_I8255_IN_PORTB_CB(IOPORT("INPUT"))
665665   MCFG_I8255_IN_PORTC_CB(READ8(fortecar_state, ppi0_portc_r))
trunk/src/mame/drivers/aliens.c
r31373r31374
267267   ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
268268   /* second half empty */
269269
270   ROM_REGION( 0x200000, "k051960", 0 )   /* sprites */
270   ROM_REGION( 0x200000, "k051960", 0 )    /* sprites */
271271   ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
272272   ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
273273   ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
r31373r31374
299299   /* second half empty */
300300
301301
302   ROM_REGION( 0x200000, "k051960", 0 )   /* sprites */
302   ROM_REGION( 0x200000, "k051960", 0 )    /* sprites */
303303   ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
304304   ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
305305   ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
r31373r31374
330330   ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
331331   /* second half empty */
332332
333   ROM_REGION( 0x200000, "k051960", 0 )   /* sprites */
333   ROM_REGION( 0x200000, "k051960", 0 )    /* sprites */
334334   ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
335335   ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
336336   ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
r31373r31374
361361   ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
362362   /* second half empty */
363363
364   ROM_REGION( 0x200000, "k051960", 0 )   /* sprites */
364   ROM_REGION( 0x200000, "k051960", 0 )    /* sprites */
365365   ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
366366   ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
367367   ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
r31373r31374
392392   ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
393393   /* second half empty */
394394
395   ROM_REGION( 0x200000, "k051960", 0 )   /* sprites */
395   ROM_REGION( 0x200000, "k051960", 0 )    /* sprites */
396396   ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
397397   ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
398398   ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
r31373r31374
423423   ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
424424   /* second half empty */
425425
426   ROM_REGION( 0x200000, "k051960", 0 )   /* sprites */
426   ROM_REGION( 0x200000, "k051960", 0 )    /* sprites */
427427   ROM_LOAD32_WORD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
428428   ROM_LOAD32_WORD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
429429   ROM_LOAD32_WORD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
r31373r31374
454454   ROM_LOAD32_WORD( "875b08.j19", 0x100002, 0x40000, CRC(f9387966) SHA1(470ecc4a5a3edd08d5e0ab10b0c590db1968fb0a) )
455455   /* second half empty */
456456
457   ROM_REGION( 0x200000, "k051960", 0 )   /* sprites */
457   ROM_REGION( 0x200000, "k051960", 0 )    /* sprites */
458458   ROM_LOAD( "875b10.k08", 0x000000, 0x80000, CRC(0b1035b1) SHA1(db04020761386e79249762cd1540208375c38c7f) )
459459   ROM_LOAD( "875b09.k02", 0x000002, 0x80000, CRC(e76b3c19) SHA1(6838e07460b3eaaeb129208ad0696c8019bd63d9) )
460460   ROM_LOAD( "875b06.j08", 0x100000, 0x40000, CRC(081a0566) SHA1(3a4aa14178fe76a030224743c9e9cd974e08bd79) )
trunk/src/mame/drivers/blockhl.c
r31373r31374
186186   /* bits 0-1 = ROM bank */
187187   m_rombank = data & 0x03;
188188   membank("bank1")->set_entry(m_rombank);
189   
189
190190   /* bits 3/4 = coin counters */
191191   coin_counter_w(machine(), 0, data & 0x08);
192192   coin_counter_w(machine(), 1, data & 0x10);
193   
193
194194   /* bit 5 = select palette RAM or work RAM at 5800-5fff */
195195   m_palette_selected = ~data & 0x20;
196   
196
197197   /* bit 6 = enable char ROM reading through the video RAM */
198198   m_k052109->set_rmrd_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE);
199   
199
200200   /* bit 7 used but unknown */
201   
201
202202   /* other bits unknown */
203   
203
204204   if ((data & 0x84) != 0x80)
205205      logerror("%04x: setlines %02x\n", machine().device("maincpu")->safe_pc(), data);
206206}
trunk/src/mame/drivers/bottom9.c
r31373r31374
481481   ROM_LOAD32_BYTE( "891e09d", 0x40002, 0x10000, CRC(4e1335e6) SHA1(b892ab40a41978a89658ea2e7aabe9b073430b5d) )
482482   ROM_LOAD32_BYTE( "891e09b", 0x40003, 0x10000, CRC(b6f914fb) SHA1(e95f3e899c2ead15ef8a529dbc67e8f4a0f88bdd) )
483483
484   ROM_REGION( 0x100000, "k051960", 0 )   /* sprites */
484   ROM_REGION( 0x100000, "k051960", 0 )    /* sprites */
485485   ROM_LOAD32_BYTE( "891e06e", 0x00000, 0x10000, CRC(0b04db1c) SHA1(0beae7bb8da49379915c0253ce03091eb71a58b5) )
486486   ROM_LOAD32_BYTE( "891e06a", 0x00001, 0x10000, CRC(5ee37327) SHA1(f63ddaf63af06ea5421b0361315940582ef57922) )
487487   ROM_LOAD32_BYTE( "891e05e", 0x00002, 0x10000, CRC(b356e729) SHA1(2cda591415b0f139fdb1f80c349d432bb0579d8e) )
trunk/src/mame/drivers/backfire.c
r31373r31374
9999   void descramble_sound();
100100   DECO16IC_BANK_CB_MEMBER(bank_callback);
101101   DECOSPR_PRIORITY_CB_MEMBER(pri_callback);
102                     
102
103103   required_ioport m_io_in0;
104104   required_ioport m_io_in1;
105105   required_ioport m_io_in2;
trunk/src/mame/drivers/sg1000a.c
r31373r31374
271271   /* video hardware */
272272   MCFG_DEVICE_ADD( "tms9928a", TMS9928A, XTAL_10_738635MHz / 2 )
273273   MCFG_TMS9928A_VRAM_SIZE(0x4000)
274   MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(sg1000a_state, vdp_interrupt))   
275   
274   MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(sg1000a_state, vdp_interrupt))
275
276276   MCFG_TMS9928A_SCREEN_ADD_NTSC( "screen" )
277277   MCFG_SCREEN_UPDATE_DEVICE( "tms9928a", tms9928a_device, screen_update )
278278
trunk/src/mame/drivers/savquest.c
r31373r31374
685685   MCFG_VOODOO_TMUMEM(4,4)
686686   MCFG_VOODOO_SCREEN_TAG("screen")
687687   MCFG_VOODOO_CPU_TAG("maincpu")
688   MCFG_VOODOO_VBLANK_CB(WRITELINE(savquest_state,vblank_assert))   
688   MCFG_VOODOO_VBLANK_CB(WRITELINE(savquest_state,vblank_assert))
689689MACHINE_CONFIG_END
690690
691691ROM_START( savquest )
trunk/src/mame/drivers/coolridr.c
r31373r31374
37133713   m_maincpu->sh2drc_add_fastram(0x06000000, 0x060d7fff, 0, &m_sysh1_workram_h[0]);
37143714   m_maincpu->sh2drc_add_fastram(0x060d9000, 0x060fffff, 0, &m_sysh1_workram_h[0xd9000/4]);
37153715   m_maincpu->sh2drc_add_fastram(0x00000000, 0x001fffff, 1, &m_rom[0]);
3716   m_maincpu->sh2drc_add_fastram(0x20000000, 0x201fffff, 1, &m_rom[0]);
3716   m_maincpu->sh2drc_add_fastram(0x20000000, 0x201fffff, 1, &m_rom[0]);
37173717}
37183718
37193719GAME( 1995, coolridr,    0, coolridr,    coolridr, coolridr_state,    coolridr, ROT0,  "Sega", "Cool Riders",GAME_IMPERFECT_SOUND) // region is set in test mode, this set is for Japan, USA and Export (all regions)
trunk/src/mame/drivers/proconn.c
r31373r31374
266266WRITE16_MEMBER(proconn_state::serial_transmit)
267267{
268268//Don't like the look of this, should be a clock somewhere
269
269
270270   // should probably be in the pios above
271271
272272   if (offset == 0)
r31373r31374
275275      {
276276         m_vfd->data(data & (1<<i));
277277         m_vfd->sclk(1);
278         m_vfd->sclk(0);     
278         m_vfd->sclk(0);
279279      }
280280   }
281281}
trunk/src/mame/drivers/arachnid.c
r31373r31374
436436
437437   // video hardware
438438   MCFG_DEVICE_ADD( TMS9118_TAG, TMS9118, XTAL_10_738635MHz / 2 )
439    MCFG_TMS9928A_VRAM_SIZE(0x4000)
439   MCFG_TMS9928A_VRAM_SIZE(0x4000)
440440   MCFG_TMS9928A_OUT_INT_LINE_CB(INPUTLINE(M6809_TAG, INPUT_LINE_IRQ0))
441441   MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG )
442442   MCFG_SCREEN_UPDATE_DEVICE( TMS9118_TAG, tms9118_device, screen_update )
trunk/src/mame/drivers/maygay1b.c
r31373r31374
6969
7070
7171        TODO: I/O is generally a nightmare, probably needs a rebuild at the address level.
72           Inputs need a sort out.
73           Some games require dongles for security, need to figure this out.
72              Inputs need a sort out.
73              Some games require dongles for security, need to figure this out.
7474******************************************************************************************/
7575#include "emu.h"
7676#include "includes/maygay1b.h"
r31373r31374
469469WRITE8_MEMBER( maygay1b_state::lamp_data_w )
470470{
471471   //The two A/B ports are merged back into one, to make one row of 8 lamps.
472   
472
473473   if (m_old_lamp_strobe != m_lamp_strobe)
474474   {
475475      // Because of the nature of the lamping circuit, there is an element of persistance
r31373r31374
482482      }
483483      m_old_lamp_strobe = m_lamp_strobe;
484484   }
485   
485
486486}
487487
488488READ8_MEMBER( maygay1b_state::kbd_r )
r31373r31374
494494WRITE8_MEMBER( maygay1b_state::lamp_data_2_w )
495495{
496496   //The two A/B ports are merged back into one, to make one row of 8 lamps.
497   
497
498498   if (m_old_lamp_strobe2 != m_lamp_strobe2)
499499   {
500500      // Because of the nature of the lamping circuit, there is an element of persistance
r31373r31374
507507      }
508508      m_old_lamp_strobe2 = m_lamp_strobe2;
509509   }
510   
510
511511}
512512
513513// machine driver for maygay m1 board /////////////////////////////////
r31373r31374
541541
542542   MCFG_TIMER_DRIVER_ADD_PERIODIC("nmitimer", maygay1b_state, maygay1b_nmitimer_callback, attotime::from_hz(75)) // freq?
543543   MCFG_DEVICE_ADD("i8279", I8279, M1_MASTER_CLOCK/4)    // unknown clock
544   MCFG_I8279_OUT_SL_CB(WRITE8(maygay1b_state, scanlines_w))   // scan SL lines
545   MCFG_I8279_OUT_DISP_CB(WRITE8(maygay1b_state, lamp_data_w))      // display A&B
546   MCFG_I8279_IN_RL_CB(READ8(maygay1b_state, kbd_r))         // kbd RL lines
547   MCFG_DEVICE_ADD("i8279_2", I8279, M1_MASTER_CLOCK/4)      // unknown clock
548   MCFG_I8279_OUT_DISP_CB(WRITE8(maygay1b_state, lamp_data_2_w))      // display A&B
549   
544   MCFG_I8279_OUT_SL_CB(WRITE8(maygay1b_state, scanlines_w))   // scan SL lines
545   MCFG_I8279_OUT_DISP_CB(WRITE8(maygay1b_state, lamp_data_w))     // display A&B
546   MCFG_I8279_IN_RL_CB(READ8(maygay1b_state, kbd_r))           // kbd RL lines
547   MCFG_DEVICE_ADD("i8279_2", I8279, M1_MASTER_CLOCK/4)        // unknown clock
548   MCFG_I8279_OUT_DISP_CB(WRITE8(maygay1b_state, lamp_data_2_w))       // display A&B
549
550550   MCFG_NVRAM_ADD_0FILL("nvram")
551551
552552   MCFG_DEFAULT_LAYOUT(layout_maygay1b)
trunk/src/mame/drivers/sam.c
r31373r31374
2323   MCFG_CPU_PROGRAM_MAP(sam_map)
2424MACHINE_CONFIG_END
2525
26#define ROM_LOAD_BOOT_EPROM   \
26#define ROM_LOAD_BOOT_EPROM \
2727   ROM_REGION( 0x100000, "boot", ROMREGION_ERASEFF ) \
2828   ROM_LOAD( "boot_eprom_01_02.bin", 0x0000, 0x100000, CRC(92c93cba) SHA1(aed7ba2f988df8c95e2ad08f70409152d5caa49a)) \
2929   ROM_LOAD( "boot_eprom_01_06.bin", 0x0000, 0x0e8ac8, CRC(fe7bcece) SHA1(775590bbd52c24950db86cc231566ba3780030d8)) \
3030   ROM_LOAD( "boot_eprom_02_10.bin", 0x0000, 0x0f0304, CRC(0f3fd4a4) SHA1(115d0b73c40fcdb2d202a0a9065472d216ca89e0)) \
3131   ROM_LOAD( "boot_eprom_02_30.bin", 0x0000, 0x0f0624, CRC(a4258c49) SHA1(d865edf7d1c6d2c922980dd192222dc24bc092a0)) \
32   ROM_LOAD( "boot_eprom_03_10.bin", 0x0000, 0x100000, CRC(de017f82) SHA1(e4a9a818fa3f1754374cd00b52b8a087d6c442a9)) \
33
32   ROM_LOAD( "boot_eprom_03_10.bin", 0x0000, 0x100000, CRC(de017f82) SHA1(e4a9a818fa3f1754374cd00b52b8a087d6c442a9))
3433/*-------------------------------------------------------------------
3534/ 24
3635/-------------------------------------------------------------------*/
r31373r31374
10651064   ROM_LOAD( "wpt1400l.bin",    0x0000, 0x1c7072c, CRC(00eff09c) SHA1(847203d4d2ce8d11a5403374f2d5b6dda8458bc9))
10661065ROM_END
10671066
1068GAME( 200?, 24_130       ,24_150,   sam, sam, driver_device, 0, ROT0, "Stern", "24 v1.30", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1069GAME( 200?, 24_140       ,24_150,   sam, sam, driver_device, 0, ROT0, "Stern", "24 v1.40", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1070GAME( 200?, 24_144       ,24_150,   sam, sam, driver_device, 0, ROT0, "Stern", "24 v1.44", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1071GAME( 200?, 24_150       ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "24 v1.50", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1072GAME( 200?, bdk_130      ,bdk_294,   sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v1.30", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1073GAME( 200?, bdk_150      ,bdk_294,   sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v1.50", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1074GAME( 200?, bdk_160      ,bdk_294,   sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v1.60", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1075GAME( 200?, bdk_200      ,bdk_294,   sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v2.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1076GAME( 200?, bdk_210      ,bdk_294,   sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v2.10", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1077GAME( 200?, bdk_220      ,bdk_294,   sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v2.20", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1078GAME( 200?, bdk_290      ,bdk_294,   sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v2.90", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1079GAME( 200?, bdk_294      ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v2.94", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1067GAME( 200?, 24_130       ,24_150,   sam, sam, driver_device, 0, ROT0, "Stern", "24 v1.30", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1068GAME( 200?, 24_140       ,24_150,   sam, sam, driver_device, 0, ROT0, "Stern", "24 v1.40", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1069GAME( 200?, 24_144       ,24_150,   sam, sam, driver_device, 0, ROT0, "Stern", "24 v1.44", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1070GAME( 200?, 24_150       ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "24 v1.50", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1071GAME( 200?, bdk_130      ,bdk_294,  sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v1.30", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1072GAME( 200?, bdk_150      ,bdk_294,  sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v1.50", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1073GAME( 200?, bdk_160      ,bdk_294,  sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v1.60", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1074GAME( 200?, bdk_200      ,bdk_294,  sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v2.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1075GAME( 200?, bdk_210      ,bdk_294,  sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v2.10", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1076GAME( 200?, bdk_220      ,bdk_294,  sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v2.20", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1077GAME( 200?, bdk_290      ,bdk_294,  sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v2.90", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1078GAME( 200?, bdk_294      ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "Batman - The Dark Knight v2.94", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
10801079// Missing version 1.30 (26-Jan-2010), 1.20 (25-Jan-2010), 1.10 (21-Jan-2010), 1.00 (15-Jan-2010)
1081GAME( 200?, bbh_140      ,bbh_160,   sam, sam, driver_device, 0, ROT0, "Stern", "Big Buck Hunter Pro v1.40", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1082GAME( 200?, bbh_150      ,bbh_160,   sam, sam, driver_device, 0, ROT0, "Stern", "Big Buck Hunter Pro v1.50", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1083GAME( 200?, bbh_160      ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "Big Buck Hunter Pro v1.60", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1084GAME( 200?, csi_102      ,csi_240,   sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v1.02", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1085GAME( 200?, csi_103      ,csi_240,   sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v1.03", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1086GAME( 200?, csi_104      ,csi_240,   sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v1.04", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1087GAME( 200?, csi_200      ,csi_240,   sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v2.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1088GAME( 200?, csi_210      ,csi_240,   sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v2.10", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1089GAME( 200?, csi_230      ,csi_240,   sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v2.30", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1090GAME( 200?, csi_240      ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v2.40", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1091GAME( 200?, fg_1000af    ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v10.0 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1092GAME( 200?, fg_1000ag    ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v10.0 (English,German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1093GAME( 200?, fg_1000ai    ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v10.0 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1094GAME( 200?, fg_1000al    ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v10.0 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1095GAME( 200?, fg_110af     ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v11.0 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1096GAME( 200?, fg_110ag     ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v11.0 (English,German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1097GAME( 200?, fg_110ai     ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v11.0 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1098GAME( 200?, fg_110al     ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v11.0 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1099GAME( 200?, fg_120af     ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v12.0 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1100GAME( 200?, fg_120ag     ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v12.0 (English,German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1101GAME( 200?, fg_120ai     ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v12.0 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1102GAME( 200?, fg_120al     ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v12.0 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1103GAME( 200?, fg_300ai     ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v3.0 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1104GAME( 200?, fg_400a      ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v4.0 (English)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1105GAME( 200?, fg_400ag     ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v4.0 (English,German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1106GAME( 200?, fg_700af     ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v7.0 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1107GAME( 200?, fg_700al     ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v7.0 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1108GAME( 200?, fg_800al     ,fg_120af,   sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v8.0 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1109GAME( 200?, im2_100      ,im2_140,   sam, sam, driver_device, 0, ROT0, "Stern", "Iron Man 2 v1.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1110GAME( 200?, im2_110      ,im2_140,   sam, sam, driver_device, 0, ROT0, "Stern", "Iron Man 2 v1.10", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1111GAME( 200?, im2_120      ,im2_140,   sam, sam, driver_device, 0, ROT0, "Stern", "Iron Man 2 v1.20", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1112GAME( 200?, im2_140      ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "Iron Man 2 v1.40", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1113GAME( 200?, indy_113a    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.13", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1114GAME( 200?, indy_113f    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.13 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1115GAME( 200?, indy_113g    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.13 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1116GAME( 200?, indy_113i    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.13 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1117GAME( 200?, indy_113l    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.13 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1118GAME( 200?, indy_114a    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.14", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1119GAME( 200?, indy_114f    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.14 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1120GAME( 200?, indy_114g    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.14 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1121GAME( 200?, indy_114i    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.14 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1122GAME( 200?, indy_114l    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.14 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1123GAME( 200?, indy_116a    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.16", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1124GAME( 200?, indy_116f    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.16 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1125GAME( 200?, indy_116g    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.16 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1126GAME( 200?, indy_116i    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.16 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1127GAME( 200?, indy_116l    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.16 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1128GAME( 200?, indy_210     ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v2.10", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1129GAME( 200?, indy_210f    ,indy_210,   sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v2.10 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1080GAME( 200?, bbh_140      ,bbh_160,  sam, sam, driver_device, 0, ROT0, "Stern", "Big Buck Hunter Pro v1.40", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1081GAME( 200?, bbh_150      ,bbh_160,  sam, sam, driver_device, 0, ROT0, "Stern", "Big Buck Hunter Pro v1.50", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1082GAME( 200?, bbh_160      ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "Big Buck Hunter Pro v1.60", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1083GAME( 200?, csi_102      ,csi_240,  sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v1.02", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1084GAME( 200?, csi_103      ,csi_240,  sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v1.03", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1085GAME( 200?, csi_104      ,csi_240,  sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v1.04", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1086GAME( 200?, csi_200      ,csi_240,  sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v2.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1087GAME( 200?, csi_210      ,csi_240,  sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v2.10", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1088GAME( 200?, csi_230      ,csi_240,  sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v2.30", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1089GAME( 200?, csi_240      ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "C.S.I. v2.40", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1090GAME( 200?, fg_1000af    ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v10.0 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1091GAME( 200?, fg_1000ag    ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v10.0 (English,German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1092GAME( 200?, fg_1000ai    ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v10.0 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1093GAME( 200?, fg_1000al    ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v10.0 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1094GAME( 200?, fg_110af     ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v11.0 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1095GAME( 200?, fg_110ag     ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v11.0 (English,German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1096GAME( 200?, fg_110ai     ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v11.0 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1097GAME( 200?, fg_110al     ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v11.0 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1098GAME( 200?, fg_120af     ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v12.0 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1099GAME( 200?, fg_120ag     ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v12.0 (English,German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1100GAME( 200?, fg_120ai     ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v12.0 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1101GAME( 200?, fg_120al     ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v12.0 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1102GAME( 200?, fg_300ai     ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v3.0 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1103GAME( 200?, fg_400a      ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v4.0 (English)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1104GAME( 200?, fg_400ag     ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v4.0 (English,German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1105GAME( 200?, fg_700af     ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v7.0 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1106GAME( 200?, fg_700al     ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v7.0 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1107GAME( 200?, fg_800al     ,fg_120af, sam, sam, driver_device, 0, ROT0, "Stern", "Family Guy v8.0 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1108GAME( 200?, im2_100      ,im2_140,  sam, sam, driver_device, 0, ROT0, "Stern", "Iron Man 2 v1.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1109GAME( 200?, im2_110      ,im2_140,  sam, sam, driver_device, 0, ROT0, "Stern", "Iron Man 2 v1.10", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1110GAME( 200?, im2_120      ,im2_140,  sam, sam, driver_device, 0, ROT0, "Stern", "Iron Man 2 v1.20", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1111GAME( 200?, im2_140      ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "Iron Man 2 v1.40", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1112GAME( 200?, indy_113a    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.13", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1113GAME( 200?, indy_113f    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.13 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1114GAME( 200?, indy_113g    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.13 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1115GAME( 200?, indy_113i    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.13 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1116GAME( 200?, indy_113l    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.13 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1117GAME( 200?, indy_114a    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.14", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1118GAME( 200?, indy_114f    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.14 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1119GAME( 200?, indy_114g    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.14 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1120GAME( 200?, indy_114i    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.14 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1121GAME( 200?, indy_114l    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.14 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1122GAME( 200?, indy_116a    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.16", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1123GAME( 200?, indy_116f    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.16 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1124GAME( 200?, indy_116g    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.16 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1125GAME( 200?, indy_116i    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.16 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1126GAME( 200?, indy_116l    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v1.16 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1127GAME( 200?, indy_210     ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v2.10", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1128GAME( 200?, indy_210f    ,indy_210, sam, sam, driver_device, 0, ROT0, "Stern", "Indiana Jones v2.10 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
11301129// Missing versions 4.00 (21-May-2009), 3.00 (20-May-2009), 2.00 (19-May-2009) and 1.00 (14-May-2009) of NBA
1131GAME( 200?, nba_500      ,nba_802,   sam, sam, driver_device, 0, ROT0, "Stern", "NBA v5.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1132GAME( 200?, nba_600      ,nba_802,   sam, sam, driver_device, 0, ROT0, "Stern", "NBA v6.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1133GAME( 200?, nba_700      ,nba_802,   sam, sam, driver_device, 0, ROT0, "Stern", "NBA v7.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1134GAME( 200?, nba_801      ,nba_802,   sam, sam, driver_device, 0, ROT0, "Stern", "NBA v8.01", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1135GAME( 200?, nba_802      ,0,   sam, sam, driver_device, 0, ROT0, "Stern", "NBA v8.02", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1136GAME( 200?, potc_110af   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.10 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1137GAME( 200?, potc_110ai   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.10 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1138GAME( 200?, potc_110gf   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.10 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1130GAME( 200?, nba_500      ,nba_802,  sam, sam, driver_device, 0, ROT0, "Stern", "NBA v5.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1131GAME( 200?, nba_600      ,nba_802,  sam, sam, driver_device, 0, ROT0, "Stern", "NBA v6.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1132GAME( 200?, nba_700      ,nba_802,  sam, sam, driver_device, 0, ROT0, "Stern", "NBA v7.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1133GAME( 200?, nba_801      ,nba_802,  sam, sam, driver_device, 0, ROT0, "Stern", "NBA v8.01", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1134GAME( 200?, nba_802      ,0,    sam, sam, driver_device, 0, ROT0, "Stern", "NBA v8.02", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1135GAME( 200?, potc_110af   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.10 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1136GAME( 200?, potc_110ai   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.10 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1137GAME( 200?, potc_110gf   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.10 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
11391138// Missing version 1.11  for other languages ??? August 17, 2006
1140GAME( 200?, potc_111as   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.11 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1139GAME( 200?, potc_111as   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.11 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
11411140// Missing version 1.12  August 24, 2006
1142GAME( 200?, potc_113af   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.13 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1143GAME( 200?, potc_113ai   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.13 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1144GAME( 200?, potc_113as   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.13 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1145GAME( 200?, potc_113gf   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.13 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1141GAME( 200?, potc_113af   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.13 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1142GAME( 200?, potc_113ai   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.13 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1143GAME( 200?, potc_113as   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.13 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1144GAME( 200?, potc_113gf   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.13 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
11461145// Missing version 1.14  October 11, 2006
1147GAME( 200?, potc_115af   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.15 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1148GAME( 200?, potc_115ai   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.15 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1149GAME( 200?, potc_115as   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.15 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1150GAME( 200?, potc_115gf   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.15 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1146GAME( 200?, potc_115af   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.15 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1147GAME( 200?, potc_115ai   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.15 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1148GAME( 200?, potc_115as   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.15 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1149GAME( 200?, potc_115gf   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v1.15 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
11511150// Missing version 2.00  April 11, 2007
1152GAME( 200?, potc_300af   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v3.00 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1153GAME( 200?, potc_300ai   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v3.00 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1154GAME( 200?, potc_300as   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v3.00 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1155GAME( 200?, potc_300gf   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v3.00 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1156GAME( 200?, potc_400af   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v4.00 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1157GAME( 200?, potc_400ai   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v4.00 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1158GAME( 200?, potc_400as   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v4.00 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1159GAME( 200?, potc_400gf   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v4.00 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1151GAME( 200?, potc_300af   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v3.00 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1152GAME( 200?, potc_300ai   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v3.00 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1153GAME( 200?, potc_300as   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v3.00 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1154GAME( 200?, potc_300gf   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v3.00 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1155GAME( 200?, potc_400af   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v4.00 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1156GAME( 200?, potc_400ai   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v4.00 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1157GAME( 200?, potc_400as   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v4.00 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1158GAME( 200?, potc_400gf   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v4.00 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
11601159// Missing version 5.00 September 27, 2007
1161GAME( 200?, potc_600     ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v6.00 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1162GAME( 200?, potc_600ai   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v6.00 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1163GAME( 200?, potc_600as   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v6.00 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1164GAME( 200?, potc_600gf   ,potc_600,   sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v6.00 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1165GAME( 200?, sh_141       ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "Shrek v1.41", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1166GAME( 200?, skc_090      ,skc_105,   sam, sam, driver_device, 0, ROT0, "Stern", "Simpsons Kooky Carnival (Redemption) v0.90 New Jersey", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1160GAME( 200?, potc_600     ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v6.00 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1161GAME( 200?, potc_600ai   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v6.00 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1162GAME( 200?, potc_600as   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v6.00 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1163GAME( 200?, potc_600gf   ,potc_600, sam, sam, driver_device, 0, ROT0, "Stern", "Pirates of the Caribbean v6.00 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1164GAME( 200?, sh_141       ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "Shrek v1.41", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1165GAME( 200?, skc_090      ,skc_105,  sam, sam, driver_device, 0, ROT0, "Stern", "Simpsons Kooky Carnival (Redemption) v0.90 New Jersey", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
11671166// Missing version 1.00
11681167// Missing version 1.01  April 10, 2006
11691168// Missing version 1.02  April 12, 2006
1170GAME( 200?, skc_103      ,skc_105,   sam, sam, driver_device, 0, ROT0, "Stern", "Simpsons Kooky Carnival (Redemption) v1.03", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1169GAME( 200?, skc_103      ,skc_105,  sam, sam, driver_device, 0, ROT0, "Stern", "Simpsons Kooky Carnival (Redemption) v1.03", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
11711170// Missing version 1.04  May 12, 2006
1172GAME( 200?, skc_105      ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "Simpsons Kooky Carnival (Redemption) v1.05", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1173GAME( 200?, sman_130ef   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.30 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1174GAME( 200?, sman_130ei   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.30 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1175GAME( 200?, sman_130es   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.30 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1176GAME( 200?, sman_130gf   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.30 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1177GAME( 200?, sman_140e    ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.40", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1178GAME( 200?, sman_140ef   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.40 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1179GAME( 200?, sman_140ei   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.40 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1180GAME( 200?, sman_140es   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.40 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1181GAME( 200?, sman_140gf   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.40 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1182GAME( 200?, sman_142e    ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.42", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1183GAME( 200?, sman_160e    ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.60", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1184GAME( 200?, sman_160ef   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.60 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1185GAME( 200?, sman_160ei   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.60 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1186GAME( 200?, sman_160es   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.60 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1187GAME( 200?, sman_160gf   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.60 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1188GAME( 200?, sman_170e    ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.70", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1189GAME( 200?, sman_170ef   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.70 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1190GAME( 200?, sman_170ei   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.70 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1191GAME( 200?, sman_170es   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.70 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1192GAME( 200?, sman_170gf   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.70 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1193GAME( 200?, sman_190e    ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.90", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1194GAME( 200?, sman_190ef   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.90 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1195GAME( 200?, sman_190ei   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.90 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1196GAME( 200?, sman_190es   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.90 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1197GAME( 200?, sman_190gf   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.90 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1198GAME( 200?, sman_192e    ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.92", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1199GAME( 200?, sman_192ef   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.92 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1200GAME( 200?, sman_192ei   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.92 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1201GAME( 200?, sman_192es   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.92 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1202GAME( 200?, sman_192gf   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.92 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1203GAME( 200?, sman_200e    ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1204GAME( 200?, sman_210e    ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.10", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1205GAME( 200?, sman_210f    ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.10 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1206GAME( 200?, sman_210ei   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.10 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1207GAME( 200?, sman_210es   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.10 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1208GAME( 200?, sman_210gf   ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.10 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1209GAME( 200?, sman_220e    ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.20", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1210GAME( 200?, sman_230e    ,sman_240,   sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.30", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1211GAME( 200?, sman_240     ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.40", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1212GAME( 200?, wof_100a     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v1.0", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1213GAME( 200?, wof_200a     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v2.0", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1214GAME( 200?, wof_200f     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v2.0 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1215GAME( 200?, wof_200g     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v2.0 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1216GAME( 200?, wof_200i     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v2.0 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1217GAME( 200?, wof_300a     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v3.0", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1218GAME( 200?, wof_300f     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v3.0 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1219GAME( 200?, wof_300g     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v3.0 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1220GAME( 200?, wof_300i     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v3.0 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1221GAME( 200?, wof_300l     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v3.0 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1222GAME( 200?, wof_400a     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v4.0", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1223GAME( 200?, wof_400f     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v4.0 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1224GAME( 200?, wof_400g     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v4.0 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1225GAME( 200?, wof_400i     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v4.0 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1226GAME( 200?, wof_400l     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v4.0 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1227GAME( 200?, wof_500a     ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v5.0", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1228GAME( 200?, wof_500f     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v5.0 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1229GAME( 200?, wof_500g     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v5.0 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1230GAME( 200?, wof_500i     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v5.0 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1231GAME( 200?, wof_500l     ,wof_500a,   sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v5.0 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1232GAME( 200?, wpt_103a     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.03", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1233GAME( 200?, wpt_105a     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.05", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1234GAME( 200?, wpt_106a     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.06", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1235GAME( 200?, wpt_106f     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.06 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1236GAME( 200?, wpt_106g     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.06 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1237GAME( 200?, wpt_106i     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.06 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1238GAME( 200?, wpt_106l     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.06 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1171GAME( 200?, skc_105      ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "Simpsons Kooky Carnival (Redemption) v1.05", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1172GAME( 200?, sman_130ef   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.30 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1173GAME( 200?, sman_130ei   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.30 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1174GAME( 200?, sman_130es   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.30 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1175GAME( 200?, sman_130gf   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.30 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1176GAME( 200?, sman_140e    ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.40", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1177GAME( 200?, sman_140ef   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.40 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1178GAME( 200?, sman_140ei   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.40 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1179GAME( 200?, sman_140es   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.40 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1180GAME( 200?, sman_140gf   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.40 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1181GAME( 200?, sman_142e    ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.42", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1182GAME( 200?, sman_160e    ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.60", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1183GAME( 200?, sman_160ef   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.60 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1184GAME( 200?, sman_160ei   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.60 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1185GAME( 200?, sman_160es   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.60 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1186GAME( 200?, sman_160gf   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.60 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1187GAME( 200?, sman_170e    ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.70", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1188GAME( 200?, sman_170ef   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.70 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1189GAME( 200?, sman_170ei   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.70 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1190GAME( 200?, sman_170es   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.70 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1191GAME( 200?, sman_170gf   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.70 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1192GAME( 200?, sman_190e    ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.90", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1193GAME( 200?, sman_190ef   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.90 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1194GAME( 200?, sman_190ei   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.90 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1195GAME( 200?, sman_190es   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.90 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1196GAME( 200?, sman_190gf   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.90 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1197GAME( 200?, sman_192e    ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.92", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1198GAME( 200?, sman_192ef   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.92 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1199GAME( 200?, sman_192ei   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.92 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1200GAME( 200?, sman_192es   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.92 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1201GAME( 200?, sman_192gf   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v1.92 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1202GAME( 200?, sman_200e    ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1203GAME( 200?, sman_210e    ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.10", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1204GAME( 200?, sman_210f    ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.10 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1205GAME( 200?, sman_210ei   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.10 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1206GAME( 200?, sman_210es   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.10 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1207GAME( 200?, sman_210gf   ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.10 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1208GAME( 200?, sman_220e    ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.20", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1209GAME( 200?, sman_230e    ,sman_240, sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.30", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1210GAME( 200?, sman_240     ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "Spider-Man v2.40", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1211GAME( 200?, wof_100a     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v1.0", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1212GAME( 200?, wof_200a     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v2.0", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1213GAME( 200?, wof_200f     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v2.0 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1214GAME( 200?, wof_200g     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v2.0 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1215GAME( 200?, wof_200i     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v2.0 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1216GAME( 200?, wof_300a     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v3.0", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1217GAME( 200?, wof_300f     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v3.0 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1218GAME( 200?, wof_300g     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v3.0 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1219GAME( 200?, wof_300i     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v3.0 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1220GAME( 200?, wof_300l     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v3.0 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1221GAME( 200?, wof_400a     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v4.0", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1222GAME( 200?, wof_400f     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v4.0 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1223GAME( 200?, wof_400g     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v4.0 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1224GAME( 200?, wof_400i     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v4.0 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1225GAME( 200?, wof_400l     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v4.0 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1226GAME( 200?, wof_500a     ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v5.0", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1227GAME( 200?, wof_500f     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v5.0 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1228GAME( 200?, wof_500g     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v5.0 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1229GAME( 200?, wof_500i     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v5.0 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1230GAME( 200?, wof_500l     ,wof_500a, sam, sam, driver_device, 0, ROT0, "Stern", "Wheel of Fortune v5.0 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1231GAME( 200?, wpt_103a     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.03", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1232GAME( 200?, wpt_105a     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.05", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1233GAME( 200?, wpt_106a     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.06", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1234GAME( 200?, wpt_106f     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.06 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1235GAME( 200?, wpt_106g     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.06 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1236GAME( 200?, wpt_106i     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.06 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1237GAME( 200?, wpt_106l     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.06 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
12391238// Missing version 1.07 should be 5 different files per language
1240GAME( 200?, wpt_108a     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.08", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1241GAME( 200?, wpt_108f     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.08 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1242GAME( 200?, wpt_108g     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.08 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1243GAME( 200?, wpt_108i     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.08 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1244GAME( 200?, wpt_108l     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.08 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1245GAME( 200?, wpt_109a     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.09", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1246GAME( 200?, wpt_109f     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.09 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1247GAME( 200?, wpt_109f2    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.09 (French)(alt)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1248GAME( 200?, wpt_109g     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.09 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1249GAME( 200?, wpt_109i     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.09 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1250GAME( 200?, wpt_109l     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.09 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1251GAME( 200?, wpt_111a     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1252GAME( 200?, wpt_111af    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1253GAME( 200?, wpt_111ai    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1254GAME( 200?, wpt_111al    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1255GAME( 200?, wpt_111f     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1256GAME( 200?, wpt_111g     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1257GAME( 200?, wpt_111gf    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1258GAME( 200?, wpt_111i     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1259GAME( 200?, wpt_111l     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1260GAME( 200?, wpt_112a     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1261GAME( 200?, wpt_112af    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1262GAME( 200?, wpt_112ai    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1263GAME( 200?, wpt_112al    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1264GAME( 200?, wpt_112f     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1265GAME( 200?, wpt_112g     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1266GAME( 200?, wpt_112gf    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1267GAME( 200?, wpt_112i     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1268GAME( 200?, wpt_112l     ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1269GAME( 200?, wpt_1400     ,0,      sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1270GAME( 200?, wpt_1400af   ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1271GAME( 200?, wpt_1400ai   ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1272GAME( 200?, wpt_1400al   ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1273GAME( 200?, wpt_1400f    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1274GAME( 200?, wpt_1400g    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1275GAME( 200?, wpt_1400gf   ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1276GAME( 200?, wpt_1400i    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1277GAME( 200?, wpt_1400l    ,wpt_1400,   sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1239GAME( 200?, wpt_108a     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.08", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1240GAME( 200?, wpt_108f     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.08 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1241GAME( 200?, wpt_108g     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.08 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1242GAME( 200?, wpt_108i     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.08 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1243GAME( 200?, wpt_108l     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.08 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1244GAME( 200?, wpt_109a     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.09", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1245GAME( 200?, wpt_109f     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.09 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1246GAME( 200?, wpt_109f2    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.09 (French)(alt)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1247GAME( 200?, wpt_109g     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.09 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1248GAME( 200?, wpt_109i     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.09 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1249GAME( 200?, wpt_109l     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.09 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1250GAME( 200?, wpt_111a     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1251GAME( 200?, wpt_111af    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1252GAME( 200?, wpt_111ai    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1253GAME( 200?, wpt_111al    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1254GAME( 200?, wpt_111f     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1255GAME( 200?, wpt_111g     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1256GAME( 200?, wpt_111gf    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1257GAME( 200?, wpt_111i     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1258GAME( 200?, wpt_111l     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.11 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1259GAME( 200?, wpt_112a     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1260GAME( 200?, wpt_112af    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1261GAME( 200?, wpt_112ai    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1262GAME( 200?, wpt_112al    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1263GAME( 200?, wpt_112f     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1264GAME( 200?, wpt_112g     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1265GAME( 200?, wpt_112gf    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1266GAME( 200?, wpt_112i     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1267GAME( 200?, wpt_112l     ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v1.12 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1268GAME( 200?, wpt_1400     ,0,        sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1269GAME( 200?, wpt_1400af   ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (English,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1270GAME( 200?, wpt_1400ai   ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (English,Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1271GAME( 200?, wpt_1400al   ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (English,Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1272GAME( 200?, wpt_1400f    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1273GAME( 200?, wpt_1400g    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (German)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1274GAME( 200?, wpt_1400gf   ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (German,French)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1275GAME( 200?, wpt_1400i    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (Italian)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
1276GAME( 200?, wpt_1400l    ,wpt_1400, sam, sam, driver_device, 0, ROT0, "Stern", "World Poker Tour v14.00 (Spanish)", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_MECHANICAL)
trunk/src/mame/drivers/simpl156.c
r31373r31374
394394   MCFG_PALETTE_ADD("palette", 4096)
395395   MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
396396   MCFG_PALETTE_MEMBITS(16)
397   
397
398398   MCFG_GFXDECODE_ADD("gfxdecode", "palette", simpl156)
399399
400400   MCFG_DEVICE_ADD("tilegen1", DECO16IC, 0)
trunk/src/mame/drivers/model2.c
r31373r31374
77    Hardware and protection reverse-engineering and general assistance by ElSemi.
88    MAME driver by R. Belmont, Olivier Galibert, and ElSemi.
99
10   TODO (updated as for April 2014):
11   - all Model 2B games: FIFO comms looks way wrong, and 3d is mostly missing/incomplete. Games also tends to stalls at some point, culprit might be when i960 tries
12     to use a burst type opcode read;
13   - Inputs needs device-ification and clean-ups;
14   - Sound comms actually passes thru a 8251-compatible device, hook it up;
15   - daytona: runs at half speed in gameplay;
16   - desert: several 3d bugs, presumably down to FIFO;
17   - dynamcop: stalls at stage select screen;
18   - fvipers: enables timers, but then irq register is empty, hence it crashes with an "interrupt halt" at POST (regression);
19   - lastbrnx: uses external DMA port 0 for uploading SHARC program, hook-up might not be 100% right;
20   - lastbrnx: uses a shitload of unsupported SHARC opcodes (compute_fmul_avg, shift operation 0x11, ALU operation 0x89 (compute_favg));
21   - lastbrnx: eventually crashes in attract mode, geo_parse_nn_s() is the culprit apparently;
22   - manxtt: missing 3d;
23   - motoraid: stalls after course select;
24   - pltkidsa: after few secs of gameplay, background 3d disappears and everything reports a collision against the player;
25   - skytargt: MAME hardlocks after disclaimer screen;
26   - srallyc: opponent cars flickers like wild;
27   - vcop: lightgun input is offsetted;
28   - vcop: sound dies at enter initial screen (i.e. after played the game once);
29   - vcop: tilemap priority bug at stage select screen;
30   - vf2: stalls after disclaimer screen;
31   - vstriker: countdown in team select goes way too fast ...
32   - vstriker: ... meanwhile gameplay is way too slow!?
33   - zeroguna: stalls after some seconds of gameplay;
10    TODO (updated as for April 2014):
11    - all Model 2B games: FIFO comms looks way wrong, and 3d is mostly missing/incomplete. Games also tends to stalls at some point, culprit might be when i960 tries
12      to use a burst type opcode read;
13    - Inputs needs device-ification and clean-ups;
14    - Sound comms actually passes thru a 8251-compatible device, hook it up;
15    - daytona: runs at half speed in gameplay;
16    - desert: several 3d bugs, presumably down to FIFO;
17    - dynamcop: stalls at stage select screen;
18    - fvipers: enables timers, but then irq register is empty, hence it crashes with an "interrupt halt" at POST (regression);
19    - lastbrnx: uses external DMA port 0 for uploading SHARC program, hook-up might not be 100% right;
20    - lastbrnx: uses a shitload of unsupported SHARC opcodes (compute_fmul_avg, shift operation 0x11, ALU operation 0x89 (compute_favg));
21    - lastbrnx: eventually crashes in attract mode, geo_parse_nn_s() is the culprit apparently;
22    - manxtt: missing 3d;
23    - motoraid: stalls after course select;
24    - pltkidsa: after few secs of gameplay, background 3d disappears and everything reports a collision against the player;
25    - skytargt: MAME hardlocks after disclaimer screen;
26    - srallyc: opponent cars flickers like wild;
27    - vcop: lightgun input is offsetted;
28    - vcop: sound dies at enter initial screen (i.e. after played the game once);
29    - vcop: tilemap priority bug at stage select screen;
30    - vf2: stalls after disclaimer screen;
31    - vstriker: countdown in team select goes way too fast ...
32    - vstriker: ... meanwhile gameplay is way too slow!?
33    - zeroguna: stalls after some seconds of gameplay;
3434
3535    OK (controls may be wrong/missing/incomplete)
3636    --
r31373r31374
548548   return iptval;
549549}
550550
551/*   PORT_DIPSETTING(    0x00, "0" ) // 0: neutral
552   PORT_DIPSETTING(    0x10, "1" ) // 2nd gear
553   PORT_DIPSETTING(    0x20, "2" ) // 1st gear
554   PORT_DIPSETTING(    0x30, "3" )
555   PORT_DIPSETTING(    0x40, "4" )
556   PORT_DIPSETTING(    0x50, "5" ) // 4th gear
557   PORT_DIPSETTING(    0x60, "6" ) // 3rd gear
558   PORT_DIPSETTING(    0x70, "7" )*/
551/*  PORT_DIPSETTING(    0x00, "0" ) // 0: neutral
552    PORT_DIPSETTING(    0x10, "1" ) // 2nd gear
553    PORT_DIPSETTING(    0x20, "2" ) // 1st gear
554    PORT_DIPSETTING(    0x30, "3" )
555    PORT_DIPSETTING(    0x40, "4" )
556    PORT_DIPSETTING(    0x50, "5" ) // 4th gear
557    PORT_DIPSETTING(    0x60, "6" ) // 3rd gear
558    PORT_DIPSETTING(    0x70, "7" )*/
559559
560560/* Used specifically by Sega Rally, others might be different */
561561CUSTOM_INPUT_MEMBER(model2_state::srallyc_gearbox_r)
r31373r31374
774774   }
775775   else
776776   {
777//      if(m_coprocnt == 0)
778//         return;
777//      if(m_coprocnt == 0)
778//          return;
779779
780780      //osd_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space.device().safe_pc());
781781      if (m_dsp_type == DSP_TYPE_SHARC)
trunk/src/mame/drivers/cliffhgr.c
r31373r31374
704704
705705   /* start with the TMS9928a video configuration */
706706   MCFG_DEVICE_ADD( "tms9928a", TMS9128, XTAL_10_738635MHz / 2 )   /* TMS9128NL on the board */
707    MCFG_TMS9928A_VRAM_SIZE(0x4000)
707   MCFG_TMS9928A_VRAM_SIZE(0x4000)
708708   MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(cliffhgr_state, vdp_interrupt))
709709
710710   /* override video rendering and raw screen info */
trunk/src/mame/drivers/popeye.c
r31373r31374
5353
5454   SOLVER(Solver, 48000)
5555   PARAM(Solver.ACCURACY, 1e-5)
56    PARAM(Solver.LTE,     5e-2) // Default is not enough for paddle control
56   PARAM(Solver.LTE,     5e-2) // Default is not enough for paddle control
5757   ANALOG_INPUT(V5, 5)
5858
5959   /* AY 8910 internal resistors */
r31373r31374
482482   MCFG_SOUND_MODIFY("aysnd")
483483   MCFG_SOUND_ROUTES_RESET()
484484   MCFG_AY8910_OUTPUT_TYPE(AY8910_RESISTOR_OUTPUT) /* Does Sky Skipper have the same filtering? */
485    MCFG_AY8910_RES_LOADS(2000.0, 2000.0, 2000.0)
485   MCFG_AY8910_RES_LOADS(2000.0, 2000.0, 2000.0)
486486   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW0"))
487487   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(popeye_state, popeye_portB_w))
488488   MCFG_SOUND_ROUTE_EX(0, "snd_nl", 1.0, 0)
trunk/src/mame/drivers/igs017.c
r31373r31374
8484   required_device<palette_device> m_palette;
8585   optional_shared_ptr<UINT8> m_generic_paletteram_8;
8686   optional_shared_ptr<UINT16> m_generic_paletteram_16;
87   
87
8888   void igs025_to_igs022_callback( void );
8989
9090   int m_toggle;
trunk/src/mame/drivers/niyanpai.c
r31373r31374
789789   MCFG_TMPZ84C011_ZC0_CB(DEVWRITELINE("audiocpu", tmpz84c011_device, trg3))
790790
791791   MCFG_NVRAM_ADD_0FILL("nvram")
792   
792
793793   /* video hardware */
794794   MCFG_SCREEN_ADD("screen", RASTER)
795795   MCFG_SCREEN_REFRESH_RATE(60)
trunk/src/mame/drivers/cobra.c
r31373r31374
32153215   MCFG_K001604_GFX_INDEX2(1)
32163216   MCFG_K001604_LAYER_SIZE(0)
32173217   MCFG_K001604_ROZ_SIZE(1)
3218   MCFG_K001604_TXT_OFFSET(0)   // correct?
3219   MCFG_K001604_ROZ_OFFSET(0)   // correct?
3218   MCFG_K001604_TXT_OFFSET(0)  // correct?
3219   MCFG_K001604_ROZ_OFFSET(0)  // correct?
32203220   MCFG_K001604_GFXDECODE("gfxdecode")
32213221   MCFG_K001604_PALETTE("palette")
32223222
trunk/src/mame/drivers/nl_pongd.c
r31373r31374
9393#endif
9494
9595CIRCUIT_LAYOUT( pongdoubles )
96    SOLVER(Solver, 48000)
97    PARAM(Solver.ACCURACY, 1e-7) // works and is sufficient
96   SOLVER(Solver, 48000)
97   PARAM(Solver.ACCURACY, 1e-7) // works and is sufficient
9898   //CHIP("CLOCK", CLOCK_14_318_MHZ)
99    MAINCLOCK(CLOCK, 14318000.0)
99   MAINCLOCK(CLOCK, 14318000.0)
100100
101101   ANALOG_INPUT(V5, 5)
102102#define VCC "V5", Q
103103#define GND "GND", Q
104104
105    CHIP("F9",  7493)
105   CHIP("F9",  7493)
106106   CHIP("F10", 7493)
107107   CHIP("F7", 74107)
108108   CHIP("F8", 7430)
r31373r31374
110110
111111   CHIP("E9", 7493)
112112   CHIP("E10", 7493)
113    CHIP("D10", 74107)
114    CHIP("D9", 7410)
113   CHIP("D10", 74107)
114   CHIP("D9", 7410)
115115
116    CHIP("G6", 7410)
117    CHIP("H6", 7400)
118    CHIP("F6", 7402)
116   CHIP("G6", 7410)
117   CHIP("H6", 7400)
118   CHIP("F6", 7402)
119119
120    CHIP("F4", 74107)
121    CHIP("G4", 7400)
122    CHIP("G3", 7427)
120   CHIP("F4", 74107)
121   CHIP("G4", 7400)
122   CHIP("G3", 7427)
123123
124    CHIP("E4", 7427)
124   CHIP("E4", 7427)
125125   CHIP("E3", 7410)
126126   CHIP("D3", 7402)
127127   CHIP("G2", 7402)
128128   CHIP("F3", 7425)
129      CHIP("C6", 7448)
129   CHIP("C6", 7448)
130130   CHIP("C7", 74153)
131131   CHIP("D7", 74153)
132132
r31373r31374
138138   CHIP("D6", 7410)
139139   CHIP("D4", 7430)
140140
141    //CHIP("B10", 555_Mono, &b10_555_desc)
142    CHIP_555_Mono(B10, &b10_555_desc)
141   //CHIP("B10", 555_Mono, &b10_555_desc)
142   CHIP_555_Mono(B10, &b10_555_desc)
143143
144    // NETLIST - analog start
145    POT(B10_POT, RES_K(1))     // This is a guess!!
146    PARAM(B10_POT.DIALLOG, 1)  // Log Dial ...
147    RES(B10_RPRE, 470)
144   // NETLIST - analog start
145   POT(B10_POT, RES_K(1))     // This is a guess!!
146   PARAM(B10_POT.DIALLOG, 1)  // Log Dial ...
147   RES(B10_RPRE, 470)
148148
149    NET_C(B10_POT.1, V5)
150    NET_C(B10_POT.3, GND)
151    NET_C(B10_POT.2, B10_RPRE.1)
152    NET_C(B10_RPRE.2, B10.5)
153    // NETLIST - analog end
149   NET_C(B10_POT.1, V5)
150   NET_C(B10_POT.3, GND)
151   NET_C(B10_POT.2, B10_RPRE.1)
152   NET_C(B10_RPRE.2, B10.5)
153   // NETLIST - analog end
154154
155155
156156   CHIP("C10", 7404)
r31373r31374
158158   CHIP("B8", 7400)
159159   CHIP("A8", 7420)
160160
161    //CHIP("A10", 555_Mono, &a10_555_desc)
162    CHIP_555_Mono(A10, &a10_555_desc)
161   //CHIP("A10", 555_Mono, &a10_555_desc)
162   CHIP_555_Mono(A10, &a10_555_desc)
163163
164    // NETLIST - analog start
165    POT(A10_POT, RES_K(1))     // This is a guess!!
166    PARAM(A10_POT.DIALLOG, 1)  // Log Dial ...
167    RES(A10_RPRE, 470)
164   // NETLIST - analog start
165   POT(A10_POT, RES_K(1))     // This is a guess!!
166   PARAM(A10_POT.DIALLOG, 1)  // Log Dial ...
167   RES(A10_RPRE, 470)
168168
169    NET_C(A10_POT.1, V5)
170    NET_C(A10_POT.3, GND)
171    NET_C(A10_POT.2, A10_RPRE.1)
172    NET_C(A10_RPRE.2, A10.5)
173    // NETLIST - analog end
169   NET_C(A10_POT.1, V5)
170   NET_C(A10_POT.3, GND)
171   NET_C(A10_POT.2, A10_RPRE.1)
172   NET_C(A10_RPRE.2, A10.5)
173   // NETLIST - analog end
174174
175    CHIP("A9", 7493)
175   CHIP("A9", 7493)
176176
177177   CHIP("H4", 7474)
178178
r31373r31374
192192   CHIP("B6", 7474)
193193   CHIP("H5", 7400)
194194   CHIP("E7", 7400)
195    //CHIP("F5", 555_Mono, &f5_555_desc)
196    CHIP_555_Mono(F5, &f5_555_desc)
195   //CHIP("F5", 555_Mono, &f5_555_desc)
196   CHIP_555_Mono(F5, &f5_555_desc)
197197
198    //CHIP("G5", 555_Mono, &g5_555_desc)
199    CHIP_555_Mono(G5, &g5_555_desc)
198   //CHIP("G5", 555_Mono, &g5_555_desc)
199   CHIP_555_Mono(G5, &g5_555_desc)
200200   CHIP("C3", 7474)
201201   CHIP("C2", 7400)
202202
203    CHIP("F2", 7493)
203   CHIP("F2", 7493)
204204   CHIP("H2", 7400)
205205   CHIP("H3", 74107)
206206
r31373r31374
211211
212212   CHIP("C8", 7490)
213213   CHIP("D8", 7490)
214    CHIP("C9", 74107)
214   CHIP("C9", 74107)
215215
216    CHIP("A1", 74153)
217    CHIP("B1", 74153)
216   CHIP("A1", 74153)
217   CHIP("B1", 74153)
218218
219    CHIP("B2", 7474)
220    CHIP("H1", 7402)
221    CHIP("G1", 7404)
219   CHIP("B2", 7474)
220   CHIP("H1", 7402)
221   CHIP("G1", 7404)
222222
223    CHIP("E1", 7400)
224    CHIP("A2", 7420)
225    CHIP("D1", 7493)
226    CHIP("C1", 7493)
223   CHIP("E1", 7400)
224   CHIP("A2", 7420)
225   CHIP("D1", 7493)
226   CHIP("C1", 7493)
227227
228    CHIP("J1", 7474)
229    CHIP("F1", 7427)
228   CHIP("J1", 7474)
229   CHIP("F1", 7427)
230230
231    CHIP("J10", 7400)
232    CHIP("H10", 7474)
233    CHIP("G10", 7474)
234    //CHIP("A3", 555_Mono, &a3_555_desc)
235    CHIP_555_Mono(A3, &a3_555_desc)
231   CHIP("J10", 7400)
232   CHIP("H10", 7474)
233   CHIP("G10", 7474)
234   //CHIP("A3", 555_Mono, &a3_555_desc)
235   CHIP_555_Mono(A3, &a3_555_desc)
236236
237    //CHIP("B9A", 555_Mono, &b9a_555_desc)
238    CHIP_555_Mono(B9A, &b9a_555_desc)
237   //CHIP("B9A", 555_Mono, &b9a_555_desc)
238   CHIP_555_Mono(B9A, &b9a_555_desc)
239239
240    // NETLIST - analog start
241    POT(B9A_POT, RES_K(1))     // This is a guess!!
242    PARAM(B9A_POT.DIALLOG, 1)  // Log Dial ...
243    RES(B9A_RPRE, 470)
240   // NETLIST - analog start
241   POT(B9A_POT, RES_K(1))     // This is a guess!!
242   PARAM(B9A_POT.DIALLOG, 1)  // Log Dial ...
243   RES(B9A_RPRE, 470)
244244
245    NET_C(B9A_POT.1, V5)
246    NET_C(B9A_POT.3, GND)
247    NET_C(B9A_POT.2, B9A_RPRE.1)
248    NET_C(B9A_RPRE.2, B9A.5)
249    // NETLIST - analog end
245   NET_C(B9A_POT.1, V5)
246   NET_C(B9A_POT.3, GND)
247   NET_C(B9A_POT.2, B9A_RPRE.1)
248   NET_C(B9A_RPRE.2, B9A.5)
249   // NETLIST - analog end
250250
251    //CHIP("B9B", 555_Mono, &b9b_555_desc)
252    CHIP_555_Mono(B9B, &b9b_555_desc)
251   //CHIP("B9B", 555_Mono, &b9b_555_desc)
252   CHIP_555_Mono(B9B, &b9b_555_desc)
253253
254    // NETLIST - analog start
255    POT(B9B_POT, RES_K(1))     // This is a guess!!
256    PARAM(B9B_POT.DIALLOG, 1)  // Log Dial ...
257    RES(B9B_RPRE, 470)
254   // NETLIST - analog start
255   POT(B9B_POT, RES_K(1))     // This is a guess!!
256   PARAM(B9B_POT.DIALLOG, 1)  // Log Dial ...
257   RES(B9B_RPRE, 470)
258258
259    NET_C(B9B_POT.1, V5)
260    NET_C(B9B_POT.3, GND)
261    NET_C(B9B_POT.2, B9B_RPRE.1)
262    NET_C(B9B_RPRE.2, B9B.5)
263    // NETLIST - analog end
259   NET_C(B9B_POT.1, V5)
260   NET_C(B9B_POT.3, GND)
261   NET_C(B9B_POT.2, B9B_RPRE.1)
262   NET_C(B9B_RPRE.2, B9B.5)
263   // NETLIST - analog end
264264
265    CHIP_SERIES_RC(C33, &c33_desc)
265   CHIP_SERIES_RC(C33, &c33_desc)
266266
267267#if 0
268    CHIP("PAD1", PADDLE1_VERTICAL_INPUT, &pad1_desc)
269    PADDLE_CONNECTION("PAD1", "A10")
268   CHIP("PAD1", PADDLE1_VERTICAL_INPUT, &pad1_desc)
269   PADDLE_CONNECTION("PAD1", "A10")
270270
271    CHIP("PAD2", PADDLE2_VERTICAL_INPUT, &pad2_desc)
272    PADDLE_CONNECTION("PAD2", "B10")
271   CHIP("PAD2", PADDLE2_VERTICAL_INPUT, &pad2_desc)
272   PADDLE_CONNECTION("PAD2", "B10")
273273
274    CHIP("PAD3", PADDLE3_VERTICAL_INPUT, &pad3_desc)
275    PADDLE_CONNECTION("PAD3", "B9B")
274   CHIP("PAD3", PADDLE3_VERTICAL_INPUT, &pad3_desc)
275   PADDLE_CONNECTION("PAD3", "B9B")
276276
277    CHIP("PAD4", PADDLE4_VERTICAL_INPUT, &pad4_desc)
278    PADDLE_CONNECTION("PAD4", "B9A")
277   CHIP("PAD4", PADDLE4_VERTICAL_INPUT, &pad4_desc)
278   PADDLE_CONNECTION("PAD4", "B9A")
279279
280    CHIP("LATCH", LATCH)
281    CHIP("COIN", COIN_INPUT)
282    CHIP("START", START_INPUT)
283    CHIP("DIPSW1", DIPSWITCH, &dipswitch1_desc)
280   CHIP("LATCH", LATCH)
281   CHIP("COIN", COIN_INPUT)
282   CHIP("START", START_INPUT)
283   CHIP("DIPSW1", DIPSWITCH, &dipswitch1_desc)
284284
285    VIDEO(pongdoubles)
285   VIDEO(pongdoubles)
286286#endif
287287
288    //CHIP("COIN", COIN_INPUT)
289    CHIP_INPUT_ACTIVE_LOW(COIN)
290    //CHIP("LATCH", LATCH)
291    CHIP_LATCH(LATCH)
292    //CHIP("START", START_INPUT)
293    CHIP_INPUT_ACTIVE_HIGH(START)
294    //CHIP("DIPSW1", DIPSWITCH, &dipswitch1_desc)
295    SWITCH2(DIPSW1)
296    SWITCH2(DIPSW2)
288   //CHIP("COIN", COIN_INPUT)
289   CHIP_INPUT_ACTIVE_LOW(COIN)
290   //CHIP("LATCH", LATCH)
291   CHIP_LATCH(LATCH)
292   //CHIP("START", START_INPUT)
293   CHIP_INPUT_ACTIVE_HIGH(START)
294   //CHIP("DIPSW1", DIPSWITCH, &dipswitch1_desc)
295   SWITCH2(DIPSW1)
296   SWITCH2(DIPSW2)
297297#ifdef DEBUG
298298   CHIP("LOG1", VCD_LOG, &vcd_log_desc)
299299#endif
300300
301301   // Not used, need to be connected
302    CONNECTION(GND, "C2", 1)
303    CONNECTION(GND, "C2", 2)
304    CONNECTION(GND, "A5", 1)
305    CONNECTION(GND, "A5", 2)
306    CONNECTION(GND, "G7", 4)
307    CONNECTION(GND, "G7", 1)
308    CONNECTION(GND, "G7",13)
309    CONNECTION(GND, "G7",12)
310    CONNECTION(GND, "J10",13)
311    CONNECTION(GND, "J10",12)
312    CONNECTION(GND, "C10",9)
313    CONNECTION(GND, "C10",11)
314    CONNECTION(GND, "C10",13)
315    CONNECTION(GND, "B1",10)
316    CONNECTION(GND, "B1",11)
317    CONNECTION(GND, "B1",12)
318    CONNECTION(GND, "B1",13)
319    CONNECTION(GND, "E7",12)
320    CONNECTION(GND, "E7",13)
321    CONNECTION(GND, "H1",11)
322    CONNECTION(GND, "H1",12)
323    CONNECTION(GND, "G1",9)
302   CONNECTION(GND, "C2", 1)
303   CONNECTION(GND, "C2", 2)
304   CONNECTION(GND, "A5", 1)
305   CONNECTION(GND, "A5", 2)
306   CONNECTION(GND, "G7", 4)
307   CONNECTION(GND, "G7", 1)
308   CONNECTION(GND, "G7",13)
309   CONNECTION(GND, "G7",12)
310   CONNECTION(GND, "J10",13)
311   CONNECTION(GND, "J10",12)
312   CONNECTION(GND, "C10",9)
313   CONNECTION(GND, "C10",11)
314   CONNECTION(GND, "C10",13)
315   CONNECTION(GND, "B1",10)
316   CONNECTION(GND, "B1",11)
317   CONNECTION(GND, "B1",12)
318   CONNECTION(GND, "B1",13)
319   CONNECTION(GND, "E7",12)
320   CONNECTION(GND, "E7",13)
321   CONNECTION(GND, "H1",11)
322   CONNECTION(GND, "H1",12)
323   CONNECTION(GND, "G1",9)
324324
325    // HRESET Circuit
325   // HRESET Circuit
326326
327    CONNECTION("CLOCK", Q, "F7", 12)
328    CONNECTION(VCC, "F7", 1)
329    CONNECTION(VCC, "F7", 4)
330    CONNECTION(VCC, "F7", 13)
327   CONNECTION("CLOCK", Q, "F7", 12)
328   CONNECTION(VCC, "F7", 1)
329   CONNECTION(VCC, "F7", 4)
330   CONNECTION(VCC, "F7", 13)
331331
332    #define CLK "F7", 3
332   #define CLK "F7", 3
333333
334334   CONNECTION("F9", 12, "F9", 1)
335335   CONNECTION(CLK, "F9", 14)
r31373r31374
348348
349349   CONNECTION("F7", 5, "F8", 1)
350350   CONNECTION("F10", 11, "F8", 11)
351    CONNECTION("F10", 8, "F8", 12)
351   CONNECTION("F10", 8, "F8", 12)
352352   CONNECTION("F9", 8, "F8", 5)
353353   CONNECTION("F9", 9, "F8", 6)
354    CONNECTION(VCC, "F8", 2)
354   CONNECTION(VCC, "F8", 2)
355355   CONNECTION(VCC, "F8", 3)
356356   CONNECTION(VCC, "F8", 4)
357357
r31373r31374
360360   CONNECTION(VCC, "E8", 13)
361361   CONNECTION(VCC, "E8", 10)
362362
363    #define H1 "F9", 12
364    #define H2 "F9", 9
365    #define H4 "F9", 8
366    #define H8 "F9", 11
367    #define H16 "F10", 12
368    #define H32 "F10", 9
369    #define H64 "F10", 8
370    #define H128 "F10", 11
371    #define H256 "F7", 5
372    #define H256_n "F7", 6
373    #define HRESET "E8", 8
374    #define HRESET_n "E8", 9
363   #define H1 "F9", 12
364   #define H2 "F9", 9
365   #define H4 "F9", 8
366   #define H8 "F9", 11
367   #define H16 "F10", 12
368   #define H32 "F10", 9
369   #define H64 "F10", 8
370   #define H128 "F10", 11
371   #define H256 "F7", 5
372   #define H256_n "F7", 6
373   #define HRESET "E8", 8
374   #define HRESET_n "E8", 9
375375
376376
377    // VRESET Circuit
377   // VRESET Circuit
378378   CONNECTION("E9", 12, "E9", 1)
379    CONNECTION(HRESET, "E9", 14)
379   CONNECTION(HRESET, "E9", 14)
380380   CONNECTION("E8", 6, "E9", 2)
381381   CONNECTION("E8", 6, "E9", 3)
382382
r31373r31374
399399   CONNECTION(VCC, "E8", 1)
400400   CONNECTION(VCC, "E8", 4)
401401
402    #define V1 "E9", 12
403    #define V2 "E9", 9
404    #define V4 "E9", 8
405    #define V8 "E9", 11
406    #define V16 "E10", 12
407    #define V32 "E10", 9
408    #define V64 "E10", 8
409    #define V128 "E10", 11
410    #define V256 "D10", 5
411    #define V256_n "D10", 6
412    #define VRESET "E8", 6
413    #define VRESET_n "E8", 5
402   #define V1 "E9", 12
403   #define V2 "E9", 9
404   #define V4 "E9", 8
405   #define V8 "E9", 11
406   #define V16 "E10", 12
407   #define V32 "E10", 9
408   #define V64 "E10", 8
409   #define V128 "E10", 11
410   #define V256 "D10", 5
411   #define V256_n "D10", 6
412   #define VRESET "E8", 6
413   #define VRESET_n "E8", 5
414414
415415
416    // HSync Logic
417    CONNECTION(H16, "G6", 3)
418    CONNECTION(H64, "G6", 4)
419    CONNECTION(H64, "G6", 5)
416   // HSync Logic
417   CONNECTION(H16, "G6", 3)
418   CONNECTION(H64, "G6", 4)
419   CONNECTION(H64, "G6", 5)
420420
421    CONNECTION("G6", 6, "H6", 4)
422    CONNECTION(HRESET_n, "H6", 10)
423    CONNECTION("H6", 6, "H6", 9)
424    CONNECTION("H6", 8, "H6", 5)
421   CONNECTION("G6", 6, "H6", 4)
422   CONNECTION(HRESET_n, "H6", 10)
423   CONNECTION("H6", 6, "H6", 9)
424   CONNECTION("H6", 8, "H6", 5)
425425
426    CONNECTION(H64, "D2", 9)
426   CONNECTION(H64, "D2", 9)
427427
428    CONNECTION(H64, "D3", 3)
429    CONNECTION("H6", 6, "D3", 2)
428   CONNECTION(H64, "D3", 3)
429   CONNECTION("H6", 6, "D3", 2)
430430
431    CONNECTION("D2", 8, "C2", 9)
432    //CONNECTION("D2", 8, "C2", 10)
433    CONNECTION(H32, "C2", 10) // Not shown. Accurate?
431   CONNECTION("D2", 8, "C2", 9)
432   //CONNECTION("D2", 8, "C2", 10)
433   CONNECTION(H32, "C2", 10) // Not shown. Accurate?
434434
435    CONNECTION(VCC, "B2", 10)
436    CONNECTION("C2", 8, "B2", 12)
437    CONNECTION(H16, "B2", 11)
438    CONNECTION("D3", 1, "B2", 13)
435   CONNECTION(VCC, "B2", 10)
436   CONNECTION("C2", 8, "B2", 12)
437   CONNECTION(H16, "B2", 11)
438   CONNECTION("D3", 1, "B2", 13)
439439
440    #define HBLANK "H6", 8
441    #define HBLANK_n "H6", 6
442    #define HSYNC_n "B2", 8
440   #define HBLANK "H6", 8
441   #define HBLANK_n "H6", 6
442   #define HSYNC_n "B2", 8
443443
444    // VSync Logic
445    CONNECTION(VRESET, "F6", 8)
446    CONNECTION(V16, "F6", 12)
447    CONNECTION("F6", 10, "F6", 11)
448    CONNECTION("F6", 13, "F6", 9)
444   // VSync Logic
445   CONNECTION(VRESET, "F6", 8)
446   CONNECTION(V16, "F6", 12)
447   CONNECTION("F6", 10, "F6", 11)
448   CONNECTION("F6", 13, "F6", 9)
449449
450    CONNECTION(V8, "H6", 1)
451    CONNECTION(V8, "H6", 2)
450   CONNECTION(V8, "H6", 1)
451   CONNECTION(V8, "H6", 2)
452452
453    CONNECTION("F6", 13, "G6", 1)
454    CONNECTION(V4, "G6", 2)
455    CONNECTION("H6", 3, "G6", 13)
453   CONNECTION("F6", 13, "G6", 1)
454   CONNECTION(V4, "G6", 2)
455   CONNECTION("H6", 3, "G6", 13)
456456
457    #define VBLANK "F6", 13
458    #define VBLANK_n "F6", 10
457   #define VBLANK "F6", 13
458   #define VBLANK_n "F6", 10
459459
460460
461    // Net circuit
462    CONNECTION(H256, "F4", 8)
463    CONNECTION(H256_n, "F4", 11)
464    CONNECTION(CLK, "F4", 9)
465    CONNECTION(VCC, "F4", 10)
461   // Net circuit
462   CONNECTION(H256, "F4", 8)
463   CONNECTION(H256_n, "F4", 11)
464   CONNECTION(CLK, "F4", 9)
465   CONNECTION(VCC, "F4", 10)
466466
467    CONNECTION("F4", 6, "G4", 5)
468    CONNECTION(H256, "G4", 4)
467   CONNECTION("F4", 6, "G4", 5)
468   CONNECTION(H256, "G4", 4)
469469
470    CONNECTION(V4, "G3", 3)
471    CONNECTION(VBLANK, "G3", 4)
472    CONNECTION("G4", 6, "G3", 5)
470   CONNECTION(V4, "G3", 3)
471   CONNECTION(VBLANK, "G3", 4)
472   CONNECTION("G4", 6, "G3", 5)
473473
474    #define NET "G3", 6
474   #define NET "G3", 6
475475
476476
477    // Score decoding circuit
477   // Score decoding circuit
478478   CONNECTION("C9", 2, "D7", 6)
479479   CONNECTION("C8", 8, "D7", 5)
480480   CONNECTION("C9", 6, "D7", 4)
r31373r31374
501501   CONNECTION(GND, "C7", 1)
502502   CONNECTION(GND, "C7", 15)
503503
504    CONNECTION(H128, "E4", 1)
504   CONNECTION(H128, "E4", 1)
505505   CONNECTION(H128, "E4", 2)
506506   CONNECTION(H128, "E4", 13)
507507
r31373r31374
600600   CONNECTION("D6", 6, "D4", 3)
601601
602602
603    // Coin / Start Logic
604    CONNECTION("COIN", 1, "C10", 5)
603   // Coin / Start Logic
604   CONNECTION("COIN", 1, "C10", 5)
605605
606    // Capacitor C33 used to drive a ~0.1ms low pulse
607    // onto A3 pin 2 at the falling edge of COIN.
608    CONNECTION("COIN", 1, "C33", 1)
609    CONNECTION(VCC, "C33", 2)
606   // Capacitor C33 used to drive a ~0.1ms low pulse
607   // onto A3 pin 2 at the falling edge of COIN.
608   CONNECTION("COIN", 1, "C33", 1)
609   CONNECTION(VCC, "C33", 2)
610610
611    CONNECTION(VCC, "A3", 4)
612    CONNECTION("C33", 3, "A3", 2)
611   CONNECTION(VCC, "A3", 4)
612   CONNECTION("C33", 3, "A3", 2)
613613
614    CONNECTION("A3", 3, "D2", 11)
614   CONNECTION("A3", 3, "D2", 11)
615615
616    CONNECTION(VCC, "B2", 4)
617    CONNECTION("D2", 10, "B2", 3)
618    CONNECTION("C10", 6, "B2", 2)
619    CONNECTION("C10", 6, "B2", 1)
616   CONNECTION(VCC, "B2", 4)
617   CONNECTION("D2", 10, "B2", 3)
618   CONNECTION("C10", 6, "B2", 2)
619   CONNECTION("C10", 6, "B2", 1)
620620
621    CONNECTION("J10", 3, "LATCH", 1)
622    CONNECTION("B2", 6, "LATCH", 2)
621   CONNECTION("J10", 3, "LATCH", 1)
622   CONNECTION("B2", 6, "LATCH", 2)
623623
624    CONNECTION("LATCH", 3, "H6", 12)
625    CONNECTION("LATCH", 3, "H6", 13) // Wrong pins on schematic
624   CONNECTION("LATCH", 3, "H6", 12)
625   CONNECTION("LATCH", 3, "H6", 13) // Wrong pins on schematic
626626
627    CONNECTION("START", 1, "J10", 9)
628    CONNECTION("START", 1, "J10", 10)
627   CONNECTION("START", 1, "J10", 9)
628   CONNECTION("START", 1, "J10", 10)
629629
630    CONNECTION(VCC, "C3", 10)
631    CONNECTION("H10", 6, "C3", 12)
632    CONNECTION("B2", 5, "C3", 11)
633    CONNECTION(VCC, "C3", 13)
630   CONNECTION(VCC, "C3", 10)
631   CONNECTION("H10", 6, "C3", 12)
632   CONNECTION("B2", 5, "C3", 11)
633   CONNECTION(VCC, "C3", 13)
634634
635    CONNECTION("H6", 11, "H10", 4)
636    CONNECTION(VCC, "H10", 2)
637    CONNECTION("B2", 6, "H10", 1)
638    CONNECTION("G10", 9, "H10", 3)
635   CONNECTION("H6", 11, "H10", 4)
636   CONNECTION(VCC, "H10", 2)
637   CONNECTION("B2", 6, "H10", 1)
638   CONNECTION("G10", 9, "H10", 3)
639639
640    CONNECTION("H10", 5, "J10", 2)
641    CONNECTION("G10", 9, "J10", 1)
640   CONNECTION("H10", 5, "J10", 2)
641   CONNECTION("G10", 9, "J10", 1)
642642
643    CONNECTION(VCC, "G10", 4)
644    CONNECTION("G10", 9, "G10", 2)
645    CONNECTION("J10", 8, "G10", 3)
646    CONNECTION("H10", 8, "G10", 1)
643   CONNECTION(VCC, "G10", 4)
644   CONNECTION("G10", 9, "G10", 2)
645   CONNECTION("J10", 8, "G10", 3)
646   CONNECTION("H10", 8, "G10", 1)
647647
648    CONNECTION(VCC, "H10", 10)
649    CONNECTION("G10", 5, "H10", 12)
650    CONNECTION(V256, "H10", 11)
651    CONNECTION(VCC, "H10", 13)
648   CONNECTION(VCC, "H10", 10)
649   CONNECTION("G10", 5, "H10", 12)
650   CONNECTION(V256, "H10", 11)
651   CONNECTION(VCC, "H10", 13)
652652
653    CONNECTION("H10", 9, "J10", 4)
654    CONNECTION("H10", 6, "J10", 5)
653   CONNECTION("H10", 9, "J10", 4)
654   CONNECTION("H10", 6, "J10", 5)
655655
656    CONNECTION("H6", 11, "G10", 10)
657    CONNECTION(VCC, "G10", 12)
658    CONNECTION("B3", 3, "G10", 11)
659    CONNECTION("J10", 6, "G10", 13) // Schematic shows pin 10
656   CONNECTION("H6", 11, "G10", 10)
657   CONNECTION(VCC, "G10", 12)
658   CONNECTION("B3", 3, "G10", 11)
659   CONNECTION("J10", 6, "G10", 13) // Schematic shows pin 10
660660
661    CONNECTION("J10", 6, "E5", 9) // Schematic says E6?
661   CONNECTION("J10", 6, "E5", 9) // Schematic says E6?
662662
663    #define ATTRACT_n "D2", 4
664    #define ATTRACT   "G10", 9
663   #define ATTRACT_n "D2", 4
664   #define ATTRACT   "G10", 9
665665
666    #define SRST "E5", 8
667    #define SRST_n "J10", 6
666   #define SRST "E5", 8
667   #define SRST_n "J10", 6
668668
669669
670    // Game Control Logic
670   // Game Control Logic
671671   CONNECTION("H7", 6, "E7", 9)
672672   CONNECTION("H6", 8, "E7", 10)
673673
r31373r31374
677677   CONNECTION(ATTRACT_n, "E2", 2)
678678
679679   CONNECTION(SRST_n, "E7", 4)
680    CONNECTION("E7", 8, "E7", 5)
680   CONNECTION("E7", 8, "E7", 5)
681681
682682   CONNECTION("E7", 6, "E7", 1)
683683   CONNECTION("E7", 6, "E7", 2)
r31373r31374
694694   CONNECTION(VCC, "B6", 10)
695695   CONNECTION("G3", 8, "B6", 11)
696696
697    CONNECTION(ATTRACT, "D2", 3)
697   CONNECTION(ATTRACT, "D2", 3)
698698
699699
700700
701    // Horizontal Ball Counter
701   // Horizontal Ball Counter
702702   CONNECTION(ATTRACT_n, "E2", 4)
703    CONNECTION("B6", 8, "E2", 5)
703   CONNECTION("B6", 8, "E2", 5)
704704
705705   CONNECTION("H5", 8, "G8", 3)
706706   CONNECTION("H5", 6, "G8", 4)
r31373r31374
732732   CONNECTION("H8", 15, "H7", 12)
733733   CONNECTION("G7", 5, "H7", 13)
734734
735    #define HVID_n "H7", 8
735   #define HVID_n "H7", 8
736736
737737   CONNECTION("H8", 15, "G6", 9)
738738   CONNECTION("G8", 15, "G6", 10)
r31373r31374
777777   CONNECTION("E3", 6, "D3", 11)
778778   CONNECTION("E3", 6, "D3", 12)
779779
780    #define VVID_n "E3", 6
781    #define VVID   "D3", 13
780   #define VVID_n "E3", 6
781   #define VVID   "D3", 13
782782
783783
784784   // Hit Logic
r31373r31374
797797   CONNECTION("B3", 8, "B3", 12)
798798   CONNECTION("B3", 8, "B3", 13)
799799
800    #define HIT   "B3", 8
801    #define HIT_n "B3", 11
800   #define HIT   "B3", 8
801   #define HIT_n "B3", 11
802802
803803
804    // Horizontal Ball Control
804   // Horizontal Ball Control
805805   CONNECTION("E2", 8, "E2", 12)
806806   CONNECTION("C3", 6, "E2", 13)
807807
r31373r31374
854854   CONNECTION("G4", 11, "H4", 13)
855855   CONNECTION("G4", 3, "H4", 10)
856856
857    CONNECTION("H5", 3, "H5", 12)
857   CONNECTION("H5", 3, "H5", 12)
858858   CONNECTION("H4", 9, "H5", 13)
859859
860860   CONNECTION("H5", 3, "H5", 4)
r31373r31374
874874   CONNECTION(H64, "B1", 14)
875875   CONNECTION(H256, "B1", 2)
876876   CONNECTION(GND, "B1", 1)
877    CONNECTION(GND, "B1", 15) // Added
877   CONNECTION(GND, "B1", 15) // Added
878878
879    CONNECTION("A7", 8, "A1", 6)
879   CONNECTION("A7", 8, "A1", 6)
880880   CONNECTION("D1", 8, "A1", 5)
881881   CONNECTION("A9", 8, "A1", 4)
882882   CONNECTION("C1", 8, "A1", 3)
r31373r31374
943943
944944
945945
946    // Paddle 1 Vertical
946   // Paddle 1 Vertical
947947   CONNECTION(V256_n, "B10", 2)
948948   CONNECTION(VCC, "B10", 4)
949949
r31373r31374
966966   CONNECTION("A8", 8, "B8", 2)
967967
968968   // Paddle 1N Vertical
969    CONNECTION(V256_n, "B9A", 2)
969   CONNECTION(V256_n, "B9A", 2)
970970   CONNECTION(VCC, "B9A", 4)
971971
972972   CONNECTION("B9A", 3, "G1", 1)
r31373r31374
10121012   CONNECTION("A8", 6, "B8", 12)
10131013
10141014   // Paddle 2N Vertical
1015    CONNECTION(V256_n, "B9B", 2)
1015   CONNECTION(V256_n, "B9B", 2)
10161016   CONNECTION(VCC, "B9B", 4)
10171017
10181018   CONNECTION("B9B", 3, "G1", 3)
r31373r31374
10341034   CONNECTION("A2", 6, "E1", 10)
10351035
10361036
1037    // Paddle N Horizontal
1038    CONNECTION(H64, "G1", 5)
1037   // Paddle N Horizontal
1038   CONNECTION(H64, "G1", 5)
10391039
1040    CONNECTION(VCC, "J1", 4)
1041    CONNECTION("G1", 6, "J1", 2)
1042    CONNECTION(H4, "J1", 3)
1043    CONNECTION(ATTRACT_n, "J1", 1)
1040   CONNECTION(VCC, "J1", 4)
1041   CONNECTION("G1", 6, "J1", 2)
1042   CONNECTION(H4, "J1", 3)
1043   CONNECTION(ATTRACT_n, "J1", 1)
10441044
1045    CONNECTION("C3", 9, "J1", 10)
1046    CONNECTION(VCC, "J1", 12)
1047    CONNECTION("G4", 8, "J1", 11)
1048    CONNECTION(H256, "J1", 13)
1045   CONNECTION("C3", 9, "J1", 10)
1046   CONNECTION(VCC, "J1", 12)
1047   CONNECTION("G4", 8, "J1", 11)
1048   CONNECTION(H256, "J1", 13)
10491049
1050    CONNECTION("J1", 9, "F1", 4)
1051    CONNECTION("G1", 6, "F1", 3)
1052    CONNECTION("J1", 6, "F1", 5)
1050   CONNECTION("J1", 9, "F1", 4)
1051   CONNECTION("G1", 6, "F1", 3)
1052   CONNECTION("J1", 6, "F1", 5)
10531053
1054    CONNECTION("F1", 6, "H1", 8)
1055    CONNECTION("F1", 6, "H1", 9)
1054   CONNECTION("F1", 6, "H1", 8)
1055   CONNECTION("F1", 6, "H1", 9)
10561056
1057    CONNECTION("H1", 10, "F1", 13)
1058    CONNECTION(H256, "F1", 2) // Schematic says 256V
1059    CONNECTION("E1", 11, "F1", 1)
1057   CONNECTION("H1", 10, "F1", 13)
1058   CONNECTION(H256, "F1", 2) // Schematic says 256V
1059   CONNECTION("E1", 11, "F1", 1)
10601060
1061    CONNECTION("H1", 10, "F1", 11)
1062    CONNECTION(H256_n, "F1", 9)
1063    CONNECTION("E1", 8, "F1", 10)
1061   CONNECTION("H1", 10, "F1", 11)
1062   CONNECTION(H256_n, "F1", 9)
1063   CONNECTION("E1", 8, "F1", 10)
10641064
10651065
10661066   // Paddle Horizontal
r31373r31374
10801080   CONNECTION(H256_n, "G3", 2)
10811081   CONNECTION("G4", 8, "G3", 13)
10821082
1083    CONNECTION("F1", 12, "H1", 2)
1084    CONNECTION("G3", 8, "H1", 3)
1083   CONNECTION("F1", 12, "H1", 2)
1084   CONNECTION("G3", 8, "H1", 3)
10851085
1086    CONNECTION("F1", 8, "H1", 5)
1087    CONNECTION("G3", 12, "H1", 6)
1086   CONNECTION("F1", 8, "H1", 5)
1087   CONNECTION("G3", 12, "H1", 6)
10881088
1089    CONNECTION("H1", 1, "G1", 13)
1090    CONNECTION("H1", 4, "G1", 11)
1089   CONNECTION("H1", 1, "G1", 13)
1090   CONNECTION("H1", 4, "G1", 11)
10911091
10921092
10931093   // Sound
r31373r31374
11511151   CONNECTION(VCC, "C9", 11)
11521152   CONNECTION(SRST_n, "C9", 10)
11531153
1154    CONNECTION(VCC, "DIPSW1", 1)
1155    CONNECTION("C8", 8, "DIPSW1", 2)
1154   CONNECTION(VCC, "DIPSW1", 1)
1155   CONNECTION("C8", 8, "DIPSW1", 2)
11561156
11571157   CONNECTION("C8", 12, "D9", 1)
1158    //CONNECTION("DIPSW1", 3, "D9", 2)
1158   //CONNECTION("DIPSW1", 3, "D9", 2)
11591159   CONNECTION("DIPSW1", Q, "D9", 2)
11601160   CONNECTION("C9", 3, "D9", 13)
11611161
1162    //CONNECTION(VCC, "DIPSW1", 4)
1163    //CONNECTION("D8", 8, "DIPSW1", 5)
1164    CONNECTION(VCC, "DIPSW2", 1)
1165    CONNECTION("D8", 8, "DIPSW2", 2)
1162   //CONNECTION(VCC, "DIPSW1", 4)
1163   //CONNECTION("D8", 8, "DIPSW1", 5)
1164   CONNECTION(VCC, "DIPSW2", 1)
1165   CONNECTION("D8", 8, "DIPSW2", 2)
11661166
11671167   CONNECTION("D8", 12, "D9", 3)
1168    //CONNECTION("DIPSW1", 6, "D9", 4)
1168   //CONNECTION("DIPSW1", 6, "D9", 4)
11691169   CONNECTION("DIPSW2", Q, "D9", 4)
11701170   CONNECTION("C9", 5, "D9", 5)
11711171
1172    CONNECTION("D9", 12, "B3", 1)
1173    CONNECTION("D9", 6, "B3", 2)
1172   CONNECTION("D9", 12, "B3", 1)
1173   CONNECTION("D9", 6, "B3", 2)
11741174
1175    // Missing Logic in DICE
1175   // Missing Logic in DICE
11761176
1177    NET_C(G6.12, A5.13)
1178    NET_C(B2.8, A5.12)
1179    NET_C(A5.11, E5.11)
1177   NET_C(G6.12, A5.13)
1178   NET_C(B2.8, A5.12)
1179   NET_C(A5.11, E5.11)
11801180
1181    // Video Summing
1182    CONNECTION("F3", 13, "G2", 4)  // Ball
1183    CONNECTION("F3", 12, "G1", 10)
1184    CONNECTION("F3", 10, NET)
1185    CONNECTION("F3", 9, "G1", 12)
1181   // Video Summing
1182   CONNECTION("F3", 13, "G2", 4)  // Ball
1183   CONNECTION("F3", 12, "G1", 10)
1184   CONNECTION("F3", 10, NET)
1185   CONNECTION("F3", 9, "G1", 12)
11861186
1187    CONNECTION("F3", 8, "E5", 13)
1187   CONNECTION("F3", 8, "E5", 13)
11881188
1189    // FIXME: pong doubles uses different resistor values!
1190    RES(RV1, 1000)
1191    RES(RV2, 1200)
1192    RES(RV3, 22000)
1193    NET_C(E5.12, RV1.1)     //Video
1194    NET_C(D4.8, RV2.1)      //Score
1195    NET_C(E5.10, RV3.1)
1189   // FIXME: pong doubles uses different resistor values!
1190   RES(RV1, 1000)
1191   RES(RV2, 1200)
1192   RES(RV3, 22000)
1193   NET_C(E5.12, RV1.1)     //Video
1194   NET_C(D4.8, RV2.1)      //Score
1195   NET_C(E5.10, RV3.1)
11961196
1197    NET_C(RV1.2, RV2.2)
1198    NET_C(RV2.2, RV3.2)
1197   NET_C(RV1.2, RV2.2)
1198   NET_C(RV2.2, RV3.2)
11991199
1200    ALIAS(videomix, RV3.2)
1200   ALIAS(videomix, RV3.2)
12011201
12021202#if 0
1203    CONNECTION("VIDEO", 1, "E5", 12) // VIDEO
1204    CONNECTION("VIDEO", 2, "D4", 8)  // SCORE
1203   CONNECTION("VIDEO", 1, "E5", 12) // VIDEO
1204   CONNECTION("VIDEO", 2, "D4", 8)  // SCORE
12051205
1206    CONNECTION("VIDEO", Video::HBLANK_PIN, HBLANK)
1207    CONNECTION("VIDEO", Video::VBLANK_PIN, VBLANK)
1206   CONNECTION("VIDEO", Video::HBLANK_PIN, HBLANK)
1207   CONNECTION("VIDEO", Video::VBLANK_PIN, VBLANK)
12081208#endif
12091209
1210    // Audio Summing
1211    CONNECTION(ATTRACT_n, "C2", 4)
1212    CONNECTION("C5", 6, "C2", 5)
1210   // Audio Summing
1211   CONNECTION(ATTRACT_n, "C2", 4)
1212   CONNECTION("C5", 6, "C2", 5)
12131213
1214    //CONNECTION("AUDIO", 1, "C2", 6)
1215    ALIAS(AUDIO, C2.6)
1214   //CONNECTION("AUDIO", 1, "C2", 6)
1215   ALIAS(AUDIO, C2.6)
12161216
12171217#ifdef DEBUG
1218    CONNECTION("LOG1", 1, "COIN", 1)
1219    CONNECTION("LOG1", 2, "A3", 3)
1220    CONNECTION("LOG1", 3, "B2", 5)
1221    CONNECTION("LOG1", 4, "H10", 5)
1222    CONNECTION("LOG1", 5, "C3", 9)
1223    CONNECTION("LOG1", 6, "G10", 5)
1224    CONNECTION("LOG1", 7, "E2", 6)
1225    CONNECTION("LOG1", 8, "B3", 3)
1218   CONNECTION("LOG1", 1, "COIN", 1)
1219   CONNECTION("LOG1", 2, "A3", 3)
1220   CONNECTION("LOG1", 3, "B2", 5)
1221   CONNECTION("LOG1", 4, "H10", 5)
1222   CONNECTION("LOG1", 5, "C3", 9)
1223   CONNECTION("LOG1", 6, "G10", 5)
1224   CONNECTION("LOG1", 7, "E2", 6)
1225   CONNECTION("LOG1", 8, "B3", 3)
12261226#endif
12271227
12281228
12291229CIRCUIT_LAYOUT_END
1230
1231
trunk/src/mame/drivers/goodejan.c
r31373r31374
4949
5050
5151Diagnostic Menu:
52   Press and keep P1 Start and Reset
53   You'll see cross hatch test screen, then press P1 Start again.
52    Press and keep P1 Start and Reset
53    You'll see cross hatch test screen, then press P1 Start again.
5454
5555
5656Secret menu hack [totmejan only] (I couldn't find official way to enter, so it's a hack):
57   Mame internal debugger:
58   PC=ECFFD ; 'SECRET MENU'
59   Keys: BACKSPC, ENTER, Z, P1 START
57    Mame internal debugger:
58    PC=ECFFD ; 'SECRET MENU'
59    Keys: BACKSPC, ENTER, Z, P1 START
6060
61   PC=E2EE2; 'TODAY: DATA' screen
62   Keys: Z
61    PC=E2EE2; 'TODAY: DATA' screen
62    Keys: Z
6363
64   PC=ECC72; 'HMODE' screen
64    PC=ECC72; 'HMODE' screen
6565
6666
6767*******************************************************************************************/
r31373r31374
496496   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
497497   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
498498
499/*   These games seems have 2 DIP Switches, DIPSW-A and DIPSW-B
500   Game reads these switches at port C000h (16 bit) with two calls (subroutine 0EF522h [totmejan])
499/*  These games seems have 2 DIP Switches, DIPSW-A and DIPSW-B
500    Game reads these switches at port C000h (16 bit) with two calls (subroutine 0EF522h [totmejan])
501501        Needs to be rearranged and cleaned up (DSW1 current holds all dips and DSW2 appears to be additional inputs) */
502502
503503   PORT_START("DSW1")
r31373r31374
527527   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
528528   PORT_DIPUNKNOWN_DIPLOC( 0x0080, 0x0080, "DSWA:8" )
529529
530        PORT_DIPNAME( 0x0300, 0x0100, "Starting Points" )             PORT_DIPLOCATION("DSWB:1,2")
530      PORT_DIPNAME( 0x0300, 0x0100, "Starting Points" )             PORT_DIPLOCATION("DSWB:1,2")
531531   PORT_DIPSETTING(      0x0300, "1500" )
532532   PORT_DIPSETTING(      0x0200, "2000" )
533533   PORT_DIPSETTING(      0x0100, "1000" )
r31373r31374
535535
536536   PORT_DIPUNKNOWN_DIPLOC( 0x0400, 0x0400, "DSWB:3" )
537537   PORT_DIPUNKNOWN_DIPLOC( 0x0800, 0x0800, "DSWB:4" )
538/*   [totmejan] Game definitely uses these, reads these 2 bits and stores at address 01A28h as 0-1st bit;
539   Sub-routine at E7C19h does some arithmetic operations depending on these.
540   I cound't understand whats going on. Call performs just before dealing tiles. */
538/*  [totmejan] Game definitely uses these, reads these 2 bits and stores at address 01A28h as 0-1st bit;
539    Sub-routine at E7C19h does some arithmetic operations depending on these.
540    I cound't understand whats going on. Call performs just before dealing tiles. */
541541
542   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Demo_Sounds ) )        PORT_DIPLOCATION("DSWB:5")
542   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Demo_Sounds ) )        PORT_DIPLOCATION("DSWB:5")
543543   PORT_DIPSETTING(      0x1000, DEF_STR( On ) )
544544   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
545545   PORT_DIPNAME( 0x2000, 0x2000, "Explicit Scenes" )             PORT_DIPLOCATION("DSWB:6")
r31373r31374
549549   PORT_DIPUNKNOWN_DIPLOC( 0x8000, 0x8000, "DSWB:8" )
550550
551551   PORT_START("DSW2")
552        PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1 )
553        PORT_BIT( 0xfffe, IP_ACTIVE_LOW, IPT_UNKNOWN ) // 0x0002 must be kept low to work as service coin
552      PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1 )
553      PORT_BIT( 0xfffe, IP_ACTIVE_LOW, IPT_UNKNOWN ) // 0x0002 must be kept low to work as service coin
554554INPUT_PORTS_END
555555
556556
trunk/src/mame/drivers/metalmx.c
r31373r31374
737737
738738   MCFG_DEVICE_ADD("cage", ATARI_CAGE, 0)
739739   MCFG_ATARI_CAGE_SPEEDUP(0) // TODO: speedup address
740   MCFG_ATARI_CAGE_IRQ_CALLBACK(WRITE8(metalmx_state,cage_irq_callback))   
740   MCFG_ATARI_CAGE_IRQ_CALLBACK(WRITE8(metalmx_state,cage_irq_callback))
741741MACHINE_CONFIG_END
742742
743743
trunk/src/mame/drivers/goldstar.c
r31373r31374
222222static ADDRESS_MAP_START( star100_map, AS_PROGRAM, 8, goldstar_state )
223223   AM_RANGE(0x0000, 0xbfff) AM_ROM
224224
225   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(sangho_fg_vidram_w ) AM_SHARE("fg_vidram")   // videoram 1
226   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(sangho_fg_atrram_w ) AM_SHARE("fg_atrram")   // atrram 1
225   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(sangho_fg_vidram_w ) AM_SHARE("fg_vidram")    // videoram 1
226   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(sangho_fg_atrram_w ) AM_SHARE("fg_atrram")    // atrram 1
227227
228228   AM_RANGE(0xd800, 0xd83f) AM_RAM AM_SHARE("reel1_scroll")
229229   AM_RANGE(0xd840, 0xd9ff) AM_RAM
r31373r31374
236236   AM_RANGE(0xe200, 0xe3ff) AM_RAM_WRITE(goldstar_reel2_ram_w ) AM_SHARE("reel2_ram")
237237   AM_RANGE(0xe400, 0xe5ff) AM_RAM_WRITE(goldstar_reel3_ram_w ) AM_SHARE("reel3_ram")
238238
239   AM_RANGE(0xe600, 0xe7ff) AM_RAM_WRITE(sangho_bg_vidram_w ) AM_SHARE("bg_vidram")   // videoram 2
239   AM_RANGE(0xe600, 0xe7ff) AM_RAM_WRITE(sangho_bg_vidram_w ) AM_SHARE("bg_vidram")    // videoram 2
240240
241241   AM_RANGE(0xe800, 0xe9ff) AM_RAM_WRITE(sangho_reel1_attrram_w ) AM_SHARE("reel1_attrram")
242242   AM_RANGE(0xea00, 0xebff) AM_RAM_WRITE(sangho_reel2_attrram_w ) AM_SHARE("reel2_attrram")
243243   AM_RANGE(0xec00, 0xedff) AM_RAM_WRITE(sangho_reel3_attrram_w ) AM_SHARE("reel3_attrram")
244244
245   AM_RANGE(0xee00, 0xefff) AM_RAM_WRITE(sangho_bg_atrram_w ) AM_SHARE("bg_atrram")   // atrram 2
245   AM_RANGE(0xee00, 0xefff) AM_RAM_WRITE(sangho_bg_atrram_w ) AM_SHARE("bg_atrram")    // atrram 2
246246
247247   AM_RANGE(0xf000, 0xf7ff) AM_RAM AM_SHARE("nvram")
248248   AM_RANGE(0xf800, 0xffff) AM_RAM
r31373r31374
278278
279279static ADDRESS_MAP_START( star100_readport, AS_IO, 8, goldstar_state )
280280   ADDRESS_MAP_GLOBAL_MASK(0xff)
281   
281
282282   AM_RANGE(0x08, 0x08) AM_DEVREADWRITE("aysnd", ay8910_device, data_r, data_w)
283283   AM_RANGE(0x0c, 0x0c) AM_DEVWRITE("aysnd", ay8910_device, address_w)
284284
r31373r31374
291291   AM_RANGE(0x1c, 0x1c) AM_DEVWRITE("ramdac", ramdac_device, index_w)
292292   AM_RANGE(0x1d ,0x1d) AM_DEVWRITE("ramdac", ramdac_device, pal_w)
293293   AM_RANGE(0x1e ,0x1e) AM_DEVWRITE("ramdac", ramdac_device, mask_w)
294   
295   AM_RANGE(0x20, 0x20) AM_READ_PORT("DSW4-0")      // the first 4 bits map to DSW4 1 to 4.
296   AM_RANGE(0x21, 0x21) AM_READ_PORT("DSW4-1")      // the first 4 bits map to DSW4 5 to 8.
297294
298   AM_RANGE(0x24, 0x24) AM_WRITE(sangho_coincount_w)   // coin counters.
295   AM_RANGE(0x20, 0x20) AM_READ_PORT("DSW4-0")     // the first 4 bits map to DSW4 1 to 4.
296   AM_RANGE(0x21, 0x21) AM_READ_PORT("DSW4-1")     // the first 4 bits map to DSW4 5 to 8.
299297
298   AM_RANGE(0x24, 0x24) AM_WRITE(sangho_coincount_w)   // coin counters.
299
300300   AM_RANGE(0x25, 0x25) AM_READ_PORT("DSW2")
301301   AM_RANGE(0x26, 0x26) AM_READ_PORT("DSW3")
302302
303   AM_RANGE(0xe0, 0xe0) AM_WRITENOP            // writting 0's and 1's constantly. seems watchdog feeder.
304   AM_RANGE(0xe1, 0xe1) AM_WRITE(sangho_enable_w)   // enable/disable reels register.
303   AM_RANGE(0xe0, 0xe0) AM_WRITENOP                // writting 0's and 1's constantly. seems watchdog feeder.
304   AM_RANGE(0xe1, 0xe1) AM_WRITE(sangho_enable_w)  // enable/disable reels register.
305305
306306ADDRESS_MAP_END
307307
308308/*
309  08:  W (3F)   AY8910 data
310  0C:  W (07)   AY8910 address
309  08:  W (3F)   AY8910 data
310  0C:  W (07)   AY8910 address
311311
312  10: R      Input #0
313  11: R      Input #1
314  12: R      Input #2
315  13: R      Input #3
316 
317  14: R      DSW #1
312  10: R     Input #0
313  11: R     Input #1
314  12: R     Input #2
315  13: R     Input #3
318316
317  14: R     DSW #1
318
319319  17:  W
320320
321  1C:  W   \ these looks like RAMDAC commands. After write to 1C, there are 3 writes to 1D.
322  1D:  W   / bp: 6c5b.
321  1C:  W    \ these looks like RAMDAC commands. After write to 1C, there are 3 writes to 1D.
322  1D:  W    / bp: 6c5b.
323323  1E:  W (FF) --> seems the RAMDAC mask.
324324
325325  20: R    DSW #4-0
r31373r31374
332332  2F:  W (9C)
333333
334334  E0:  W
335  E1:  W   Reels enable/disable register
335  E1:  W    Reels enable/disable register
336336 */
337337
338338static ADDRESS_MAP_START( ramdac_map, AS_0, 8, goldstar_state )
339339   AM_RANGE(0x000, 0x3ff) AM_DEVREADWRITE("ramdac", ramdac_device, ramdac_pal_r, ramdac_rgb666_w)
340ADDRESS_MAP_END
340ADDRESS_MAP_END
341341
342/* 
342/*
343343  RAMDAC written commands:
344344
345345  1C   1D 1D 1D       1C   1D 1D 1D       1C   1D 1D 1D       1C   1D 1D 1D
r31373r31374
972972static ADDRESS_MAP_START( bonusch_map, AS_PROGRAM, 8, goldstar_state )
973973/* Reels stuff and RAM are there just as placeholder, and obviously in wrong offset */
974974
975   AM_RANGE(0x0000, 0xbfff) AM_ROM      // ok
975   AM_RANGE(0x0000, 0xbfff) AM_ROM     // ok
976976
977977   AM_RANGE(0xd800, 0xdfff) AM_RAM //AM_SHARE("nvram")
978978   AM_RANGE(0xf000, 0xffff) AM_RAM
r31373r31374
10161016   ADDRESS_MAP_GLOBAL_MASK(0xff)
10171017   AM_RANGE(0x10, 0x10) AM_READ_PORT("IN0")
10181018   AM_RANGE(0x20, 0x20) AM_READ_PORT("IN1")
1019   AM_RANGE(0x50, 0x50) AM_DEVWRITE("sn1", sn76489_device, write)      /* SN76489 #1 */
1020   AM_RANGE(0x51, 0x51) AM_DEVWRITE("sn2", sn76489_device, write)      /* SN76489 #2 */
1021   AM_RANGE(0x52, 0x52) AM_DEVWRITE("sn3", sn76489_device, write)      /* SN76489 #3 */
1022   AM_RANGE(0x53, 0x53) AM_DEVWRITE("sn4", sn76489_device, write)      /* SN76489 #4 */
1019   AM_RANGE(0x50, 0x50) AM_DEVWRITE("sn1", sn76489_device, write)      /* SN76489 #1 */
1020   AM_RANGE(0x51, 0x51) AM_DEVWRITE("sn2", sn76489_device, write)      /* SN76489 #2 */
1021   AM_RANGE(0x52, 0x52) AM_DEVWRITE("sn3", sn76489_device, write)      /* SN76489 #3 */
1022   AM_RANGE(0x53, 0x53) AM_DEVWRITE("sn4", sn76489_device, write)      /* SN76489 #4 */
10231023   AM_RANGE(0x60, 0x60) AM_READ_PORT("IN3")
10241024ADDRESS_MAP_END
10251025
r31373r31374
61536153   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SLOT_STOP2 ) PORT_NAME("Stop 2 / Small")
61546154   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start")
61556155
6156//   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_1) PORT_NAME("IN0-1")
6157//   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_2) PORT_NAME("IN0-2")
6158//   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_3) PORT_NAME("IN0-3: BIG")
6159//   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4) PORT_NAME("IN0-4: DOUBLE UP")
6160//   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_5) PORT_NAME("IN0-5: TAKE")
6161//   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_6) PORT_NAME("IN0-6: BET")
6162//   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_7) PORT_NAME("IN0-7: SMALL")
6163//   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_8) PORT_NAME("IN0-8: START")
6156//  PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_1) PORT_NAME("IN0-1")
6157//  PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_2) PORT_NAME("IN0-2")
6158//  PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_3) PORT_NAME("IN0-3: BIG")
6159//  PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4) PORT_NAME("IN0-4: DOUBLE UP")
6160//  PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_5) PORT_NAME("IN0-5: TAKE")
6161//  PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_6) PORT_NAME("IN0-6: BET")
6162//  PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_7) PORT_NAME("IN0-7: SMALL")
6163//  PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_8) PORT_NAME("IN0-8: START")
61646164
61656165   PORT_START("IN1")
61666166   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
r31373r31374
61696169   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
61706170   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_IMPULSE(2)                            /* Coin A */
61716171   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_IMPULSE(2)                            /* Coin B */
6172   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN )                              /* Key In */
6172   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN )                                       /* Key In */
61736173   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_IMPULSE(2)                            /* Coin C */
61746174
61756175   PORT_START("IN2")
r31373r31374
61826182   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_9) PORT_NAME("Settings / Test Mode") PORT_TOGGLE
61836183   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Statistics")
61846184
6185   PORT_START("IN3")   // reflected in test mode
6185   PORT_START("IN3")   // reflected in test mode
61866186   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
61876187   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
61886188   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r31373r31374
61926192   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
61936193   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
61946194
6195   PORT_START("IN4")   // reflected in test mode
6195   PORT_START("IN4")   // reflected in test mode
61966196   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
61976197   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
61986198   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r31373r31374
62036203   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
62046204
62056205   PORT_START("DSW1")
6206   PORT_DIPNAME( 0x01, 0x00, "Key Out" )            PORT_DIPLOCATION("SW1:1")
6206   PORT_DIPNAME( 0x01, 0x00, "Key Out" )               PORT_DIPLOCATION("SW1:1")
62076207   PORT_DIPSETTING(    0x00, "x1" )
62086208   PORT_DIPSETTING(    0x01, "x100" )
6209   PORT_DIPNAME( 0x02, 0x02, "Bonus Rate" )         PORT_DIPLOCATION("SW1:2")
6209   PORT_DIPNAME( 0x02, 0x02, "Bonus Rate" )            PORT_DIPLOCATION("SW1:2")
62106210   PORT_DIPSETTING(    0x00, "1/24" )
62116211   PORT_DIPSETTING(    0x02, "1/32" )
6212   PORT_DIPNAME( 0x04, 0x04, "Spin Rate" )            PORT_DIPLOCATION("SW1:3")
6212   PORT_DIPNAME( 0x04, 0x04, "Spin Rate" )             PORT_DIPLOCATION("SW1:3")
62136213   PORT_DIPSETTING(    0x04, "Slow" )
62146214   PORT_DIPSETTING(    0x00, "Fast" )
6215   PORT_DIPNAME( 0x18, 0x18, "Double Up Rate" )      PORT_DIPLOCATION("SW1:4,5")
6215   PORT_DIPNAME( 0x18, 0x18, "Double Up Rate" )        PORT_DIPLOCATION("SW1:4,5")
62166216   PORT_DIPSETTING(    0x18, "60%" )
62176217   PORT_DIPSETTING(    0x10, "70%" )
62186218   PORT_DIPSETTING(    0x08, "80%" )
62196219   PORT_DIPSETTING(    0x00, "90%" )
6220   PORT_DIPNAME( 0xe0, 0xe0, "Game Rate" )            PORT_DIPLOCATION("SW1:6,7,8")
6220   PORT_DIPNAME( 0xe0, 0xe0, "Game Rate" )             PORT_DIPLOCATION("SW1:6,7,8")
62216221   PORT_DIPSETTING(    0xe0, "50%" )
62226222   PORT_DIPSETTING(    0xc0, "60%" )
62236223   PORT_DIPSETTING(    0xa0, "65%" )
r31373r31374
62286228   PORT_DIPSETTING(    0x00, "90%" )
62296229
62306230   PORT_START("DSW2")
6231   PORT_DIPNAME( 0x01, 0x01, "Bonus Min Bet" )         PORT_DIPLOCATION("SW2:1")
6231   PORT_DIPNAME( 0x01, 0x01, "Bonus Min Bet" )         PORT_DIPLOCATION("SW2:1")
62326232   PORT_DIPSETTING(    0x01, "16" )
62336233   PORT_DIPSETTING(    0x00, "32" )
6234   PORT_DIPNAME( 0x02, 0x02, "Number of Jackpot" )      PORT_DIPLOCATION("SW2:2")
6234   PORT_DIPNAME( 0x02, 0x02, "Number of Jackpot" )     PORT_DIPLOCATION("SW2:2")
62356235   PORT_DIPSETTING(    0x00, "3 2" )
62366236   PORT_DIPSETTING(    0x02, "6 3" )
6237   PORT_DIPNAME( 0x04, 0x04, "Double Up" )            PORT_DIPLOCATION("SW2:3")
6237   PORT_DIPNAME( 0x04, 0x04, "Double Up" )             PORT_DIPLOCATION("SW2:3")
62386238   PORT_DIPSETTING(    0x04, DEF_STR( Yes ) )
62396239   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
6240   PORT_DIPNAME( 0x18, 0x18, "Payout Limit" )         PORT_DIPLOCATION("SW2:4,5")
6240   PORT_DIPNAME( 0x18, 0x18, "Payout Limit" )          PORT_DIPLOCATION("SW2:4,5")
62416241   PORT_DIPSETTING(    0x18, "1000" )
62426242   PORT_DIPSETTING(    0x10, "2000" )
62436243   PORT_DIPSETTING(    0x08, "5000" )
62446244   PORT_DIPSETTING(    0x00, "No Limit" )
6245   PORT_DIPNAME( 0x20, 0x20, "Bonus" )               PORT_DIPLOCATION("SW2:6")
6245   PORT_DIPNAME( 0x20, 0x20, "Bonus" )                 PORT_DIPLOCATION("SW2:6")
62466246   PORT_DIPSETTING(    0x20, "Normal" )
62476247   PORT_DIPSETTING(    0x00, "Random" )
6248   PORT_DIPNAME( 0xc0, 0xc0, "Number of Clown" )      PORT_DIPLOCATION("SW2:7,8")
6248   PORT_DIPNAME( 0xc0, 0xc0, "Number of Clown" )       PORT_DIPLOCATION("SW2:7,8")
62496249   PORT_DIPSETTING(    0xc0, "60%" )
62506250   PORT_DIPSETTING(    0x80, "70%" )
62516251   PORT_DIPSETTING(    0x40, "80%" )
62526252   PORT_DIPSETTING(    0x00, "90%" )
62536253
62546254   PORT_START("DSW3")
6255   PORT_DIPNAME( 0x07, 0x07, "Key In Rate" )         PORT_DIPLOCATION("SW3:1,2,3")
6255   PORT_DIPNAME( 0x07, 0x07, "Key In Rate" )           PORT_DIPLOCATION("SW3:1,2,3")
62566256   PORT_DIPSETTING(    0x00, "100 Credits" )
62576257   PORT_DIPSETTING(    0x01, "110 Credits" )
62586258   PORT_DIPSETTING(    0x02, "120 Credits" )
r31373r31374
62616261   PORT_DIPSETTING(    0x05, "400 Credits" )
62626262   PORT_DIPSETTING(    0x06, "500 Credits" )
62636263   PORT_DIPSETTING(    0x07, "1000 Credits" )
6264   PORT_DIPNAME( 0x18, 0x00, "Bet Limit" )            PORT_DIPLOCATION("SW3:4,5")
6264   PORT_DIPNAME( 0x18, 0x00, "Bet Limit" )             PORT_DIPLOCATION("SW3:4,5")
62656265   PORT_DIPSETTING(    0x18, "32 (Limit of Bonus: 1/4)" )
62666266   PORT_DIPSETTING(    0x10, "64 (Limit of Bonus: 1/2)" )
62676267   PORT_DIPSETTING(    0x08, "72 (Limit of Bonus: All)" )
62686268   PORT_DIPSETTING(    0x00, "80 (Limit of Bonus: All)" )
6269   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:6")
6269   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:6")
62706270   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
62716271   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6272   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:7")
6272   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:7")
62736273   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
62746274   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6275   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:8")
6275   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:8")
62766276   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
62776277   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
62786278
62796279   PORT_START("DSW4-0")
6280   PORT_DIPNAME( 0x07, 0x07, "Coinage A, B & C" )      PORT_DIPLOCATION("SW4:1,2,3")
6280   PORT_DIPNAME( 0x07, 0x07, "Coinage A, B & C" )      PORT_DIPLOCATION("SW4:1,2,3")
62816281   PORT_DIPSETTING(    0x00, "1 Coin / 1 Credit" )
62826282   PORT_DIPSETTING(    0x01, "1 Coin / 5 Credits" )
62836283   PORT_DIPSETTING(    0x02, "1 Coin / 10 Credits" )
r31373r31374
62886288   PORT_DIPSETTING(    0x07, "1 Coin / 100 Credit" )
62896289
62906290   /* the following two are 'bonus', and need conditional port since they are in different banks */
6291   PORT_DIPNAME( 0x08, 0x08, "Bonus (switch-1)" )         PORT_DIPLOCATION("SW4:4")
6291   PORT_DIPNAME( 0x08, 0x08, "Bonus (switch-1)" )          PORT_DIPLOCATION("SW4:4")
62926292   PORT_DIPSETTING(    0x08, "20000" )    PORT_CONDITION("DSW4-1", 0x01, NOTEQUALS, 0x00)
62936293   PORT_DIPSETTING(    0x08, "40000" )    PORT_CONDITION("DSW4-1", 0x01, EQUALS, 0x00)
62946294   PORT_DIPSETTING(    0x00, "30000" )    PORT_CONDITION("DSW4-1", 0x01, NOTEQUALS, 0x00)
r31373r31374
62966296   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
62976297
62986298   PORT_START("DSW4-1")
6299   PORT_DIPNAME( 0x01, 0x01, "Bonus (switch-2)" )         PORT_DIPLOCATION("SW4:5")
6299   PORT_DIPNAME( 0x01, 0x01, "Bonus (switch-2)" )          PORT_DIPLOCATION("SW4:5")
63006300   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
63016301   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
63026302
6303   PORT_DIPNAME( 0x02, 0x02, "Max Bonus" )               PORT_DIPLOCATION("SW4:6")
6303   PORT_DIPNAME( 0x02, 0x02, "Max Bonus" )                 PORT_DIPLOCATION("SW4:6")
63046304   PORT_DIPSETTING(    0x00, "100000" )
63056305   PORT_DIPSETTING(    0x02, "200000" )
6306   PORT_DIPNAME( 0x0c, 0x0c, "Minimum Bet" )            PORT_DIPLOCATION("SW4:7,8")
6306   PORT_DIPNAME( 0x0c, 0x0c, "Minimum Bet" )               PORT_DIPLOCATION("SW4:7,8")
63076307   PORT_DIPSETTING(    0x0c, "0" )
63086308   PORT_DIPSETTING(    0x08, "8" )
63096309   PORT_DIPSETTING(    0x04, "16" )
63106310   PORT_DIPSETTING(    0x00, "32" )
63116311   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
63126312
6313   PORT_START("DSW5")   // phisically tied to ay8910 port A, but unused...
6314   PORT_DIPNAME( 0x01, 0x01, "DSW5" )               PORT_DIPLOCATION("SW5:1")
6313   PORT_START("DSW5")  // phisically tied to ay8910 port A, but unused...
6314   PORT_DIPNAME( 0x01, 0x01, "DSW5" )                  PORT_DIPLOCATION("SW5:1")
63156315   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
63166316   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6317   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:2")
6317   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:2")
63186318   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
63196319   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6320   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:3")
6320   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:3")
63216321   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
63226322   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6323   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:4")
6323   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:4")
63246324   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
63256325   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6326   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:5")
6326   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:5")
63276327   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
63286328   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6329   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:6")
6329   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:6")
63306330   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
63316331   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6332   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:7")
6332   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:7")
63336333   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
63346334   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6335   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:8")
6335   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:8")
63366336   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
63376337   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
63386338
6339   PORT_START("DSW6")   // phisically tied to ay8910 port B, but unused...
6340   PORT_DIPNAME( 0x01, 0x01, "DSW6" )               PORT_DIPLOCATION("SW6:1")
6339   PORT_START("DSW6")  // phisically tied to ay8910 port B, but unused...
6340   PORT_DIPNAME( 0x01, 0x01, "DSW6" )                  PORT_DIPLOCATION("SW6:1")
63416341   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
63426342   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6343   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:2")
6343   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:2")
63446344   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
63456345   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6346   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:3")
6346   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:3")
63476347   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
63486348   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6349   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:4")
6349   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:4")
63506350   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
63516351   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6352   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:5")
6352   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:5")
63536353   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
63546354   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6355   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:6")
6355   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:6")
63566356   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
63576357   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6358   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:7")
6358   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:7")
63596359   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
63606360   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6361   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:8")
6361   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:8")
63626362   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
63636363   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
63646364INPUT_PORTS_END
63656365
63666366
6367static INPUT_PORTS_START( crazybon )   // to analyze...
6367static INPUT_PORTS_START( crazybon )    // to analyze...
63686368   PORT_START("IN0")
63696369   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_1) PORT_NAME("IN0-1")
63706370   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_2) PORT_NAME("IN0-2")
r31373r31374
64166416   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("IN4-8")
64176417
64186418   PORT_START("DSW1")
6419   PORT_DIPNAME( 0x01, 0x01, "DSW1" )               PORT_DIPLOCATION("SW1:1")
6419   PORT_DIPNAME( 0x01, 0x01, "DSW1" )                  PORT_DIPLOCATION("SW1:1")
64206420   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
64216421   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6422   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:2")
6422   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:2")
64236423   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
64246424   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6425   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:3")
6425   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:3")
64266426   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
64276427   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6428   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:4")
6428   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:4")
64296429   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
64306430   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6431   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:5")
6431   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:5")
64326432   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
64336433   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6434   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:6")
6434   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:6")
64356435   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
64366436   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6437   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:7")
6437   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:7")
64386438   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
64396439   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6440   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:8")
6440   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW1:8")
64416441   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
64426442   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
64436443
64446444   PORT_START("DSW2")
6445   PORT_DIPNAME( 0x01, 0x01, "DSW2" )               PORT_DIPLOCATION("SW2:1")
6445   PORT_DIPNAME( 0x01, 0x01, "DSW2" )                  PORT_DIPLOCATION("SW2:1")
64466446   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
64476447   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6448   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:2")
6448   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:2")
64496449   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
64506450   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6451   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:3")
6451   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:3")
64526452   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
64536453   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6454   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:4")
6454   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:4")
64556455   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
64566456   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6457   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:5")
6457   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:5")
64586458   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
64596459   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6460   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:6")
6460   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:6")
64616461   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
64626462   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6463   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:7")
6463   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:7")
64646464   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
64656465   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6466   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:8")
6466   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW2:8")
64676467   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
64686468   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
64696469
64706470   PORT_START("DSW3")
6471   PORT_DIPNAME( 0x01, 0x01, "DSW3" )               PORT_DIPLOCATION("SW3:1")
6471   PORT_DIPNAME( 0x01, 0x01, "DSW3" )                  PORT_DIPLOCATION("SW3:1")
64726472   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
64736473   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6474   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:2")
6474   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:2")
64756475   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
64766476   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6477   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:3")
6477   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:3")
64786478   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
64796479   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6480   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:4")
6480   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:4")
64816481   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
64826482   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6483   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:5")
6483   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:5")
64846484   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
64856485   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6486   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:6")
6486   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:6")
64876487   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
64886488   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6489   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:7")
6489   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:7")
64906490   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
64916491   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6492   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:8")
6492   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW3:8")
64936493   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
64946494   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
64956495
64966496   PORT_START("DSW4-0")
6497   PORT_DIPNAME( 0x01, 0x01, "DSW4-0" )            PORT_DIPLOCATION("SW4:1")
6497   PORT_DIPNAME( 0x01, 0x01, "DSW4-0" )                PORT_DIPLOCATION("SW4:1")
64986498   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
64996499   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6500   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:2")
6500   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:2")
65016501   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
65026502   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6503   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:3")
6503   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:3")
65046504   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
65056505   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6506   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:4")
6506   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:4")
65076507   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
65086508   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
65096509   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
r31373r31374
65206520   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
65216521
65226522   PORT_START("DSW4-1")
6523   PORT_DIPNAME( 0x01, 0x01, "DSW4-1" )            PORT_DIPLOCATION("SW4:5")
6523   PORT_DIPNAME( 0x01, 0x01, "DSW4-1" )                PORT_DIPLOCATION("SW4:5")
65246524   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
65256525   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6526   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:6")
6526   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:6")
65276527   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
65286528   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6529   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:7")
6529   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:7")
65306530   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
65316531   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6532   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:8")
6532   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW4:8")
65336533   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
65346534   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
65356535   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
r31373r31374
65466546   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
65476547
65486548   PORT_START("DSW5")
6549   PORT_DIPNAME( 0x01, 0x01, "DSW5" )               PORT_DIPLOCATION("SW5:1")
6549   PORT_DIPNAME( 0x01, 0x01, "DSW5" )                  PORT_DIPLOCATION("SW5:1")
65506550   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
65516551   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6552   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:2")
6552   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:2")
65536553   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
65546554   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6555   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:3")
6555   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:3")
65566556   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
65576557   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6558   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:4")
6558   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:4")
65596559   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
65606560   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6561   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:5")
6561   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:5")
65626562   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
65636563   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6564   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:6")
6564   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:6")
65656565   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
65666566   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6567   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:7")
6567   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:7")
65686568   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
65696569   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6570   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:8")
6570   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW5:8")
65716571   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
65726572   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
65736573
65746574   PORT_START("DSW6")
6575   PORT_DIPNAME( 0x01, 0x01, "DSW6" )               PORT_DIPLOCATION("SW6:1")
6575   PORT_DIPNAME( 0x01, 0x01, "DSW6" )                  PORT_DIPLOCATION("SW6:1")
65766576   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
65776577   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6578   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:2")
6578   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:2")
65796579   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
65806580   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6581   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:3")
6581   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:3")
65826582   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
65836583   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6584   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:4")
6584   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:4")
65856585   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
65866586   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6587   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:5")
6587   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:5")
65886588   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
65896589   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6590   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:6")
6590   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:6")
65916591   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
65926592   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6593   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:7")
6593   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:7")
65946594   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
65956595   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
6596   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:8")
6596   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )      PORT_DIPLOCATION("SW6:8")
65976597   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
65986598   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
65996599INPUT_PORTS_END
r31373r31374
66206620   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)  /* Coin A */
66216621
66226622   PORT_START("IN2")
6623   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* Tied to GND and to the hidden switch that change games. (PC0+GND) -+-> PB0 */
6623   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* Tied to GND and to the hidden switch that change games. (PC0+GND) -+-> PB0 */
66246624   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
66256625   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
66266626   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
r31373r31374
67826782   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)  /* Coin A */
67836783
67846784   PORT_START("IN2")
6785   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* Tied to GND and to the hidden switch that change games. (PC0+GND) -+-> (PB0|PB1) */
6785   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* Tied to GND and to the hidden switch that change games. (PC0+GND) -+-> (PB0|PB1) */
67866786   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
67876787   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
67886788   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
r31373r31374
72927292   3*16,16 cherries in game
72937293   2*16,16 oranges and title girl in game
72947294   1*16,16 nines in game
7295*/   
7295*/
72967296GFXDECODE_END
72977297
72987298
r31373r31374
77587758
77597759   MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0)
77607760   MCFG_I8255_IN_PORTA_CB(IOPORT("IN0"))
7761   MCFG_I8255_IN_PORTB_CB(IOPORT("IN3"))   //Player2 controls, confirmed
7761   MCFG_I8255_IN_PORTB_CB(IOPORT("IN3"))   //Player2 controls, confirmed
77627762
77637763   MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0)
77647764   MCFG_I8255_IN_PORTA_CB(IOPORT("IN1"))
r31373r31374
78087808
78097809   MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0)
78107810   MCFG_I8255_IN_PORTA_CB(IOPORT("IN0"))
7811   MCFG_I8255_IN_PORTB_CB(IOPORT("IN3"))   //Player2 controls, confirmed
7811   MCFG_I8255_IN_PORTB_CB(IOPORT("IN3"))   //Player2 controls, confirmed
78127812
78137813   MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0)
78147814   MCFG_I8255_IN_PORTA_CB(IOPORT("IN1"))
r31373r31374
78587858
78597859   MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0)
78607860   MCFG_I8255_IN_PORTA_CB(IOPORT("IN0"))
7861   MCFG_I8255_IN_PORTB_CB(IOPORT("IN3"))   //Player2 controls, confirmed
7861   MCFG_I8255_IN_PORTB_CB(IOPORT("IN3"))   //Player2 controls, confirmed
78627862
78637863   MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0)
78647864   MCFG_I8255_IN_PORTA_CB(IOPORT("IN1"))
r31373r31374
79077907
79087908   MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0)
79097909   MCFG_I8255_IN_PORTA_CB(IOPORT("IN0"))
7910   MCFG_I8255_IN_PORTB_CB(IOPORT("IN3"))   //Player2 controls, confirmed
7910   MCFG_I8255_IN_PORTB_CB(IOPORT("IN3"))   //Player2 controls, confirmed
79117911
79127912   MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0)
79137913   MCFG_I8255_IN_PORTA_CB(IOPORT("IN1"))
r31373r31374
79577957
79587958   MCFG_DEVICE_ADD("ppi8255_0", I8255A, 0)
79597959   MCFG_I8255_IN_PORTA_CB(IOPORT("IN0"))
7960   MCFG_I8255_IN_PORTB_CB(IOPORT("IN3"))   //Player2 controls, confirmed
7960   MCFG_I8255_IN_PORTB_CB(IOPORT("IN3"))   //Player2 controls, confirmed
79617961
79627962   MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0)
79637963   MCFG_I8255_IN_PORTA_CB(IOPORT("IN1"))
r31373r31374
87238723   MCFG_SPEAKER_STANDARD_MONO("mono")
87248724
87258725//  MCFG_SOUND_ADD("aysnd", AY8910, AY_CLOCK)
8726//   
8727//   
8728//   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW4"))
8729//   MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW3"))
8726//
8727//
8728//  MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW4"))
8729//  MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW3"))
87308730//  MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
87318731MACHINE_CONFIG_END
87328732
r31373r31374
1323113231  9800+ --> 3800+
1323213232
1323313233*/
13234//   ROM_COPY( "maincpu", 0x1c000, 0x0000, 0x1000 )      /* src-dest-size ok */
13235//   ROM_COPY( "maincpu", 0x16000, 0x1000, 0x1000 )      /* src-dest-size ok */
13236//   ROM_COPY( "maincpu", 0x14000, 0x2000, 0x1000 )      /* src-dest-size ok */
13237//   ROM_COPY( "maincpu", 0x1a000, 0x3000, 0x1000 )      /* src-dest-size ok (some calls to high 5xxx appear here, maybe split in 0x800?) */
13238//   ROM_COPY( "maincpu", 0x15000, 0x4000, 0x1000 )      /* src-dest-size ok */
13239//   ROM_COPY( "maincpu", 0x11000, 0x6000, 0x1000 )      /* src-dest-size ok */
13240//   ROM_COPY( "maincpu", 0x13000, 0x8000, 0x1000 )      /* src-dest-size ok */
13234//  ROM_COPY( "maincpu", 0x1c000, 0x0000, 0x1000 )      /* src-dest-size ok */
13235//  ROM_COPY( "maincpu", 0x16000, 0x1000, 0x1000 )      /* src-dest-size ok */
13236//  ROM_COPY( "maincpu", 0x14000, 0x2000, 0x1000 )      /* src-dest-size ok */
13237//  ROM_COPY( "maincpu", 0x1a000, 0x3000, 0x1000 )      /* src-dest-size ok (some calls to high 5xxx appear here, maybe split in 0x800?) */
13238//  ROM_COPY( "maincpu", 0x15000, 0x4000, 0x1000 )      /* src-dest-size ok */
13239//  ROM_COPY( "maincpu", 0x11000, 0x6000, 0x1000 )      /* src-dest-size ok */
13240//  ROM_COPY( "maincpu", 0x13000, 0x8000, 0x1000 )      /* src-dest-size ok */
1324113241
13242//   ROM_COPY( "maincpu", 0x17000, 0x5000, 0x1000 )      /* src-dest-size */
13243//   ROM_COPY( "maincpu", 0x10000, 0x7000, 0x1000 )      /* src-dest-size */
13244//   ROM_COPY( "maincpu", 0x18000, 0x9000, 0x1000 )      /* src-dest-size */
13245//   ROM_COPY( "maincpu", 0x19000, 0xa000, 0x1000 )      /* src-dest-size */
13246//   ROM_COPY( "maincpu", 0x12000, 0xb000, 0x1000 )      /* src-dest-size */
13247//   ROM_COPY( "maincpu", 0x1b000, 0xc000, 0x1000 )      /* src-dest-size */
13248//   ROM_COPY( "maincpu", 0x1d000, 0xd000, 0x1000 )      /* src-dest-size */
13249//   ROM_COPY( "maincpu", 0x1e000, 0xe000, 0x1000 )      /* src-dest-size */
13250//   ROM_COPY( "maincpu", 0x1f000, 0xf000, 0x1000 )      /* src-dest-size */
13242//  ROM_COPY( "maincpu", 0x17000, 0x5000, 0x1000 )      /* src-dest-size */
13243//  ROM_COPY( "maincpu", 0x10000, 0x7000, 0x1000 )      /* src-dest-size */
13244//  ROM_COPY( "maincpu", 0x18000, 0x9000, 0x1000 )      /* src-dest-size */
13245//  ROM_COPY( "maincpu", 0x19000, 0xa000, 0x1000 )      /* src-dest-size */
13246//  ROM_COPY( "maincpu", 0x12000, 0xb000, 0x1000 )      /* src-dest-size */
13247//  ROM_COPY( "maincpu", 0x1b000, 0xc000, 0x1000 )      /* src-dest-size */
13248//  ROM_COPY( "maincpu", 0x1d000, 0xd000, 0x1000 )      /* src-dest-size */
13249//  ROM_COPY( "maincpu", 0x1e000, 0xe000, 0x1000 )      /* src-dest-size */
13250//  ROM_COPY( "maincpu", 0x1f000, 0xf000, 0x1000 )      /* src-dest-size */
1325113251
13252   ROM_COPY( "maincpu", 0x1c000, 0x0000, 0x0800 )      /* src-dest-size */   // #01
13253   ROM_COPY( "maincpu", 0x19800, 0x0800, 0x0800 )      /* src-dest-size */   // #02
13254   ROM_COPY( "maincpu", 0x16000, 0x1000, 0x0800 )      /* src-dest-size */   // #03
13255   ROM_COPY( "maincpu", 0x17800, 0x1800, 0x0800 )      /* src-dest-size */   // #04
13256   ROM_COPY( "maincpu", 0x14000, 0x2000, 0x0800 )      /* src-dest-size */   // #05
13257   ROM_COPY( "maincpu", 0x1c800, 0x2800, 0x0800 )      /* src-dest-size */   // #06
13258   ROM_COPY( "maincpu", 0x1a000, 0x3000, 0x0800 )      /* src-dest-size */   // #07
13259   ROM_COPY( "maincpu", 0x18800, 0x3800, 0x0800 )      /* src-dest-size */   // #08
13260   ROM_COPY( "maincpu", 0x10000, 0x4000, 0x0800 )      /* src-dest-size */   // #09
13261   ROM_COPY( "maincpu", 0x15000, 0x4800, 0x0800 )      /* src-dest-size */   // #10
13262   ROM_COPY( "maincpu", 0x14800, 0x5000, 0x0800 )      /* src-dest-size */   // #11
13263   ROM_COPY( "maincpu", 0x1a800, 0x5800, 0x0800 )      /* src-dest-size */   // #12
13264   ROM_COPY( "maincpu", 0x11000, 0x6000, 0x0800 )      /* src-dest-size */   // #13
13265   ROM_COPY( "maincpu", 0x11800, 0x6800, 0x0800 )      /* src-dest-size */   // #14
13266   ROM_COPY( "maincpu", 0x1b000, 0x7000, 0x0800 )      /* src-dest-size */   // #15
13267   ROM_COPY( "maincpu", 0x1f000, 0x7800, 0x0800 )      /* src-dest-size */   // #16
13268   ROM_COPY( "maincpu", 0x1f800, 0x8000, 0x0800 )      /* src-dest-size */   // #17
13269   ROM_COPY( "maincpu", 0x13800, 0x8800, 0x0800 )      /* src-dest-size */   // #18
13270   ROM_COPY( "maincpu", 0x19000, 0x9000, 0x0800 )      /* src-dest-size */   // #19
13271   ROM_COPY( "maincpu", 0x1b800, 0x9800, 0x0800 )      /* src-dest-size */   // #20
13272   ROM_COPY( "maincpu", 0x12000, 0xa000, 0x0800 )      /* src-dest-size */   // #21
13273   ROM_COPY( "maincpu", 0x10800, 0xa800, 0x0800 )      /* src-dest-size */   // #22
13274   ROM_COPY( "maincpu", 0x18000, 0xb000, 0x0800 )      /* src-dest-size */   // #23
13275   ROM_COPY( "maincpu", 0x12800, 0xb800, 0x0800 )      /* src-dest-size */   // #24
13276   ROM_COPY( "maincpu", 0x13000, 0xc000, 0x0800 )      /* src-dest-size */   // #25
13252   ROM_COPY( "maincpu", 0x1c000, 0x0000, 0x0800 )      /* src-dest-size */ // #01
13253   ROM_COPY( "maincpu", 0x19800, 0x0800, 0x0800 )      /* src-dest-size */ // #02
13254   ROM_COPY( "maincpu", 0x16000, 0x1000, 0x0800 )      /* src-dest-size */ // #03
13255   ROM_COPY( "maincpu", 0x17800, 0x1800, 0x0800 )      /* src-dest-size */ // #04
13256   ROM_COPY( "maincpu", 0x14000, 0x2000, 0x0800 )      /* src-dest-size */ // #05
13257   ROM_COPY( "maincpu", 0x1c800, 0x2800, 0x0800 )      /* src-dest-size */ // #06
13258   ROM_COPY( "maincpu", 0x1a000, 0x3000, 0x0800 )      /* src-dest-size */ // #07
13259   ROM_COPY( "maincpu", 0x18800, 0x3800, 0x0800 )      /* src-dest-size */ // #08
13260   ROM_COPY( "maincpu", 0x10000, 0x4000, 0x0800 )      /* src-dest-size */ // #09
13261   ROM_COPY( "maincpu", 0x15000, 0x4800, 0x0800 )      /* src-dest-size */ // #10
13262   ROM_COPY( "maincpu", 0x14800, 0x5000, 0x0800 )      /* src-dest-size */ // #11
13263   ROM_COPY( "maincpu", 0x1a800, 0x5800, 0x0800 )      /* src-dest-size */ // #12
13264   ROM_COPY( "maincpu", 0x11000, 0x6000, 0x0800 )      /* src-dest-size */ // #13
13265   ROM_COPY( "maincpu", 0x11800, 0x6800, 0x0800 )      /* src-dest-size */ // #14
13266   ROM_COPY( "maincpu", 0x1b000, 0x7000, 0x0800 )      /* src-dest-size */ // #15
13267   ROM_COPY( "maincpu", 0x1f000, 0x7800, 0x0800 )      /* src-dest-size */ // #16
13268   ROM_COPY( "maincpu", 0x1f800, 0x8000, 0x0800 )      /* src-dest-size */ // #17
13269   ROM_COPY( "maincpu", 0x13800, 0x8800, 0x0800 )      /* src-dest-size */ // #18
13270   ROM_COPY( "maincpu", 0x19000, 0x9000, 0x0800 )      /* src-dest-size */ // #19
13271   ROM_COPY( "maincpu", 0x1b800, 0x9800, 0x0800 )      /* src-dest-size */ // #20
13272   ROM_COPY( "maincpu", 0x12000, 0xa000, 0x0800 )      /* src-dest-size */ // #21
13273   ROM_COPY( "maincpu", 0x10800, 0xa800, 0x0800 )      /* src-dest-size */ // #22
13274   ROM_COPY( "maincpu", 0x18000, 0xb000, 0x0800 )      /* src-dest-size */ // #23
13275   ROM_COPY( "maincpu", 0x12800, 0xb800, 0x0800 )      /* src-dest-size */ // #24
13276   ROM_COPY( "maincpu", 0x13000, 0xc000, 0x0800 )      /* src-dest-size */ // #25
1327713277
1327813278   ROM_REGION( 0x18000, "gfx1", 0 )
1327913279   ROM_LOAD( "cm89-tetri-7.u16", 0x00000,  0x8000, CRC(2f5c94bd) SHA1(d99bcaa788f8abf5c75b29572d53be109b20c4bb) )
r31373r31374
1332813328  Because of the dual amp, this might support it being a sound chip.
1332913329  Probably tracing pin connections to the HX881 will confirm it.
1333013330
13331 
13331
1333213332  You can switch the games pulsing their respective hidden buttons.
1333313333
1333413334  Hidden Switch:
r31373r31374
1414614146GAME(  198?, ladylinr,  0,        ladylinr, ladylinr, driver_device,  0,         ROT0, "TAB Austria",       "Lady Liner",                                               0 )
1414714147GAME(  198?, wcat3,     0,        wcat3,    lucky8,   driver_device,  0,         ROT0, "E.A.I.",            "Wild Cat 3",                                               GAME_NOT_WORKING )
1414814148
14149GAME(  1985, luckylad,  0,        lucky8,   luckylad, driver_device,  0,         ROT0, "Wing Co., Ltd.",    "Lucky Lady (Wing, encrypted)",                             GAME_NOT_WORKING )   // encrypted (see notes in rom_load)...
14149GAME(  1985, luckylad,  0,        lucky8,   luckylad, driver_device,  0,         ROT0, "Wing Co., Ltd.",    "Lucky Lady (Wing, encrypted)",                             GAME_NOT_WORKING )  // encrypted (see notes in rom_load)...
1415014150GAME(  1991, megaline,  0,        megaline, megaline, driver_device,  0,         ROT0, "Fun World",         "Mega Lines",                                               GAME_NOT_WORKING )
14151GAME(  1990, bonusch,   0,        bonusch,  bonusch,  driver_device,  0,         ROT0, "Wing Co., Ltd.",    "Bonus Chance (W-8)",                                       GAME_NOT_WORKING )   // M80C51F MCU
14151GAME(  1990, bonusch,   0,        bonusch,  bonusch,  driver_device,  0,         ROT0, "Wing Co., Ltd.",    "Bonus Chance (W-8)",                                       GAME_NOT_WORKING )  // M80C51F MCU
1415214152
1415314153
1415414154GAMEL( 1993, bingowng,  0,        bingowng, bingowng, driver_device,  0,         ROT0, "Wing Co., Ltd.",    "Bingo (set 1)",                                            0,                     layout_bingowng )
r31373r31374
1421814218/*    YEAR  NAME       PARENT    MACHINE   INPUT      STATE           INIT       ROT    COMPANY      FULLNAME                                                 FLAGS  */
1421914219GAME( 198?, cmpacman,  0,        cm,       cmpacman,  goldstar_state, cm,        ROT0, "<unknown>", "Super Pacman (v1.2) + Cherry Master (Corsica, v8.31)",   0 ) /* need to press K to switch between games... */
1422014220GAME( 198?, cmtetris,  0,        cm,       cmtetris,  goldstar_state, cm,        ROT0, "<unknown>", "Tetris + Cherry Master (Corsica, v8.01, set 1)",         0 ) /* need to press K/L to switch between games... */
14221GAME( 198?, cmtetrsa,  0,        cm,       cmtetris,  goldstar_state, cm,        ROT0, "<unknown>", "Tetris + Cherry Master (Corsica, v8.01, set 2)",         GAME_NOT_WORKING)      // seems banked...
14222GAME( 198?, cmtetrsb,  0,        cm,       cmtetris,  goldstar_state, cm,        ROT0, "<unknown>", "Tetris + Cherry Master (+K, Canada Version, encrypted)", GAME_NOT_WORKING)      // different Tetris game
14221GAME( 198?, cmtetrsa,  0,        cm,       cmtetris,  goldstar_state, cm,        ROT0, "<unknown>", "Tetris + Cherry Master (Corsica, v8.01, set 2)",         GAME_NOT_WORKING)     // seems banked...
14222GAME( 198?, cmtetrsb,  0,        cm,       cmtetris,  goldstar_state, cm,        ROT0, "<unknown>", "Tetris + Cherry Master (+K, Canada Version, encrypted)", GAME_NOT_WORKING)     // different Tetris game
1422314223
1422414224/* other possible stealth sets:
1422514225 - cmv4a    ---> see the 1fxx zone. put a bp in 1f9f to see the loop.
trunk/src/mame/drivers/simpsons.c
r31373r31374
322322   MCFG_KONAMICPU_LINE_CB(WRITE8(simpsons_state, banking_callback))
323323
324324   MCFG_CPU_ADD("audiocpu", Z80, XTAL_3_579545MHz) /* verified on pcb */
325   MCFG_CPU_PROGRAM_MAP(z80_map)   /* NMIs are generated by the 053260 */
325   MCFG_CPU_PROGRAM_MAP(z80_map)   /* NMIs are generated by the 053260 */
326326
327327   MCFG_DEVICE_ADD("bank0000", ADDRESS_MAP_BANK, 0)
328328   MCFG_DEVICE_PROGRAM_MAP(bank0000_map)
trunk/src/mame/drivers/pgm.c
r31373r31374
14111411   PGM_68K_BIOS
14121412   ROM_LOAD16_WORD_SWAP( "p0600.322",    0x100000, 0x400000, CRC(7c78e5f3) SHA1(9b1e4bd63fb1294ebeb539966842273c8dc7683b) )
14131413   //ROM_LOAD16_WORD_SWAP( "kovsh-v0104-u1.bin",    0x100000, 0x400000, CRC(4e2ba39b) SHA1(f3b5aa6f45cfd5a7f1e2a2e893d1652a3f23d6b8) ) // identical but the last 1MB is filled with 0xff instead of 0x00
1414   
1414
14151415   ROM_REGION( 0x4000, "prot", 0 ) /* ARM protection ASIC - internal rom */
14161416   ROM_LOAD( "kovsh_v100_china.asic", 0x000000, 0x04000,  CRC(0f09a5c1) SHA1(621b38c05f33277608d58b49822aebc930ae4870) )
14171417
trunk/src/mame/drivers/ecoinf3.c
r31373r31374
681681   MCFG_I8255_IN_PORTA_CB(READ8(ecoinf3_state, ppi8255_intf_a_read_a))
682682   MCFG_I8255_OUT_PORTA_CB(WRITE8(ecoinf3_state, ppi8255_intf_a_write_a_strobedat0))
683683   MCFG_I8255_IN_PORTB_CB(READ8(ecoinf3_state, ppi8255_intf_a_read_b))
684   MCFG_I8255_OUT_PORTB_CB(WRITE8(ecoinf3_state, ppi8255_intf_a_write_b_strobedat1))   
684   MCFG_I8255_OUT_PORTB_CB(WRITE8(ecoinf3_state, ppi8255_intf_a_write_b_strobedat1))
685685   MCFG_I8255_IN_PORTC_CB(READ8(ecoinf3_state, ppi8255_intf_a_read_c))
686686   MCFG_I8255_OUT_PORTC_CB(WRITE8(ecoinf3_state, ppi8255_intf_a_write_c_strobe))
687687
r31373r31374
711711
712712   MCFG_DEVICE_ADD("ppi8255_e", I8255, 0)
713713   MCFG_I8255_IN_PORTA_CB(READ8(ecoinf3_state, ppi8255_intf_e_read_a))
714   MCFG_I8255_OUT_PORTA_CB(WRITE8(ecoinf3_state, ppi8255_intf_e_write_a_alpha_display))   // alpha display characters
714   MCFG_I8255_OUT_PORTA_CB(WRITE8(ecoinf3_state, ppi8255_intf_e_write_a_alpha_display))    // alpha display characters
715715   MCFG_I8255_IN_PORTB_CB(READ8(ecoinf3_state, ppi8255_intf_e_read_b))
716   MCFG_I8255_OUT_PORTB_CB(WRITE8(ecoinf3_state, ppi8255_intf_e_write_b))   // not written at an appropriate time for it to be a 'send' address for the text
716   MCFG_I8255_OUT_PORTB_CB(WRITE8(ecoinf3_state, ppi8255_intf_e_write_b))  // not written at an appropriate time for it to be a 'send' address for the text
717717   MCFG_I8255_IN_PORTC_CB(READ8(ecoinf3_state, ppi8255_intf_e_read_c))
718   MCFG_I8255_OUT_PORTC_CB(WRITE8(ecoinf3_state, ppi8255_intf_e_write_c))   // not written at an appropriate time for it to be a 'send' address for the text
718   MCFG_I8255_OUT_PORTC_CB(WRITE8(ecoinf3_state, ppi8255_intf_e_write_c))  // not written at an appropriate time for it to be a 'send' address for the text
719719
720720   MCFG_DEVICE_ADD("ppi8255_f", I8255, 0)
721721   MCFG_I8255_IN_PORTA_CB(READ8(ecoinf3_state, ppi8255_intf_f_read_a))
trunk/src/mame/drivers/timeplt.c
r31373r31374
501501   /* sound hardware */
502502   MCFG_SOUND_MODIFY("ay2")
503503   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(timeplt_state, chkun_sound_w))
504   
504
505505   MCFG_TC8830F_ADD("tc8830f", XTAL_512kHz)
506506   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10)
507507MACHINE_CONFIG_END
trunk/src/mame/drivers/aces1.c
r31373r31374
260260
261261   // 0xafb0 IC24 - lamps, 7segs
262262   MCFG_DEVICE_ADD("ic24", I8255A, 0)
263   MCFG_I8255_OUT_PORTA_CB(WRITE8(aces1_state, ic24_write_a))   // 7segs
264   MCFG_I8255_OUT_PORTB_CB(WRITE8(aces1_state, ic24_write_b))   // lamps
265   MCFG_I8255_OUT_PORTC_CB(WRITE8(aces1_state, ic24_write_c))   // strobe
263   MCFG_I8255_OUT_PORTA_CB(WRITE8(aces1_state, ic24_write_a))  // 7segs
264   MCFG_I8255_OUT_PORTB_CB(WRITE8(aces1_state, ic24_write_b))  // lamps
265   MCFG_I8255_OUT_PORTC_CB(WRITE8(aces1_state, ic24_write_c))  // strobe
266266
267267   // 0xafd0 IC25 - lamps, meters, reel comms (writes)
268268   MCFG_DEVICE_ADD("ic25", I8255A, 0)
269   MCFG_I8255_OUT_PORTA_CB(WRITE8(aces1_state, ic25_write_a))   // extra lamps
270   MCFG_I8255_OUT_PORTB_CB(WRITE8(aces1_state, ic25_write_b))   // meters, extra lamp select
271   MCFG_I8255_OUT_PORTC_CB(WRITE8(aces1_state, ic25_write_c))   // reel write, extra lamp strobe
269   MCFG_I8255_OUT_PORTA_CB(WRITE8(aces1_state, ic25_write_a))  // extra lamps
270   MCFG_I8255_OUT_PORTB_CB(WRITE8(aces1_state, ic25_write_b))  // meters, extra lamp select
271   MCFG_I8255_OUT_PORTC_CB(WRITE8(aces1_state, ic25_write_c))  // reel write, extra lamp strobe
272272
273273   // 0xafe0 IC37 - doors, coins, reel optics (reads)
274274   MCFG_DEVICE_ADD("ic37", I8255A, 0)
275   MCFG_I8255_IN_PORTA_CB(READ8(aces1_state, ic37_read_a))   // extra lamps
276   MCFG_I8255_IN_PORTB_CB(READ8(aces1_state, ic37_read_b))   // meters, extra lamp select
277   MCFG_I8255_IN_PORTC_CB(READ8(aces1_state, ic37_read_c))   // reel write, extra lamp strobe
275   MCFG_I8255_IN_PORTA_CB(READ8(aces1_state, ic37_read_a)) // extra lamps
276   MCFG_I8255_IN_PORTB_CB(READ8(aces1_state, ic37_read_b)) // meters, extra lamp select
277   MCFG_I8255_IN_PORTC_CB(READ8(aces1_state, ic37_read_c)) // reel write, extra lamp strobe
278278
279279   MCFG_DEFAULT_LAYOUT(layout_aces1)
280280
r31373r31374
337337ROM_END
338338
339339ROM_START( ac1cshtw ) // Cash Towers, same ROM as above, original machine apparently plays the same, reskinned machine?
340    ROM_REGION( 0x8000, "maincpu", 0 )
341    ROM_LOAD( "ctp1.bin", 0x0000, 0x8000, CRC(2fabb08f) SHA1(b737930e428f9258ab22394229c2b5039edf8f97) )
340   ROM_REGION( 0x8000, "maincpu", 0 )
341   ROM_LOAD( "ctp1.bin", 0x0000, 0x8000, CRC(2fabb08f) SHA1(b737930e428f9258ab22394229c2b5039edf8f97) )
342342ROM_END
343343
344344
trunk/src/mame/drivers/vegas.c
r31373r31374
475475   required_shared_ptr<UINT32> m_rombase;
476476   required_device<dcs_audio_device> m_dcs;
477477   required_device<midway_ioasic_device> m_ioasic;
478   
478
479479   UINT16 m_nile_irq_state;
480480   UINT16 m_ide_irq_state;
481481   UINT32 m_pci_bridge_regs[0x40];
r31373r31374
15641564
15651565   /* the build the list of stuff */
15661566   m_dynamic_count = 0;
1567   
1567
15681568   /* DCS2 */
15691569   base = m_nile_regs[NREG_DCS2] & 0x1fffff00;
15701570   if (base >= m_rambase.bytes())
r31373r31374
22652265   MCFG_VOODOO_FBMEM(16)
22662266   MCFG_VOODOO_SCREEN_TAG("screen")
22672267   MCFG_VOODOO_CPU_TAG("maincpu")
2268   MCFG_VOODOO_VBLANK_CB(WRITELINE(vegas_state,vblank_assert))   
2268   MCFG_VOODOO_VBLANK_CB(WRITELINE(vegas_state,vblank_assert))
22692269MACHINE_CONFIG_END
22702270
22712271
r31373r31374
23032303// Per driver configs
23042304
23052305static MACHINE_CONFIG_DERIVED( gauntleg, vegas )
2306   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)   
2306   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)
23072307   MCFG_DCS2_AUDIO_DRAM_IN_MB(4)
23082308   MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0b5d)
23092309
r31373r31374
23162316MACHINE_CONFIG_END
23172317
23182318static MACHINE_CONFIG_DERIVED( gauntdl, vegas )
2319   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)   
2319   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)
23202320   MCFG_DCS2_AUDIO_DRAM_IN_MB(4)
23212321   MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0b5d)
23222322
r31373r31374
23292329MACHINE_CONFIG_END
23302330
23312331static MACHINE_CONFIG_DERIVED( warfa, vegas250 )
2332   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)   
2332   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)
23332333   MCFG_DCS2_AUDIO_DRAM_IN_MB(4)
23342334   MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0b5d)
23352335
r31373r31374
23422342MACHINE_CONFIG_END
23432343
23442344static MACHINE_CONFIG_DERIVED( tenthdeg, vegas )
2345   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)   
2345   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)
23462346   MCFG_DCS2_AUDIO_DRAM_IN_MB(4)
23472347   MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0afb)
23482348
r31373r31374
23552355MACHINE_CONFIG_END
23562356
23572357static MACHINE_CONFIG_DERIVED( roadburn, vegas32m )
2358   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_DSIO, 0)   
2358   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_DSIO, 0)
23592359   MCFG_DCS2_AUDIO_DRAM_IN_MB(4)
23602360   MCFG_DCS2_AUDIO_POLLING_OFFSET(0) /* no place to hook :-( */
23612361
r31373r31374
23682368MACHINE_CONFIG_END
23692369
23702370static MACHINE_CONFIG_DERIVED( nbashowt, vegasban )
2371   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)   
2371   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)
23722372   MCFG_DCS2_AUDIO_DRAM_IN_MB(4)
23732373
23742374   MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0)
r31373r31374
23802380MACHINE_CONFIG_END
23812381
23822382static MACHINE_CONFIG_DERIVED( nbanfl, vegasban )
2383   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)   
2383   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)
23842384   MCFG_DCS2_AUDIO_DRAM_IN_MB(4)
23852385
23862386   MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0)
r31373r31374
23922392MACHINE_CONFIG_END
23932393
23942394static MACHINE_CONFIG_DERIVED( sf2049 , denver )
2395   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_DENVER, 0)   
2395   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_DENVER, 0)
23962396   MCFG_DCS2_AUDIO_DRAM_IN_MB(8)
23972397
23982398   MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0)
r31373r31374
24042404MACHINE_CONFIG_END
24052405
24062406static MACHINE_CONFIG_DERIVED( sf2049se, denver )
2407   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_DENVER, 0)   
2407   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_DENVER, 0)
24082408   MCFG_DCS2_AUDIO_DRAM_IN_MB(8)
24092409
24102410   MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0)
r31373r31374
24162416MACHINE_CONFIG_END
24172417
24182418static MACHINE_CONFIG_DERIVED( sf2049te, denver )
2419   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_DENVER, 0)   
2419   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_DENVER, 0)
24202420   MCFG_DCS2_AUDIO_DRAM_IN_MB(8)
24212421
24222422   MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0)
r31373r31374
24282428MACHINE_CONFIG_END
24292429
24302430static MACHINE_CONFIG_DERIVED( cartfury, vegasv3 )
2431   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)   
2431   MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0)
24322432   MCFG_DCS2_AUDIO_DRAM_IN_MB(4)
24332433
24342434   MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0)
trunk/src/mame/drivers/jpmsys5.c
r31373r31374
238238      }
239239      case 1:
240240      {
241         //Reset 0x04, data 0x02, clock
241         //Reset 0x04, data 0x02, clock
242242         m_vfd->por(data & 0x04);
243243         m_vfd->data(data & 0x02);
244244         m_vfd->sclk(data & 0x01);
trunk/src/mame/drivers/wpc_dcs.c
r31373r31374
1616public:
1717   wpc_dcs_state(const machine_config &mconfig, device_type type, const char *tag)
1818      : driver_device(mconfig, type, tag),
19        maincpu(*this, "maincpu"),
20        dcs(*this, "dcs"),
21        rombank(*this, "rombank"),
22        mainram(*this, "mainram"),
23        nvram(*this, "nvram"),
24        lamp(*this, "lamp"),
25        out(*this, "out"),
26        swarray(*this, "SW")
19         maincpu(*this, "maincpu"),
20         dcs(*this, "dcs"),
21         rombank(*this, "rombank"),
22         mainram(*this, "mainram"),
23         nvram(*this, "nvram"),
24         lamp(*this, "lamp"),
25         out(*this, "out"),
26         swarray(*this, "SW")
2727   { }
2828
2929   DECLARE_WRITE8_MEMBER(bank_w);
r31373r31374
293293
294294static INPUT_PORTS_START( wpc_dcs )
295295   PORT_START("SW.0")
296    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
297    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
298    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
299    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
300    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
301    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
302    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
303    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
296   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Launch button")
297   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED)
298   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Start button")
299   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Plumb bob tilt")
300   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
301   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left outlane")
302   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right return")
303   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shooter lane")
304304
305305   PORT_START("SW.1")
306    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
307    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
308    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
309    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
310    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
311    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
312    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
313    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
306   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Slam tilt")
307   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Coin door closed") PORT_TOGGLE PORT_CODE(KEYCODE_F1)
308   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED)
309   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
310   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED)
311   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left return")
312   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right outlane")
313   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
314314
315315   PORT_START("SW.2")
316    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
317    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
318    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
319    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
320    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
321    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
322    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
323    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
316   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough eject")
317   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 1")
318   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 2")
319   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 3")
320   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Trough ball 4")
321   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Left popper")
322   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Right popper")
323   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left top lane")
324324
325325   PORT_START("SW.3")
326    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
327    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
328    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
329    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
330    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
331    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
332    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
333    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
326   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTI\"A\"N")
327   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MARTIA\"N\"")
328   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MAR\"T\"IN")
329   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MART\"I\"AN")
330   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L motor bank")
331   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C motor bank")
332   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R motor bank")
333   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right top lane")
334334
335335   PORT_START("SW.4")
336    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
337    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
338    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
339    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
340    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
341    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
342    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
343    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
336   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left slingshot")
337   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right slingshot")
338   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left jet")
339   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Bottom jet")
340   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right jet")
341   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("\"M\"ARTIAN")
342   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("M\"A\"RTIAN")
343   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("MA\"R\"TIAN")
344344
345345   PORT_START("SW.5")
346    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
347    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
348    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
349    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
350    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
351    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
352    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
353    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
346   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp enter")
347   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("C ramp enter")
348   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp enter")
349   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L ramp exit")
350   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R ramp exit")
351   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank down")
352   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Motor bank up")
353   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED)
354354
355355   PORT_START("SW.6")
356    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
357    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
358    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
359    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
360    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
361    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
362    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
363    PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
356   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop hi")
357   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Right loop lo")
358   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop hi")
359   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Left loop lo")
360   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("L saucer tgt")
361   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("R saucer tgt")
362   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Drop target")
363   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Center trough")
364364
365365   PORT_START("SW.7")
366    PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
366   PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED)
367367
368368   PORT_START("DOOR")
369    PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
370    PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
371    PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
372    PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
373    PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
374    PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
375    PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
376    PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
369   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_NAME("Left coin chute")
370   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_NAME("Center coin chute")
371   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_COIN3) PORT_NAME("Right coin chute")
372   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_COIN4) PORT_NAME("4th coin chute")
373   PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_SERVICE1) PORT_NAME("Service credit/Escape")
374   PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Down/Down") PORT_CODE(KEYCODE_DOWN)
375   PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Volume Up/Up") PORT_CODE(KEYCODE_UP)
376   PORT_SERVICE_NO_TOGGLE(0x80, IP_ACTIVE_HIGH ) PORT_NAME("Begin test/Enter")
377377
378378   PORT_START("DSW")
379379   PORT_DIPNAME(0x01,0x01,"Switch 1") PORT_DIPLOCATION("SWA:1")
r31373r31374
407407   PORT_DIPSETTING(0xf0,"USA 2")
408408
409409   PORT_START("FLIPPERS")
410    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
411    PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
412    PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
413    PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
414    PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
415    PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
416    PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
417    PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
410   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper EOS")
411   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Flipper Button")
412   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper EOS")
413   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Flipper Button")
414   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
415   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UR Flipper Button")
416   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
417   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("UL Flipper Button")
418418
419419INPUT_PORTS_END
420420
trunk/src/mame/drivers/g627.c
r31373r31374
301301
302302ROM_START(rota_115)
303303   ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF)
304    ROM_LOAD("v115-a.bin", 0x0000, 0x0800, CRC(474884b3) SHA1(b7919bf2e3a3897c1180373cccf88240c57b5645))
305    ROM_LOAD("v115-b.bin", 0x0800, 0x0800, CRC(8779fc6c) SHA1(df00f58d38b4eca68603247ae69009e13cfa31fb))
306    ROM_LOAD("v115-c.bin", 0x1000, 0x0800, CRC(54b420f9) SHA1(597bb9f8ad0b20babc696175e9fbcecf2d5d799d))
304   ROM_LOAD("v115-a.bin", 0x0000, 0x0800, CRC(474884b3) SHA1(b7919bf2e3a3897c1180373cccf88240c57b5645))
305   ROM_LOAD("v115-b.bin", 0x0800, 0x0800, CRC(8779fc6c) SHA1(df00f58d38b4eca68603247ae69009e13cfa31fb))
306   ROM_LOAD("v115-c.bin", 0x1000, 0x0800, CRC(54b420f9) SHA1(597bb9f8ad0b20babc696175e9fbcecf2d5d799d))
307307ROM_END
308308
309309ROM_START(rota_101)
310310   ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF)
311    ROM_LOAD("v101-a.bin", 0x0000, 0x0800, CRC(e89f3de6) SHA1(0b62220a24e176f2d7838da080b447a3df9ce05d))
312    ROM_LOAD("v101-b.bin", 0x0800, 0x0800, CRC(0690670b) SHA1(6399a7df707d644d0b7fe7b4fea6fb5091a9883d))
313    ROM_LOAD("v101-c.bin", 0x1000, 0x0800, CRC(c7e85638) SHA1(b59805d8b558ab8f5ea5b4b9261e862afca4b9d3))
311   ROM_LOAD("v101-a.bin", 0x0000, 0x0800, CRC(e89f3de6) SHA1(0b62220a24e176f2d7838da080b447a3df9ce05d))
312   ROM_LOAD("v101-b.bin", 0x0800, 0x0800, CRC(0690670b) SHA1(6399a7df707d644d0b7fe7b4fea6fb5091a9883d))
313   ROM_LOAD("v101-c.bin", 0x1000, 0x0800, CRC(c7e85638) SHA1(b59805d8b558ab8f5ea5b4b9261e862afca4b9d3))
314314ROM_END
315315
316GAME(1978,  rotation,  0,          g627,  g627, driver_device,  0,  ROT0,  "Midway", "Rotation VIII (v. 1.17)", GAME_MECHANICAL )
316GAME(1978,  rotation,  0,         g627,  g627, driver_device,  0,  ROT0,  "Midway", "Rotation VIII (v. 1.17)", GAME_MECHANICAL )
317317GAME(1978,  rota_115,  rotation,  g627,  g627, driver_device,  0,  ROT0,  "Midway", "Rotation VIII (v. 1.15)", GAME_MECHANICAL )
318318GAME(1978,  rota_101,  rotation,  g627,  g627, driver_device,  0,  ROT0,  "Midway", "Rotation VIII (v. 1.01)", GAME_MECHANICAL )
trunk/src/mame/drivers/atarigt.c
r31373r31374
836836   /* sound hardware */
837837   MCFG_DEVICE_ADD("cage", ATARI_CAGE, 0)
838838   MCFG_ATARI_CAGE_SPEEDUP(0x4fad)
839   MCFG_ATARI_CAGE_IRQ_CALLBACK(WRITE8(atarigt_state,cage_irq_callback))   
839   MCFG_ATARI_CAGE_IRQ_CALLBACK(WRITE8(atarigt_state,cage_irq_callback))
840840MACHINE_CONFIG_END
841841
842842static MACHINE_CONFIG_DERIVED( primrage, atarigt )
843843   /* sound hardware */
844844   MCFG_DEVICE_ADD("cage", ATARI_CAGE, 0)
845845   MCFG_ATARI_CAGE_SPEEDUP(0x42f2)
846   MCFG_ATARI_CAGE_IRQ_CALLBACK(WRITE8(atarigt_state,cage_irq_callback))   
846   MCFG_ATARI_CAGE_IRQ_CALLBACK(WRITE8(atarigt_state,cage_irq_callback))
847847MACHINE_CONFIG_END
848848
849849static MACHINE_CONFIG_DERIVED( primrage20, atarigt )
850850   /* sound hardware */
851851   MCFG_DEVICE_ADD("cage", ATARI_CAGE, 0)
852852   MCFG_ATARI_CAGE_SPEEDUP(0x48a4)
853   MCFG_ATARI_CAGE_IRQ_CALLBACK(WRITE8(atarigt_state,cage_irq_callback))   
853   MCFG_ATARI_CAGE_IRQ_CALLBACK(WRITE8(atarigt_state,cage_irq_callback))
854854MACHINE_CONFIG_END
855855
856856/*************************************
r31373r31374
13311331 *
13321332 *************************************/
13331333
1334GAME( 1994, tmek,       0,        tmek,      tmek, atarigt_state,     tmek,       ROT0, "Atari Games", "T-MEK (v5.1, The Warlords)", GAME_UNEMULATED_PROTECTION )
1335GAME( 1994, tmek51p,    tmek,     tmek,      tmek, atarigt_state,     tmek,       ROT0, "Atari Games", "T-MEK (v5.1, prototype)", GAME_UNEMULATED_PROTECTION )
1336GAME( 1994, tmek45,     tmek,     tmek,      tmek, atarigt_state,     tmek,       ROT0, "Atari Games", "T-MEK (v4.5)", GAME_UNEMULATED_PROTECTION )
1337GAME( 1994, tmek44,     tmek,     tmek,     tmek, atarigt_state,     tmek,       ROT0, "Atari Games", "T-MEK (v4.4)", GAME_UNEMULATED_PROTECTION )
1338GAME( 1994, tmek20,     tmek,     tmek,      tmek, atarigt_state,     tmek,       ROT0, "Atari Games", "T-MEK (v2.0, prototype)", 0 )
1334GAME( 1994, tmek,       0,        tmek,      tmek, atarigt_state,     tmek,       ROT0, "Atari Games", "T-MEK (v5.1, The Warlords)", GAME_UNEMULATED_PROTECTION )
1335GAME( 1994, tmek51p,    tmek,     tmek,      tmek, atarigt_state,     tmek,       ROT0, "Atari Games", "T-MEK (v5.1, prototype)", GAME_UNEMULATED_PROTECTION )
1336GAME( 1994, tmek45,     tmek,     tmek,      tmek, atarigt_state,     tmek,       ROT0, "Atari Games", "T-MEK (v4.5)", GAME_UNEMULATED_PROTECTION )
1337GAME( 1994, tmek44,     tmek,     tmek,      tmek, atarigt_state,     tmek,       ROT0, "Atari Games", "T-MEK (v4.4)", GAME_UNEMULATED_PROTECTION )
1338GAME( 1994, tmek20,     tmek,     tmek,      tmek, atarigt_state,     tmek,       ROT0, "Atari Games", "T-MEK (v2.0, prototype)", 0 )
13391339GAME( 1994, primrage,   0,        primrage,  primrage, atarigt_state, primrage,   ROT0, "Atari Games", "Primal Rage (version 2.3)", GAME_UNEMULATED_PROTECTION )
13401340GAME( 1994, primrage20, primrage, primrage20,primrage, atarigt_state, primrage, ROT0, "Atari Games", "Primal Rage (version 2.0)", GAME_UNEMULATED_PROTECTION )
trunk/src/mame/drivers/rollerg.c
r31373r31374
250250   MCFG_KONAMICPU_LINE_CB(WRITE8(rollerg_state, banking_callback))
251251
252252   MCFG_CPU_ADD("audiocpu", Z80, 3579545)
253   MCFG_CPU_PROGRAM_MAP(rollerg_sound_map)   /* NMIs are generated by the 053260 */
253   MCFG_CPU_PROGRAM_MAP(rollerg_sound_map) /* NMIs are generated by the 053260 */
254254
255255   /* video hardware */
256256   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mame/drivers/dwarfd.c
r31373r31374
579579      m_back_color = false;
580580
581581   //if(!linecount)
582   //   logerror("%d %d %02x %02x %02x %02x %02x %02x %02x\n", x/8, y/8, charcode, lineattr, lten, rvv, vsp, gpa, hlgt);
582   //  logerror("%d %d %02x %02x %02x %02x %02x %02x %02x\n", x/8, y/8, charcode, lineattr, lten, rvv, vsp, gpa, hlgt);
583583
584584   for(i=0;i<8;i+=2)
585585   {
r31373r31374
603603      m_back_color = false;
604604
605605   //if(!linecount)
606   //   logerror("%d %d %02x %02x %02x %02x %02x %02x %02x\n", x/8, y/8, charcode, lineattr, lten, rvv, vsp, gpa, hlgt);
606   //  logerror("%d %d %02x %02x %02x %02x %02x %02x %02x\n", x/8, y/8, charcode, lineattr, lten, rvv, vsp, gpa, hlgt);
607607
608608   for(i=0;i<8;i+=2)
609609   {
trunk/src/mame/audio/cinemat.c
r31373r31374
14211421   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
14221422
14231423   MCFG_SOUND_ADD("ay3", AY8910, 3579545)
1424   
1425   
1424
1425
14261426   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(cinemat_state, sound_output_w))
14271427   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
14281428MACHINE_CONFIG_END
trunk/src/mame/audio/dcs.c
r31373r31374
779779      machine().save().register_postload(save_prepost_delegate(FUNC(dcs_audio_device::sdrc_remap_memory), this));
780780}
781781
782
782
783783//-------------------------------------------------
784784//  dcs_audio_device - constructor
785785//-------------------------------------------------
r31373r31374
911911   }
912912   if (m_cpu != NULL && !m_cpu->started())
913913      throw device_missing_dependencies();
914   
914
915915   m_program = &m_cpu->space(AS_PROGRAM);
916916   m_data = &m_cpu->space(AS_DATA);
917917   m_channels = 2;
r31373r31374
14501450   /* going high halts the CPU */
14511451   if (state)
14521452   {
1453      //      logerror("%s: DCS reset = %d\n", machine().describe_context(), state);
1453      //      logerror("%s: DCS reset = %d\n", machine().describe_context(), state);
14541454
14551455      /* just run through the init code again */
14561456      machine().scheduler().synchronize(timer_expired_delegate(FUNC(dcs_audio_device::dcs_reset),this));
r31373r31374
24442444{
24452445}
24462446
2447   
2447
24482448const device_type DCS2_AUDIO_2115 = &device_creator<dcs2_audio_2115_device>;
24492449
24502450//-------------------------------------------------
r31373r31374
25092509{
25102510   return MACHINE_CONFIG_NAME( dcs2_audio_denver );
25112511}
2512
2513
trunk/src/mame/audio/midway.c
r31373r31374
384384   MCFG_DEVICE_PERIODIC_INT_DEVICE(DEVICE_SELF, midway_ssio_device, clock_14024, SSIO_CLOCK/2/16/10)
385385
386386   MCFG_SOUND_ADD("ay0", AY8910, SSIO_CLOCK/2/4)
387   
388   
387
388
389389   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(midway_ssio_device, porta0_w))
390390   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(midway_ssio_device, portb0_w))
391391   MCFG_MIXER_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.33, 0)
392392
393393   MCFG_SOUND_ADD("ay1", AY8910, SSIO_CLOCK/2/4)
394   
395   
394
395
396396   MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(midway_ssio_device, porta1_w))
397397   MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(midway_ssio_device, portb1_w))
398398   MCFG_MIXER_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.33, 1)
trunk/src/mame/audio/cage.c
r31373r31374
104104 *  Initialization
105105 *
106106 *************************************/
107
107
108108const device_type ATARI_CAGE = &device_creator<atari_cage_device>;
109109
110110
r31373r31374
581581
582582WRITE32_MEMBER( atari_cage_device::speedup_w )
583583{
584
585584   space.device().execute().eat_cycles(100);
586585   COMBINE_DATA(&m_speedup_ram[offset]);
587586}
trunk/src/mame/machine/balsente.c
r31373r31374
211211   /* noise generator runs at 100kHz */
212212   UINT32 step = (100000 << 14) / CEM3394_SAMPLE_RATE;
213213   UINT32 noise_counter = m_noise_position[chip];
214   
214
215215   while (count--)
216216   {
217217      *buffer++ = m_poly17[(noise_counter >> 14) & POLY17_SIZE] << 12;
218218      noise_counter += step;
219219   }
220   
220
221221   /* remember the noise position */
222222   m_noise_position[chip] = noise_counter;
223223}
trunk/src/mame/machine/fd1094.c
r31373r31374
305305
306306    driver      FD1094      SP plain  SP enc    PC plain  PC enc    States Used (majority one marked with asterisk, if known)
307307    --------    --------    --------  --------  --------  --------  ---------------------
308    aceattac    317-0059    00000000  A711AF59  00000414  AF59AACD  00 12 17 31 45 90 FC*
309    aceattaca   317-0060    00000000  A711AF59  00000400  AF59EADD  00 17 31 45 90 FC*
310    altbeast5   317-0069    FFFFFF00  B2F7F299  00000400  CCDDEF58  00 0F 18 20 93* A7 D8
311    altbeastj1  317-0065    FFFFFF00  C9C5F299  00000400  CCDDECDD  00 09 12 67* 99 FC
312    altbeastj3  317-0068    FFFFFF00  B2F7F299  00000400  CCDDEF58  00 0F 18 20 93* A7 D8
313    astorm      317-0154    FFFFFF00  B297F23F  00000400  BD5999DD  00 1F 48* 5F 66 ED
314    astorm3     317-0148    FFFFFF00  ED9FF23F  00000400  FC58B9DC  00 06 36 50 CC D9*
315    astormj     317-0146    FFFFFF00  ED8CF23F  00000400  FC58BC59  00 10 29* 44 CE DF
316    astormu     317-0147    FFFFFF00  B297F23F  00000400  55334533  00 19 2D 46 58* DF
317    bayroute    317-0116    00504000  5EB40000  00001000  5533A184  00 04* 11 18
318    bayroutej   317-0115    00504000  56150000  00001000  85948DCF  00 05* 12 16
319    bloxeed     317-0139    00000000  5D92A711  00001D38  BD59FFE8  00 49 53 55 56* DF
320    bullet      317-0041    00000000  57355D96  00001882  8DDC8CF4  00 12 21 69* FE
321    cltchitr    317-0176    00000000  A711A711  00000416  AF59EBCD  00 01* 80 FC
322    cltchitrj   317-0175    00000000  5F94A711  00000416  AF59AFFB  00 03 19* 91
323    cotton      317-0181a   00204000  5DB20000  00000716  CCDD0716  00 0E* 73
324    cottonj     317-0179b   00204000  5DB20000  00000720  CCDD0720  00 0E* 73
325    cottonu     317-0180    00204000  5DB20000  00000716  A1840716  00 0E* 73
326    ddcrew      317-0190    00000000  AF595D92  00000408  BD59FD7F  00 07 16* 17
327    ddcrew1     317-0187    00000000  5F945D96  00000408  8DDCE758  00 04 07* 13 91
328    ddcrew2     317-0184    00000000  AF595D92  00000408  5533FD7F  00 07 12* 16 22
329    ddcrewj     317-0185    00000000  5F945D92  00000408  5533FD7F  00 06 07* 09 91
330    ddcrewu     317-0186    00000000  AF59A711  00000408  8DDCC381  00 01 07 5F 91*
331    ddux        317-0096    00000000  5F94AF59  00000406  AF5987A0  00 21 28 70* D9
332    desertbr    317-0196    00000000  55335D92  00001838  5533F46A  00 3C 4A 82 DA*
333    desertbrj   317-0194    00000000  55335D92  00001838  BD59E720  00 3C 4A 82 DA*
334    eswat       317-0130    00000000  A711AF59  00000400  5533BC59  00 05 0C EC FA*
335    eswatj      317-0128    00000000  A711AF59  00000400  55334735  00 55 63 CB* D5
336    eswatu      317-0129    00000000  5537AF59  00000400  55334735  00 0A 12 C3* CC
337    exctleag    317-0079    00000000  5537AF59  00000410  83018384  00 02 39 4B 85 98 E5*
338    fpoint      317-0127a   00000000  AF59AF59  00001A40  8DDC9960  00 15* 35 5F 82 DB
339    fpoint1     317-0127a   00000000  AF59AF59  00001A40  8DDC9960  00 15* 35 5F 82 DB
340    goldnaxe1   317-0110    FFFFFF00  ED62F2B9  00000400  AF59A785  00 19 2E 31 48* 5D
341    goldnaxe3   317-0120    FFFFFF00  ED62F2B9  00000400  AF59A785  00 0A 0D 44 C7 EF*
342    goldnaxej   317-0121    FFFFFF00  C9D6F2B9  00000400  AF59A785  00 12* 35 58 7A 9E
343    goldnaxeu   317-0122    FFFFFF00  E53AF2B9  00000400  A184A196  00 03 51* 72 99 F6
344    hwchampj    317-0046    00000000  5D925D96  000008AC  AF59AA41  00 8B* E3
345    lghost      317-0166    00000000  5F94A711  00000404  EE588241  00 A2 DC E0*
346    lghostu     317-0165    00000000  AF59A711  00000404  EE58C340  00 56 C4 DE*
347    mvp         317-0143    00000000  5F94A711  00000416  BD59DC5B  00 19* 20 88 98
348    mwalk       317-0159    FFFFFF00  C9C7F23F  00000400  5533BD7F  00 39 51* AA CC
349    mwalkj      317-0157    FFFFFF00  B2F7F23F  00000400  5533BD7F  00 20 88 99 CF*
350    mwalku      317-0158    FFFFFF00  C572F23F  00000400  8DDC8DDD  00 49* 90 C0 DE
351    passsht     317-0080    00000000  AF59AF59  00003202  C2003923  00 11 52* 96 EE
352    passshta    317-0074    00000000  AF59AF59  000031E4  C2003F8C  00 12* 47 83 A7
353    passshtj    317-0070    00000000  5D92AF59  000031E4  C2003F8C  00 12 59 83* FE
354    pontoon     317-0153    00000000  A7115D92  00000E0C  FC585979  00 19 70 DC* FC
355    ryukyu      317-5023    00203800  AF49D30B  0000042E  FC5863B5  00 DC* EF
356    shinobi2    317-0049    FFFFFF00  C9C5F25F  00000400  AF598395  00 53 88 98 9B 9C* F1
357    sonicbom    317-0053    00000000  5735AF59  00001000  FC587133  00*
358    suprleag    317-0045    00000000  A711AF59  0000108E  BD59CE5B  00 12* 34 56 AB CD
308    aceattac    317-0059    00000000  A711AF59  00000414  AF59AACD  00 12 17 31 45 90 FC*
309    aceattaca   317-0060    00000000  A711AF59  00000400  AF59EADD  00 17 31 45 90 FC*
310    altbeast5   317-0069    FFFFFF00  B2F7F299  00000400  CCDDEF58  00 0F 18 20 93* A7 D8
311    altbeastj1  317-0065    FFFFFF00  C9C5F299  00000400  CCDDECDD  00 09 12 67* 99 FC
312    altbeastj3  317-0068    FFFFFF00  B2F7F299  00000400  CCDDEF58  00 0F 18 20 93* A7 D8
313    astorm      317-0154    FFFFFF00  B297F23F  00000400  BD5999DD  00 1F 48* 5F 66 ED
314    astorm3     317-0148    FFFFFF00  ED9FF23F  00000400  FC58B9DC  00 06 36 50 CC D9*
315    astormj     317-0146    FFFFFF00  ED8CF23F  00000400  FC58BC59  00 10 29* 44 CE DF
316    astormu     317-0147    FFFFFF00  B297F23F  00000400  55334533  00 19 2D 46 58* DF
317    bayroute    317-0116    00504000  5EB40000  00001000  5533A184  00 04* 11 18
318    bayroutej   317-0115    00504000  56150000  00001000  85948DCF  00 05* 12 16
319    bloxeed     317-0139    00000000  5D92A711  00001D38  BD59FFE8  00 49 53 55 56* DF
320    bullet      317-0041    00000000  57355D96  00001882  8DDC8CF4  00 12 21 69* FE
321    cltchitr    317-0176    00000000  A711A711  00000416  AF59EBCD  00 01* 80 FC
322    cltchitrj   317-0175    00000000  5F94A711  00000416  AF59AFFB  00 03 19* 91
323    cotton      317-0181a   00204000  5DB20000  00000716  CCDD0716  00 0E* 73
324    cottonj     317-0179b   00204000  5DB20000  00000720  CCDD0720  00 0E* 73
325    cottonu     317-0180    00204000  5DB20000  00000716  A1840716  00 0E* 73
326    ddcrew      317-0190    00000000  AF595D92  00000408  BD59FD7F  00 07 16* 17
327    ddcrew1     317-0187    00000000  5F945D96  00000408  8DDCE758  00 04 07* 13 91
328    ddcrew2     317-0184    00000000  AF595D92  00000408  5533FD7F  00 07 12* 16 22
329    ddcrewj     317-0185    00000000  5F945D92  00000408  5533FD7F  00 06 07* 09 91
330    ddcrewu     317-0186    00000000  AF59A711  00000408  8DDCC381  00 01 07 5F 91*
331    ddux        317-0096    00000000  5F94AF59  00000406  AF5987A0  00 21 28 70* D9
332    desertbr    317-0196    00000000  55335D92  00001838  5533F46A  00 3C 4A 82 DA*
333    desertbrj   317-0194    00000000  55335D92  00001838  BD59E720  00 3C 4A 82 DA*
334    eswat       317-0130    00000000  A711AF59  00000400  5533BC59  00 05 0C EC FA*
335    eswatj      317-0128    00000000  A711AF59  00000400  55334735  00 55 63 CB* D5
336    eswatu      317-0129    00000000  5537AF59  00000400  55334735  00 0A 12 C3* CC
337    exctleag    317-0079    00000000  5537AF59  00000410  83018384  00 02 39 4B 85 98 E5*
338    fpoint      317-0127a   00000000  AF59AF59  00001A40  8DDC9960  00 15* 35 5F 82 DB
339    fpoint1     317-0127a   00000000  AF59AF59  00001A40  8DDC9960  00 15* 35 5F 82 DB
340    goldnaxe1   317-0110    FFFFFF00  ED62F2B9  00000400  AF59A785  00 19 2E 31 48* 5D
341    goldnaxe3   317-0120    FFFFFF00  ED62F2B9  00000400  AF59A785  00 0A 0D 44 C7 EF*
342    goldnaxej   317-0121    FFFFFF00  C9D6F2B9  00000400  AF59A785  00 12* 35 58 7A 9E
343    goldnaxeu   317-0122    FFFFFF00  E53AF2B9  00000400  A184A196  00 03 51* 72 99 F6
344    hwchampj    317-0046    00000000  5D925D96  000008AC  AF59AA41  00 8B* E3
345    lghost      317-0166    00000000  5F94A711  00000404  EE588241  00 A2 DC E0*
346    lghostu     317-0165    00000000  AF59A711  00000404  EE58C340  00 56 C4 DE*
347    mvp         317-0143    00000000  5F94A711  00000416  BD59DC5B  00 19* 20 88 98
348    mwalk       317-0159    FFFFFF00  C9C7F23F  00000400  5533BD7F  00 39 51* AA CC
349    mwalkj      317-0157    FFFFFF00  B2F7F23F  00000400  5533BD7F  00 20 88 99 CF*
350    mwalku      317-0158    FFFFFF00  C572F23F  00000400  8DDC8DDD  00 49* 90 C0 DE
351    passsht     317-0080    00000000  AF59AF59  00003202  C2003923  00 11 52* 96 EE
352    passshta    317-0074    00000000  AF59AF59  000031E4  C2003F8C  00 12* 47 83 A7
353    passshtj    317-0070    00000000  5D92AF59  000031E4  C2003F8C  00 12 59 83* FE
354    pontoon     317-0153    00000000  A7115D92  00000E0C  FC585979  00 19 70 DC* FC
355    ryukyu      317-5023    00203800  AF49D30B  0000042E  FC5863B5  00 DC* EF
356    shinobi2    317-0049    FFFFFF00  C9C5F25F  00000400  AF598395  00 53 88 98 9B 9C* F1
357    sonicbom    317-0053    00000000  5735AF59  00001000  FC587133  00*
358    suprleag    317-0045    00000000  A711AF59  0000108E  BD59CE5B  00 12* 34 56 AB CD
359359    tetris1     317-0091    00000000  5D92AF59  00000410  AF59AE58  99 25 42 5B 68 FC
360    tetris2     317-0092    00000000  5735AF59  00000410  AF598685  00 10 52 74 97* FC
360    tetris2     317-0092    00000000  5735AF59  00000410  AF598685  00 10 52 74 97* FC
361361    wb32        317-0085    FFFFFF7E  B2F78997  00000500  AF590500  00 10 13 26 77
362    wb33        317-0089    FFFFFF7E  E5C78997  00000500  AF590500  00 23 40 52 71*
363    wb34        317-0087    FFFFFF7E  B2978997  00000500  AF590500  00 11* 64 69 82
364    wrestwar1   317-0090    00000000  5D96AF59  00000414  8301AE18  00 12* A7 AB CC F9 FC
365    wrestwar2   317-0102    00000000  5D96AF59  00000414  EE588E5B  00 12* A7 AB CC F9 FC
366    wwallyj     317-0197b   00000000  AF595D96  00000416  CCDDCE5B  00 16* 32 3F 43
367    wwallyja    317-0197a   00000000  AF595D96  00000416  CCDDCE5B  00 16* 32 3F 43
362    wb33        317-0089    FFFFFF7E  E5C78997  00000500  AF590500  00 23 40 52 71*
363    wb34        317-0087    FFFFFF7E  B2978997  00000500  AF590500  00 11* 64 69 82
364    wrestwar1   317-0090    00000000  5D96AF59  00000414  8301AE18  00 12* A7 AB CC F9 FC
365    wrestwar2   317-0102    00000000  5D96AF59  00000414  EE588E5B  00 12* A7 AB CC F9 FC
366    wwallyj     317-0197b   00000000  AF595D96  00000416  CCDDCE5B  00 16* 32 3F 43
367    wwallyja    317-0197a   00000000  AF595D96  00000416  CCDDCE5B  00 16* 32 3F 43
368368
369369*****************************************************************************/
370370
r31373r31374
822822   UINT8 key_7a = BIT(mainkey,7) ^ BIT(gkey2,4);
823823
824824
825    if (val & 0x8000)           // block invariant: val & 0x8000 != 0
826    {
827        val = BITSWAP16(val, 15, 9,10,13, 3,12, 0,14, 6, 5, 2,11, 8, 1, 4, 7);
828       
829        if (!global_xor1)   if (~val & 0x0800)  val ^= 0x3002;                                      // 1,12,13
830                            if (~val & 0x0020)  val ^= 0x0044;                                      // 2,6
831        if (!key_1b)        if (~val & 0x0400)  val ^= 0x0890;                                      // 4,7,11
832        if (!global_swap2)  if (!key_0c)        val ^= 0x0308;                                      // 3,8,9
833                                                val ^= 0x6561;
834       
835        if (!key_2b)        val = BITSWAP16(val,15,10,13,12,11,14,9,8,7,6,0,4,3,2,1,5);             // 0-5, 10-14
836    }
837   
838    if (val & 0x4000)           // block invariant: val & 0x4000 != 0
839    {
840        val = BITSWAP16(val, 13,14, 7, 0, 8, 6, 4, 2, 1,15, 3,11,12,10, 5, 9);
841       
842        if (!global_xor0)   if (val & 0x0010)   val ^= 0x0468;                                      // 3,5,6,10
843        if (!key_3a)        if (val & 0x0100)   val ^= 0x0081;                                      // 0,7
844        if (!key_6a)        if (val & 0x0004)   val ^= 0x0100;                                      // 8
845        if (!key_5b)        if (!key_0b)        val ^= 0x3012;                                      // 1,4,12,13
846                                                val ^= 0x3523;
847                                               
848        if (!global_swap0b) val = BITSWAP16(val, 2,14,13,12, 9,10,11, 8, 7, 6, 5, 4, 3,15, 1, 0);   // 2-15, 9-11
849    }
850   
851    if (val & 0x2000)           // block invariant: val & 0x2000 != 0
852    {
853        val = BITSWAP16(val, 10, 2,13, 7, 8, 0, 3,14, 6,15, 1,11, 9, 4, 5,12);
854       
855        if (!key_4a)        if (val & 0x0800)   val ^= 0x010c;                                      // 2,3,8
856        if (!key_1a)        if (val & 0x0080)   val ^= 0x1000;                                      // 12
857        if (!key_7a)        if (val & 0x0400)   val ^= 0x0a21;                                      // 0,5,9,11
858        if (!key_4b)        if (!key_0a)        val ^= 0x0080;                                      // 7
859        if (!global_swap0a) if (!key_6b)        val ^= 0xc000;                                      // 14,15
860                                                val ^= 0x99a5;
861                                               
862        if (!key_5b)        val = BITSWAP16(val,15,14,13,12,11, 1, 9, 8, 7,10, 5, 6, 3, 2, 4, 0);   // 1,4,6,10
863    }
825   if (val & 0x8000)           // block invariant: val & 0x8000 != 0
826   {
827      val = BITSWAP16(val, 15, 9,10,13, 3,12, 0,14, 6, 5, 2,11, 8, 1, 4, 7);
864828
829      if (!global_xor1)   if (~val & 0x0800)  val ^= 0x3002;                                      // 1,12,13
830                     if (~val & 0x0020)  val ^= 0x0044;                                      // 2,6
831      if (!key_1b)        if (~val & 0x0400)  val ^= 0x0890;                                      // 4,7,11
832      if (!global_swap2)  if (!key_0c)        val ^= 0x0308;                                      // 3,8,9
833                                    val ^= 0x6561;
834
835      if (!key_2b)        val = BITSWAP16(val,15,10,13,12,11,14,9,8,7,6,0,4,3,2,1,5);             // 0-5, 10-14
836   }
837
838   if (val & 0x4000)           // block invariant: val & 0x4000 != 0
839   {
840      val = BITSWAP16(val, 13,14, 7, 0, 8, 6, 4, 2, 1,15, 3,11,12,10, 5, 9);
841
842      if (!global_xor0)   if (val & 0x0010)   val ^= 0x0468;                                      // 3,5,6,10
843      if (!key_3a)        if (val & 0x0100)   val ^= 0x0081;                                      // 0,7
844      if (!key_6a)        if (val & 0x0004)   val ^= 0x0100;                                      // 8
845      if (!key_5b)        if (!key_0b)        val ^= 0x3012;                                      // 1,4,12,13
846                                    val ^= 0x3523;
847
848      if (!global_swap0b) val = BITSWAP16(val, 2,14,13,12, 9,10,11, 8, 7, 6, 5, 4, 3,15, 1, 0);   // 2-15, 9-11
849   }
850
851   if (val & 0x2000)           // block invariant: val & 0x2000 != 0
852   {
853      val = BITSWAP16(val, 10, 2,13, 7, 8, 0, 3,14, 6,15, 1,11, 9, 4, 5,12);
854
855      if (!key_4a)        if (val & 0x0800)   val ^= 0x010c;                                      // 2,3,8
856      if (!key_1a)        if (val & 0x0080)   val ^= 0x1000;                                      // 12
857      if (!key_7a)        if (val & 0x0400)   val ^= 0x0a21;                                      // 0,5,9,11
858      if (!key_4b)        if (!key_0a)        val ^= 0x0080;                                      // 7
859      if (!global_swap0a) if (!key_6b)        val ^= 0xc000;                                      // 14,15
860                                    val ^= 0x99a5;
861
862      if (!key_5b)        val = BITSWAP16(val,15,14,13,12,11, 1, 9, 8, 7,10, 5, 6, 3, 2, 4, 0);   // 1,4,6,10
863   }
864
865865   if (val & 0xe000)           // block invariant: val & 0xe000 != 0
866866   {
867        val = BITSWAP16(val,15,13,14, 5, 6, 0, 9,10, 4,11, 1, 2,12, 3, 7, 8);
868       
869        val ^= 0x17ff;
870       
867      val = BITSWAP16(val,15,13,14, 5, 6, 0, 9,10, 4,11, 1, 2,12, 3, 7, 8);
868
869      val ^= 0x17ff;
870
871871      if (!global_swap4)  val = BITSWAP16(val, 15,14,13, 6,11,10, 9, 5, 7,12, 8, 4, 3, 2, 1, 0);  // 5-8, 6-12
872872      if (!global_swap3)  val = BITSWAP16(val, 13,15,14,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);  // 15-14-13
873873      if (!global_swap2)  val = BITSWAP16(val, 15,14,13,12,11, 2, 9, 8,10, 6, 5, 4, 3, 0, 1, 7);  // 10-2-0-7
874874      if (!key_3b)        val = BITSWAP16(val, 15,14,13,12,11,10, 4, 8, 7, 6, 5, 9, 1, 2, 3, 0);  // 9-4, 3-1
875        if (!key_2a)        val = BITSWAP16(val, 13,14,15,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);  // 13-15
876       
875      if (!key_2a)        val = BITSWAP16(val, 13,14,15,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);  // 13-15
876
877877      if (!global_swap1)  val = BITSWAP16(val, 15,14,13,12, 9, 8,11,10, 7, 6, 5, 4, 3, 2, 1, 0);  // 11...8
878878      if (!key_5a)        val = BITSWAP16(val, 15,14,13,12,11,10, 9, 8, 4, 5, 7, 6, 3, 2, 1, 0);  // 7...4
879879      if (!global_swap0a) val = BITSWAP16(val, 15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 0, 3, 2, 1);  // 3...0
880880   }
881   
882    val = BITSWAP16(val, 12,15,14,13,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
883881
884    if ((val & 0xb080) == 0x8000) val ^= 0x4000;
885    if ((val & 0xf000) == 0xc000) val ^= 0x0080;
886    if ((val & 0xb100) == 0x0000) val ^= 0x4000;
882   val = BITSWAP16(val, 12,15,14,13,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
887883
884   if ((val & 0xb080) == 0x8000) val ^= 0x4000;
885   if ((val & 0xf000) == 0xc000) val ^= 0x0080;
886   if ((val & 0xb100) == 0x0000) val ^= 0x4000;
887
888888   // mask out opcodes doing PC-relative addressing, replace them with FFFF
889889   if ((m_masked_opcodes_lookup[key_F][val >> 4] >> ((val >> 1) & 7)) & 1)
890890      val = 0xffff;
trunk/src/mame/machine/ng_memcard.c
r31373r31374
2222
2323ng_memcard_device::ng_memcard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
2424   : device_t(mconfig, NG_MEMCARD, "NEOGEO Memory Card", tag, owner, clock, "ng_memcard", __FILE__),
25     device_image_interface(mconfig, *this)
25      device_image_interface(mconfig, *this)
2626{
2727}
2828
r31373r31374
6363   size_t ret = fread(m_memcard_data, 0x800);
6464   if(ret != 0x800)
6565      return IMAGE_INIT_FAIL;
66     
66
6767   return IMAGE_INIT_PASS;
6868}
6969
r31373r31374
7474}
7575
7676bool ng_memcard_device::call_create(int format_type, option_resolution *format_options)
77{   
77{
7878   memset(m_memcard_data, 0, 0x800);
79   
79
8080   size_t ret = fwrite(m_memcard_data, 0x800);
8181   if(ret != 0x800)
8282      return IMAGE_INIT_FAIL;
83   
83
8484   return IMAGE_INIT_PASS;
8585}
8686
r31373r31374
9393WRITE8_MEMBER(ng_memcard_device::write)
9494{
9595   m_memcard_data[offset] = data;
96}
No newline at end of file
96}
trunk/src/mame/machine/tigeroad.c
r31373r31374
209209      m_new_latch = 1;
210210   }
211211   m_shared_ram[offset] = data;
212}
No newline at end of file
212}
trunk/src/mame/machine/midwayic.c
r31373r31374
225225   m_time_index(0),
226226   m_time_just_written(0),
227227   m_yearoffs(0),
228   m_time_write_timer(NULL)   
228   m_time_write_timer(NULL)
229229{
230230   memset(m_buffer,0,sizeof(m_buffer));
231231   memset(m_time_buf,0,sizeof(m_time_buf));
232232   memset(m_nvram,0,sizeof(m_nvram));
233233   memset(m_default_nvram,0,sizeof(m_default_nvram));
234   
234
235235}
236236
237237midway_serial_pic2_device::midway_serial_pic2_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
r31373r31374
241241   m_state(0),
242242   m_index(0),
243243   m_total(0),
244   m_nvram_addr(0),   
244   m_nvram_addr(0),
245245   m_time_index(0),
246246   m_time_just_written(0),
247247   m_yearoffs(0),
248   m_time_write_timer(NULL)   
248   m_time_write_timer(NULL)
249249{
250250   memset(m_buffer,0,sizeof(m_buffer));
251251   memset(m_time_buf,0,sizeof(m_time_buf));
r31373r31374
531531}
532532
533533void midway_serial_pic2_device::nvram_read(emu_file &file)
534{
534{
535535   file.read(m_nvram, sizeof(m_nvram));
536536}
537537
538void midway_serial_pic2_device::nvram_write(emu_file &file)
539{
538void midway_serial_pic2_device::nvram_write(emu_file &file)
539{
540540   file.write(m_nvram, sizeof(m_nvram));
541541}
542542
r31373r31374
608608   m_fifo_in(0),
609609   m_fifo_out(0),
610610   m_fifo_bytes(0),
611   m_fifo_force_buffer_empty_pc(0),   
611   m_fifo_force_buffer_empty_pc(0),
612612   m_cage(NULL),
613613   m_dcs(NULL)
614614{
r31373r31374
641641
642642   /* do we have a DCS2 sound chip connected? (most likely) */
643643   m_dcs = machine().device<dcs_audio_device>("dcs");
644   m_has_dcs = (m_dcs != NULL);     
644   m_has_dcs = (m_dcs != NULL);
645645   m_cage = machine().device<atari_cage_device>("cage");
646646   m_has_cage = (m_cage != NULL);
647   
647
648648   m_dcs_cpu = m_dcs->subdevice("dcs2");
649649   if (m_dcs_cpu == NULL)
650650      m_dcs_cpu = m_dcs->subdevice("dsio");
r31373r31374
665665   /* configure the fifo */
666666   if (m_has_dcs)
667667   {
668      m_dcs->set_fifo_callbacks(read16_delegate(FUNC(midway_ioasic_device::fifo_r),this),
669         read16_delegate(FUNC(midway_ioasic_device::fifo_status_r),this),
668      m_dcs->set_fifo_callbacks(read16_delegate(FUNC(midway_ioasic_device::fifo_r),this),
669         read16_delegate(FUNC(midway_ioasic_device::fifo_status_r),this),
670670         write_line_delegate(FUNC(midway_ioasic_device::fifo_reset_w),this));
671      m_dcs->set_io_callbacks(write_line_delegate(FUNC(midway_ioasic_device::ioasic_output_full),this),
671      m_dcs->set_io_callbacks(write_line_delegate(FUNC(midway_ioasic_device::ioasic_output_full),this),
672672         write_line_delegate(FUNC(midway_ioasic_device::ioasic_input_empty),this));
673673   }
674674   fifo_reset_w(1);
trunk/src/mame/machine/pcshare.c
r31373r31374
136136}
137137
138138
139 ADDRESS_MAP_START( pcat32_io_common, AS_IO, 32, pcat_base_state )
139   ADDRESS_MAP_START( pcat32_io_common, AS_IO, 32, pcat_base_state )
140140   AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", am9517a_device, read, write, 0xffffffff)
141141   AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_device, read, write, 0xffffffff)
142142   AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8254_device, read, write, 0xffffffff)
trunk/src/mame/machine/wpc_pic.c
r31373r31374
5151      v = v & 0xffffff;
5252      if(v == cmp)
5353         logerror("%s: Detected game id %03d\n", tag(), i);
54   }     
54   }
5555}
5656
5757WRITE8_MEMBER(wpc_pic_device::write)
trunk/src/mame/machine/archimds.c
r31373r31374
606606         ---- ---x I2C data
607607         */
608608         //if(data & 0x40)
609         //   popmessage("Muting sound, contact MAME/MESSdev");
609         //  popmessage("Muting sound, contact MAME/MESSdev");
610610         break;
611611
612612      case KART:
r31373r31374
761761                     case 0x18: return 0xff; // FDC latch B
762762                     case 0x40: return 0xff; // FDC latch A
763763                     case 0x50: return 0; //fdc type, new model returns 5 here
764                            case 0x70: return 0x0F;
765                            case 0x74: return 0xFF; // unknown
764                     case 0x70: return 0x0F;
765                     case 0x74: return 0xFF; // unknown
766766//                          case 0x78: /* joystick */
767767//                          case 0x7c:
768768                  }
r31373r31374
916916         visarea.max_y = (m_vidc_regs[VIDC_VBER] - m_vidc_regs[VIDC_VBSR]) * (m_vidc_interlace+1);
917917
918918         //logerror("Configuring: htotal %d vtotal %d border %d x %d display %d x %d\n",
919         //   m_vidc_regs[VIDC_HCR], m_vidc_regs[VIDC_VCR],
920         //   visarea.max_x, visarea.max_y,
921         //   m_vidc_regs[VIDC_HDER]-m_vidc_regs[VIDC_HDSR],m_vidc_regs[VIDC_VDER]-m_vidc_regs[VIDC_VDSR]+1);
919         //  m_vidc_regs[VIDC_HCR], m_vidc_regs[VIDC_VCR],
920         //  visarea.max_x, visarea.max_y,
921         //  m_vidc_regs[VIDC_HDER]-m_vidc_regs[VIDC_HDSR],m_vidc_regs[VIDC_VDER]-m_vidc_regs[VIDC_VDSR]+1);
922922
923923         /* FIXME: pixel clock */
924924         refresh = HZ_TO_ATTOSECONDS(pixel_rate[m_vidc_pixel_clk]*2) * m_vidc_regs[VIDC_HCR] * m_vidc_regs[VIDC_VCR];
trunk/src/mame/machine/bfm_bd1.c
r31373r31374
562562WRITE_LINE_MEMBER( bfm_bd1_t::sclk ) { shift_clock(state); }
563563WRITE_LINE_MEMBER( bfm_bd1_t::data ) { m_data = state; }
564564
565WRITE_LINE_MEMBER( bfm_bd1_t::por )
565WRITE_LINE_MEMBER( bfm_bd1_t::por )
566566{
567567   if (!state)
568568   {
trunk/src/mame/machine/wpc_out.c
r31373r31374
136136{
137137   gi_update();
138138   for(int i=0; i<gi_count; i++) {
139      //      fprintf(stderr, "gi[%d] = %d\n", i, gi_time[i]);
139      //      fprintf(stderr, "gi[%d] = %d\n", i, gi_time[i]);
140140      gi_time[i] = 0;
141141   }
142142}
trunk/src/mame/video/nmk16.c
r31373r31374
938938   m_tx_tilemap->draw(screen, bitmap, cliprect, 0,0);
939939   return 0;
940940}
941
942
trunk/src/mame/video/k001005.c
r31373r31374
110110{
111111   switch (param)
112112   {
113      case K001005_LIGHT_R:      m_light_r = value; break;
114      case K001005_LIGHT_G:      m_light_g = value; break;
115      case K001005_LIGHT_B:      m_light_b = value; break;
116      case K001005_AMBIENT_R:      m_ambient_r = value; break;
117      case K001005_AMBIENT_G:      m_ambient_g = value; break;
118      case K001005_AMBIENT_B:      m_ambient_b = value; break;
119      case K001005_FOG_R:         m_fog_r = value; break;
120      case K001005_FOG_G:         m_fog_g = value; break;
121      case K001005_FOG_B:         m_fog_b = value; break;
113      case K001005_LIGHT_R:       m_light_r = value; break;
114      case K001005_LIGHT_G:       m_light_g = value; break;
115      case K001005_LIGHT_B:       m_light_b = value; break;
116      case K001005_AMBIENT_R:     m_ambient_r = value; break;
117      case K001005_AMBIENT_G:     m_ambient_g = value; break;
118      case K001005_AMBIENT_B:     m_ambient_b = value; break;
119      case K001005_FOG_R:         m_fog_r = value; break;
120      case K001005_FOG_G:         m_fog_g = value; break;
121      case K001005_FOG_B:         m_fog_b = value; break;
122122      case K001005_FAR_Z:
123123      {
124124         UINT32 fz = value << 11;
r31373r31374
896896
897897void k001005_renderer::draw_scanline_2d_tex(INT32 scanline, const extent_t &extent, const k001005_polydata &extradata, int threadid)
898898{
899   //   int pal_chip = (extradata.texture_palette & 0x8) ? 1 : 0;
899   //  int pal_chip = (extradata.texture_palette & 0x8) ? 1 : 0;
900900   k001006_device *k001006 = downcast<k001006_device*>(m_k001006);
901901
902902   int tex_page = extradata.texture_page * 0x40000;
r31373r31374
999999
10001000void k001005_renderer::draw_scanline_tex(INT32 scanline, const extent_t &extent, const k001005_polydata &extradata, int threadid)
10011001{
1002//   int pal_chip = (extradata.texture_palette & 0x8) ? 1 : 0;
1002//  int pal_chip = (extradata.texture_palette & 0x8) ? 1 : 0;
10031003   k001006_device *k001006 = downcast<k001006_device*>(m_k001006);
10041004
10051005   int tex_page = extradata.texture_page * 0x40000;
r31373r31374
12591259      case 0x000:         // FIFO read, high 16 bits
12601260      {
12611261         //osd_printf_debug("FIFO_r0: %08X\n", m_fifo_read_ptr);
1262         UINT16 value = m_fifo[m_fifo_read_ptr] >> 16;     
1262         UINT16 value = m_fifo[m_fifo_read_ptr] >> 16;
12631263         return value;
12641264      }
12651265
r31373r31374
13701370         break;
13711371      }
13721372
1373      case 0x100:      break;
1373      case 0x100:     break;
13741374
13751375      case 0x101:     break;      // viewport x and width?
13761376      case 0x102:     break;      // viewport y and height?
r31373r31374
14521452
14531453void k001005_device::draw( bitmap_rgb32 &bitmap, const rectangle &cliprect )
14541454{
1455   m_renderer->draw(bitmap, cliprect);   
1455   m_renderer->draw(bitmap, cliprect);
14561456}
14571457
14581458void k001005_device::set_texel_chip(device_t &device, const char *tag)
14591459{
14601460   downcast<k001005_device &>(device).m_k001006_tag = tag;
1461}
No newline at end of file
1461}
trunk/src/mame/video/excellent_spr.c
r31373r31374
1/*
2   Excellent Systems Sprite chip
1/*
2    Excellent Systems Sprite chip
33
44  is this original hw or a clone of something?
55
r31373r31374
5050
5151/****************************************************************
5252                     SPRITE DRAW ROUTINE
53                (8-bit)
53                    (8-bit)
5454
5555    Word |     Bit(s)      | Use
5656    -----+-----------------+-----------------
r31373r31374
7171
7272void excellent_spr_device::aquarium_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, gfxdecode_device *gfxdecode, int y_offs )
7373{
74
7574   int offs, chain_pos;
7675   int x, y, curx, cury;
7776   UINT8 col, flipx, flipy, chain;
r31373r31374
156155   UINT8 *spriteram = m_ram;
157156   int offs, chain_pos;
158157   int x, y, curx, cury;
159//   int priority = 0;
158//  int priority = 0;
160159   UINT8 col, flipx, flipy, chain;
161160   UINT16 code;
162161
r31373r31374
219218   }
220219#endif
221220}
222
trunk/src/mame/video/tecmo_mix.c
r31373r31374
3434
3535void tecmo_mix_device::device_start()
3636{
37
38
39
40
41
42
4337}
4438
4539void tecmo_mix_device::device_reset()
r31373r31374
133127         {
134128            if (m_sprpri == (0 ^ m_revspritetile)) // behind all
135129            {
136
137130               if (fgpixel & 0xf) // is the fg used?
138131               {
139132                  if (fgbln)
r31373r31374
180173                     }
181174                     else
182175                     {
183                        // fg is used and blended with opaque sprite                 
176                        // fg is used and blended with opaque sprite
184177                        dd[x] = paldata[fgpixel + m_fgblend_source] + paldata[sprpixel + m_spblend_comp];
185178                     }
186179                  }
r31373r31374
230223                  {
231224                     // blended sprite over solid bg pixel
232225                     dd[x] = paldata[bgpixel + m_bgblend_comp] + paldata[sprpixel + m_spblend_source];
233                  //   dd[x] =  rand();
226                  //  dd[x] =  rand();
234227                  }
235                 
236                 
237228
229
230
238231               }
239232               else
240233               {
r31373r31374
265258               {
266259                  // needs if bgpixel & 0xf check?
267260                  dd[x] = paldata[fgpixel + m_fgblend_source] + paldata[bgpixel + m_bgblend_comp];
268           
261
269262               }
270263               else
271264               {
272265                  dd[x] = paldata[fgpixel + m_fgregular_comp];
273266               }
274               
267
275268            }
276269            else if (bgpixel & 0x0f)
277270            {
r31373r31374
284277         }
285278      }
286279   }
287}
No newline at end of file
280}
trunk/src/mame/video/deco16ic.c
r31373r31374
189189      m_pf2_colour_bank(0),
190190      m_pf1_colourmask(0xf),
191191      m_pf2_colourmask(0xf),
192      m_pf12_8x8_gfx_bank(0),
192      m_pf12_8x8_gfx_bank(0),
193193      m_pf12_16x16_gfx_bank(0),
194194      m_gfxdecode(*this),
195195      m_palette(*this)
trunk/src/mame/video/pc090oj.c
r31373r31374
8080   m_ram(NULL),
8181   m_ram_buffered(0),
8282   m_gfxnum(0),
83   m_x_offset(0),
83   m_x_offset(0),
8484   m_y_offset(0),
8585   m_use_buffer(0),
8686   m_gfxdecode(*this),
trunk/src/mame/video/vulgus.c
r31373r31374
165165void vulgus_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
166166{
167167   gfx_element *gfx = m_gfxdecode->gfx(2);
168   
168
169169   for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
170170   {
171171      int code = m_spriteram[offs];
r31373r31374
174174      int sx = m_spriteram[offs + 3];
175175      bool flip = flip_screen() ? true : false;
176176      int dir = 1;
177     
177
178178      if (sy == 0)
179179         continue;
180     
180
181181      if (flip)
182182      {
183183         sx = 240 - sx;
trunk/src/mame/video/tc0480scp.c
r31373r31374
153153   m_dblwidth(0),
154154   m_gfxnum(0),
155155   m_txnum(0),
156   m_x_offset(0),
156   m_x_offset(0),
157157   m_y_offset(0),
158   m_text_xoffs(0),
158   m_text_xoffs(0),
159159   m_text_yoffs(0),
160   m_flip_xoffs(0),
160   m_flip_xoffs(0),
161161   m_flip_yoffs(0),
162162   m_col_base(0),
163163   m_gfxdecode(*this),
trunk/src/mame/video/tecmo_spr.c
r31373r31374
131131      }
132132
133133      if (enabled)
134      {           
134      {
135135         UINT32 flipx = (attributes & 1);
136136         UINT32 flipy = (attributes & 2);
137137
r31373r31374
183183         // this contains the blend bit and the priority bits, the spbactn proto uses 0x0300 for priority, spbactn uses 0x0030, others use 0x00c0
184184         color |= (source[attributes_word] & 0x03f0);
185185         bitmap = &sprite_bitmap;
186   
187186
187
188188         for (row = 0; row < sizey; row++)
189189         {
190190            for (col = 0; col < sizex; col++)
r31373r31374
198198                  flipx, flipy,
199199                  sx, sy,
200200                  0);
201               
201
202202            }
203         }   
203         }
204204      }
205205      source += sourceinc;
206206   }
r31373r31374
214214 *  byte     bit        usage
215215 * --------+-76543210-+----------------
216216         0 | xxxxx--- | bank / upper tile bits
217         | -----x-- | enable
218         | ------x- | flip y
219         | -------x | flip x
220       1 | xxxxxxxx | tile number (low bits)
221       2 | ------xx | size
222       3 | xx-------| priority
223         | --x----- | upper y co-ord
224         | ---x---- | upper x co-ord
225         | ----xxxx | colour
226       4 | xxxxxxxx | ypos
227       5 | xxxxxxxx | xpos
228       6 | -------- |
229       7 | -------- |
217           | -----x-- | enable
218           | ------x- | flip y
219           | -------x | flip x
220         1 | xxxxxxxx | tile number (low bits)
221         2 | ------xx | size
222         3 | xx-------| priority
223           | --x----- | upper y co-ord
224           | ---x---- | upper x co-ord
225           | ----xxxx | colour
226         4 | xxxxxxxx | ypos
227         5 | xxxxxxxx | xpos
228         6 | -------- |
229         7 | -------- |
230230
231231*/
232232
r31373r31374
302302 *
303303 *  byte     bit        usage
304304 * --------+-76543210-+----------------
305   
306305
307306
307
308308*/
309309
310310
r31373r31374
326326            if (xpos >= 0x0300) xpos -= 0x0400;
327327
328328            flags = spriteram[offs+4];
329           
329
330330            int sizex = 1 << ((flags >> 0) & 3);
331331            int sizey = 1 << ((flags >> 2) & 3);
332332
r31373r31374
424424         }
425425      }
426426   }
427}
No newline at end of file
427}
trunk/src/mame/video/k001006.c
r31373r31374
3131
3232void k001006_device::device_config_complete()
3333{
34
3534}
3635
3736//-------------------------------------------------
r31373r31374
4645
4746   m_gfxrom = machine().root_device().memregion(m_gfx_region)->base();
4847   m_texrom = auto_alloc_array(machine(), UINT8, 0x800000);
49   
48
5049   preprocess_texture_data(m_texrom, m_gfxrom, 0x800000, m_tex_layout);
5150
5251   save_pointer(NAME(m_pal_ram), 0x800*sizeof(UINT16));
trunk/src/mame/video/cps1.c
r31373r31374
12831283
12841284 Dedicated input pins
12851285
1286pin 1   = I0;  Input
1287pin 2   = I1;  Input
1288pin 3   = I2;  Input
1289pin 4   = I3;  Input
1290pin 5   = I4;  Input
1291pin 6   = I5;  Input
1292pin 7   = I6;  Input
1293pin 8   = I7;  Input
1294pin 9   = I8;  Input
1295pin 11  = I9;  Input
1286pin 1   = I0;  Input
1287pin 2   = I1;  Input
1288pin 3   = I2;  Input
1289pin 4   = I3;  Input
1290pin 5   = I4;  Input
1291pin 6   = I5;  Input
1292pin 7   = I6;  Input
1293pin 8   = I7;  Input
1294pin 9   = I8;  Input
1295pin 11  = I9;  Input
12961296
1297 Programmable output pins
1297 Programmable output pins
12981298
1299pin 12  = B0;  Combinatorial output
1300pin 13  = B1;  Combinatorial output
1301pin 14  = B2;  Combinatorial output
1302pin 15  = B3;  Combinatorial output
1303pin 16  = B4;  Combinatorial output
1304pin 17  = B5;  Combinatorial output
1305pin 18  = B6;  Combinatorial output
1306pin 19  = B7;  Combinatorial output
1299pin 12  = B0;  Combinatorial output
1300pin 13  = B1;  Combinatorial output
1301pin 14  = B2;  Combinatorial output
1302pin 15  = B3;  Combinatorial output
1303pin 16  = B4;  Combinatorial output
1304pin 17  = B5;  Combinatorial output
1305pin 18  = B6;  Combinatorial output
1306pin 19  = B7;  Combinatorial output
13071307
1308 Output equations
1308 Output equations
13091309
1310!B7 = !I0 & !I1 & !I2 & !I3 & !I4 & !I5 & !I9
1310!B7 = !I0 & !I1 & !I2 & !I3 & !I4 & !I5 & !I9
13111311    #  I0 & !I1 & !I2 & !I3 & !I4 & !I5 &  I9;
1312!B6 = !I0 & !I1 & !I2 & !I3 & !I4 & !I5 & !I9
1312!B6 = !I0 & !I1 & !I2 & !I3 & !I4 & !I5 & !I9
13131313    #  I0 & !I1 & !I2 & !I3 & !I4 & !I5 &  I9;
1314!B5 = !I0 & !I1 & !I2 & !I3 & !I4 &  I5 & !I9
1314!B5 = !I0 & !I1 & !I2 & !I3 & !I4 &  I5 & !I9
13151315    #  I0 & !I1 & !I2 & !I3 & !I4 &  I5 &  I9;
1316!B4 = !I0 & !I1 & !I2 & !I3 & !I4 &  I5 & !I9
1316!B4 = !I0 & !I1 & !I2 & !I3 & !I4 &  I5 & !I9
13171317    #  I0 & !I1 & !I2 & !I3 & !I4 &  I5 &  I9;
1318!B3 = !I0 & !I1 & !I2 & !I3 &  I4 & !I5 & !I6 & !I7 & !I8 & !I9
1319    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 & !I8 & !I9
1320    # !I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 & !I8 & !I9
1321    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 & !I8 & !I9
1322    # !I0 & !I1 & !I2 &  I3 & !I4 & !I5 & !I6 & !I7 &  I8 & !I9
1323    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 &  I8 & !I9
1324    # !I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 &  I8 & !I9
1325    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 &  I8 & !I9
1326    #  I0 & !I1 & !I2 & !I3 &  I4 & !I5 & !I6 & !I7 & !I8 &  I9
1327    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 & !I8 &  I9
1328    #  I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 & !I8 &  I9
1329    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 & !I8 &  I9
1330    #  I0 & !I1 & !I2 &  I3 & !I4 & !I5 & !I6 & !I7 &  I8 &  I9
1331    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 &  I8 &  I9
1332    #  I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 &  I8 &  I9
1318!B3 = !I0 & !I1 & !I2 & !I3 &  I4 & !I5 & !I6 & !I7 & !I8 & !I9
1319    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 & !I8 & !I9
1320    # !I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 & !I8 & !I9
1321    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 & !I8 & !I9
1322    # !I0 & !I1 & !I2 &  I3 & !I4 & !I5 & !I6 & !I7 &  I8 & !I9
1323    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 &  I8 & !I9
1324    # !I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 &  I8 & !I9
1325    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 &  I8 & !I9
1326    #  I0 & !I1 & !I2 & !I3 &  I4 & !I5 & !I6 & !I7 & !I8 &  I9
1327    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 & !I8 &  I9
1328    #  I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 & !I8 &  I9
1329    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 & !I8 &  I9
1330    #  I0 & !I1 & !I2 &  I3 & !I4 & !I5 & !I6 & !I7 &  I8 &  I9
1331    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 &  I8 &  I9
1332    #  I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 &  I8 &  I9
13331333    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 &  I8 &  I9;
1334!B2 = !I0 & !I1 & !I2 & !I3 &  I4 & !I5 & !I6 & !I7 & !I8 & !I9
1335    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 & !I8 & !I9
1336    # !I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 & !I8 & !I9
1337    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 & !I8 & !I9
1338    # !I0 & !I1 & !I2 &  I3 & !I4 & !I5 & !I6 & !I7 &  I8 & !I9
1339    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 &  I8 & !I9
1340    # !I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 &  I8 & !I9
1341    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 &  I8 & !I9
1342    #  I0 & !I1 & !I2 & !I3 &  I4 & !I5 & !I6 & !I7 & !I8 &  I9
1343    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 & !I8 &  I9
1344    #  I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 & !I8 &  I9
1345    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 & !I8 &  I9
1346    #  I0 & !I1 & !I2 &  I3 & !I4 & !I5 & !I6 & !I7 &  I8 &  I9
1347    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 &  I8 &  I9
1348    #  I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 &  I8 &  I9
1334!B2 = !I0 & !I1 & !I2 & !I3 &  I4 & !I5 & !I6 & !I7 & !I8 & !I9
1335    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 & !I8 & !I9
1336    # !I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 & !I8 & !I9
1337    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 & !I8 & !I9
1338    # !I0 & !I1 & !I2 &  I3 & !I4 & !I5 & !I6 & !I7 &  I8 & !I9
1339    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 &  I8 & !I9
1340    # !I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 &  I8 & !I9
1341    # !I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 &  I8 & !I9
1342    #  I0 & !I1 & !I2 & !I3 &  I4 & !I5 & !I6 & !I7 & !I8 &  I9
1343    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 & !I8 &  I9
1344    #  I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 & !I8 &  I9
1345    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 & !I8 &  I9
1346    #  I0 & !I1 & !I2 &  I3 & !I4 & !I5 & !I6 & !I7 &  I8 &  I9
1347    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 &  I8 &  I9
1348    #  I0 & !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 &  I8 &  I9
13491349    #  I0 & !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 &  I8 &  I9;
1350!B1 = !I1 & !I2 & !I3 &  I4 & !I5 & !I6 & !I7 & !I8
1351    # !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 & !I8
1352    # !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 & !I8
1353    # !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 & !I8
1354    # !I1 & !I2 &  I3 & !I4 & !I5 & !I6 & !I7 &  I8
1355    # !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 &  I8
1356    # !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 &  I8
1350!B1 = !I1 & !I2 & !I3 &  I4 & !I5 & !I6 & !I7 & !I8
1351    # !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 & !I8
1352    # !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 & !I8
1353    # !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 & !I8
1354    # !I1 & !I2 &  I3 & !I4 & !I5 & !I6 & !I7 &  I8
1355    # !I1 &  I2 & !I3 & !I4 & !I5 &  I6 & !I7 &  I8
1356    # !I1 &  I2 &  I3 & !I4 & !I5 & !I6 &  I7 &  I8
13571357    # !I1 &  I2 & !I3 & !I4 & !I5 &  I6 &  I7 &  I8;
13581358!B0 =  I0 &  I9;
13591359
r31373r31374
15821582
15831583   /* CPS1 board + extra support boards */
15841584
1585   {"kenseim",     CPS_B_21_DEF, mapper_KNM10B },   // wrong, need to convert equations from PAL
1585   {"kenseim",     CPS_B_21_DEF, mapper_KNM10B },  // wrong, need to convert equations from PAL
15861586
15871587   {0}     /* End of table */
15881588};
trunk/src/mame/video/dkong.c
r31373r31374
926926   save_item(NAME(m_flip));
927927
928928   // TRS01 TRS02
929    save_item(NAME(m_sig30Hz));
930    save_item(NAME(m_blue_level));
931    save_item(NAME(m_cv1));
932    save_item(NAME(m_cv2));
933    save_item(NAME(m_vg1));
934    save_item(NAME(m_vg2));
935    save_item(NAME(m_vg3));
936    save_item(NAME(m_cv3));
937    save_item(NAME(m_cv4));
929   save_item(NAME(m_sig30Hz));
930   save_item(NAME(m_blue_level));
931   save_item(NAME(m_cv1));
932   save_item(NAME(m_cv2));
933   save_item(NAME(m_vg1));
934   save_item(NAME(m_vg2));
935   save_item(NAME(m_vg3));
936   save_item(NAME(m_cv3));
937   save_item(NAME(m_cv4));
938938
939    save_item(NAME(m_lfsr_5I));
940    save_item(NAME(m_grid_sig));
941    save_item(NAME(m_rflip_sig));
942    save_item(NAME(m_star_ff));
943    save_item(NAME(m_counter));
944    save_item(NAME(m_pixelcnt));
945    save_item(NAME(m_bg_bits));
939   save_item(NAME(m_lfsr_5I));
940   save_item(NAME(m_grid_sig));
941   save_item(NAME(m_rflip_sig));
942   save_item(NAME(m_star_ff));
943   save_item(NAME(m_counter));
944   save_item(NAME(m_pixelcnt));
945   save_item(NAME(m_bg_bits));
946946
947947}
948948
trunk/src/mame/video/wpc_dmd.c
r31373r31374
153153         base++;
154154      }
155155   }
156   
156
157157   cur_scanline = (cur_scanline+1) & 0x1f;
158158   scanline_cb(cur_scanline == (firq_scanline & 0x1f));
159159}
trunk/src/mame/video/k054338.c
r31373r31374
111111// Unified k054338/K055555 BG color fill (see p.67)
112112void k054338_device::fill_backcolor(bitmap_rgb32 &bitmap, const rectangle &cliprect, const pen_t *pal_ptr, int mode)
113113{
114   if ((mode & 0x02) == 0)   // solid fill
114   if ((mode & 0x02) == 0) // solid fill
115115   {
116116      bitmap.fill(*pal_ptr, cliprect);
117117   }
r31373r31374
120120      UINT32 *dst_ptr = &bitmap.pix32(cliprect.min_y);
121121      int dst_pitch = bitmap.rowpixels();
122122
123      if ((mode & 0x01) == 0)   // vertical gradient fill
123      if ((mode & 0x01) == 0) // vertical gradient fill
124124      {
125125         pal_ptr += cliprect.min_y;
126126         for(int y = cliprect.min_y; y <= cliprect.max_y; y++)
r31373r31374
134134            dst_ptr += dst_pitch;
135135         }
136136      }
137      else   // horizontal gradient fill
137      else    // horizontal gradient fill
138138      {
139139         int width = cliprect.width() * sizeof(UINT32);
140140         pal_ptr += cliprect.min_x;
trunk/src/mame/video/konamigx.c
r31373r31374
11951195VIDEO_START_MEMBER(konamigx_state, konamigx_5bpp)
11961196{
11971197   common_init();
1198   
1198
11991199   if (!strcmp(machine().system().name,"tbyahhoo"))
12001200      gx_tilemode = 1;
12011201   else if (!strcmp(machine().system().name,"crzcross") || !strcmp(machine().system().name,"puzldama"))
trunk/src/mame/video/gaiden.c
r31373r31374
7777   m_foreground = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(gaiden_state::get_fg_tile_info_raiga),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 32);
7878   m_text_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(gaiden_state::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
7979
80//   m_background->set_transparent_pen(0);
81//   m_foreground->set_transparent_pen(0);
80//  m_background->set_transparent_pen(0);
81//  m_foreground->set_transparent_pen(0);
8282   m_text_layer->set_transparent_pen(0);
8383
8484   m_background->set_scrolldy(0, 33);
r31373r31374
104104   m_foreground = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(gaiden_state::get_fg_tile_info_raiga),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 32);
105105   m_text_layer = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(gaiden_state::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
106106
107//   m_background->set_transparent_pen(0);
108//   m_foreground->set_transparent_pen(0);
107//  m_background->set_transparent_pen(0);
108//  m_foreground->set_transparent_pen(0);
109109   m_text_layer->set_transparent_pen(0);
110110
111111   /* set up sprites */
trunk/src/mame/video/k051960.c
r31373r31374
136136      case K051960_PLANEORDER_BASE:
137137         device_gfx_interface::static_set_info(dev, gfxinfo);
138138         break;
139         
139
140140      case K051960_PLANEORDER_MIA:
141141         device_gfx_interface::static_set_info(dev, gfxinfo_reverse);
142142         break;
143         
143
144144      case K051960_PLANEORDER_GRADIUS3:
145145         device_gfx_interface::static_set_info(dev, gfxinfo_gradius3);
146146         break;
147         
147
148148      default:
149149         fatalerror("Unknown plane_order\n");
150150   }
r31373r31374
166166      popmessage("driver should use VIDEO_HAS_SHADOWS");
167167
168168   m_ram = auto_alloc_array_clear(machine(), UINT8, 0x400);
169   
169
170170   // bind callbacks
171171   m_k051960_cb.bind_relative_to(*owner());
172   
172
173173   save_item(NAME(m_romoffset));
174174   save_item(NAME(m_spriteflip));
175175   save_item(NAME(m_readroms));
trunk/src/mame/video/armedf.c
r31373r31374
128128
129129   m_text_videoram = auto_alloc_array(machine(), UINT8, 0x1000);
130130   memset(m_text_videoram, 0x00, 0x1000);
131   
131
132132   save_pointer(NAME(m_text_videoram), 0x1000);
133133}
134134
r31373r31374
150150
151151   m_text_videoram = auto_alloc_array(machine(), UINT8, 0x1000);
152152   memset(m_text_videoram, 0x00, 0x1000);
153   
153
154154   save_pointer(NAME(m_text_videoram), 0x1000);
155155}
156156
trunk/src/mame/video/k054156_k054157_k056832.c
r31373r31374
377377   create_tilemaps(machine());
378378
379379   finalize_init(machine());
380   
380
381381   // bind callbacks
382382   m_k056832_cb.bind_relative_to(*owner());
383383}
r31373r31374
25722572{
25732573   return(m_layer_association);
25742574}
2575
trunk/src/mame/video/k053246_k053247_k055673.c
r31373r31374
965965{
966966   int gfx_index;
967967   UINT32 total;
968   
968
969969   static const gfx_layout spritelayout =  /* System GX sprite layout */
970970   {
971971      16,16,
r31373r31374
10131013   long i;
10141014   UINT16 *alt_k055673_rom;
10151015   int size4;
1016   
1016
10171017   /* find first empty slot to decode gfx */
10181018   for (gfx_index = 0; gfx_index < MAX_GFX_ELEMENTS; gfx_index++)
10191019      if (m_gfxdecode->gfx(gfx_index) == 0)
10201020         break;
10211021   assert(gfx_index != MAX_GFX_ELEMENTS);
1022   
1022
10231023   alt_k055673_rom = (UINT16 *)machine().root_device().memregion(m_memory_region)->base();
1024   
1024
10251025   /* decode the graphics */
10261026   switch (m_plane_order)
10271027   {
r31373r31374
10421042            *d++ = *s1++;
10431043            *d++ = *s2++;
10441044         }
1045         
1045
10461046         total = size4 / 128;
10471047         konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, (UINT8 *)alt_k055673_rom, total, &spritelayout, 5);
10481048         break;
1049         
1049
10501050      case K055673_LAYOUT_RNG:
10511051         total = machine().root_device().memregion(m_memory_region)->bytes() / (16*16/2);
10521052         konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, (UINT8 *)alt_k055673_rom, total, &spritelayout2, 4);
10531053         break;
1054         
1054
10551055      case K055673_LAYOUT_LE2:
10561056         total = machine().root_device().memregion(m_memory_region)->bytes() / (16*16);
10571057         konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, (UINT8 *)alt_k055673_rom, total, &spritelayout3, 8);
10581058         break;
1059         
1059
10601060      case K055673_LAYOUT_GX6:
10611061         total = machine().root_device().memregion(m_memory_region)->bytes() / (16*16*6/8);
10621062         konami_decode_gfx(machine(), m_gfxdecode, m_palette, gfx_index, (UINT8 *)alt_k055673_rom, total, &spritelayout4, 6);
10631063         break;
1064         
1064
10651065      default:
10661066         fatalerror("Unsupported layout\n");
10671067   }
1068   
1068
10691069   if (VERBOSE && !(m_palette->shadows_enabled()))
10701070      popmessage("driver should use VIDEO_HAS_SHADOWS");
1071   
1071
10721072   m_z_rejection = -1;
10731073   m_gfx = m_gfxdecode->gfx(gfx_index);
10741074   m_objcha_line = CLEAR_LINE;
10751075   m_ram = auto_alloc_array(machine(), UINT16, 0x1000/2);
1076   
1076
10771077   memset(m_ram,  0, 0x1000);
10781078   memset(m_kx46_regs, 0, 8);
10791079   memset(m_kx47_regs, 0, 32);
1080   
1080
10811081   machine().save().save_pointer(NAME(m_ram), 0x800);
10821082   machine().save().save_item(NAME(m_kx46_regs));
10831083   machine().save().save_item(NAME(m_kx47_regs));
r31373r31374
12581258   offset <<= 1;
12591259   return (k053247_reg_word_r( space, offset + 1, 0xffff) | k053247_reg_word_r( space, offset, 0xffff) << 16);
12601260}
1261
trunk/src/mame/video/mb60553.c
r31373r31374
1/* This is the tilemap chip used by Grand Striker, Tecmo World Cup '94 and V Goal Soccer for the backgrounds
1/* This is the tilemap chip used by Grand Striker, Tecmo World Cup '94 and V Goal Soccer for the backgrounds
22
3  the actual line scroll / zoom is not properly understood
3  the actual line scroll / zoom is not properly understood
44
55  interestingly the chip seems to require doubled up ROMs (2 copies of each ROM) to draw just the single layer.
66
r31373r31374
3838
3939void mb60553_zooming_tilemap_device::device_reset()
4040{
41
4241}
4342
4443
r31373r31374
119118
120119void mb60553_zooming_tilemap_device::reg_written( int num_reg)
121120{
122
123121   switch (num_reg)
124122   {
125123   case 0:
r31373r31374
338336{
339337   return m_lineram[offset];
340338}
341
342
343
trunk/src/mame/video/nitedrvr.c
r31373r31374
5252UINT32 nitedrvr_state::screen_update_nitedrvr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
5353{
5454   bitmap.fill(0, cliprect);
55   
55
5656   // don't wrap playfield
5757   rectangle clip = cliprect;
5858   if (clip.max_y > 31) clip.max_y = 31;
trunk/src/mame/video/galspnbl.c
r31373r31374
4646         UINT16 sprpixel = (sd2[x]);
4747         //UINT16 sprpri = (sprpixel >> 8) & 3;
4848         UINT16 sprpri = (sprpixel >> 9) & 1; // only upper priority bit matters on the bootleg hw?
49         
49
5050         sprpixel &= 0xff;
5151
5252         if (sprpixel & 0xf)
r31373r31374
5555               dd[x] = sprpixel;
5656         }
5757
58         //   UINT16 sprbln = (sprpixel >> 10) & 1; // we handle 'blending' from the original as a simple on/off flicker in the bootleg sprite function, I don't think the bootleg hw can blend
58         //  UINT16 sprbln = (sprpixel >> 10) & 1; // we handle 'blending' from the original as a simple on/off flicker in the bootleg sprite function, I don't think the bootleg hw can blend
5959      }
6060   }
6161}
trunk/src/mame/video/k051316.c
r31373r31374
243243
244244***************************************************************************/
245245
246TILE_GET_INFO_MEMBER(k051316_device::get_tile_info)
247{
246TILE_GET_INFO_MEMBER(k051316_device::get_tile_info)
247{
248248   int code = m_ram[tile_index];
249249   int color = m_ram[tile_index + 0x400];
250250   int flags = 0;
251   
251
252252   m_k051316_cb(&code, &color, &flags);
253   
253
254254   SET_TILE_INFO_MEMBER(0,
255                   code,
256                   color,
257                   flags);   
255                     code,
256                     color,
257                     flags);
258258}
259259
260260
trunk/src/mame/video/k052109.c
r31373r31374
220220   m_videoram2_F = &m_ram[0x4000];
221221   m_videoram2_A = &m_ram[0x4800];
222222   m_videoram2_B = &m_ram[0x5000];
223   
223
224224   m_tilemap[0] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k052109_device::get_tile_info0),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
225225   m_tilemap[1] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k052109_device::get_tile_info1),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
226226   m_tilemap[2] = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(k052109_device::get_tile_info2),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
227   
227
228228   m_tilemap[0]->set_transparent_pen(0);
229229   m_tilemap[1]->set_transparent_pen(0);
230230   m_tilemap[2]->set_transparent_pen(0);
231   
231
232232   // bind callbacks
233233   m_k052109_cb.bind_relative_to(*owner());
234   
234
235235   save_pointer(NAME(m_ram), 0x6000);
236236   save_item(NAME(m_rmrd_line));
237237   save_item(NAME(m_romsubbank));
r31373r31374
292292   else    /* Punk Shot and TMNT read from 0000-1fff, Aliens from 2000-3fff */
293293   {
294294      assert (m_char_size != 0);
295     
295
296296      int code = (offset & 0x1fff) >> 5;
297297      int color = m_romsubbank;
298298      int flags = 0;
trunk/src/mame/video/tc0080vco.c
r31373r31374
9797   m_flipscreen(0),
9898   m_gfxnum(0),
9999   m_txnum(0),
100   m_bg_xoffs(0),
100   m_bg_xoffs(0),
101101   m_bg_yoffs(0),
102102   m_bg_flip_yoffs(0),
103103   m_has_fg0(1),
trunk/src/mame/video/neogeo_spr.c
r31373r31374
99
1010/*
1111neosprite_base_device::neosprite_base_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
12   : device_t(mconfig, NEOGEO_SPRITE_BASE, "Neogeo Sprites", tag, owner, clock, "neospritebase", __FILE__),
13   m_bppshift(4)
12    : device_t(mconfig, NEOGEO_SPRITE_BASE, "Neogeo Sprites", tag, owner, clock, "neospritebase", __FILE__),
13    m_bppshift(4)
1414{
1515
1616}
r31373r31374
2020   : device_t(mconfig, type, "Neogeo Sprites", tag, owner, clock, "neosprite", __FILE__),
2121   m_bppshift(4)
2222{
23
2423}
2524
2625void neosprite_base_device::device_start()
2726{
28
2927   m_videoram = auto_alloc_array(machine(), UINT16, 0x8000 + 0x800);
3028   m_videoram_drawsource = m_videoram;
3129
r31373r31374
235233         int gfx_offset = ((code << 5) | (scanline & 0x07)) & addr_mask;
236234
237235         const pen_t *char_pens;
238         
236
239237         char_pens = &m_pens[code_and_palette >> 12 << m_bppshift];
240238
241239
r31373r31374
355353      {
356354         y = 0x200 - (y_control >> 7);
357355         x = m_videoram_drawsource[0x8400 | sprite_number] >> 7;
358         
356
359357         zoom_y = (zoom_control & 0xff);
360358
361359         zoom_x = (zoom_control >> 8) & 0x0f;
r31373r31374
430428
431429         /* compute offset in gfx ROM and mask it to the number of bits available */
432430         int gfx_base = ((code << 8) | (sprite_y << 4)) & m_sprite_gfx_address_mask;
433         
434431
432
435433         line_pens = &m_pens[attr >> 8 << m_bppshift];
436434
437435
r31373r31374
656654neosprite_regular_device::neosprite_regular_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
657655   : neosprite_base_device(mconfig, tag, owner, clock, NEOGEO_SPRITE_REGULAR)
658656{
659
660657}
661658
662659
r31373r31374
675672   {
676673      fatalerror("please use power of 2 region sizes with neosprite_base_device to ensure masking works correctly");
677674   }
678     
675
679676   m_sprite_gfx_address_mask = mask;
680677}
681678
r31373r31374
683680{
684681   const UINT8* src = m_region_sprites + (((romaddr &~0xff)>>1) | (((romaddr&0x8)^0x8)<<3) | ((romaddr & 0xf0)  >> 2));
685682   const int x = romaddr & 0x7;
686   
683
687684   const UINT8 gfx = (((src[0x3] >> x) & 0x01) << 3) |
688                  (((src[0x1] >> x) & 0x01) << 2) |
689                  (((src[0x2] >> x) & 0x01) << 1) |
690                  (((src[0x0] >> x) & 0x01) << 0);
685                  (((src[0x1] >> x) & 0x01) << 2) |
686                  (((src[0x2] >> x) & 0x01) << 1) |
687                  (((src[0x0] >> x) & 0x01) << 0);
691688
692689   if (gfx)
693690      *dst = line_pens[gfx];
r31373r31374
753750{
754751   const UINT8* src = m_region_sprites + (((romaddr &~0xff)) | (((romaddr&0x8)^0x8)<<4) | ((romaddr & 0xf0)  >> 1));
755752   const int x = romaddr & 0x7;
756   
757   const UINT8 gfx =   (((src[0x7] >> x) & 0x01) << 7) |
753
754   const UINT8 gfx =   (((src[0x7] >> x) & 0x01) << 7) |
758755                  (((src[0x6] >> x) & 0x01) << 6) |
759756                  (((src[0x5] >> x) & 0x01) << 5) |
760757                  (((src[0x4] >> x) & 0x01) << 4) |
r31373r31374
774771
775772   m_videoram_buffer = auto_alloc_array(machine(), UINT16, 0x8000 + 0x800);
776773   m_videoram_drawsource = m_videoram_buffer;
777   
774
778775   memset(m_videoram_buffer, 0x00, (0x8000 + 0x800) * sizeof(UINT16));
779776
780777}
r31373r31374
787784inline void neosprite_midas_device::draw_fixed_layer_2pixels(UINT32*&pixel_addr, int offset, UINT8* gfx_base, const pen_t* char_pens)
788785{
789786   UINT8 data;
790   
787
791788   data = ((gfx_base[(offset * 2)+0] & 0x0f)<<0) | ((gfx_base[(offset * 2)+1] & 0x0f)<<4);
792789   if (data)
793790      *pixel_addr = char_pens[data];
r31373r31374
806803   UINT32 mask = get_region_mask(m_region_sprites, m_region_sprites_size);
807804   m_sprite_gfx_address_mask = mask;
808805}
809
trunk/src/mame/video/deco_zoomspr.c
r31373r31374
188188                        UINT8 *pri = &pri_bitmap.pix8(y);
189189                        UINT32 *tmapcolor = &dest_bmp.pix32(y);
190190
191                       
191
192192                        int x, x_index = x_index_base;
193193                        for( x=sx; x<ex; x++ )
194194                        {
r31373r31374
279279   */
280280
281281   /* Sprite global disable bit - can't be, it's set in lockload calibration menu where the targets are sprites */
282//   if (dragngun_sprite_ctrl&0x40000000)
283//      return;
282//  if (dragngun_sprite_ctrl&0x40000000)
283//      return;
284284
285285   for (offs = 0;offs < 0x800;offs += 8)
286286   {
r31373r31374
316316      colour = spritedata[offs+6]&0x1f;
317317
318318      int priority = (spritedata[offs + 6] & 0x60) >> 5;
319     
320319
321     
322320
323//      printf("%02x\n", priority);
324     
321
322
323//      printf("%02x\n", priority);
324
325325      if (priority == 0) priority = 7;
326326      else if (priority == 1) priority = 7; // set to 1 to have the 'masking effect' with the dragon on the dragngun attract mode, but that breaks the player select where it needs to be 3, probably missing some bits..
327327      else if (priority == 2) priority = 7;
r31373r31374
415415            ypos+=zoomy<<4;
416416      }
417417   }
418     
418
419419   for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
420420   {
421421      UINT32 *src = &temp_bitmap.pix32(y);
r31373r31374
434434   }
435435
436436}
437
trunk/src/mame/video/model3.c
r31373r31374
718718{
719719   address_space &space = m_maincpu->space(AS_PROGRAM);
720720   int d = (dst & 0xffffff) / 4;
721   for (int i = 0; i < length; i += 4)
721   for (int i = 0; i < length; i += 4)
722722   {
723723      UINT32 w;
724724      if (byteswap) {
r31373r31374
735735{
736736   address_space &space = m_maincpu->space(AS_PROGRAM);
737737   int d = (dst & 0xffffff) / 4;
738   for (int i = 0; i < length; i += 4)
738   for (int i = 0; i < length; i += 4)
739739   {
740740      UINT32 w;
741741      if (byteswap) {
r31373r31374
768768void model3_state::real3d_texture_fifo_dma(UINT32 src, int length, int byteswap)
769769{
770770   address_space &space = m_maincpu->space(AS_PROGRAM);
771   for (int i = 0; i < length; i += 4)
771   for (int i = 0; i < length; i += 4)
772772   {
773773      UINT32 w;
774774      if (byteswap) {
r31373r31374
786786{
787787   address_space &space = m_maincpu->space(AS_PROGRAM);
788788   int d = (dst & 0xffffff) / 4;
789   for (int i = 0; i < length; i += 4)
789   for (int i = 0; i < length; i += 4)
790790   {
791791      UINT32 w;
792792      if (byteswap) {
trunk/src/mame/video/spbactn.c
r31373r31374
128128   m_fg_tilemap->draw(screen, m_tile_bitmap_fg, cliprect, 0, 0);
129129
130130   m_mixer->mix_bitmaps(screen, bitmap, cliprect, m_palette, &m_tile_bitmap_bg, &m_tile_bitmap_fg, (bitmap_ind16*)0, &m_sprite_bitmap);
131   
131
132132   return 0;
133133}
134134
trunk/src/mame/video/pc080sn.c
r31373r31374
5353   : device_t(mconfig, PC080SN, "Taito PC080SN", tag, owner, clock, "pc080sn", __FILE__),
5454   m_ram(NULL),
5555   m_gfxnum(0),
56   m_x_offset(0),
56   m_x_offset(0),
5757   m_y_offset(0),
5858   m_y_invert(0),
5959   m_dblwidth(0),
trunk/src/mame/video/decospr.c
r31373r31374
175175{
176176   m_pri_cb.bind_relative_to(*owner());
177177   m_col_cb.bind_relative_to(*owner());
178   
178
179179   m_alt_format = 0;
180180   m_pixmask = 0xf;
181181   m_raw_shift = 4; // set to 8 on tattass / nslashers for the custom mixing (because they have 5bpp sprites, and shifting by 4 isn't good enough)
trunk/src/mame/video/kaneko16.c
r31373r31374
196196   if (!m_bg15_bitmap[0].valid())
197197      return;
198198
199   int select   =   m_bg15_select[ 0 ];
200   int scroll   =   m_bg15_scroll[ 0 ];
199   int select  =   m_bg15_select[ 0 ];
200   int scroll  =   m_bg15_scroll[ 0 ];
201201
202   int screen   =   select & 0x1f;
203   int flip   =   select & 0x20;
202   int screen  =   select & 0x1f;
203   int flip    =   select & 0x20;
204204
205   int scrollx   =   (scroll >> 0) & 0xff;
206   int scrolly   =   (scroll >> 8) & 0xff;
205   int scrollx =   (scroll >> 0) & 0xff;
206   int scrolly =   (scroll >> 8) & 0xff;
207207
208208   if (!flip)
209209   {
r31373r31374
222222
223223   for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
224224   {
225      if (!flip)   srcbitmap = &m_bg15_bitmap[screen].pix16(        (y - scrolly) & 0xff  );
226      else      srcbitmap = &m_bg15_bitmap[screen].pix16( 255 - ((y - scrolly) & 0xff) );
225      if (!flip)  srcbitmap = &m_bg15_bitmap[screen].pix16(        (y - scrolly) & 0xff  );
226      else        srcbitmap = &m_bg15_bitmap[screen].pix16( 255 - ((y - scrolly) & 0xff) );
227227
228228      dstbitmap = &bitmap.pix32(y);
229229
r31373r31374
231231      {
232232         UINT16 pix;
233233
234         if (!flip)   pix = srcbitmap[        (x - scrollx) & 0xff  ];
235         else      pix = srcbitmap[ 255 - ((x - scrollx) & 0xff) ];
234         if (!flip)  pix = srcbitmap[        (x - scrollx) & 0xff  ];
235         else        pix = srcbitmap[ 255 - ((x - scrollx) & 0xff) ];
236236
237237         dstbitmap[x] = pal[pix];
238238      }
trunk/src/mame/video/k053936.c
r31373r31374
233233   m_ctrl(NULL),
234234   m_linectrl(NULL),
235235   m_wrap(0),
236   m_xoff(0),
236   m_xoff(0),
237237   m_yoff(0)
238238{
239239}
trunk/src/mame/video/gstriker.c
r31373r31374
1010UINT32 gstriker_state::screen_update_gstriker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
1111{
1212   bitmap.fill(m_mixerregs1[8]&0x07ff, cliprect); // complete guess, causes green behind test grid in twc94 and blue behind title screen on gstriker
13   
13
1414   popmessage("%04x %04x %04x %04x %04x %04x %04x %04x | %04x %04x %04x %04x %04x %04x %04x %04x", m_mixerregs1[0],m_mixerregs1[1],m_mixerregs1[2],m_mixerregs1[3],m_mixerregs1[4],m_mixerregs1[5],m_mixerregs1[6],m_mixerregs1[7],  m_mixerregs1[8],m_mixerregs1[9],m_mixerregs1[10],m_mixerregs1[11],m_mixerregs1[12],m_mixerregs1[13],m_mixerregs1[14],m_mixerregs1[15] );
15//   popmessage("%04x %04x %04x %04x %04x %04x %04x %04x | %04x %04x %04x %04x %04x %04x %04x %04x", m_mixerregs2[0],m_mixerregs2[1],m_mixerregs2[2],m_mixerregs2[3],m_mixerregs2[4],m_mixerregs2[5],m_mixerregs2[6],m_mixerregs2[7],  m_mixerregs2[8],m_mixerregs2[9],m_mixerregs2[10],m_mixerregs2[11],m_mixerregs2[12],m_mixerregs2[13],m_mixerregs2[14],m_mixerregs2[15] );
15//  popmessage("%04x %04x %04x %04x %04x %04x %04x %04x | %04x %04x %04x %04x %04x %04x %04x %04x", m_mixerregs2[0],m_mixerregs2[1],m_mixerregs2[2],m_mixerregs2[3],m_mixerregs2[4],m_mixerregs2[5],m_mixerregs2[6],m_mixerregs2[7],  m_mixerregs2[8],m_mixerregs2[9],m_mixerregs2[10],m_mixerregs2[11],m_mixerregs2[12],m_mixerregs2[13],m_mixerregs2[14],m_mixerregs2[15] );
1616
1717   m_spr->set_pal_base( (m_mixerregs1[0]&0xf000)>>8 );
1818   m_bg->set_pal_base( (m_mixerregs1[1]&0xf000)>>8 );
trunk/src/mame/video/tc0100scn.c
r31373r31374
143143   m_dblwidth(0),
144144   m_gfxnum(0),
145145   m_txnum(0),
146   m_x_offset(0),
146   m_x_offset(0),
147147   m_y_offset(0),
148   m_flip_xoffs(0),
148   m_flip_xoffs(0),
149149   m_flip_yoffs(0),
150   m_flip_text_xoffs(0),
150   m_flip_text_xoffs(0),
151151   m_flip_text_yoffs(0),
152152   m_multiscrn_xoffs(0),
153153   m_multiscrn_hack(0),
trunk/src/mame/video/mappy.c
r31373r31374
327327
328328   m_bg_tilemap->configure_groups(*m_gfxdecode->gfx(0), 31);
329329   m_bg_tilemap->set_scroll_cols(36);
330   
330
331331   save_item(NAME(m_scroll));
332332}
333333
trunk/src/mame/video/midzeus2.c
r31373r31374
13281328      logerror(" %08X", data[wordnum]);
13291329   logerror("%s", suffix);
13301330}
1331
trunk/src/mame/video/namcos21.c
r31373r31374
127127}
128128
129129
130/*   Palette:
131       0x0000..0x1fff  sprite palettes (0x10 sets of 0x100 colors)
130/*  Palette:
131        0x0000..0x1fff  sprite palettes (0x10 sets of 0x100 colors)
132132
133       0x2000..0x3fff  polygon palette bank0 (0x10 sets of 0x200 colors)
134           (in starblade, some palette animation effects are performed here)
133        0x2000..0x3fff  polygon palette bank0 (0x10 sets of 0x200 colors)
134            (in starblade, some palette animation effects are performed here)
135135
136       0x4000..0x5fff  polygon palette bank1 (0x10 sets of 0x200 colors)
136        0x4000..0x5fff  polygon palette bank1 (0x10 sets of 0x200 colors)
137137
138       0x6000..0x7fff  polygon palette bank2 (0x10 sets of 0x200 colors)
138        0x6000..0x7fff  polygon palette bank2 (0x10 sets of 0x200 colors)
139139
140       The polygon-dedicated color sets within a bank typically increase in
141       intensity from very dark to full intensity.
140        The polygon-dedicated color sets within a bank typically increase in
141        intensity from very dark to full intensity.
142142
143       Probably the selected palette is determined by most significant bits of z-code.
144       This is not yet hooked up.
145   */
143        Probably the selected palette is determined by most significant bits of z-code.
144        This is not yet hooked up.
145    */
146146
147147
148148UINT32 namcos21_state::screen_update_namcos21(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
trunk/src/mame/video/nemesis.c
r31373r31374
168168
169169void nemesis_state::create_palette_lookups()
170170{
171    // driver is 74LS09 (AND gates with open collector)
171   // driver is 74LS09 (AND gates with open collector)
172172
173173   static const res_net_info nemesis_net_info =
174174   {
trunk/src/mame/video/tetrisp2.c
r31373r31374
228228   // should be smaller and mirrored like m32 I guess
229229   m_priority = auto_alloc_array(machine(), UINT8, 0x40000);
230230   ms32_rearrange_sprites(machine(), "gfx1");
231   
231
232232   save_item(NAME(m_flipscreen_old));
233233   save_pointer(NAME(m_priority), 0x40000);
234234}
r31373r31374
254254   // should be smaller and mirrored like m32 I guess
255255   m_priority = auto_alloc_array(machine(), UINT8, 0x40000);
256256   ms32_rearrange_sprites(machine(), "gfx1");
257   
257
258258   save_item(NAME(m_flipscreen_old));
259259   save_pointer(NAME(m_priority), 0x40000);
260260}
trunk/src/mame/video/neogeo.c
r31373r31374
6767{
6868   const pen_t *pen_base = m_palette->pens() + m_palette_bank + (m_screen_shadow ? 0x2000 : 0);
6969   m_sprgen->set_pens(pen_base);
70   m_bg_pen = pen_base + 0xfff;
70   m_bg_pen = pen_base + 0xfff;
7171}
7272
7373
r31373r31374
104104   m_palette->set_pen_color(offset,
105105                        m_palette_lookup[r][dark],
106106                        m_palette_lookup[g][dark],
107                        m_palette_lookup[b][dark]);   // normal
107                        m_palette_lookup[b][dark]); // normal
108108
109109   m_palette->set_pen_color(offset + 0x2000,
110110                        m_palette_lookup[r][dark+2],
r31373r31374
147147
148148void neogeo_state::video_reset()
149149{
150
151150}
152151
153152
r31373r31374
274273      }
275274   }
276275}
277
278
trunk/src/tools/nltool.c
r31373r31374
6767
6868void report_bad_cast(const std::type_info &src_type, const std::type_info &dst_type)
6969{
70    printf("Error: bad downcast<> or device<>.  Tried to convert a %s to a %s, which are incompatible.\n",
71            src_type.name(), dst_type.name());
72    throw;
70   printf("Error: bad downcast<> or device<>.  Tried to convert a %s to a %s, which are incompatible.\n",
71         src_type.name(), dst_type.name());
72   throw;
7373}
7474
7575struct options_entry oplist[] =
trunk/src/tools/chdman.c
r31373r31374
243243         UINT8 *_dest = reinterpret_cast<UINT8 *>(dest);
244244
245245         for (int chdlba = 0; chdlba < lenlba; chdlba++)
246         {   
246         {
247247            // find current frame's track number
248248            int tracknum = m_toc->numtrks;
249249            for (int track = 0; track < m_toc->numtrks; track++)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team